diff --git a/docs/contributing/MODEL_MANAGER.md b/docs/contributing/MODEL_MANAGER.md new file mode 100644 index 0000000000..9d06366a23 --- /dev/null +++ b/docs/contributing/MODEL_MANAGER.md @@ -0,0 +1,1213 @@ +# Introduction to the Model Manager V2 + +The Model Manager is responsible for organizing the various machine +learning models used by InvokeAI. It consists of a series of +interdependent services that together handle the full lifecycle of a +model. These are the: + +* _ModelRecordServiceBase_ Responsible for managing model metadata and + configuration information. Among other things, the record service + tracks the type of the model, its provenance, and where it can be + found on disk. + +* _ModelLoadServiceBase_ Responsible for loading a model from disk + into RAM and VRAM and getting it ready for inference. + +* _DownloadQueueServiceBase_ A multithreaded downloader responsible + for downloading models from a remote source to disk. The download + queue has special methods for downloading repo_id folders from + Hugging Face, as well as discriminating among model versions in + Civitai, but can be used for arbitrary content. + +* _ModelInstallServiceBase_ A service for installing models to + disk. It uses `DownloadQueueServiceBase` to download models and + their metadata, and `ModelRecordServiceBase` to store that + information. It is also responsible for managing the InvokeAI + `models` directory and its contents. + +## Location of the Code + +All four of these services can be found in +`invokeai/app/services` in the following directories: + +* `invokeai/app/services/model_records/` +* `invokeai/app/services/downloads/` +* `invokeai/app/services/model_loader/` +* `invokeai/app/services/model_install/` + +With the exception of the install service, each of these is a thin +shell around a corresponding implementation located in +`invokeai/backend/model_manager`. The main difference between the +modules found in app services and those in the backend folder is that +the former add support for event reporting and are more tied to the +needs of the InvokeAI API. + +Code related to the FastAPI web API can be found in +`invokeai/app/api/routers/models.py`. + +*** + +## What's in a Model? The ModelRecordService + +The `ModelRecordService` manages the model's metadata. It supports a +hierarchy of pydantic metadata "config" objects, which become +increasingly specialized to support particular model types. + +### ModelConfigBase + +All model metadata classes inherit from this pydantic class. it +provides the following fields: + +| **Field Name** | **Type** | **Description** | +|----------------|-----------------|------------------| +| `key` | str | Unique identifier for the model | +| `name` | str | Name of the model (not unique) | +| `model_type` | ModelType | The type of the model | +| `model_format` | ModelFormat | The format of the model (e.g. "diffusers"); also used as a Union discriminator | +| `base_model` | BaseModelType | The base model that the model is compatible with | +| `path` | str | Location of model on disk | +| `original_hash` | str | Hash of the model when it was first installed | +| `current_hash` | str | Most recent hash of the model's contents | +| `description` | str | Human-readable description of the model (optional) | +| `source` | str | Model's source URL or repo id (optional) | + +The `key` is a unique 32-character random ID which was generated at +install time. The `original_hash` field stores a hash of the model's +contents at install time obtained by sampling several parts of the +model's files using the `imohash` library. Over the course of the +model's lifetime it may be transformed in various ways, such as +changing its precision or converting it from a .safetensors to a +diffusers model. When this happens, `original_hash` is unchanged, but +`current_hash` is updated to indicate the current contents. + +`ModelType`, `ModelFormat` and `BaseModelType` are string enums that +are defined in `invokeai.backend.model_manager.config`. They are also +imported by, and can be reexported from, +`invokeai.app.services.model_record_service`: + +``` +from invokeai.app.services.model_record_service import ModelType, ModelFormat, BaseModelType +``` + +The `path` field can be absolute or relative. If relative, it is taken +to be relative to the `models_dir` setting in the user's +`invokeai.yaml` file. + + +### CheckpointConfig + +This adds support for checkpoint configurations, and adds the +following field: + +| **Field Name** | **Type** | **Description** | +|----------------|-----------------|------------------| +| `config` | str | Path to the checkpoint's config file | + +`config` is the path to the checkpoint's config file. If relative, it +is taken to be relative to the InvokeAI root directory +(e.g. `configs/stable-diffusion/v1-inference.yaml`) + +### MainConfig + +This adds support for "main" Stable Diffusion models, and adds these +fields: + +| **Field Name** | **Type** | **Description** | +|----------------|-----------------|------------------| +| `vae` | str | Path to a VAE to use instead of the burnt-in one | +| `variant` | ModelVariantType| Model variant type, such as "inpainting" | + +`vae` can be an absolute or relative path. If relative, its base is +taken to be the `models_dir` directory. + +`variant` is an enumerated string class with values `normal`, +`inpaint` and `depth`. If needed, it can be imported if needed from +either `invokeai.app.services.model_record_service` or +`invokeai.backend.model_manager.config`. + +### ONNXSD2Config + +| **Field Name** | **Type** | **Description** | +|----------------|-----------------|------------------| +| `prediction_type` | SchedulerPredictionType | Scheduler prediction type to use, e.g. "epsilon" | +| `upcast_attention` | bool | Model requires its attention module to be upcast | + +The `SchedulerPredictionType` enum can be imported from either +`invokeai.app.services.model_record_service` or +`invokeai.backend.model_manager.config`. + +### Other config classes + +There are a series of such classes each discriminated by their +`ModelFormat`, including `LoRAConfig`, `IPAdapterConfig`, and so +forth. These are rarely needed outside the model manager's internal +code, but available in `invokeai.backend.model_manager.config` if +needed. There is also a Union of all ModelConfig classes, called +`AnyModelConfig` that can be imported from the same file. + +### Limitations of the Data Model + +The config hierarchy has a major limitation in its handling of the +base model type. Each model can only be compatible with one base +model, which breaks down in the event of models that are compatible +with two or more base models. For example, SD-1 VAEs also work with +SD-2 models. A partial workaround is to use `BaseModelType.Any`, which +indicates that the model is compatible with any of the base +models. This works OK for some models, such as the IP Adapter image +encoders, but is an all-or-nothing proposition. + +Another issue is that the config class hierarchy is paralleled to some +extent by a `ModelBase` class hierarchy defined in +`invokeai.backend.model_manager.models.base` and its subclasses. These +are classes representing the models after they are loaded into RAM and +include runtime information such as load status and bytes used. Some +of the fields, including `name`, `model_type` and `base_model`, are +shared between `ModelConfigBase` and `ModelBase`, and this is a +potential source of confusion. + +** TO DO: ** The `ModelBase` code needs to be revised to reduce the +duplication of similar classes and to support using the `key` as the +primary model identifier. + +## Reading and Writing Model Configuration Records + +The `ModelRecordService` provides the ability to retrieve model +configuration records from SQL or YAML databases, update them, and +write them back. + +A application-wide `ModelRecordService` is created during API +initialization and can be retrieved within an invocation from the +`InvocationContext` object: + +``` +store = context.services.model_record_store +``` + +or from elsewhere in the code by accessing +`ApiDependencies.invoker.services.model_record_store`. + +### Creating a `ModelRecordService` + +To create a new `ModelRecordService` database or open an existing one, +you can directly create either a `ModelRecordServiceSQL` or a +`ModelRecordServiceFile` object: + +``` +from invokeai.app.services.model_record_service import ModelRecordServiceSQL, ModelRecordServiceFile + +store = ModelRecordServiceSQL.from_connection(connection, lock) +store = ModelRecordServiceSQL.from_db_file('/path/to/sqlite_database.db') +store = ModelRecordServiceFile.from_db_file('/path/to/database.yaml') +``` + +The `from_connection()` form is only available from the +`ModelRecordServiceSQL` class, and is used to manage records in a +previously-opened SQLITE3 database using a `sqlite3.connection` object +and a `threading.lock` object. It is intended for the specific use +case of storing the record information in the main InvokeAI database, +usually `databases/invokeai.db`. + +The `from_db_file()` methods can be used to open new connections to +the named database files. If the file doesn't exist, it will be +created and initialized. + +As a convenience, `ModelRecordServiceBase` offers two methods, +`from_db_file` and `open`, which will return either a SQL or File +implementation depending on the context. The former looks at the file +extension to determine whether to open the file as a SQL database +(".db") or as a file database (".yaml"). If the file exists, but is +either the wrong type or does not contain the expected schema +metainformation, then an appropriate `AssertionError` will be raised: + +``` +store = ModelRecordServiceBase.from_db_file('/path/to/a/file.{yaml,db}') +``` + +The `ModelRecordServiceBase.open()` method is specifically designed +for use in the InvokeAI web server. Its signature is: + +``` +def open( + cls, + config: InvokeAIAppConfig, + conn: Optional[sqlite3.Connection] = None, + lock: Optional[threading.Lock] = None + ) -> Union[ModelRecordServiceSQL, ModelRecordServiceFile]: +``` + +The way it works is as follows: + +1. Retrieve the value of the `model_config_db` option from the user's + `invokeai.yaml` config file. +2. If `model_config_db` is `auto` (the default), then: + - Use the values of `conn` and `lock` to return a `ModelRecordServiceSQL` object + opened on the passed connection and lock. + - Open up a new connection to `databases/invokeai.db` if `conn` + and/or `lock` are missing (see note below). +3. If `model_config_db` is a Path, then use `from_db_file` + to return the appropriate type of ModelRecordService. +4. If `model_config_db` is None, then retrieve the legacy + `conf_path` option from `invokeai.yaml` and use the Path + indicated there. This will default to `configs/models.yaml`. + +So a typical startup pattern would be: + +``` +import sqlite3 +from invokeai.app.services.thread import lock +from invokeai.app.services.model_record_service import ModelRecordServiceBase +from invokeai.app.services.config import InvokeAIAppConfig + +config = InvokeAIAppConfig.get_config() +db_conn = sqlite3.connect(config.db_path.as_posix(), check_same_thread=False) +store = ModelRecordServiceBase.open(config, db_conn, lock) +``` + +_A note on simultaneous access to `invokeai.db`_: The current InvokeAI +service architecture for the image and graph databases is careful to +use a shared sqlite3 connection and a thread lock to ensure that two +threads don't attempt to access the database simultaneously. However, +the default `sqlite3` library used by Python reports using +**Serialized** mode, which allows multiple threads to access the +database simultaneously using multiple database connections (see +https://www.sqlite.org/threadsafe.html and +https://ricardoanderegg.com/posts/python-sqlite-thread-safety/). Therefore +it should be safe to allow the record service to open its own SQLite +database connection. Opening a model record service should then be as +simple as `ModelRecordServiceBase.open(config)`. + +### Fetching a Model's Configuration from `ModelRecordServiceBase` + +Configurations can be retrieved in several ways. + +#### get_model(key) -> AnyModelConfig: + +The basic functionality is to call the record store object's +`get_model()` method with the desired model's unique key. It returns +the appropriate subclass of ModelConfigBase: + +``` +model_conf = store.get_model('f13dd932c0c35c22dcb8d6cda4203764') +print(model_conf.path) + +>> '/tmp/models/ckpts/v1-5-pruned-emaonly.safetensors' + +``` + +If the key is unrecognized, this call raises an +`UnknownModelException`. + +#### exists(key) -> AnyModelConfig: + +Returns True if a model with the given key exists in the databsae. + +#### search_by_path(path) -> AnyModelConfig: + +Returns the configuration of the model whose path is `path`. The path +is matched using a simple string comparison and won't correctly match +models referred to by different paths (e.g. using symbolic links). + +#### search_by_name(name, base, type) -> List[AnyModelConfig]: + +This method searches for models that match some combination of `name`, +`BaseType` and `ModelType`. Calling without any arguments will return +all the models in the database. + +#### all_models() -> List[AnyModelConfig]: + +Return all the model configs in the database. Exactly equivalent to +calling `search_by_name()` with no arguments. + +#### search_by_tag(tags) -> List[AnyModelConfig]: + +`tags` is a list of strings. This method returns a list of model +configs that contain all of the given tags. Examples: + +``` +# find all models that are marked as both SFW and as generating +# background scenery +configs = store.search_by_tag(['sfw', 'scenery']) +``` + +Note that only tags are not searchable in this way. Other fields can +be searched using a filter: + +``` +commercializable_models = [x for x in store.all_models() \ + if x.license.contains('allowCommercialUse=Sell')] +``` + +#### version() -> str: + +Returns the version of the database, currently at `3.2` + +#### model_info_by_name(name, base_model, model_type) -> ModelConfigBase: + +This method exists to ease the transition from the previous version of +the model manager, in which `get_model()` took the three arguments +shown above. This looks for a unique model identified by name, base +model and model type and returns it. + +The method will generate a `DuplicateModelException` if there are more +than one models that share the same type, base and name. While +unlikely, it is certainly possible to have a situation in which the +user had added two models with the same name, base and type, one +located at path `/foo/my_model` and the other at `/bar/my_model`. It +is strongly recommended to search for models using `search_by_name()`, +which can return multiple results, and then to select the desired +model and pass its key to `get_model()`. + +### Writing model configs to the database + +Several methods allow you to create and update stored model config +records. + +#### add_model(key, config) -> ModelConfigBase: + +Given a key and a configuration, this will add the model's +configuration record to the database. `config` can either be a subclass of +`ModelConfigBase` (i.e. any class listed in `AnyModelConfig`), or a +`dict` of key/value pairs. In the latter case, the correct +configuration class will be picked by Pydantic's discriminated union +mechanism. + +If successful, the method will return the appropriate subclass of +`ModelConfigBase`. It will raise a `DuplicateModelException` if a +model with the same key is already in the database, or an +`InvalidModelConfigException` if a dict was passed and Pydantic +experienced a parse or validation error. + +### update_model(key, config) -> AnyModelConfig: + +Given a key and a configuration, this will update the model +configuration record in the database. `config` can be either a +instance of `ModelConfigBase`, or a sparse `dict` containing the +fields to be updated. This will return an `AnyModelConfig` on success, +or raise `InvalidModelConfigException` or `UnknownModelException` +exceptions on failure. + +***TO DO:*** Investigate why `update_model()` returns an +`AnyModelConfig` while `add_model()` returns a `ModelConfigBase`. + +### rename_model(key, new_name) -> ModelConfigBase: + +This is a special case of `update_model()` for the use case of +changing the model's name. It is broken out because there are cases in +which the InvokeAI application wants to synchronize the model's name +with its path in the `models` directory after changing the name, type +or base. However, when using the ModelRecordService directly, the call +is equivalent to: + +``` +store.rename_model(key, {'name': 'new_name'}) +``` + +***TO DO:*** Investigate why `rename_model()` is returning a +`ModelConfigBase` while `update_model()` returns a `AnyModelConfig`. + +*** + +## Let's get loaded, the lowdown on ModelLoadService + +The `ModelLoadService` is responsible for loading a named model into +memory so that it can be used for inference. Despite the fact that it +does a lot under the covers, it is very straightforward to use. + +An application-wide model loader is created at API initialization time +and stored in +`ApiDependencies.invoker.services.model_loader`. However, you can +create alternative instances if you wish. + +### Creating a ModelLoadService object + +The class is defined in +`invokeai.app.services.model_loader_service`. It is initialized with +an InvokeAIAppConfig object, from which it gets configuration +information such as the user's desired GPU and precision, and with a +previously-created `ModelRecordServiceBase` object, from which it +loads the requested model's configuration information. + +Here is a typical initialization pattern: + +``` +from invokeai.app.services.config import InvokeAIAppConfig +from invokeai.app.services.model_record_service import ModelRecordServiceBase +from invokeai.app.services.model_loader_service import ModelLoadService + +config = InvokeAIAppConfig.get_config() +store = ModelRecordServiceBase.open(config) +loader = ModelLoadService(config, store) +``` + +Note that we are relying on the contents of the application +configuration to choose the implementation of +`ModelRecordServiceBase`. + +### get_model(key, [submodel_type], [context]) -> ModelInfo: + +*** TO DO: change to get_model(key, context=None, **kwargs) + +The `get_model()` method, like its similarly-named cousin in +`ModelRecordService`, receives the unique key that identifies the +model. It loads the model into memory, gets the model ready for use, +and returns a `ModelInfo` object. + +The optional second argument, `subtype` is a `SubModelType` string +enum, such as "vae". It is mandatory when used with a main model, and +is used to select which part of the main model to load. + +The optional third argument, `context` can be provided by +an invocation to trigger model load event reporting. See below for +details. + +The returned `ModelInfo` object shares some fields in common with +`ModelConfigBase`, but is otherwise a completely different beast: + +| **Field Name** | **Type** | **Description** | +|----------------|-----------------|------------------| +| `key` | str | The model key derived from the ModelRecordService database | +| `name` | str | Name of this model | +| `base_model` | BaseModelType | Base model for this model | +| `type` | ModelType or SubModelType | Either the model type (non-main) or the submodel type (main models)| +| `location` | Path or str | Location of the model on the filesystem | +| `precision` | torch.dtype | The torch.precision to use for inference | +| `context` | ModelCache.ModelLocker | A context class used to lock the model in VRAM while in use | + +The types for `ModelInfo` and `SubModelType` can be imported from +`invokeai.app.services.model_loader_service`. + +To use the model, you use the `ModelInfo` as a context manager using +the following pattern: + +``` +model_info = loader.get_model('f13dd932c0c35c22dcb8d6cda4203764', SubModelType('vae')) +with model_info as vae: + image = vae.decode(latents)[0] +``` + +The `vae` model will stay locked in the GPU during the period of time +it is in the context manager's scope. + +`get_model()` may raise any of the following exceptions: + +- `UnknownModelException` -- key not in database +- `ModelNotFoundException` -- key in database but model not found at path +- `InvalidModelException` -- the model is guilty of a variety of sins + +** TO DO: ** Resolve discrepancy between ModelInfo.location and +ModelConfig.path. + +### Emitting model loading events + +When the `context` argument is passed to `get_model()`, it will +retrieve the invocation event bus from the passed `InvocationContext` +object to emit events on the invocation bus. The two events are +"model_load_started" and "model_load_completed". Both carry the +following payload: + +``` +payload=dict( + queue_id=queue_id, + queue_item_id=queue_item_id, + queue_batch_id=queue_batch_id, + graph_execution_state_id=graph_execution_state_id, + model_key=model_key, + submodel=submodel, + hash=model_info.hash, + location=str(model_info.location), + precision=str(model_info.precision), +) +``` + +*** + +## Get on line: The Download Queue + +InvokeAI can download arbitrary files using a multithreaded background +download queue. Internally, the download queue is used for installing +models located at remote locations. The queue is implemented by the +`DownloadQueueService` defined in +`invokeai.app.services.download_manager`. However, most of the +implementation is spread out among several files in +`invokeai/backend/model_manager/download/*` + +A default download queue is located in +`ApiDependencies.invoker.services.download_queue`. However, you can +create additional instances if you need to isolate your queue from the +main one. + +### A job for every task + +The queue operates on a series of download job objects. These objects +specify the source and destination of the download, and keep track of +the progress of the download. Jobs come in a variety of shapes and +colors as they are progressively specialized for particular download +task. + +The basic job is the `DownloadJobBase`, a pydantic object with the +following fields: + +| **Field** | **Type** | **Default** | **Description** | +|----------------|-----------------|---------------|-----------------| +| `id` | int | | Job ID, an integer >= 0 | +| `priority` | int | 10 | Job priority. Lower priorities run before higher priorities | +| `source` | str | | Where to download from (specialized types used in subclasses)| +| `destination` | Path | | Where to download to | +| `status` | DownloadJobStatus| Idle | Job's status (see below) | +| `event_handlers` | List[DownloadEventHandler]| | Event handlers (see below) | +| `job_started` | float | | Timestamp for when the job started running | +| `job_ended` | float | | Timestamp for when the job completed or errored out | +| `job_sequence` | int | | A counter that is incremented each time a model is dequeued | +| `preserve_partial_downloads`| bool | False | Resume partial downloads when relaunched. | +| `error` | Exception | | A copy of the Exception that caused an error during download | + +When you create a job, you can assign it a `priority`. If multiple +jobs are queued, the job with the lowest priority runs first. (Don't +blame me! The Unix developers came up with this convention.) + +Every job has a `source` and a `destination`. `source` is a string in +the base class, but subclassses redefine it more specifically. + +The `destination` must be the Path to a file or directory on the local +filesystem. If the Path points to a new or existing file, then the +source will be stored under that filename. If the Path ponts to an +existing directory, then the downloaded file will be stored inside the +directory, usually using the name assigned to it at the remote site in +the `content-disposition` http field. + +When the job is submitted, it is assigned a numeric `id`. The id can +then be used to control the job, such as starting, stopping and +cancelling its download. + +The `status` field is updated by the queue to indicate where the job +is in its lifecycle. Values are defined in the string enum +`DownloadJobStatus`, a symbol available from +`invokeai.app.services.download_manager`. Possible values are: + +| **Value** | **String Value** | ** Description ** | +|--------------|---------------------|-------------------| +| `IDLE` | idle | Job created, but not submitted to the queue | +| `ENQUEUED` | enqueued | Job is patiently waiting on the queue | +| `RUNNING` | running | Job is running! | +| `PAUSED` | paused | Job was paused and can be restarted | +| `COMPLETED` | completed | Job has finished its work without an error | +| `ERROR` | error | Job encountered an error and will not run again| +| `CANCELLED` | cancelled | Job was cancelled and will not run (again) | + +`job_started`, `job_ended` and `job_sequence` indicate when the job +was started (using a python timestamp), when it completed, and the +order in which it was taken off the queue. These are mostly used for +debugging and performance testing. + +In case of an error, the Exception that caused the error will be +placed in the `error` field, and the job's status will be set to +`DownloadJobStatus.ERROR`. + +After an error occurs, any partially downloaded files will be deleted +from disk, unless `preserve_partial_downloads` was set to True at job +creation time (or set to True any time before the error +occurred). Note that since all InvokeAI model install operations +involve downloading files to a temporary directory that has a limited +lifetime, this flag is not used by the model installer. + +There are a series of subclasses of `DownloadJobBase` that provide +support for specific types of downloads. These are: + +#### DownloadJobPath + +This subclass redefines `source` to be a filesystem Path. It is used +to move a file or directory from the `source` to the `destination` +paths in the background using a uniform event-based infrastructure. + +#### DownloadJobRemoteSource + +This subclass adds the following fields to the job: + +| **Field** | **Type** | **Default** | **Description** | +|----------------|-----------------|---------------|-----------------| +| `bytes` | int | 0 | bytes downloaded so far | +| `total_bytes` | int | 0 | total size to download | +| `access_token` | Any | None | an authorization token to present to the remote source | + +The job will start out with 0/0 in its bytes/total_bytes fields. Once +it starts running, `total_bytes` will be populated from information +provided in the HTTP download header (if available), and the number of +bytes downloaded so far will be progressively incremented. + +#### DownloadJobURL + +This is a subclass of `DownloadJobBase`. It redefines `source` to be a +Pydantic `AnyHttpUrl` object, which enforces URL validation checking +on the field. + +Note that the installer service defines an additional subclass of +`DownloadJobRemoteSource` that accepts HuggingFace repo_ids in +addition to URLs. This is discussed later in this document. + +### Event handlers + +While a job is being downloaded, the queue will emit events at +periodic intervals. A typical series of events during a successful +download session will look like this: + +- enqueued +- running +- running +- running +- completed + +There will be a single enqueued event, followed by one or more running +events, and finally one `completed`, `error` or `cancelled` +events. + +It is possible for a caller to pause download temporarily, in which +case the events may look something like this: + +- enqueued +- running +- running +- paused +- running +- completed + +The download queue logs when downloads start and end (unless `quiet` +is set to True at initialization time) but doesn't log any progress +events. You will probably want to be alerted to events during the +download job and provide more user feedback. In order to intercept and +respond to events you may install a series of one or more event +handlers in the job. Whenever the job's status changes, the chain of +event handlers is traversed and executed in the same thread that the +download job is running in. + +Event handlers have the signature `Callable[["DownloadJobBase"], +None]`, i.e. + +``` +def handler(job: DownloadJobBase): + pass +``` + +A typical handler will examine `job.status` and decide if there's +something to be done. This can include cancelling or erroring the job, +but more typically is used to report on the job status to the user +interface or to perform certain actions on successful completion of +the job. + +Event handlers can be attached to a job at creation time. In addition, +you can create a series of default handlers that are attached to the +queue object itself. These handlers will be executed for each job +after the job's own handlers (if any) have run. + +During a download, running events are issued every time roughly 1% of +the file is transferred. This is to provide just enough granularity to +update a tqdm progress bar smoothly. + +Handlers can be added to a job after the fact using the job's +`add_event_handler` method: + +``` +job.add_event_handler(my_handler) +``` + +All handlers can be cleared using the job's `clear_event_handlers()` +method. Note that it might be a good idea to pause the job before +altering its handlers. + +### Creating a download queue object + +The `DownloadQueueService` constructor takes the following arguments: + +| **Argument** | **Type** | **Default** | **Description** | +|----------------|-----------------|---------------|-----------------| +| `event_handlers` | List[DownloadEventHandler] | [] | Event handlers | +| `max_parallel_dl` | int | 5 | Maximum number of simultaneous downloads allowed | +| `requests_session` | requests.sessions.Session | None | An alternative requests Session object to use for the download | +| `quiet` | bool | False| Do work quietly without issuing log messages | + +A typical initialization sequence will look like: + +``` +from invokeai.app.services.download_manager import DownloadQueueService + +def log_download_event(job: DownloadJobBase): + logger.info(f'job={job.id}: status={job.status}') + +queue = DownloadQueueService( + event_handlers=[log_download_event] + ) +``` + +Event handlers can be provided to the queue at initialization time as +shown in the example. These will be automatically appended to the +handler list for any job that is submitted to this queue. + +`max_parallel_dl` sets the number of simultaneous active downloads +that are allowed. The default of five has not been benchmarked in any +way, but seems to give acceptable performance. + +`requests_session` can be used to provide a `requests` module Session +object that will be used to stream remote URLs to disk. This facility +was added for use in the module's unit tests to simulate a remote web +server, but may be useful in other contexts. + +`quiet` will prevent the queue from issuing any log messages at the +INFO or higher levels. + +### Submitting a download job + +You can submit a download job to the queue either by creating the job +manually and passing it to the queue's `submit_download_job()` method, +or using the `create_download_job()` method, which will do the same +thing on your behalf. + +To use the former method, follow this example: + +``` +job = DownloadJobRemoteSource( + source='http://www.civitai.com/models/13456', + destination='/tmp/models/', + event_handlers=[my_handler1, my_handler2], # if desired + ) +queue.submit_download_job(job, start=True) +``` + +`submit_download_job()` takes just two arguments: the job to submit, +and a flag indicating whether to immediately start the job (defaulting +to True). If you choose not to start the job immediately, you can +start it later by calling the queue's `start_job()` or +`start_all_jobs()` methods, which are described later. + +To have the queue create the job for you, follow this example instead: + +``` +job = queue.create_download_job( + source='http://www.civitai.com/models/13456', + destdir='/tmp/models/', + filename='my_model.safetensors', + event_handlers=[my_handler1, my_handler2], # if desired + start=True, + ) + ``` + +The `filename` argument forces the downloader to use the specified +name for the file rather than the name provided by the remote source, +and is equivalent to manually specifying a destination of +`/tmp/models/my_model.safetensors' in the submitted job. + +Here is the full list of arguments that can be provided to +`create_download_job()`: + + +| **Argument** | **Type** | **Default** | **Description** | +|------------------|------------------------------|-------------|-------------------------------------------| +| `source` | Union[str, Path, AnyHttpUrl] | | Download remote or local source | +| `destdir` | Path | | Destination directory for downloaded file | +| `filename` | Path | None | Filename for downloaded file | +| `start` | bool | True | Enqueue the job immediately | +| `priority` | int | 10 | Starting priority for this job | +| `access_token` | str | None | Authorization token for this resource | +| `event_handlers` | List[DownloadEventHandler] | [] | Event handlers for this job | + +Internally, `create_download_job()` has a little bit of internal logic +that looks at the type of the source and selects the right subclass of +`DownloadJobBase` to create and enqueue. + +**TODO**: move this logic into its own method for overriding in +subclasses. + +### Job control + +Prior to completion, jobs can be controlled with a series of queue +method calls. Do not attempt to modify jobs by directly writing to +their fields, as this is likely to lead to unexpected results. + +Any method that accepts a job argument may raise an +`UnknownJobIDException` if the job has not yet been submitted to the +queue or was not created by this queue. + +#### queue.join() + +This method will block until all the active jobs in the queue have +reached a terminal state (completed, errored or cancelled). + +#### jobs = queue.list_jobs() + +This will return a list of all jobs, including ones that have not yet +been enqueued and those that have completed or errored out. + +#### job = queue.id_to_job(int) + +This method allows you to recover a submitted job using its ID. + +#### queue.prune_jobs() + +Remove completed and errored jobs from the job list. + +#### queue.start_job(job) + +If the job was submitted with `start=False`, then it can be started +using this method. + +#### queue.pause_job(job) + +This will temporarily pause the job, if possible. It can later be +restarted and pick up where it left off using `queue.start_job()`. + +#### queue.cancel_job(job) + +This will cancel the job if possible and clean up temporary files and +other resources that it might have been using. + +#### queue.start_all_jobs(), queue.pause_all_jobs(), queue.cancel_all_jobs() + +This will start/pause/cancel all jobs that have been submitted to the +queue and have not yet reached a terminal state. + +## Model installation + +The `ModelInstallService` class implements the +`ModelInstallServiceBase` abstract base class, and provides a one-stop +shop for all your model install needs. It provides the following +functionality: + +- Registering a model config record for a model already located on the + local filesystem, without moving it or changing its path. + +- Installing a model alreadiy located on the local filesystem, by + moving it into the InvokeAI root directory under the + `models` folder (or wherever config parameter `models_dir` + specifies). + +- Downloading a model from an arbitrary URL and installing it in + `models_dir`. + +- Special handling for Civitai model URLs which allow the user to + paste in a model page's URL or download link. Any metadata provided + by Civitai, such as trigger terms, are captured and placed in the + model config record. + +- Special handling for HuggingFace repo_ids to recursively download + the contents of the repository, paying attention to alternative + variants such as fp16. + +- Probing of models to determine their type, base type and other key + information. + +- Interface with the InvokeAI event bus to provide status updates on + the download, installation and registration process. + +### Initializing the installer + +A default installer is created at InvokeAI api startup time and stored +in `ApiDependencies.invoker.services.model_install_service` and can +also be retrieved from an invocation's `context` argument with +`context.services.model_install_service`. + +In the event you wish to create a new installer, you may use the +following initialization pattern: + +``` +from invokeai.app.services.config import InvokeAIAppConfig +from invokeai.app.services.download_manager import DownloadQueueServive +from invokeai.app.services.model_record_service import ModelRecordServiceBase + +config = InvokeAI.get_config() +queue = DownloadQueueService() +store = ModelRecordServiceBase.open(config) +installer = ModelInstallService(config=config, queue=queue, store=store) +``` + +The full form of `ModelInstallService()` takes the following +parameters. Each parameter will default to a reasonable value, but it +is recommended that you set them explicitly as shown in the above example. + +| **Argument** | **Type** | **Default** | **Description** | +|------------------|------------------------------|-------------|-------------------------------------------| +| `config` | InvokeAIAppConfig | Use system-wide config | InvokeAI app configuration object | +| `queue` | DownloadQueueServiceBase | Create a new download queue for internal use | Download queue | +| `store` | ModelRecordServiceBase | Use config to select the database to open | Config storage database | +| `event_bus` | EventServiceBase | None | An event bus to send download/install progress events to | +| `event_handlers` | List[DownloadEventHandler] | None | Event handlers for the download queue | + +Note that if `store` is not provided, then the class will use +`ModelRecordServiceBase.open(config)` to select the database to use. + +Once initialized, the installer will provide the following methods: + +#### install_job = installer.install_model() + +The `install_model()` method is the core of the installer. The +following illustrates basic usage: + +``` +sources = [ + Path('/opt/models/sushi.safetensors'), # a local safetensors file + Path('/opt/models/sushi_diffusers/'), # a local diffusers folder + 'runwayml/stable-diffusion-v1-5', # a repo_id + 'runwayml/stable-diffusion-v1-5:vae', # a subfolder within a repo_id + 'https://civitai.com/api/download/models/63006', # a civitai direct download link + 'https://civitai.com/models/8765?modelVersionId=10638', # civitai model page + 'https://s3.amazon.com/fjacks/sd-3.safetensors', # arbitrary URL +] + +for source in sources: + install_job = installer.install_model(source) + +source2key = installer.wait_for_installs() +for source in sources: + model_key = source2key[source] + print(f"{source} installed as {model_key}") +``` + +As shown here, the `install_model()` method accepts a variety of +sources, including local safetensors files, local diffusers folders, +HuggingFace repo_ids with and without a subfolder designation, +Civitai model URLs and arbitrary URLs that point to checkpoint files +(but not to folders). + +Each call to `install_model()` will return a `ModelInstallJob` job, a +subclass of `DownloadJobBase`. The install job has additional +install-specific fields described in the next section. + +Each install job will run in a series of background threads using +the object's download queue. You may block until all install jobs are +completed (or errored) by calling the `wait_for_installs()` method as +shown in the code example. `wait_for_installs()` will return a `dict` +that maps the requested source to the key of the installed model. In +the case that a model fails to download or install, its value in the +dict will be None. The actual cause of the error will be reported in +the corresponding job's `error` field. + +Alternatively you may install event handlers and/or listen for events +on the InvokeAI event bus in order to monitor the progress of the +requested installs. + +The full list of arguments to `model_install()` is as follows: + +| **Argument** | **Type** | **Default** | **Description** | +|------------------|------------------------------|-------------|-------------------------------------------| +| `source` | Union[str, Path, AnyHttpUrl] | | The source of the model, Path, URL or repo_id | +| `inplace` | bool | True | Leave a local model in its current location | +| `variant` | str | None | Desired variant, such as 'fp16' or 'onnx' (HuggingFace only) | +| `subfolder` | str | None | Repository subfolder (HuggingFace only) | +| `probe_override` | Dict[str, Any] | None | Override all or a portion of model's probed attributes | +| `metadata` | ModelSourceMetadata | None | Provide metadata that will be added to model's config | +| `access_token` | str | None | Provide authorization information needed to download | +| `priority` | int | 10 | Download queue priority for the job | + + +The `inplace` field controls how local model Paths are handled. If +True (the default), then the model is simply registered in its current +location by the installer's `ModelConfigRecordService`. Otherwise, the +model will be moved into the location specified by the `models_dir` +application configuration parameter. + +The `variant` field is used for HuggingFace repo_ids only. If +provided, the repo_id download handler will look for and download +tensors files that follow the convention for the selected variant: + +- "fp16" will select files named "*model.fp16.{safetensors,bin}" +- "onnx" will select files ending with the suffix ".onnx" +- "openvino" will select files beginning with "openvino_model" + +In the special case of the "fp16" variant, the installer will select +the 32-bit version of the files if the 16-bit version is unavailable. + +`subfolder` is used for HuggingFace repo_ids only. If provided, the +model will be downloaded from the designated subfolder rather than the +top-level repository folder. If a subfolder is attached to the repo_id +using the format `repo_owner/repo_name:subfolder`, then the subfolder +specified by the repo_id will override the subfolder argument. + +`probe_override` can be used to override all or a portion of the +attributes returned by the model prober. This can be used to overcome +cases in which automatic probing is unable to (correctly) determine +the model's attribute. The most common situation is the +`prediction_type` field for sd-2 (and rare sd-1) models. Here is an +example of how it works: + +``` +install_job = installer.install_model( + source='stabilityai/stable-diffusion-2-1', + variant='fp16', + probe_override=dict( + prediction_type=SchedulerPredictionType('v_prediction') + ) + ) +``` + +`metadata` allows you to attach custom metadata to the installed +model. See the next section for details. + +`priority` and `access_token` are passed to the download queue and +have the same effect as they do for the DownloadQueueServiceBase. + +#### Monitoring the install job process + +When you create an install job with `model_install()`, events will be +passed to the list of `DownloadEventHandlers` provided at installer +initialization time. Event handlers can also be added to individual +model install jobs by calling their `add_handler()` method as +described earlier for the `DownloadQueueService`. + +If the `event_bus` argument was provided, events will also be +broadcast to the InvokeAI event bus. The events will appear on the bus +as a singular event type named `model_event` with a payload of +`job`. You can then retrieve the job and check its status. + +** TO DO: ** consider breaking `model_event` into +`model_install_started`, `model_install_completed`, etc. The event bus +features have not yet been tested with FastAPI/websockets, and it may +turn out that the job object is not serializable. + +#### Model metadata and probing + +The install service has special handling for HuggingFace and Civitai +URLs that capture metadata from the source and include it in the model +configuration record. For example, fetching the Civitai model 8765 +will produce a config record similar to this (using YAML +representation): + +``` +5abc3ef8600b6c1cc058480eaae3091e: + path: sd-1/lora/to8contrast-1-5.safetensors + name: to8contrast-1-5 + base_model: sd-1 + model_type: lora + model_format: lycoris + key: 5abc3ef8600b6c1cc058480eaae3091e + hash: 5abc3ef8600b6c1cc058480eaae3091e + description: 'Trigger terms: to8contrast style' + author: theovercomer8 + license: allowCommercialUse=Sell; allowDerivatives=True; allowNoCredit=True + source: https://civitai.com/models/8765?modelVersionId=10638 + thumbnail_url: null + tags: + - model + - style + - portraits +``` + +For sources that do not provide model metadata, you can attach custom +fields by providing a `metadata` argument to `model_install()` using +an initialized `ModelSourceMetadata` object (available for import from +`model_install_service.py`): + +``` +from invokeai.app.services.model_install_service import ModelSourceMetadata +meta = ModelSourceMetadata( + name="my model", + author="Sushi Chef", + description="Highly customized model; trigger with 'sushi'," + license="mit", + thumbnail_url="http://s3.amazon.com/ljack/pics/sushi.png", + tags=list('sfw', 'food') + ) +install_job = installer.install_model( + source='sushi_chef/model3', + variant='fp16', + metadata=meta, + ) +``` + +It is not currently recommended to provide custom metadata when +installing from Civitai or HuggingFace source, as the metadata +provided by the source will overwrite the fields you provide. Instead, +after the model is installed you can use +`ModelRecordService.update_model()` to change the desired fields. + +** TO DO: ** Change the logic so that the caller's metadata fields take +precedence over those provided by the source. + + +#### Other installer methods + +This section describes additional, less-frequently-used attributes and +methods provided by the installer class. + +##### installer.wait_for_installs() + +This is equivalent to the `DownloadQueue` `join()` method. It will +block until all the active jobs in the install queue have reached a +terminal state (completed, errored or cancelled). + +##### installer.queue, installer.store, installer.config + +These attributes provide access to the `DownloadQueueServiceBase`, +`ModelConfigRecordServiceBase`, and `InvokeAIAppConfig` objects that +the installer uses. + +For example, to temporarily pause all pending installations, you can +do this: + +``` +installer.queue.pause_all_jobs() +``` +##### key = installer.register_path(model_path, overrides), key = installer.install_path(model_path, overrides) + +These methods bypass the download queue and directly register or +install the model at the indicated path, returning the unique ID for +the installed model. + +Both methods accept a Path object corresponding to a checkpoint or +diffusers folder, and an optional dict of attributes to use to +override the values derived from model probing. + +The difference between `register_path()` and `install_path()` is that +the former will not move the model from its current position, while +the latter will move it into the `models_dir` hierarchy. + +##### installer.unregister(key) + +This will remove the model config record for the model at key, and is +equivalent to `installer.store.unregister(key)` + +##### installer.delete(key) + +This is similar to `unregister()` but has the additional effect of +deleting the underlying model file(s) -- even if they were outside the +`models_dir` directory! + +##### installer.conditionally_delete(key) + +This method will call `unregister()` if the model identified by `key` +is outside the `models_dir` hierarchy, and call `delete()` if the +model is inside. + +#### List[str]=installer.scan_directory(scan_dir: Path, install: bool) + +This method will recursively scan the directory indicated in +`scan_dir` for new models and either install them in the models +directory or register them in place, depending on the setting of +`install` (default False). + +The return value is the list of keys of the new installed/registered +models. + +#### installer.scan_models_directory() + +This method scans the models directory for new models and registers +them in place. Models that are present in the +`ModelConfigRecordService` database whose paths are not found will be +unregistered. + +#### installer.sync_to_config() + +This method synchronizes models in the models directory and autoimport +directory to those in the `ModelConfigRecordService` database. New +models are registered and orphan models are unregistered. + +#### hash=installer.hash(model_path) + +This method is calls the fasthash algorithm on a model's Path +(either a file or a folder) to generate a unique ID based on the +contents of the model. + +##### installer.start(invoker) + +The `start` method is called by the API intialization routines when +the API starts up. Its effect is to call `sync_to_config()` to +synchronize the model record store database with what's currently on +disk. + +This method should not ordinarily be called manually. diff --git a/invokeai/app/api/dependencies.py b/invokeai/app/api/dependencies.py index e7c8fa7fae..b739327368 100644 --- a/invokeai/app/api/dependencies.py +++ b/invokeai/app/api/dependencies.py @@ -24,6 +24,7 @@ from ..services.item_storage.item_storage_sqlite import SqliteItemStorage from ..services.latents_storage.latents_storage_disk import DiskLatentsStorage from ..services.latents_storage.latents_storage_forward_cache import ForwardCacheLatentsStorage from ..services.model_manager.model_manager_default import ModelManagerService +from ..services.model_records import ModelRecordServiceSQL from ..services.names.names_default import SimpleNameService from ..services.session_processor.session_processor_default import DefaultSessionProcessor from ..services.session_queue.session_queue_sqlite import SqliteSessionQueue @@ -85,6 +86,7 @@ class ApiDependencies: invocation_cache = MemoryInvocationCache(max_cache_size=config.node_cache_size) latents = ForwardCacheLatentsStorage(DiskLatentsStorage(f"{output_folder}/latents")) model_manager = ModelManagerService(config, logger) + model_record_service = ModelRecordServiceSQL(db=db) names = SimpleNameService() performance_statistics = InvocationStatsService() processor = DefaultInvocationProcessor() @@ -111,6 +113,7 @@ class ApiDependencies: latents=latents, logger=logger, model_manager=model_manager, + model_records=model_record_service, names=names, performance_statistics=performance_statistics, processor=processor, diff --git a/invokeai/app/api/routers/model_records.py b/invokeai/app/api/routers/model_records.py new file mode 100644 index 0000000000..cffca25d9f --- /dev/null +++ b/invokeai/app/api/routers/model_records.py @@ -0,0 +1,164 @@ +# Copyright (c) 2023 Lincoln D. Stein +"""FastAPI route for model configuration records.""" + + +from hashlib import sha1 +from random import randbytes +from typing import List, Optional + +from fastapi import Body, Path, Query, Response +from fastapi.routing import APIRouter +from pydantic import BaseModel, ConfigDict +from starlette.exceptions import HTTPException +from typing_extensions import Annotated + +from invokeai.app.services.model_records import ( + DuplicateModelException, + InvalidModelException, + UnknownModelException, +) +from invokeai.backend.model_manager.config import ( + AnyModelConfig, + BaseModelType, + ModelType, +) + +from ..dependencies import ApiDependencies + +model_records_router = APIRouter(prefix="/v1/model/record", tags=["models"]) + + +class ModelsList(BaseModel): + """Return list of configs.""" + + models: list[AnyModelConfig] + + model_config = ConfigDict(use_enum_values=True) + + +@model_records_router.get( + "/", + operation_id="list_model_records", +) +async def list_model_records( + base_models: Optional[List[BaseModelType]] = Query(default=None, description="Base models to include"), + model_type: Optional[ModelType] = Query(default=None, description="The type of model to get"), +) -> ModelsList: + """Get a list of models.""" + record_store = ApiDependencies.invoker.services.model_records + found_models: list[AnyModelConfig] = [] + if base_models: + for base_model in base_models: + found_models.extend(record_store.search_by_attr(base_model=base_model, model_type=model_type)) + else: + found_models.extend(record_store.search_by_attr(model_type=model_type)) + return ModelsList(models=found_models) + + +@model_records_router.get( + "/i/{key}", + operation_id="get_model_record", + responses={ + 200: {"description": "Success"}, + 400: {"description": "Bad request"}, + 404: {"description": "The model could not be found"}, + }, +) +async def get_model_record( + key: str = Path(description="Key of the model record to fetch."), +) -> AnyModelConfig: + """Get a model record""" + record_store = ApiDependencies.invoker.services.model_records + try: + return record_store.get_model(key) + except UnknownModelException as e: + raise HTTPException(status_code=404, detail=str(e)) + + +@model_records_router.patch( + "/i/{key}", + operation_id="update_model_record", + responses={ + 200: {"description": "The model was updated successfully"}, + 400: {"description": "Bad request"}, + 404: {"description": "The model could not be found"}, + 409: {"description": "There is already a model corresponding to the new name"}, + }, + status_code=200, + response_model=AnyModelConfig, +) +async def update_model_record( + key: Annotated[str, Path(description="Unique key of model")], + info: Annotated[AnyModelConfig, Body(description="Model config", discriminator="type")], +) -> AnyModelConfig: + """Update model contents with a new config. If the model name or base fields are changed, then the model is renamed.""" + logger = ApiDependencies.invoker.services.logger + record_store = ApiDependencies.invoker.services.model_records + try: + model_response = record_store.update_model(key, config=info) + logger.info(f"Updated model: {key}") + except UnknownModelException as e: + raise HTTPException(status_code=404, detail=str(e)) + except ValueError as e: + logger.error(str(e)) + raise HTTPException(status_code=409, detail=str(e)) + return model_response + + +@model_records_router.delete( + "/i/{key}", + operation_id="del_model_record", + responses={ + 204: {"description": "Model deleted successfully"}, + 404: {"description": "Model not found"}, + }, + status_code=204, +) +async def del_model_record( + key: str = Path(description="Unique key of model to remove from model registry."), +) -> Response: + """Delete Model""" + logger = ApiDependencies.invoker.services.logger + + try: + record_store = ApiDependencies.invoker.services.model_records + record_store.del_model(key) + logger.info(f"Deleted model: {key}") + return Response(status_code=204) + except UnknownModelException as e: + logger.error(str(e)) + raise HTTPException(status_code=404, detail=str(e)) + + +@model_records_router.post( + "/i/", + operation_id="add_model_record", + responses={ + 201: {"description": "The model added successfully"}, + 409: {"description": "There is already a model corresponding to this path or repo_id"}, + 415: {"description": "Unrecognized file/folder format"}, + }, + status_code=201, +) +async def add_model_record( + config: Annotated[AnyModelConfig, Body(description="Model config", discriminator="type")] +) -> AnyModelConfig: + """ + Add a model using the configuration information appropriate for its type. + """ + logger = ApiDependencies.invoker.services.logger + record_store = ApiDependencies.invoker.services.model_records + if config.key == "": + config.key = sha1(randbytes(100)).hexdigest() + logger.info(f"Created model {config.key} for {config.name}") + try: + record_store.add_model(config.key, config) + except DuplicateModelException as e: + logger.error(str(e)) + raise HTTPException(status_code=409, detail=str(e)) + except InvalidModelException as e: + logger.error(str(e)) + raise HTTPException(status_code=415) + + # now fetch it out + return record_store.get_model(config.key) diff --git a/invokeai/app/api/routers/models.py b/invokeai/app/api/routers/models.py index cf3d31cc38..8f83820cf8 100644 --- a/invokeai/app/api/routers/models.py +++ b/invokeai/app/api/routers/models.py @@ -1,6 +1,5 @@ # Copyright (c) 2023 Kyle Schouviller (https://github.com/kyle0654), 2023 Kent Keirsey (https://github.com/hipsterusername), 2023 Lincoln D. Stein - import pathlib from typing import Annotated, List, Literal, Optional, Union diff --git a/invokeai/app/api_app.py b/invokeai/app/api_app.py index 19bdd084e2..ad16812f9a 100644 --- a/invokeai/app/api_app.py +++ b/invokeai/app/api_app.py @@ -43,6 +43,7 @@ if True: # hack to make flake8 happy with imports coming after setting up the c board_images, boards, images, + model_records, models, session_queue, sessions, @@ -106,6 +107,7 @@ app.include_router(sessions.session_router, prefix="/api") app.include_router(utilities.utilities_router, prefix="/api") app.include_router(models.models_router, prefix="/api") +app.include_router(model_records.model_records_router, prefix="/api") app.include_router(images.images_router, prefix="/api") app.include_router(boards.boards_router, prefix="/api") app.include_router(board_images.board_images_router, prefix="/api") diff --git a/invokeai/app/services/invocation_services.py b/invokeai/app/services/invocation_services.py index d405201f4e..366e2d0f2b 100644 --- a/invokeai/app/services/invocation_services.py +++ b/invokeai/app/services/invocation_services.py @@ -22,6 +22,7 @@ if TYPE_CHECKING: from .item_storage.item_storage_base import ItemStorageABC from .latents_storage.latents_storage_base import LatentsStorageBase from .model_manager.model_manager_base import ModelManagerServiceBase + from .model_records import ModelRecordServiceBase from .names.names_base import NameServiceBase from .session_processor.session_processor_base import SessionProcessorBase from .session_queue.session_queue_base import SessionQueueBase @@ -49,6 +50,7 @@ class InvocationServices: latents: "LatentsStorageBase" logger: "Logger" model_manager: "ModelManagerServiceBase" + model_records: "ModelRecordServiceBase" processor: "InvocationProcessorABC" performance_statistics: "InvocationStatsServiceBase" queue: "InvocationQueueABC" @@ -76,6 +78,7 @@ class InvocationServices: latents: "LatentsStorageBase", logger: "Logger", model_manager: "ModelManagerServiceBase", + model_records: "ModelRecordServiceBase", processor: "InvocationProcessorABC", performance_statistics: "InvocationStatsServiceBase", queue: "InvocationQueueABC", @@ -101,6 +104,7 @@ class InvocationServices: self.latents = latents self.logger = logger self.model_manager = model_manager + self.model_records = model_records self.processor = processor self.performance_statistics = performance_statistics self.queue = queue diff --git a/invokeai/app/services/model_records/__init__.py b/invokeai/app/services/model_records/__init__.py new file mode 100644 index 0000000000..05005d4227 --- /dev/null +++ b/invokeai/app/services/model_records/__init__.py @@ -0,0 +1,8 @@ +"""Init file for model record services.""" +from .model_records_base import ( # noqa F401 + DuplicateModelException, + InvalidModelException, + ModelRecordServiceBase, + UnknownModelException, +) +from .model_records_sql import ModelRecordServiceSQL # noqa F401 diff --git a/invokeai/app/services/model_records/model_records_base.py b/invokeai/app/services/model_records/model_records_base.py new file mode 100644 index 0000000000..9b0612a846 --- /dev/null +++ b/invokeai/app/services/model_records/model_records_base.py @@ -0,0 +1,169 @@ +# Copyright (c) 2023 Lincoln D. Stein and the InvokeAI Development Team +""" +Abstract base class for storing and retrieving model configuration records. +""" + +from abc import ABC, abstractmethod +from pathlib import Path +from typing import List, Optional, Union + +from invokeai.backend.model_manager.config import AnyModelConfig, BaseModelType, ModelType + +# should match the InvokeAI version when this is first released. +CONFIG_FILE_VERSION = "3.2.0" + + +class DuplicateModelException(Exception): + """Raised on an attempt to add a model with the same key twice.""" + + +class InvalidModelException(Exception): + """Raised when an invalid model is detected.""" + + +class UnknownModelException(Exception): + """Raised on an attempt to fetch or delete a model with a nonexistent key.""" + + +class ConfigFileVersionMismatchException(Exception): + """Raised on an attempt to open a config with an incompatible version.""" + + +class ModelRecordServiceBase(ABC): + """Abstract base class for storage and retrieval of model configs.""" + + @property + @abstractmethod + def version(self) -> str: + """Return the config file/database schema version.""" + pass + + @abstractmethod + def add_model(self, key: str, config: Union[dict, AnyModelConfig]) -> AnyModelConfig: + """ + Add a model to the database. + + :param key: Unique key for the model + :param config: Model configuration record, either a dict with the + required fields or a ModelConfigBase instance. + + Can raise DuplicateModelException and InvalidModelConfigException exceptions. + """ + pass + + @abstractmethod + def del_model(self, key: str) -> None: + """ + Delete a model. + + :param key: Unique key for the model to be deleted + + Can raise an UnknownModelException + """ + pass + + @abstractmethod + def update_model(self, key: str, config: Union[dict, AnyModelConfig]) -> AnyModelConfig: + """ + Update the model, returning the updated version. + + :param key: Unique key for the model to be updated + :param config: Model configuration record. Either a dict with the + required fields, or a ModelConfigBase instance. + """ + pass + + @abstractmethod + def get_model(self, key: str) -> AnyModelConfig: + """ + Retrieve the configuration for the indicated model. + + :param key: Key of model config to be fetched. + + Exceptions: UnknownModelException + """ + pass + + @abstractmethod + def exists(self, key: str) -> bool: + """ + Return True if a model with the indicated key exists in the databse. + + :param key: Unique key for the model to be deleted + """ + pass + + @abstractmethod + def search_by_path( + self, + path: Union[str, Path], + ) -> List[AnyModelConfig]: + """Return the model(s) having the indicated path.""" + pass + + @abstractmethod + def search_by_hash( + self, + hash: str, + ) -> List[AnyModelConfig]: + """Return the model(s) having the indicated original hash.""" + pass + + @abstractmethod + def search_by_attr( + self, + model_name: Optional[str] = None, + base_model: Optional[BaseModelType] = None, + model_type: Optional[ModelType] = None, + ) -> List[AnyModelConfig]: + """ + Return models matching name, base and/or type. + + :param model_name: Filter by name of model (optional) + :param base_model: Filter by base model (optional) + :param model_type: Filter by type of model (optional) + + If none of the optional filters are passed, will return all + models in the database. + """ + pass + + def all_models(self) -> List[AnyModelConfig]: + """Return all the model configs in the database.""" + return self.search_by_attr() + + def model_info_by_name(self, model_name: str, base_model: BaseModelType, model_type: ModelType) -> AnyModelConfig: + """ + Return information about a single model using its name, base type and model type. + + If there are more than one model that match, raises a DuplicateModelException. + If no model matches, raises an UnknownModelException + """ + model_configs = self.search_by_attr(model_name=model_name, base_model=base_model, model_type=model_type) + if len(model_configs) > 1: + raise DuplicateModelException( + f"More than one model matched the search criteria: base_model='{base_model}', model_type='{model_type}', model_name='{model_name}'." + ) + if len(model_configs) == 0: + raise UnknownModelException( + f"More than one model matched the search criteria: base_model='{base_model}', model_type='{model_type}', model_name='{model_name}'." + ) + return model_configs[0] + + def rename_model( + self, + key: str, + new_name: str, + ) -> AnyModelConfig: + """ + Rename the indicated model. Just a special case of update_model(). + + In some implementations, renaming the model may involve changing where + it is stored on the filesystem. So this is broken out. + + :param key: Model key + :param new_name: New name for model + """ + config = self.get_model(key) + config.name = new_name + return self.update_model(key, config) diff --git a/invokeai/app/services/model_records/model_records_sql.py b/invokeai/app/services/model_records/model_records_sql.py new file mode 100644 index 0000000000..a353fd88e0 --- /dev/null +++ b/invokeai/app/services/model_records/model_records_sql.py @@ -0,0 +1,397 @@ +# Copyright (c) 2023 Lincoln D. Stein and the InvokeAI Development Team +""" +SQL Implementation of the ModelRecordServiceBase API + +Typical usage: + + from invokeai.backend.model_manager import ModelConfigStoreSQL + store = ModelConfigStoreSQL(sqlite_db) + config = dict( + path='/tmp/pokemon.bin', + name='old name', + base_model='sd-1', + type='embedding', + format='embedding_file', + ) + + # adding - the key becomes the model's "key" field + store.add_model('key1', config) + + # updating + config.name='new name' + store.update_model('key1', config) + + # checking for existence + if store.exists('key1'): + print("yes") + + # fetching config + new_config = store.get_model('key1') + print(new_config.name, new_config.base) + assert new_config.key == 'key1' + + # deleting + store.del_model('key1') + + # searching + configs = store.search_by_path(path='/tmp/pokemon.bin') + configs = store.search_by_hash('750a499f35e43b7e1b4d15c207aa2f01') + configs = store.search_by_attr(base_model='sd-2', model_type='main') +""" + + +import json +import sqlite3 +from pathlib import Path +from typing import List, Optional, Union + +from invokeai.backend.model_manager.config import ( + AnyModelConfig, + BaseModelType, + ModelConfigBase, + ModelConfigFactory, + ModelType, +) + +from ..shared.sqlite import SqliteDatabase +from .model_records_base import ( + CONFIG_FILE_VERSION, + DuplicateModelException, + ModelRecordServiceBase, + UnknownModelException, +) + + +class ModelRecordServiceSQL(ModelRecordServiceBase): + """Implementation of the ModelConfigStore ABC using a SQL database.""" + + _db: SqliteDatabase + _cursor: sqlite3.Cursor + + def __init__(self, db: SqliteDatabase): + """ + Initialize a new object from preexisting sqlite3 connection and threading lock objects. + + :param conn: sqlite3 connection object + :param lock: threading Lock object + """ + super().__init__() + self._db = db + self._cursor = self._db.conn.cursor() + + with self._db.lock: + # Enable foreign keys + self._db.conn.execute("PRAGMA foreign_keys = ON;") + self._create_tables() + self._db.conn.commit() + assert ( + str(self.version) == CONFIG_FILE_VERSION + ), f"Model config version {self.version} does not match expected version {CONFIG_FILE_VERSION}" + + def _create_tables(self) -> None: + """Create sqlite3 tables.""" + # model_config table breaks out the fields that are common to all config objects + # and puts class-specific ones in a serialized json object + self._cursor.execute( + """--sql + CREATE TABLE IF NOT EXISTS model_config ( + id TEXT NOT NULL PRIMARY KEY, + -- The next 3 fields are enums in python, unrestricted string here + base TEXT NOT NULL, + type TEXT NOT NULL, + name TEXT NOT NULL, + path TEXT NOT NULL, + original_hash TEXT, -- could be null + -- Serialized JSON representation of the whole config object, + -- which will contain additional fields from subclasses + config TEXT NOT NULL, + created_at DATETIME NOT NULL DEFAULT(STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), + -- Updated via trigger + updated_at DATETIME NOT NULL DEFAULT(STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW')), + -- unique constraint on combo of name, base and type + UNIQUE(name, base, type) + ); + """ + ) + + # metadata table + self._cursor.execute( + """--sql + CREATE TABLE IF NOT EXISTS model_manager_metadata ( + metadata_key TEXT NOT NULL PRIMARY KEY, + metadata_value TEXT NOT NULL + ); + """ + ) + + # Add trigger for `updated_at`. + self._cursor.execute( + """--sql + CREATE TRIGGER IF NOT EXISTS model_config_updated_at + AFTER UPDATE + ON model_config FOR EACH ROW + BEGIN + UPDATE model_config SET updated_at = STRFTIME('%Y-%m-%d %H:%M:%f', 'NOW') + WHERE id = old.id; + END; + """ + ) + + # Add indexes for searchable fields + for stmt in [ + "CREATE INDEX IF NOT EXISTS base_index ON model_config(base);", + "CREATE INDEX IF NOT EXISTS type_index ON model_config(type);", + "CREATE INDEX IF NOT EXISTS name_index ON model_config(name);", + "CREATE UNIQUE INDEX IF NOT EXISTS path_index ON model_config(path);", + ]: + self._cursor.execute(stmt) + + # Add our version to the metadata table + self._cursor.execute( + """--sql + INSERT OR IGNORE into model_manager_metadata ( + metadata_key, + metadata_value + ) + VALUES (?,?); + """, + ("version", CONFIG_FILE_VERSION), + ) + + def add_model(self, key: str, config: Union[dict, ModelConfigBase]) -> AnyModelConfig: + """ + Add a model to the database. + + :param key: Unique key for the model + :param config: Model configuration record, either a dict with the + required fields or a ModelConfigBase instance. + + Can raise DuplicateModelException and InvalidModelConfigException exceptions. + """ + record = ModelConfigFactory.make_config(config, key=key) # ensure it is a valid config obect. + json_serialized = record.model_dump_json() # and turn it into a json string. + with self._db.lock: + try: + self._cursor.execute( + """--sql + INSERT INTO model_config ( + id, + base, + type, + name, + path, + original_hash, + config + ) + VALUES (?,?,?,?,?,?,?); + """, + ( + key, + record.base, + record.type, + record.name, + record.path, + record.original_hash, + json_serialized, + ), + ) + self._db.conn.commit() + + except sqlite3.IntegrityError as e: + self._db.conn.rollback() + if "UNIQUE constraint failed" in str(e): + if "model_config.path" in str(e): + msg = f"A model with path '{record.path}' is already installed" + elif "model_config.name" in str(e): + msg = f"A model with name='{record.name}', type='{record.type}', base='{record.base}' is already installed" + else: + msg = f"A model with key '{key}' is already installed" + raise DuplicateModelException(msg) from e + else: + raise e + except sqlite3.Error as e: + self._db.conn.rollback() + raise e + + return self.get_model(key) + + @property + def version(self) -> str: + """Return the version of the database schema.""" + with self._db.lock: + self._cursor.execute( + """--sql + SELECT metadata_value FROM model_manager_metadata + WHERE metadata_key=?; + """, + ("version",), + ) + rows = self._cursor.fetchone() + if not rows: + raise KeyError("Models database does not have metadata key 'version'") + return rows[0] + + def del_model(self, key: str) -> None: + """ + Delete a model. + + :param key: Unique key for the model to be deleted + + Can raise an UnknownModelException + """ + with self._db.lock: + try: + self._cursor.execute( + """--sql + DELETE FROM model_config + WHERE id=?; + """, + (key,), + ) + if self._cursor.rowcount == 0: + raise UnknownModelException("model not found") + self._db.conn.commit() + except sqlite3.Error as e: + self._db.conn.rollback() + raise e + + def update_model(self, key: str, config: ModelConfigBase) -> AnyModelConfig: + """ + Update the model, returning the updated version. + + :param key: Unique key for the model to be updated + :param config: Model configuration record. Either a dict with the + required fields, or a ModelConfigBase instance. + """ + record = ModelConfigFactory.make_config(config, key=key) # ensure it is a valid config obect + json_serialized = record.model_dump_json() # and turn it into a json string. + with self._db.lock: + try: + self._cursor.execute( + """--sql + UPDATE model_config + SET base=?, + type=?, + name=?, + path=?, + config=? + WHERE id=?; + """, + (record.base, record.type, record.name, record.path, json_serialized, key), + ) + if self._cursor.rowcount == 0: + raise UnknownModelException("model not found") + self._db.conn.commit() + except sqlite3.Error as e: + self._db.conn.rollback() + raise e + + return self.get_model(key) + + def get_model(self, key: str) -> AnyModelConfig: + """ + Retrieve the ModelConfigBase instance for the indicated model. + + :param key: Key of model config to be fetched. + + Exceptions: UnknownModelException + """ + with self._db.lock: + self._cursor.execute( + """--sql + SELECT config FROM model_config + WHERE id=?; + """, + (key,), + ) + rows = self._cursor.fetchone() + if not rows: + raise UnknownModelException("model not found") + model = ModelConfigFactory.make_config(json.loads(rows[0])) + return model + + def exists(self, key: str) -> bool: + """ + Return True if a model with the indicated key exists in the databse. + + :param key: Unique key for the model to be deleted + """ + count = 0 + with self._db.lock: + self._cursor.execute( + """--sql + select count(*) FROM model_config + WHERE id=?; + """, + (key,), + ) + count = self._cursor.fetchone()[0] + return count > 0 + + def search_by_attr( + self, + model_name: Optional[str] = None, + base_model: Optional[BaseModelType] = None, + model_type: Optional[ModelType] = None, + ) -> List[AnyModelConfig]: + """ + Return models matching name, base and/or type. + + :param model_name: Filter by name of model (optional) + :param base_model: Filter by base model (optional) + :param model_type: Filter by type of model (optional) + + If none of the optional filters are passed, will return all + models in the database. + """ + results = [] + where_clause = [] + bindings = [] + if model_name: + where_clause.append("name=?") + bindings.append(model_name) + if base_model: + where_clause.append("base=?") + bindings.append(base_model) + if model_type: + where_clause.append("type=?") + bindings.append(model_type) + where = f"WHERE {' AND '.join(where_clause)}" if where_clause else "" + with self._db.lock: + self._cursor.execute( + f"""--sql + select config FROM model_config + {where}; + """, + tuple(bindings), + ) + results = [ModelConfigFactory.make_config(json.loads(x[0])) for x in self._cursor.fetchall()] + return results + + def search_by_path(self, path: Union[str, Path]) -> List[ModelConfigBase]: + """Return models with the indicated path.""" + results = [] + with self._db.lock: + self._cursor.execute( + """--sql + SELECT config FROM model_config + WHERE model_path=?; + """, + (str(path),), + ) + results = [ModelConfigFactory.make_config(json.loads(x[0])) for x in self._cursor.fetchall()] + return results + + def search_by_hash(self, hash: str) -> List[ModelConfigBase]: + """Return models with the indicated original_hash.""" + results = [] + with self._db.lock: + self._cursor.execute( + """--sql + SELECT config FROM model_config + WHERE original_hash=?; + """, + (hash,), + ) + results = [ModelConfigFactory.make_config(json.loads(x[0])) for x in self._cursor.fetchall()] + return results diff --git a/invokeai/backend/model_manager/config.py b/invokeai/backend/model_manager/config.py new file mode 100644 index 0000000000..457e6b0823 --- /dev/null +++ b/invokeai/backend/model_manager/config.py @@ -0,0 +1,323 @@ +# Copyright (c) 2023 Lincoln D. Stein and the InvokeAI Development Team +""" +Configuration definitions for image generation models. + +Typical usage: + + from invokeai.backend.model_manager import ModelConfigFactory + raw = dict(path='models/sd-1/main/foo.ckpt', + name='foo', + base='sd-1', + type='main', + config='configs/stable-diffusion/v1-inference.yaml', + variant='normal', + format='checkpoint' + ) + config = ModelConfigFactory.make_config(raw) + print(config.name) + +Validation errors will raise an InvalidModelConfigException error. + +""" +from enum import Enum +from typing import Literal, Optional, Type, Union + +from pydantic import BaseModel, ConfigDict, Field, TypeAdapter +from typing_extensions import Annotated + + +class InvalidModelConfigException(Exception): + """Exception for when config parser doesn't recognized this combination of model type and format.""" + + +class BaseModelType(str, Enum): + """Base model type.""" + + Any = "any" + StableDiffusion1 = "sd-1" + StableDiffusion2 = "sd-2" + StableDiffusionXL = "sdxl" + StableDiffusionXLRefiner = "sdxl-refiner" + # Kandinsky2_1 = "kandinsky-2.1" + + +class ModelType(str, Enum): + """Model type.""" + + ONNX = "onnx" + Main = "main" + Vae = "vae" + Lora = "lora" + ControlNet = "controlnet" # used by model_probe + TextualInversion = "embedding" + IPAdapter = "ip_adapter" + CLIPVision = "clip_vision" + T2IAdapter = "t2i_adapter" + + +class SubModelType(str, Enum): + """Submodel type.""" + + UNet = "unet" + TextEncoder = "text_encoder" + TextEncoder2 = "text_encoder_2" + Tokenizer = "tokenizer" + Tokenizer2 = "tokenizer_2" + Vae = "vae" + VaeDecoder = "vae_decoder" + VaeEncoder = "vae_encoder" + Scheduler = "scheduler" + SafetyChecker = "safety_checker" + + +class ModelVariantType(str, Enum): + """Variant type.""" + + Normal = "normal" + Inpaint = "inpaint" + Depth = "depth" + + +class ModelFormat(str, Enum): + """Storage format of model.""" + + Diffusers = "diffusers" + Checkpoint = "checkpoint" + Lycoris = "lycoris" + Onnx = "onnx" + Olive = "olive" + EmbeddingFile = "embedding_file" + EmbeddingFolder = "embedding_folder" + InvokeAI = "invokeai" + + +class SchedulerPredictionType(str, Enum): + """Scheduler prediction type.""" + + Epsilon = "epsilon" + VPrediction = "v_prediction" + Sample = "sample" + + +class ModelConfigBase(BaseModel): + """Base class for model configuration information.""" + + path: str + name: str + base: BaseModelType + type: ModelType + format: ModelFormat + key: str = Field(description="unique key for model", default="") + original_hash: Optional[str] = Field( + description="original fasthash of model contents", default=None + ) # this is assigned at install time and will not change + current_hash: Optional[str] = Field( + description="current fasthash of model contents", default=None + ) # if model is converted or otherwise modified, this will hold updated hash + description: Optional[str] = Field(default=None) + source: Optional[str] = Field(description="Model download source (URL or repo_id)", default=None) + + model_config = ConfigDict( + use_enum_values=False, + validate_assignment=True, + ) + + def update(self, attributes: dict): + """Update the object with fields in dict.""" + for key, value in attributes.items(): + setattr(self, key, value) # may raise a validation error + + +class _CheckpointConfig(ModelConfigBase): + """Model config for checkpoint-style models.""" + + format: Literal[ModelFormat.Checkpoint] = ModelFormat.Checkpoint + config: str = Field(description="path to the checkpoint model config file") + + +class _DiffusersConfig(ModelConfigBase): + """Model config for diffusers-style models.""" + + format: Literal[ModelFormat.Diffusers] = ModelFormat.Diffusers + + +class LoRAConfig(ModelConfigBase): + """Model config for LoRA/Lycoris models.""" + + type: Literal[ModelType.Lora] = ModelType.Lora + format: Literal[ModelFormat.Lycoris, ModelFormat.Diffusers] + + +class VaeCheckpointConfig(ModelConfigBase): + """Model config for standalone VAE models.""" + + type: Literal[ModelType.Vae] = ModelType.Vae + format: Literal[ModelFormat.Checkpoint] = ModelFormat.Checkpoint + + +class VaeDiffusersConfig(ModelConfigBase): + """Model config for standalone VAE models (diffusers version).""" + + type: Literal[ModelType.Vae] = ModelType.Vae + format: Literal[ModelFormat.Diffusers] = ModelFormat.Diffusers + + +class ControlNetDiffusersConfig(_DiffusersConfig): + """Model config for ControlNet models (diffusers version).""" + + type: Literal[ModelType.ControlNet] = ModelType.ControlNet + format: Literal[ModelFormat.Diffusers] = ModelFormat.Diffusers + + +class ControlNetCheckpointConfig(_CheckpointConfig): + """Model config for ControlNet models (diffusers version).""" + + type: Literal[ModelType.ControlNet] = ModelType.ControlNet + format: Literal[ModelFormat.Checkpoint] = ModelFormat.Checkpoint + + +class TextualInversionConfig(ModelConfigBase): + """Model config for textual inversion embeddings.""" + + type: Literal[ModelType.TextualInversion] = ModelType.TextualInversion + format: Literal[ModelFormat.EmbeddingFile, ModelFormat.EmbeddingFolder] + + +class _MainConfig(ModelConfigBase): + """Model config for main models.""" + + vae: Optional[str] = Field(default=None) + variant: ModelVariantType = ModelVariantType.Normal + ztsnr_training: bool = False + + +class MainCheckpointConfig(_CheckpointConfig, _MainConfig): + """Model config for main checkpoint models.""" + + type: Literal[ModelType.Main] = ModelType.Main + # Note that we do not need prediction_type or upcast_attention here + # because they are provided in the checkpoint's own config file. + + +class MainDiffusersConfig(_DiffusersConfig, _MainConfig): + """Model config for main diffusers models.""" + + type: Literal[ModelType.Main] = ModelType.Main + prediction_type: SchedulerPredictionType = SchedulerPredictionType.Epsilon + upcast_attention: bool = False + + +class ONNXSD1Config(_MainConfig): + """Model config for ONNX format models based on sd-1.""" + + type: Literal[ModelType.ONNX] = ModelType.ONNX + format: Literal[ModelFormat.Onnx, ModelFormat.Olive] + base: Literal[BaseModelType.StableDiffusion1] = BaseModelType.StableDiffusion1 + prediction_type: SchedulerPredictionType = SchedulerPredictionType.Epsilon + upcast_attention: bool = False + + +class ONNXSD2Config(_MainConfig): + """Model config for ONNX format models based on sd-2.""" + + type: Literal[ModelType.ONNX] = ModelType.ONNX + format: Literal[ModelFormat.Onnx, ModelFormat.Olive] + # No yaml config file for ONNX, so these are part of config + base: Literal[BaseModelType.StableDiffusion2] = BaseModelType.StableDiffusion2 + prediction_type: SchedulerPredictionType = SchedulerPredictionType.VPrediction + upcast_attention: bool = True + + +class IPAdapterConfig(ModelConfigBase): + """Model config for IP Adaptor format models.""" + + type: Literal[ModelType.IPAdapter] = ModelType.IPAdapter + format: Literal[ModelFormat.InvokeAI] + + +class CLIPVisionDiffusersConfig(ModelConfigBase): + """Model config for ClipVision.""" + + type: Literal[ModelType.CLIPVision] = ModelType.CLIPVision + format: Literal[ModelFormat.Diffusers] + + +class T2IConfig(ModelConfigBase): + """Model config for T2I.""" + + type: Literal[ModelType.T2IAdapter] = ModelType.T2IAdapter + format: Literal[ModelFormat.Diffusers] + + +_ONNXConfig = Annotated[Union[ONNXSD1Config, ONNXSD2Config], Field(discriminator="base")] +_ControlNetConfig = Annotated[ + Union[ControlNetDiffusersConfig, ControlNetCheckpointConfig], + Field(discriminator="format"), +] +_VaeConfig = Annotated[Union[VaeDiffusersConfig, VaeCheckpointConfig], Field(discriminator="format")] +_MainModelConfig = Annotated[Union[MainDiffusersConfig, MainCheckpointConfig], Field(discriminator="format")] + +AnyModelConfig = Union[ + _MainModelConfig, + _ONNXConfig, + _VaeConfig, + _ControlNetConfig, + LoRAConfig, + TextualInversionConfig, + IPAdapterConfig, + CLIPVisionDiffusersConfig, + T2IConfig, +] + +AnyModelConfigValidator = TypeAdapter(AnyModelConfig) + +# IMPLEMENTATION NOTE: +# The preferred alternative to the above is a discriminated Union as shown +# below. However, it breaks FastAPI when used as the input Body parameter in a route. +# This is a known issue. Please see: +# https://github.com/tiangolo/fastapi/discussions/9761 and +# https://github.com/tiangolo/fastapi/discussions/9287 +# AnyModelConfig = Annotated[ +# Union[ +# _MainModelConfig, +# _ONNXConfig, +# _VaeConfig, +# _ControlNetConfig, +# LoRAConfig, +# TextualInversionConfig, +# IPAdapterConfig, +# CLIPVisionDiffusersConfig, +# T2IConfig, +# ], +# Field(discriminator="type"), +# ] + + +class ModelConfigFactory(object): + """Class for parsing config dicts into StableDiffusion Config obects.""" + + @classmethod + def make_config( + cls, + model_data: Union[dict, AnyModelConfig], + key: Optional[str] = None, + dest_class: Optional[Type] = None, + ) -> AnyModelConfig: + """ + Return the appropriate config object from raw dict values. + + :param model_data: A raw dict corresponding the obect fields to be + parsed into a ModelConfigBase obect (or descendent), or a ModelConfigBase + object, which will be passed through unchanged. + :param dest_class: The config class to be returned. If not provided, will + be selected automatically. + """ + if isinstance(model_data, ModelConfigBase): + model = model_data + elif dest_class: + model = dest_class.validate_python(model_data) + else: + model = AnyModelConfigValidator.validate_python(model_data) + if key: + model.key = key + return model diff --git a/invokeai/backend/model_manager/hash.py b/invokeai/backend/model_manager/hash.py new file mode 100644 index 0000000000..fb563a8cda --- /dev/null +++ b/invokeai/backend/model_manager/hash.py @@ -0,0 +1,66 @@ +# Copyright (c) 2023 Lincoln D. Stein and the InvokeAI Development Team +""" +Fast hashing of diffusers and checkpoint-style models. + +Usage: +from invokeai.backend.model_managre.model_hash import FastModelHash +>>> FastModelHash.hash('/home/models/stable-diffusion-v1.5') +'a8e693a126ea5b831c96064dc569956f' +""" + +import hashlib +import os +from pathlib import Path +from typing import Dict, Union + +from imohash import hashfile + + +class FastModelHash(object): + """FastModelHash obect provides one public class method, hash().""" + + @classmethod + def hash(cls, model_location: Union[str, Path]) -> str: + """ + Return hexdigest string for model located at model_location. + + :param model_location: Path to the model + """ + model_location = Path(model_location) + if model_location.is_file(): + return cls._hash_file(model_location) + elif model_location.is_dir(): + return cls._hash_dir(model_location) + else: + raise OSError(f"Not a valid file or directory: {model_location}") + + @classmethod + def _hash_file(cls, model_location: Union[str, Path]) -> str: + """ + Fasthash a single file and return its hexdigest. + + :param model_location: Path to the model file + """ + # we return md5 hash of the filehash to make it shorter + # cryptographic security not needed here + return hashlib.md5(hashfile(model_location)).hexdigest() + + @classmethod + def _hash_dir(cls, model_location: Union[str, Path]) -> str: + components: Dict[str, str] = {} + + for root, _dirs, files in os.walk(model_location): + for file in files: + # only tally tensor files because diffusers config files change slightly + # depending on how the model was downloaded/converted. + if not file.endswith((".ckpt", ".safetensors", ".bin", ".pt", ".pth")): + continue + path = (Path(root) / file).as_posix() + fast_hash = cls._hash_file(path) + components.update({path: fast_hash}) + + # hash all the model hashes together, using alphabetic file order + md5 = hashlib.md5() + for _path, fast_hash in sorted(components.items()): + md5.update(fast_hash.encode("utf-8")) + return md5.hexdigest() diff --git a/invokeai/backend/model_manager/migrate_to_db.py b/invokeai/backend/model_manager/migrate_to_db.py new file mode 100644 index 0000000000..e962a7c28b --- /dev/null +++ b/invokeai/backend/model_manager/migrate_to_db.py @@ -0,0 +1,93 @@ +# Copyright (c) 2023 Lincoln D. Stein +"""Migrate from the InvokeAI v2 models.yaml format to the v3 sqlite format.""" + +from hashlib import sha1 + +from omegaconf import DictConfig, OmegaConf +from pydantic import TypeAdapter + +from invokeai.app.services.config import InvokeAIAppConfig +from invokeai.app.services.model_records import ( + DuplicateModelException, + ModelRecordServiceSQL, +) +from invokeai.app.services.shared.sqlite import SqliteDatabase +from invokeai.backend.model_manager.config import ( + AnyModelConfig, + BaseModelType, + ModelType, +) +from invokeai.backend.model_manager.hash import FastModelHash +from invokeai.backend.util.logging import InvokeAILogger + +ModelsValidator = TypeAdapter(AnyModelConfig) + + +class MigrateModelYamlToDb: + """ + Migrate the InvokeAI models.yaml format (VERSION 3.0.0) to SQL3 database format (VERSION 3.2.0) + + The class has one externally useful method, migrate(), which scans the + currently models.yaml file and imports all its entries into invokeai.db. + + Use this way: + + from invokeai.backend.model_manager/migrate_to_db import MigrateModelYamlToDb + MigrateModelYamlToDb().migrate() + + """ + + config: InvokeAIAppConfig + logger: InvokeAILogger + + def __init__(self): + self.config = InvokeAIAppConfig.get_config() + self.config.parse_args() + self.logger = InvokeAILogger.get_logger() + + def get_db(self) -> ModelRecordServiceSQL: + """Fetch the sqlite3 database for this installation.""" + db = SqliteDatabase(self.config, self.logger) + return ModelRecordServiceSQL(db) + + def get_yaml(self) -> DictConfig: + """Fetch the models.yaml DictConfig for this installation.""" + yaml_path = self.config.model_conf_path + return OmegaConf.load(yaml_path) + + def migrate(self): + """Do the migration from models.yaml to invokeai.db.""" + db = self.get_db() + yaml = self.get_yaml() + + for model_key, stanza in yaml.items(): + if model_key == "__metadata__": + assert ( + stanza["version"] == "3.0.0" + ), f"This script works on version 3.0.0 yaml files, but your configuration points to a {stanza['version']} version" + continue + + base_type, model_type, model_name = str(model_key).split("/") + hash = FastModelHash.hash(self.config.models_path / stanza.path) + new_key = sha1(model_key.encode("utf-8")).hexdigest() + + stanza["base"] = BaseModelType(base_type) + stanza["type"] = ModelType(model_type) + stanza["name"] = model_name + stanza["original_hash"] = hash + stanza["current_hash"] = hash + + new_config = ModelsValidator.validate_python(stanza) + self.logger.info(f"Adding model {model_name} with key {model_key}") + try: + db.add_model(new_key, new_config) + except DuplicateModelException: + self.logger.warning(f"Model {model_name} is already in the database") + + +def main(): + MigrateModelYamlToDb().migrate() + + +if __name__ == "__main__": + main() diff --git a/invokeai/backend/util/util.py b/invokeai/backend/util/util.py index 12ba3701cf..4612b42cb9 100644 --- a/invokeai/backend/util/util.py +++ b/invokeai/backend/util/util.py @@ -5,6 +5,7 @@ import math import multiprocessing as mp import os import re +import warnings from collections import abc from inspect import isfunction from pathlib import Path @@ -14,8 +15,10 @@ from threading import Thread import numpy as np import requests import torch +from diffusers import logging as diffusers_logging from PIL import Image, ImageDraw, ImageFont from tqdm import tqdm +from transformers import logging as transformers_logging import invokeai.backend.util.logging as logger @@ -379,3 +382,21 @@ class Chdir(object): def __exit__(self, *args): os.chdir(self.original) + + +class SilenceWarnings(object): + """Context manager to temporarily lower verbosity of diffusers & transformers warning messages.""" + + def __enter__(self): + """Set verbosity to error.""" + self.transformers_verbosity = transformers_logging.get_verbosity() + self.diffusers_verbosity = diffusers_logging.get_verbosity() + transformers_logging.set_verbosity_error() + diffusers_logging.set_verbosity_error() + warnings.simplefilter("ignore") + + def __exit__(self, type, value, traceback): + """Restore logger verbosity to state before context was entered.""" + transformers_logging.set_verbosity(self.transformers_verbosity) + diffusers_logging.set_verbosity(self.diffusers_verbosity) + warnings.simplefilter("default") diff --git a/invokeai/frontend/web/dist/assets/App-d620b60d.js b/invokeai/frontend/web/dist/assets/App-d620b60d.js new file mode 100644 index 0000000000..1411ad51c9 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/App-d620b60d.js @@ -0,0 +1,171 @@ +import{a as Pu,b as pI,S as mI,c as hI,d as gI,e as A1,f as vI,i as D1,g as BA,h as xI,j as bI,k as HA,l as db,m as WA,n as VA,o as jw,p as yI,t as UA,q as GA,r as qA,s as KA,u as QA,v as d,w as a,x as fb,y as Rm,z as XA,A as YA,B as JA,C as ZA,P as eD,D as pb,E as tD,F as nD,G as rD,H as oD,I as CI,J as Oe,K as Lr,L as sD,M as aD,N as iD,O as Bn,Q as Ee,R as _t,T as pr,U as rt,V as ff,W as yo,X as Mr,Y as Kr,Z as ar,_ as vi,$ as il,a0 as qt,a1 as _s,a2 as Yc,a3 as xi,a4 as bi,a5 as eg,a6 as mb,a7 as pf,a8 as hr,a9 as lD,aa as H,ab as _w,ac as cD,ad as wI,ae as T1,af as mf,ag as Eu,ah as uD,ai as SI,aj as kI,ak as jI,al as Ks,am as dD,an as ce,ao as we,ap as Tn,aq as W,ar as fD,as as Iw,at as pD,au as mD,av as hD,aw as yi,ax as te,ay as gD,az as $t,aA as Gn,aB as De,aC as $,aD as xo,aE as ro,aF as je,aG as J,aH as _I,aI as vD,aJ as xD,aK as bD,aL as yD,aM as rs,aN as hb,aO as Ci,aP as Vo,aQ as hf,aR as CD,aS as wD,aT as Pw,aU as gb,aV as Se,aW as Qs,aX as SD,aY as II,aZ as PI,a_ as Ew,a$ as kD,b0 as jD,b1 as _D,b2 as wi,b3 as vb,b4 as on,b5 as ID,b6 as PD,b7 as Fa,b8 as EI,b9 as MI,ba as tg,bb as ED,bc as Mw,bd as OI,be as MD,bf as OD,bg as RD,bh as AD,bi as DD,bj as TD,bk as ND,bl as RI,bm as $D,bn as LD,bo as zD,bp as FD,bq as BD,br as fu,bs as xb,bt as HD,bu as WD,bv as VD,bw as wc,bx as UD,by as GD,bz as qD,bA as KD,bB as Ow,bC as QD,bD as XD,bE as oi,bF as AI,bG as DI,bH as ng,bI as bb,bJ as yb,bK as Ps,bL as TI,bM as YD,bN as Fl,bO as kd,bP as Rw,bQ as JD,bR as ZD,bS as e7,bT as Mp,bU as Op,bV as dd,bW as kv,bX as Md,bY as Od,bZ as Rd,b_ as Ad,b$ as Aw,c0 as Am,c1 as jv,c2 as Dm,c3 as Dw,c4 as N1,c5 as _v,c6 as $1,c7 as Iv,c8 as Tm,c9 as Tw,ca as Bl,cb as Nw,cc as Hl,cd as $w,ce as Nm,cf as gf,cg as NI,ch as t7,ci as Lw,cj as Cb,ck as $m,cl as $I,cm as Oo,cn as fd,co as Sc,cp as wb,cq as LI,cr as Rp,cs as Sb,ct as n7,cu as zI,cv as Pv,cw as rg,cx as r7,cy as FI,cz as L1,cA as z1,cB as BI,cC as o7,cD as F1,cE as s7,cF as B1,cG as a7,cH as H1,cI as i7,cJ as HI,cK as l7,cL as WI,cM as VI,cN as c7,cO as UI,cP as kb,cQ as jb,cR as _b,cS as Ib,cT as og,cU as Pb,cV as ti,cW as GI,cX as qI,cY as Eb,cZ as KI,c_ as u7,c$ as pd,d0 as di,d1 as QI,d2 as XI,d3 as zw,d4 as Mb,d5 as YI,d6 as Ob,d7 as Rb,d8 as JI,d9 as Or,da as d7,db as qr,dc as f7,dd as Mu,de as sg,df as Ab,dg as ZI,dh as eP,di as p7,dj as m7,dk as h7,dl as g7,dm as v7,dn as x7,dp as b7,dq as y7,dr as C7,ds as w7,dt as Fw,du as Db,dv as S7,dw as k7,dx as vf,dy as j7,dz as _7,dA as ag,dB as I7,dC as P7,dD as E7,dE as M7,dF as gr,dG as O7,dH as R7,dI as A7,dJ as D7,dK as T7,dL as N7,dM as Bd,dN as Bw,dO as na,dP as tP,dQ as $7,dR as Tb,dS as L7,dT as Hw,dU as z7,dV as F7,dW as B7,dX as nP,dY as H7,dZ as W7,d_ as V7,d$ as U7,e0 as G7,e1 as q7,e2 as rP,e3 as K7,e4 as Q7,e5 as Ww,e6 as X7,e7 as Y7,e8 as J7,e9 as Z7,ea as eT,eb as tT,ec as nT,ed as oP,ee as rT,ef as oT,eg as sT,eh as Vw,ei as Ap,ej as Rs,ek as aT,el as iT,em as lT,en as cT,eo as uT,ep as dT,eq as Xs,er as fT,es as pT,et as mT,eu as hT,ev as gT,ew as vT,ex as xT,ey as bT,ez as yT,eA as CT,eB as wT,eC as ST,eD as kT,eE as jT,eF as _T,eG as IT,eH as PT,eI as ET,eJ as MT,eK as OT,eL as RT,eM as AT,eN as DT,eO as TT,eP as NT,eQ as Uw,eR as Gw,eS as sP,eT as $T,eU as Us,eV as Hd,eW as Gr,eX as LT,eY as zT,eZ as aP,e_ as iP,e$ as FT,f0 as qw,f1 as BT,f2 as Kw,f3 as Qw,f4 as Xw,f5 as HT,f6 as WT,f7 as Yw,f8 as Jw,f9 as VT,fa as UT,fb as Lm,fc as GT,fd as Zw,fe as eS,ff as qT,fg as zm,fh as Fm,fi as tS,fj as KT,fk as QT,fl as lP,fm as XT,fn as YT,fo as cP,fp as JT,fq as ZT,fr as nS,fs as eN,ft as rS,fu as tN,fv as nN,fw as uP,fx as dP,fy as xf,fz as fP,fA as Ml,fB as pP,fC as oS,fD as rN,fE as oN,fF as mP,fG as sN,fH as aN,fI as iN,fJ as lN,fK as cN,fL as Nb,fM as W1,fN as sS,fO as ec,fP as uN,fQ as dN,fR as hP,fS as $b,fT as gP,fU as Lb,fV as vP,fW as fN,fX as ri,fY as pN,fZ as xP,f_ as mN,f$ as zb,g0 as bP,g1 as hN,g2 as gN,g3 as vN,g4 as xN,g5 as bN,g6 as yN,g7 as CN,g8 as Bm,g9 as jd,ga as Vc,gb as wN,gc as SN,gd as kN,ge as jN,gf as _N,gg as IN,gh as PN,gi as EN,gj as aS,gk as MN,gl as ON,gm as RN,gn as AN,go as DN,gp as TN,gq as iS,gr as NN,gs as $N,gt as LN,gu as zN,gv as FN,gw as BN,gx as HN,gy as lS,gz as WN,gA as VN,gB as UN,gC as GN,gD as qN,gE as KN,gF as QN,gG as XN,gH as YN,gI as JN,gJ as ZN,gK as e9,gL as t9,gM as bf,gN as n9,gO as r9,gP as o9,gQ as s9,gR as a9,gS as i9,gT as l9,gU as c9,gV as cS,gW as xm,gX as u9,gY as Hm,gZ as yP,g_ as Wm,g$ as d9,h0 as f9,h1 as Jc,h2 as CP,h3 as wP,h4 as Fb,h5 as p9,h6 as m9,h7 as h9,h8 as V1,h9 as SP,ha as g9,hb as v9,hc as kP,hd as x9,he as b9,hf as y9,hg as C9,hh as w9,hi as uS,hj as kc,hk as S9,hl as k9,hm as j9,hn as _9,ho as I9,hp as dS,hq as P9,hr as E9,hs as M9,ht as O9,hu as R9,hv as A9,hw as D9,hx as T9,hy as Ev,hz as Mv,hA as Ov,hB as Dp,hC as fS,hD as U1,hE as pS,hF as N9,hG as $9,hH as L9,hI as z9,hJ as jP,hK as F9,hL as B9,hM as H9,hN as W9,hO as V9,hP as U9,hQ as G9,hR as q9,hS as K9,hT as Q9,hU as X9,hV as Tp,hW as Rv,hX as Y9,hY as J9,hZ as Z9,h_ as e$,h$ as t$,i0 as n$,i1 as r$,i2 as o$,i3 as s$,i4 as a$,i5 as mS,i6 as hS,i7 as i$,i8 as l$,i9 as c$}from"./index-54a1ea80.js";import{u as _P,a as Si,b as u$,r as Ge,f as d$,g as gS,c as Xt,d as Nr}from"./MantineProvider-17a58e64.js";var f$=200;function p$(e,t,n,r){var o=-1,s=hI,i=!0,l=e.length,u=[],p=t.length;if(!l)return u;n&&(t=Pu(t,pI(n))),r?(s=gI,i=!1):t.length>=f$&&(s=A1,i=!1,t=new mI(t));e:for(;++o=120&&m.length>=120)?new mI(i&&m):void 0}m=e[0];var h=-1,g=l[0];e:for(;++h{r.has(s)&&n(o,s)})}function E$(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}const IP=({id:e,x:t,y:n,width:r,height:o,style:s,color:i,strokeColor:l,strokeWidth:u,className:p,borderRadius:m,shapeRendering:h,onClick:g,selected:x})=>{const{background:y,backgroundColor:b}=s||{},C=i||y||b;return a.jsx("rect",{className:fb(["react-flow__minimap-node",{selected:x},p]),x:t,y:n,rx:m,ry:m,width:r,height:o,fill:C,stroke:l,strokeWidth:u,shapeRendering:h,onClick:g?S=>g(S,e):void 0})};IP.displayName="MiniMapNode";var M$=d.memo(IP);const O$=e=>e.nodeOrigin,R$=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Av=e=>e instanceof Function?e:()=>e;function A$({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o=2,nodeComponent:s=M$,onClick:i}){const l=Rm(R$,pb),u=Rm(O$),p=Av(t),m=Av(e),h=Av(n),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(x=>{const{x:y,y:b}=XA(x,u).positionAbsolute;return a.jsx(s,{x:y,y:b,width:x.width,height:x.height,style:x.style,selected:x.selected,className:h(x),color:p(x),borderRadius:r,strokeColor:m(x),strokeWidth:o,shapeRendering:g,onClick:i,id:x.id},x.id)})})}var D$=d.memo(A$);const T$=200,N$=150,$$=e=>{const t=e.getNodes(),n={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:n,boundingRect:t.length>0?rD(oD(t,e.nodeOrigin),n):n,rfId:e.rfId}},L$="react-flow__minimap-desc";function PP({style:e,className:t,nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:s=5,nodeStrokeWidth:i=2,nodeComponent:l,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:p="none",maskStrokeWidth:m=1,position:h="bottom-right",onClick:g,onNodeClick:x,pannable:y=!1,zoomable:b=!1,ariaLabel:C="React Flow mini map",inversePan:S=!1,zoomStep:j=10,offsetScale:_=5}){const P=YA(),I=d.useRef(null),{boundingRect:M,viewBB:O,rfId:A}=Rm($$,pb),D=(e==null?void 0:e.width)??T$,R=(e==null?void 0:e.height)??N$,N=M.width/D,Y=M.height/R,F=Math.max(N,Y),V=F*D,Q=F*R,q=_*F,z=M.x-(V-M.width)/2-q,G=M.y-(Q-M.height)/2-q,T=V+q*2,B=Q+q*2,X=`${L$}-${A}`,re=d.useRef(0);re.current=F,d.useEffect(()=>{if(I.current){const K=JA(I.current),U=Z=>{const{transform:ue,d3Selection:fe,d3Zoom:ge}=P.getState();if(Z.sourceEvent.type!=="wheel"||!fe||!ge)return;const _e=-Z.sourceEvent.deltaY*(Z.sourceEvent.deltaMode===1?.05:Z.sourceEvent.deltaMode?1:.002)*j,ye=ue[2]*Math.pow(2,_e);ge.scaleTo(fe,ye)},ee=Z=>{const{transform:ue,d3Selection:fe,d3Zoom:ge,translateExtent:_e,width:ye,height:pe}=P.getState();if(Z.sourceEvent.type!=="mousemove"||!fe||!ge)return;const Te=re.current*Math.max(1,ue[2])*(S?-1:1),Ae={x:ue[0]-Z.sourceEvent.movementX*Te,y:ue[1]-Z.sourceEvent.movementY*Te},qe=[[0,0],[ye,pe]],Pt=tD.translate(Ae.x,Ae.y).scale(ue[2]),tt=ge.constrain()(Pt,qe,_e);ge.transform(fe,tt)},de=ZA().on("zoom",y?ee:null).on("zoom.wheel",b?U:null);return K.call(de),()=>{K.on("zoom",null)}}},[y,b,S,j]);const le=g?K=>{const U=nD(K);g(K,{x:U[0],y:U[1]})}:void 0,se=x?(K,U)=>{const ee=P.getState().nodeInternals.get(U);x(K,ee)}:void 0;return a.jsx(eD,{position:h,style:e,className:fb(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:D,height:R,viewBox:`${z} ${G} ${T} ${B}`,role:"img","aria-labelledby":X,ref:I,onClick:le,children:[C&&a.jsx("title",{id:X,children:C}),a.jsx(D$,{onClick:se,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:s,nodeClassName:o,nodeStrokeWidth:i,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${z-q},${G-q}h${T+q*2}v${B+q*2}h${-T-q*2}z + M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fill:u,fillRule:"evenodd",stroke:p,strokeWidth:m,pointerEvents:"none"})]})})}PP.displayName="MiniMap";var z$=d.memo(PP),Ys;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ys||(Ys={}));function F$({color:e,dimensions:t,lineWidth:n}){return a.jsx("path",{stroke:e,strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function B$({color:e,radius:t}){return a.jsx("circle",{cx:t,cy:t,r:t,fill:e})}const H$={[Ys.Dots]:"#91919a",[Ys.Lines]:"#eee",[Ys.Cross]:"#e2e2e2"},W$={[Ys.Dots]:1,[Ys.Lines]:1,[Ys.Cross]:6},V$=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function EP({id:e,variant:t=Ys.Dots,gap:n=20,size:r,lineWidth:o=1,offset:s=2,color:i,style:l,className:u}){const p=d.useRef(null),{transform:m,patternId:h}=Rm(V$,pb),g=i||H$[t],x=r||W$[t],y=t===Ys.Dots,b=t===Ys.Cross,C=Array.isArray(n)?n:[n,n],S=[C[0]*m[2]||1,C[1]*m[2]||1],j=x*m[2],_=b?[j,j]:S,P=y?[j/s,j/s]:[_[0]/s,_[1]/s];return a.jsxs("svg",{className:fb(["react-flow__background",u]),style:{...l,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:p,"data-testid":"rf__background",children:[a.jsx("pattern",{id:h+e,x:m[0]%S[0],y:m[1]%S[1],width:S[0],height:S[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${P[0]},-${P[1]})`,children:y?a.jsx(B$,{color:g,radius:j/s}):a.jsx(F$,{dimensions:_,color:g,lineWidth:o})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${h+e})`})]})}EP.displayName="Background";var U$=d.memo(EP);const xS=(e,t,n)=>{G$(n);const r=CI(e,t);return MP[n].includes(r)},MP={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},bS=Object.keys(MP),G$=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(bS.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${bS.join("|")}`)};function q$(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var K$=q$();const OP=1/60*1e3,Q$=typeof performance<"u"?()=>performance.now():()=>Date.now(),RP=typeof window<"u"?e=>window.requestAnimationFrame(e):e=>setTimeout(()=>e(Q$()),OP);function X$(e){let t=[],n=[],r=0,o=!1,s=!1;const i=new WeakSet,l={schedule:(u,p=!1,m=!1)=>{const h=m&&o,g=h?t:n;return p&&i.add(u),g.indexOf(u)===-1&&(g.push(u),h&&o&&(r=t.length)),u},cancel:u=>{const p=n.indexOf(u);p!==-1&&n.splice(p,1),i.delete(u)},process:u=>{if(o){s=!0;return}if(o=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let p=0;p(e[t]=X$(()=>Vd=!0),e),{}),J$=yf.reduce((e,t)=>{const n=ig[t];return e[t]=(r,o=!1,s=!1)=>(Vd||tL(),n.schedule(r,o,s)),e},{}),Z$=yf.reduce((e,t)=>(e[t]=ig[t].cancel,e),{});yf.reduce((e,t)=>(e[t]=()=>ig[t].process(Zc),e),{});const eL=e=>ig[e].process(Zc),AP=e=>{Vd=!1,Zc.delta=G1?OP:Math.max(Math.min(e-Zc.timestamp,Y$),1),Zc.timestamp=e,q1=!0,yf.forEach(eL),q1=!1,Vd&&(G1=!1,RP(AP))},tL=()=>{Vd=!0,G1=!0,q1||RP(AP)},yS=()=>Zc;function lg(e){const{viewBox:t="0 0 24 24",d:n,displayName:r,defaultProps:o={}}=e,s=d.Children.toArray(e.path),i=Oe((l,u)=>a.jsx(Lr,{ref:u,viewBox:t,...o,...l,children:s.length?s:a.jsx("path",{fill:"currentColor",d:n})}));return i.displayName=r,i}function DP(e){const{theme:t}=sD(),n=aD();return d.useMemo(()=>iD(t.direction,{...n,...e}),[e,t.direction,n])}var nL=Object.defineProperty,rL=(e,t,n)=>t in e?nL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pr=(e,t,n)=>(rL(e,typeof t!="symbol"?t+"":t,n),n);function CS(e){return e.sort((t,n)=>{const r=t.compareDocumentPosition(n);if(r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY)return-1;if(r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS)return 1;if(r&Node.DOCUMENT_POSITION_DISCONNECTED||r&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC)throw Error("Cannot sort the given nodes.");return 0})}var oL=e=>typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE;function wS(e,t,n){let r=e+1;return n&&r>=t&&(r=0),r}function SS(e,t,n){let r=e-1;return n&&r<0&&(r=t),r}var K1=typeof window<"u"?d.useLayoutEffect:d.useEffect,Vm=e=>e,sL=class{constructor(){Pr(this,"descendants",new Map),Pr(this,"register",e=>{if(e!=null)return oL(e)?this.registerNode(e):t=>{this.registerNode(t,e)}}),Pr(this,"unregister",e=>{this.descendants.delete(e);const t=CS(Array.from(this.descendants.keys()));this.assignIndex(t)}),Pr(this,"destroy",()=>{this.descendants.clear()}),Pr(this,"assignIndex",e=>{this.descendants.forEach(t=>{const n=e.indexOf(t.node);t.index=n,t.node.dataset.index=t.index.toString()})}),Pr(this,"count",()=>this.descendants.size),Pr(this,"enabledCount",()=>this.enabledValues().length),Pr(this,"values",()=>Array.from(this.descendants.values()).sort((t,n)=>t.index-n.index)),Pr(this,"enabledValues",()=>this.values().filter(e=>!e.disabled)),Pr(this,"item",e=>{if(this.count()!==0)return this.values()[e]}),Pr(this,"enabledItem",e=>{if(this.enabledCount()!==0)return this.enabledValues()[e]}),Pr(this,"first",()=>this.item(0)),Pr(this,"firstEnabled",()=>this.enabledItem(0)),Pr(this,"last",()=>this.item(this.descendants.size-1)),Pr(this,"lastEnabled",()=>{const e=this.enabledValues().length-1;return this.enabledItem(e)}),Pr(this,"indexOf",e=>{var t,n;return e&&(n=(t=this.descendants.get(e))==null?void 0:t.index)!=null?n:-1}),Pr(this,"enabledIndexOf",e=>e==null?-1:this.enabledValues().findIndex(t=>t.node.isSameNode(e))),Pr(this,"next",(e,t=!0)=>{const n=wS(e,this.count(),t);return this.item(n)}),Pr(this,"nextEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=wS(r,this.enabledCount(),t);return this.enabledItem(o)}),Pr(this,"prev",(e,t=!0)=>{const n=SS(e,this.count()-1,t);return this.item(n)}),Pr(this,"prevEnabled",(e,t=!0)=>{const n=this.item(e);if(!n)return;const r=this.enabledIndexOf(n.node),o=SS(r,this.enabledCount()-1,t);return this.enabledItem(o)}),Pr(this,"registerNode",(e,t)=>{if(!e||this.descendants.has(e))return;const n=Array.from(this.descendants.keys()).concat(e),r=CS(n);t!=null&&t.disabled&&(t.disabled=!!t.disabled);const o={node:e,index:-1,...t};this.descendants.set(e,o),this.assignIndex(r)})}};function aL(e,t){if(e!=null){if(typeof e=="function"){e(t);return}try{e.current=t}catch{throw new Error(`Cannot assign value '${t}' to ref '${e}'`)}}}function gn(...e){return t=>{e.forEach(n=>{aL(n,t)})}}function iL(...e){return d.useMemo(()=>gn(...e),e)}function lL(){const e=d.useRef(new sL);return K1(()=>()=>e.current.destroy()),e.current}var[cL,TP]=Bn({name:"DescendantsProvider",errorMessage:"useDescendantsContext must be used within DescendantsProvider"});function uL(e){const t=TP(),[n,r]=d.useState(-1),o=d.useRef(null);K1(()=>()=>{o.current&&t.unregister(o.current)},[]),K1(()=>{if(!o.current)return;const i=Number(o.current.dataset.index);n!=i&&!Number.isNaN(i)&&r(i)});const s=Vm(e?t.register(e):t.register);return{descendants:t,index:n,enabledIndex:t.enabledIndexOf(o.current),register:gn(s,o)}}function Bb(){return[Vm(cL),()=>Vm(TP()),()=>lL(),o=>uL(o)]}var[dL,cg]=Bn({name:"AccordionStylesContext",hookName:"useAccordionStyles",providerName:""}),[fL,Hb]=Bn({name:"AccordionItemContext",hookName:"useAccordionItemContext",providerName:""}),[pL,mxe,mL,hL]=Bb(),Tc=Oe(function(t,n){const{getButtonProps:r}=Hb(),o=r(t,n),i={display:"flex",alignItems:"center",width:"100%",outline:0,...cg().button};return a.jsx(Ee.button,{...o,className:_t("chakra-accordion__button",t.className),__css:i})});Tc.displayName="AccordionButton";function Cf(e){const{value:t,defaultValue:n,onChange:r,shouldUpdate:o=(g,x)=>g!==x}=e,s=pr(r),i=pr(o),[l,u]=d.useState(n),p=t!==void 0,m=p?t:l,h=pr(g=>{const y=typeof g=="function"?g(m):g;i(m,y)&&(p||u(y),s(y))},[p,s,m,i]);return[m,h]}function gL(e){const{onChange:t,defaultIndex:n,index:r,allowMultiple:o,allowToggle:s,...i}=e;bL(e),yL(e);const l=mL(),[u,p]=d.useState(-1);d.useEffect(()=>()=>{p(-1)},[]);const[m,h]=Cf({value:r,defaultValue(){return o?n??[]:n??-1},onChange:t});return{index:m,setIndex:h,htmlProps:i,getAccordionItemProps:x=>{let y=!1;return x!==null&&(y=Array.isArray(m)?m.includes(x):m===x),{isOpen:y,onChange:C=>{if(x!==null)if(o&&Array.isArray(m)){const S=C?m.concat(x):m.filter(j=>j!==x);h(S)}else C?h(x):s&&h(-1)}}},focusedIndex:u,setFocusedIndex:p,descendants:l}}var[vL,Wb]=Bn({name:"AccordionContext",hookName:"useAccordionContext",providerName:"Accordion"});function xL(e){const{isDisabled:t,isFocusable:n,id:r,...o}=e,{getAccordionItemProps:s,setFocusedIndex:i}=Wb(),l=d.useRef(null),u=d.useId(),p=r??u,m=`accordion-button-${p}`,h=`accordion-panel-${p}`;CL(e);const{register:g,index:x,descendants:y}=hL({disabled:t&&!n}),{isOpen:b,onChange:C}=s(x===-1?null:x);wL({isOpen:b,isDisabled:t});const S=()=>{C==null||C(!0)},j=()=>{C==null||C(!1)},_=d.useCallback(()=>{C==null||C(!b),i(x)},[x,i,b,C]),P=d.useCallback(A=>{const R={ArrowDown:()=>{const N=y.nextEnabled(x);N==null||N.node.focus()},ArrowUp:()=>{const N=y.prevEnabled(x);N==null||N.node.focus()},Home:()=>{const N=y.firstEnabled();N==null||N.node.focus()},End:()=>{const N=y.lastEnabled();N==null||N.node.focus()}}[A.key];R&&(A.preventDefault(),R(A))},[y,x]),I=d.useCallback(()=>{i(x)},[i,x]),M=d.useCallback(function(D={},R=null){return{...D,type:"button",ref:gn(g,l,R),id:m,disabled:!!t,"aria-expanded":!!b,"aria-controls":h,onClick:rt(D.onClick,_),onFocus:rt(D.onFocus,I),onKeyDown:rt(D.onKeyDown,P)}},[m,t,b,_,I,P,h,g]),O=d.useCallback(function(D={},R=null){return{...D,ref:R,role:"region",id:h,"aria-labelledby":m,hidden:!b}},[m,b,h]);return{isOpen:b,isDisabled:t,isFocusable:n,onOpen:S,onClose:j,getButtonProps:M,getPanelProps:O,htmlProps:o}}function bL(e){const t=e.index||e.defaultIndex,n=t!=null&&!Array.isArray(t)&&e.allowMultiple;ff({condition:!!n,message:`If 'allowMultiple' is passed, then 'index' or 'defaultIndex' must be an array. You passed: ${typeof t},`})}function yL(e){ff({condition:!!(e.allowMultiple&&e.allowToggle),message:"If 'allowMultiple' is passed, 'allowToggle' will be ignored. Either remove 'allowToggle' or 'allowMultiple' depending on whether you want multiple accordions visible or not"})}function CL(e){ff({condition:!!(e.isFocusable&&!e.isDisabled),message:`Using only 'isFocusable', this prop is reserved for situations where you pass 'isDisabled' but you still want the element to receive focus (A11y). Either remove it or pass 'isDisabled' as well. + `})}function wL(e){ff({condition:e.isOpen&&!!e.isDisabled,message:"Cannot open a disabled accordion item"})}function Nc(e){const{isOpen:t,isDisabled:n}=Hb(),{reduceMotion:r}=Wb(),o=_t("chakra-accordion__icon",e.className),s=cg(),i={opacity:n?.4:1,transform:t?"rotate(-180deg)":void 0,transition:r?void 0:"transform 0.2s",transformOrigin:"center",...s.icon};return a.jsx(Lr,{viewBox:"0 0 24 24","aria-hidden":!0,className:o,__css:i,...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})})}Nc.displayName="AccordionIcon";var $c=Oe(function(t,n){const{children:r,className:o}=t,{htmlProps:s,...i}=xL(t),u={...cg().container,overflowAnchor:"none"},p=d.useMemo(()=>i,[i]);return a.jsx(fL,{value:p,children:a.jsx(Ee.div,{ref:n,...s,className:_t("chakra-accordion__item",o),__css:u,children:typeof r=="function"?r({isExpanded:!!i.isOpen,isDisabled:!!i.isDisabled}):r})})});$c.displayName="AccordionItem";var Uc={ease:[.25,.1,.25,1],easeIn:[.4,0,1,1],easeOut:[0,0,.2,1],easeInOut:[.4,0,.2,1]},Al={enter:{duration:.2,ease:Uc.easeOut},exit:{duration:.1,ease:Uc.easeIn}},si={enter:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.enter}),exit:(e,t)=>({...e,delay:typeof t=="number"?t:t==null?void 0:t.exit})},SL=e=>e!=null&&parseInt(e.toString(),10)>0,kS={exit:{height:{duration:.2,ease:Uc.ease},opacity:{duration:.3,ease:Uc.ease}},enter:{height:{duration:.3,ease:Uc.ease},opacity:{duration:.4,ease:Uc.ease}}},kL={exit:({animateOpacity:e,startingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:SL(t)?1:0},height:t,transitionEnd:r==null?void 0:r.exit,transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(kS.exit,o)}},enter:({animateOpacity:e,endingHeight:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{...e&&{opacity:1},height:t,transitionEnd:r==null?void 0:r.enter,transition:(s=n==null?void 0:n.enter)!=null?s:si.enter(kS.enter,o)}}},wf=d.forwardRef((e,t)=>{const{in:n,unmountOnExit:r,animateOpacity:o=!0,startingHeight:s=0,endingHeight:i="auto",style:l,className:u,transition:p,transitionEnd:m,...h}=e,[g,x]=d.useState(!1);d.useEffect(()=>{const j=setTimeout(()=>{x(!0)});return()=>clearTimeout(j)},[]),ff({condition:Number(s)>0&&!!r,message:"startingHeight and unmountOnExit are mutually exclusive. You can't use them together"});const y=parseFloat(s.toString())>0,b={startingHeight:s,endingHeight:i,animateOpacity:o,transition:g?p:{enter:{duration:0}},transitionEnd:{enter:m==null?void 0:m.enter,exit:r?m==null?void 0:m.exit:{...m==null?void 0:m.exit,display:y?"block":"none"}}},C=r?n:!0,S=n||r?"enter":"exit";return a.jsx(yo,{initial:!1,custom:b,children:C&&a.jsx(Mr.div,{ref:t,...h,className:_t("chakra-collapse",u),style:{overflow:"hidden",display:"block",...l},custom:b,variants:kL,initial:r?"exit":!1,animate:S,exit:"exit"})})});wf.displayName="Collapse";var jL={enter:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:1,transition:(r=e==null?void 0:e.enter)!=null?r:si.enter(Al.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({transition:e,transitionEnd:t,delay:n}={})=>{var r;return{opacity:0,transition:(r=e==null?void 0:e.exit)!=null?r:si.exit(Al.exit,n),transitionEnd:t==null?void 0:t.exit}}},NP={initial:"exit",animate:"enter",exit:"exit",variants:jL},_L=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,className:s,transition:i,transitionEnd:l,delay:u,...p}=t,m=o||r?"enter":"exit",h=r?o&&r:!0,g={transition:i,transitionEnd:l,delay:u};return a.jsx(yo,{custom:g,children:h&&a.jsx(Mr.div,{ref:n,className:_t("chakra-fade",s),custom:g,...NP,animate:m,...p})})});_L.displayName="Fade";var IL={exit:({reverse:e,initialScale:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,...e?{scale:t,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{scale:t,...r==null?void 0:r.exit}},transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(Al.exit,o)}},enter:({transitionEnd:e,transition:t,delay:n})=>{var r;return{opacity:1,scale:1,transition:(r=t==null?void 0:t.enter)!=null?r:si.enter(Al.enter,n),transitionEnd:e==null?void 0:e.enter}}},$P={initial:"exit",animate:"enter",exit:"exit",variants:IL},PL=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,initialScale:i=.95,className:l,transition:u,transitionEnd:p,delay:m,...h}=t,g=r?o&&r:!0,x=o||r?"enter":"exit",y={initialScale:i,reverse:s,transition:u,transitionEnd:p,delay:m};return a.jsx(yo,{custom:y,children:g&&a.jsx(Mr.div,{ref:n,className:_t("chakra-offset-slide",l),...$P,animate:x,custom:y,...h})})});PL.displayName="ScaleFade";var EL={initial:({offsetX:e,offsetY:t,transition:n,transitionEnd:r,delay:o})=>{var s;return{opacity:0,x:e,y:t,transition:(s=n==null?void 0:n.exit)!=null?s:si.exit(Al.exit,o),transitionEnd:r==null?void 0:r.exit}},enter:({transition:e,transitionEnd:t,delay:n})=>{var r;return{opacity:1,x:0,y:0,transition:(r=e==null?void 0:e.enter)!=null?r:si.enter(Al.enter,n),transitionEnd:t==null?void 0:t.enter}},exit:({offsetY:e,offsetX:t,transition:n,transitionEnd:r,reverse:o,delay:s})=>{var i;const l={x:t,y:e};return{opacity:0,transition:(i=n==null?void 0:n.exit)!=null?i:si.exit(Al.exit,s),...o?{...l,transitionEnd:r==null?void 0:r.exit}:{transitionEnd:{...l,...r==null?void 0:r.exit}}}}},Q1={initial:"initial",animate:"enter",exit:"exit",variants:EL},ML=d.forwardRef(function(t,n){const{unmountOnExit:r,in:o,reverse:s=!0,className:i,offsetX:l=0,offsetY:u=8,transition:p,transitionEnd:m,delay:h,...g}=t,x=r?o&&r:!0,y=o||r?"enter":"exit",b={offsetX:l,offsetY:u,reverse:s,transition:p,transitionEnd:m,delay:h};return a.jsx(yo,{custom:b,children:x&&a.jsx(Mr.div,{ref:n,className:_t("chakra-offset-slide",i),custom:b,...Q1,animate:y,...g})})});ML.displayName="SlideFade";var Lc=Oe(function(t,n){const{className:r,motionProps:o,...s}=t,{reduceMotion:i}=Wb(),{getPanelProps:l,isOpen:u}=Hb(),p=l(s,n),m=_t("chakra-accordion__panel",r),h=cg();i||delete p.hidden;const g=a.jsx(Ee.div,{...p,__css:h.panel,className:m});return i?g:a.jsx(wf,{in:u,...o,children:g})});Lc.displayName="AccordionPanel";var LP=Oe(function({children:t,reduceMotion:n,...r},o){const s=Kr("Accordion",r),i=ar(r),{htmlProps:l,descendants:u,...p}=gL(i),m=d.useMemo(()=>({...p,reduceMotion:!!n}),[p,n]);return a.jsx(pL,{value:u,children:a.jsx(vL,{value:m,children:a.jsx(dL,{value:s,children:a.jsx(Ee.div,{ref:o,...l,className:_t("chakra-accordion",r.className),__css:s.root,children:t})})})})});LP.displayName="Accordion";function ug(e){return d.Children.toArray(e).filter(t=>d.isValidElement(t))}var[OL,RL]=Bn({strict:!1,name:"ButtonGroupContext"}),AL={horizontal:{"> *:first-of-type:not(:last-of-type)":{borderEndRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderStartRadius:0}},vertical:{"> *:first-of-type:not(:last-of-type)":{borderBottomRadius:0},"> *:not(:first-of-type):not(:last-of-type)":{borderRadius:0},"> *:not(:first-of-type):last-of-type":{borderTopRadius:0}}},DL={horizontal:e=>({"& > *:not(style) ~ *:not(style)":{marginStart:e}}),vertical:e=>({"& > *:not(style) ~ *:not(style)":{marginTop:e}})},zn=Oe(function(t,n){const{size:r,colorScheme:o,variant:s,className:i,spacing:l="0.5rem",isAttached:u,isDisabled:p,orientation:m="horizontal",...h}=t,g=_t("chakra-button__group",i),x=d.useMemo(()=>({size:r,colorScheme:o,variant:s,isDisabled:p}),[r,o,s,p]);let y={display:"inline-flex",...u?AL[m]:DL[m](l)};const b=m==="vertical";return a.jsx(OL,{value:x,children:a.jsx(Ee.div,{ref:n,role:"group",__css:y,className:g,"data-attached":u?"":void 0,"data-orientation":m,flexDir:b?"column":void 0,...h})})});zn.displayName="ButtonGroup";function TL(e){const[t,n]=d.useState(!e);return{ref:d.useCallback(s=>{s&&n(s.tagName==="BUTTON")},[]),type:t?"button":void 0}}function X1(e){const{children:t,className:n,...r}=e,o=d.isValidElement(t)?d.cloneElement(t,{"aria-hidden":!0,focusable:!1}):t,s=_t("chakra-button__icon",n);return a.jsx(Ee.span,{display:"inline-flex",alignSelf:"center",flexShrink:0,...r,className:s,children:o})}X1.displayName="ButtonIcon";function Y1(e){const{label:t,placement:n,spacing:r="0.5rem",children:o=a.jsx(vi,{color:"currentColor",width:"1em",height:"1em"}),className:s,__css:i,...l}=e,u=_t("chakra-button__spinner",s),p=n==="start"?"marginEnd":"marginStart",m=d.useMemo(()=>({display:"flex",alignItems:"center",position:t?"relative":"absolute",[p]:t?r:0,fontSize:"1em",lineHeight:"normal",...i}),[i,t,p,r]);return a.jsx(Ee.div,{className:u,...l,__css:m,children:o})}Y1.displayName="ButtonSpinner";var el=Oe((e,t)=>{const n=RL(),r=il("Button",{...n,...e}),{isDisabled:o=n==null?void 0:n.isDisabled,isLoading:s,isActive:i,children:l,leftIcon:u,rightIcon:p,loadingText:m,iconSpacing:h="0.5rem",type:g,spinner:x,spinnerPlacement:y="start",className:b,as:C,...S}=ar(e),j=d.useMemo(()=>{const M={...r==null?void 0:r._focus,zIndex:1};return{display:"inline-flex",appearance:"none",alignItems:"center",justifyContent:"center",userSelect:"none",position:"relative",whiteSpace:"nowrap",verticalAlign:"middle",outline:"none",...r,...!!n&&{_focus:M}}},[r,n]),{ref:_,type:P}=TL(C),I={rightIcon:p,leftIcon:u,iconSpacing:h,children:l};return a.jsxs(Ee.button,{ref:iL(t,_),as:C,type:g??P,"data-active":qt(i),"data-loading":qt(s),__css:j,className:_t("chakra-button",b),...S,disabled:o||s,children:[s&&y==="start"&&a.jsx(Y1,{className:"chakra-button__spinner--start",label:m,placement:"start",spacing:h,children:x}),s?m||a.jsx(Ee.span,{opacity:0,children:a.jsx(jS,{...I})}):a.jsx(jS,{...I}),s&&y==="end"&&a.jsx(Y1,{className:"chakra-button__spinner--end",label:m,placement:"end",spacing:h,children:x})]})});el.displayName="Button";function jS(e){const{leftIcon:t,rightIcon:n,children:r,iconSpacing:o}=e;return a.jsxs(a.Fragment,{children:[t&&a.jsx(X1,{marginEnd:o,children:t}),r,n&&a.jsx(X1,{marginStart:o,children:n})]})}var Pa=Oe((e,t)=>{const{icon:n,children:r,isRound:o,"aria-label":s,...i}=e,l=n||r,u=d.isValidElement(l)?d.cloneElement(l,{"aria-hidden":!0,focusable:!1}):null;return a.jsx(el,{padding:"0",borderRadius:o?"full":void 0,ref:t,"aria-label":s,...i,children:u})});Pa.displayName="IconButton";var[hxe,NL]=Bn({name:"CheckboxGroupContext",strict:!1});function $L(e){const[t,n]=d.useState(e),[r,o]=d.useState(!1);return e!==t&&(o(!0),n(e)),r}function LL(e){return a.jsx(Ee.svg,{width:"1.2em",viewBox:"0 0 12 10",style:{fill:"none",strokeWidth:2,stroke:"currentColor",strokeDasharray:16},...e,children:a.jsx("polyline",{points:"1.5 6 4.5 9 10.5 1"})})}function zL(e){return a.jsx(Ee.svg,{width:"1.2em",viewBox:"0 0 24 24",style:{stroke:"currentColor",strokeWidth:4},...e,children:a.jsx("line",{x1:"21",x2:"3",y1:"12",y2:"12"})})}function FL(e){const{isIndeterminate:t,isChecked:n,...r}=e,o=t?zL:LL;return n||t?a.jsx(Ee.div,{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%"},children:a.jsx(o,{...r})}):null}var[BL,zP]=Bn({name:"FormControlStylesContext",errorMessage:`useFormControlStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[HL,Sf]=Bn({strict:!1,name:"FormControlContext"});function WL(e){const{id:t,isRequired:n,isInvalid:r,isDisabled:o,isReadOnly:s,...i}=e,l=d.useId(),u=t||`field-${l}`,p=`${u}-label`,m=`${u}-feedback`,h=`${u}-helptext`,[g,x]=d.useState(!1),[y,b]=d.useState(!1),[C,S]=d.useState(!1),j=d.useCallback((O={},A=null)=>({id:h,...O,ref:gn(A,D=>{D&&b(!0)})}),[h]),_=d.useCallback((O={},A=null)=>({...O,ref:A,"data-focus":qt(C),"data-disabled":qt(o),"data-invalid":qt(r),"data-readonly":qt(s),id:O.id!==void 0?O.id:p,htmlFor:O.htmlFor!==void 0?O.htmlFor:u}),[u,o,C,r,s,p]),P=d.useCallback((O={},A=null)=>({id:m,...O,ref:gn(A,D=>{D&&x(!0)}),"aria-live":"polite"}),[m]),I=d.useCallback((O={},A=null)=>({...O,...i,ref:A,role:"group"}),[i]),M=d.useCallback((O={},A=null)=>({...O,ref:A,role:"presentation","aria-hidden":!0,children:O.children||"*"}),[]);return{isRequired:!!n,isInvalid:!!r,isReadOnly:!!s,isDisabled:!!o,isFocused:!!C,onFocus:()=>S(!0),onBlur:()=>S(!1),hasFeedbackText:g,setHasFeedbackText:x,hasHelpText:y,setHasHelpText:b,id:u,labelId:p,feedbackId:m,helpTextId:h,htmlProps:i,getHelpTextProps:j,getErrorMessageProps:P,getRootProps:I,getLabelProps:_,getRequiredIndicatorProps:M}}var Kn=Oe(function(t,n){const r=Kr("Form",t),o=ar(t),{getRootProps:s,htmlProps:i,...l}=WL(o),u=_t("chakra-form-control",t.className);return a.jsx(HL,{value:l,children:a.jsx(BL,{value:r,children:a.jsx(Ee.div,{...s({},n),className:u,__css:r.container})})})});Kn.displayName="FormControl";var FP=Oe(function(t,n){const r=Sf(),o=zP(),s=_t("chakra-form__helper-text",t.className);return a.jsx(Ee.div,{...r==null?void 0:r.getHelpTextProps(t,n),__css:o.helperText,className:s})});FP.displayName="FormHelperText";var Rr=Oe(function(t,n){var r;const o=il("FormLabel",t),s=ar(t),{className:i,children:l,requiredIndicator:u=a.jsx(BP,{}),optionalIndicator:p=null,...m}=s,h=Sf(),g=(r=h==null?void 0:h.getLabelProps(m,n))!=null?r:{ref:n,...m};return a.jsxs(Ee.label,{...g,className:_t("chakra-form__label",s.className),__css:{display:"block",textAlign:"start",...o},children:[l,h!=null&&h.isRequired?u:p]})});Rr.displayName="FormLabel";var BP=Oe(function(t,n){const r=Sf(),o=zP();if(!(r!=null&&r.isRequired))return null;const s=_t("chakra-form__required-indicator",t.className);return a.jsx(Ee.span,{...r==null?void 0:r.getRequiredIndicatorProps(t,n),__css:o.requiredIndicator,className:s})});BP.displayName="RequiredIndicator";function Vb(e){const{isDisabled:t,isInvalid:n,isReadOnly:r,isRequired:o,...s}=Ub(e);return{...s,disabled:t,readOnly:r,required:o,"aria-invalid":_s(n),"aria-required":_s(o),"aria-readonly":_s(r)}}function Ub(e){var t,n,r;const o=Sf(),{id:s,disabled:i,readOnly:l,required:u,isRequired:p,isInvalid:m,isReadOnly:h,isDisabled:g,onFocus:x,onBlur:y,...b}=e,C=e["aria-describedby"]?[e["aria-describedby"]]:[];return o!=null&&o.hasFeedbackText&&(o!=null&&o.isInvalid)&&C.push(o.feedbackId),o!=null&&o.hasHelpText&&C.push(o.helpTextId),{...b,"aria-describedby":C.join(" ")||void 0,id:s??(o==null?void 0:o.id),isDisabled:(t=i??g)!=null?t:o==null?void 0:o.isDisabled,isReadOnly:(n=l??h)!=null?n:o==null?void 0:o.isReadOnly,isRequired:(r=u??p)!=null?r:o==null?void 0:o.isRequired,isInvalid:m??(o==null?void 0:o.isInvalid),onFocus:rt(o==null?void 0:o.onFocus,x),onBlur:rt(o==null?void 0:o.onBlur,y)}}var Gb={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},HP=Ee("span",{baseStyle:Gb});HP.displayName="VisuallyHidden";var VL=Ee("input",{baseStyle:Gb});VL.displayName="VisuallyHiddenInput";const UL=()=>typeof document<"u";let _S=!1,kf=null,Wl=!1,J1=!1;const Z1=new Set;function qb(e,t){Z1.forEach(n=>n(e,t))}const GL=typeof window<"u"&&window.navigator!=null?/^Mac/.test(window.navigator.platform):!1;function qL(e){return!(e.metaKey||!GL&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function IS(e){Wl=!0,qL(e)&&(kf="keyboard",qb("keyboard",e))}function jc(e){if(kf="pointer",e.type==="mousedown"||e.type==="pointerdown"){Wl=!0;const t=e.composedPath?e.composedPath()[0]:e.target;let n=!1;try{n=t.matches(":focus-visible")}catch{}if(n)return;qb("pointer",e)}}function KL(e){return e.mozInputSource===0&&e.isTrusted?!0:e.detail===0&&!e.pointerType}function QL(e){KL(e)&&(Wl=!0,kf="virtual")}function XL(e){e.target===window||e.target===document||(!Wl&&!J1&&(kf="virtual",qb("virtual",e)),Wl=!1,J1=!1)}function YL(){Wl=!1,J1=!0}function PS(){return kf!=="pointer"}function JL(){if(!UL()||_S)return;const{focus:e}=HTMLElement.prototype;HTMLElement.prototype.focus=function(...n){Wl=!0,e.apply(this,n)},document.addEventListener("keydown",IS,!0),document.addEventListener("keyup",IS,!0),document.addEventListener("click",QL,!0),window.addEventListener("focus",XL,!0),window.addEventListener("blur",YL,!1),typeof PointerEvent<"u"?(document.addEventListener("pointerdown",jc,!0),document.addEventListener("pointermove",jc,!0),document.addEventListener("pointerup",jc,!0)):(document.addEventListener("mousedown",jc,!0),document.addEventListener("mousemove",jc,!0),document.addEventListener("mouseup",jc,!0)),_S=!0}function WP(e){JL(),e(PS());const t=()=>e(PS());return Z1.add(t),()=>{Z1.delete(t)}}function ZL(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function VP(e={}){const t=Ub(e),{isDisabled:n,isReadOnly:r,isRequired:o,isInvalid:s,id:i,onBlur:l,onFocus:u,"aria-describedby":p}=t,{defaultChecked:m,isChecked:h,isFocusable:g,onChange:x,isIndeterminate:y,name:b,value:C,tabIndex:S=void 0,"aria-label":j,"aria-labelledby":_,"aria-invalid":P,...I}=e,M=ZL(I,["isDisabled","isReadOnly","isRequired","isInvalid","id","onBlur","onFocus","aria-describedby"]),O=pr(x),A=pr(l),D=pr(u),[R,N]=d.useState(!1),[Y,F]=d.useState(!1),[V,Q]=d.useState(!1),[q,z]=d.useState(!1);d.useEffect(()=>WP(N),[]);const G=d.useRef(null),[T,B]=d.useState(!0),[X,re]=d.useState(!!m),le=h!==void 0,se=le?h:X,K=d.useCallback(pe=>{if(r||n){pe.preventDefault();return}le||re(se?pe.target.checked:y?!0:pe.target.checked),O==null||O(pe)},[r,n,se,le,y,O]);Yc(()=>{G.current&&(G.current.indeterminate=!!y)},[y]),xi(()=>{n&&F(!1)},[n,F]),Yc(()=>{const pe=G.current;if(!(pe!=null&&pe.form))return;const Te=()=>{re(!!m)};return pe.form.addEventListener("reset",Te),()=>{var Ae;return(Ae=pe.form)==null?void 0:Ae.removeEventListener("reset",Te)}},[]);const U=n&&!g,ee=d.useCallback(pe=>{pe.key===" "&&z(!0)},[z]),de=d.useCallback(pe=>{pe.key===" "&&z(!1)},[z]);Yc(()=>{if(!G.current)return;G.current.checked!==se&&re(G.current.checked)},[G.current]);const Z=d.useCallback((pe={},Te=null)=>{const Ae=qe=>{Y&&qe.preventDefault(),z(!0)};return{...pe,ref:Te,"data-active":qt(q),"data-hover":qt(V),"data-checked":qt(se),"data-focus":qt(Y),"data-focus-visible":qt(Y&&R),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r),"aria-hidden":!0,onMouseDown:rt(pe.onMouseDown,Ae),onMouseUp:rt(pe.onMouseUp,()=>z(!1)),onMouseEnter:rt(pe.onMouseEnter,()=>Q(!0)),onMouseLeave:rt(pe.onMouseLeave,()=>Q(!1))}},[q,se,n,Y,R,V,y,s,r]),ue=d.useCallback((pe={},Te=null)=>({...pe,ref:Te,"data-active":qt(q),"data-hover":qt(V),"data-checked":qt(se),"data-focus":qt(Y),"data-focus-visible":qt(Y&&R),"data-indeterminate":qt(y),"data-disabled":qt(n),"data-invalid":qt(s),"data-readonly":qt(r)}),[q,se,n,Y,R,V,y,s,r]),fe=d.useCallback((pe={},Te=null)=>({...M,...pe,ref:gn(Te,Ae=>{Ae&&B(Ae.tagName==="LABEL")}),onClick:rt(pe.onClick,()=>{var Ae;T||((Ae=G.current)==null||Ae.click(),requestAnimationFrame(()=>{var qe;(qe=G.current)==null||qe.focus({preventScroll:!0})}))}),"data-disabled":qt(n),"data-checked":qt(se),"data-invalid":qt(s)}),[M,n,se,s,T]),ge=d.useCallback((pe={},Te=null)=>({...pe,ref:gn(G,Te),type:"checkbox",name:b,value:C,id:i,tabIndex:S,onChange:rt(pe.onChange,K),onBlur:rt(pe.onBlur,A,()=>F(!1)),onFocus:rt(pe.onFocus,D,()=>F(!0)),onKeyDown:rt(pe.onKeyDown,ee),onKeyUp:rt(pe.onKeyUp,de),required:o,checked:se,disabled:U,readOnly:r,"aria-label":j,"aria-labelledby":_,"aria-invalid":P?!!P:s,"aria-describedby":p,"aria-disabled":n,style:Gb}),[b,C,i,K,A,D,ee,de,o,se,U,r,j,_,P,s,p,n,S]),_e=d.useCallback((pe={},Te=null)=>({...pe,ref:Te,onMouseDown:rt(pe.onMouseDown,ez),"data-disabled":qt(n),"data-checked":qt(se),"data-invalid":qt(s)}),[se,n,s]);return{state:{isInvalid:s,isFocused:Y,isChecked:se,isActive:q,isHovered:V,isIndeterminate:y,isDisabled:n,isReadOnly:r,isRequired:o},getRootProps:fe,getCheckboxProps:Z,getIndicatorProps:ue,getInputProps:ge,getLabelProps:_e,htmlProps:M}}function ez(e){e.preventDefault(),e.stopPropagation()}var tz={display:"inline-flex",alignItems:"center",justifyContent:"center",verticalAlign:"top",userSelect:"none",flexShrink:0},nz={cursor:"pointer",display:"inline-flex",alignItems:"center",verticalAlign:"top",position:"relative"},rz=bi({from:{opacity:0,strokeDashoffset:16,transform:"scale(0.95)"},to:{opacity:1,strokeDashoffset:0,transform:"scale(1)"}}),oz=bi({from:{opacity:0},to:{opacity:1}}),sz=bi({from:{transform:"scaleX(0.65)"},to:{transform:"scaleX(1)"}}),jf=Oe(function(t,n){const r=NL(),o={...r,...t},s=Kr("Checkbox",o),i=ar(t),{spacing:l="0.5rem",className:u,children:p,iconColor:m,iconSize:h,icon:g=a.jsx(FL,{}),isChecked:x,isDisabled:y=r==null?void 0:r.isDisabled,onChange:b,inputProps:C,...S}=i;let j=x;r!=null&&r.value&&i.value&&(j=r.value.includes(i.value));let _=b;r!=null&&r.onChange&&i.value&&(_=eg(r.onChange,b));const{state:P,getInputProps:I,getCheckboxProps:M,getLabelProps:O,getRootProps:A}=VP({...S,isDisabled:y,isChecked:j,onChange:_}),D=$L(P.isChecked),R=d.useMemo(()=>({animation:D?P.isIndeterminate?`${oz} 20ms linear, ${sz} 200ms linear`:`${rz} 200ms linear`:void 0,fontSize:h,color:m,...s.icon}),[m,h,D,P.isIndeterminate,s.icon]),N=d.cloneElement(g,{__css:R,isIndeterminate:P.isIndeterminate,isChecked:P.isChecked});return a.jsxs(Ee.label,{__css:{...nz,...s.container},className:_t("chakra-checkbox",u),...A(),children:[a.jsx("input",{className:"chakra-checkbox__input",...I(C,n)}),a.jsx(Ee.span,{__css:{...tz,...s.control},className:"chakra-checkbox__control",...M(),children:N}),p&&a.jsx(Ee.span,{className:"chakra-checkbox__label",...O(),__css:{marginStart:l,...s.label},children:p})]})});jf.displayName="Checkbox";function az(e){const t=parseFloat(e);return typeof t!="number"||Number.isNaN(t)?0:t}function Kb(e,t){let n=az(e);const r=10**(t??10);return n=Math.round(n*r)/r,t?n.toFixed(t):n.toString()}function ex(e){if(!Number.isFinite(e))return 0;let t=1,n=0;for(;Math.round(e*t)/t!==e;)t*=10,n+=1;return n}function Um(e,t,n){return(e-t)*100/(n-t)}function UP(e,t,n){return(n-t)*e+t}function tx(e,t,n){const r=Math.round((e-t)/n)*n+t,o=ex(n);return Kb(r,o)}function eu(e,t,n){return e==null?e:(n{var R;return r==null?"":(R=Dv(r,s,n))!=null?R:""}),g=typeof o<"u",x=g?o:m,y=GP(Fi(x),s),b=n??y,C=d.useCallback(R=>{R!==x&&(g||h(R.toString()),p==null||p(R.toString(),Fi(R)))},[p,g,x]),S=d.useCallback(R=>{let N=R;return u&&(N=eu(N,i,l)),Kb(N,b)},[b,u,l,i]),j=d.useCallback((R=s)=>{let N;x===""?N=Fi(R):N=Fi(x)+R,N=S(N),C(N)},[S,s,C,x]),_=d.useCallback((R=s)=>{let N;x===""?N=Fi(-R):N=Fi(x)-R,N=S(N),C(N)},[S,s,C,x]),P=d.useCallback(()=>{var R;let N;r==null?N="":N=(R=Dv(r,s,n))!=null?R:i,C(N)},[r,n,s,C,i]),I=d.useCallback(R=>{var N;const Y=(N=Dv(R,s,b))!=null?N:i;C(Y)},[b,s,C,i]),M=Fi(x);return{isOutOfRange:M>l||M" `}),[cz,Qb]=Bn({name:"EditableContext",errorMessage:"useEditableContext: context is undefined. Seems you forgot to wrap the editable components in ``"}),KP={fontSize:"inherit",fontWeight:"inherit",textAlign:"inherit",bg:"transparent"},dg=Oe(function(t,n){const{getInputProps:r}=Qb(),o=qP(),s=r(t,n),i=_t("chakra-editable__input",t.className);return a.jsx(Ee.input,{...s,__css:{outline:0,...KP,...o.input},className:i})});dg.displayName="EditableInput";var fg=Oe(function(t,n){const{getPreviewProps:r}=Qb(),o=qP(),s=r(t,n),i=_t("chakra-editable__preview",t.className);return a.jsx(Ee.span,{...s,__css:{cursor:"text",display:"inline-block",...KP,...o.preview},className:i})});fg.displayName="EditablePreview";function Dl(e,t,n,r){const o=pr(n);return d.useEffect(()=>{const s=typeof e=="function"?e():e??document;if(!(!n||!s))return s.addEventListener(t,o,r),()=>{s.removeEventListener(t,o,r)}},[t,e,r,o,n]),()=>{const s=typeof e=="function"?e():e??document;s==null||s.removeEventListener(t,o,r)}}function uz(e){return"current"in e}var QP=()=>typeof window<"u";function dz(){var e;const t=navigator.userAgentData;return(e=t==null?void 0:t.platform)!=null?e:navigator.platform}var fz=e=>QP()&&e.test(navigator.vendor),pz=e=>QP()&&e.test(dz()),mz=()=>pz(/mac|iphone|ipad|ipod/i),hz=()=>mz()&&fz(/apple/i);function XP(e){const{ref:t,elements:n,enabled:r}=e,o=()=>{var s,i;return(i=(s=t.current)==null?void 0:s.ownerDocument)!=null?i:document};Dl(o,"pointerdown",s=>{if(!hz()||!r)return;const i=s.target,u=(n??[t]).some(p=>{const m=uz(p)?p.current:p;return(m==null?void 0:m.contains(i))||m===i});o().activeElement!==i&&u&&(s.preventDefault(),i.focus())})}function ES(e,t){return e?e===t||e.contains(t):!1}function gz(e={}){const{onChange:t,onCancel:n,onSubmit:r,onBlur:o,value:s,isDisabled:i,defaultValue:l,startWithEditView:u,isPreviewFocusable:p=!0,submitOnBlur:m=!0,selectAllOnFocus:h=!0,placeholder:g,onEdit:x,finalFocusRef:y,...b}=e,C=pr(x),S=!!(u&&!i),[j,_]=d.useState(S),[P,I]=Cf({defaultValue:l||"",value:s,onChange:t}),[M,O]=d.useState(P),A=d.useRef(null),D=d.useRef(null),R=d.useRef(null),N=d.useRef(null),Y=d.useRef(null);XP({ref:A,enabled:j,elements:[N,Y]});const F=!j&&!i;Yc(()=>{var Z,ue;j&&((Z=A.current)==null||Z.focus(),h&&((ue=A.current)==null||ue.select()))},[]),xi(()=>{var Z,ue,fe,ge;if(!j){y?(Z=y.current)==null||Z.focus():(ue=R.current)==null||ue.focus();return}(fe=A.current)==null||fe.focus(),h&&((ge=A.current)==null||ge.select()),C==null||C()},[j,C,h]);const V=d.useCallback(()=>{F&&_(!0)},[F]),Q=d.useCallback(()=>{O(P)},[P]),q=d.useCallback(()=>{_(!1),I(M),n==null||n(M),o==null||o(M)},[n,o,I,M]),z=d.useCallback(()=>{_(!1),O(P),r==null||r(P),o==null||o(M)},[P,r,o,M]);d.useEffect(()=>{if(j)return;const Z=A.current;(Z==null?void 0:Z.ownerDocument.activeElement)===Z&&(Z==null||Z.blur())},[j]);const G=d.useCallback(Z=>{I(Z.currentTarget.value)},[I]),T=d.useCallback(Z=>{const ue=Z.key,ge={Escape:q,Enter:_e=>{!_e.shiftKey&&!_e.metaKey&&z()}}[ue];ge&&(Z.preventDefault(),ge(Z))},[q,z]),B=d.useCallback(Z=>{const ue=Z.key,ge={Escape:q}[ue];ge&&(Z.preventDefault(),ge(Z))},[q]),X=P.length===0,re=d.useCallback(Z=>{var ue;if(!j)return;const fe=Z.currentTarget.ownerDocument,ge=(ue=Z.relatedTarget)!=null?ue:fe.activeElement,_e=ES(N.current,ge),ye=ES(Y.current,ge);!_e&&!ye&&(m?z():q())},[m,z,q,j]),le=d.useCallback((Z={},ue=null)=>{const fe=F&&p?0:void 0;return{...Z,ref:gn(ue,D),children:X?g:P,hidden:j,"aria-disabled":_s(i),tabIndex:fe,onFocus:rt(Z.onFocus,V,Q)}},[i,j,F,p,X,V,Q,g,P]),se=d.useCallback((Z={},ue=null)=>({...Z,hidden:!j,placeholder:g,ref:gn(ue,A),disabled:i,"aria-disabled":_s(i),value:P,onBlur:rt(Z.onBlur,re),onChange:rt(Z.onChange,G),onKeyDown:rt(Z.onKeyDown,T),onFocus:rt(Z.onFocus,Q)}),[i,j,re,G,T,Q,g,P]),K=d.useCallback((Z={},ue=null)=>({...Z,hidden:!j,placeholder:g,ref:gn(ue,A),disabled:i,"aria-disabled":_s(i),value:P,onBlur:rt(Z.onBlur,re),onChange:rt(Z.onChange,G),onKeyDown:rt(Z.onKeyDown,B),onFocus:rt(Z.onFocus,Q)}),[i,j,re,G,B,Q,g,P]),U=d.useCallback((Z={},ue=null)=>({"aria-label":"Edit",...Z,type:"button",onClick:rt(Z.onClick,V),ref:gn(ue,R),disabled:i}),[V,i]),ee=d.useCallback((Z={},ue=null)=>({...Z,"aria-label":"Submit",ref:gn(Y,ue),type:"button",onClick:rt(Z.onClick,z),disabled:i}),[z,i]),de=d.useCallback((Z={},ue=null)=>({"aria-label":"Cancel",id:"cancel",...Z,ref:gn(N,ue),type:"button",onClick:rt(Z.onClick,q),disabled:i}),[q,i]);return{isEditing:j,isDisabled:i,isValueEmpty:X,value:P,onEdit:V,onCancel:q,onSubmit:z,getPreviewProps:le,getInputProps:se,getTextareaProps:K,getEditButtonProps:U,getSubmitButtonProps:ee,getCancelButtonProps:de,htmlProps:b}}var pg=Oe(function(t,n){const r=Kr("Editable",t),o=ar(t),{htmlProps:s,...i}=gz(o),{isEditing:l,onSubmit:u,onCancel:p,onEdit:m}=i,h=_t("chakra-editable",t.className),g=mb(t.children,{isEditing:l,onSubmit:u,onCancel:p,onEdit:m});return a.jsx(cz,{value:i,children:a.jsx(lz,{value:r,children:a.jsx(Ee.div,{ref:n,...s,className:h,children:g})})})});pg.displayName="Editable";function YP(){const{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}=Qb();return{isEditing:e,getEditButtonProps:t,getCancelButtonProps:n,getSubmitButtonProps:r}}var JP={exports:{}},vz="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",xz=vz,bz=xz;function ZP(){}function e3(){}e3.resetWarningCache=ZP;var yz=function(){function e(r,o,s,i,l,u){if(u!==bz){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:e3,resetWarningCache:ZP};return n.PropTypes=n,n};JP.exports=yz();var Cz=JP.exports;const Zn=pf(Cz);var nx="data-focus-lock",t3="data-focus-lock-disabled",wz="data-no-focus-lock",Sz="data-autofocus-inside",kz="data-no-autofocus";function jz(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function _z(e,t){var n=d.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}function n3(e,t){return _z(t||null,function(n){return e.forEach(function(r){return jz(r,n)})})}var Tv={width:"1px",height:"0px",padding:0,overflow:"hidden",position:"fixed",top:"1px",left:"1px"},ka=function(){return ka=Object.assign||function(t){for(var n,r=1,o=arguments.length;r0&&s[s.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]0)&&!(o=r.next()).done;)s.push(o.value)}catch(l){i={error:l}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function rx(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r=0}).sort(Fz)},Bz=["button:enabled","select:enabled","textarea:enabled","input:enabled","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]","[tabindex]","[contenteditable]","[autofocus]"],Zb=Bz.join(","),Hz="".concat(Zb,", [data-focus-guard]"),y3=function(e,t){return Ba((e.shadowRoot||e).children).reduce(function(n,r){return n.concat(r.matches(t?Hz:Zb)?[r]:[],y3(r))},[])},Wz=function(e,t){var n;return e instanceof HTMLIFrameElement&&(!((n=e.contentDocument)===null||n===void 0)&&n.body)?mg([e.contentDocument.body],t):[e]},mg=function(e,t){return e.reduce(function(n,r){var o,s=y3(r,t),i=(o=[]).concat.apply(o,s.map(function(l){return Wz(l,t)}));return n.concat(i,r.parentNode?Ba(r.parentNode.querySelectorAll(Zb)).filter(function(l){return l===r}):[])},[])},Vz=function(e){var t=e.querySelectorAll("[".concat(Sz,"]"));return Ba(t).map(function(n){return mg([n])}).reduce(function(n,r){return n.concat(r)},[])},ey=function(e,t){return Ba(e).filter(function(n){return m3(t,n)}).filter(function(n){return $z(n)})},OS=function(e,t){return t===void 0&&(t=new Map),Ba(e).filter(function(n){return h3(t,n)})},sx=function(e,t,n){return b3(ey(mg(e,n),t),!0,n)},RS=function(e,t){return b3(ey(mg(e),t),!1)},Uz=function(e,t){return ey(Vz(e),t)},tu=function(e,t){return e.shadowRoot?tu(e.shadowRoot,t):Object.getPrototypeOf(e).contains!==void 0&&Object.getPrototypeOf(e).contains.call(e,t)?!0:Ba(e.children).some(function(n){var r;if(n instanceof HTMLIFrameElement){var o=(r=n.contentDocument)===null||r===void 0?void 0:r.body;return o?tu(o,t):!1}return tu(n,t)})},Gz=function(e){for(var t=new Set,n=e.length,r=0;r0&&t.add(o),(s&Node.DOCUMENT_POSITION_CONTAINS)>0&&t.add(r)}return e.filter(function(i,l){return!t.has(l)})},C3=function(e){return e.parentNode?C3(e.parentNode):e},ty=function(e){var t=Gm(e);return t.filter(Boolean).reduce(function(n,r){var o=r.getAttribute(nx);return n.push.apply(n,o?Gz(Ba(C3(r).querySelectorAll("[".concat(nx,'="').concat(o,'"]:not([').concat(t3,'="disabled"])')))):[r]),n},[])},qz=function(e){try{return e()}catch{return}},Ud=function(e){if(e===void 0&&(e=document),!(!e||!e.activeElement)){var t=e.activeElement;return t.shadowRoot?Ud(t.shadowRoot):t instanceof HTMLIFrameElement&&qz(function(){return t.contentWindow.document})?Ud(t.contentWindow.document):t}},Kz=function(e,t){return e===t},Qz=function(e,t){return!!Ba(e.querySelectorAll("iframe")).some(function(n){return Kz(n,t)})},w3=function(e,t){return t===void 0&&(t=Ud(d3(e).ownerDocument)),!t||t.dataset&&t.dataset.focusGuard?!1:ty(e).some(function(n){return tu(n,t)||Qz(n,t)})},Xz=function(e){e===void 0&&(e=document);var t=Ud(e);return t?Ba(e.querySelectorAll("[".concat(wz,"]"))).some(function(n){return tu(n,t)}):!1},Yz=function(e,t){return t.filter(x3).filter(function(n){return n.name===e.name}).filter(function(n){return n.checked})[0]||e},ny=function(e,t){return x3(e)&&e.name?Yz(e,t):e},Jz=function(e){var t=new Set;return e.forEach(function(n){return t.add(ny(n,e))}),e.filter(function(n){return t.has(n)})},AS=function(e){return e[0]&&e.length>1?ny(e[0],e):e[0]},DS=function(e,t){return e.length>1?e.indexOf(ny(e[t],e)):t},S3="NEW_FOCUS",Zz=function(e,t,n,r){var o=e.length,s=e[0],i=e[o-1],l=Jb(n);if(!(n&&e.indexOf(n)>=0)){var u=n!==void 0?t.indexOf(n):-1,p=r?t.indexOf(r):u,m=r?e.indexOf(r):-1,h=u-p,g=t.indexOf(s),x=t.indexOf(i),y=Jz(t),b=n!==void 0?y.indexOf(n):-1,C=b-(r?y.indexOf(r):u),S=DS(e,0),j=DS(e,o-1);if(u===-1||m===-1)return S3;if(!h&&m>=0)return m;if(u<=g&&l&&Math.abs(h)>1)return j;if(u>=x&&l&&Math.abs(h)>1)return S;if(h&&Math.abs(C)>1)return m;if(u<=g)return j;if(u>x)return S;if(h)return Math.abs(h)>1?m:(o+m+h)%o}},eF=function(e){return function(t){var n,r=(n=g3(t))===null||n===void 0?void 0:n.autofocus;return t.autofocus||r!==void 0&&r!=="false"||e.indexOf(t)>=0}},tF=function(e,t,n){var r=e.map(function(s){var i=s.node;return i}),o=OS(r.filter(eF(n)));return o&&o.length?AS(o):AS(OS(t))},ax=function(e,t){return t===void 0&&(t=[]),t.push(e),e.parentNode&&ax(e.parentNode.host||e.parentNode,t),t},Nv=function(e,t){for(var n=ax(e),r=ax(t),o=0;o=0)return s}return!1},k3=function(e,t,n){var r=Gm(e),o=Gm(t),s=r[0],i=!1;return o.filter(Boolean).forEach(function(l){i=Nv(i||l,l)||i,n.filter(Boolean).forEach(function(u){var p=Nv(s,u);p&&(!i||tu(p,i)?i=p:i=Nv(p,i))})}),i},nF=function(e,t){return e.reduce(function(n,r){return n.concat(Uz(r,t))},[])},rF=function(e,t){var n=new Map;return t.forEach(function(r){return n.set(r.node,r)}),e.map(function(r){return n.get(r)}).filter(zz)},oF=function(e,t){var n=Ud(Gm(e).length>0?document:d3(e).ownerDocument),r=ty(e).filter(qm),o=k3(n||e,e,r),s=new Map,i=RS(r,s),l=sx(r,s).filter(function(x){var y=x.node;return qm(y)});if(!(!l[0]&&(l=i,!l[0]))){var u=RS([o],s).map(function(x){var y=x.node;return y}),p=rF(u,l),m=p.map(function(x){var y=x.node;return y}),h=Zz(m,u,n,t);if(h===S3){var g=tF(i,m,nF(r,s));if(g)return{node:g};console.warn("focus-lock: cannot find any node to move focus into");return}return h===void 0?h:p[h]}},sF=function(e){var t=ty(e).filter(qm),n=k3(e,e,t),r=new Map,o=sx([n],r,!0),s=sx(t,r).filter(function(i){var l=i.node;return qm(l)}).map(function(i){var l=i.node;return l});return o.map(function(i){var l=i.node,u=i.index;return{node:l,index:u,lockItem:s.indexOf(l)>=0,guard:Jb(l)}})},aF=function(e,t){"focus"in e&&e.focus(t),"contentWindow"in e&&e.contentWindow&&e.contentWindow.focus()},$v=0,Lv=!1,j3=function(e,t,n){n===void 0&&(n={});var r=oF(e,t);if(!Lv&&r){if($v>2){console.error("FocusLock: focus-fighting detected. Only one focus management system could be active. See https://github.com/theKashey/focus-lock/#focus-fighting"),Lv=!0,setTimeout(function(){Lv=!1},1);return}$v++,aF(r.node,n.focusOptions),$v--}};function ry(e){setTimeout(e,1)}var iF=function(){return document&&document.activeElement===document.body},lF=function(){return iF()||Xz()},nu=null,Gc=null,ru=null,Gd=!1,cF=function(){return!0},uF=function(t){return(nu.whiteList||cF)(t)},dF=function(t,n){ru={observerNode:t,portaledElement:n}},fF=function(t){return ru&&ru.portaledElement===t};function TS(e,t,n,r){var o=null,s=e;do{var i=r[s];if(i.guard)i.node.dataset.focusAutoGuard&&(o=i);else if(i.lockItem){if(s!==e)return;o=null}else break}while((s+=n)!==t);o&&(o.node.tabIndex=0)}var pF=function(t){return t&&"current"in t?t.current:t},mF=function(t){return t?!!Gd:Gd==="meanwhile"},hF=function e(t,n,r){return n&&(n.host===t&&(!n.activeElement||r.contains(n.activeElement))||n.parentNode&&e(t,n.parentNode,r))},gF=function(t,n){return n.some(function(r){return hF(t,r,r)})},Km=function(){var t=!1;if(nu){var n=nu,r=n.observed,o=n.persistentFocus,s=n.autoFocus,i=n.shards,l=n.crossFrame,u=n.focusOptions,p=r||ru&&ru.portaledElement,m=document&&document.activeElement;if(p){var h=[p].concat(i.map(pF).filter(Boolean));if((!m||uF(m))&&(o||mF(l)||!lF()||!Gc&&s)&&(p&&!(w3(h)||m&&gF(m,h)||fF(m))&&(document&&!Gc&&m&&!s?(m.blur&&m.blur(),document.body.focus()):(t=j3(h,Gc,{focusOptions:u}),ru={})),Gd=!1,Gc=document&&document.activeElement),document){var g=document&&document.activeElement,x=sF(h),y=x.map(function(b){var C=b.node;return C}).indexOf(g);y>-1&&(x.filter(function(b){var C=b.guard,S=b.node;return C&&S.dataset.focusAutoGuard}).forEach(function(b){var C=b.node;return C.removeAttribute("tabIndex")}),TS(y,x.length,1,x),TS(y,-1,-1,x))}}}return t},_3=function(t){Km()&&t&&(t.stopPropagation(),t.preventDefault())},oy=function(){return ry(Km)},vF=function(t){var n=t.target,r=t.currentTarget;r.contains(n)||dF(r,n)},xF=function(){return null},I3=function(){Gd="just",ry(function(){Gd="meanwhile"})},bF=function(){document.addEventListener("focusin",_3),document.addEventListener("focusout",oy),window.addEventListener("blur",I3)},yF=function(){document.removeEventListener("focusin",_3),document.removeEventListener("focusout",oy),window.removeEventListener("blur",I3)};function CF(e){return e.filter(function(t){var n=t.disabled;return!n})}function wF(e){var t=e.slice(-1)[0];t&&!nu&&bF();var n=nu,r=n&&t&&t.id===n.id;nu=t,n&&!r&&(n.onDeactivation(),e.filter(function(o){var s=o.id;return s===n.id}).length||n.returnFocus(!t)),t?(Gc=null,(!r||n.observed!==t.observed)&&t.onActivation(),Km(),ry(Km)):(yF(),Gc=null)}l3.assignSyncMedium(vF);c3.assignMedium(oy);Pz.assignMedium(function(e){return e({moveFocusInside:j3,focusInside:w3})});const SF=Rz(CF,wF)(xF);var P3=d.forwardRef(function(t,n){return d.createElement(u3,hr({sideCar:SF,ref:n},t))}),E3=u3.propTypes||{};E3.sideCar;E$(E3,["sideCar"]);P3.propTypes={};const NS=P3;function M3(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function sy(e){var t;if(!M3(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function kF(e){var t,n;return(n=(t=O3(e))==null?void 0:t.defaultView)!=null?n:window}function O3(e){return M3(e)?e.ownerDocument:document}function jF(e){return O3(e).activeElement}function _F(e){const t=e.ownerDocument.defaultView||window,{overflow:n,overflowX:r,overflowY:o}=t.getComputedStyle(e);return/auto|scroll|overlay|hidden/.test(n+o+r)}function IF(e){return e.localName==="html"?e:e.assignedSlot||e.parentElement||e.ownerDocument.documentElement}function R3(e){return["html","body","#document"].includes(e.localName)?e.ownerDocument.body:sy(e)&&_F(e)?e:R3(IF(e))}var A3=e=>e.hasAttribute("tabindex"),PF=e=>A3(e)&&e.tabIndex===-1;function EF(e){return!!e.getAttribute("disabled")||!!e.getAttribute("aria-disabled")}function D3(e){return e.parentElement&&D3(e.parentElement)?!0:e.hidden}function MF(e){const t=e.getAttribute("contenteditable");return t!=="false"&&t!=null}function T3(e){if(!sy(e)||D3(e)||EF(e))return!1;const{localName:t}=e;if(["input","select","textarea","button"].indexOf(t)>=0)return!0;const r={a:()=>e.hasAttribute("href"),audio:()=>e.hasAttribute("controls"),video:()=>e.hasAttribute("controls")};return t in r?r[t]():MF(e)?!0:A3(e)}function OF(e){return e?sy(e)&&T3(e)&&!PF(e):!1}var RF=["input:not(:disabled):not([disabled])","select:not(:disabled):not([disabled])","textarea:not(:disabled):not([disabled])","embed","iframe","object","a[href]","area[href]","button:not(:disabled):not([disabled])","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","*[contenteditable]"],AF=RF.join(),DF=e=>e.offsetWidth>0&&e.offsetHeight>0;function N3(e){const t=Array.from(e.querySelectorAll(AF));return t.unshift(e),t.filter(n=>T3(n)&&DF(n))}var $S,TF=($S=NS.default)!=null?$S:NS,$3=e=>{const{initialFocusRef:t,finalFocusRef:n,contentRef:r,restoreFocus:o,children:s,isDisabled:i,autoFocus:l,persistentFocus:u,lockFocusAcrossFrames:p}=e,m=d.useCallback(()=>{t!=null&&t.current?t.current.focus():r!=null&&r.current&&N3(r.current).length===0&&requestAnimationFrame(()=>{var y;(y=r.current)==null||y.focus()})},[t,r]),h=d.useCallback(()=>{var x;(x=n==null?void 0:n.current)==null||x.focus()},[n]),g=o&&!n;return a.jsx(TF,{crossFrame:p,persistentFocus:u,autoFocus:l,disabled:i,onActivation:m,onDeactivation:h,returnFocus:g,children:s})};$3.displayName="FocusLock";var NF=K$?d.useLayoutEffect:d.useEffect;function ix(e,t=[]){const n=d.useRef(e);return NF(()=>{n.current=e}),d.useCallback((...r)=>{var o;return(o=n.current)==null?void 0:o.call(n,...r)},t)}function $F(e,t,n,r){const o=ix(t);return d.useEffect(()=>{var s;const i=(s=_w(n))!=null?s:document;if(t)return i.addEventListener(e,o,r),()=>{i.removeEventListener(e,o,r)}},[e,n,r,o,t]),()=>{var s;((s=_w(n))!=null?s:document).removeEventListener(e,o,r)}}function LF(e,t){const n=d.useId();return d.useMemo(()=>e||[t,n].filter(Boolean).join("-"),[e,t,n])}function zF(e,t){const n=e!==void 0;return[n,n&&typeof e<"u"?e:t]}function Uo(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=ix(n),i=ix(t),[l,u]=d.useState(e.defaultIsOpen||!1),[p,m]=zF(r,l),h=LF(o,"disclosure"),g=d.useCallback(()=>{p||u(!1),i==null||i()},[p,i]),x=d.useCallback(()=>{p||u(!0),s==null||s()},[p,s]),y=d.useCallback(()=>{(m?g:x)()},[m,x,g]);return{isOpen:!!m,onOpen:x,onClose:g,onToggle:y,isControlled:p,getButtonProps:(b={})=>({...b,"aria-expanded":m,"aria-controls":h,onClick:cD(b.onClick,y)}),getDisclosureProps:(b={})=>({...b,hidden:!m,id:h})}}var[FF,BF]=Bn({name:"InputGroupStylesContext",errorMessage:`useInputGroupStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),L3=Oe(function(t,n){const r=Kr("Input",t),{children:o,className:s,...i}=ar(t),l=_t("chakra-input__group",s),u={},p=ug(o),m=r.field;p.forEach(g=>{var x,y;r&&(m&&g.type.id==="InputLeftElement"&&(u.paddingStart=(x=m.height)!=null?x:m.h),m&&g.type.id==="InputRightElement"&&(u.paddingEnd=(y=m.height)!=null?y:m.h),g.type.id==="InputRightAddon"&&(u.borderEndRadius=0),g.type.id==="InputLeftAddon"&&(u.borderStartRadius=0))});const h=p.map(g=>{var x,y;const b=wI({size:((x=g.props)==null?void 0:x.size)||t.size,variant:((y=g.props)==null?void 0:y.variant)||t.variant});return g.type.id!=="Input"?d.cloneElement(g,b):d.cloneElement(g,Object.assign(b,u,g.props))});return a.jsx(Ee.div,{className:l,ref:n,__css:{width:"100%",display:"flex",position:"relative",isolation:"isolate",...r.group},"data-group":!0,...i,children:a.jsx(FF,{value:r,children:h})})});L3.displayName="InputGroup";var HF=Ee("div",{baseStyle:{display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",top:"0",zIndex:2}}),hg=Oe(function(t,n){var r,o;const{placement:s="left",...i}=t,l=BF(),u=l.field,m={[s==="left"?"insetStart":"insetEnd"]:"0",width:(r=u==null?void 0:u.height)!=null?r:u==null?void 0:u.h,height:(o=u==null?void 0:u.height)!=null?o:u==null?void 0:u.h,fontSize:u==null?void 0:u.fontSize,...l.element};return a.jsx(HF,{ref:n,__css:m,...i})});hg.id="InputElement";hg.displayName="InputElement";var z3=Oe(function(t,n){const{className:r,...o}=t,s=_t("chakra-input__left-element",r);return a.jsx(hg,{ref:n,placement:"left",className:s,...o})});z3.id="InputLeftElement";z3.displayName="InputLeftElement";var ay=Oe(function(t,n){const{className:r,...o}=t,s=_t("chakra-input__right-element",r);return a.jsx(hg,{ref:n,placement:"right",className:s,...o})});ay.id="InputRightElement";ay.displayName="InputRightElement";var gg=Oe(function(t,n){const{htmlSize:r,...o}=t,s=Kr("Input",o),i=ar(o),l=Vb(i),u=_t("chakra-input",t.className);return a.jsx(Ee.input,{size:r,...l,__css:s.field,ref:n,className:u})});gg.displayName="Input";gg.id="Input";var vg=Oe(function(t,n){const r=il("Link",t),{className:o,isExternal:s,...i}=ar(t);return a.jsx(Ee.a,{target:s?"_blank":void 0,rel:s?"noopener":void 0,ref:n,className:_t("chakra-link",o),...i,__css:r})});vg.displayName="Link";var[WF,F3]=Bn({name:"ListStylesContext",errorMessage:`useListStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),iy=Oe(function(t,n){const r=Kr("List",t),{children:o,styleType:s="none",stylePosition:i,spacing:l,...u}=ar(t),p=ug(o),h=l?{["& > *:not(style) ~ *:not(style)"]:{mt:l}}:{};return a.jsx(WF,{value:r,children:a.jsx(Ee.ul,{ref:n,listStyleType:s,listStylePosition:i,role:"list",__css:{...r.container,...h},...u,children:p})})});iy.displayName="List";var B3=Oe((e,t)=>{const{as:n,...r}=e;return a.jsx(iy,{ref:t,as:"ol",styleType:"decimal",marginStart:"1em",...r})});B3.displayName="OrderedList";var _f=Oe(function(t,n){const{as:r,...o}=t;return a.jsx(iy,{ref:n,as:"ul",styleType:"initial",marginStart:"1em",...o})});_f.displayName="UnorderedList";var ws=Oe(function(t,n){const r=F3();return a.jsx(Ee.li,{ref:n,...t,__css:r.item})});ws.displayName="ListItem";var VF=Oe(function(t,n){const r=F3();return a.jsx(Lr,{ref:n,role:"presentation",...t,__css:r.icon})});VF.displayName="ListIcon";var tl=Oe(function(t,n){const{templateAreas:r,gap:o,rowGap:s,columnGap:i,column:l,row:u,autoFlow:p,autoRows:m,templateRows:h,autoColumns:g,templateColumns:x,...y}=t,b={display:"grid",gridTemplateAreas:r,gridGap:o,gridRowGap:s,gridColumnGap:i,gridAutoColumns:g,gridColumn:l,gridRow:u,gridAutoFlow:p,gridAutoRows:m,gridTemplateRows:h,gridTemplateColumns:x};return a.jsx(Ee.div,{ref:n,__css:b,...y})});tl.displayName="Grid";function H3(e,t){return Array.isArray(e)?e.map(n=>n===null?null:t(n)):T1(e)?Object.keys(e).reduce((n,r)=>(n[r]=t(e[r]),n),{}):e!=null?t(e):null}var ki=Ee("div",{baseStyle:{flex:1,justifySelf:"stretch",alignSelf:"stretch"}});ki.displayName="Spacer";var W3=e=>a.jsx(Ee.div,{className:"chakra-stack__item",...e,__css:{display:"inline-block",flex:"0 0 auto",minWidth:0,...e.__css}});W3.displayName="StackItem";function UF(e){const{spacing:t,direction:n}=e,r={column:{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},"column-reverse":{my:t,mx:0,borderLeftWidth:0,borderBottomWidth:"1px"},row:{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0},"row-reverse":{mx:t,my:0,borderLeftWidth:"1px",borderBottomWidth:0}};return{"&":H3(n,o=>r[o])}}var ly=Oe((e,t)=>{const{isInline:n,direction:r,align:o,justify:s,spacing:i="0.5rem",wrap:l,children:u,divider:p,className:m,shouldWrapChildren:h,...g}=e,x=n?"row":r??"column",y=d.useMemo(()=>UF({spacing:i,direction:x}),[i,x]),b=!!p,C=!h&&!b,S=d.useMemo(()=>{const _=ug(u);return C?_:_.map((P,I)=>{const M=typeof P.key<"u"?P.key:I,O=I+1===_.length,D=h?a.jsx(W3,{children:P},M):P;if(!b)return D;const R=d.cloneElement(p,{__css:y}),N=O?null:R;return a.jsxs(d.Fragment,{children:[D,N]},M)})},[p,y,b,C,h,u]),j=_t("chakra-stack",m);return a.jsx(Ee.div,{ref:t,display:"flex",alignItems:o,justifyContent:s,flexDirection:x,flexWrap:l,gap:b?void 0:i,className:j,...g,children:S})});ly.displayName="Stack";var V3=Oe((e,t)=>a.jsx(ly,{align:"center",...e,direction:"column",ref:t}));V3.displayName="VStack";var cy=Oe((e,t)=>a.jsx(ly,{align:"center",...e,direction:"row",ref:t}));cy.displayName="HStack";function LS(e){return H3(e,t=>t==="auto"?"auto":`span ${t}/span ${t}`)}var qd=Oe(function(t,n){const{area:r,colSpan:o,colStart:s,colEnd:i,rowEnd:l,rowSpan:u,rowStart:p,...m}=t,h=wI({gridArea:r,gridColumn:LS(o),gridRow:LS(u),gridColumnStart:s,gridColumnEnd:i,gridRowStart:p,gridRowEnd:l});return a.jsx(Ee.div,{ref:n,__css:h,...m})});qd.displayName="GridItem";var Ha=Oe(function(t,n){const r=il("Badge",t),{className:o,...s}=ar(t);return a.jsx(Ee.span,{ref:n,className:_t("chakra-badge",t.className),...s,__css:{display:"inline-block",whiteSpace:"nowrap",verticalAlign:"middle",...r}})});Ha.displayName="Badge";var no=Oe(function(t,n){const{borderLeftWidth:r,borderBottomWidth:o,borderTopWidth:s,borderRightWidth:i,borderWidth:l,borderStyle:u,borderColor:p,...m}=il("Divider",t),{className:h,orientation:g="horizontal",__css:x,...y}=ar(t),b={vertical:{borderLeftWidth:r||i||l||"1px",height:"100%"},horizontal:{borderBottomWidth:o||s||l||"1px",width:"100%"}};return a.jsx(Ee.hr,{ref:n,"aria-orientation":g,...y,__css:{...m,border:"0",borderColor:p,borderStyle:u,...b[g],...x},className:_t("chakra-divider",h)})});no.displayName="Divider";function GF(e){const{key:t}=e;return t.length===1||t.length>1&&/[^a-zA-Z0-9]/.test(t)}function qF(e={}){const{timeout:t=300,preventDefault:n=()=>!0}=e,[r,o]=d.useState([]),s=d.useRef(),i=()=>{s.current&&(clearTimeout(s.current),s.current=null)},l=()=>{i(),s.current=setTimeout(()=>{o([]),s.current=null},t)};d.useEffect(()=>i,[]);function u(p){return m=>{if(m.key==="Backspace"){const h=[...r];h.pop(),o(h);return}if(GF(m)){const h=r.concat(m.key);n(m)&&(m.preventDefault(),m.stopPropagation()),o(h),p(h.join("")),l()}}}return u}function KF(e,t,n,r){if(t==null)return r;if(!r)return e.find(i=>n(i).toLowerCase().startsWith(t.toLowerCase()));const o=e.filter(s=>n(s).toLowerCase().startsWith(t.toLowerCase()));if(o.length>0){let s;return o.includes(r)?(s=o.indexOf(r)+1,s===o.length&&(s=0),o[s]):(s=e.indexOf(o[0]),e[s])}return r}function QF(){const e=d.useRef(new Map),t=e.current,n=d.useCallback((o,s,i,l)=>{e.current.set(i,{type:s,el:o,options:l}),o.addEventListener(s,i,l)},[]),r=d.useCallback((o,s,i,l)=>{o.removeEventListener(s,i,l),e.current.delete(i)},[]);return d.useEffect(()=>()=>{t.forEach((o,s)=>{r(o.el,o.type,s,o.options)})},[r,t]),{add:n,remove:r}}function zv(e){const t=e.target,{tagName:n,isContentEditable:r}=t;return n!=="INPUT"&&n!=="TEXTAREA"&&r!==!0}function U3(e={}){const{ref:t,isDisabled:n,isFocusable:r,clickOnEnter:o=!0,clickOnSpace:s=!0,onMouseDown:i,onMouseUp:l,onClick:u,onKeyDown:p,onKeyUp:m,tabIndex:h,onMouseOver:g,onMouseLeave:x,...y}=e,[b,C]=d.useState(!0),[S,j]=d.useState(!1),_=QF(),P=z=>{z&&z.tagName!=="BUTTON"&&C(!1)},I=b?h:h||0,M=n&&!r,O=d.useCallback(z=>{if(n){z.stopPropagation(),z.preventDefault();return}z.currentTarget.focus(),u==null||u(z)},[n,u]),A=d.useCallback(z=>{S&&zv(z)&&(z.preventDefault(),z.stopPropagation(),j(!1),_.remove(document,"keyup",A,!1))},[S,_]),D=d.useCallback(z=>{if(p==null||p(z),n||z.defaultPrevented||z.metaKey||!zv(z.nativeEvent)||b)return;const G=o&&z.key==="Enter";s&&z.key===" "&&(z.preventDefault(),j(!0)),G&&(z.preventDefault(),z.currentTarget.click()),_.add(document,"keyup",A,!1)},[n,b,p,o,s,_,A]),R=d.useCallback(z=>{if(m==null||m(z),n||z.defaultPrevented||z.metaKey||!zv(z.nativeEvent)||b)return;s&&z.key===" "&&(z.preventDefault(),j(!1),z.currentTarget.click())},[s,b,n,m]),N=d.useCallback(z=>{z.button===0&&(j(!1),_.remove(document,"mouseup",N,!1))},[_]),Y=d.useCallback(z=>{if(z.button!==0)return;if(n){z.stopPropagation(),z.preventDefault();return}b||j(!0),z.currentTarget.focus({preventScroll:!0}),_.add(document,"mouseup",N,!1),i==null||i(z)},[n,b,i,_,N]),F=d.useCallback(z=>{z.button===0&&(b||j(!1),l==null||l(z))},[l,b]),V=d.useCallback(z=>{if(n){z.preventDefault();return}g==null||g(z)},[n,g]),Q=d.useCallback(z=>{S&&(z.preventDefault(),j(!1)),x==null||x(z)},[S,x]),q=gn(t,P);return b?{...y,ref:q,type:"button","aria-disabled":M?void 0:n,disabled:M,onClick:O,onMouseDown:i,onMouseUp:l,onKeyUp:m,onKeyDown:p,onMouseOver:g,onMouseLeave:x}:{...y,ref:q,role:"button","data-active":qt(S),"aria-disabled":n?"true":void 0,tabIndex:M?void 0:I,onClick:O,onMouseDown:Y,onMouseUp:F,onKeyUp:R,onKeyDown:D,onMouseOver:V,onMouseLeave:Q}}function XF(e){const t=e.current;if(!t)return!1;const n=jF(t);return!n||t.contains(n)?!1:!!OF(n)}function G3(e,t){const{shouldFocus:n,visible:r,focusRef:o}=t,s=n&&!r;xi(()=>{if(!s||XF(e))return;const i=(o==null?void 0:o.current)||e.current;let l;if(i)return l=requestAnimationFrame(()=>{i.focus({preventScroll:!0})}),()=>{cancelAnimationFrame(l)}},[s,e,o])}var YF={preventScroll:!0,shouldFocus:!1};function JF(e,t=YF){const{focusRef:n,preventScroll:r,shouldFocus:o,visible:s}=t,i=ZF(e)?e.current:e,l=o&&s,u=d.useRef(l),p=d.useRef(s);Yc(()=>{!p.current&&s&&(u.current=l),p.current=s},[s,l]);const m=d.useCallback(()=>{if(!(!s||!i||!u.current)&&(u.current=!1,!i.contains(document.activeElement)))if(n!=null&&n.current)requestAnimationFrame(()=>{var h;(h=n.current)==null||h.focus({preventScroll:r})});else{const h=N3(i);h.length>0&&requestAnimationFrame(()=>{h[0].focus({preventScroll:r})})}},[s,r,i,n]);xi(()=>{m()},[m]),Dl(i,"transitionend",m)}function ZF(e){return"current"in e}var _c=(e,t)=>({var:e,varRef:t?`var(${e}, ${t})`:`var(${e})`}),zr={arrowShadowColor:_c("--popper-arrow-shadow-color"),arrowSize:_c("--popper-arrow-size","8px"),arrowSizeHalf:_c("--popper-arrow-size-half"),arrowBg:_c("--popper-arrow-bg"),transformOrigin:_c("--popper-transform-origin"),arrowOffset:_c("--popper-arrow-offset")};function eB(e){if(e.includes("top"))return"1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("bottom"))return"-1px -1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("right"))return"-1px 1px 0px 0 var(--popper-arrow-shadow-color)";if(e.includes("left"))return"1px -1px 0px 0 var(--popper-arrow-shadow-color)"}var tB={top:"bottom center","top-start":"bottom left","top-end":"bottom right",bottom:"top center","bottom-start":"top left","bottom-end":"top right",left:"right center","left-start":"right top","left-end":"right bottom",right:"left center","right-start":"left top","right-end":"left bottom"},nB=e=>tB[e],zS={scroll:!0,resize:!0};function rB(e){let t;return typeof e=="object"?t={enabled:!0,options:{...zS,...e}}:t={enabled:e,options:zS},t}var oB={name:"matchWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:e})=>{e.styles.popper.width=`${e.rects.reference.width}px`},effect:({state:e})=>()=>{const t=e.elements.reference;e.elements.popper.style.width=`${t.offsetWidth}px`}},sB={name:"transformOrigin",enabled:!0,phase:"write",fn:({state:e})=>{FS(e)},effect:({state:e})=>()=>{FS(e)}},FS=e=>{e.elements.popper.style.setProperty(zr.transformOrigin.var,nB(e.placement))},aB={name:"positionArrow",enabled:!0,phase:"afterWrite",fn:({state:e})=>{iB(e)}},iB=e=>{var t;if(!e.placement)return;const n=lB(e.placement);if((t=e.elements)!=null&&t.arrow&&n){Object.assign(e.elements.arrow.style,{[n.property]:n.value,width:zr.arrowSize.varRef,height:zr.arrowSize.varRef,zIndex:-1});const r={[zr.arrowSizeHalf.var]:`calc(${zr.arrowSize.varRef} / 2 - 1px)`,[zr.arrowOffset.var]:`calc(${zr.arrowSizeHalf.varRef} * -1)`};for(const o in r)e.elements.arrow.style.setProperty(o,r[o])}},lB=e=>{if(e.startsWith("top"))return{property:"bottom",value:zr.arrowOffset.varRef};if(e.startsWith("bottom"))return{property:"top",value:zr.arrowOffset.varRef};if(e.startsWith("left"))return{property:"right",value:zr.arrowOffset.varRef};if(e.startsWith("right"))return{property:"left",value:zr.arrowOffset.varRef}},cB={name:"innerArrow",enabled:!0,phase:"main",requires:["arrow"],fn:({state:e})=>{BS(e)},effect:({state:e})=>()=>{BS(e)}},BS=e=>{if(!e.elements.arrow)return;const t=e.elements.arrow.querySelector("[data-popper-arrow-inner]");if(!t)return;const n=eB(e.placement);n&&t.style.setProperty("--popper-arrow-default-shadow",n),Object.assign(t.style,{transform:"rotate(45deg)",background:zr.arrowBg.varRef,top:0,left:0,width:"100%",height:"100%",position:"absolute",zIndex:"inherit",boxShadow:"var(--popper-arrow-shadow, var(--popper-arrow-default-shadow))"})},uB={"start-start":{ltr:"left-start",rtl:"right-start"},"start-end":{ltr:"left-end",rtl:"right-end"},"end-start":{ltr:"right-start",rtl:"left-start"},"end-end":{ltr:"right-end",rtl:"left-end"},start:{ltr:"left",rtl:"right"},end:{ltr:"right",rtl:"left"}},dB={"auto-start":"auto-end","auto-end":"auto-start","top-start":"top-end","top-end":"top-start","bottom-start":"bottom-end","bottom-end":"bottom-start"};function fB(e,t="ltr"){var n,r;const o=((n=uB[e])==null?void 0:n[t])||e;return t==="ltr"?o:(r=dB[e])!=null?r:o}var Ho="top",Es="bottom",Ms="right",Wo="left",uy="auto",If=[Ho,Es,Ms,Wo],pu="start",Kd="end",pB="clippingParents",q3="viewport",md="popper",mB="reference",HS=If.reduce(function(e,t){return e.concat([t+"-"+pu,t+"-"+Kd])},[]),K3=[].concat(If,[uy]).reduce(function(e,t){return e.concat([t,t+"-"+pu,t+"-"+Kd])},[]),hB="beforeRead",gB="read",vB="afterRead",xB="beforeMain",bB="main",yB="afterMain",CB="beforeWrite",wB="write",SB="afterWrite",kB=[hB,gB,vB,xB,bB,yB,CB,wB,SB];function Ma(e){return e?(e.nodeName||"").toLowerCase():null}function cs(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Vl(e){var t=cs(e).Element;return e instanceof t||e instanceof Element}function Is(e){var t=cs(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function dy(e){if(typeof ShadowRoot>"u")return!1;var t=cs(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function jB(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Is(s)||!Ma(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(i){var l=o[i];l===!1?s.removeAttribute(i):s.setAttribute(i,l===!0?"":l)}))})}function _B(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(r){var o=t.elements[r],s=t.attributes[r]||{},i=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),l=i.reduce(function(u,p){return u[p]="",u},{});!Is(o)||!Ma(o)||(Object.assign(o.style,l),Object.keys(s).forEach(function(u){o.removeAttribute(u)}))})}}const IB={name:"applyStyles",enabled:!0,phase:"write",fn:jB,effect:_B,requires:["computeStyles"]};function Ea(e){return e.split("-")[0]}var Tl=Math.max,Qm=Math.min,mu=Math.round;function lx(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function Q3(){return!/^((?!chrome|android).)*safari/i.test(lx())}function hu(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Is(e)&&(o=e.offsetWidth>0&&mu(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&mu(r.height)/e.offsetHeight||1);var i=Vl(e)?cs(e):window,l=i.visualViewport,u=!Q3()&&n,p=(r.left+(u&&l?l.offsetLeft:0))/o,m=(r.top+(u&&l?l.offsetTop:0))/s,h=r.width/o,g=r.height/s;return{width:h,height:g,top:m,right:p+h,bottom:m+g,left:p,x:p,y:m}}function fy(e){var t=hu(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function X3(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&dy(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fi(e){return cs(e).getComputedStyle(e)}function PB(e){return["table","td","th"].indexOf(Ma(e))>=0}function ll(e){return((Vl(e)?e.ownerDocument:e.document)||window.document).documentElement}function xg(e){return Ma(e)==="html"?e:e.assignedSlot||e.parentNode||(dy(e)?e.host:null)||ll(e)}function WS(e){return!Is(e)||fi(e).position==="fixed"?null:e.offsetParent}function EB(e){var t=/firefox/i.test(lx()),n=/Trident/i.test(lx());if(n&&Is(e)){var r=fi(e);if(r.position==="fixed")return null}var o=xg(e);for(dy(o)&&(o=o.host);Is(o)&&["html","body"].indexOf(Ma(o))<0;){var s=fi(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function Pf(e){for(var t=cs(e),n=WS(e);n&&PB(n)&&fi(n).position==="static";)n=WS(n);return n&&(Ma(n)==="html"||Ma(n)==="body"&&fi(n).position==="static")?t:n||EB(e)||t}function py(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Dd(e,t,n){return Tl(e,Qm(t,n))}function MB(e,t,n){var r=Dd(e,t,n);return r>n?n:r}function Y3(){return{top:0,right:0,bottom:0,left:0}}function J3(e){return Object.assign({},Y3(),e)}function Z3(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var OB=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,J3(typeof t!="number"?t:Z3(t,If))};function RB(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,i=n.modifiersData.popperOffsets,l=Ea(n.placement),u=py(l),p=[Wo,Ms].indexOf(l)>=0,m=p?"height":"width";if(!(!s||!i)){var h=OB(o.padding,n),g=fy(s),x=u==="y"?Ho:Wo,y=u==="y"?Es:Ms,b=n.rects.reference[m]+n.rects.reference[u]-i[u]-n.rects.popper[m],C=i[u]-n.rects.reference[u],S=Pf(s),j=S?u==="y"?S.clientHeight||0:S.clientWidth||0:0,_=b/2-C/2,P=h[x],I=j-g[m]-h[y],M=j/2-g[m]/2+_,O=Dd(P,M,I),A=u;n.modifiersData[r]=(t={},t[A]=O,t.centerOffset=O-M,t)}}function AB(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||X3(t.elements.popper,o)&&(t.elements.arrow=o))}const DB={name:"arrow",enabled:!0,phase:"main",fn:RB,effect:AB,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function gu(e){return e.split("-")[1]}var TB={top:"auto",right:"auto",bottom:"auto",left:"auto"};function NB(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:mu(n*o)/o||0,y:mu(r*o)/o||0}}function VS(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,i=e.offsets,l=e.position,u=e.gpuAcceleration,p=e.adaptive,m=e.roundOffsets,h=e.isFixed,g=i.x,x=g===void 0?0:g,y=i.y,b=y===void 0?0:y,C=typeof m=="function"?m({x,y:b}):{x,y:b};x=C.x,b=C.y;var S=i.hasOwnProperty("x"),j=i.hasOwnProperty("y"),_=Wo,P=Ho,I=window;if(p){var M=Pf(n),O="clientHeight",A="clientWidth";if(M===cs(n)&&(M=ll(n),fi(M).position!=="static"&&l==="absolute"&&(O="scrollHeight",A="scrollWidth")),M=M,o===Ho||(o===Wo||o===Ms)&&s===Kd){P=Es;var D=h&&M===I&&I.visualViewport?I.visualViewport.height:M[O];b-=D-r.height,b*=u?1:-1}if(o===Wo||(o===Ho||o===Es)&&s===Kd){_=Ms;var R=h&&M===I&&I.visualViewport?I.visualViewport.width:M[A];x-=R-r.width,x*=u?1:-1}}var N=Object.assign({position:l},p&&TB),Y=m===!0?NB({x,y:b},cs(n)):{x,y:b};if(x=Y.x,b=Y.y,u){var F;return Object.assign({},N,(F={},F[P]=j?"0":"",F[_]=S?"0":"",F.transform=(I.devicePixelRatio||1)<=1?"translate("+x+"px, "+b+"px)":"translate3d("+x+"px, "+b+"px, 0)",F))}return Object.assign({},N,(t={},t[P]=j?b+"px":"",t[_]=S?x+"px":"",t.transform="",t))}function $B(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,i=s===void 0?!0:s,l=n.roundOffsets,u=l===void 0?!0:l,p={placement:Ea(t.placement),variation:gu(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,VS(Object.assign({},p,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:u})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,VS(Object.assign({},p,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:u})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const LB={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:$B,data:{}};var Np={passive:!0};function zB(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,i=r.resize,l=i===void 0?!0:i,u=cs(t.elements.popper),p=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&p.forEach(function(m){m.addEventListener("scroll",n.update,Np)}),l&&u.addEventListener("resize",n.update,Np),function(){s&&p.forEach(function(m){m.removeEventListener("scroll",n.update,Np)}),l&&u.removeEventListener("resize",n.update,Np)}}const FB={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:zB,data:{}};var BB={left:"right",right:"left",bottom:"top",top:"bottom"};function bm(e){return e.replace(/left|right|bottom|top/g,function(t){return BB[t]})}var HB={start:"end",end:"start"};function US(e){return e.replace(/start|end/g,function(t){return HB[t]})}function my(e){var t=cs(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function hy(e){return hu(ll(e)).left+my(e).scrollLeft}function WB(e,t){var n=cs(e),r=ll(e),o=n.visualViewport,s=r.clientWidth,i=r.clientHeight,l=0,u=0;if(o){s=o.width,i=o.height;var p=Q3();(p||!p&&t==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:l+hy(e),y:u}}function VB(e){var t,n=ll(e),r=my(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=Tl(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),i=Tl(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),l=-r.scrollLeft+hy(e),u=-r.scrollTop;return fi(o||n).direction==="rtl"&&(l+=Tl(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:i,x:l,y:u}}function gy(e){var t=fi(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function e5(e){return["html","body","#document"].indexOf(Ma(e))>=0?e.ownerDocument.body:Is(e)&&gy(e)?e:e5(xg(e))}function Td(e,t){var n;t===void 0&&(t=[]);var r=e5(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=cs(r),i=o?[s].concat(s.visualViewport||[],gy(r)?r:[]):r,l=t.concat(i);return o?l:l.concat(Td(xg(i)))}function cx(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function UB(e,t){var n=hu(e,!1,t==="fixed");return n.top=n.top+e.clientTop,n.left=n.left+e.clientLeft,n.bottom=n.top+e.clientHeight,n.right=n.left+e.clientWidth,n.width=e.clientWidth,n.height=e.clientHeight,n.x=n.left,n.y=n.top,n}function GS(e,t,n){return t===q3?cx(WB(e,n)):Vl(t)?UB(t,n):cx(VB(ll(e)))}function GB(e){var t=Td(xg(e)),n=["absolute","fixed"].indexOf(fi(e).position)>=0,r=n&&Is(e)?Pf(e):e;return Vl(r)?t.filter(function(o){return Vl(o)&&X3(o,r)&&Ma(o)!=="body"}):[]}function qB(e,t,n,r){var o=t==="clippingParents"?GB(e):[].concat(t),s=[].concat(o,[n]),i=s[0],l=s.reduce(function(u,p){var m=GS(e,p,r);return u.top=Tl(m.top,u.top),u.right=Qm(m.right,u.right),u.bottom=Qm(m.bottom,u.bottom),u.left=Tl(m.left,u.left),u},GS(e,i,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function t5(e){var t=e.reference,n=e.element,r=e.placement,o=r?Ea(r):null,s=r?gu(r):null,i=t.x+t.width/2-n.width/2,l=t.y+t.height/2-n.height/2,u;switch(o){case Ho:u={x:i,y:t.y-n.height};break;case Es:u={x:i,y:t.y+t.height};break;case Ms:u={x:t.x+t.width,y:l};break;case Wo:u={x:t.x-n.width,y:l};break;default:u={x:t.x,y:t.y}}var p=o?py(o):null;if(p!=null){var m=p==="y"?"height":"width";switch(s){case pu:u[p]=u[p]-(t[m]/2-n[m]/2);break;case Kd:u[p]=u[p]+(t[m]/2-n[m]/2);break}}return u}function Qd(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,i=s===void 0?e.strategy:s,l=n.boundary,u=l===void 0?pB:l,p=n.rootBoundary,m=p===void 0?q3:p,h=n.elementContext,g=h===void 0?md:h,x=n.altBoundary,y=x===void 0?!1:x,b=n.padding,C=b===void 0?0:b,S=J3(typeof C!="number"?C:Z3(C,If)),j=g===md?mB:md,_=e.rects.popper,P=e.elements[y?j:g],I=qB(Vl(P)?P:P.contextElement||ll(e.elements.popper),u,m,i),M=hu(e.elements.reference),O=t5({reference:M,element:_,strategy:"absolute",placement:o}),A=cx(Object.assign({},_,O)),D=g===md?A:M,R={top:I.top-D.top+S.top,bottom:D.bottom-I.bottom+S.bottom,left:I.left-D.left+S.left,right:D.right-I.right+S.right},N=e.modifiersData.offset;if(g===md&&N){var Y=N[o];Object.keys(R).forEach(function(F){var V=[Ms,Es].indexOf(F)>=0?1:-1,Q=[Ho,Es].indexOf(F)>=0?"y":"x";R[F]+=Y[Q]*V})}return R}function KB(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,i=n.padding,l=n.flipVariations,u=n.allowedAutoPlacements,p=u===void 0?K3:u,m=gu(r),h=m?l?HS:HS.filter(function(y){return gu(y)===m}):If,g=h.filter(function(y){return p.indexOf(y)>=0});g.length===0&&(g=h);var x=g.reduce(function(y,b){return y[b]=Qd(e,{placement:b,boundary:o,rootBoundary:s,padding:i})[Ea(b)],y},{});return Object.keys(x).sort(function(y,b){return x[y]-x[b]})}function QB(e){if(Ea(e)===uy)return[];var t=bm(e);return[US(e),t,US(t)]}function XB(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!0:i,u=n.fallbackPlacements,p=n.padding,m=n.boundary,h=n.rootBoundary,g=n.altBoundary,x=n.flipVariations,y=x===void 0?!0:x,b=n.allowedAutoPlacements,C=t.options.placement,S=Ea(C),j=S===C,_=u||(j||!y?[bm(C)]:QB(C)),P=[C].concat(_).reduce(function(se,K){return se.concat(Ea(K)===uy?KB(t,{placement:K,boundary:m,rootBoundary:h,padding:p,flipVariations:y,allowedAutoPlacements:b}):K)},[]),I=t.rects.reference,M=t.rects.popper,O=new Map,A=!0,D=P[0],R=0;R=0,Q=V?"width":"height",q=Qd(t,{placement:N,boundary:m,rootBoundary:h,altBoundary:g,padding:p}),z=V?F?Ms:Wo:F?Es:Ho;I[Q]>M[Q]&&(z=bm(z));var G=bm(z),T=[];if(s&&T.push(q[Y]<=0),l&&T.push(q[z]<=0,q[G]<=0),T.every(function(se){return se})){D=N,A=!1;break}O.set(N,T)}if(A)for(var B=y?3:1,X=function(K){var U=P.find(function(ee){var de=O.get(ee);if(de)return de.slice(0,K).every(function(Z){return Z})});if(U)return D=U,"break"},re=B;re>0;re--){var le=X(re);if(le==="break")break}t.placement!==D&&(t.modifiersData[r]._skip=!0,t.placement=D,t.reset=!0)}}const YB={name:"flip",enabled:!0,phase:"main",fn:XB,requiresIfExists:["offset"],data:{_skip:!1}};function qS(e,t,n){return n===void 0&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function KS(e){return[Ho,Ms,Es,Wo].some(function(t){return e[t]>=0})}function JB(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,i=Qd(t,{elementContext:"reference"}),l=Qd(t,{altBoundary:!0}),u=qS(i,r),p=qS(l,o,s),m=KS(u),h=KS(p);t.modifiersData[n]={referenceClippingOffsets:u,popperEscapeOffsets:p,isReferenceHidden:m,hasPopperEscaped:h},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":m,"data-popper-escaped":h})}const ZB={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:JB};function eH(e,t,n){var r=Ea(e),o=[Wo,Ho].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=s[0],l=s[1];return i=i||0,l=(l||0)*o,[Wo,Ms].indexOf(r)>=0?{x:l,y:i}:{x:i,y:l}}function tH(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,i=K3.reduce(function(m,h){return m[h]=eH(h,t.rects,s),m},{}),l=i[t.placement],u=l.x,p=l.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=u,t.modifiersData.popperOffsets.y+=p),t.modifiersData[r]=i}const nH={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:tH};function rH(e){var t=e.state,n=e.name;t.modifiersData[n]=t5({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const oH={name:"popperOffsets",enabled:!0,phase:"read",fn:rH,data:{}};function sH(e){return e==="x"?"y":"x"}function aH(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,i=n.altAxis,l=i===void 0?!1:i,u=n.boundary,p=n.rootBoundary,m=n.altBoundary,h=n.padding,g=n.tether,x=g===void 0?!0:g,y=n.tetherOffset,b=y===void 0?0:y,C=Qd(t,{boundary:u,rootBoundary:p,padding:h,altBoundary:m}),S=Ea(t.placement),j=gu(t.placement),_=!j,P=py(S),I=sH(P),M=t.modifiersData.popperOffsets,O=t.rects.reference,A=t.rects.popper,D=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,R=typeof D=="number"?{mainAxis:D,altAxis:D}:Object.assign({mainAxis:0,altAxis:0},D),N=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,Y={x:0,y:0};if(M){if(s){var F,V=P==="y"?Ho:Wo,Q=P==="y"?Es:Ms,q=P==="y"?"height":"width",z=M[P],G=z+C[V],T=z-C[Q],B=x?-A[q]/2:0,X=j===pu?O[q]:A[q],re=j===pu?-A[q]:-O[q],le=t.elements.arrow,se=x&&le?fy(le):{width:0,height:0},K=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Y3(),U=K[V],ee=K[Q],de=Dd(0,O[q],se[q]),Z=_?O[q]/2-B-de-U-R.mainAxis:X-de-U-R.mainAxis,ue=_?-O[q]/2+B+de+ee+R.mainAxis:re+de+ee+R.mainAxis,fe=t.elements.arrow&&Pf(t.elements.arrow),ge=fe?P==="y"?fe.clientTop||0:fe.clientLeft||0:0,_e=(F=N==null?void 0:N[P])!=null?F:0,ye=z+Z-_e-ge,pe=z+ue-_e,Te=Dd(x?Qm(G,ye):G,z,x?Tl(T,pe):T);M[P]=Te,Y[P]=Te-z}if(l){var Ae,qe=P==="x"?Ho:Wo,Pt=P==="x"?Es:Ms,tt=M[I],sn=I==="y"?"height":"width",mt=tt+C[qe],ct=tt-C[Pt],be=[Ho,Wo].indexOf(S)!==-1,We=(Ae=N==null?void 0:N[I])!=null?Ae:0,Rt=be?mt:tt-O[sn]-A[sn]-We+R.altAxis,Ut=be?tt+O[sn]+A[sn]-We-R.altAxis:ct,ke=x&&be?MB(Rt,tt,Ut):Dd(x?Rt:mt,tt,x?Ut:ct);M[I]=ke,Y[I]=ke-tt}t.modifiersData[r]=Y}}const iH={name:"preventOverflow",enabled:!0,phase:"main",fn:aH,requiresIfExists:["offset"]};function lH(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function cH(e){return e===cs(e)||!Is(e)?my(e):lH(e)}function uH(e){var t=e.getBoundingClientRect(),n=mu(t.width)/e.offsetWidth||1,r=mu(t.height)/e.offsetHeight||1;return n!==1||r!==1}function dH(e,t,n){n===void 0&&(n=!1);var r=Is(t),o=Is(t)&&uH(t),s=ll(t),i=hu(e,o,n),l={scrollLeft:0,scrollTop:0},u={x:0,y:0};return(r||!r&&!n)&&((Ma(t)!=="body"||gy(s))&&(l=cH(t)),Is(t)?(u=hu(t,!0),u.x+=t.clientLeft,u.y+=t.clientTop):s&&(u.x=hy(s))),{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function fH(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var i=[].concat(s.requires||[],s.requiresIfExists||[]);i.forEach(function(l){if(!n.has(l)){var u=t.get(l);u&&o(u)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function pH(e){var t=fH(e);return kB.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function mH(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function hH(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var QS={placement:"bottom",modifiers:[],strategy:"absolute"};function XS(){for(var e=arguments.length,t=new Array(e),n=0;n{}),_=d.useCallback(()=>{var R;!t||!y.current||!b.current||((R=j.current)==null||R.call(j),C.current=xH(y.current,b.current,{placement:S,modifiers:[cB,aB,sB,{...oB,enabled:!!g},{name:"eventListeners",...rB(i)},{name:"arrow",options:{padding:s}},{name:"offset",options:{offset:l??[0,u]}},{name:"flip",enabled:!!p,options:{padding:8}},{name:"preventOverflow",enabled:!!h,options:{boundary:m}},...n??[]],strategy:o}),C.current.forceUpdate(),j.current=C.current.destroy)},[S,t,n,g,i,s,l,u,p,h,m,o]);d.useEffect(()=>()=>{var R;!y.current&&!b.current&&((R=C.current)==null||R.destroy(),C.current=null)},[]);const P=d.useCallback(R=>{y.current=R,_()},[_]),I=d.useCallback((R={},N=null)=>({...R,ref:gn(P,N)}),[P]),M=d.useCallback(R=>{b.current=R,_()},[_]),O=d.useCallback((R={},N=null)=>({...R,ref:gn(M,N),style:{...R.style,position:o,minWidth:g?void 0:"max-content",inset:"0 auto auto 0"}}),[o,M,g]),A=d.useCallback((R={},N=null)=>{const{size:Y,shadowColor:F,bg:V,style:Q,...q}=R;return{...q,ref:N,"data-popper-arrow":"",style:bH(R)}},[]),D=d.useCallback((R={},N=null)=>({...R,ref:N,"data-popper-arrow-inner":""}),[]);return{update(){var R;(R=C.current)==null||R.update()},forceUpdate(){var R;(R=C.current)==null||R.forceUpdate()},transformOrigin:zr.transformOrigin.varRef,referenceRef:P,popperRef:M,getPopperProps:O,getArrowProps:A,getArrowInnerProps:D,getReferenceProps:I}}function bH(e){const{size:t,shadowColor:n,bg:r,style:o}=e,s={...o,position:"absolute"};return t&&(s["--popper-arrow-size"]=t),n&&(s["--popper-arrow-shadow-color"]=n),r&&(s["--popper-arrow-bg"]=r),s}function xy(e={}){const{onClose:t,onOpen:n,isOpen:r,id:o}=e,s=pr(n),i=pr(t),[l,u]=d.useState(e.defaultIsOpen||!1),p=r!==void 0?r:l,m=r!==void 0,h=d.useId(),g=o??`disclosure-${h}`,x=d.useCallback(()=>{m||u(!1),i==null||i()},[m,i]),y=d.useCallback(()=>{m||u(!0),s==null||s()},[m,s]),b=d.useCallback(()=>{p?x():y()},[p,y,x]);function C(j={}){return{...j,"aria-expanded":p,"aria-controls":g,onClick(_){var P;(P=j.onClick)==null||P.call(j,_),b()}}}function S(j={}){return{...j,hidden:!p,id:g}}return{isOpen:p,onOpen:y,onClose:x,onToggle:b,isControlled:m,getButtonProps:C,getDisclosureProps:S}}function yH(e){const{ref:t,handler:n,enabled:r=!0}=e,o=pr(n),i=d.useRef({isPointerDown:!1,ignoreEmulatedMouseEvents:!1}).current;d.useEffect(()=>{if(!r)return;const l=h=>{Fv(h,t)&&(i.isPointerDown=!0)},u=h=>{if(i.ignoreEmulatedMouseEvents){i.ignoreEmulatedMouseEvents=!1;return}i.isPointerDown&&n&&Fv(h,t)&&(i.isPointerDown=!1,o(h))},p=h=>{i.ignoreEmulatedMouseEvents=!0,n&&i.isPointerDown&&Fv(h,t)&&(i.isPointerDown=!1,o(h))},m=n5(t.current);return m.addEventListener("mousedown",l,!0),m.addEventListener("mouseup",u,!0),m.addEventListener("touchstart",l,!0),m.addEventListener("touchend",p,!0),()=>{m.removeEventListener("mousedown",l,!0),m.removeEventListener("mouseup",u,!0),m.removeEventListener("touchstart",l,!0),m.removeEventListener("touchend",p,!0)}},[n,t,o,i,r])}function Fv(e,t){var n;const r=e.target;return r&&!n5(r).contains(r)?!1:!((n=t.current)!=null&&n.contains(r))}function n5(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function r5(e){const{isOpen:t,ref:n}=e,[r,o]=d.useState(t),[s,i]=d.useState(!1);return d.useEffect(()=>{s||(o(t),i(!0))},[t,s,r]),Dl(()=>n.current,"animationend",()=>{o(t)}),{present:!(t?!1:!r),onComplete(){var u;const p=kF(n.current),m=new p.CustomEvent("animationend",{bubbles:!0});(u=n.current)==null||u.dispatchEvent(m)}}}function by(e){const{wasSelected:t,enabled:n,isSelected:r,mode:o="unmount"}=e;return!!(!n||r||o==="keepMounted"&&t)}var[CH,wH,SH,kH]=Bb(),[jH,Ef]=Bn({strict:!1,name:"MenuContext"});function _H(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}function o5(e){var t;return(t=e==null?void 0:e.ownerDocument)!=null?t:document}function YS(e){return o5(e).activeElement===e}function IH(e={}){const{id:t,closeOnSelect:n=!0,closeOnBlur:r=!0,initialFocusRef:o,autoSelect:s=!0,isLazy:i,isOpen:l,defaultIsOpen:u,onClose:p,onOpen:m,placement:h="bottom-start",lazyBehavior:g="unmount",direction:x,computePositionOnMount:y=!1,...b}=e,C=d.useRef(null),S=d.useRef(null),j=SH(),_=d.useCallback(()=>{requestAnimationFrame(()=>{var le;(le=C.current)==null||le.focus({preventScroll:!1})})},[]),P=d.useCallback(()=>{const le=setTimeout(()=>{var se;if(o)(se=o.current)==null||se.focus();else{const K=j.firstEnabled();K&&F(K.index)}});G.current.add(le)},[j,o]),I=d.useCallback(()=>{const le=setTimeout(()=>{const se=j.lastEnabled();se&&F(se.index)});G.current.add(le)},[j]),M=d.useCallback(()=>{m==null||m(),s?P():_()},[s,P,_,m]),{isOpen:O,onOpen:A,onClose:D,onToggle:R}=xy({isOpen:l,defaultIsOpen:u,onClose:p,onOpen:M});yH({enabled:O&&r,ref:C,handler:le=>{var se;(se=S.current)!=null&&se.contains(le.target)||D()}});const N=vy({...b,enabled:O||y,placement:h,direction:x}),[Y,F]=d.useState(-1);xi(()=>{O||F(-1)},[O]),G3(C,{focusRef:S,visible:O,shouldFocus:!0});const V=r5({isOpen:O,ref:C}),[Q,q]=_H(t,"menu-button","menu-list"),z=d.useCallback(()=>{A(),_()},[A,_]),G=d.useRef(new Set([]));DH(()=>{G.current.forEach(le=>clearTimeout(le)),G.current.clear()});const T=d.useCallback(()=>{A(),P()},[P,A]),B=d.useCallback(()=>{A(),I()},[A,I]),X=d.useCallback(()=>{var le,se;const K=o5(C.current),U=(le=C.current)==null?void 0:le.contains(K.activeElement);if(!(O&&!U))return;const de=(se=j.item(Y))==null?void 0:se.node;de==null||de.focus()},[O,Y,j]),re=d.useRef(null);return{openAndFocusMenu:z,openAndFocusFirstItem:T,openAndFocusLastItem:B,onTransitionEnd:X,unstable__animationState:V,descendants:j,popper:N,buttonId:Q,menuId:q,forceUpdate:N.forceUpdate,orientation:"vertical",isOpen:O,onToggle:R,onOpen:A,onClose:D,menuRef:C,buttonRef:S,focusedIndex:Y,closeOnSelect:n,closeOnBlur:r,autoSelect:s,setFocusedIndex:F,isLazy:i,lazyBehavior:g,initialFocusRef:o,rafId:re}}function PH(e={},t=null){const n=Ef(),{onToggle:r,popper:o,openAndFocusFirstItem:s,openAndFocusLastItem:i}=n,l=d.useCallback(u=>{const p=u.key,h={Enter:s,ArrowDown:s,ArrowUp:i}[p];h&&(u.preventDefault(),u.stopPropagation(),h(u))},[s,i]);return{...e,ref:gn(n.buttonRef,t,o.referenceRef),id:n.buttonId,"data-active":qt(n.isOpen),"aria-expanded":n.isOpen,"aria-haspopup":"menu","aria-controls":n.menuId,onClick:rt(e.onClick,r),onKeyDown:rt(e.onKeyDown,l)}}function ux(e){var t;return RH(e)&&!!((t=e==null?void 0:e.getAttribute("role"))!=null&&t.startsWith("menuitem"))}function EH(e={},t=null){const n=Ef();if(!n)throw new Error("useMenuContext: context is undefined. Seems you forgot to wrap component within ");const{focusedIndex:r,setFocusedIndex:o,menuRef:s,isOpen:i,onClose:l,menuId:u,isLazy:p,lazyBehavior:m,unstable__animationState:h}=n,g=wH(),x=qF({preventDefault:S=>S.key!==" "&&ux(S.target)}),y=d.useCallback(S=>{if(!S.currentTarget.contains(S.target))return;const j=S.key,P={Tab:M=>M.preventDefault(),Escape:l,ArrowDown:()=>{const M=g.nextEnabled(r);M&&o(M.index)},ArrowUp:()=>{const M=g.prevEnabled(r);M&&o(M.index)}}[j];if(P){S.preventDefault(),P(S);return}const I=x(M=>{const O=KF(g.values(),M,A=>{var D,R;return(R=(D=A==null?void 0:A.node)==null?void 0:D.textContent)!=null?R:""},g.item(r));if(O){const A=g.indexOf(O.node);o(A)}});ux(S.target)&&I(S)},[g,r,x,l,o]),b=d.useRef(!1);i&&(b.current=!0);const C=by({wasSelected:b.current,enabled:p,mode:m,isSelected:h.present});return{...e,ref:gn(s,t),children:C?e.children:null,tabIndex:-1,role:"menu",id:u,style:{...e.style,transformOrigin:"var(--popper-transform-origin)"},"aria-orientation":"vertical",onKeyDown:rt(e.onKeyDown,y)}}function MH(e={}){const{popper:t,isOpen:n}=Ef();return t.getPopperProps({...e,style:{visibility:n?"visible":"hidden",...e.style}})}function OH(e={},t=null){const{onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onClick:s,onFocus:i,isDisabled:l,isFocusable:u,closeOnSelect:p,type:m,...h}=e,g=Ef(),{setFocusedIndex:x,focusedIndex:y,closeOnSelect:b,onClose:C,menuRef:S,isOpen:j,menuId:_,rafId:P}=g,I=d.useRef(null),M=`${_}-menuitem-${d.useId()}`,{index:O,register:A}=kH({disabled:l&&!u}),D=d.useCallback(z=>{n==null||n(z),!l&&x(O)},[x,O,l,n]),R=d.useCallback(z=>{r==null||r(z),I.current&&!YS(I.current)&&D(z)},[D,r]),N=d.useCallback(z=>{o==null||o(z),!l&&x(-1)},[x,l,o]),Y=d.useCallback(z=>{s==null||s(z),ux(z.currentTarget)&&(p??b)&&C()},[C,s,b,p]),F=d.useCallback(z=>{i==null||i(z),x(O)},[x,i,O]),V=O===y,Q=l&&!u;xi(()=>{j&&(V&&!Q&&I.current?(P.current&&cancelAnimationFrame(P.current),P.current=requestAnimationFrame(()=>{var z;(z=I.current)==null||z.focus(),P.current=null})):S.current&&!YS(S.current)&&S.current.focus({preventScroll:!0}))},[V,Q,S,j]);const q=U3({onClick:Y,onFocus:F,onMouseEnter:D,onMouseMove:R,onMouseLeave:N,ref:gn(A,I,t),isDisabled:l,isFocusable:u});return{...h,...q,type:m??q.type,id:M,role:"menuitem",tabIndex:V?0:-1}}function RH(e){var t;if(!AH(e))return!1;const n=(t=e.ownerDocument.defaultView)!=null?t:window;return e instanceof n.HTMLElement}function AH(e){return e!=null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function DH(e,t=[]){return d.useEffect(()=>()=>e(),t)}var[TH,Au]=Bn({name:"MenuStylesContext",errorMessage:`useMenuStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),bg=e=>{const{children:t}=e,n=Kr("Menu",e),r=ar(e),{direction:o}=mf(),{descendants:s,...i}=IH({...r,direction:o}),l=d.useMemo(()=>i,[i]),{isOpen:u,onClose:p,forceUpdate:m}=l;return a.jsx(CH,{value:s,children:a.jsx(jH,{value:l,children:a.jsx(TH,{value:n,children:mb(t,{isOpen:u,onClose:p,forceUpdate:m})})})})};bg.displayName="Menu";var s5=Oe((e,t)=>{const n=Au();return a.jsx(Ee.span,{ref:t,...e,__css:n.command,className:"chakra-menu__command"})});s5.displayName="MenuCommand";var NH=Oe((e,t)=>{const{type:n,...r}=e,o=Au(),s=r.as||n?n??void 0:"button",i=d.useMemo(()=>({textDecoration:"none",color:"inherit",userSelect:"none",display:"flex",width:"100%",alignItems:"center",textAlign:"start",flex:"0 0 auto",outline:0,...o.item}),[o.item]);return a.jsx(Ee.button,{ref:t,type:s,...r,__css:i})}),a5=e=>{const{className:t,children:n,...r}=e,o=Au(),s=d.Children.only(n),i=d.isValidElement(s)?d.cloneElement(s,{focusable:"false","aria-hidden":!0,className:_t("chakra-menu__icon",s.props.className)}):null,l=_t("chakra-menu__icon-wrapper",t);return a.jsx(Ee.span,{className:l,...r,__css:o.icon,children:i})};a5.displayName="MenuIcon";var Wn=Oe((e,t)=>{const{icon:n,iconSpacing:r="0.75rem",command:o,commandSpacing:s="0.75rem",children:i,...l}=e,u=OH(l,t),m=n||o?a.jsx("span",{style:{pointerEvents:"none",flex:1},children:i}):i;return a.jsxs(NH,{...u,className:_t("chakra-menu__menuitem",u.className),children:[n&&a.jsx(a5,{fontSize:"0.8em",marginEnd:r,children:n}),m,o&&a.jsx(s5,{marginStart:s,children:o})]})});Wn.displayName="MenuItem";var $H={enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.2,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.1,easings:"easeOut"}}},LH=Ee(Mr.div),Ul=Oe(function(t,n){var r,o;const{rootProps:s,motionProps:i,...l}=t,{isOpen:u,onTransitionEnd:p,unstable__animationState:m}=Ef(),h=EH(l,n),g=MH(s),x=Au();return a.jsx(Ee.div,{...g,__css:{zIndex:(o=t.zIndex)!=null?o:(r=x.list)==null?void 0:r.zIndex},children:a.jsx(LH,{variants:$H,initial:!1,animate:u?"enter":"exit",__css:{outline:0,...x.list},...i,className:_t("chakra-menu__menu-list",h.className),...h,onUpdate:p,onAnimationComplete:eg(m.onComplete,h.onAnimationComplete)})})});Ul.displayName="MenuList";var Xd=Oe((e,t)=>{const{title:n,children:r,className:o,...s}=e,i=_t("chakra-menu__group__title",o),l=Au();return a.jsxs("div",{ref:t,className:"chakra-menu__group",role:"group",children:[n&&a.jsx(Ee.p,{className:i,...s,__css:l.groupTitle,children:n}),r]})});Xd.displayName="MenuGroup";var zH=Oe((e,t)=>{const n=Au();return a.jsx(Ee.button,{ref:t,...e,__css:{display:"inline-flex",appearance:"none",alignItems:"center",outline:0,...n.button}})}),yg=Oe((e,t)=>{const{children:n,as:r,...o}=e,s=PH(o,t),i=r||zH;return a.jsx(i,{...s,className:_t("chakra-menu__menu-button",e.className),children:a.jsx(Ee.span,{__css:{pointerEvents:"none",flex:"1 1 auto",minW:0},children:e.children})})});yg.displayName="MenuButton";var FH={slideInBottom:{...Q1,custom:{offsetY:16,reverse:!0}},slideInRight:{...Q1,custom:{offsetX:16,reverse:!0}},scale:{...$P,custom:{initialScale:.95,reverse:!0}},none:{}},BH=Ee(Mr.section),HH=e=>FH[e||"none"],i5=d.forwardRef((e,t)=>{const{preset:n,motionProps:r=HH(n),...o}=e;return a.jsx(BH,{ref:t,...r,...o})});i5.displayName="ModalTransition";var WH=Object.defineProperty,VH=(e,t,n)=>t in e?WH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,UH=(e,t,n)=>(VH(e,typeof t!="symbol"?t+"":t,n),n),GH=class{constructor(){UH(this,"modals"),this.modals=new Map}add(e){return this.modals.set(e,this.modals.size+1),this.modals.size}remove(e){this.modals.delete(e)}isTopModal(e){return e?this.modals.get(e)===this.modals.size:!1}},dx=new GH;function l5(e,t){const[n,r]=d.useState(0);return d.useEffect(()=>{const o=e.current;if(o){if(t){const s=dx.add(o);r(s)}return()=>{dx.remove(o),r(0)}}},[t,e]),n}var qH=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},Ic=new WeakMap,$p=new WeakMap,Lp={},Bv=0,c5=function(e){return e&&(e.host||c5(e.parentNode))},KH=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=c5(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},QH=function(e,t,n,r){var o=KH(t,Array.isArray(e)?e:[e]);Lp[n]||(Lp[n]=new WeakMap);var s=Lp[n],i=[],l=new Set,u=new Set(o),p=function(h){!h||l.has(h)||(l.add(h),p(h.parentNode))};o.forEach(p);var m=function(h){!h||u.has(h)||Array.prototype.forEach.call(h.children,function(g){if(l.has(g))m(g);else{var x=g.getAttribute(r),y=x!==null&&x!=="false",b=(Ic.get(g)||0)+1,C=(s.get(g)||0)+1;Ic.set(g,b),s.set(g,C),i.push(g),b===1&&y&&$p.set(g,!0),C===1&&g.setAttribute(n,"true"),y||g.setAttribute(r,"true")}})};return m(t),l.clear(),Bv++,function(){i.forEach(function(h){var g=Ic.get(h)-1,x=s.get(h)-1;Ic.set(h,g),s.set(h,x),g||($p.has(h)||h.removeAttribute(r),$p.delete(h)),x||h.removeAttribute(n)}),Bv--,Bv||(Ic=new WeakMap,Ic=new WeakMap,$p=new WeakMap,Lp={})}},XH=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=t||qH(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),QH(r,o,n,"aria-hidden")):function(){return null}};function YH(e){const{isOpen:t,onClose:n,id:r,closeOnOverlayClick:o=!0,closeOnEsc:s=!0,useInert:i=!0,onOverlayClick:l,onEsc:u}=e,p=d.useRef(null),m=d.useRef(null),[h,g,x]=ZH(r,"chakra-modal","chakra-modal--header","chakra-modal--body");JH(p,t&&i);const y=l5(p,t),b=d.useRef(null),C=d.useCallback(D=>{b.current=D.target},[]),S=d.useCallback(D=>{D.key==="Escape"&&(D.stopPropagation(),s&&(n==null||n()),u==null||u())},[s,n,u]),[j,_]=d.useState(!1),[P,I]=d.useState(!1),M=d.useCallback((D={},R=null)=>({role:"dialog",...D,ref:gn(R,p),id:h,tabIndex:-1,"aria-modal":!0,"aria-labelledby":j?g:void 0,"aria-describedby":P?x:void 0,onClick:rt(D.onClick,N=>N.stopPropagation())}),[x,P,h,g,j]),O=d.useCallback(D=>{D.stopPropagation(),b.current===D.target&&dx.isTopModal(p.current)&&(o&&(n==null||n()),l==null||l())},[n,o,l]),A=d.useCallback((D={},R=null)=>({...D,ref:gn(R,m),onClick:rt(D.onClick,O),onKeyDown:rt(D.onKeyDown,S),onMouseDown:rt(D.onMouseDown,C)}),[S,C,O]);return{isOpen:t,onClose:n,headerId:g,bodyId:x,setBodyMounted:I,setHeaderMounted:_,dialogRef:p,overlayRef:m,getDialogProps:M,getDialogContainerProps:A,index:y}}function JH(e,t){const n=e.current;d.useEffect(()=>{if(!(!e.current||!t))return XH(e.current)},[t,e,n])}function ZH(e,...t){const n=d.useId(),r=e||n;return d.useMemo(()=>t.map(o=>`${o}-${r}`),[r,t])}var[eW,Du]=Bn({name:"ModalStylesContext",errorMessage:`useModalStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[tW,Gl]=Bn({strict:!0,name:"ModalContext",errorMessage:"useModalContext: `context` is undefined. Seems you forgot to wrap modal components in ``"}),ql=e=>{const t={scrollBehavior:"outside",autoFocus:!0,trapFocus:!0,returnFocusOnClose:!0,blockScrollOnMount:!0,allowPinchZoom:!1,motionPreset:"scale",lockFocusAcrossFrames:!0,...e},{portalProps:n,children:r,autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x,onCloseComplete:y}=t,b=Kr("Modal",t),S={...YH(t),autoFocus:o,trapFocus:s,initialFocusRef:i,finalFocusRef:l,returnFocusOnClose:u,blockScrollOnMount:p,allowPinchZoom:m,preserveScrollBarGap:h,motionPreset:g,lockFocusAcrossFrames:x};return a.jsx(tW,{value:S,children:a.jsx(eW,{value:b,children:a.jsx(yo,{onExitComplete:y,children:S.isOpen&&a.jsx(Eu,{...n,children:r})})})})};ql.displayName="Modal";var ym="right-scroll-bar-position",Cm="width-before-scroll-bar",nW="with-scroll-bars-hidden",rW="--removed-body-scroll-bar-size",u5=a3(),Hv=function(){},Cg=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:Hv,onWheelCapture:Hv,onTouchMoveCapture:Hv}),o=r[0],s=r[1],i=e.forwardProps,l=e.children,u=e.className,p=e.removeScrollBar,m=e.enabled,h=e.shards,g=e.sideCar,x=e.noIsolation,y=e.inert,b=e.allowPinchZoom,C=e.as,S=C===void 0?"div":C,j=e.gapMode,_=r3(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),P=g,I=n3([n,t]),M=ka(ka({},_),o);return d.createElement(d.Fragment,null,m&&d.createElement(P,{sideCar:u5,removeScrollBar:p,shards:h,noIsolation:x,inert:y,setCallbacks:s,allowPinchZoom:!!b,lockRef:n,gapMode:j}),i?d.cloneElement(d.Children.only(l),ka(ka({},M),{ref:I})):d.createElement(S,ka({},M,{className:u,ref:I}),l))});Cg.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Cg.classNames={fullWidth:Cm,zeroRight:ym};var JS,oW=function(){if(JS)return JS;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function sW(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=oW();return t&&e.setAttribute("nonce",t),e}function aW(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function iW(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var lW=function(){var e=0,t=null;return{add:function(n){e==0&&(t=sW())&&(aW(t,n),iW(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},cW=function(){var e=lW();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},d5=function(){var e=cW(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},uW={left:0,top:0,right:0,gap:0},Wv=function(e){return parseInt(e||"",10)||0},dW=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Wv(n),Wv(r),Wv(o)]},fW=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return uW;var t=dW(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},pW=d5(),mW=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,l=e.gap;return n===void 0&&(n="margin"),` + .`.concat(nW,` { + overflow: hidden `).concat(r,`; + padding-right: `).concat(l,"px ").concat(r,`; + } + body { + overflow: hidden `).concat(r,`; + overscroll-behavior: contain; + `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&` + padding-left: `.concat(o,`px; + padding-top: `).concat(s,`px; + padding-right: `).concat(i,`px; + margin-left:0; + margin-top:0; + margin-right: `).concat(l,"px ").concat(r,`; + `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),` + } + + .`).concat(ym,` { + right: `).concat(l,"px ").concat(r,`; + } + + .`).concat(Cm,` { + margin-right: `).concat(l,"px ").concat(r,`; + } + + .`).concat(ym," .").concat(ym,` { + right: 0 `).concat(r,`; + } + + .`).concat(Cm," .").concat(Cm,` { + margin-right: 0 `).concat(r,`; + } + + body { + `).concat(rW,": ").concat(l,`px; + } +`)},hW=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r,s=d.useMemo(function(){return fW(o)},[o]);return d.createElement(pW,{styles:mW(s,!t,o,n?"":"!important")})},fx=!1;if(typeof window<"u")try{var zp=Object.defineProperty({},"passive",{get:function(){return fx=!0,!0}});window.addEventListener("test",zp,zp),window.removeEventListener("test",zp,zp)}catch{fx=!1}var Pc=fx?{passive:!1}:!1,gW=function(e){return e.tagName==="TEXTAREA"},f5=function(e,t){var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!gW(e)&&n[t]==="visible")},vW=function(e){return f5(e,"overflowY")},xW=function(e){return f5(e,"overflowX")},ZS=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=p5(e,r);if(o){var s=m5(e,r),i=s[1],l=s[2];if(i>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},bW=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},yW=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},p5=function(e,t){return e==="v"?vW(t):xW(t)},m5=function(e,t){return e==="v"?bW(t):yW(t)},CW=function(e,t){return e==="h"&&t==="rtl"?-1:1},wW=function(e,t,n,r,o){var s=CW(e,window.getComputedStyle(t).direction),i=s*r,l=n.target,u=t.contains(l),p=!1,m=i>0,h=0,g=0;do{var x=m5(e,l),y=x[0],b=x[1],C=x[2],S=b-C-s*y;(y||S)&&p5(e,l)&&(h+=S,g+=y),l=l.parentNode}while(!u&&l!==document.body||u&&(t.contains(l)||t===l));return(m&&(o&&h===0||!o&&i>h)||!m&&(o&&g===0||!o&&-i>g))&&(p=!0),p},Fp=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},e4=function(e){return[e.deltaX,e.deltaY]},t4=function(e){return e&&"current"in e?e.current:e},SW=function(e,t){return e[0]===t[0]&&e[1]===t[1]},kW=function(e){return` + .block-interactivity-`.concat(e,` {pointer-events: none;} + .allow-interactivity-`).concat(e,` {pointer-events: all;} +`)},jW=0,Ec=[];function _W(e){var t=d.useRef([]),n=d.useRef([0,0]),r=d.useRef(),o=d.useState(jW++)[0],s=d.useState(d5)[0],i=d.useRef(e);d.useEffect(function(){i.current=e},[e]),d.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var b=rx([e.lockRef.current],(e.shards||[]).map(t4),!0).filter(Boolean);return b.forEach(function(C){return C.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),b.forEach(function(C){return C.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var l=d.useCallback(function(b,C){if("touches"in b&&b.touches.length===2)return!i.current.allowPinchZoom;var S=Fp(b),j=n.current,_="deltaX"in b?b.deltaX:j[0]-S[0],P="deltaY"in b?b.deltaY:j[1]-S[1],I,M=b.target,O=Math.abs(_)>Math.abs(P)?"h":"v";if("touches"in b&&O==="h"&&M.type==="range")return!1;var A=ZS(O,M);if(!A)return!0;if(A?I=O:(I=O==="v"?"h":"v",A=ZS(O,M)),!A)return!1;if(!r.current&&"changedTouches"in b&&(_||P)&&(r.current=I),!I)return!0;var D=r.current||I;return wW(D,C,b,D==="h"?_:P,!0)},[]),u=d.useCallback(function(b){var C=b;if(!(!Ec.length||Ec[Ec.length-1]!==s)){var S="deltaY"in C?e4(C):Fp(C),j=t.current.filter(function(I){return I.name===C.type&&I.target===C.target&&SW(I.delta,S)})[0];if(j&&j.should){C.cancelable&&C.preventDefault();return}if(!j){var _=(i.current.shards||[]).map(t4).filter(Boolean).filter(function(I){return I.contains(C.target)}),P=_.length>0?l(C,_[0]):!i.current.noIsolation;P&&C.cancelable&&C.preventDefault()}}},[]),p=d.useCallback(function(b,C,S,j){var _={name:b,delta:C,target:S,should:j};t.current.push(_),setTimeout(function(){t.current=t.current.filter(function(P){return P!==_})},1)},[]),m=d.useCallback(function(b){n.current=Fp(b),r.current=void 0},[]),h=d.useCallback(function(b){p(b.type,e4(b),b.target,l(b,e.lockRef.current))},[]),g=d.useCallback(function(b){p(b.type,Fp(b),b.target,l(b,e.lockRef.current))},[]);d.useEffect(function(){return Ec.push(s),e.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:g}),document.addEventListener("wheel",u,Pc),document.addEventListener("touchmove",u,Pc),document.addEventListener("touchstart",m,Pc),function(){Ec=Ec.filter(function(b){return b!==s}),document.removeEventListener("wheel",u,Pc),document.removeEventListener("touchmove",u,Pc),document.removeEventListener("touchstart",m,Pc)}},[]);var x=e.removeScrollBar,y=e.inert;return d.createElement(d.Fragment,null,y?d.createElement(s,{styles:kW(o)}):null,x?d.createElement(hW,{gapMode:e.gapMode}):null)}const IW=Iz(u5,_W);var h5=d.forwardRef(function(e,t){return d.createElement(Cg,ka({},e,{ref:t,sideCar:IW}))});h5.classNames=Cg.classNames;const PW=h5;function EW(e){const{autoFocus:t,trapFocus:n,dialogRef:r,initialFocusRef:o,blockScrollOnMount:s,allowPinchZoom:i,finalFocusRef:l,returnFocusOnClose:u,preserveScrollBarGap:p,lockFocusAcrossFrames:m,isOpen:h}=Gl(),[g,x]=uD();d.useEffect(()=>{!g&&x&&setTimeout(x)},[g,x]);const y=l5(r,h);return a.jsx($3,{autoFocus:t,isDisabled:!n,initialFocusRef:o,finalFocusRef:l,restoreFocus:u,contentRef:r,lockFocusAcrossFrames:m,children:a.jsx(PW,{removeScrollBar:!p,allowPinchZoom:i,enabled:y===1&&s,forwardProps:!0,children:e.children})})}var Kl=Oe((e,t)=>{const{className:n,children:r,containerProps:o,motionProps:s,...i}=e,{getDialogProps:l,getDialogContainerProps:u}=Gl(),p=l(i,t),m=u(o),h=_t("chakra-modal__content",n),g=Du(),x={display:"flex",flexDirection:"column",position:"relative",width:"100%",outline:0,...g.dialog},y={display:"flex",width:"100vw",height:"$100vh",position:"fixed",left:0,top:0,...g.dialogContainer},{motionPreset:b}=Gl();return a.jsx(EW,{children:a.jsx(Ee.div,{...m,className:"chakra-modal__content-container",tabIndex:-1,__css:y,children:a.jsx(i5,{preset:b,motionProps:s,className:h,...p,__css:x,children:r})})})});Kl.displayName="ModalContent";function Mf(e){const{leastDestructiveRef:t,...n}=e;return a.jsx(ql,{...n,initialFocusRef:t})}var Of=Oe((e,t)=>a.jsx(Kl,{ref:t,role:"alertdialog",...e})),Oa=Oe((e,t)=>{const{className:n,...r}=e,o=_t("chakra-modal__footer",n),i={display:"flex",alignItems:"center",justifyContent:"flex-end",...Du().footer};return a.jsx(Ee.footer,{ref:t,...r,__css:i,className:o})});Oa.displayName="ModalFooter";var ra=Oe((e,t)=>{const{className:n,...r}=e,{headerId:o,setHeaderMounted:s}=Gl();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=_t("chakra-modal__header",n),u={flex:0,...Du().header};return a.jsx(Ee.header,{ref:t,className:i,id:o,...r,__css:u})});ra.displayName="ModalHeader";var MW=Ee(Mr.div),oa=Oe((e,t)=>{const{className:n,transition:r,motionProps:o,...s}=e,i=_t("chakra-modal__overlay",n),u={pos:"fixed",left:"0",top:"0",w:"100vw",h:"100vh",...Du().overlay},{motionPreset:p}=Gl(),h=o||(p==="none"?{}:NP);return a.jsx(MW,{...h,__css:u,ref:t,className:i,...s})});oa.displayName="ModalOverlay";var sa=Oe((e,t)=>{const{className:n,...r}=e,{bodyId:o,setBodyMounted:s}=Gl();d.useEffect(()=>(s(!0),()=>s(!1)),[s]);const i=_t("chakra-modal__body",n),l=Du();return a.jsx(Ee.div,{ref:t,className:i,id:o,...r,__css:l.body})});sa.displayName="ModalBody";var Rf=Oe((e,t)=>{const{onClick:n,className:r,...o}=e,{onClose:s}=Gl(),i=_t("chakra-modal__close-btn",r),l=Du();return a.jsx(SI,{ref:t,__css:l.closeButton,className:i,onClick:rt(n,u=>{u.stopPropagation(),s()}),...o})});Rf.displayName="ModalCloseButton";var OW=e=>a.jsx(Lr,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M21,5H3C2.621,5,2.275,5.214,2.105,5.553C1.937,5.892,1.973,6.297,2.2,6.6l9,12 c0.188,0.252,0.485,0.4,0.8,0.4s0.611-0.148,0.8-0.4l9-12c0.228-0.303,0.264-0.708,0.095-1.047C21.725,5.214,21.379,5,21,5z"})}),RW=e=>a.jsx(Lr,{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M12.8,5.4c-0.377-0.504-1.223-0.504-1.6,0l-9,12c-0.228,0.303-0.264,0.708-0.095,1.047 C2.275,18.786,2.621,19,3,19h18c0.379,0,0.725-0.214,0.895-0.553c0.169-0.339,0.133-0.744-0.095-1.047L12.8,5.4z"})});function n4(e,t,n,r){d.useEffect(()=>{var o;if(!e.current||!r)return;const s=(o=e.current.ownerDocument.defaultView)!=null?o:window,i=Array.isArray(t)?t:[t],l=new s.MutationObserver(u=>{for(const p of u)p.type==="attributes"&&p.attributeName&&i.includes(p.attributeName)&&n(p)});return l.observe(e.current,{attributes:!0,attributeFilter:i}),()=>l.disconnect()})}function AW(e,t){const n=pr(e);d.useEffect(()=>{let r=null;const o=()=>n();return t!==null&&(r=window.setInterval(o,t)),()=>{r&&window.clearInterval(r)}},[t,n])}var DW=50,r4=300;function TW(e,t){const[n,r]=d.useState(!1),[o,s]=d.useState(null),[i,l]=d.useState(!0),u=d.useRef(null),p=()=>clearTimeout(u.current);AW(()=>{o==="increment"&&e(),o==="decrement"&&t()},n?DW:null);const m=d.useCallback(()=>{i&&e(),u.current=setTimeout(()=>{l(!1),r(!0),s("increment")},r4)},[e,i]),h=d.useCallback(()=>{i&&t(),u.current=setTimeout(()=>{l(!1),r(!0),s("decrement")},r4)},[t,i]),g=d.useCallback(()=>{l(!0),r(!1),p()},[]);return d.useEffect(()=>()=>p(),[]),{up:m,down:h,stop:g,isSpinning:n}}var NW=/^[Ee0-9+\-.]$/;function $W(e){return NW.test(e)}function LW(e,t){if(e.key==null)return!0;const n=e.ctrlKey||e.altKey||e.metaKey;return!(e.key.length===1)||n?!0:t(e.key)}function zW(e={}){const{focusInputOnChange:t=!0,clampValueOnBlur:n=!0,keepWithinRange:r=!0,min:o=Number.MIN_SAFE_INTEGER,max:s=Number.MAX_SAFE_INTEGER,step:i=1,isReadOnly:l,isDisabled:u,isRequired:p,isInvalid:m,pattern:h="[0-9]*(.[0-9]+)?",inputMode:g="decimal",allowMouseWheel:x,id:y,onChange:b,precision:C,name:S,"aria-describedby":j,"aria-label":_,"aria-labelledby":P,onFocus:I,onBlur:M,onInvalid:O,getAriaValueText:A,isValidCharacter:D,format:R,parse:N,...Y}=e,F=pr(I),V=pr(M),Q=pr(O),q=pr(D??$W),z=pr(A),G=iz(e),{update:T,increment:B,decrement:X}=G,[re,le]=d.useState(!1),se=!(l||u),K=d.useRef(null),U=d.useRef(null),ee=d.useRef(null),de=d.useRef(null),Z=d.useCallback(ke=>ke.split("").filter(q).join(""),[q]),ue=d.useCallback(ke=>{var Ct;return(Ct=N==null?void 0:N(ke))!=null?Ct:ke},[N]),fe=d.useCallback(ke=>{var Ct;return((Ct=R==null?void 0:R(ke))!=null?Ct:ke).toString()},[R]);xi(()=>{(G.valueAsNumber>s||G.valueAsNumber{if(!K.current)return;if(K.current.value!=G.value){const Ct=ue(K.current.value);G.setValue(Z(Ct))}},[ue,Z]);const ge=d.useCallback((ke=i)=>{se&&B(ke)},[B,se,i]),_e=d.useCallback((ke=i)=>{se&&X(ke)},[X,se,i]),ye=TW(ge,_e);n4(ee,"disabled",ye.stop,ye.isSpinning),n4(de,"disabled",ye.stop,ye.isSpinning);const pe=d.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;const Ft=ue(ke.currentTarget.value);T(Z(Ft)),U.current={start:ke.currentTarget.selectionStart,end:ke.currentTarget.selectionEnd}},[T,Z,ue]),Te=d.useCallback(ke=>{var Ct,Ft,Wt;F==null||F(ke),U.current&&(ke.target.selectionStart=(Ft=U.current.start)!=null?Ft:(Ct=ke.currentTarget.value)==null?void 0:Ct.length,ke.currentTarget.selectionEnd=(Wt=U.current.end)!=null?Wt:ke.currentTarget.selectionStart)},[F]),Ae=d.useCallback(ke=>{if(ke.nativeEvent.isComposing)return;LW(ke,q)||ke.preventDefault();const Ct=qe(ke)*i,Ft=ke.key,Le={ArrowUp:()=>ge(Ct),ArrowDown:()=>_e(Ct),Home:()=>T(o),End:()=>T(s)}[Ft];Le&&(ke.preventDefault(),Le(ke))},[q,i,ge,_e,T,o,s]),qe=ke=>{let Ct=1;return(ke.metaKey||ke.ctrlKey)&&(Ct=.1),ke.shiftKey&&(Ct=10),Ct},Pt=d.useMemo(()=>{const ke=z==null?void 0:z(G.value);if(ke!=null)return ke;const Ct=G.value.toString();return Ct||void 0},[G.value,z]),tt=d.useCallback(()=>{let ke=G.value;if(G.value==="")return;/^[eE]/.test(G.value.toString())?G.setValue(""):(G.valueAsNumbers&&(ke=s),G.cast(ke))},[G,s,o]),sn=d.useCallback(()=>{le(!1),n&&tt()},[n,le,tt]),mt=d.useCallback(()=>{t&&requestAnimationFrame(()=>{var ke;(ke=K.current)==null||ke.focus()})},[t]),ct=d.useCallback(ke=>{ke.preventDefault(),ye.up(),mt()},[mt,ye]),be=d.useCallback(ke=>{ke.preventDefault(),ye.down(),mt()},[mt,ye]);Dl(()=>K.current,"wheel",ke=>{var Ct,Ft;const Le=((Ft=(Ct=K.current)==null?void 0:Ct.ownerDocument)!=null?Ft:document).activeElement===K.current;if(!x||!Le)return;ke.preventDefault();const Xe=qe(ke)*i,_n=Math.sign(ke.deltaY);_n===-1?ge(Xe):_n===1&&_e(Xe)},{passive:!1});const We=d.useCallback((ke={},Ct=null)=>{const Ft=u||r&&G.isAtMax;return{...ke,ref:gn(Ct,ee),role:"button",tabIndex:-1,onPointerDown:rt(ke.onPointerDown,Wt=>{Wt.button!==0||Ft||ct(Wt)}),onPointerLeave:rt(ke.onPointerLeave,ye.stop),onPointerUp:rt(ke.onPointerUp,ye.stop),disabled:Ft,"aria-disabled":_s(Ft)}},[G.isAtMax,r,ct,ye.stop,u]),Rt=d.useCallback((ke={},Ct=null)=>{const Ft=u||r&&G.isAtMin;return{...ke,ref:gn(Ct,de),role:"button",tabIndex:-1,onPointerDown:rt(ke.onPointerDown,Wt=>{Wt.button!==0||Ft||be(Wt)}),onPointerLeave:rt(ke.onPointerLeave,ye.stop),onPointerUp:rt(ke.onPointerUp,ye.stop),disabled:Ft,"aria-disabled":_s(Ft)}},[G.isAtMin,r,be,ye.stop,u]),Ut=d.useCallback((ke={},Ct=null)=>{var Ft,Wt,Le,Xe;return{name:S,inputMode:g,type:"text",pattern:h,"aria-labelledby":P,"aria-label":_,"aria-describedby":j,id:y,disabled:u,...ke,readOnly:(Ft=ke.readOnly)!=null?Ft:l,"aria-readonly":(Wt=ke.readOnly)!=null?Wt:l,"aria-required":(Le=ke.required)!=null?Le:p,required:(Xe=ke.required)!=null?Xe:p,ref:gn(K,Ct),value:fe(G.value),role:"spinbutton","aria-valuemin":o,"aria-valuemax":s,"aria-valuenow":Number.isNaN(G.valueAsNumber)?void 0:G.valueAsNumber,"aria-invalid":_s(m??G.isOutOfRange),"aria-valuetext":Pt,autoComplete:"off",autoCorrect:"off",onChange:rt(ke.onChange,pe),onKeyDown:rt(ke.onKeyDown,Ae),onFocus:rt(ke.onFocus,Te,()=>le(!0)),onBlur:rt(ke.onBlur,V,sn)}},[S,g,h,P,_,fe,j,y,u,p,l,m,G.value,G.valueAsNumber,G.isOutOfRange,o,s,Pt,pe,Ae,Te,V,sn]);return{value:fe(G.value),valueAsNumber:G.valueAsNumber,isFocused:re,isDisabled:u,isReadOnly:l,getIncrementButtonProps:We,getDecrementButtonProps:Rt,getInputProps:Ut,htmlProps:Y}}var[FW,wg]=Bn({name:"NumberInputStylesContext",errorMessage:`useNumberInputStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),[BW,yy]=Bn({name:"NumberInputContext",errorMessage:"useNumberInputContext: `context` is undefined. Seems you forgot to wrap number-input's components within "}),Sg=Oe(function(t,n){const r=Kr("NumberInput",t),o=ar(t),s=Ub(o),{htmlProps:i,...l}=zW(s),u=d.useMemo(()=>l,[l]);return a.jsx(BW,{value:u,children:a.jsx(FW,{value:r,children:a.jsx(Ee.div,{...i,ref:n,className:_t("chakra-numberinput",t.className),__css:{position:"relative",zIndex:0,...r.root}})})})});Sg.displayName="NumberInput";var kg=Oe(function(t,n){const r=wg();return a.jsx(Ee.div,{"aria-hidden":!0,ref:n,...t,__css:{display:"flex",flexDirection:"column",position:"absolute",top:"0",insetEnd:"0px",margin:"1px",height:"calc(100% - 2px)",zIndex:1,...r.stepperGroup}})});kg.displayName="NumberInputStepper";var jg=Oe(function(t,n){const{getInputProps:r}=yy(),o=r(t,n),s=wg();return a.jsx(Ee.input,{...o,className:_t("chakra-numberinput__field",t.className),__css:{width:"100%",...s.field}})});jg.displayName="NumberInputField";var g5=Ee("div",{baseStyle:{display:"flex",justifyContent:"center",alignItems:"center",flex:1,transitionProperty:"common",transitionDuration:"normal",userSelect:"none",cursor:"pointer",lineHeight:"normal"}}),_g=Oe(function(t,n){var r;const o=wg(),{getDecrementButtonProps:s}=yy(),i=s(t,n);return a.jsx(g5,{...i,__css:o.stepper,children:(r=t.children)!=null?r:a.jsx(OW,{})})});_g.displayName="NumberDecrementStepper";var Ig=Oe(function(t,n){var r;const{getIncrementButtonProps:o}=yy(),s=o(t,n),i=wg();return a.jsx(g5,{...s,__css:i.stepper,children:(r=t.children)!=null?r:a.jsx(RW,{})})});Ig.displayName="NumberIncrementStepper";var[HW,tc]=Bn({name:"PopoverContext",errorMessage:"usePopoverContext: `context` is undefined. Seems you forgot to wrap all popover components within ``"}),[WW,Pg]=Bn({name:"PopoverStylesContext",errorMessage:`usePopoverStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `});function Eg(e){const t=d.Children.only(e.children),{getTriggerProps:n}=tc();return d.cloneElement(t,n(t.props,t.ref))}Eg.displayName="PopoverTrigger";var Mc={click:"click",hover:"hover"};function VW(e={}){const{closeOnBlur:t=!0,closeOnEsc:n=!0,initialFocusRef:r,id:o,returnFocusOnClose:s=!0,autoFocus:i=!0,arrowSize:l,arrowShadowColor:u,trigger:p=Mc.click,openDelay:m=200,closeDelay:h=200,isLazy:g,lazyBehavior:x="unmount",computePositionOnMount:y,...b}=e,{isOpen:C,onClose:S,onOpen:j,onToggle:_}=xy(e),P=d.useRef(null),I=d.useRef(null),M=d.useRef(null),O=d.useRef(!1),A=d.useRef(!1);C&&(A.current=!0);const[D,R]=d.useState(!1),[N,Y]=d.useState(!1),F=d.useId(),V=o??F,[Q,q,z,G]=["popover-trigger","popover-content","popover-header","popover-body"].map(pe=>`${pe}-${V}`),{referenceRef:T,getArrowProps:B,getPopperProps:X,getArrowInnerProps:re,forceUpdate:le}=vy({...b,enabled:C||!!y}),se=r5({isOpen:C,ref:M});XP({enabled:C,ref:I}),G3(M,{focusRef:I,visible:C,shouldFocus:s&&p===Mc.click}),JF(M,{focusRef:r,visible:C,shouldFocus:i&&p===Mc.click});const K=by({wasSelected:A.current,enabled:g,mode:x,isSelected:se.present}),U=d.useCallback((pe={},Te=null)=>{const Ae={...pe,style:{...pe.style,transformOrigin:zr.transformOrigin.varRef,[zr.arrowSize.var]:l?`${l}px`:void 0,[zr.arrowShadowColor.var]:u},ref:gn(M,Te),children:K?pe.children:null,id:q,tabIndex:-1,role:"dialog",onKeyDown:rt(pe.onKeyDown,qe=>{n&&qe.key==="Escape"&&S()}),onBlur:rt(pe.onBlur,qe=>{const Pt=o4(qe),tt=Vv(M.current,Pt),sn=Vv(I.current,Pt);C&&t&&(!tt&&!sn)&&S()}),"aria-labelledby":D?z:void 0,"aria-describedby":N?G:void 0};return p===Mc.hover&&(Ae.role="tooltip",Ae.onMouseEnter=rt(pe.onMouseEnter,()=>{O.current=!0}),Ae.onMouseLeave=rt(pe.onMouseLeave,qe=>{qe.nativeEvent.relatedTarget!==null&&(O.current=!1,setTimeout(()=>S(),h))})),Ae},[K,q,D,z,N,G,p,n,S,C,t,h,u,l]),ee=d.useCallback((pe={},Te=null)=>X({...pe,style:{visibility:C?"visible":"hidden",...pe.style}},Te),[C,X]),de=d.useCallback((pe,Te=null)=>({...pe,ref:gn(Te,P,T)}),[P,T]),Z=d.useRef(),ue=d.useRef(),fe=d.useCallback(pe=>{P.current==null&&T(pe)},[T]),ge=d.useCallback((pe={},Te=null)=>{const Ae={...pe,ref:gn(I,Te,fe),id:Q,"aria-haspopup":"dialog","aria-expanded":C,"aria-controls":q};return p===Mc.click&&(Ae.onClick=rt(pe.onClick,_)),p===Mc.hover&&(Ae.onFocus=rt(pe.onFocus,()=>{Z.current===void 0&&j()}),Ae.onBlur=rt(pe.onBlur,qe=>{const Pt=o4(qe),tt=!Vv(M.current,Pt);C&&t&&tt&&S()}),Ae.onKeyDown=rt(pe.onKeyDown,qe=>{qe.key==="Escape"&&S()}),Ae.onMouseEnter=rt(pe.onMouseEnter,()=>{O.current=!0,Z.current=window.setTimeout(()=>j(),m)}),Ae.onMouseLeave=rt(pe.onMouseLeave,()=>{O.current=!1,Z.current&&(clearTimeout(Z.current),Z.current=void 0),ue.current=window.setTimeout(()=>{O.current===!1&&S()},h)})),Ae},[Q,C,q,p,fe,_,j,t,S,m,h]);d.useEffect(()=>()=>{Z.current&&clearTimeout(Z.current),ue.current&&clearTimeout(ue.current)},[]);const _e=d.useCallback((pe={},Te=null)=>({...pe,id:z,ref:gn(Te,Ae=>{R(!!Ae)})}),[z]),ye=d.useCallback((pe={},Te=null)=>({...pe,id:G,ref:gn(Te,Ae=>{Y(!!Ae)})}),[G]);return{forceUpdate:le,isOpen:C,onAnimationComplete:se.onComplete,onClose:S,getAnchorProps:de,getArrowProps:B,getArrowInnerProps:re,getPopoverPositionerProps:ee,getPopoverProps:U,getTriggerProps:ge,getHeaderProps:_e,getBodyProps:ye}}function Vv(e,t){return e===t||(e==null?void 0:e.contains(t))}function o4(e){var t;const n=e.currentTarget.ownerDocument.activeElement;return(t=e.relatedTarget)!=null?t:n}function Af(e){const t=Kr("Popover",e),{children:n,...r}=ar(e),o=mf(),s=VW({...r,direction:o.direction});return a.jsx(HW,{value:s,children:a.jsx(WW,{value:t,children:mb(n,{isOpen:s.isOpen,onClose:s.onClose,forceUpdate:s.forceUpdate})})})}Af.displayName="Popover";function v5(e){const t=d.Children.only(e.children),{getAnchorProps:n}=tc();return d.cloneElement(t,n(t.props,t.ref))}v5.displayName="PopoverAnchor";var Uv=(e,t)=>t?`${e}.${t}, ${t}`:void 0;function x5(e){var t;const{bg:n,bgColor:r,backgroundColor:o,shadow:s,boxShadow:i,shadowColor:l}=e,{getArrowProps:u,getArrowInnerProps:p}=tc(),m=Pg(),h=(t=n??r)!=null?t:o,g=s??i;return a.jsx(Ee.div,{...u(),className:"chakra-popover__arrow-positioner",children:a.jsx(Ee.div,{className:_t("chakra-popover__arrow",e.className),...p(e),__css:{"--popper-arrow-shadow-color":Uv("colors",l),"--popper-arrow-bg":Uv("colors",h),"--popper-arrow-shadow":Uv("shadows",g),...m.arrow}})})}x5.displayName="PopoverArrow";var Mg=Oe(function(t,n){const{getBodyProps:r}=tc(),o=Pg();return a.jsx(Ee.div,{...r(t,n),className:_t("chakra-popover__body",t.className),__css:o.body})});Mg.displayName="PopoverBody";var b5=Oe(function(t,n){const{onClose:r}=tc(),o=Pg();return a.jsx(SI,{size:"sm",onClick:r,className:_t("chakra-popover__close-btn",t.className),__css:o.closeButton,ref:n,...t})});b5.displayName="PopoverCloseButton";function UW(e){if(e)return{enter:{...e.enter,visibility:"visible"},exit:{...e.exit,transitionEnd:{visibility:"hidden"}}}}var GW={exit:{opacity:0,scale:.95,transition:{duration:.1,ease:[.4,0,1,1]}},enter:{scale:1,opacity:1,transition:{duration:.15,ease:[0,0,.2,1]}}},qW=Ee(Mr.section),y5=Oe(function(t,n){const{variants:r=GW,...o}=t,{isOpen:s}=tc();return a.jsx(qW,{ref:n,variants:UW(r),initial:!1,animate:s?"enter":"exit",...o})});y5.displayName="PopoverTransition";var Df=Oe(function(t,n){const{rootProps:r,motionProps:o,...s}=t,{getPopoverProps:i,getPopoverPositionerProps:l,onAnimationComplete:u}=tc(),p=Pg(),m={position:"relative",display:"flex",flexDirection:"column",...p.content};return a.jsx(Ee.div,{...l(r),__css:p.popper,className:"chakra-popover__popper",children:a.jsx(y5,{...o,...i(s,n),onAnimationComplete:eg(u,s.onAnimationComplete),className:_t("chakra-popover__content",t.className),__css:m})})});Df.displayName="PopoverContent";var px=e=>a.jsx(Ee.circle,{cx:50,cy:50,r:42,fill:"transparent",...e});px.displayName="Circle";function KW(e,t,n){return(e-t)*100/(n-t)}var QW=bi({"0%":{strokeDasharray:"1, 400",strokeDashoffset:"0"},"50%":{strokeDasharray:"400, 400",strokeDashoffset:"-100"},"100%":{strokeDasharray:"400, 400",strokeDashoffset:"-260"}}),XW=bi({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),YW=bi({"0%":{left:"-40%"},"100%":{left:"100%"}}),JW=bi({from:{backgroundPosition:"1rem 0"},to:{backgroundPosition:"0 0"}});function C5(e){const{value:t=0,min:n,max:r,valueText:o,getValueText:s,isIndeterminate:i,role:l="progressbar"}=e,u=KW(t,n,r);return{bind:{"data-indeterminate":i?"":void 0,"aria-valuemax":r,"aria-valuemin":n,"aria-valuenow":i?void 0:t,"aria-valuetext":(()=>{if(t!=null)return typeof s=="function"?s(t,u):o})(),role:l},percent:u,value:t}}var w5=e=>{const{size:t,isIndeterminate:n,...r}=e;return a.jsx(Ee.svg,{viewBox:"0 0 100 100",__css:{width:t,height:t,animation:n?`${XW} 2s linear infinite`:void 0},...r})};w5.displayName="Shape";var mx=Oe((e,t)=>{var n;const{size:r="48px",max:o=100,min:s=0,valueText:i,getValueText:l,value:u,capIsRound:p,children:m,thickness:h="10px",color:g="#0078d4",trackColor:x="#edebe9",isIndeterminate:y,...b}=e,C=C5({min:s,max:o,value:u,valueText:i,getValueText:l,isIndeterminate:y}),S=y?void 0:((n=C.percent)!=null?n:0)*2.64,j=S==null?void 0:`${S} ${264-S}`,_=y?{css:{animation:`${QW} 1.5s linear infinite`}}:{strokeDashoffset:66,strokeDasharray:j,transitionProperty:"stroke-dasharray, stroke",transitionDuration:"0.6s",transitionTimingFunction:"ease"},P={display:"inline-block",position:"relative",verticalAlign:"middle",fontSize:r};return a.jsxs(Ee.div,{ref:t,className:"chakra-progress",...C.bind,...b,__css:P,children:[a.jsxs(w5,{size:r,isIndeterminate:y,children:[a.jsx(px,{stroke:x,strokeWidth:h,className:"chakra-progress__track"}),a.jsx(px,{stroke:g,strokeWidth:h,className:"chakra-progress__indicator",strokeLinecap:p?"round":void 0,opacity:C.value===0&&!y?0:void 0,..._})]}),m]})});mx.displayName="CircularProgress";var[ZW,eV]=Bn({name:"ProgressStylesContext",errorMessage:`useProgressStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),tV=Oe((e,t)=>{const{min:n,max:r,value:o,isIndeterminate:s,role:i,...l}=e,u=C5({value:o,min:n,max:r,isIndeterminate:s,role:i}),m={height:"100%",...eV().filledTrack};return a.jsx(Ee.div,{ref:t,style:{width:`${u.percent}%`,...l.style},...u.bind,...l,__css:m})}),S5=Oe((e,t)=>{var n;const{value:r,min:o=0,max:s=100,hasStripe:i,isAnimated:l,children:u,borderRadius:p,isIndeterminate:m,"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,title:y,role:b,...C}=ar(e),S=Kr("Progress",e),j=p??((n=S.track)==null?void 0:n.borderRadius),_={animation:`${JW} 1s linear infinite`},M={...!m&&i&&l&&_,...m&&{position:"absolute",willChange:"left",minWidth:"50%",animation:`${YW} 1s ease infinite normal none running`}},O={overflow:"hidden",position:"relative",...S.track};return a.jsx(Ee.div,{ref:t,borderRadius:j,__css:O,...C,children:a.jsxs(ZW,{value:S,children:[a.jsx(tV,{"aria-label":h,"aria-labelledby":g,"aria-valuetext":x,min:o,max:s,value:r,isIndeterminate:m,css:M,borderRadius:j,title:y,role:b}),u]})})});S5.displayName="Progress";function nV(e){return e&&T1(e)&&T1(e.target)}function rV(e={}){const{onChange:t,value:n,defaultValue:r,name:o,isDisabled:s,isFocusable:i,isNative:l,...u}=e,[p,m]=d.useState(r||""),h=typeof n<"u",g=h?n:p,x=d.useRef(null),y=d.useCallback(()=>{const I=x.current;if(!I)return;let M="input:not(:disabled):checked";const O=I.querySelector(M);if(O){O.focus();return}M="input:not(:disabled)";const A=I.querySelector(M);A==null||A.focus()},[]),C=`radio-${d.useId()}`,S=o||C,j=d.useCallback(I=>{const M=nV(I)?I.target.value:I;h||m(M),t==null||t(String(M))},[t,h]),_=d.useCallback((I={},M=null)=>({...I,ref:gn(M,x),role:"radiogroup"}),[]),P=d.useCallback((I={},M=null)=>({...I,ref:M,name:S,[l?"checked":"isChecked"]:g!=null?I.value===g:void 0,onChange(A){j(A)},"data-radiogroup":!0}),[l,S,j,g]);return{getRootProps:_,getRadioProps:P,name:S,ref:x,focus:y,setValue:m,value:g,onChange:j,isDisabled:s,isFocusable:i,htmlProps:u}}var[oV,k5]=Bn({name:"RadioGroupContext",strict:!1}),Xm=Oe((e,t)=>{const{colorScheme:n,size:r,variant:o,children:s,className:i,isDisabled:l,isFocusable:u,...p}=e,{value:m,onChange:h,getRootProps:g,name:x,htmlProps:y}=rV(p),b=d.useMemo(()=>({name:x,size:r,onChange:h,colorScheme:n,value:m,variant:o,isDisabled:l,isFocusable:u}),[x,r,h,n,m,o,l,u]);return a.jsx(oV,{value:b,children:a.jsx(Ee.div,{...g(y,t),className:_t("chakra-radio-group",i),children:s})})});Xm.displayName="RadioGroup";var sV={border:"0",clip:"rect(0, 0, 0, 0)",height:"1px",width:"1px",margin:"-1px",padding:"0",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"};function aV(e={}){const{defaultChecked:t,isChecked:n,isFocusable:r,isDisabled:o,isReadOnly:s,isRequired:i,onChange:l,isInvalid:u,name:p,value:m,id:h,"data-radiogroup":g,"aria-describedby":x,...y}=e,b=`radio-${d.useId()}`,C=Sf(),j=!!k5()||!!g;let P=!!C&&!j?C.id:b;P=h??P;const I=o??(C==null?void 0:C.isDisabled),M=s??(C==null?void 0:C.isReadOnly),O=i??(C==null?void 0:C.isRequired),A=u??(C==null?void 0:C.isInvalid),[D,R]=d.useState(!1),[N,Y]=d.useState(!1),[F,V]=d.useState(!1),[Q,q]=d.useState(!1),[z,G]=d.useState(!!t),T=typeof n<"u",B=T?n:z;d.useEffect(()=>WP(R),[]);const X=d.useCallback(fe=>{if(M||I){fe.preventDefault();return}T||G(fe.target.checked),l==null||l(fe)},[T,I,M,l]),re=d.useCallback(fe=>{fe.key===" "&&q(!0)},[q]),le=d.useCallback(fe=>{fe.key===" "&&q(!1)},[q]),se=d.useCallback((fe={},ge=null)=>({...fe,ref:ge,"data-active":qt(Q),"data-hover":qt(F),"data-disabled":qt(I),"data-invalid":qt(A),"data-checked":qt(B),"data-focus":qt(N),"data-focus-visible":qt(N&&D),"data-readonly":qt(M),"aria-hidden":!0,onMouseDown:rt(fe.onMouseDown,()=>q(!0)),onMouseUp:rt(fe.onMouseUp,()=>q(!1)),onMouseEnter:rt(fe.onMouseEnter,()=>V(!0)),onMouseLeave:rt(fe.onMouseLeave,()=>V(!1))}),[Q,F,I,A,B,N,M,D]),{onFocus:K,onBlur:U}=C??{},ee=d.useCallback((fe={},ge=null)=>{const _e=I&&!r;return{...fe,id:P,ref:ge,type:"radio",name:p,value:m,onChange:rt(fe.onChange,X),onBlur:rt(U,fe.onBlur,()=>Y(!1)),onFocus:rt(K,fe.onFocus,()=>Y(!0)),onKeyDown:rt(fe.onKeyDown,re),onKeyUp:rt(fe.onKeyUp,le),checked:B,disabled:_e,readOnly:M,required:O,"aria-invalid":_s(A),"aria-disabled":_s(_e),"aria-required":_s(O),"data-readonly":qt(M),"aria-describedby":x,style:sV}},[I,r,P,p,m,X,U,K,re,le,B,M,O,A,x]);return{state:{isInvalid:A,isFocused:N,isChecked:B,isActive:Q,isHovered:F,isDisabled:I,isReadOnly:M,isRequired:O},getCheckboxProps:se,getRadioProps:se,getInputProps:ee,getLabelProps:(fe={},ge=null)=>({...fe,ref:ge,onMouseDown:rt(fe.onMouseDown,iV),"data-disabled":qt(I),"data-checked":qt(B),"data-invalid":qt(A)}),getRootProps:(fe,ge=null)=>({...fe,ref:ge,"data-disabled":qt(I),"data-checked":qt(B),"data-invalid":qt(A)}),htmlProps:y}}function iV(e){e.preventDefault(),e.stopPropagation()}function lV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var Za=Oe((e,t)=>{var n;const r=k5(),{onChange:o,value:s}=e,i=Kr("Radio",{...r,...e}),l=ar(e),{spacing:u="0.5rem",children:p,isDisabled:m=r==null?void 0:r.isDisabled,isFocusable:h=r==null?void 0:r.isFocusable,inputProps:g,...x}=l;let y=e.isChecked;(r==null?void 0:r.value)!=null&&s!=null&&(y=r.value===s);let b=o;r!=null&&r.onChange&&s!=null&&(b=eg(r.onChange,o));const C=(n=e==null?void 0:e.name)!=null?n:r==null?void 0:r.name,{getInputProps:S,getCheckboxProps:j,getLabelProps:_,getRootProps:P,htmlProps:I}=aV({...x,isChecked:y,isFocusable:h,isDisabled:m,onChange:b,name:C}),[M,O]=lV(I,kI),A=j(O),D=S(g,t),R=_(),N=Object.assign({},M,P()),Y={display:"inline-flex",alignItems:"center",verticalAlign:"top",cursor:"pointer",position:"relative",...i.container},F={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0,...i.control},V={userSelect:"none",marginStart:u,...i.label};return a.jsxs(Ee.label,{className:"chakra-radio",...N,__css:Y,children:[a.jsx("input",{className:"chakra-radio__input",...D}),a.jsx(Ee.span,{className:"chakra-radio__control",...A,__css:F}),p&&a.jsx(Ee.span,{className:"chakra-radio__label",...R,__css:V,children:p})]})});Za.displayName="Radio";var j5=Oe(function(t,n){const{children:r,placeholder:o,className:s,...i}=t;return a.jsxs(Ee.select,{...i,ref:n,className:_t("chakra-select",s),children:[o&&a.jsx("option",{value:"",children:o}),r]})});j5.displayName="SelectField";function cV(e,t){const n={},r={};for(const[o,s]of Object.entries(e))t.includes(o)?n[o]=s:r[o]=s;return[n,r]}var _5=Oe((e,t)=>{var n;const r=Kr("Select",e),{rootProps:o,placeholder:s,icon:i,color:l,height:u,h:p,minH:m,minHeight:h,iconColor:g,iconSize:x,...y}=ar(e),[b,C]=cV(y,kI),S=Vb(C),j={width:"100%",height:"fit-content",position:"relative",color:l},_={paddingEnd:"2rem",...r.field,_focus:{zIndex:"unset",...(n=r.field)==null?void 0:n._focus}};return a.jsxs(Ee.div,{className:"chakra-select__wrapper",__css:j,...b,...o,children:[a.jsx(j5,{ref:t,height:p??u,minH:m??h,placeholder:s,...S,__css:_,children:e.children}),a.jsx(I5,{"data-disabled":qt(S.disabled),...(g||l)&&{color:g||l},__css:r.icon,...x&&{fontSize:x},children:i})]})});_5.displayName="Select";var uV=e=>a.jsx("svg",{viewBox:"0 0 24 24",...e,children:a.jsx("path",{fill:"currentColor",d:"M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"})}),dV=Ee("div",{baseStyle:{position:"absolute",display:"inline-flex",alignItems:"center",justifyContent:"center",pointerEvents:"none",top:"50%",transform:"translateY(-50%)"}}),I5=e=>{const{children:t=a.jsx(uV,{}),...n}=e,r=d.cloneElement(t,{role:"presentation",className:"chakra-select__icon",focusable:!1,"aria-hidden":!0,style:{width:"1em",height:"1em",color:"currentColor"}});return a.jsx(dV,{...n,className:"chakra-select__icon-wrapper",children:d.isValidElement(t)?r:null})};I5.displayName="SelectIcon";function fV(){const e=d.useRef(!0);return d.useEffect(()=>{e.current=!1},[]),e.current}function pV(e){const t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var mV=Ee("div",{baseStyle:{boxShadow:"none",backgroundClip:"padding-box",cursor:"default",color:"transparent",pointerEvents:"none",userSelect:"none","&::before, &::after, *":{visibility:"hidden"}}}),hx=jI("skeleton-start-color"),gx=jI("skeleton-end-color"),hV=bi({from:{opacity:0},to:{opacity:1}}),gV=bi({from:{borderColor:hx.reference,background:hx.reference},to:{borderColor:gx.reference,background:gx.reference}}),Og=Oe((e,t)=>{const n={...e,fadeDuration:typeof e.fadeDuration=="number"?e.fadeDuration:.4,speed:typeof e.speed=="number"?e.speed:.8},r=il("Skeleton",n),o=fV(),{startColor:s="",endColor:i="",isLoaded:l,fadeDuration:u,speed:p,className:m,fitContent:h,...g}=ar(n),[x,y]=Ks("colors",[s,i]),b=pV(l),C=_t("chakra-skeleton",m),S={...x&&{[hx.variable]:x},...y&&{[gx.variable]:y}};if(l){const j=o||b?"none":`${hV} ${u}s`;return a.jsx(Ee.div,{ref:t,className:C,__css:{animation:j},...g})}return a.jsx(mV,{ref:t,className:C,...g,__css:{width:h?"fit-content":void 0,...r,...S,_dark:{...r._dark,...S},animation:`${p}s linear infinite alternate ${gV}`}})});Og.displayName="Skeleton";var bs=e=>e?"":void 0,ou=e=>e?!0:void 0,cl=(...e)=>e.filter(Boolean).join(" ");function su(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function vV(e){return{root:`slider-root-${e}`,getThumb:t=>`slider-thumb-${e}-${t}`,getInput:t=>`slider-input-${e}-${t}`,track:`slider-track-${e}`,innerTrack:`slider-filled-track-${e}`,getMarker:t=>`slider-marker-${e}-${t}`,output:`slider-output-${e}`}}function _d(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}var wm={width:0,height:0},Bp=e=>e||wm;function P5(e){const{orientation:t,thumbPercents:n,thumbRects:r,isReversed:o}=e,s=b=>{var C;const S=(C=r[b])!=null?C:wm;return{position:"absolute",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none",touchAction:"none",..._d({orientation:t,vertical:{bottom:`calc(${n[b]}% - ${S.height/2}px)`},horizontal:{left:`calc(${n[b]}% - ${S.width/2}px)`}})}},i=t==="vertical"?r.reduce((b,C)=>Bp(b).height>Bp(C).height?b:C,wm):r.reduce((b,C)=>Bp(b).width>Bp(C).width?b:C,wm),l={position:"relative",touchAction:"none",WebkitTapHighlightColor:"rgba(0,0,0,0)",userSelect:"none",outline:0,..._d({orientation:t,vertical:i?{paddingLeft:i.width/2,paddingRight:i.width/2}:{},horizontal:i?{paddingTop:i.height/2,paddingBottom:i.height/2}:{}})},u={position:"absolute",..._d({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",height:"100%"},horizontal:{top:"50%",transform:"translateY(-50%)",width:"100%"}})},p=n.length===1,m=[0,o?100-n[0]:n[0]],h=p?m:n;let g=h[0];!p&&o&&(g=100-g);const x=Math.abs(h[h.length-1]-h[0]),y={...u,..._d({orientation:t,vertical:o?{height:`${x}%`,top:`${g}%`}:{height:`${x}%`,bottom:`${g}%`},horizontal:o?{width:`${x}%`,right:`${g}%`}:{width:`${x}%`,left:`${g}%`}})};return{trackStyle:u,innerTrackStyle:y,rootStyle:l,getThumbStyle:s}}function E5(e){const{isReversed:t,direction:n,orientation:r}=e;return n==="ltr"||r==="vertical"?t:!t}function xV(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}function bV(e){const t=CV(e);return typeof t.PointerEvent<"u"&&e instanceof t.PointerEvent?e.pointerType==="mouse":e instanceof t.MouseEvent}function M5(e){return!!e.touches}function yV(e){return M5(e)&&e.touches.length>1}function CV(e){var t;return(t=e.view)!=null?t:window}function wV(e,t="page"){const n=e.touches[0]||e.changedTouches[0];return{x:n[`${t}X`],y:n[`${t}Y`]}}function SV(e,t="page"){return{x:e[`${t}X`],y:e[`${t}Y`]}}function O5(e,t="page"){return M5(e)?wV(e,t):SV(e,t)}function kV(e){return t=>{const n=bV(t);(!n||n&&t.button===0)&&e(t)}}function jV(e,t=!1){function n(o){e(o,{point:O5(o)})}return t?kV(n):n}function Sm(e,t,n,r){return xV(e,t,jV(n,t==="pointerdown"),r)}var _V=Object.defineProperty,IV=(e,t,n)=>t in e?_V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ws=(e,t,n)=>(IV(e,typeof t!="symbol"?t+"":t,n),n),PV=class{constructor(e,t,n){Ws(this,"history",[]),Ws(this,"startEvent",null),Ws(this,"lastEvent",null),Ws(this,"lastEventInfo",null),Ws(this,"handlers",{}),Ws(this,"removeListeners",()=>{}),Ws(this,"threshold",3),Ws(this,"win"),Ws(this,"updatePoint",()=>{if(!(this.lastEvent&&this.lastEventInfo))return;const l=Gv(this.lastEventInfo,this.history),u=this.startEvent!==null,p=RV(l.offset,{x:0,y:0})>=this.threshold;if(!u&&!p)return;const{timestamp:m}=yS();this.history.push({...l.point,timestamp:m});const{onStart:h,onMove:g}=this.handlers;u||(h==null||h(this.lastEvent,l),this.startEvent=this.lastEvent),g==null||g(this.lastEvent,l)}),Ws(this,"onPointerMove",(l,u)=>{this.lastEvent=l,this.lastEventInfo=u,J$.update(this.updatePoint,!0)}),Ws(this,"onPointerUp",(l,u)=>{const p=Gv(u,this.history),{onEnd:m,onSessionEnd:h}=this.handlers;h==null||h(l,p),this.end(),!(!m||!this.startEvent)&&(m==null||m(l,p))});var r;if(this.win=(r=e.view)!=null?r:window,yV(e))return;this.handlers=t,n&&(this.threshold=n),e.stopPropagation(),e.preventDefault();const o={point:O5(e)},{timestamp:s}=yS();this.history=[{...o.point,timestamp:s}];const{onSessionStart:i}=t;i==null||i(e,Gv(o,this.history)),this.removeListeners=OV(Sm(this.win,"pointermove",this.onPointerMove),Sm(this.win,"pointerup",this.onPointerUp),Sm(this.win,"pointercancel",this.onPointerUp))}updateHandlers(e){this.handlers=e}end(){var e;(e=this.removeListeners)==null||e.call(this),Z$.update(this.updatePoint)}};function s4(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Gv(e,t){return{point:e.point,delta:s4(e.point,t[t.length-1]),offset:s4(e.point,t[0]),velocity:MV(t,.1)}}var EV=e=>e*1e3;function MV(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const o=e[e.length-1];for(;n>=0&&(r=e[n],!(o.timestamp-r.timestamp>EV(t)));)n--;if(!r)return{x:0,y:0};const s=(o.timestamp-r.timestamp)/1e3;if(s===0)return{x:0,y:0};const i={x:(o.x-r.x)/s,y:(o.y-r.y)/s};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function OV(...e){return t=>e.reduce((n,r)=>r(n),t)}function qv(e,t){return Math.abs(e-t)}function a4(e){return"x"in e&&"y"in e}function RV(e,t){if(typeof e=="number"&&typeof t=="number")return qv(e,t);if(a4(e)&&a4(t)){const n=qv(e.x,t.x),r=qv(e.y,t.y);return Math.sqrt(n**2+r**2)}return 0}function R5(e){const t=d.useRef(null);return t.current=e,t}function A5(e,t){const{onPan:n,onPanStart:r,onPanEnd:o,onPanSessionStart:s,onPanSessionEnd:i,threshold:l}=t,u=!!(n||r||o||s||i),p=d.useRef(null),m=R5({onSessionStart:s,onSessionEnd:i,onStart:r,onMove:n,onEnd(h,g){p.current=null,o==null||o(h,g)}});d.useEffect(()=>{var h;(h=p.current)==null||h.updateHandlers(m.current)}),d.useEffect(()=>{const h=e.current;if(!h||!u)return;function g(x){p.current=new PV(x,m.current,l)}return Sm(h,"pointerdown",g)},[e,u,m,l]),d.useEffect(()=>()=>{var h;(h=p.current)==null||h.end(),p.current=null},[])}function AV(e,t){if(!e){t(void 0);return}t({width:e.offsetWidth,height:e.offsetHeight});const n=e.ownerDocument.defaultView??window,r=new n.ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const[s]=o;let i,l;if("borderBoxSize"in s){const u=s.borderBoxSize,p=Array.isArray(u)?u[0]:u;i=p.inlineSize,l=p.blockSize}else i=e.offsetWidth,l=e.offsetHeight;t({width:i,height:l})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}var DV=globalThis!=null&&globalThis.document?d.useLayoutEffect:d.useEffect;function TV(e,t){var n,r;if(!e||!e.parentElement)return;const o=(r=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?r:window,s=new o.MutationObserver(()=>{t()});return s.observe(e.parentElement,{childList:!0}),()=>{s.disconnect()}}function D5({getNodes:e,observeMutation:t=!0}){const[n,r]=d.useState([]),[o,s]=d.useState(0);return DV(()=>{const i=e(),l=i.map((u,p)=>AV(u,m=>{r(h=>[...h.slice(0,p),m,...h.slice(p+1)])}));if(t){const u=i[0];l.push(TV(u,()=>{s(p=>p+1)}))}return()=>{l.forEach(u=>{u==null||u()})}},[o]),n}function NV(e){return typeof e=="object"&&e!==null&&"current"in e}function $V(e){const[t]=D5({observeMutation:!1,getNodes(){return[NV(e)?e.current:e]}});return t}function LV(e){const{min:t=0,max:n=100,onChange:r,value:o,defaultValue:s,isReversed:i,direction:l="ltr",orientation:u="horizontal",id:p,isDisabled:m,isReadOnly:h,onChangeStart:g,onChangeEnd:x,step:y=1,getAriaValueText:b,"aria-valuetext":C,"aria-label":S,"aria-labelledby":j,name:_,focusThumbOnChange:P=!0,minStepsBetweenThumbs:I=0,...M}=e,O=pr(g),A=pr(x),D=pr(b),R=E5({isReversed:i,direction:l,orientation:u}),[N,Y]=Cf({value:o,defaultValue:s??[25,75],onChange:r});if(!Array.isArray(N))throw new TypeError(`[range-slider] You passed an invalid value for \`value\` or \`defaultValue\`, expected \`Array\` but got \`${typeof N}\``);const[F,V]=d.useState(!1),[Q,q]=d.useState(!1),[z,G]=d.useState(-1),T=!(m||h),B=d.useRef(N),X=N.map(Me=>eu(Me,t,n)),re=I*y,le=zV(X,t,n,re),se=d.useRef({eventSource:null,value:[],valueBounds:[]});se.current.value=X,se.current.valueBounds=le;const K=X.map(Me=>n-Me+t),ee=(R?K:X).map(Me=>Um(Me,t,n)),de=u==="vertical",Z=d.useRef(null),ue=d.useRef(null),fe=D5({getNodes(){const Me=ue.current,Ze=Me==null?void 0:Me.querySelectorAll("[role=slider]");return Ze?Array.from(Ze):[]}}),ge=d.useId(),ye=vV(p??ge),pe=d.useCallback(Me=>{var Ze,Ye;if(!Z.current)return;se.current.eventSource="pointer";const dt=Z.current.getBoundingClientRect(),{clientX:Vt,clientY:xr}=(Ye=(Ze=Me.touches)==null?void 0:Ze[0])!=null?Ye:Me,yn=de?dt.bottom-xr:Vt-dt.left,mn=de?dt.height:dt.width;let oo=yn/mn;return R&&(oo=1-oo),UP(oo,t,n)},[de,R,n,t]),Te=(n-t)/10,Ae=y||(n-t)/100,qe=d.useMemo(()=>({setValueAtIndex(Me,Ze){if(!T)return;const Ye=se.current.valueBounds[Me];Ze=parseFloat(tx(Ze,Ye.min,Ae)),Ze=eu(Ze,Ye.min,Ye.max);const dt=[...se.current.value];dt[Me]=Ze,Y(dt)},setActiveIndex:G,stepUp(Me,Ze=Ae){const Ye=se.current.value[Me],dt=R?Ye-Ze:Ye+Ze;qe.setValueAtIndex(Me,dt)},stepDown(Me,Ze=Ae){const Ye=se.current.value[Me],dt=R?Ye+Ze:Ye-Ze;qe.setValueAtIndex(Me,dt)},reset(){Y(B.current)}}),[Ae,R,Y,T]),Pt=d.useCallback(Me=>{const Ze=Me.key,dt={ArrowRight:()=>qe.stepUp(z),ArrowUp:()=>qe.stepUp(z),ArrowLeft:()=>qe.stepDown(z),ArrowDown:()=>qe.stepDown(z),PageUp:()=>qe.stepUp(z,Te),PageDown:()=>qe.stepDown(z,Te),Home:()=>{const{min:Vt}=le[z];qe.setValueAtIndex(z,Vt)},End:()=>{const{max:Vt}=le[z];qe.setValueAtIndex(z,Vt)}}[Ze];dt&&(Me.preventDefault(),Me.stopPropagation(),dt(Me),se.current.eventSource="keyboard")},[qe,z,Te,le]),{getThumbStyle:tt,rootStyle:sn,trackStyle:mt,innerTrackStyle:ct}=d.useMemo(()=>P5({isReversed:R,orientation:u,thumbRects:fe,thumbPercents:ee}),[R,u,ee,fe]),be=d.useCallback(Me=>{var Ze;const Ye=Me??z;if(Ye!==-1&&P){const dt=ye.getThumb(Ye),Vt=(Ze=ue.current)==null?void 0:Ze.ownerDocument.getElementById(dt);Vt&&setTimeout(()=>Vt.focus())}},[P,z,ye]);xi(()=>{se.current.eventSource==="keyboard"&&(A==null||A(se.current.value))},[X,A]);const We=Me=>{const Ze=pe(Me)||0,Ye=se.current.value.map(mn=>Math.abs(mn-Ze)),dt=Math.min(...Ye);let Vt=Ye.indexOf(dt);const xr=Ye.filter(mn=>mn===dt);xr.length>1&&Ze>se.current.value[Vt]&&(Vt=Vt+xr.length-1),G(Vt),qe.setValueAtIndex(Vt,Ze),be(Vt)},Rt=Me=>{if(z==-1)return;const Ze=pe(Me)||0;G(z),qe.setValueAtIndex(z,Ze),be(z)};A5(ue,{onPanSessionStart(Me){T&&(V(!0),We(Me),O==null||O(se.current.value))},onPanSessionEnd(){T&&(V(!1),A==null||A(se.current.value))},onPan(Me){T&&Rt(Me)}});const Ut=d.useCallback((Me={},Ze=null)=>({...Me,...M,id:ye.root,ref:gn(Ze,ue),tabIndex:-1,"aria-disabled":ou(m),"data-focused":bs(Q),style:{...Me.style,...sn}}),[M,m,Q,sn,ye]),ke=d.useCallback((Me={},Ze=null)=>({...Me,ref:gn(Ze,Z),id:ye.track,"data-disabled":bs(m),style:{...Me.style,...mt}}),[m,mt,ye]),Ct=d.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ye.innerTrack,style:{...Me.style,...ct}}),[ct,ye]),Ft=d.useCallback((Me,Ze=null)=>{var Ye;const{index:dt,...Vt}=Me,xr=X[dt];if(xr==null)throw new TypeError(`[range-slider > thumb] Cannot find value at index \`${dt}\`. The \`value\` or \`defaultValue\` length is : ${X.length}`);const yn=le[dt];return{...Vt,ref:Ze,role:"slider",tabIndex:T?0:void 0,id:ye.getThumb(dt),"data-active":bs(F&&z===dt),"aria-valuetext":(Ye=D==null?void 0:D(xr))!=null?Ye:C==null?void 0:C[dt],"aria-valuemin":yn.min,"aria-valuemax":yn.max,"aria-valuenow":xr,"aria-orientation":u,"aria-disabled":ou(m),"aria-readonly":ou(h),"aria-label":S==null?void 0:S[dt],"aria-labelledby":S!=null&&S[dt]||j==null?void 0:j[dt],style:{...Me.style,...tt(dt)},onKeyDown:su(Me.onKeyDown,Pt),onFocus:su(Me.onFocus,()=>{q(!0),G(dt)}),onBlur:su(Me.onBlur,()=>{q(!1),G(-1)})}},[ye,X,le,T,F,z,D,C,u,m,h,S,j,tt,Pt,q]),Wt=d.useCallback((Me={},Ze=null)=>({...Me,ref:Ze,id:ye.output,htmlFor:X.map((Ye,dt)=>ye.getThumb(dt)).join(" "),"aria-live":"off"}),[ye,X]),Le=d.useCallback((Me,Ze=null)=>{const{value:Ye,...dt}=Me,Vt=!(Yen),xr=Ye>=X[0]&&Ye<=X[X.length-1];let yn=Um(Ye,t,n);yn=R?100-yn:yn;const mn={position:"absolute",pointerEvents:"none",..._d({orientation:u,vertical:{bottom:`${yn}%`},horizontal:{left:`${yn}%`}})};return{...dt,ref:Ze,id:ye.getMarker(Me.value),role:"presentation","aria-hidden":!0,"data-disabled":bs(m),"data-invalid":bs(!Vt),"data-highlighted":bs(xr),style:{...Me.style,...mn}}},[m,R,n,t,u,X,ye]),Xe=d.useCallback((Me,Ze=null)=>{const{index:Ye,...dt}=Me;return{...dt,ref:Ze,id:ye.getInput(Ye),type:"hidden",value:X[Ye],name:Array.isArray(_)?_[Ye]:`${_}-${Ye}`}},[_,X,ye]);return{state:{value:X,isFocused:Q,isDragging:F,getThumbPercent:Me=>ee[Me],getThumbMinValue:Me=>le[Me].min,getThumbMaxValue:Me=>le[Me].max},actions:qe,getRootProps:Ut,getTrackProps:ke,getInnerTrackProps:Ct,getThumbProps:Ft,getMarkerProps:Le,getInputProps:Xe,getOutputProps:Wt}}function zV(e,t,n,r){return e.map((o,s)=>{const i=s===0?t:e[s-1]+r,l=s===e.length-1?n:e[s+1]-r;return{min:i,max:l}})}var[FV,Rg]=Bn({name:"SliderContext",errorMessage:"useSliderContext: `context` is undefined. Seems you forgot to wrap all slider components within "}),[BV,Ag]=Bn({name:"RangeSliderStylesContext",errorMessage:`useRangeSliderStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),T5=Oe(function(t,n){const r={orientation:"horizontal",...t},o=Kr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getRootProps:l,...u}=LV(s),p=d.useMemo(()=>({...u,name:r.name}),[u,r.name]);return a.jsx(FV,{value:p,children:a.jsx(BV,{value:o,children:a.jsx(Ee.div,{...l({},n),className:"chakra-slider",__css:o.container,children:r.children})})})});T5.displayName="RangeSlider";var vx=Oe(function(t,n){const{getThumbProps:r,getInputProps:o,name:s}=Rg(),i=Ag(),l=r(t,n);return a.jsxs(Ee.div,{...l,className:cl("chakra-slider__thumb",t.className),__css:i.thumb,children:[l.children,s&&a.jsx("input",{...o({index:t.index})})]})});vx.displayName="RangeSliderThumb";var N5=Oe(function(t,n){const{getTrackProps:r}=Rg(),o=Ag(),s=r(t,n);return a.jsx(Ee.div,{...s,className:cl("chakra-slider__track",t.className),__css:o.track,"data-testid":"chakra-range-slider-track"})});N5.displayName="RangeSliderTrack";var $5=Oe(function(t,n){const{getInnerTrackProps:r}=Rg(),o=Ag(),s=r(t,n);return a.jsx(Ee.div,{...s,className:"chakra-slider__filled-track",__css:o.filledTrack})});$5.displayName="RangeSliderFilledTrack";var km=Oe(function(t,n){const{getMarkerProps:r}=Rg(),o=Ag(),s=r(t,n);return a.jsx(Ee.div,{...s,className:cl("chakra-slider__marker",t.className),__css:o.mark})});km.displayName="RangeSliderMark";function HV(e){var t;const{min:n=0,max:r=100,onChange:o,value:s,defaultValue:i,isReversed:l,direction:u="ltr",orientation:p="horizontal",id:m,isDisabled:h,isReadOnly:g,onChangeStart:x,onChangeEnd:y,step:b=1,getAriaValueText:C,"aria-valuetext":S,"aria-label":j,"aria-labelledby":_,name:P,focusThumbOnChange:I=!0,...M}=e,O=pr(x),A=pr(y),D=pr(C),R=E5({isReversed:l,direction:u,orientation:p}),[N,Y]=Cf({value:s,defaultValue:i??VV(n,r),onChange:o}),[F,V]=d.useState(!1),[Q,q]=d.useState(!1),z=!(h||g),G=(r-n)/10,T=b||(r-n)/100,B=eu(N,n,r),X=r-B+n,le=Um(R?X:B,n,r),se=p==="vertical",K=R5({min:n,max:r,step:b,isDisabled:h,value:B,isInteractive:z,isReversed:R,isVertical:se,eventSource:null,focusThumbOnChange:I,orientation:p}),U=d.useRef(null),ee=d.useRef(null),de=d.useRef(null),Z=d.useId(),ue=m??Z,[fe,ge]=[`slider-thumb-${ue}`,`slider-track-${ue}`],_e=d.useCallback(Le=>{var Xe,_n;if(!U.current)return;const Me=K.current;Me.eventSource="pointer";const Ze=U.current.getBoundingClientRect(),{clientX:Ye,clientY:dt}=(_n=(Xe=Le.touches)==null?void 0:Xe[0])!=null?_n:Le,Vt=se?Ze.bottom-dt:Ye-Ze.left,xr=se?Ze.height:Ze.width;let yn=Vt/xr;R&&(yn=1-yn);let mn=UP(yn,Me.min,Me.max);return Me.step&&(mn=parseFloat(tx(mn,Me.min,Me.step))),mn=eu(mn,Me.min,Me.max),mn},[se,R,K]),ye=d.useCallback(Le=>{const Xe=K.current;Xe.isInteractive&&(Le=parseFloat(tx(Le,Xe.min,T)),Le=eu(Le,Xe.min,Xe.max),Y(Le))},[T,Y,K]),pe=d.useMemo(()=>({stepUp(Le=T){const Xe=R?B-Le:B+Le;ye(Xe)},stepDown(Le=T){const Xe=R?B+Le:B-Le;ye(Xe)},reset(){ye(i||0)},stepTo(Le){ye(Le)}}),[ye,R,B,T,i]),Te=d.useCallback(Le=>{const Xe=K.current,Me={ArrowRight:()=>pe.stepUp(),ArrowUp:()=>pe.stepUp(),ArrowLeft:()=>pe.stepDown(),ArrowDown:()=>pe.stepDown(),PageUp:()=>pe.stepUp(G),PageDown:()=>pe.stepDown(G),Home:()=>ye(Xe.min),End:()=>ye(Xe.max)}[Le.key];Me&&(Le.preventDefault(),Le.stopPropagation(),Me(Le),Xe.eventSource="keyboard")},[pe,ye,G,K]),Ae=(t=D==null?void 0:D(B))!=null?t:S,qe=$V(ee),{getThumbStyle:Pt,rootStyle:tt,trackStyle:sn,innerTrackStyle:mt}=d.useMemo(()=>{const Le=K.current,Xe=qe??{width:0,height:0};return P5({isReversed:R,orientation:Le.orientation,thumbRects:[Xe],thumbPercents:[le]})},[R,qe,le,K]),ct=d.useCallback(()=>{K.current.focusThumbOnChange&&setTimeout(()=>{var Xe;return(Xe=ee.current)==null?void 0:Xe.focus()})},[K]);xi(()=>{const Le=K.current;ct(),Le.eventSource==="keyboard"&&(A==null||A(Le.value))},[B,A]);function be(Le){const Xe=_e(Le);Xe!=null&&Xe!==K.current.value&&Y(Xe)}A5(de,{onPanSessionStart(Le){const Xe=K.current;Xe.isInteractive&&(V(!0),ct(),be(Le),O==null||O(Xe.value))},onPanSessionEnd(){const Le=K.current;Le.isInteractive&&(V(!1),A==null||A(Le.value))},onPan(Le){K.current.isInteractive&&be(Le)}});const We=d.useCallback((Le={},Xe=null)=>({...Le,...M,ref:gn(Xe,de),tabIndex:-1,"aria-disabled":ou(h),"data-focused":bs(Q),style:{...Le.style,...tt}}),[M,h,Q,tt]),Rt=d.useCallback((Le={},Xe=null)=>({...Le,ref:gn(Xe,U),id:ge,"data-disabled":bs(h),style:{...Le.style,...sn}}),[h,ge,sn]),Ut=d.useCallback((Le={},Xe=null)=>({...Le,ref:Xe,style:{...Le.style,...mt}}),[mt]),ke=d.useCallback((Le={},Xe=null)=>({...Le,ref:gn(Xe,ee),role:"slider",tabIndex:z?0:void 0,id:fe,"data-active":bs(F),"aria-valuetext":Ae,"aria-valuemin":n,"aria-valuemax":r,"aria-valuenow":B,"aria-orientation":p,"aria-disabled":ou(h),"aria-readonly":ou(g),"aria-label":j,"aria-labelledby":j?void 0:_,style:{...Le.style,...Pt(0)},onKeyDown:su(Le.onKeyDown,Te),onFocus:su(Le.onFocus,()=>q(!0)),onBlur:su(Le.onBlur,()=>q(!1))}),[z,fe,F,Ae,n,r,B,p,h,g,j,_,Pt,Te]),Ct=d.useCallback((Le,Xe=null)=>{const _n=!(Le.valuer),Me=B>=Le.value,Ze=Um(Le.value,n,r),Ye={position:"absolute",pointerEvents:"none",...WV({orientation:p,vertical:{bottom:R?`${100-Ze}%`:`${Ze}%`},horizontal:{left:R?`${100-Ze}%`:`${Ze}%`}})};return{...Le,ref:Xe,role:"presentation","aria-hidden":!0,"data-disabled":bs(h),"data-invalid":bs(!_n),"data-highlighted":bs(Me),style:{...Le.style,...Ye}}},[h,R,r,n,p,B]),Ft=d.useCallback((Le={},Xe=null)=>({...Le,ref:Xe,type:"hidden",value:B,name:P}),[P,B]);return{state:{value:B,isFocused:Q,isDragging:F},actions:pe,getRootProps:We,getTrackProps:Rt,getInnerTrackProps:Ut,getThumbProps:ke,getMarkerProps:Ct,getInputProps:Ft}}function WV(e){const{orientation:t,vertical:n,horizontal:r}=e;return t==="vertical"?n:r}function VV(e,t){return t"}),[GV,Tg]=Bn({name:"SliderStylesContext",hookName:"useSliderStyles",providerName:""}),Cy=Oe((e,t)=>{var n;const r={...e,orientation:(n=e==null?void 0:e.orientation)!=null?n:"horizontal"},o=Kr("Slider",r),s=ar(r),{direction:i}=mf();s.direction=i;const{getInputProps:l,getRootProps:u,...p}=HV(s),m=u(),h=l({},t);return a.jsx(UV,{value:p,children:a.jsx(GV,{value:o,children:a.jsxs(Ee.div,{...m,className:cl("chakra-slider",r.className),__css:o.container,children:[r.children,a.jsx("input",{...h})]})})})});Cy.displayName="Slider";var wy=Oe((e,t)=>{const{getThumbProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__thumb",e.className),__css:r.thumb})});wy.displayName="SliderThumb";var Sy=Oe((e,t)=>{const{getTrackProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__track",e.className),__css:r.track})});Sy.displayName="SliderTrack";var ky=Oe((e,t)=>{const{getInnerTrackProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__filled-track",e.className),__css:r.filledTrack})});ky.displayName="SliderFilledTrack";var zc=Oe((e,t)=>{const{getMarkerProps:n}=Dg(),r=Tg(),o=n(e,t);return a.jsx(Ee.div,{...o,className:cl("chakra-slider__marker",e.className),__css:r.mark})});zc.displayName="SliderMark";var[qV,L5]=Bn({name:"StatStylesContext",errorMessage:`useStatStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),z5=Oe(function(t,n){const r=Kr("Stat",t),o={position:"relative",flex:"1 1 0%",...r.container},{className:s,children:i,...l}=ar(t);return a.jsx(qV,{value:r,children:a.jsx(Ee.div,{ref:n,...l,className:_t("chakra-stat",s),__css:o,children:a.jsx("dl",{children:i})})})});z5.displayName="Stat";var F5=Oe(function(t,n){return a.jsx(Ee.div,{...t,ref:n,role:"group",className:_t("chakra-stat__group",t.className),__css:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",alignItems:"flex-start"}})});F5.displayName="StatGroup";var B5=Oe(function(t,n){const r=L5();return a.jsx(Ee.dt,{ref:n,...t,className:_t("chakra-stat__label",t.className),__css:r.label})});B5.displayName="StatLabel";var H5=Oe(function(t,n){const r=L5();return a.jsx(Ee.dd,{ref:n,...t,className:_t("chakra-stat__number",t.className),__css:{...r.number,fontFeatureSettings:"pnum",fontVariantNumeric:"proportional-nums"}})});H5.displayName="StatNumber";var jy=Oe(function(t,n){const r=Kr("Switch",t),{spacing:o="0.5rem",children:s,...i}=ar(t),{getIndicatorProps:l,getInputProps:u,getCheckboxProps:p,getRootProps:m,getLabelProps:h}=VP(i),g=d.useMemo(()=>({display:"inline-block",position:"relative",verticalAlign:"middle",lineHeight:0,...r.container}),[r.container]),x=d.useMemo(()=>({display:"inline-flex",flexShrink:0,justifyContent:"flex-start",boxSizing:"content-box",cursor:"pointer",...r.track}),[r.track]),y=d.useMemo(()=>({userSelect:"none",marginStart:o,...r.label}),[o,r.label]);return a.jsxs(Ee.label,{...m(),className:_t("chakra-switch",t.className),__css:g,children:[a.jsx("input",{className:"chakra-switch__input",...u({},n)}),a.jsx(Ee.span,{...p(),className:"chakra-switch__track",__css:x,children:a.jsx(Ee.span,{__css:r.thumb,className:"chakra-switch__thumb",...l()})}),s&&a.jsx(Ee.span,{className:"chakra-switch__label",...h(),__css:y,children:s})]})});jy.displayName="Switch";var[KV,QV,XV,YV]=Bb();function JV(e){var t;const{defaultIndex:n,onChange:r,index:o,isManual:s,isLazy:i,lazyBehavior:l="unmount",orientation:u="horizontal",direction:p="ltr",...m}=e,[h,g]=d.useState(n??0),[x,y]=Cf({defaultValue:n??0,value:o,onChange:r});d.useEffect(()=>{o!=null&&g(o)},[o]);const b=XV(),C=d.useId();return{id:`tabs-${(t=e.id)!=null?t:C}`,selectedIndex:x,focusedIndex:h,setSelectedIndex:y,setFocusedIndex:g,isManual:s,isLazy:i,lazyBehavior:l,orientation:u,descendants:b,direction:p,htmlProps:m}}var[ZV,Ng]=Bn({name:"TabsContext",errorMessage:"useTabsContext: `context` is undefined. Seems you forgot to wrap all tabs components within "});function eU(e){const{focusedIndex:t,orientation:n,direction:r}=Ng(),o=QV(),s=d.useCallback(i=>{const l=()=>{var j;const _=o.nextEnabled(t);_&&((j=_.node)==null||j.focus())},u=()=>{var j;const _=o.prevEnabled(t);_&&((j=_.node)==null||j.focus())},p=()=>{var j;const _=o.firstEnabled();_&&((j=_.node)==null||j.focus())},m=()=>{var j;const _=o.lastEnabled();_&&((j=_.node)==null||j.focus())},h=n==="horizontal",g=n==="vertical",x=i.key,y=r==="ltr"?"ArrowLeft":"ArrowRight",b=r==="ltr"?"ArrowRight":"ArrowLeft",S={[y]:()=>h&&u(),[b]:()=>h&&l(),ArrowDown:()=>g&&l(),ArrowUp:()=>g&&u(),Home:p,End:m}[x];S&&(i.preventDefault(),S(i))},[o,t,n,r]);return{...e,role:"tablist","aria-orientation":n,onKeyDown:rt(e.onKeyDown,s)}}function tU(e){const{isDisabled:t=!1,isFocusable:n=!1,...r}=e,{setSelectedIndex:o,isManual:s,id:i,setFocusedIndex:l,selectedIndex:u}=Ng(),{index:p,register:m}=YV({disabled:t&&!n}),h=p===u,g=()=>{o(p)},x=()=>{l(p),!s&&!(t&&n)&&o(p)},y=U3({...r,ref:gn(m,e.ref),isDisabled:t,isFocusable:n,onClick:rt(e.onClick,g)}),b="button";return{...y,id:W5(i,p),role:"tab",tabIndex:h?0:-1,type:b,"aria-selected":h,"aria-controls":V5(i,p),onFocus:t?void 0:rt(e.onFocus,x)}}var[nU,rU]=Bn({});function oU(e){const t=Ng(),{id:n,selectedIndex:r}=t,s=ug(e.children).map((i,l)=>d.createElement(nU,{key:l,value:{isSelected:l===r,id:V5(n,l),tabId:W5(n,l),selectedIndex:r}},i));return{...e,children:s}}function sU(e){const{children:t,...n}=e,{isLazy:r,lazyBehavior:o}=Ng(),{isSelected:s,id:i,tabId:l}=rU(),u=d.useRef(!1);s&&(u.current=!0);const p=by({wasSelected:u.current,isSelected:s,enabled:r,mode:o});return{tabIndex:0,...n,children:p?t:null,role:"tabpanel","aria-labelledby":l,hidden:!s,id:i}}function W5(e,t){return`${e}--tab-${t}`}function V5(e,t){return`${e}--tabpanel-${t}`}var[aU,$g]=Bn({name:"TabsStylesContext",errorMessage:`useTabsStyles returned is 'undefined'. Seems you forgot to wrap the components in "" `}),nc=Oe(function(t,n){const r=Kr("Tabs",t),{children:o,className:s,...i}=ar(t),{htmlProps:l,descendants:u,...p}=JV(i),m=d.useMemo(()=>p,[p]),{isFitted:h,...g}=l;return a.jsx(KV,{value:u,children:a.jsx(ZV,{value:m,children:a.jsx(aU,{value:r,children:a.jsx(Ee.div,{className:_t("chakra-tabs",s),ref:n,...g,__css:r.root,children:o})})})})});nc.displayName="Tabs";var rc=Oe(function(t,n){const r=eU({...t,ref:n}),s={display:"flex",...$g().tablist};return a.jsx(Ee.div,{...r,className:_t("chakra-tabs__tablist",t.className),__css:s})});rc.displayName="TabList";var ss=Oe(function(t,n){const r=sU({...t,ref:n}),o=$g();return a.jsx(Ee.div,{outline:"0",...r,className:_t("chakra-tabs__tab-panel",t.className),__css:o.tabpanel})});ss.displayName="TabPanel";var Tu=Oe(function(t,n){const r=oU(t),o=$g();return a.jsx(Ee.div,{...r,width:"100%",ref:n,className:_t("chakra-tabs__tab-panels",t.className),__css:o.tabpanels})});Tu.displayName="TabPanels";var Po=Oe(function(t,n){const r=$g(),o=tU({...t,ref:n}),s={outline:"0",display:"flex",alignItems:"center",justifyContent:"center",...r.tab};return a.jsx(Ee.button,{...o,className:_t("chakra-tabs__tab",t.className),__css:s})});Po.displayName="Tab";function iU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var lU=["h","minH","height","minHeight"],U5=Oe((e,t)=>{const n=il("Textarea",e),{className:r,rows:o,...s}=ar(e),i=Vb(s),l=o?iU(n,lU):n;return a.jsx(Ee.textarea,{ref:t,rows:o,...i,className:_t("chakra-textarea",r),__css:l})});U5.displayName="Textarea";var cU={exit:{scale:.85,opacity:0,transition:{opacity:{duration:.15,easings:"easeInOut"},scale:{duration:.2,easings:"easeInOut"}}},enter:{scale:1,opacity:1,transition:{opacity:{easings:"easeOut",duration:.2},scale:{duration:.2,ease:[.175,.885,.4,1.1]}}}},xx=e=>{var t;return((t=e.current)==null?void 0:t.ownerDocument)||document},jm=e=>{var t,n;return((n=(t=e.current)==null?void 0:t.ownerDocument)==null?void 0:n.defaultView)||window};function uU(e={}){const{openDelay:t=0,closeDelay:n=0,closeOnClick:r=!0,closeOnMouseDown:o,closeOnScroll:s,closeOnPointerDown:i=o,closeOnEsc:l=!0,onOpen:u,onClose:p,placement:m,id:h,isOpen:g,defaultIsOpen:x,arrowSize:y=10,arrowShadowColor:b,arrowPadding:C,modifiers:S,isDisabled:j,gutter:_,offset:P,direction:I,...M}=e,{isOpen:O,onOpen:A,onClose:D}=xy({isOpen:g,defaultIsOpen:x,onOpen:u,onClose:p}),{referenceRef:R,getPopperProps:N,getArrowInnerProps:Y,getArrowProps:F}=vy({enabled:O,placement:m,arrowPadding:C,modifiers:S,gutter:_,offset:P,direction:I}),V=d.useId(),q=`tooltip-${h??V}`,z=d.useRef(null),G=d.useRef(),T=d.useCallback(()=>{G.current&&(clearTimeout(G.current),G.current=void 0)},[]),B=d.useRef(),X=d.useCallback(()=>{B.current&&(clearTimeout(B.current),B.current=void 0)},[]),re=d.useCallback(()=>{X(),D()},[D,X]),le=dU(z,re),se=d.useCallback(()=>{if(!j&&!G.current){O&&le();const ge=jm(z);G.current=ge.setTimeout(A,t)}},[le,j,O,A,t]),K=d.useCallback(()=>{T();const ge=jm(z);B.current=ge.setTimeout(re,n)},[n,re,T]),U=d.useCallback(()=>{O&&r&&K()},[r,K,O]),ee=d.useCallback(()=>{O&&i&&K()},[i,K,O]),de=d.useCallback(ge=>{O&&ge.key==="Escape"&&K()},[O,K]);Dl(()=>xx(z),"keydown",l?de:void 0),Dl(()=>{const ge=z.current;if(!ge)return null;const _e=R3(ge);return _e.localName==="body"?jm(z):_e},"scroll",()=>{O&&s&&re()},{passive:!0,capture:!0}),d.useEffect(()=>{j&&(T(),O&&D())},[j,O,D,T]),d.useEffect(()=>()=>{T(),X()},[T,X]),Dl(()=>z.current,"pointerleave",K);const Z=d.useCallback((ge={},_e=null)=>({...ge,ref:gn(z,_e,R),onPointerEnter:rt(ge.onPointerEnter,pe=>{pe.pointerType!=="touch"&&se()}),onClick:rt(ge.onClick,U),onPointerDown:rt(ge.onPointerDown,ee),onFocus:rt(ge.onFocus,se),onBlur:rt(ge.onBlur,K),"aria-describedby":O?q:void 0}),[se,K,ee,O,q,U,R]),ue=d.useCallback((ge={},_e=null)=>N({...ge,style:{...ge.style,[zr.arrowSize.var]:y?`${y}px`:void 0,[zr.arrowShadowColor.var]:b}},_e),[N,y,b]),fe=d.useCallback((ge={},_e=null)=>{const ye={...ge.style,position:"relative",transformOrigin:zr.transformOrigin.varRef};return{ref:_e,...M,...ge,id:q,role:"tooltip",style:ye}},[M,q]);return{isOpen:O,show:se,hide:K,getTriggerProps:Z,getTooltipProps:fe,getTooltipPositionerProps:ue,getArrowProps:F,getArrowInnerProps:Y}}var Kv="chakra-ui:close-tooltip";function dU(e,t){return d.useEffect(()=>{const n=xx(e);return n.addEventListener(Kv,t),()=>n.removeEventListener(Kv,t)},[t,e]),()=>{const n=xx(e),r=jm(e);n.dispatchEvent(new r.CustomEvent(Kv))}}function fU(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function pU(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}var mU=Ee(Mr.div),Fn=Oe((e,t)=>{var n,r;const o=il("Tooltip",e),s=ar(e),i=mf(),{children:l,label:u,shouldWrapChildren:p,"aria-label":m,hasArrow:h,bg:g,portalProps:x,background:y,backgroundColor:b,bgColor:C,motionProps:S,...j}=s,_=(r=(n=y??b)!=null?n:g)!=null?r:C;if(_){o.bg=_;const N=dD(i,"colors",_);o[zr.arrowBg.var]=N}const P=uU({...j,direction:i.direction}),I=typeof l=="string"||p;let M;if(I)M=a.jsx(Ee.span,{display:"inline-block",tabIndex:0,...P.getTriggerProps(),children:l});else{const N=d.Children.only(l);M=d.cloneElement(N,P.getTriggerProps(N.props,N.ref))}const O=!!m,A=P.getTooltipProps({},t),D=O?fU(A,["role","id"]):A,R=pU(A,["role","id"]);return u?a.jsxs(a.Fragment,{children:[M,a.jsx(yo,{children:P.isOpen&&a.jsx(Eu,{...x,children:a.jsx(Ee.div,{...P.getTooltipPositionerProps(),__css:{zIndex:o.zIndex,pointerEvents:"none"},children:a.jsxs(mU,{variants:cU,initial:"exit",animate:"enter",exit:"exit",...S,...D,__css:o,children:[u,O&&a.jsx(Ee.span,{srOnly:!0,...R,children:m}),h&&a.jsx(Ee.div,{"data-popper-arrow":!0,className:"chakra-tooltip__arrow-wrapper",children:a.jsx(Ee.div,{"data-popper-arrow-inner":!0,className:"chakra-tooltip__arrow",__css:{bg:o.bg}})})]})})})})]}):a.jsx(a.Fragment,{children:l})});Fn.displayName="Tooltip";function Lg(e,t={}){let n=d.useCallback(o=>t.keys?P$(e,t.keys,o):e.listen(o),[t.keys,e]),r=e.get.bind(e);return d.useSyncExternalStore(n,r,r)}const hU=ce(we,({system:e})=>{const{consoleLogLevel:t,shouldLogToConsole:n}=e;return{consoleLogLevel:t,shouldLogToConsole:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),G5=e=>{const{consoleLogLevel:t,shouldLogToConsole:n}=W(hU);return d.useEffect(()=>{n?(localStorage.setItem("ROARR_LOG","true"),localStorage.setItem("ROARR_FILTER",`context.logLevel:>=${fD[t]}`)):localStorage.setItem("ROARR_LOG","false"),Iw.ROARR.write=pD.createLogWriter()},[t,n]),d.useEffect(()=>{const o={...mD};hD.set(Iw.Roarr.child(o))},[]),d.useMemo(()=>yi(e),[e])},gU=()=>{const e=te(),t=W(r=>r.system.toastQueue),n=DP();return d.useEffect(()=>{t.forEach(r=>{n(r)}),t.length>0&&e(gD())},[e,n,t]),null},oc=()=>{const e=te();return d.useCallback(n=>e($t(Gn(n))),[e])},vU=d.memo(gU);var xU=new Map([["aac","audio/aac"],["abw","application/x-abiword"],["arc","application/x-freearc"],["avif","image/avif"],["avi","video/x-msvideo"],["azw","application/vnd.amazon.ebook"],["bin","application/octet-stream"],["bmp","image/bmp"],["bz","application/x-bzip"],["bz2","application/x-bzip2"],["cda","application/x-cdf"],["csh","application/x-csh"],["css","text/css"],["csv","text/csv"],["doc","application/msword"],["docx","application/vnd.openxmlformats-officedocument.wordprocessingml.document"],["eot","application/vnd.ms-fontobject"],["epub","application/epub+zip"],["gz","application/gzip"],["gif","image/gif"],["heic","image/heic"],["heif","image/heif"],["htm","text/html"],["html","text/html"],["ico","image/vnd.microsoft.icon"],["ics","text/calendar"],["jar","application/java-archive"],["jpeg","image/jpeg"],["jpg","image/jpeg"],["js","text/javascript"],["json","application/json"],["jsonld","application/ld+json"],["mid","audio/midi"],["midi","audio/midi"],["mjs","text/javascript"],["mp3","audio/mpeg"],["mp4","video/mp4"],["mpeg","video/mpeg"],["mpkg","application/vnd.apple.installer+xml"],["odp","application/vnd.oasis.opendocument.presentation"],["ods","application/vnd.oasis.opendocument.spreadsheet"],["odt","application/vnd.oasis.opendocument.text"],["oga","audio/ogg"],["ogv","video/ogg"],["ogx","application/ogg"],["opus","audio/opus"],["otf","font/otf"],["png","image/png"],["pdf","application/pdf"],["php","application/x-httpd-php"],["ppt","application/vnd.ms-powerpoint"],["pptx","application/vnd.openxmlformats-officedocument.presentationml.presentation"],["rar","application/vnd.rar"],["rtf","application/rtf"],["sh","application/x-sh"],["svg","image/svg+xml"],["swf","application/x-shockwave-flash"],["tar","application/x-tar"],["tif","image/tiff"],["tiff","image/tiff"],["ts","video/mp2t"],["ttf","font/ttf"],["txt","text/plain"],["vsd","application/vnd.visio"],["wav","audio/wav"],["weba","audio/webm"],["webm","video/webm"],["webp","image/webp"],["woff","font/woff"],["woff2","font/woff2"],["xhtml","application/xhtml+xml"],["xls","application/vnd.ms-excel"],["xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"],["xml","application/xml"],["xul","application/vnd.mozilla.xul+xml"],["zip","application/zip"],["7z","application/x-7z-compressed"],["mkv","video/x-matroska"],["mov","video/quicktime"],["msg","application/vnd.ms-outlook"]]);function Tf(e,t){var n=bU(e);if(typeof n.path!="string"){var r=e.webkitRelativePath;Object.defineProperty(n,"path",{value:typeof t=="string"?t:typeof r=="string"&&r.length>0?r:e.name,writable:!1,configurable:!1,enumerable:!0})}return n}function bU(e){var t=e.name,n=t&&t.lastIndexOf(".")!==-1;if(n&&!e.type){var r=t.split(".").pop().toLowerCase(),o=xU.get(r);o&&Object.defineProperty(e,"type",{value:o,writable:!1,configurable:!1,enumerable:!0})}return e}var yU=[".DS_Store","Thumbs.db"];function CU(e){return Ou(this,void 0,void 0,function(){return Ru(this,function(t){return Ym(e)&&wU(e.dataTransfer)?[2,_U(e.dataTransfer,e.type)]:SU(e)?[2,kU(e)]:Array.isArray(e)&&e.every(function(n){return"getFile"in n&&typeof n.getFile=="function"})?[2,jU(e)]:[2,[]]})})}function wU(e){return Ym(e)}function SU(e){return Ym(e)&&Ym(e.target)}function Ym(e){return typeof e=="object"&&e!==null}function kU(e){return bx(e.target.files).map(function(t){return Tf(t)})}function jU(e){return Ou(this,void 0,void 0,function(){var t;return Ru(this,function(n){switch(n.label){case 0:return[4,Promise.all(e.map(function(r){return r.getFile()}))];case 1:return t=n.sent(),[2,t.map(function(r){return Tf(r)})]}})})}function _U(e,t){return Ou(this,void 0,void 0,function(){var n,r;return Ru(this,function(o){switch(o.label){case 0:return e.items?(n=bx(e.items).filter(function(s){return s.kind==="file"}),t!=="drop"?[2,n]:[4,Promise.all(n.map(IU))]):[3,2];case 1:return r=o.sent(),[2,i4(q5(r))];case 2:return[2,i4(bx(e.files).map(function(s){return Tf(s)}))]}})})}function i4(e){return e.filter(function(t){return yU.indexOf(t.name)===-1})}function bx(e){if(e===null)return[];for(var t=[],n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);nn)return[!1,f4(n)];if(e.sizen)return[!1,f4(n)]}return[!0,null]}function Pl(e){return e!=null}function WU(e){var t=e.files,n=e.accept,r=e.minSize,o=e.maxSize,s=e.multiple,i=e.maxFiles,l=e.validator;return!s&&t.length>1||s&&i>=1&&t.length>i?!1:t.every(function(u){var p=Y5(u,n),m=Yd(p,1),h=m[0],g=J5(u,r,o),x=Yd(g,1),y=x[0],b=l?l(u):null;return h&&y&&!b})}function Jm(e){return typeof e.isPropagationStopped=="function"?e.isPropagationStopped():typeof e.cancelBubble<"u"?e.cancelBubble:!1}function Hp(e){return e.dataTransfer?Array.prototype.some.call(e.dataTransfer.types,function(t){return t==="Files"||t==="application/x-moz-file"}):!!e.target&&!!e.target.files}function m4(e){e.preventDefault()}function VU(e){return e.indexOf("MSIE")!==-1||e.indexOf("Trident/")!==-1}function UU(e){return e.indexOf("Edge/")!==-1}function GU(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return VU(e)||UU(e)}function Ca(){for(var e=arguments.length,t=new Array(e),n=0;n1?o-1:0),i=1;ie.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function cG(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s=0)&&(n[o]=e[o]);return n}var _y=d.forwardRef(function(e,t){var n=e.children,r=Zm(e,JU),o=Iy(r),s=o.open,i=Zm(o,ZU);return d.useImperativeHandle(t,function(){return{open:s}},[s]),H.createElement(d.Fragment,null,n(Cr(Cr({},i),{},{open:s})))});_y.displayName="Dropzone";var n6={disabled:!1,getFilesFromEvent:CU,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!0,autoFocus:!1};_y.defaultProps=n6;_y.propTypes={children:Zn.func,accept:Zn.objectOf(Zn.arrayOf(Zn.string)),multiple:Zn.bool,preventDropOnDocument:Zn.bool,noClick:Zn.bool,noKeyboard:Zn.bool,noDrag:Zn.bool,noDragEventsBubbling:Zn.bool,minSize:Zn.number,maxSize:Zn.number,maxFiles:Zn.number,disabled:Zn.bool,getFilesFromEvent:Zn.func,onFileDialogCancel:Zn.func,onFileDialogOpen:Zn.func,useFsAccessApi:Zn.bool,autoFocus:Zn.bool,onDragEnter:Zn.func,onDragLeave:Zn.func,onDragOver:Zn.func,onDrop:Zn.func,onDropAccepted:Zn.func,onDropRejected:Zn.func,onError:Zn.func,validator:Zn.func};var Sx={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function Iy(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=Cr(Cr({},n6),e),n=t.accept,r=t.disabled,o=t.getFilesFromEvent,s=t.maxSize,i=t.minSize,l=t.multiple,u=t.maxFiles,p=t.onDragEnter,m=t.onDragLeave,h=t.onDragOver,g=t.onDrop,x=t.onDropAccepted,y=t.onDropRejected,b=t.onFileDialogCancel,C=t.onFileDialogOpen,S=t.useFsAccessApi,j=t.autoFocus,_=t.preventDropOnDocument,P=t.noClick,I=t.noKeyboard,M=t.noDrag,O=t.noDragEventsBubbling,A=t.onError,D=t.validator,R=d.useMemo(function(){return QU(n)},[n]),N=d.useMemo(function(){return KU(n)},[n]),Y=d.useMemo(function(){return typeof C=="function"?C:g4},[C]),F=d.useMemo(function(){return typeof b=="function"?b:g4},[b]),V=d.useRef(null),Q=d.useRef(null),q=d.useReducer(uG,Sx),z=Qv(q,2),G=z[0],T=z[1],B=G.isFocused,X=G.isFileDialogActive,re=d.useRef(typeof window<"u"&&window.isSecureContext&&S&&qU()),le=function(){!re.current&&X&&setTimeout(function(){if(Q.current){var We=Q.current.files;We.length||(T({type:"closeDialog"}),F())}},300)};d.useEffect(function(){return window.addEventListener("focus",le,!1),function(){window.removeEventListener("focus",le,!1)}},[Q,X,F,re]);var se=d.useRef([]),K=function(We){V.current&&V.current.contains(We.target)||(We.preventDefault(),se.current=[])};d.useEffect(function(){return _&&(document.addEventListener("dragover",m4,!1),document.addEventListener("drop",K,!1)),function(){_&&(document.removeEventListener("dragover",m4),document.removeEventListener("drop",K))}},[V,_]),d.useEffect(function(){return!r&&j&&V.current&&V.current.focus(),function(){}},[V,j,r]);var U=d.useCallback(function(be){A?A(be):console.error(be)},[A]),ee=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be),se.current=[].concat(nG(se.current),[be.target]),Hp(be)&&Promise.resolve(o(be)).then(function(We){if(!(Jm(be)&&!O)){var Rt=We.length,Ut=Rt>0&&WU({files:We,accept:R,minSize:i,maxSize:s,multiple:l,maxFiles:u,validator:D}),ke=Rt>0&&!Ut;T({isDragAccept:Ut,isDragReject:ke,isDragActive:!0,type:"setDraggedFiles"}),p&&p(be)}}).catch(function(We){return U(We)})},[o,p,U,O,R,i,s,l,u,D]),de=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be);var We=Hp(be);if(We&&be.dataTransfer)try{be.dataTransfer.dropEffect="copy"}catch{}return We&&h&&h(be),!1},[h,O]),Z=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be);var We=se.current.filter(function(Ut){return V.current&&V.current.contains(Ut)}),Rt=We.indexOf(be.target);Rt!==-1&&We.splice(Rt,1),se.current=We,!(We.length>0)&&(T({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Hp(be)&&m&&m(be))},[V,m,O]),ue=d.useCallback(function(be,We){var Rt=[],Ut=[];be.forEach(function(ke){var Ct=Y5(ke,R),Ft=Qv(Ct,2),Wt=Ft[0],Le=Ft[1],Xe=J5(ke,i,s),_n=Qv(Xe,2),Me=_n[0],Ze=_n[1],Ye=D?D(ke):null;if(Wt&&Me&&!Ye)Rt.push(ke);else{var dt=[Le,Ze];Ye&&(dt=dt.concat(Ye)),Ut.push({file:ke,errors:dt.filter(function(Vt){return Vt})})}}),(!l&&Rt.length>1||l&&u>=1&&Rt.length>u)&&(Rt.forEach(function(ke){Ut.push({file:ke,errors:[HU]})}),Rt.splice(0)),T({acceptedFiles:Rt,fileRejections:Ut,type:"setFiles"}),g&&g(Rt,Ut,We),Ut.length>0&&y&&y(Ut,We),Rt.length>0&&x&&x(Rt,We)},[T,l,R,i,s,u,g,x,y,D]),fe=d.useCallback(function(be){be.preventDefault(),be.persist(),tt(be),se.current=[],Hp(be)&&Promise.resolve(o(be)).then(function(We){Jm(be)&&!O||ue(We,be)}).catch(function(We){return U(We)}),T({type:"reset"})},[o,ue,U,O]),ge=d.useCallback(function(){if(re.current){T({type:"openDialog"}),Y();var be={multiple:l,types:N};window.showOpenFilePicker(be).then(function(We){return o(We)}).then(function(We){ue(We,null),T({type:"closeDialog"})}).catch(function(We){XU(We)?(F(We),T({type:"closeDialog"})):YU(We)?(re.current=!1,Q.current?(Q.current.value=null,Q.current.click()):U(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no was provided."))):U(We)});return}Q.current&&(T({type:"openDialog"}),Y(),Q.current.value=null,Q.current.click())},[T,Y,F,S,ue,U,N,l]),_e=d.useCallback(function(be){!V.current||!V.current.isEqualNode(be.target)||(be.key===" "||be.key==="Enter"||be.keyCode===32||be.keyCode===13)&&(be.preventDefault(),ge())},[V,ge]),ye=d.useCallback(function(){T({type:"focus"})},[]),pe=d.useCallback(function(){T({type:"blur"})},[]),Te=d.useCallback(function(){P||(GU()?setTimeout(ge,0):ge())},[P,ge]),Ae=function(We){return r?null:We},qe=function(We){return I?null:Ae(We)},Pt=function(We){return M?null:Ae(We)},tt=function(We){O&&We.stopPropagation()},sn=d.useMemo(function(){return function(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},We=be.refKey,Rt=We===void 0?"ref":We,Ut=be.role,ke=be.onKeyDown,Ct=be.onFocus,Ft=be.onBlur,Wt=be.onClick,Le=be.onDragEnter,Xe=be.onDragOver,_n=be.onDragLeave,Me=be.onDrop,Ze=Zm(be,eG);return Cr(Cr(wx({onKeyDown:qe(Ca(ke,_e)),onFocus:qe(Ca(Ct,ye)),onBlur:qe(Ca(Ft,pe)),onClick:Ae(Ca(Wt,Te)),onDragEnter:Pt(Ca(Le,ee)),onDragOver:Pt(Ca(Xe,de)),onDragLeave:Pt(Ca(_n,Z)),onDrop:Pt(Ca(Me,fe)),role:typeof Ut=="string"&&Ut!==""?Ut:"presentation"},Rt,V),!r&&!I?{tabIndex:0}:{}),Ze)}},[V,_e,ye,pe,Te,ee,de,Z,fe,I,M,r]),mt=d.useCallback(function(be){be.stopPropagation()},[]),ct=d.useMemo(function(){return function(){var be=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},We=be.refKey,Rt=We===void 0?"ref":We,Ut=be.onChange,ke=be.onClick,Ct=Zm(be,tG),Ft=wx({accept:R,multiple:l,type:"file",style:{display:"none"},onChange:Ae(Ca(Ut,fe)),onClick:Ae(Ca(ke,mt)),tabIndex:-1},Rt,Q);return Cr(Cr({},Ft),Ct)}},[Q,n,l,fe,r]);return Cr(Cr({},G),{},{isFocused:B&&!r,getRootProps:sn,getInputProps:ct,rootRef:V,inputRef:Q,open:Ae(ge)})}function uG(e,t){switch(t.type){case"focus":return Cr(Cr({},e),{},{isFocused:!0});case"blur":return Cr(Cr({},e),{},{isFocused:!1});case"openDialog":return Cr(Cr({},Sx),{},{isFileDialogActive:!0});case"closeDialog":return Cr(Cr({},e),{},{isFileDialogActive:!1});case"setDraggedFiles":return Cr(Cr({},e),{},{isDragActive:t.isDragActive,isDragAccept:t.isDragAccept,isDragReject:t.isDragReject});case"setFiles":return Cr(Cr({},e),{},{acceptedFiles:t.acceptedFiles,fileRejections:t.fileRejections});case"reset":return Cr({},Sx);default:return e}}function g4(){}function kx(){return kx=Object.assign?Object.assign.bind():function(e){for(var t=1;t'),!0):t?e.some(function(n){return t.includes(n)})||e.includes("*"):!0}var vG=function(t,n,r){r===void 0&&(r=!1);var o=n.alt,s=n.meta,i=n.mod,l=n.shift,u=n.ctrl,p=n.keys,m=t.key,h=t.code,g=t.ctrlKey,x=t.metaKey,y=t.shiftKey,b=t.altKey,C=Vi(h),S=m.toLowerCase();if(!r){if(o===!b&&S!=="alt"||l===!y&&S!=="shift")return!1;if(i){if(!x&&!g)return!1}else if(s===!x&&S!=="meta"&&S!=="os"||u===!g&&S!=="ctrl"&&S!=="control")return!1}return p&&p.length===1&&(p.includes(S)||p.includes(C))?!0:p?_m(p):!p},xG=d.createContext(void 0),bG=function(){return d.useContext(xG)};function i6(e,t){return e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(e).length===Object.keys(t).length&&Object.keys(e).reduce(function(n,r){return n&&i6(e[r],t[r])},!0):e===t}var yG=d.createContext({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),CG=function(){return d.useContext(yG)};function wG(e){var t=d.useRef(void 0);return i6(t.current,e)||(t.current=e),t.current}var v4=function(t){t.stopPropagation(),t.preventDefault(),t.stopImmediatePropagation()},SG=typeof window<"u"?d.useLayoutEffect:d.useEffect;function It(e,t,n,r){var o=d.useRef(null),s=d.useRef(!1),i=n instanceof Array?r instanceof Array?void 0:r:n,l=Py(e)?e.join(i==null?void 0:i.splitKey):e,u=n instanceof Array?n:r instanceof Array?r:void 0,p=d.useCallback(t,u??[]),m=d.useRef(p);u?m.current=p:m.current=t;var h=wG(i),g=CG(),x=g.enabledScopes,y=bG();return SG(function(){if(!((h==null?void 0:h.enabled)===!1||!gG(x,h==null?void 0:h.scopes))){var b=function(P,I){var M;if(I===void 0&&(I=!1),!(hG(P)&&!a6(P,h==null?void 0:h.enableOnFormTags))&&!(h!=null&&h.ignoreEventWhen!=null&&h.ignoreEventWhen(P))){if(o.current!==null&&document.activeElement!==o.current&&!o.current.contains(document.activeElement)){v4(P);return}(M=P.target)!=null&&M.isContentEditable&&!(h!=null&&h.enableOnContentEditable)||Xv(l,h==null?void 0:h.splitKey).forEach(function(O){var A,D=Yv(O,h==null?void 0:h.combinationKey);if(vG(P,D,h==null?void 0:h.ignoreModifiers)||(A=D.keys)!=null&&A.includes("*")){if(I&&s.current)return;if(pG(P,D,h==null?void 0:h.preventDefault),!mG(P,D,h==null?void 0:h.enabled)){v4(P);return}m.current(P,D),I||(s.current=!0)}})}},C=function(P){P.key!==void 0&&(o6(Vi(P.code)),((h==null?void 0:h.keydown)===void 0&&(h==null?void 0:h.keyup)!==!0||h!=null&&h.keydown)&&b(P))},S=function(P){P.key!==void 0&&(s6(Vi(P.code)),s.current=!1,h!=null&&h.keyup&&b(P,!0))},j=o.current||(i==null?void 0:i.document)||document;return j.addEventListener("keyup",S),j.addEventListener("keydown",C),y&&Xv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.addHotkey(Yv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))}),function(){j.removeEventListener("keyup",S),j.removeEventListener("keydown",C),y&&Xv(l,h==null?void 0:h.splitKey).forEach(function(_){return y.removeHotkey(Yv(_,h==null?void 0:h.combinationKey,h==null?void 0:h.description))})}}},[l,h,x]),o}const kG=e=>{const{isDragAccept:t,isDragReject:n,setIsHandlingUpload:r}=e;return It("esc",()=>{r(!1)}),a.jsxs(De,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"100vw",height:"100vh",zIndex:999,backdropFilter:"blur(20px)"},children:[a.jsx($,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:"base.700",_dark:{bg:"base.900"},opacity:.7,alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx($,{sx:{position:"absolute",top:0,insetInlineStart:0,width:"full",height:"full",alignItems:"center",justifyContent:"center",p:4},children:a.jsx($,{sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",flexDir:"column",gap:4,borderWidth:3,borderRadius:"xl",borderStyle:"dashed",color:"base.100",borderColor:"base.100",_dark:{borderColor:"base.200"}},children:t?a.jsx(xo,{size:"lg",children:"Drop to Upload"}):a.jsxs(a.Fragment,{children:[a.jsx(xo,{size:"lg",children:"Invalid Upload"}),a.jsx(xo,{size:"md",children:"Must be single JPEG or PNG image"})]})})})]})},jG=d.memo(kG),_G=ce([we,ro],({gallery:e},t)=>{let n={type:"TOAST"};t==="unifiedCanvas"&&(n={type:"SET_CANVAS_INITIAL_IMAGE"}),t==="img2img"&&(n={type:"SET_INITIAL_IMAGE"});const{autoAddBoardId:r}=e;return{autoAddBoardId:r,postUploadAction:n}},je),IG=e=>{const{children:t}=e,{autoAddBoardId:n,postUploadAction:r}=W(_G),o=oc(),{t:s}=J(),[i,l]=d.useState(!1),[u]=_I(),p=d.useCallback(_=>{l(!0),o({title:s("toast.uploadFailed"),description:_.errors.map(P=>P.message).join(` +`),status:"error"})},[s,o]),m=d.useCallback(async _=>{u({file:_,image_category:"user",is_intermediate:!1,postUploadAction:r,board_id:n==="none"?void 0:n})},[n,r,u]),h=d.useCallback((_,P)=>{if(P.length>1){o({title:s("toast.uploadFailed"),description:s("toast.uploadFailedInvalidUploadDesc"),status:"error"});return}P.forEach(I=>{p(I)}),_.forEach(I=>{m(I)})},[s,o,m,p]),g=d.useCallback(()=>{l(!0)},[]),{getRootProps:x,getInputProps:y,isDragAccept:b,isDragReject:C,isDragActive:S,inputRef:j}=Iy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},noClick:!0,onDrop:h,onDragOver:g,multiple:!1});return d.useEffect(()=>{const _=async P=>{var I,M;j.current&&(I=P.clipboardData)!=null&&I.files&&(j.current.files=P.clipboardData.files,(M=j.current)==null||M.dispatchEvent(new Event("change",{bubbles:!0})))};return document.addEventListener("paste",_),()=>{document.removeEventListener("paste",_)}},[j]),a.jsxs(De,{...x({style:{}}),onKeyDown:_=>{_.key},children:[a.jsx("input",{...y()}),t,a.jsx(yo,{children:S&&i&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(jG,{isDragAccept:b,isDragReject:C,setIsHandlingUpload:l})},"image-upload-overlay")})]})},PG=d.memo(IG),EG=Oe((e,t)=>{const{children:n,tooltip:r="",tooltipProps:{placement:o="top",hasArrow:s=!0,...i}={},isChecked:l,...u}=e;return a.jsx(Fn,{label:r,placement:o,hasArrow:s,...i,children:a.jsx(el,{ref:t,colorScheme:l?"accent":"base",...u,children:n})})}),Mt=d.memo(EG);function MG(e){const t=d.createContext(null);return[({children:o,value:s})=>H.createElement(t.Provider,{value:s},o),()=>{const o=d.useContext(t);if(o===null)throw new Error(e);return o}]}function l6(e){return Array.isArray(e)?e:[e]}const OG=()=>{};function RG(e,t={active:!0}){return typeof e!="function"||!t.active?t.onKeyDown||OG:n=>{var r;n.key==="Escape"&&(e(n),(r=t.onTrigger)==null||r.call(t))}}function c6({data:e}){const t=[],n=[],r=e.reduce((o,s,i)=>(s.group?o[s.group]?o[s.group].push(i):o[s.group]=[i]:n.push(i),o),{});return Object.keys(r).forEach(o=>{t.push(...r[o].map(s=>e[s]))}),t.push(...n.map(o=>e[o])),t}function u6(e){return Array.isArray(e)||e===null?!1:typeof e=="object"?e.type!==H.Fragment:!1}function d6(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;tr===t[o]).indexOf(!1)>=0)&&(n.current={v:e(),prevDeps:[...t]}),n.current.v}const TG=vD({key:"mantine",prepend:!0});function NG(){return _P()||TG}var $G=Object.defineProperty,x4=Object.getOwnPropertySymbols,LG=Object.prototype.hasOwnProperty,zG=Object.prototype.propertyIsEnumerable,b4=(e,t,n)=>t in e?$G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FG=(e,t)=>{for(var n in t||(t={}))LG.call(t,n)&&b4(e,n,t[n]);if(x4)for(var n of x4(t))zG.call(t,n)&&b4(e,n,t[n]);return e};const Jv="ref";function BG(e){let t;if(e.length!==1)return{args:e,ref:t};const[n]=e;if(!(n instanceof Object))return{args:e,ref:t};if(!(Jv in n))return{args:e,ref:t};t=n[Jv];const r=FG({},n);return delete r[Jv],{args:[r],ref:t}}const{cssFactory:HG}=(()=>{function e(n,r,o){const s=[],i=yD(n,s,o);return s.length<2?o:i+r(s)}function t(n){const{cache:r}=n,o=(...i)=>{const{ref:l,args:u}=BG(i),p=xD(u,r.registered);return bD(r,p,!1),`${r.key}-${p.name}${l===void 0?"":` ${l}`}`};return{css:o,cx:(...i)=>e(r.registered,o,f6(i))}}return{cssFactory:t}})();function p6(){const e=NG();return DG(()=>HG({cache:e}),[e])}function WG({cx:e,classes:t,context:n,classNames:r,name:o,cache:s}){const i=n.reduce((l,u)=>(Object.keys(u.classNames).forEach(p=>{typeof l[p]!="string"?l[p]=`${u.classNames[p]}`:l[p]=`${l[p]} ${u.classNames[p]}`}),l),{});return Object.keys(t).reduce((l,u)=>(l[u]=e(t[u],i[u],r!=null&&r[u],Array.isArray(o)?o.filter(Boolean).map(p=>`${(s==null?void 0:s.key)||"mantine"}-${p}-${u}`).join(" "):o?`${(s==null?void 0:s.key)||"mantine"}-${o}-${u}`:null),l),{})}var VG=Object.defineProperty,y4=Object.getOwnPropertySymbols,UG=Object.prototype.hasOwnProperty,GG=Object.prototype.propertyIsEnumerable,C4=(e,t,n)=>t in e?VG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zv=(e,t)=>{for(var n in t||(t={}))UG.call(t,n)&&C4(e,n,t[n]);if(y4)for(var n of y4(t))GG.call(t,n)&&C4(e,n,t[n]);return e};function jx(e,t){return t&&Object.keys(t).forEach(n=>{e[n]?e[n]=Zv(Zv({},e[n]),t[n]):e[n]=Zv({},t[n])}),e}function w4(e,t,n,r){const o=s=>typeof s=="function"?s(t,n||{},r):s||{};return Array.isArray(e)?e.map(s=>o(s.styles)).reduce((s,i)=>jx(s,i),{}):o(e)}function qG({ctx:e,theme:t,params:n,variant:r,size:o}){return e.reduce((s,i)=>(i.variants&&r in i.variants&&jx(s,i.variants[r](t,n,{variant:r,size:o})),i.sizes&&o in i.sizes&&jx(s,i.sizes[o](t,n,{variant:r,size:o})),s),{})}function Co(e){const t=typeof e=="function"?e:()=>e;function n(r,o){const s=Si(),i=u$(o==null?void 0:o.name),l=_P(),u={variant:o==null?void 0:o.variant,size:o==null?void 0:o.size},{css:p,cx:m}=p6(),h=t(s,r,u),g=w4(o==null?void 0:o.styles,s,r,u),x=w4(i,s,r,u),y=qG({ctx:i,theme:s,params:r,variant:o==null?void 0:o.variant,size:o==null?void 0:o.size}),b=Object.fromEntries(Object.keys(h).map(C=>{const S=m({[p(h[C])]:!(o!=null&&o.unstyled)},p(y[C]),p(x[C]),p(g[C]));return[C,S]}));return{classes:WG({cx:m,classes:b,context:i,classNames:o==null?void 0:o.classNames,name:o==null?void 0:o.name,cache:l}),cx:m,theme:s}}return n}function S4(e){return`___ref-${e||""}`}var KG=Object.defineProperty,QG=Object.defineProperties,XG=Object.getOwnPropertyDescriptors,k4=Object.getOwnPropertySymbols,YG=Object.prototype.hasOwnProperty,JG=Object.prototype.propertyIsEnumerable,j4=(e,t,n)=>t in e?KG(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hd=(e,t)=>{for(var n in t||(t={}))YG.call(t,n)&&j4(e,n,t[n]);if(k4)for(var n of k4(t))JG.call(t,n)&&j4(e,n,t[n]);return e},gd=(e,t)=>QG(e,XG(t));const vd={in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${Ge(10)})`},transitionProperty:"transform, opacity"},Wp={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(-${Ge(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) skew(-10deg, -5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) rotate(-5deg)`},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:`translateY(${Ge(20)}) rotate(5deg)`},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:gd(hd({},vd),{common:{transformOrigin:"center center"}}),"pop-bottom-left":gd(hd({},vd),{common:{transformOrigin:"bottom left"}}),"pop-bottom-right":gd(hd({},vd),{common:{transformOrigin:"bottom right"}}),"pop-top-left":gd(hd({},vd),{common:{transformOrigin:"top left"}}),"pop-top-right":gd(hd({},vd),{common:{transformOrigin:"top right"}})},_4=["mousedown","touchstart"];function ZG(e,t,n){const r=d.useRef();return d.useEffect(()=>{const o=s=>{const{target:i}=s??{};if(Array.isArray(n)){const l=(i==null?void 0:i.hasAttribute("data-ignore-outside-clicks"))||!document.body.contains(i)&&i.tagName!=="HTML";n.every(p=>!!p&&!s.composedPath().includes(p))&&!l&&e()}else r.current&&!r.current.contains(i)&&e()};return(t||_4).forEach(s=>document.addEventListener(s,o)),()=>{(t||_4).forEach(s=>document.removeEventListener(s,o))}},[r,e,n]),r}function eq(e,t){try{return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}catch{return e.addListener(t),()=>e.removeListener(t)}}function tq(e,t){return typeof t=="boolean"?t:typeof window<"u"&&"matchMedia"in window?window.matchMedia(e).matches:!1}function nq(e,t,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,o]=d.useState(n?t:tq(e,t)),s=d.useRef();return d.useEffect(()=>{if("matchMedia"in window)return s.current=window.matchMedia(e),o(s.current.matches),eq(s.current,i=>o(i.matches))},[e]),r}const m6=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Js(e,t){const n=d.useRef(!1);d.useEffect(()=>()=>{n.current=!1},[]),d.useEffect(()=>{if(n.current)return e();n.current=!0},t)}function rq({opened:e,shouldReturnFocus:t=!0}){const n=d.useRef(),r=()=>{var o;n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&((o=n.current)==null||o.focus({preventScroll:!0}))};return Js(()=>{let o=-1;const s=i=>{i.key==="Tab"&&window.clearTimeout(o)};return document.addEventListener("keydown",s),e?n.current=document.activeElement:t&&(o=window.setTimeout(r,10)),()=>{window.clearTimeout(o),document.removeEventListener("keydown",s)}},[e,t]),r}const oq=/input|select|textarea|button|object/,h6="a, input, select, textarea, button, object, [tabindex]";function sq(e){return e.style.display==="none"}function aq(e){if(e.getAttribute("aria-hidden")||e.getAttribute("hidden")||e.getAttribute("type")==="hidden")return!1;let n=e;for(;n&&!(n===document.body||n.nodeType===11);){if(sq(n))return!1;n=n.parentNode}return!0}function g6(e){let t=e.getAttribute("tabindex");return t===null&&(t=void 0),parseInt(t,10)}function _x(e){const t=e.nodeName.toLowerCase(),n=!Number.isNaN(g6(e));return(oq.test(t)&&!e.disabled||e instanceof HTMLAnchorElement&&e.href||n)&&aq(e)}function v6(e){const t=g6(e);return(Number.isNaN(t)||t>=0)&&_x(e)}function iq(e){return Array.from(e.querySelectorAll(h6)).filter(v6)}function lq(e,t){const n=iq(e);if(!n.length){t.preventDefault();return}const r=n[t.shiftKey?0:n.length-1],o=e.getRootNode();if(!(r===o.activeElement||e===o.activeElement))return;t.preventDefault();const i=n[t.shiftKey?n.length-1:0];i&&i.focus()}function My(){return`mantine-${Math.random().toString(36).slice(2,11)}`}function cq(e,t="body > :not(script)"){const n=My(),r=Array.from(document.querySelectorAll(t)).map(o=>{var s;if((s=o==null?void 0:o.shadowRoot)!=null&&s.contains(e)||o.contains(e))return;const i=o.getAttribute("aria-hidden"),l=o.getAttribute("data-hidden"),u=o.getAttribute("data-focus-id");return o.setAttribute("data-focus-id",n),i===null||i==="false"?o.setAttribute("aria-hidden","true"):!l&&!u&&o.setAttribute("data-hidden",i),{node:o,ariaHidden:l||null}});return()=>{r.forEach(o=>{!o||n!==o.node.getAttribute("data-focus-id")||(o.ariaHidden===null?o.node.removeAttribute("aria-hidden"):o.node.setAttribute("aria-hidden",o.ariaHidden),o.node.removeAttribute("data-focus-id"),o.node.removeAttribute("data-hidden"))})}}function uq(e=!0){const t=d.useRef(),n=d.useRef(null),r=s=>{let i=s.querySelector("[data-autofocus]");if(!i){const l=Array.from(s.querySelectorAll(h6));i=l.find(v6)||l.find(_x)||null,!i&&_x(s)&&(i=s)}i&&i.focus({preventScroll:!0})},o=d.useCallback(s=>{if(e){if(s===null){n.current&&(n.current(),n.current=null);return}n.current=cq(s),t.current!==s&&(s?(setTimeout(()=>{s.getRootNode()&&r(s)}),t.current=s):t.current=null)}},[e]);return d.useEffect(()=>{if(!e)return;t.current&&setTimeout(()=>r(t.current));const s=i=>{i.key==="Tab"&&t.current&&lq(t.current,i)};return document.addEventListener("keydown",s),()=>{document.removeEventListener("keydown",s),n.current&&n.current()}},[e]),o}const dq=H["useId".toString()]||(()=>{});function fq(){const e=dq();return e?`mantine-${e.replace(/:/g,"")}`:""}function Oy(e){const t=fq(),[n,r]=d.useState(t);return m6(()=>{r(My())},[]),typeof e=="string"?e:typeof window>"u"?t:n}function I4(e,t,n){d.useEffect(()=>(window.addEventListener(e,t,n),()=>window.removeEventListener(e,t,n)),[e,t])}function x6(e,t){typeof e=="function"?e(t):typeof e=="object"&&e!==null&&"current"in e&&(e.current=t)}function pq(...e){return t=>{e.forEach(n=>x6(n,t))}}function Nf(...e){return d.useCallback(pq(...e),e)}function Jd({value:e,defaultValue:t,finalValue:n,onChange:r=()=>{}}){const[o,s]=d.useState(t!==void 0?t:n),i=l=>{s(l),r==null||r(l)};return e!==void 0?[e,r,!0]:[o,i,!1]}function b6(e,t){return nq("(prefers-reduced-motion: reduce)",e,t)}const mq=e=>e<.5?2*e*e:-1+(4-2*e)*e,hq=({axis:e,target:t,parent:n,alignment:r,offset:o,isList:s})=>{if(!t||!n&&typeof document>"u")return 0;const i=!!n,u=(n||document.body).getBoundingClientRect(),p=t.getBoundingClientRect(),m=h=>p[h]-u[h];if(e==="y"){const h=m("top");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.height*(s?0:1)||!s?x:0}const g=i?u.height:window.innerHeight;if(r==="end"){const x=h+o-g+p.height;return x>=-p.height*(s?0:1)||!s?x:0}return r==="center"?h-g/2+p.height/2:0}if(e==="x"){const h=m("left");if(h===0)return 0;if(r==="start"){const x=h-o;return x<=p.width||!s?x:0}const g=i?u.width:window.innerWidth;if(r==="end"){const x=h+o-g+p.width;return x>=-p.width||!s?x:0}return r==="center"?h-g/2+p.width/2:0}return 0},gq=({axis:e,parent:t})=>{if(!t&&typeof document>"u")return 0;const n=e==="y"?"scrollTop":"scrollLeft";if(t)return t[n];const{body:r,documentElement:o}=document;return r[n]+o[n]},vq=({axis:e,parent:t,distance:n})=>{if(!t&&typeof document>"u")return;const r=e==="y"?"scrollTop":"scrollLeft";if(t)t[r]=n;else{const{body:o,documentElement:s}=document;o[r]=n,s[r]=n}};function y6({duration:e=1250,axis:t="y",onScrollFinish:n,easing:r=mq,offset:o=0,cancelable:s=!0,isList:i=!1}={}){const l=d.useRef(0),u=d.useRef(0),p=d.useRef(!1),m=d.useRef(null),h=d.useRef(null),g=b6(),x=()=>{l.current&&cancelAnimationFrame(l.current)},y=d.useCallback(({alignment:C="start"}={})=>{var S;p.current=!1,l.current&&x();const j=(S=gq({parent:m.current,axis:t}))!=null?S:0,_=hq({parent:m.current,target:h.current,axis:t,alignment:C,offset:o,isList:i})-(m.current?0:j);function P(){u.current===0&&(u.current=performance.now());const M=performance.now()-u.current,O=g||e===0?1:M/e,A=j+_*r(O);vq({parent:m.current,axis:t,distance:A}),!p.current&&O<1?l.current=requestAnimationFrame(P):(typeof n=="function"&&n(),u.current=0,l.current=0,x())}P()},[t,e,r,i,o,n,g]),b=()=>{s&&(p.current=!0)};return I4("wheel",b,{passive:!0}),I4("touchmove",b,{passive:!0}),d.useEffect(()=>x,[]),{scrollableRef:m,targetRef:h,scrollIntoView:y,cancel:x}}var P4=Object.getOwnPropertySymbols,xq=Object.prototype.hasOwnProperty,bq=Object.prototype.propertyIsEnumerable,yq=(e,t)=>{var n={};for(var r in e)xq.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&P4)for(var r of P4(e))t.indexOf(r)<0&&bq.call(e,r)&&(n[r]=e[r]);return n};function zg(e){const t=e,{m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:C,c:S,opacity:j,ff:_,fz:P,fw:I,lts:M,ta:O,lh:A,fs:D,tt:R,td:N,w:Y,miw:F,maw:V,h:Q,mih:q,mah:z,bgsz:G,bgp:T,bgr:B,bga:X,pos:re,top:le,left:se,bottom:K,right:U,inset:ee,display:de}=t,Z=yq(t,["m","mx","my","mt","mb","ml","mr","p","px","py","pt","pb","pl","pr","bg","c","opacity","ff","fz","fw","lts","ta","lh","fs","tt","td","w","miw","maw","h","mih","mah","bgsz","bgp","bgr","bga","pos","top","left","bottom","right","inset","display"]);return{systemStyles:d$({m:n,mx:r,my:o,mt:s,mb:i,ml:l,mr:u,p,px:m,py:h,pt:g,pb:x,pl:y,pr:b,bg:C,c:S,opacity:j,ff:_,fz:P,fw:I,lts:M,ta:O,lh:A,fs:D,tt:R,td:N,w:Y,miw:F,maw:V,h:Q,mih:q,mah:z,bgsz:G,bgp:T,bgr:B,bga:X,pos:re,top:le,left:se,bottom:K,right:U,inset:ee,display:de}),rest:Z}}function Cq(e,t){const n=Object.keys(e).filter(r=>r!=="base").sort((r,o)=>gS(Xt({size:r,sizes:t.breakpoints}))-gS(Xt({size:o,sizes:t.breakpoints})));return"base"in e?["base",...n]:n}function wq({value:e,theme:t,getValue:n,property:r}){if(e==null)return;if(typeof e=="object")return Cq(e,t).reduce((i,l)=>{if(l==="base"&&e.base!==void 0){const p=n(e.base,t);return Array.isArray(r)?(r.forEach(m=>{i[m]=p}),i):(i[r]=p,i)}const u=n(e[l],t);return Array.isArray(r)?(i[t.fn.largerThan(l)]={},r.forEach(p=>{i[t.fn.largerThan(l)][p]=u}),i):(i[t.fn.largerThan(l)]={[r]:u},i)},{});const o=n(e,t);return Array.isArray(r)?r.reduce((s,i)=>(s[i]=o,s),{}):{[r]:o}}function Sq(e,t){return e==="dimmed"?t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]:t.fn.variant({variant:"filled",color:e,primaryFallback:!1}).background}function kq(e){return Ge(e)}function jq(e){return e}function _q(e,t){return Xt({size:e,sizes:t.fontSizes})}const Iq=["-xs","-sm","-md","-lg","-xl"];function Pq(e,t){return Iq.includes(e)?`calc(${Xt({size:e.replace("-",""),sizes:t.spacing})} * -1)`:Xt({size:e,sizes:t.spacing})}const Eq={identity:jq,color:Sq,size:kq,fontSize:_q,spacing:Pq},Mq={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},mx:{type:"spacing",property:["marginRight","marginLeft"]},my:{type:"spacing",property:["marginTop","marginBottom"]},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},px:{type:"spacing",property:["paddingRight","paddingLeft"]},py:{type:"spacing",property:["paddingTop","paddingBottom"]},bg:{type:"color",property:"background"},c:{type:"color",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"identity",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"identity",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"identity",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"}};var Oq=Object.defineProperty,E4=Object.getOwnPropertySymbols,Rq=Object.prototype.hasOwnProperty,Aq=Object.prototype.propertyIsEnumerable,M4=(e,t,n)=>t in e?Oq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O4=(e,t)=>{for(var n in t||(t={}))Rq.call(t,n)&&M4(e,n,t[n]);if(E4)for(var n of E4(t))Aq.call(t,n)&&M4(e,n,t[n]);return e};function R4(e,t,n=Mq){return Object.keys(n).reduce((o,s)=>(s in e&&e[s]!==void 0&&o.push(wq({value:e[s],getValue:Eq[n[s].type],property:n[s].property,theme:t})),o),[]).reduce((o,s)=>(Object.keys(s).forEach(i=>{typeof s[i]=="object"&&s[i]!==null&&i in o?o[i]=O4(O4({},o[i]),s[i]):o[i]=s[i]}),o),{})}function A4(e,t){return typeof e=="function"?e(t):e}function Dq(e,t,n){const r=Si(),{css:o,cx:s}=p6();return Array.isArray(e)?s(n,o(R4(t,r)),e.map(i=>o(A4(i,r)))):s(n,o(A4(e,r)),o(R4(t,r)))}var Tq=Object.defineProperty,eh=Object.getOwnPropertySymbols,C6=Object.prototype.hasOwnProperty,w6=Object.prototype.propertyIsEnumerable,D4=(e,t,n)=>t in e?Tq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Nq=(e,t)=>{for(var n in t||(t={}))C6.call(t,n)&&D4(e,n,t[n]);if(eh)for(var n of eh(t))w6.call(t,n)&&D4(e,n,t[n]);return e},$q=(e,t)=>{var n={};for(var r in e)C6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&eh)for(var r of eh(e))t.indexOf(r)<0&&w6.call(e,r)&&(n[r]=e[r]);return n};const S6=d.forwardRef((e,t)=>{var n=e,{className:r,component:o,style:s,sx:i}=n,l=$q(n,["className","component","style","sx"]);const{systemStyles:u,rest:p}=zg(l),m=o||"div";return H.createElement(m,Nq({ref:t,className:Dq(i,u,r),style:s},p))});S6.displayName="@mantine/core/Box";const Go=S6;var Lq=Object.defineProperty,zq=Object.defineProperties,Fq=Object.getOwnPropertyDescriptors,T4=Object.getOwnPropertySymbols,Bq=Object.prototype.hasOwnProperty,Hq=Object.prototype.propertyIsEnumerable,N4=(e,t,n)=>t in e?Lq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$4=(e,t)=>{for(var n in t||(t={}))Bq.call(t,n)&&N4(e,n,t[n]);if(T4)for(var n of T4(t))Hq.call(t,n)&&N4(e,n,t[n]);return e},Wq=(e,t)=>zq(e,Fq(t)),Vq=Co(e=>({root:Wq($4($4({},e.fn.focusStyles()),e.fn.fontStyles()),{cursor:"pointer",border:0,padding:0,appearance:"none",fontSize:e.fontSizes.md,backgroundColor:"transparent",textAlign:"left",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,textDecoration:"none",boxSizing:"border-box"})}));const Uq=Vq;var Gq=Object.defineProperty,th=Object.getOwnPropertySymbols,k6=Object.prototype.hasOwnProperty,j6=Object.prototype.propertyIsEnumerable,L4=(e,t,n)=>t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,qq=(e,t)=>{for(var n in t||(t={}))k6.call(t,n)&&L4(e,n,t[n]);if(th)for(var n of th(t))j6.call(t,n)&&L4(e,n,t[n]);return e},Kq=(e,t)=>{var n={};for(var r in e)k6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&th)for(var r of th(e))t.indexOf(r)<0&&j6.call(e,r)&&(n[r]=e[r]);return n};const _6=d.forwardRef((e,t)=>{const n=Nr("UnstyledButton",{},e),{className:r,component:o="button",unstyled:s,variant:i}=n,l=Kq(n,["className","component","unstyled","variant"]),{classes:u,cx:p}=Uq(null,{name:"UnstyledButton",unstyled:s,variant:i});return H.createElement(Go,qq({component:o,ref:t,className:p(u.root,r),type:o==="button"?"button":void 0},l))});_6.displayName="@mantine/core/UnstyledButton";const Qq=_6;var Xq=Object.defineProperty,Yq=Object.defineProperties,Jq=Object.getOwnPropertyDescriptors,z4=Object.getOwnPropertySymbols,Zq=Object.prototype.hasOwnProperty,eK=Object.prototype.propertyIsEnumerable,F4=(e,t,n)=>t in e?Xq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ix=(e,t)=>{for(var n in t||(t={}))Zq.call(t,n)&&F4(e,n,t[n]);if(z4)for(var n of z4(t))eK.call(t,n)&&F4(e,n,t[n]);return e},B4=(e,t)=>Yq(e,Jq(t));const tK=["subtle","filled","outline","light","default","transparent","gradient"],Vp={xs:Ge(18),sm:Ge(22),md:Ge(28),lg:Ge(34),xl:Ge(44)};function nK({variant:e,theme:t,color:n,gradient:r}){const o=t.fn.variant({color:n,variant:e,gradient:r});return e==="gradient"?{border:0,backgroundImage:o.background,color:o.color,"&:hover":t.fn.hover({backgroundSize:"200%"})}:tK.includes(e)?Ix({border:`${Ge(1)} solid ${o.border}`,backgroundColor:o.background,color:o.color},t.fn.hover({backgroundColor:o.hover})):null}var rK=Co((e,{radius:t,color:n,gradient:r},{variant:o,size:s})=>({root:B4(Ix({position:"relative",borderRadius:e.fn.radius(t),padding:0,lineHeight:1,display:"flex",alignItems:"center",justifyContent:"center",height:Xt({size:s,sizes:Vp}),minHeight:Xt({size:s,sizes:Vp}),width:Xt({size:s,sizes:Vp}),minWidth:Xt({size:s,sizes:Vp})},nK({variant:o,theme:e,color:n,gradient:r})),{"&:active":e.activeStyles,"& [data-action-icon-loader]":{maxWidth:"70%"},"&:disabled, &[data-disabled]":{color:e.colors.gray[e.colorScheme==="dark"?6:4],cursor:"not-allowed",backgroundColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),borderColor:o==="transparent"?void 0:e.fn.themeColor("gray",e.colorScheme==="dark"?8:1),backgroundImage:"none",pointerEvents:"none","&:active":{transform:"none"}},"&[data-loading]":{pointerEvents:"none","&::before":B4(Ix({content:'""'},e.fn.cover(Ge(-1))),{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.colors.dark[7],.5):"rgba(255, 255, 255, .5)",borderRadius:e.fn.radius(t),cursor:"not-allowed"})}})}));const oK=rK;var sK=Object.defineProperty,nh=Object.getOwnPropertySymbols,I6=Object.prototype.hasOwnProperty,P6=Object.prototype.propertyIsEnumerable,H4=(e,t,n)=>t in e?sK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,W4=(e,t)=>{for(var n in t||(t={}))I6.call(t,n)&&H4(e,n,t[n]);if(nh)for(var n of nh(t))P6.call(t,n)&&H4(e,n,t[n]);return e},V4=(e,t)=>{var n={};for(var r in e)I6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&nh)for(var r of nh(e))t.indexOf(r)<0&&P6.call(e,r)&&(n[r]=e[r]);return n};function aK(e){var t=e,{size:n,color:r}=t,o=V4(t,["size","color"]);const s=o,{style:i}=s,l=V4(s,["style"]);return H.createElement("svg",W4({viewBox:"0 0 135 140",xmlns:"http://www.w3.org/2000/svg",fill:r,style:W4({width:n},i)},l),H.createElement("rect",{y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"30",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"60",width:"15",height:"140",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"90",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.25s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.25s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("rect",{x:"120",y:"10",width:"15",height:"120",rx:"6"},H.createElement("animate",{attributeName:"height",begin:"0.5s",dur:"1s",values:"120;110;100;90;80;70;60;50;40;140;120",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"y",begin:"0.5s",dur:"1s",values:"10;15;20;25;30;35;40;45;50;0;10",calcMode:"linear",repeatCount:"indefinite"})))}var iK=Object.defineProperty,rh=Object.getOwnPropertySymbols,E6=Object.prototype.hasOwnProperty,M6=Object.prototype.propertyIsEnumerable,U4=(e,t,n)=>t in e?iK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G4=(e,t)=>{for(var n in t||(t={}))E6.call(t,n)&&U4(e,n,t[n]);if(rh)for(var n of rh(t))M6.call(t,n)&&U4(e,n,t[n]);return e},q4=(e,t)=>{var n={};for(var r in e)E6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&rh)for(var r of rh(e))t.indexOf(r)<0&&M6.call(e,r)&&(n[r]=e[r]);return n};function lK(e){var t=e,{size:n,color:r}=t,o=q4(t,["size","color"]);const s=o,{style:i}=s,l=q4(s,["style"]);return H.createElement("svg",G4({viewBox:"0 0 38 38",xmlns:"http://www.w3.org/2000/svg",stroke:r,style:G4({width:n,height:n},i)},l),H.createElement("g",{fill:"none",fillRule:"evenodd"},H.createElement("g",{transform:"translate(2.5 2.5)",strokeWidth:"5"},H.createElement("circle",{strokeOpacity:".5",cx:"16",cy:"16",r:"16"}),H.createElement("path",{d:"M32 16c0-9.94-8.06-16-16-16"},H.createElement("animateTransform",{attributeName:"transform",type:"rotate",from:"0 16 16",to:"360 16 16",dur:"1s",repeatCount:"indefinite"})))))}var cK=Object.defineProperty,oh=Object.getOwnPropertySymbols,O6=Object.prototype.hasOwnProperty,R6=Object.prototype.propertyIsEnumerable,K4=(e,t,n)=>t in e?cK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q4=(e,t)=>{for(var n in t||(t={}))O6.call(t,n)&&K4(e,n,t[n]);if(oh)for(var n of oh(t))R6.call(t,n)&&K4(e,n,t[n]);return e},X4=(e,t)=>{var n={};for(var r in e)O6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&oh)for(var r of oh(e))t.indexOf(r)<0&&R6.call(e,r)&&(n[r]=e[r]);return n};function uK(e){var t=e,{size:n,color:r}=t,o=X4(t,["size","color"]);const s=o,{style:i}=s,l=X4(s,["style"]);return H.createElement("svg",Q4({viewBox:"0 0 120 30",xmlns:"http://www.w3.org/2000/svg",fill:r,style:Q4({width:n},i)},l),H.createElement("circle",{cx:"15",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"60",cy:"15",r:"9",fillOpacity:"0.3"},H.createElement("animate",{attributeName:"r",from:"9",to:"9",begin:"0s",dur:"0.8s",values:"9;15;9",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"0.5",to:"0.5",begin:"0s",dur:"0.8s",values:".5;1;.5",calcMode:"linear",repeatCount:"indefinite"})),H.createElement("circle",{cx:"105",cy:"15",r:"15"},H.createElement("animate",{attributeName:"r",from:"15",to:"15",begin:"0s",dur:"0.8s",values:"15;9;15",calcMode:"linear",repeatCount:"indefinite"}),H.createElement("animate",{attributeName:"fill-opacity",from:"1",to:"1",begin:"0s",dur:"0.8s",values:"1;.5;1",calcMode:"linear",repeatCount:"indefinite"})))}var dK=Object.defineProperty,sh=Object.getOwnPropertySymbols,A6=Object.prototype.hasOwnProperty,D6=Object.prototype.propertyIsEnumerable,Y4=(e,t,n)=>t in e?dK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fK=(e,t)=>{for(var n in t||(t={}))A6.call(t,n)&&Y4(e,n,t[n]);if(sh)for(var n of sh(t))D6.call(t,n)&&Y4(e,n,t[n]);return e},pK=(e,t)=>{var n={};for(var r in e)A6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&sh)for(var r of sh(e))t.indexOf(r)<0&&D6.call(e,r)&&(n[r]=e[r]);return n};const e1={bars:aK,oval:lK,dots:uK},mK={xs:Ge(18),sm:Ge(22),md:Ge(36),lg:Ge(44),xl:Ge(58)},hK={size:"md"};function T6(e){const t=Nr("Loader",hK,e),{size:n,color:r,variant:o}=t,s=pK(t,["size","color","variant"]),i=Si(),l=o in e1?o:i.loader;return H.createElement(Go,fK({role:"presentation",component:e1[l]||e1.bars,size:Xt({size:n,sizes:mK}),color:i.fn.variant({variant:"filled",primaryFallback:!1,color:r||i.primaryColor}).background},s))}T6.displayName="@mantine/core/Loader";var gK=Object.defineProperty,ah=Object.getOwnPropertySymbols,N6=Object.prototype.hasOwnProperty,$6=Object.prototype.propertyIsEnumerable,J4=(e,t,n)=>t in e?gK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Z4=(e,t)=>{for(var n in t||(t={}))N6.call(t,n)&&J4(e,n,t[n]);if(ah)for(var n of ah(t))$6.call(t,n)&&J4(e,n,t[n]);return e},vK=(e,t)=>{var n={};for(var r in e)N6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ah)for(var r of ah(e))t.indexOf(r)<0&&$6.call(e,r)&&(n[r]=e[r]);return n};const xK={color:"gray",size:"md",variant:"subtle"},L6=d.forwardRef((e,t)=>{const n=Nr("ActionIcon",xK,e),{className:r,color:o,children:s,radius:i,size:l,variant:u,gradient:p,disabled:m,loaderProps:h,loading:g,unstyled:x,__staticSelector:y}=n,b=vK(n,["className","color","children","radius","size","variant","gradient","disabled","loaderProps","loading","unstyled","__staticSelector"]),{classes:C,cx:S,theme:j}=oK({radius:i,color:o,gradient:p},{name:["ActionIcon",y],unstyled:x,size:l,variant:u}),_=H.createElement(T6,Z4({color:j.fn.variant({color:o,variant:u}).color,size:"100%","data-action-icon-loader":!0},h));return H.createElement(Qq,Z4({className:S(C.root,r),ref:t,disabled:m,"data-disabled":m||void 0,"data-loading":g||void 0,unstyled:x},b),g?_:s)});L6.displayName="@mantine/core/ActionIcon";const bK=L6;var yK=Object.defineProperty,CK=Object.defineProperties,wK=Object.getOwnPropertyDescriptors,ih=Object.getOwnPropertySymbols,z6=Object.prototype.hasOwnProperty,F6=Object.prototype.propertyIsEnumerable,ek=(e,t,n)=>t in e?yK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,SK=(e,t)=>{for(var n in t||(t={}))z6.call(t,n)&&ek(e,n,t[n]);if(ih)for(var n of ih(t))F6.call(t,n)&&ek(e,n,t[n]);return e},kK=(e,t)=>CK(e,wK(t)),jK=(e,t)=>{var n={};for(var r in e)z6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ih)for(var r of ih(e))t.indexOf(r)<0&&F6.call(e,r)&&(n[r]=e[r]);return n};function B6(e){const t=Nr("Portal",{},e),{children:n,target:r,className:o,innerRef:s}=t,i=jK(t,["children","target","className","innerRef"]),l=Si(),[u,p]=d.useState(!1),m=d.useRef();return m6(()=>(p(!0),m.current=r?typeof r=="string"?document.querySelector(r):r:document.createElement("div"),r||document.body.appendChild(m.current),()=>{!r&&document.body.removeChild(m.current)}),[r]),u?rs.createPortal(H.createElement("div",kK(SK({className:o,dir:l.dir},i),{ref:s}),n),m.current):null}B6.displayName="@mantine/core/Portal";var _K=Object.defineProperty,lh=Object.getOwnPropertySymbols,H6=Object.prototype.hasOwnProperty,W6=Object.prototype.propertyIsEnumerable,tk=(e,t,n)=>t in e?_K(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IK=(e,t)=>{for(var n in t||(t={}))H6.call(t,n)&&tk(e,n,t[n]);if(lh)for(var n of lh(t))W6.call(t,n)&&tk(e,n,t[n]);return e},PK=(e,t)=>{var n={};for(var r in e)H6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&lh)for(var r of lh(e))t.indexOf(r)<0&&W6.call(e,r)&&(n[r]=e[r]);return n};function V6(e){var t=e,{withinPortal:n=!0,children:r}=t,o=PK(t,["withinPortal","children"]);return n?H.createElement(B6,IK({},o),r):H.createElement(H.Fragment,null,r)}V6.displayName="@mantine/core/OptionalPortal";var EK=Object.defineProperty,ch=Object.getOwnPropertySymbols,U6=Object.prototype.hasOwnProperty,G6=Object.prototype.propertyIsEnumerable,nk=(e,t,n)=>t in e?EK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,rk=(e,t)=>{for(var n in t||(t={}))U6.call(t,n)&&nk(e,n,t[n]);if(ch)for(var n of ch(t))G6.call(t,n)&&nk(e,n,t[n]);return e},MK=(e,t)=>{var n={};for(var r in e)U6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ch)for(var r of ch(e))t.indexOf(r)<0&&G6.call(e,r)&&(n[r]=e[r]);return n};function q6(e){const t=e,{width:n,height:r,style:o}=t,s=MK(t,["width","height","style"]);return H.createElement("svg",rk({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:rk({width:n,height:r},o)},s),H.createElement("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}q6.displayName="@mantine/core/CloseIcon";var OK=Object.defineProperty,uh=Object.getOwnPropertySymbols,K6=Object.prototype.hasOwnProperty,Q6=Object.prototype.propertyIsEnumerable,ok=(e,t,n)=>t in e?OK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,RK=(e,t)=>{for(var n in t||(t={}))K6.call(t,n)&&ok(e,n,t[n]);if(uh)for(var n of uh(t))Q6.call(t,n)&&ok(e,n,t[n]);return e},AK=(e,t)=>{var n={};for(var r in e)K6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&uh)for(var r of uh(e))t.indexOf(r)<0&&Q6.call(e,r)&&(n[r]=e[r]);return n};const DK={xs:Ge(12),sm:Ge(16),md:Ge(20),lg:Ge(28),xl:Ge(34)},TK={size:"sm"},X6=d.forwardRef((e,t)=>{const n=Nr("CloseButton",TK,e),{iconSize:r,size:o,children:s}=n,i=AK(n,["iconSize","size","children"]),l=Ge(r||DK[o]);return H.createElement(bK,RK({ref:t,__staticSelector:"CloseButton",size:o},i),s||H.createElement(q6,{width:l,height:l}))});X6.displayName="@mantine/core/CloseButton";const Y6=X6;var NK=Object.defineProperty,$K=Object.defineProperties,LK=Object.getOwnPropertyDescriptors,sk=Object.getOwnPropertySymbols,zK=Object.prototype.hasOwnProperty,FK=Object.prototype.propertyIsEnumerable,ak=(e,t,n)=>t in e?NK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Up=(e,t)=>{for(var n in t||(t={}))zK.call(t,n)&&ak(e,n,t[n]);if(sk)for(var n of sk(t))FK.call(t,n)&&ak(e,n,t[n]);return e},BK=(e,t)=>$K(e,LK(t));function HK({underline:e,strikethrough:t}){const n=[];return e&&n.push("underline"),t&&n.push("line-through"),n.length>0?n.join(" "):"none"}function WK({theme:e,color:t}){return t==="dimmed"?e.fn.dimmed():typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?e.fn.variant({variant:"filled",color:t}).background:t||"inherit"}function VK(e){return typeof e=="number"?{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"}:null}function UK({theme:e,truncate:t}){return t==="start"?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",direction:e.dir==="ltr"?"rtl":"ltr",textAlign:e.dir==="ltr"?"right":"left"}:t?{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}:null}var GK=Co((e,{color:t,lineClamp:n,truncate:r,inline:o,inherit:s,underline:i,gradient:l,weight:u,transform:p,align:m,strikethrough:h,italic:g},{size:x})=>{const y=e.fn.variant({variant:"gradient",gradient:l});return{root:BK(Up(Up(Up(Up({},e.fn.fontStyles()),e.fn.focusStyles()),VK(n)),UK({theme:e,truncate:r})),{color:WK({color:t,theme:e}),fontFamily:s?"inherit":e.fontFamily,fontSize:s||x===void 0?"inherit":Xt({size:x,sizes:e.fontSizes}),lineHeight:s?"inherit":o?1:e.lineHeight,textDecoration:HK({underline:i,strikethrough:h}),WebkitTapHighlightColor:"transparent",fontWeight:s?"inherit":u,textTransform:p,textAlign:m,fontStyle:g?"italic":void 0}),gradient:{backgroundImage:y.background,WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent"}}});const qK=GK;var KK=Object.defineProperty,dh=Object.getOwnPropertySymbols,J6=Object.prototype.hasOwnProperty,Z6=Object.prototype.propertyIsEnumerable,ik=(e,t,n)=>t in e?KK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,QK=(e,t)=>{for(var n in t||(t={}))J6.call(t,n)&&ik(e,n,t[n]);if(dh)for(var n of dh(t))Z6.call(t,n)&&ik(e,n,t[n]);return e},XK=(e,t)=>{var n={};for(var r in e)J6.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&dh)for(var r of dh(e))t.indexOf(r)<0&&Z6.call(e,r)&&(n[r]=e[r]);return n};const YK={variant:"text"},eE=d.forwardRef((e,t)=>{const n=Nr("Text",YK,e),{className:r,size:o,weight:s,transform:i,color:l,align:u,variant:p,lineClamp:m,truncate:h,gradient:g,inline:x,inherit:y,underline:b,strikethrough:C,italic:S,classNames:j,styles:_,unstyled:P,span:I,__staticSelector:M}=n,O=XK(n,["className","size","weight","transform","color","align","variant","lineClamp","truncate","gradient","inline","inherit","underline","strikethrough","italic","classNames","styles","unstyled","span","__staticSelector"]),{classes:A,cx:D}=qK({color:l,lineClamp:m,truncate:h,inline:x,inherit:y,underline:b,strikethrough:C,italic:S,weight:s,transform:i,align:u,gradient:g},{unstyled:P,name:M||"Text",variant:p,size:o});return H.createElement(Go,QK({ref:t,className:D(A.root,{[A.gradient]:p==="gradient"},r),component:I?"span":"div"},O))});eE.displayName="@mantine/core/Text";const vu=eE,Gp={xs:Ge(1),sm:Ge(2),md:Ge(3),lg:Ge(4),xl:Ge(5)};function qp(e,t){const n=e.fn.variant({variant:"outline",color:t}).border;return typeof t=="string"&&(t in e.colors||t.split(".")[0]in e.colors)?n:t===void 0?e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]:t}var JK=Co((e,{color:t},{size:n,variant:r})=>({root:{},withLabel:{borderTop:"0 !important"},left:{"&::before":{display:"none"}},right:{"&::after":{display:"none"}},label:{display:"flex",alignItems:"center","&::before":{content:'""',flex:1,height:Ge(1),borderTop:`${Xt({size:n,sizes:Gp})} ${r} ${qp(e,t)}`,marginRight:e.spacing.xs},"&::after":{content:'""',flex:1,borderTop:`${Xt({size:n,sizes:Gp})} ${r} ${qp(e,t)}`,marginLeft:e.spacing.xs}},labelDefaultStyles:{color:t==="dark"?e.colors.dark[1]:e.fn.themeColor(t,e.colorScheme==="dark"?5:e.fn.primaryShade(),!1)},horizontal:{border:0,borderTopWidth:Ge(Xt({size:n,sizes:Gp})),borderTopColor:qp(e,t),borderTopStyle:r,margin:0},vertical:{border:0,alignSelf:"stretch",height:"auto",borderLeftWidth:Ge(Xt({size:n,sizes:Gp})),borderLeftColor:qp(e,t),borderLeftStyle:r}}));const ZK=JK;var eQ=Object.defineProperty,tQ=Object.defineProperties,nQ=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,tE=Object.prototype.hasOwnProperty,nE=Object.prototype.propertyIsEnumerable,lk=(e,t,n)=>t in e?eQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ck=(e,t)=>{for(var n in t||(t={}))tE.call(t,n)&&lk(e,n,t[n]);if(fh)for(var n of fh(t))nE.call(t,n)&&lk(e,n,t[n]);return e},rQ=(e,t)=>tQ(e,nQ(t)),oQ=(e,t)=>{var n={};for(var r in e)tE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&fh)for(var r of fh(e))t.indexOf(r)<0&&nE.call(e,r)&&(n[r]=e[r]);return n};const sQ={orientation:"horizontal",size:"xs",labelPosition:"left",variant:"solid"},Px=d.forwardRef((e,t)=>{const n=Nr("Divider",sQ,e),{className:r,color:o,orientation:s,size:i,label:l,labelPosition:u,labelProps:p,variant:m,styles:h,classNames:g,unstyled:x}=n,y=oQ(n,["className","color","orientation","size","label","labelPosition","labelProps","variant","styles","classNames","unstyled"]),{classes:b,cx:C}=ZK({color:o},{classNames:g,styles:h,unstyled:x,name:"Divider",variant:m,size:i}),S=s==="vertical",j=s==="horizontal",_=!!l&&j,P=!(p!=null&&p.color);return H.createElement(Go,ck({ref:t,className:C(b.root,{[b.vertical]:S,[b.horizontal]:j,[b.withLabel]:_},r),role:"separator"},y),_&&H.createElement(vu,rQ(ck({},p),{size:(p==null?void 0:p.size)||"xs",mt:Ge(2),className:C(b.label,b[u],{[b.labelDefaultStyles]:P})}),l))});Px.displayName="@mantine/core/Divider";var aQ=Object.defineProperty,iQ=Object.defineProperties,lQ=Object.getOwnPropertyDescriptors,uk=Object.getOwnPropertySymbols,cQ=Object.prototype.hasOwnProperty,uQ=Object.prototype.propertyIsEnumerable,dk=(e,t,n)=>t in e?aQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fk=(e,t)=>{for(var n in t||(t={}))cQ.call(t,n)&&dk(e,n,t[n]);if(uk)for(var n of uk(t))uQ.call(t,n)&&dk(e,n,t[n]);return e},dQ=(e,t)=>iQ(e,lQ(t)),fQ=Co((e,t,{size:n})=>({item:dQ(fk({},e.fn.fontStyles()),{boxSizing:"border-box",wordBreak:"break-all",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`,cursor:"pointer",fontSize:Xt({size:n,sizes:e.fontSizes}),color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,borderRadius:e.fn.radius(),"&[data-hovered]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},"&[data-selected]":fk({backgroundColor:e.fn.variant({variant:"filled"}).background,color:e.fn.variant({variant:"filled"}).color},e.fn.hover({backgroundColor:e.fn.variant({variant:"filled"}).hover})),"&[data-disabled]":{cursor:"default",color:e.colors.dark[2]}}),nothingFound:{boxSizing:"border-box",color:e.colors.gray[6],paddingTop:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,paddingBottom:`calc(${Xt({size:n,sizes:e.spacing})} / 2)`,textAlign:"center"},separator:{boxSizing:"border-box",textAlign:"left",width:"100%",padding:`calc(${Xt({size:n,sizes:e.spacing})} / 1.5) ${Xt({size:n,sizes:e.spacing})}`},separatorLabel:{color:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]}}));const pQ=fQ;var mQ=Object.defineProperty,pk=Object.getOwnPropertySymbols,hQ=Object.prototype.hasOwnProperty,gQ=Object.prototype.propertyIsEnumerable,mk=(e,t,n)=>t in e?mQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vQ=(e,t)=>{for(var n in t||(t={}))hQ.call(t,n)&&mk(e,n,t[n]);if(pk)for(var n of pk(t))gQ.call(t,n)&&mk(e,n,t[n]);return e};function Ry({data:e,hovered:t,classNames:n,styles:r,isItemSelected:o,uuid:s,__staticSelector:i,onItemHover:l,onItemSelect:u,itemsRefs:p,itemComponent:m,size:h,nothingFound:g,creatable:x,createLabel:y,unstyled:b,variant:C}){const{classes:S}=pQ(null,{classNames:n,styles:r,unstyled:b,name:i,variant:C,size:h}),j=[],_=[];let P=null;const I=(O,A)=>{const D=typeof o=="function"?o(O.value):!1;return H.createElement(m,vQ({key:O.value,className:S.item,"data-disabled":O.disabled||void 0,"data-hovered":!O.disabled&&t===A||void 0,"data-selected":!O.disabled&&D||void 0,selected:D,onMouseEnter:()=>l(A),id:`${s}-${A}`,role:"option",tabIndex:-1,"aria-selected":t===A,ref:R=>{p&&p.current&&(p.current[O.value]=R)},onMouseDown:O.disabled?null:R=>{R.preventDefault(),u(O)},disabled:O.disabled,variant:C},O))};let M=null;if(e.forEach((O,A)=>{O.creatable?P=A:O.group?(M!==O.group&&(M=O.group,_.push(H.createElement("div",{className:S.separator,key:`__mantine-divider-${A}`},H.createElement(Px,{classNames:{label:S.separatorLabel},label:O.group})))),_.push(I(O,A))):j.push(I(O,A))}),x){const O=e[P];j.push(H.createElement("div",{key:My(),className:S.item,"data-hovered":t===P||void 0,onMouseEnter:()=>l(P),onMouseDown:A=>{A.preventDefault(),u(O)},tabIndex:-1,ref:A=>{p&&p.current&&(p.current[O.value]=A)}},y))}return _.length>0&&j.length>0&&j.unshift(H.createElement("div",{className:S.separator,key:"empty-group-separator"},H.createElement(Px,null))),_.length>0||j.length>0?H.createElement(H.Fragment,null,_,j):H.createElement(vu,{size:h,unstyled:b,className:S.nothingFound},g)}Ry.displayName="@mantine/core/SelectItems";var xQ=Object.defineProperty,ph=Object.getOwnPropertySymbols,rE=Object.prototype.hasOwnProperty,oE=Object.prototype.propertyIsEnumerable,hk=(e,t,n)=>t in e?xQ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bQ=(e,t)=>{for(var n in t||(t={}))rE.call(t,n)&&hk(e,n,t[n]);if(ph)for(var n of ph(t))oE.call(t,n)&&hk(e,n,t[n]);return e},yQ=(e,t)=>{var n={};for(var r in e)rE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&ph)for(var r of ph(e))t.indexOf(r)<0&&oE.call(e,r)&&(n[r]=e[r]);return n};const Ay=d.forwardRef((e,t)=>{var n=e,{label:r,value:o}=n,s=yQ(n,["label","value"]);return H.createElement("div",bQ({ref:t},s),r||o)});Ay.displayName="@mantine/core/DefaultItem";function CQ(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function sE(...e){return t=>e.forEach(n=>CQ(n,t))}function sc(...e){return d.useCallback(sE(...e),e)}const aE=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(SQ);if(s){const i=s.props.children,l=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return d.createElement(Ex,hr({},r,{ref:t}),d.isValidElement(i)?d.cloneElement(i,void 0,l):null)}return d.createElement(Ex,hr({},r,{ref:t}),n)});aE.displayName="Slot";const Ex=d.forwardRef((e,t)=>{const{children:n,...r}=e;return d.isValidElement(n)?d.cloneElement(n,{...kQ(r,n.props),ref:sE(t,n.ref)}):d.Children.count(n)>1?d.Children.only(null):null});Ex.displayName="SlotClone";const wQ=({children:e})=>d.createElement(d.Fragment,null,e);function SQ(e){return d.isValidElement(e)&&e.type===wQ}function kQ(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...l)=>{s(...l),o(...l)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}const jQ=["a","button","div","h2","h3","img","label","li","nav","ol","p","span","svg","ul"],$f=jQ.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,l=s?aE:t;return d.useEffect(()=>{window[Symbol.for("radix-ui")]=!0},[]),d.createElement(l,hr({},i,{ref:o}))});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Mx=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function _Q(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const Lf=e=>{const{present:t,children:n}=e,r=IQ(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=sc(r.ref,o.ref);return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};Lf.displayName="Presence";function IQ(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[l,u]=_Q(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const p=Kp(r.current);s.current=l==="mounted"?p:"none"},[l]),Mx(()=>{const p=r.current,m=o.current;if(m!==e){const g=s.current,x=Kp(p);e?u("MOUNT"):x==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(m&&g!==x?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Mx(()=>{if(t){const p=h=>{const x=Kp(r.current).includes(h.animationName);h.target===t&&x&&rs.flushSync(()=>u("ANIMATION_END"))},m=h=>{h.target===t&&(s.current=Kp(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:d.useCallback(p=>{p&&(r.current=getComputedStyle(p)),n(p)},[])}}function Kp(e){return(e==null?void 0:e.animationName)||"none"}function PQ(e,t=[]){let n=[];function r(s,i){const l=d.createContext(i),u=n.length;n=[...n,i];function p(h){const{scope:g,children:x,...y}=h,b=(g==null?void 0:g[e][u])||l,C=d.useMemo(()=>y,Object.values(y));return d.createElement(b.Provider,{value:C},x)}function m(h,g){const x=(g==null?void 0:g[e][u])||l,y=d.useContext(x);if(y)return y;if(i!==void 0)return i;throw new Error(`\`${h}\` must be used within \`${s}\``)}return p.displayName=s+"Provider",[p,m]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(l){const u=(l==null?void 0:l[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...l,[e]:u}}),[l,u])}};return o.scopeName=e,[r,EQ(o,...t)]}function EQ(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((l,{useScope:u,scopeName:p})=>{const h=u(s)[`__scope${p}`];return{...l,...h}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function El(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)===null||r===void 0?void 0:r.call(t,...n)},[])}const MQ=d.createContext(void 0);function OQ(e){const t=d.useContext(MQ);return e||t||"ltr"}function RQ(e,[t,n]){return Math.min(n,Math.max(t,e))}function Nl(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function AQ(e,t){return d.useReducer((n,r)=>{const o=t[n][r];return o??n},e)}const iE="ScrollArea",[lE,gxe]=PQ(iE),[DQ,As]=lE(iE),TQ=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:r="hover",dir:o,scrollHideDelay:s=600,...i}=e,[l,u]=d.useState(null),[p,m]=d.useState(null),[h,g]=d.useState(null),[x,y]=d.useState(null),[b,C]=d.useState(null),[S,j]=d.useState(0),[_,P]=d.useState(0),[I,M]=d.useState(!1),[O,A]=d.useState(!1),D=sc(t,N=>u(N)),R=OQ(o);return d.createElement(DQ,{scope:n,type:r,dir:R,scrollHideDelay:s,scrollArea:l,viewport:p,onViewportChange:m,content:h,onContentChange:g,scrollbarX:x,onScrollbarXChange:y,scrollbarXEnabled:I,onScrollbarXEnabledChange:M,scrollbarY:b,onScrollbarYChange:C,scrollbarYEnabled:O,onScrollbarYEnabledChange:A,onCornerWidthChange:j,onCornerHeightChange:P},d.createElement($f.div,hr({dir:R},i,{ref:D,style:{position:"relative","--radix-scroll-area-corner-width":S+"px","--radix-scroll-area-corner-height":_+"px",...e.style}})))}),NQ="ScrollAreaViewport",$Q=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:r,...o}=e,s=As(NQ,n),i=d.useRef(null),l=sc(t,i,s.onViewportChange);return d.createElement(d.Fragment,null,d.createElement("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"}}),d.createElement($f.div,hr({"data-radix-scroll-area-viewport":""},o,{ref:l,style:{overflowX:s.scrollbarXEnabled?"scroll":"hidden",overflowY:s.scrollbarYEnabled?"scroll":"hidden",...e.style}}),d.createElement("div",{ref:s.onContentChange,style:{minWidth:"100%",display:"table"}},r)))}),ji="ScrollAreaScrollbar",LQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(ji,e.__scopeScrollArea),{onScrollbarXEnabledChange:s,onScrollbarYEnabledChange:i}=o,l=e.orientation==="horizontal";return d.useEffect(()=>(l?s(!0):i(!0),()=>{l?s(!1):i(!1)}),[l,s,i]),o.type==="hover"?d.createElement(zQ,hr({},r,{ref:t,forceMount:n})):o.type==="scroll"?d.createElement(FQ,hr({},r,{ref:t,forceMount:n})):o.type==="auto"?d.createElement(cE,hr({},r,{ref:t,forceMount:n})):o.type==="always"?d.createElement(Dy,hr({},r,{ref:t})):null}),zQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(ji,e.__scopeScrollArea),[s,i]=d.useState(!1);return d.useEffect(()=>{const l=o.scrollArea;let u=0;if(l){const p=()=>{window.clearTimeout(u),i(!0)},m=()=>{u=window.setTimeout(()=>i(!1),o.scrollHideDelay)};return l.addEventListener("pointerenter",p),l.addEventListener("pointerleave",m),()=>{window.clearTimeout(u),l.removeEventListener("pointerenter",p),l.removeEventListener("pointerleave",m)}}},[o.scrollArea,o.scrollHideDelay]),d.createElement(Lf,{present:n||s},d.createElement(cE,hr({"data-state":s?"visible":"hidden"},r,{ref:t})))}),FQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=As(ji,e.__scopeScrollArea),s=e.orientation==="horizontal",i=Bg(()=>u("SCROLL_END"),100),[l,u]=AQ("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return d.useEffect(()=>{if(l==="idle"){const p=window.setTimeout(()=>u("HIDE"),o.scrollHideDelay);return()=>window.clearTimeout(p)}},[l,o.scrollHideDelay,u]),d.useEffect(()=>{const p=o.viewport,m=s?"scrollLeft":"scrollTop";if(p){let h=p[m];const g=()=>{const x=p[m];h!==x&&(u("SCROLL"),i()),h=x};return p.addEventListener("scroll",g),()=>p.removeEventListener("scroll",g)}},[o.viewport,s,u,i]),d.createElement(Lf,{present:n||l!=="hidden"},d.createElement(Dy,hr({"data-state":l==="hidden"?"hidden":"visible"},r,{ref:t,onPointerEnter:Nl(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:Nl(e.onPointerLeave,()=>u("POINTER_LEAVE"))})))}),cE=d.forwardRef((e,t)=>{const n=As(ji,e.__scopeScrollArea),{forceMount:r,...o}=e,[s,i]=d.useState(!1),l=e.orientation==="horizontal",u=Bg(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...r}=e,o=As(ji,e.__scopeScrollArea),s=d.useRef(null),i=d.useRef(0),[l,u]=d.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=pE(l.viewport,l.content),m={...r,sizes:l,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:g=>s.current=g,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:g=>i.current=g};function h(g,x){return KQ(g,i.current,l,x)}return n==="horizontal"?d.createElement(BQ,hr({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollLeft,x=gk(g,l,o.dir);s.current.style.transform=`translate3d(${x}px, 0, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollLeft=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollLeft=h(g,o.dir))}})):n==="vertical"?d.createElement(HQ,hr({},m,{ref:t,onThumbPositionChange:()=>{if(o.viewport&&s.current){const g=o.viewport.scrollTop,x=gk(g,l);s.current.style.transform=`translate3d(0, ${x}px, 0)`}},onWheelScroll:g=>{o.viewport&&(o.viewport.scrollTop=g)},onDragScroll:g=>{o.viewport&&(o.viewport.scrollTop=h(g))}})):null}),BQ=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(ji,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=sc(t,u,s.onScrollbarXChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(dE,hr({"data-orientation":"horizontal"},o,{ref:p,sizes:n,style:{bottom:0,left:s.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:s.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":Fg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollLeft+m.deltaX;e.onWheelScroll(g),hE(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollWidth,viewport:s.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:mh(i.paddingLeft),paddingEnd:mh(i.paddingRight)}})}}))}),HQ=d.forwardRef((e,t)=>{const{sizes:n,onSizesChange:r,...o}=e,s=As(ji,e.__scopeScrollArea),[i,l]=d.useState(),u=d.useRef(null),p=sc(t,u,s.onScrollbarYChange);return d.useEffect(()=>{u.current&&l(getComputedStyle(u.current))},[u]),d.createElement(dE,hr({"data-orientation":"vertical"},o,{ref:p,sizes:n,style:{top:0,right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":Fg(n)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,h)=>{if(s.viewport){const g=s.viewport.scrollTop+m.deltaY;e.onWheelScroll(g),hE(g,h)&&m.preventDefault()}},onResize:()=>{u.current&&s.viewport&&i&&r({content:s.viewport.scrollHeight,viewport:s.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:mh(i.paddingTop),paddingEnd:mh(i.paddingBottom)}})}}))}),[WQ,uE]=lE(ji),dE=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:o,onThumbChange:s,onThumbPointerUp:i,onThumbPointerDown:l,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:m,onResize:h,...g}=e,x=As(ji,n),[y,b]=d.useState(null),C=sc(t,D=>b(D)),S=d.useRef(null),j=d.useRef(""),_=x.viewport,P=r.content-r.viewport,I=El(m),M=El(u),O=Bg(h,10);function A(D){if(S.current){const R=D.clientX-S.current.left,N=D.clientY-S.current.top;p({x:R,y:N})}}return d.useEffect(()=>{const D=R=>{const N=R.target;(y==null?void 0:y.contains(N))&&I(R,P)};return document.addEventListener("wheel",D,{passive:!1}),()=>document.removeEventListener("wheel",D,{passive:!1})},[_,y,P,I]),d.useEffect(M,[r,M]),xu(y,O),xu(x.content,O),d.createElement(WQ,{scope:n,scrollbar:y,hasThumb:o,onThumbChange:El(s),onThumbPointerUp:El(i),onThumbPositionChange:M,onThumbPointerDown:El(l)},d.createElement($f.div,hr({},g,{ref:C,style:{position:"absolute",...g.style},onPointerDown:Nl(e.onPointerDown,D=>{D.button===0&&(D.target.setPointerCapture(D.pointerId),S.current=y.getBoundingClientRect(),j.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",A(D))}),onPointerMove:Nl(e.onPointerMove,A),onPointerUp:Nl(e.onPointerUp,D=>{const R=D.target;R.hasPointerCapture(D.pointerId)&&R.releasePointerCapture(D.pointerId),document.body.style.webkitUserSelect=j.current,S.current=null})})))}),Ox="ScrollAreaThumb",VQ=d.forwardRef((e,t)=>{const{forceMount:n,...r}=e,o=uE(Ox,e.__scopeScrollArea);return d.createElement(Lf,{present:n||o.hasThumb},d.createElement(UQ,hr({ref:t},r)))}),UQ=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:r,...o}=e,s=As(Ox,n),i=uE(Ox,n),{onThumbPositionChange:l}=i,u=sc(t,h=>i.onThumbChange(h)),p=d.useRef(),m=Bg(()=>{p.current&&(p.current(),p.current=void 0)},100);return d.useEffect(()=>{const h=s.viewport;if(h){const g=()=>{if(m(),!p.current){const x=QQ(h,l);p.current=x,l()}};return l(),h.addEventListener("scroll",g),()=>h.removeEventListener("scroll",g)}},[s.viewport,m,l]),d.createElement($f.div,hr({"data-state":i.hasThumb?"visible":"hidden"},o,{ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Nl(e.onPointerDownCapture,h=>{const x=h.target.getBoundingClientRect(),y=h.clientX-x.left,b=h.clientY-x.top;i.onThumbPointerDown({x:y,y:b})}),onPointerUp:Nl(e.onPointerUp,i.onThumbPointerUp)}))}),fE="ScrollAreaCorner",GQ=d.forwardRef((e,t)=>{const n=As(fE,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?d.createElement(qQ,hr({},e,{ref:t})):null}),qQ=d.forwardRef((e,t)=>{const{__scopeScrollArea:n,...r}=e,o=As(fE,n),[s,i]=d.useState(0),[l,u]=d.useState(0),p=!!(s&&l);return xu(o.scrollbarX,()=>{var m;const h=((m=o.scrollbarX)===null||m===void 0?void 0:m.offsetHeight)||0;o.onCornerHeightChange(h),u(h)}),xu(o.scrollbarY,()=>{var m;const h=((m=o.scrollbarY)===null||m===void 0?void 0:m.offsetWidth)||0;o.onCornerWidthChange(h),i(h)}),p?d.createElement($f.div,hr({},r,{ref:t,style:{width:s,height:l,position:"absolute",right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:0,...e.style}})):null});function mh(e){return e?parseInt(e,10):0}function pE(e,t){const n=e/t;return isNaN(n)?0:n}function Fg(e){const t=pE(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function KQ(e,t,n,r="ltr"){const o=Fg(n),s=o/2,i=t||s,l=o-i,u=n.scrollbar.paddingStart+i,p=n.scrollbar.size-n.scrollbar.paddingEnd-l,m=n.content-n.viewport,h=r==="ltr"?[0,m]:[m*-1,0];return mE([u,p],h)(e)}function gk(e,t,n="ltr"){const r=Fg(t),o=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=t.scrollbar.size-o,i=t.content-t.viewport,l=s-r,u=n==="ltr"?[0,i]:[i*-1,0],p=RQ(e,u);return mE([0,i],[0,l])(p)}function mE(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function hE(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return function o(){const s={left:e.scrollLeft,top:e.scrollTop},i=n.left!==s.left,l=n.top!==s.top;(i||l)&&t(),n=s,r=window.requestAnimationFrame(o)}(),()=>window.cancelAnimationFrame(r)};function Bg(e,t){const n=El(e),r=d.useRef(0);return d.useEffect(()=>()=>window.clearTimeout(r.current),[]),d.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function xu(e,t){const n=El(t);Mx(()=>{let r=0;if(e){const o=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return o.observe(e),()=>{window.cancelAnimationFrame(r),o.unobserve(e)}}},[e,n])}const XQ=TQ,YQ=$Q,vk=LQ,xk=VQ,JQ=GQ;var ZQ=Co((e,{scrollbarSize:t,offsetScrollbars:n,scrollbarHovered:r,hidden:o})=>({root:{overflow:"hidden"},viewport:{width:"100%",height:"100%",paddingRight:n?Ge(t):void 0,paddingBottom:n?Ge(t):void 0},scrollbar:{display:o?"none":"flex",userSelect:"none",touchAction:"none",boxSizing:"border-box",padding:`calc(${Ge(t)} / 5)`,transition:"background-color 150ms ease, opacity 150ms ease","&:hover":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[8]:e.colors.gray[0],[`& .${S4("thumb")}`]:{backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.5):e.fn.rgba(e.black,.5)}},'&[data-orientation="vertical"]':{width:Ge(t)},'&[data-orientation="horizontal"]':{flexDirection:"column",height:Ge(t)},'&[data-state="hidden"]':{display:"none",opacity:0}},thumb:{ref:S4("thumb"),flex:1,backgroundColor:e.colorScheme==="dark"?e.fn.rgba(e.white,.4):e.fn.rgba(e.black,.4),borderRadius:Ge(t),position:"relative",transition:"background-color 150ms ease",display:o?"none":void 0,overflow:"hidden","&::before":{content:'""',position:"absolute",top:"50%",left:"50%",transform:"translate(-50%, -50%)",width:"100%",height:"100%",minWidth:Ge(44),minHeight:Ge(44)}},corner:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[0],transition:"opacity 150ms ease",opacity:r?1:0,display:o?"none":void 0}}));const eX=ZQ;var tX=Object.defineProperty,nX=Object.defineProperties,rX=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertySymbols,gE=Object.prototype.hasOwnProperty,vE=Object.prototype.propertyIsEnumerable,bk=(e,t,n)=>t in e?tX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rx=(e,t)=>{for(var n in t||(t={}))gE.call(t,n)&&bk(e,n,t[n]);if(hh)for(var n of hh(t))vE.call(t,n)&&bk(e,n,t[n]);return e},xE=(e,t)=>nX(e,rX(t)),bE=(e,t)=>{var n={};for(var r in e)gE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&hh)for(var r of hh(e))t.indexOf(r)<0&&vE.call(e,r)&&(n[r]=e[r]);return n};const yE={scrollbarSize:12,scrollHideDelay:1e3,type:"hover",offsetScrollbars:!1},Hg=d.forwardRef((e,t)=>{const n=Nr("ScrollArea",yE,e),{children:r,className:o,classNames:s,styles:i,scrollbarSize:l,scrollHideDelay:u,type:p,dir:m,offsetScrollbars:h,viewportRef:g,onScrollPositionChange:x,unstyled:y,variant:b,viewportProps:C}=n,S=bE(n,["children","className","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","variant","viewportProps"]),[j,_]=d.useState(!1),P=Si(),{classes:I,cx:M}=eX({scrollbarSize:l,offsetScrollbars:h,scrollbarHovered:j,hidden:p==="never"},{name:"ScrollArea",classNames:s,styles:i,unstyled:y,variant:b});return H.createElement(XQ,{type:p==="never"?"always":p,scrollHideDelay:u,dir:m||P.dir,ref:t,asChild:!0},H.createElement(Go,Rx({className:M(I.root,o)},S),H.createElement(YQ,xE(Rx({},C),{className:I.viewport,ref:g,onScroll:typeof x=="function"?({currentTarget:O})=>x({x:O.scrollLeft,y:O.scrollTop}):void 0}),r),H.createElement(vk,{orientation:"horizontal",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(xk,{className:I.thumb})),H.createElement(vk,{orientation:"vertical",className:I.scrollbar,forceMount:!0,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1)},H.createElement(xk,{className:I.thumb})),H.createElement(JQ,{className:I.corner})))}),CE=d.forwardRef((e,t)=>{const n=Nr("ScrollAreaAutosize",yE,e),{children:r,classNames:o,styles:s,scrollbarSize:i,scrollHideDelay:l,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,sx:y,variant:b,viewportProps:C}=n,S=bE(n,["children","classNames","styles","scrollbarSize","scrollHideDelay","type","dir","offsetScrollbars","viewportRef","onScrollPositionChange","unstyled","sx","variant","viewportProps"]);return H.createElement(Go,xE(Rx({},S),{ref:t,sx:[{display:"flex"},...l6(y)]}),H.createElement(Go,{sx:{display:"flex",flexDirection:"column",flex:1}},H.createElement(Hg,{classNames:o,styles:s,scrollHideDelay:l,scrollbarSize:i,type:u,dir:p,offsetScrollbars:m,viewportRef:h,onScrollPositionChange:g,unstyled:x,variant:b,viewportProps:C},r)))});CE.displayName="@mantine/core/ScrollAreaAutosize";Hg.displayName="@mantine/core/ScrollArea";Hg.Autosize=CE;const wE=Hg;var oX=Object.defineProperty,sX=Object.defineProperties,aX=Object.getOwnPropertyDescriptors,gh=Object.getOwnPropertySymbols,SE=Object.prototype.hasOwnProperty,kE=Object.prototype.propertyIsEnumerable,yk=(e,t,n)=>t in e?oX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ck=(e,t)=>{for(var n in t||(t={}))SE.call(t,n)&&yk(e,n,t[n]);if(gh)for(var n of gh(t))kE.call(t,n)&&yk(e,n,t[n]);return e},iX=(e,t)=>sX(e,aX(t)),lX=(e,t)=>{var n={};for(var r in e)SE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&gh)for(var r of gh(e))t.indexOf(r)<0&&kE.call(e,r)&&(n[r]=e[r]);return n};const Wg=d.forwardRef((e,t)=>{var n=e,{style:r}=n,o=lX(n,["style"]);return H.createElement(wE,iX(Ck({},o),{style:Ck({width:"100%"},r),viewportProps:{tabIndex:-1},viewportRef:t}),o.children)});Wg.displayName="@mantine/core/SelectScrollArea";var cX=Co(()=>({dropdown:{},itemsWrapper:{padding:Ge(4),display:"flex",width:"100%",boxSizing:"border-box"}}));const uX=cX;function Nu(e){return e.split("-")[1]}function Ty(e){return e==="y"?"height":"width"}function Zs(e){return e.split("-")[0]}function ul(e){return["top","bottom"].includes(Zs(e))?"x":"y"}function wk(e,t,n){let{reference:r,floating:o}=e;const s=r.x+r.width/2-o.width/2,i=r.y+r.height/2-o.height/2,l=ul(t),u=Ty(l),p=r[u]/2-o[u]/2,m=l==="x";let h;switch(Zs(t)){case"top":h={x:s,y:r.y-o.height};break;case"bottom":h={x:s,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:i};break;case"left":h={x:r.x-o.width,y:i};break;default:h={x:r.x,y:r.y}}switch(Nu(t)){case"start":h[l]-=p*(n&&m?-1:1);break;case"end":h[l]+=p*(n&&m?-1:1)}return h}const dX=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,l=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let p=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:m,y:h}=wk(p,r,u),g=r,x={},y=0;for(let b=0;b({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:l}=t,{element:u,padding:p=0}=pi(e,t)||{};if(u==null)return{};const m=Ny(p),h={x:n,y:r},g=ul(o),x=Ty(g),y=await i.getDimensions(u),b=g==="y",C=b?"top":"left",S=b?"bottom":"right",j=b?"clientHeight":"clientWidth",_=s.reference[x]+s.reference[g]-h[g]-s.floating[x],P=h[g]-s.reference[g],I=await(i.getOffsetParent==null?void 0:i.getOffsetParent(u));let M=I?I[j]:0;M&&await(i.isElement==null?void 0:i.isElement(I))||(M=l.floating[j]||s.floating[x]);const O=_/2-P/2,A=M/2-y[x]/2-1,D=nl(m[C],A),R=nl(m[S],A),N=D,Y=M-y[x]-R,F=M/2-y[x]/2+O,V=Ax(N,F,Y),Q=Nu(o)!=null&&F!=V&&s.reference[x]/2-(Fe.concat(t,t+"-start",t+"-end"),[]);const pX={left:"right",right:"left",bottom:"top",top:"bottom"};function vh(e){return e.replace(/left|right|bottom|top/g,t=>pX[t])}function mX(e,t,n){n===void 0&&(n=!1);const r=Nu(e),o=ul(e),s=Ty(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=vh(i)),{main:i,cross:vh(i)}}const hX={start:"end",end:"start"};function t1(e){return e.replace(/start|end/g,t=>hX[t])}const gX=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n;const{placement:r,middlewareData:o,rects:s,initialPlacement:i,platform:l,elements:u}=t,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:h,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:y=!0,...b}=pi(e,t),C=Zs(r),S=Zs(i)===i,j=await(l.isRTL==null?void 0:l.isRTL(u.floating)),_=h||(S||!y?[vh(i)]:function(N){const Y=vh(N);return[t1(N),Y,t1(Y)]}(i));h||x==="none"||_.push(...function(N,Y,F,V){const Q=Nu(N);let q=function(z,G,T){const B=["left","right"],X=["right","left"],re=["top","bottom"],le=["bottom","top"];switch(z){case"top":case"bottom":return T?G?X:B:G?B:X;case"left":case"right":return G?re:le;default:return[]}}(Zs(N),F==="start",V);return Q&&(q=q.map(z=>z+"-"+Q),Y&&(q=q.concat(q.map(t1)))),q}(i,y,x,j));const P=[i,..._],I=await $y(t,b),M=[];let O=((n=o.flip)==null?void 0:n.overflows)||[];if(p&&M.push(I[C]),m){const{main:N,cross:Y}=mX(r,s,j);M.push(I[N],I[Y])}if(O=[...O,{placement:r,overflows:M}],!M.every(N=>N<=0)){var A,D;const N=(((A=o.flip)==null?void 0:A.index)||0)+1,Y=P[N];if(Y)return{data:{index:N,overflows:O},reset:{placement:Y}};let F=(D=O.filter(V=>V.overflows[0]<=0).sort((V,Q)=>V.overflows[1]-Q.overflows[1])[0])==null?void 0:D.placement;if(!F)switch(g){case"bestFit":{var R;const V=(R=O.map(Q=>[Q.placement,Q.overflows.filter(q=>q>0).reduce((q,z)=>q+z,0)]).sort((Q,q)=>Q[1]-q[1])[0])==null?void 0:R[0];V&&(F=V);break}case"initialPlacement":F=i}if(r!==F)return{reset:{placement:F}}}return{}}}};function kk(e){const t=nl(...e.map(r=>r.left)),n=nl(...e.map(r=>r.top));return{x:t,y:n,width:wa(...e.map(r=>r.right))-t,height:wa(...e.map(r=>r.bottom))-n}}const vX=function(e){return e===void 0&&(e={}),{name:"inline",options:e,async fn(t){const{placement:n,elements:r,rects:o,platform:s,strategy:i}=t,{padding:l=2,x:u,y:p}=pi(e,t),m=Array.from(await(s.getClientRects==null?void 0:s.getClientRects(r.reference))||[]),h=function(b){const C=b.slice().sort((_,P)=>_.y-P.y),S=[];let j=null;for(let _=0;_j.height/2?S.push([P]):S[S.length-1].push(P),j=P}return S.map(_=>bu(kk(_)))}(m),g=bu(kk(m)),x=Ny(l),y=await s.getElementRects({reference:{getBoundingClientRect:function(){if(h.length===2&&h[0].left>h[1].right&&u!=null&&p!=null)return h.find(b=>u>b.left-x.left&&ub.top-x.top&&p=2){if(ul(n)==="x"){const I=h[0],M=h[h.length-1],O=Zs(n)==="top",A=I.top,D=M.bottom,R=O?I.left:M.left,N=O?I.right:M.right;return{top:A,bottom:D,left:R,right:N,width:N-R,height:D-A,x:R,y:A}}const b=Zs(n)==="left",C=wa(...h.map(I=>I.right)),S=nl(...h.map(I=>I.left)),j=h.filter(I=>b?I.left===S:I.right===C),_=j[0].top,P=j[j.length-1].bottom;return{top:_,bottom:P,left:S,right:C,width:C-S,height:P-_,x:S,y:_}}return g}},floating:r.floating,strategy:i});return o.reference.x!==y.reference.x||o.reference.y!==y.reference.y||o.reference.width!==y.reference.width||o.reference.height!==y.reference.height?{reset:{rects:y}}:{}}}},xX=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){const{x:n,y:r}=t,o=await async function(s,i){const{placement:l,platform:u,elements:p}=s,m=await(u.isRTL==null?void 0:u.isRTL(p.floating)),h=Zs(l),g=Nu(l),x=ul(l)==="x",y=["left","top"].includes(h)?-1:1,b=m&&x?-1:1,C=pi(i,s);let{mainAxis:S,crossAxis:j,alignmentAxis:_}=typeof C=="number"?{mainAxis:C,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...C};return g&&typeof _=="number"&&(j=g==="end"?-1*_:_),x?{x:j*b,y:S*y}:{x:S*y,y:j*b}}(t,e);return{x:n+o.x,y:r+o.y,data:o}}}};function jE(e){return e==="x"?"y":"x"}const bX=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:l={fn:C=>{let{x:S,y:j}=C;return{x:S,y:j}}},...u}=pi(e,t),p={x:n,y:r},m=await $y(t,u),h=ul(Zs(o)),g=jE(h);let x=p[h],y=p[g];if(s){const C=h==="y"?"bottom":"right";x=Ax(x+m[h==="y"?"top":"left"],x,x-m[C])}if(i){const C=g==="y"?"bottom":"right";y=Ax(y+m[g==="y"?"top":"left"],y,y-m[C])}const b=l.fn({...t,[h]:x,[g]:y});return{...b,data:{x:b.x-n,y:b.y-r}}}}},yX=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:l=0,mainAxis:u=!0,crossAxis:p=!0}=pi(e,t),m={x:n,y:r},h=ul(o),g=jE(h);let x=m[h],y=m[g];const b=pi(l,t),C=typeof b=="number"?{mainAxis:b,crossAxis:0}:{mainAxis:0,crossAxis:0,...b};if(u){const _=h==="y"?"height":"width",P=s.reference[h]-s.floating[_]+C.mainAxis,I=s.reference[h]+s.reference[_]-C.mainAxis;xI&&(x=I)}if(p){var S,j;const _=h==="y"?"width":"height",P=["top","left"].includes(Zs(o)),I=s.reference[g]-s.floating[_]+(P&&((S=i.offset)==null?void 0:S[g])||0)+(P?0:C.crossAxis),M=s.reference[g]+s.reference[_]+(P?0:((j=i.offset)==null?void 0:j[g])||0)-(P?C.crossAxis:0);yM&&(y=M)}return{[h]:x,[g]:y}}}},CX=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){const{placement:n,rects:r,platform:o,elements:s}=t,{apply:i=()=>{},...l}=pi(e,t),u=await $y(t,l),p=Zs(n),m=Nu(n),h=ul(n)==="x",{width:g,height:x}=r.floating;let y,b;p==="top"||p==="bottom"?(y=p,b=m===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?"start":"end")?"left":"right"):(b=p,y=m==="end"?"top":"bottom");const C=x-u[y],S=g-u[b],j=!t.middlewareData.shift;let _=C,P=S;if(h){const M=g-u.left-u.right;P=m||j?nl(S,M):M}else{const M=x-u.top-u.bottom;_=m||j?nl(C,M):M}if(j&&!m){const M=wa(u.left,0),O=wa(u.right,0),A=wa(u.top,0),D=wa(u.bottom,0);h?P=g-2*(M!==0||O!==0?M+O:wa(u.left,u.right)):_=x-2*(A!==0||D!==0?A+D:wa(u.top,u.bottom))}await i({...t,availableWidth:P,availableHeight:_});const I=await o.getDimensions(s.floating);return g!==I.width||x!==I.height?{reset:{rects:!0}}:{}}}};function as(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ra(e){return as(e).getComputedStyle(e)}function _E(e){return e instanceof as(e).Node}function rl(e){return _E(e)?(e.nodeName||"").toLowerCase():"#document"}function aa(e){return e instanceof HTMLElement||e instanceof as(e).HTMLElement}function jk(e){return typeof ShadowRoot<"u"&&(e instanceof as(e).ShadowRoot||e instanceof ShadowRoot)}function Zd(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ra(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function wX(e){return["table","td","th"].includes(rl(e))}function Dx(e){const t=Ly(),n=Ra(e);return n.transform!=="none"||n.perspective!=="none"||!!n.containerType&&n.containerType!=="normal"||!t&&!!n.backdropFilter&&n.backdropFilter!=="none"||!t&&!!n.filter&&n.filter!=="none"||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function Ly(){return!(typeof CSS>"u"||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}function Vg(e){return["html","body","#document"].includes(rl(e))}const Tx=Math.min,au=Math.max,xh=Math.round,Qp=Math.floor,ol=e=>({x:e,y:e});function IE(e){const t=Ra(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=aa(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,l=xh(n)!==s||xh(r)!==i;return l&&(n=s,r=i),{width:n,height:r,$:l}}function ai(e){return e instanceof Element||e instanceof as(e).Element}function zy(e){return ai(e)?e:e.contextElement}function iu(e){const t=zy(e);if(!aa(t))return ol(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=IE(t);let i=(s?xh(n.width):n.width)/r,l=(s?xh(n.height):n.height)/o;return i&&Number.isFinite(i)||(i=1),l&&Number.isFinite(l)||(l=1),{x:i,y:l}}const SX=ol(0);function PE(e){const t=as(e);return Ly()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:SX}function Ql(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=zy(e);let i=ol(1);t&&(r?ai(r)&&(i=iu(r)):i=iu(e));const l=function(g,x,y){return x===void 0&&(x=!1),!(!y||x&&y!==as(g))&&x}(s,n,r)?PE(s):ol(0);let u=(o.left+l.x)/i.x,p=(o.top+l.y)/i.y,m=o.width/i.x,h=o.height/i.y;if(s){const g=as(s),x=r&&ai(r)?as(r):r;let y=g.frameElement;for(;y&&r&&x!==g;){const b=iu(y),C=y.getBoundingClientRect(),S=getComputedStyle(y),j=C.left+(y.clientLeft+parseFloat(S.paddingLeft))*b.x,_=C.top+(y.clientTop+parseFloat(S.paddingTop))*b.y;u*=b.x,p*=b.y,m*=b.x,h*=b.y,u+=j,p+=_,y=as(y).frameElement}}return bu({width:m,height:h,x:u,y:p})}function Ug(e){return ai(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function ii(e){var t;return(t=(_E(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function EE(e){return Ql(ii(e)).left+Ug(e).scrollLeft}function yu(e){if(rl(e)==="html")return e;const t=e.assignedSlot||e.parentNode||jk(e)&&e.host||ii(e);return jk(t)?t.host:t}function ME(e){const t=yu(e);return Vg(t)?e.ownerDocument?e.ownerDocument.body:e.body:aa(t)&&Zd(t)?t:ME(t)}function bh(e,t){var n;t===void 0&&(t=[]);const r=ME(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=as(r);return o?t.concat(s,s.visualViewport||[],Zd(r)?r:[]):t.concat(r,bh(r))}function _k(e,t,n){let r;if(t==="viewport")r=function(o,s){const i=as(o),l=ii(o),u=i.visualViewport;let p=l.clientWidth,m=l.clientHeight,h=0,g=0;if(u){p=u.width,m=u.height;const x=Ly();(!x||x&&s==="fixed")&&(h=u.offsetLeft,g=u.offsetTop)}return{width:p,height:m,x:h,y:g}}(e,n);else if(t==="document")r=function(o){const s=ii(o),i=Ug(o),l=o.ownerDocument.body,u=au(s.scrollWidth,s.clientWidth,l.scrollWidth,l.clientWidth),p=au(s.scrollHeight,s.clientHeight,l.scrollHeight,l.clientHeight);let m=-i.scrollLeft+EE(o);const h=-i.scrollTop;return Ra(l).direction==="rtl"&&(m+=au(s.clientWidth,l.clientWidth)-u),{width:u,height:p,x:m,y:h}}(ii(e));else if(ai(t))r=function(o,s){const i=Ql(o,!0,s==="fixed"),l=i.top+o.clientTop,u=i.left+o.clientLeft,p=aa(o)?iu(o):ol(1);return{width:o.clientWidth*p.x,height:o.clientHeight*p.y,x:u*p.x,y:l*p.y}}(t,n);else{const o=PE(e);r={...t,x:t.x-o.x,y:t.y-o.y}}return bu(r)}function OE(e,t){const n=yu(e);return!(n===t||!ai(n)||Vg(n))&&(Ra(n).position==="fixed"||OE(n,t))}function kX(e,t,n){const r=aa(t),o=ii(t),s=n==="fixed",i=Ql(e,!0,s,t);let l={scrollLeft:0,scrollTop:0};const u=ol(0);if(r||!r&&!s)if((rl(t)!=="body"||Zd(o))&&(l=Ug(t)),aa(t)){const p=Ql(t,!0,s,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop}else o&&(u.x=EE(o));return{x:i.left+l.scrollLeft-u.x,y:i.top+l.scrollTop-u.y,width:i.width,height:i.height}}function Ik(e,t){return aa(e)&&Ra(e).position!=="fixed"?t?t(e):e.offsetParent:null}function Pk(e,t){const n=as(e);if(!aa(e))return n;let r=Ik(e,t);for(;r&&wX(r)&&Ra(r).position==="static";)r=Ik(r,t);return r&&(rl(r)==="html"||rl(r)==="body"&&Ra(r).position==="static"&&!Dx(r))?n:r||function(o){let s=yu(o);for(;aa(s)&&!Vg(s);){if(Dx(s))return s;s=yu(s)}return null}(e)||n}const jX={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e;const o=aa(n),s=ii(n);if(n===s)return t;let i={scrollLeft:0,scrollTop:0},l=ol(1);const u=ol(0);if((o||!o&&r!=="fixed")&&((rl(n)!=="body"||Zd(s))&&(i=Ug(n)),aa(n))){const p=Ql(n);l=iu(n),u.x=p.x+n.clientLeft,u.y=p.y+n.clientTop}return{width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-i.scrollLeft*l.x+u.x,y:t.y*l.y-i.scrollTop*l.y+u.y}},getDocumentElement:ii,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?function(u,p){const m=p.get(u);if(m)return m;let h=bh(u).filter(b=>ai(b)&&rl(b)!=="body"),g=null;const x=Ra(u).position==="fixed";let y=x?yu(u):u;for(;ai(y)&&!Vg(y);){const b=Ra(y),C=Dx(y);C||b.position!=="fixed"||(g=null),(x?!C&&!g:!C&&b.position==="static"&&g&&["absolute","fixed"].includes(g.position)||Zd(y)&&!C&&OE(u,y))?h=h.filter(S=>S!==y):g=b,y=yu(y)}return p.set(u,h),h}(t,this._c):[].concat(n),r],i=s[0],l=s.reduce((u,p)=>{const m=_k(t,p,o);return u.top=au(m.top,u.top),u.right=Tx(m.right,u.right),u.bottom=Tx(m.bottom,u.bottom),u.left=au(m.left,u.left),u},_k(t,i,o));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}},getOffsetParent:Pk,getElementRects:async function(e){let{reference:t,floating:n,strategy:r}=e;const o=this.getOffsetParent||Pk,s=this.getDimensions;return{reference:kX(t,await o(n),r),floating:{x:0,y:0,...await s(n)}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){return IE(e)},getScale:iu,isElement:ai,isRTL:function(e){return getComputedStyle(e).direction==="rtl"}};function _X(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,p=zy(e),m=o||s?[...p?bh(p):[],...bh(t)]:[];m.forEach(C=>{o&&C.addEventListener("scroll",n,{passive:!0}),s&&C.addEventListener("resize",n)});const h=p&&l?function(C,S){let j,_=null;const P=ii(C);function I(){clearTimeout(j),_&&_.disconnect(),_=null}return function M(O,A){O===void 0&&(O=!1),A===void 0&&(A=1),I();const{left:D,top:R,width:N,height:Y}=C.getBoundingClientRect();if(O||S(),!N||!Y)return;const F={rootMargin:-Qp(R)+"px "+-Qp(P.clientWidth-(D+N))+"px "+-Qp(P.clientHeight-(R+Y))+"px "+-Qp(D)+"px",threshold:au(0,Tx(1,A))||1};let V=!0;function Q(q){const z=q[0].intersectionRatio;if(z!==A){if(!V)return M();z?M(!1,z):j=setTimeout(()=>{M(!1,1e-7)},100)}V=!1}try{_=new IntersectionObserver(Q,{...F,root:P.ownerDocument})}catch{_=new IntersectionObserver(Q,F)}_.observe(C)}(!0),I}(p,n):null;let g,x=-1,y=null;i&&(y=new ResizeObserver(C=>{let[S]=C;S&&S.target===p&&y&&(y.unobserve(t),cancelAnimationFrame(x),x=requestAnimationFrame(()=>{y&&y.observe(t)})),n()}),p&&!u&&y.observe(p),y.observe(t));let b=u?Ql(e):null;return u&&function C(){const S=Ql(e);!b||S.x===b.x&&S.y===b.y&&S.width===b.width&&S.height===b.height||n(),b=S,g=requestAnimationFrame(C)}(),n(),()=>{m.forEach(C=>{o&&C.removeEventListener("scroll",n),s&&C.removeEventListener("resize",n)}),h&&h(),y&&y.disconnect(),y=null,u&&cancelAnimationFrame(g)}}const IX=(e,t,n)=>{const r=new Map,o={platform:jX,...n},s={...o.platform,_c:r};return dX(e,t,{...o,platform:s})},PX=e=>{const{element:t,padding:n}=e;function r(o){return Object.prototype.hasOwnProperty.call(o,"current")}return{name:"arrow",options:e,fn(o){return r(t)?t.current!=null?Sk({element:t.current,padding:n}).fn(o):{}:t?Sk({element:t,padding:n}).fn(o):{}}}};var Im=typeof document<"u"?d.useLayoutEffect:d.useEffect;function yh(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!yh(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!yh(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ek(e){const t=d.useRef(e);return Im(()=>{t.current=e}),t}function EX(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,whileElementsMounted:s,open:i}=e,[l,u]=d.useState({x:null,y:null,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,m]=d.useState(r);yh(p,r)||m(r);const h=d.useRef(null),g=d.useRef(null),x=d.useRef(l),y=Ek(s),b=Ek(o),[C,S]=d.useState(null),[j,_]=d.useState(null),P=d.useCallback(R=>{h.current!==R&&(h.current=R,S(R))},[]),I=d.useCallback(R=>{g.current!==R&&(g.current=R,_(R))},[]),M=d.useCallback(()=>{if(!h.current||!g.current)return;const R={placement:t,strategy:n,middleware:p};b.current&&(R.platform=b.current),IX(h.current,g.current,R).then(N=>{const Y={...N,isPositioned:!0};O.current&&!yh(x.current,Y)&&(x.current=Y,rs.flushSync(()=>{u(Y)}))})},[p,t,n,b]);Im(()=>{i===!1&&x.current.isPositioned&&(x.current.isPositioned=!1,u(R=>({...R,isPositioned:!1})))},[i]);const O=d.useRef(!1);Im(()=>(O.current=!0,()=>{O.current=!1}),[]),Im(()=>{if(C&&j){if(y.current)return y.current(C,j,M);M()}},[C,j,M,y]);const A=d.useMemo(()=>({reference:h,floating:g,setReference:P,setFloating:I}),[P,I]),D=d.useMemo(()=>({reference:C,floating:j}),[C,j]);return d.useMemo(()=>({...l,update:M,refs:A,elements:D,reference:P,floating:I}),[l,M,A,D,P,I])}var MX=typeof document<"u"?d.useLayoutEffect:d.useEffect;function OX(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){e.set(t,(e.get(t)||[]).filter(r=>r!==n))}}}const RX=d.createContext(null),AX=()=>d.useContext(RX);function DX(e){return(e==null?void 0:e.ownerDocument)||document}function TX(e){return DX(e).defaultView||window}function Xp(e){return e?e instanceof TX(e).Element:!1}const NX=hb["useInsertionEffect".toString()],$X=NX||(e=>e());function LX(e){const t=d.useRef(()=>{});return $X(()=>{t.current=e}),d.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;oOX())[0],[p,m]=d.useState(null),h=d.useCallback(S=>{const j=Xp(S)?{getBoundingClientRect:()=>S.getBoundingClientRect(),contextElement:S}:S;o.refs.setReference(j)},[o.refs]),g=d.useCallback(S=>{(Xp(S)||S===null)&&(i.current=S,m(S)),(Xp(o.refs.reference.current)||o.refs.reference.current===null||S!==null&&!Xp(S))&&o.refs.setReference(S)},[o.refs]),x=d.useMemo(()=>({...o.refs,setReference:g,setPositionReference:h,domReference:i}),[o.refs,g,h]),y=d.useMemo(()=>({...o.elements,domReference:p}),[o.elements,p]),b=LX(n),C=d.useMemo(()=>({...o,refs:x,elements:y,dataRef:l,nodeId:r,events:u,open:t,onOpenChange:b}),[o,r,u,t,b,x,y]);return MX(()=>{const S=s==null?void 0:s.nodesRef.current.find(j=>j.id===r);S&&(S.context=C)}),d.useMemo(()=>({...o,context:C,refs:x,reference:g,positionReference:h}),[o,x,C,g,h])}function FX({opened:e,floating:t,position:n,positionDependencies:r}){const[o,s]=d.useState(0);d.useEffect(()=>{if(t.refs.reference.current&&t.refs.floating.current)return _X(t.refs.reference.current,t.refs.floating.current,t.update)},[t.refs.reference.current,t.refs.floating.current,e,o,n]),Js(()=>{t.update()},r),Js(()=>{s(i=>i+1)},[e])}function BX(e){const t=[xX(e.offset)];return e.middlewares.shift&&t.push(bX({limiter:yX()})),e.middlewares.flip&&t.push(gX()),e.middlewares.inline&&t.push(vX()),t.push(PX({element:e.arrowRef,padding:e.arrowOffset})),t}function HX(e){const[t,n]=Jd({value:e.opened,defaultValue:e.defaultOpened,finalValue:!1,onChange:e.onChange}),r=()=>{var i;(i=e.onClose)==null||i.call(e),n(!1)},o=()=>{var i,l;t?((i=e.onClose)==null||i.call(e),n(!1)):((l=e.onOpen)==null||l.call(e),n(!0))},s=zX({placement:e.position,middleware:[...BX(e),...e.width==="target"?[CX({apply({rects:i}){var l,u;Object.assign((u=(l=s.refs.floating.current)==null?void 0:l.style)!=null?u:{},{width:`${i.reference.width}px`})}})]:[]]});return FX({opened:e.opened,position:e.position,positionDependencies:e.positionDependencies,floating:s}),Js(()=>{var i;(i=e.onPositionChange)==null||i.call(e,s.placement)},[s.placement]),Js(()=>{var i,l;e.opened?(l=e.onOpen)==null||l.call(e):(i=e.onClose)==null||i.call(e)},[e.opened]),{floating:s,controlled:typeof e.opened=="boolean",opened:t,onClose:r,onToggle:o}}const RE={context:"Popover component was not found in the tree",children:"Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported"},[WX,AE]=MG(RE.context);var VX=Object.defineProperty,UX=Object.defineProperties,GX=Object.getOwnPropertyDescriptors,Ch=Object.getOwnPropertySymbols,DE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,Mk=(e,t,n)=>t in e?VX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yp=(e,t)=>{for(var n in t||(t={}))DE.call(t,n)&&Mk(e,n,t[n]);if(Ch)for(var n of Ch(t))TE.call(t,n)&&Mk(e,n,t[n]);return e},qX=(e,t)=>UX(e,GX(t)),KX=(e,t)=>{var n={};for(var r in e)DE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ch)for(var r of Ch(e))t.indexOf(r)<0&&TE.call(e,r)&&(n[r]=e[r]);return n};const QX={refProp:"ref",popupType:"dialog"},NE=d.forwardRef((e,t)=>{const n=Nr("PopoverTarget",QX,e),{children:r,refProp:o,popupType:s}=n,i=KX(n,["children","refProp","popupType"]);if(!u6(r))throw new Error(RE.children);const l=i,u=AE(),p=Nf(u.reference,r.ref,t),m=u.withRoles?{"aria-haspopup":s,"aria-expanded":u.opened,"aria-controls":u.getDropdownId(),id:u.getTargetId()}:{};return d.cloneElement(r,Yp(qX(Yp(Yp(Yp({},l),m),u.targetProps),{className:f6(u.targetProps.className,l.className,r.props.className),[o]:p}),u.controlled?null:{onClick:u.onToggle}))});NE.displayName="@mantine/core/PopoverTarget";var XX=Co((e,{radius:t,shadow:n})=>({dropdown:{position:"absolute",backgroundColor:e.white,background:e.colorScheme==="dark"?e.colors.dark[6]:e.white,border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,padding:`${e.spacing.sm} ${e.spacing.md}`,boxShadow:e.shadows[n]||n||"none",borderRadius:e.fn.radius(t),"&:focus":{outline:0}},arrow:{backgroundColor:"inherit",border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`,zIndex:1}}));const YX=XX;var JX=Object.defineProperty,Ok=Object.getOwnPropertySymbols,ZX=Object.prototype.hasOwnProperty,eY=Object.prototype.propertyIsEnumerable,Rk=(e,t,n)=>t in e?JX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Oc=(e,t)=>{for(var n in t||(t={}))ZX.call(t,n)&&Rk(e,n,t[n]);if(Ok)for(var n of Ok(t))eY.call(t,n)&&Rk(e,n,t[n]);return e};const Ak={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function tY({transition:e,state:t,duration:n,timingFunction:r}){const o={transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof e=="string"?e in Wp?Oc(Oc(Oc({transitionProperty:Wp[e].transitionProperty},o),Wp[e].common),Wp[e][Ak[t]]):null:Oc(Oc(Oc({transitionProperty:e.transitionProperty},o),e.common),e[Ak[t]])}function nY({duration:e,exitDuration:t,timingFunction:n,mounted:r,onEnter:o,onExit:s,onEntered:i,onExited:l}){const u=Si(),p=b6(),m=u.respectReducedMotion?p:!1,[h,g]=d.useState(m?0:e),[x,y]=d.useState(r?"entered":"exited"),b=d.useRef(-1),C=S=>{const j=S?o:s,_=S?i:l;y(S?"pre-entering":"pre-exiting"),window.clearTimeout(b.current);const P=m?0:S?e:t;if(g(P),P===0)typeof j=="function"&&j(),typeof _=="function"&&_(),y(S?"entered":"exited");else{const I=window.setTimeout(()=>{typeof j=="function"&&j(),y(S?"entering":"exiting")},10);b.current=window.setTimeout(()=>{window.clearTimeout(I),typeof _=="function"&&_(),y(S?"entered":"exited")},P)}};return Js(()=>{C(r)},[r]),d.useEffect(()=>()=>window.clearTimeout(b.current),[]),{transitionDuration:h,transitionStatus:x,transitionTimingFunction:n||u.transitionTimingFunction}}function $E({keepMounted:e,transition:t,duration:n=250,exitDuration:r=n,mounted:o,children:s,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m}){const{transitionDuration:h,transitionStatus:g,transitionTimingFunction:x}=nY({mounted:o,exitDuration:r,duration:n,timingFunction:i,onExit:l,onEntered:u,onEnter:p,onExited:m});return h===0?o?H.createElement(H.Fragment,null,s({})):e?s({display:"none"}):null:g==="exited"?e?s({display:"none"}):null:H.createElement(H.Fragment,null,s(tY({transition:t,duration:h,state:g,timingFunction:x})))}$E.displayName="@mantine/core/Transition";function LE({children:e,active:t=!0,refProp:n="ref"}){const r=uq(t),o=Nf(r,e==null?void 0:e.ref);return u6(e)?d.cloneElement(e,{[n]:o}):e}LE.displayName="@mantine/core/FocusTrap";var rY=Object.defineProperty,oY=Object.defineProperties,sY=Object.getOwnPropertyDescriptors,Dk=Object.getOwnPropertySymbols,aY=Object.prototype.hasOwnProperty,iY=Object.prototype.propertyIsEnumerable,Tk=(e,t,n)=>t in e?rY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$i=(e,t)=>{for(var n in t||(t={}))aY.call(t,n)&&Tk(e,n,t[n]);if(Dk)for(var n of Dk(t))iY.call(t,n)&&Tk(e,n,t[n]);return e},Jp=(e,t)=>oY(e,sY(t));function Nk(e,t,n,r){return e==="center"||r==="center"?{top:t}:e==="end"?{bottom:n}:e==="start"?{top:n}:{}}function $k(e,t,n,r,o){return e==="center"||r==="center"?{left:t}:e==="end"?{[o==="ltr"?"right":"left"]:n}:e==="start"?{[o==="ltr"?"left":"right"]:n}:{}}const lY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function cY({position:e,arrowSize:t,arrowOffset:n,arrowRadius:r,arrowPosition:o,arrowX:s,arrowY:i,dir:l}){const[u,p="center"]=e.split("-"),m={width:Ge(t),height:Ge(t),transform:"rotate(45deg)",position:"absolute",[lY[u]]:Ge(r)},h=Ge(-t/2);return u==="left"?Jp($i($i({},m),Nk(p,i,n,o)),{right:h,borderLeftColor:"transparent",borderBottomColor:"transparent"}):u==="right"?Jp($i($i({},m),Nk(p,i,n,o)),{left:h,borderRightColor:"transparent",borderTopColor:"transparent"}):u==="top"?Jp($i($i({},m),$k(p,s,n,o,l)),{bottom:h,borderTopColor:"transparent",borderLeftColor:"transparent"}):u==="bottom"?Jp($i($i({},m),$k(p,s,n,o,l)),{top:h,borderBottomColor:"transparent",borderRightColor:"transparent"}):{}}var uY=Object.defineProperty,dY=Object.defineProperties,fY=Object.getOwnPropertyDescriptors,wh=Object.getOwnPropertySymbols,zE=Object.prototype.hasOwnProperty,FE=Object.prototype.propertyIsEnumerable,Lk=(e,t,n)=>t in e?uY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,pY=(e,t)=>{for(var n in t||(t={}))zE.call(t,n)&&Lk(e,n,t[n]);if(wh)for(var n of wh(t))FE.call(t,n)&&Lk(e,n,t[n]);return e},mY=(e,t)=>dY(e,fY(t)),hY=(e,t)=>{var n={};for(var r in e)zE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&wh)for(var r of wh(e))t.indexOf(r)<0&&FE.call(e,r)&&(n[r]=e[r]);return n};const BE=d.forwardRef((e,t)=>{var n=e,{position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,visible:u,arrowX:p,arrowY:m}=n,h=hY(n,["position","arrowSize","arrowOffset","arrowRadius","arrowPosition","visible","arrowX","arrowY"]);const g=Si();return u?H.createElement("div",mY(pY({},h),{ref:t,style:cY({position:r,arrowSize:o,arrowOffset:s,arrowRadius:i,arrowPosition:l,dir:g.dir,arrowX:p,arrowY:m})})):null});BE.displayName="@mantine/core/FloatingArrow";var gY=Object.defineProperty,vY=Object.defineProperties,xY=Object.getOwnPropertyDescriptors,Sh=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,WE=Object.prototype.propertyIsEnumerable,zk=(e,t,n)=>t in e?gY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Rc=(e,t)=>{for(var n in t||(t={}))HE.call(t,n)&&zk(e,n,t[n]);if(Sh)for(var n of Sh(t))WE.call(t,n)&&zk(e,n,t[n]);return e},Zp=(e,t)=>vY(e,xY(t)),bY=(e,t)=>{var n={};for(var r in e)HE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Sh)for(var r of Sh(e))t.indexOf(r)<0&&WE.call(e,r)&&(n[r]=e[r]);return n};const yY={};function VE(e){var t;const n=Nr("PopoverDropdown",yY,e),{style:r,className:o,children:s,onKeyDownCapture:i}=n,l=bY(n,["style","className","children","onKeyDownCapture"]),u=AE(),{classes:p,cx:m}=YX({radius:u.radius,shadow:u.shadow},{name:u.__staticSelector,classNames:u.classNames,styles:u.styles,unstyled:u.unstyled,variant:u.variant}),h=rq({opened:u.opened,shouldReturnFocus:u.returnFocus}),g=u.withRoles?{"aria-labelledby":u.getTargetId(),id:u.getDropdownId(),role:"dialog"}:{};return u.disabled?null:H.createElement(V6,Zp(Rc({},u.portalProps),{withinPortal:u.withinPortal}),H.createElement($E,Zp(Rc({mounted:u.opened},u.transitionProps),{transition:u.transitionProps.transition||"fade",duration:(t=u.transitionProps.duration)!=null?t:150,keepMounted:u.keepMounted,exitDuration:typeof u.transitionProps.exitDuration=="number"?u.transitionProps.exitDuration:u.transitionProps.duration}),x=>{var y,b;return H.createElement(LE,{active:u.trapFocus},H.createElement(Go,Rc(Zp(Rc({},g),{tabIndex:-1,ref:u.floating,style:Zp(Rc(Rc({},r),x),{zIndex:u.zIndex,top:(y=u.y)!=null?y:0,left:(b=u.x)!=null?b:0,width:u.width==="target"?void 0:Ge(u.width)}),className:m(p.dropdown,o),onKeyDownCapture:RG(u.onClose,{active:u.closeOnEscape,onTrigger:h,onKeyDown:i}),"data-position":u.placement}),l),s,H.createElement(BE,{ref:u.arrowRef,arrowX:u.arrowX,arrowY:u.arrowY,visible:u.withArrow,position:u.placement,arrowSize:u.arrowSize,arrowRadius:u.arrowRadius,arrowOffset:u.arrowOffset,arrowPosition:u.arrowPosition,className:p.arrow})))}))}VE.displayName="@mantine/core/PopoverDropdown";function CY(e,t){if(e==="rtl"&&(t.includes("right")||t.includes("left"))){const[n,r]=t.split("-"),o=n==="right"?"left":"right";return r===void 0?o:`${o}-${r}`}return t}var Fk=Object.getOwnPropertySymbols,wY=Object.prototype.hasOwnProperty,SY=Object.prototype.propertyIsEnumerable,kY=(e,t)=>{var n={};for(var r in e)wY.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Fk)for(var r of Fk(e))t.indexOf(r)<0&&SY.call(e,r)&&(n[r]=e[r]);return n};const jY={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!1,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,clickOutsideEvents:["mousedown","touchstart"],zIndex:Ey("popover"),__staticSelector:"Popover",width:"max-content"};function $u(e){var t,n,r,o,s,i;const l=d.useRef(null),u=Nr("Popover",jY,e),{children:p,position:m,offset:h,onPositionChange:g,positionDependencies:x,opened:y,transitionProps:b,width:C,middlewares:S,withArrow:j,arrowSize:_,arrowOffset:P,arrowRadius:I,arrowPosition:M,unstyled:O,classNames:A,styles:D,closeOnClickOutside:R,withinPortal:N,portalProps:Y,closeOnEscape:F,clickOutsideEvents:V,trapFocus:Q,onClose:q,onOpen:z,onChange:G,zIndex:T,radius:B,shadow:X,id:re,defaultOpened:le,__staticSelector:se,withRoles:K,disabled:U,returnFocus:ee,variant:de,keepMounted:Z}=u,ue=kY(u,["children","position","offset","onPositionChange","positionDependencies","opened","transitionProps","width","middlewares","withArrow","arrowSize","arrowOffset","arrowRadius","arrowPosition","unstyled","classNames","styles","closeOnClickOutside","withinPortal","portalProps","closeOnEscape","clickOutsideEvents","trapFocus","onClose","onOpen","onChange","zIndex","radius","shadow","id","defaultOpened","__staticSelector","withRoles","disabled","returnFocus","variant","keepMounted"]),[fe,ge]=d.useState(null),[_e,ye]=d.useState(null),pe=Oy(re),Te=Si(),Ae=HX({middlewares:S,width:C,position:CY(Te.dir,m),offset:typeof h=="number"?h+(j?_/2:0):h,arrowRef:l,arrowOffset:P,onPositionChange:g,positionDependencies:x,opened:y,defaultOpened:le,onChange:G,onOpen:z,onClose:q});ZG(()=>Ae.opened&&R&&Ae.onClose(),V,[fe,_e]);const qe=d.useCallback(tt=>{ge(tt),Ae.floating.reference(tt)},[Ae.floating.reference]),Pt=d.useCallback(tt=>{ye(tt),Ae.floating.floating(tt)},[Ae.floating.floating]);return H.createElement(WX,{value:{returnFocus:ee,disabled:U,controlled:Ae.controlled,reference:qe,floating:Pt,x:Ae.floating.x,y:Ae.floating.y,arrowX:(r=(n=(t=Ae.floating)==null?void 0:t.middlewareData)==null?void 0:n.arrow)==null?void 0:r.x,arrowY:(i=(s=(o=Ae.floating)==null?void 0:o.middlewareData)==null?void 0:s.arrow)==null?void 0:i.y,opened:Ae.opened,arrowRef:l,transitionProps:b,width:C,withArrow:j,arrowSize:_,arrowOffset:P,arrowRadius:I,arrowPosition:M,placement:Ae.floating.placement,trapFocus:Q,withinPortal:N,portalProps:Y,zIndex:T,radius:B,shadow:X,closeOnEscape:F,onClose:Ae.onClose,onToggle:Ae.onToggle,getTargetId:()=>`${pe}-target`,getDropdownId:()=>`${pe}-dropdown`,withRoles:K,targetProps:ue,__staticSelector:se,classNames:A,styles:D,unstyled:O,variant:de,keepMounted:Z}},p)}$u.Target=NE;$u.Dropdown=VE;$u.displayName="@mantine/core/Popover";var _Y=Object.defineProperty,kh=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,GE=Object.prototype.propertyIsEnumerable,Bk=(e,t,n)=>t in e?_Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,IY=(e,t)=>{for(var n in t||(t={}))UE.call(t,n)&&Bk(e,n,t[n]);if(kh)for(var n of kh(t))GE.call(t,n)&&Bk(e,n,t[n]);return e},PY=(e,t)=>{var n={};for(var r in e)UE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&kh)for(var r of kh(e))t.indexOf(r)<0&&GE.call(e,r)&&(n[r]=e[r]);return n};function EY(e){var t=e,{children:n,component:r="div",maxHeight:o=220,direction:s="column",id:i,innerRef:l,__staticSelector:u,styles:p,classNames:m,unstyled:h}=t,g=PY(t,["children","component","maxHeight","direction","id","innerRef","__staticSelector","styles","classNames","unstyled"]);const{classes:x}=uX(null,{name:u,styles:p,classNames:m,unstyled:h});return H.createElement($u.Dropdown,IY({p:0,onMouseDown:y=>y.preventDefault()},g),H.createElement("div",{style:{maxHeight:Ge(o),display:"flex"}},H.createElement(Go,{component:r||"div",id:`${i}-items`,"aria-labelledby":`${i}-label`,role:"listbox",onMouseDown:y=>y.preventDefault(),style:{flex:1,overflowY:r!==Wg?"auto":void 0},"data-combobox-popover":!0,tabIndex:-1,ref:l},H.createElement("div",{className:x.itemsWrapper,style:{flexDirection:s}},n))))}function Ki({opened:e,transitionProps:t={transition:"fade",duration:0},shadow:n,withinPortal:r,portalProps:o,children:s,__staticSelector:i,onDirectionChange:l,switchDirectionOnFlip:u,zIndex:p,dropdownPosition:m,positionDependencies:h=[],classNames:g,styles:x,unstyled:y,readOnly:b,variant:C}){return H.createElement($u,{unstyled:y,classNames:g,styles:x,width:"target",withRoles:!1,opened:e,middlewares:{flip:m==="flip",shift:!1},position:m==="flip"?"bottom":m,positionDependencies:h,zIndex:p,__staticSelector:i,withinPortal:r,portalProps:o,transitionProps:t,shadow:n,disabled:b,onPositionChange:S=>u&&(l==null?void 0:l(S==="top"?"column-reverse":"column")),variant:C},s)}Ki.Target=$u.Target;Ki.Dropdown=EY;var MY=Object.defineProperty,OY=Object.defineProperties,RY=Object.getOwnPropertyDescriptors,jh=Object.getOwnPropertySymbols,qE=Object.prototype.hasOwnProperty,KE=Object.prototype.propertyIsEnumerable,Hk=(e,t,n)=>t in e?MY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,em=(e,t)=>{for(var n in t||(t={}))qE.call(t,n)&&Hk(e,n,t[n]);if(jh)for(var n of jh(t))KE.call(t,n)&&Hk(e,n,t[n]);return e},AY=(e,t)=>OY(e,RY(t)),DY=(e,t)=>{var n={};for(var r in e)qE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&jh)for(var r of jh(e))t.indexOf(r)<0&&KE.call(e,r)&&(n[r]=e[r]);return n};function QE(e,t,n){const r=Nr(e,t,n),{label:o,description:s,error:i,required:l,classNames:u,styles:p,className:m,unstyled:h,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:C,wrapperProps:S,id:j,size:_,style:P,inputContainer:I,inputWrapperOrder:M,withAsterisk:O,variant:A}=r,D=DY(r,["label","description","error","required","classNames","styles","className","unstyled","__staticSelector","sx","errorProps","labelProps","descriptionProps","wrapperProps","id","size","style","inputContainer","inputWrapperOrder","withAsterisk","variant"]),R=Oy(j),{systemStyles:N,rest:Y}=zg(D),F=em({label:o,description:s,error:i,required:l,classNames:u,className:m,__staticSelector:g,sx:x,errorProps:y,labelProps:b,descriptionProps:C,unstyled:h,styles:p,id:R,size:_,style:P,inputContainer:I,inputWrapperOrder:M,withAsterisk:O,variant:A},S);return AY(em({},Y),{classNames:u,styles:p,unstyled:h,wrapperProps:em(em({},F),N),inputProps:{required:l,classNames:u,styles:p,unstyled:h,id:R,size:_,__staticSelector:g,error:i,variant:A}})}var TY=Co((e,t,{size:n})=>({label:{display:"inline-block",fontSize:Xt({size:n,sizes:e.fontSizes}),fontWeight:500,color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[9],wordBreak:"break-word",cursor:"default",WebkitTapHighlightColor:"transparent"},required:{color:e.fn.variant({variant:"filled",color:"red"}).background}}));const NY=TY;var $Y=Object.defineProperty,_h=Object.getOwnPropertySymbols,XE=Object.prototype.hasOwnProperty,YE=Object.prototype.propertyIsEnumerable,Wk=(e,t,n)=>t in e?$Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,LY=(e,t)=>{for(var n in t||(t={}))XE.call(t,n)&&Wk(e,n,t[n]);if(_h)for(var n of _h(t))YE.call(t,n)&&Wk(e,n,t[n]);return e},zY=(e,t)=>{var n={};for(var r in e)XE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&_h)for(var r of _h(e))t.indexOf(r)<0&&YE.call(e,r)&&(n[r]=e[r]);return n};const FY={labelElement:"label",size:"sm"},Fy=d.forwardRef((e,t)=>{const n=Nr("InputLabel",FY,e),{labelElement:r,children:o,required:s,size:i,classNames:l,styles:u,unstyled:p,className:m,htmlFor:h,__staticSelector:g,variant:x,onMouseDown:y}=n,b=zY(n,["labelElement","children","required","size","classNames","styles","unstyled","className","htmlFor","__staticSelector","variant","onMouseDown"]),{classes:C,cx:S}=NY(null,{name:["InputWrapper",g],classNames:l,styles:u,unstyled:p,variant:x,size:i});return H.createElement(Go,LY({component:r,ref:t,className:S(C.label,m),htmlFor:r==="label"?h:void 0,onMouseDown:j=>{y==null||y(j),!j.defaultPrevented&&j.detail>1&&j.preventDefault()}},b),o,s&&H.createElement("span",{className:C.required,"aria-hidden":!0}," *"))});Fy.displayName="@mantine/core/InputLabel";var BY=Co((e,t,{size:n})=>({error:{wordBreak:"break-word",color:e.fn.variant({variant:"filled",color:"red"}).background,fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${Ge(2)})`,lineHeight:1.2,display:"block"}}));const HY=BY;var WY=Object.defineProperty,Ih=Object.getOwnPropertySymbols,JE=Object.prototype.hasOwnProperty,ZE=Object.prototype.propertyIsEnumerable,Vk=(e,t,n)=>t in e?WY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,VY=(e,t)=>{for(var n in t||(t={}))JE.call(t,n)&&Vk(e,n,t[n]);if(Ih)for(var n of Ih(t))ZE.call(t,n)&&Vk(e,n,t[n]);return e},UY=(e,t)=>{var n={};for(var r in e)JE.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ih)for(var r of Ih(e))t.indexOf(r)<0&&ZE.call(e,r)&&(n[r]=e[r]);return n};const GY={size:"sm"},By=d.forwardRef((e,t)=>{const n=Nr("InputError",GY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=UY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=HY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(vu,VY({className:x(g.error,o),ref:t},h),r)});By.displayName="@mantine/core/InputError";var qY=Co((e,t,{size:n})=>({description:{wordBreak:"break-word",color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6],fontSize:`calc(${Xt({size:n,sizes:e.fontSizes})} - ${Ge(2)})`,lineHeight:1.2,display:"block"}}));const KY=qY;var QY=Object.defineProperty,Ph=Object.getOwnPropertySymbols,eM=Object.prototype.hasOwnProperty,tM=Object.prototype.propertyIsEnumerable,Uk=(e,t,n)=>t in e?QY(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XY=(e,t)=>{for(var n in t||(t={}))eM.call(t,n)&&Uk(e,n,t[n]);if(Ph)for(var n of Ph(t))tM.call(t,n)&&Uk(e,n,t[n]);return e},YY=(e,t)=>{var n={};for(var r in e)eM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ph)for(var r of Ph(e))t.indexOf(r)<0&&tM.call(e,r)&&(n[r]=e[r]);return n};const JY={size:"sm"},Hy=d.forwardRef((e,t)=>{const n=Nr("InputDescription",JY,e),{children:r,className:o,classNames:s,styles:i,unstyled:l,size:u,__staticSelector:p,variant:m}=n,h=YY(n,["children","className","classNames","styles","unstyled","size","__staticSelector","variant"]),{classes:g,cx:x}=KY(null,{name:["InputWrapper",p],classNames:s,styles:i,unstyled:l,variant:m,size:u});return H.createElement(vu,XY({color:"dimmed",className:x(g.description,o),ref:t,unstyled:l},h),r)});Hy.displayName="@mantine/core/InputDescription";const nM=d.createContext({offsetBottom:!1,offsetTop:!1,describedBy:void 0}),ZY=nM.Provider,eJ=()=>d.useContext(nM);function tJ(e,{hasDescription:t,hasError:n}){const r=e.findIndex(u=>u==="input"),o=e[r-1],s=e[r+1];return{offsetBottom:t&&s==="description"||n&&s==="error",offsetTop:t&&o==="description"||n&&o==="error"}}var nJ=Object.defineProperty,rJ=Object.defineProperties,oJ=Object.getOwnPropertyDescriptors,Gk=Object.getOwnPropertySymbols,sJ=Object.prototype.hasOwnProperty,aJ=Object.prototype.propertyIsEnumerable,qk=(e,t,n)=>t in e?nJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iJ=(e,t)=>{for(var n in t||(t={}))sJ.call(t,n)&&qk(e,n,t[n]);if(Gk)for(var n of Gk(t))aJ.call(t,n)&&qk(e,n,t[n]);return e},lJ=(e,t)=>rJ(e,oJ(t)),cJ=Co(e=>({root:lJ(iJ({},e.fn.fontStyles()),{lineHeight:e.lineHeight})}));const uJ=cJ;var dJ=Object.defineProperty,fJ=Object.defineProperties,pJ=Object.getOwnPropertyDescriptors,Eh=Object.getOwnPropertySymbols,rM=Object.prototype.hasOwnProperty,oM=Object.prototype.propertyIsEnumerable,Kk=(e,t,n)=>t in e?dJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Li=(e,t)=>{for(var n in t||(t={}))rM.call(t,n)&&Kk(e,n,t[n]);if(Eh)for(var n of Eh(t))oM.call(t,n)&&Kk(e,n,t[n]);return e},Qk=(e,t)=>fJ(e,pJ(t)),mJ=(e,t)=>{var n={};for(var r in e)rM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Eh)for(var r of Eh(e))t.indexOf(r)<0&&oM.call(e,r)&&(n[r]=e[r]);return n};const hJ={labelElement:"label",size:"sm",inputContainer:e=>e,inputWrapperOrder:["label","description","input","error"]},sM=d.forwardRef((e,t)=>{const n=Nr("InputWrapper",hJ,e),{className:r,label:o,children:s,required:i,id:l,error:u,description:p,labelElement:m,labelProps:h,descriptionProps:g,errorProps:x,classNames:y,styles:b,size:C,inputContainer:S,__staticSelector:j,unstyled:_,inputWrapperOrder:P,withAsterisk:I,variant:M}=n,O=mJ(n,["className","label","children","required","id","error","description","labelElement","labelProps","descriptionProps","errorProps","classNames","styles","size","inputContainer","__staticSelector","unstyled","inputWrapperOrder","withAsterisk","variant"]),{classes:A,cx:D}=uJ(null,{classNames:y,styles:b,name:["InputWrapper",j],unstyled:_,variant:M,size:C}),R={classNames:y,styles:b,unstyled:_,size:C,variant:M,__staticSelector:j},N=typeof I=="boolean"?I:i,Y=l?`${l}-error`:x==null?void 0:x.id,F=l?`${l}-description`:g==null?void 0:g.id,Q=`${!!u&&typeof u!="boolean"?Y:""} ${p?F:""}`,q=Q.trim().length>0?Q.trim():void 0,z=o&&H.createElement(Fy,Li(Li({key:"label",labelElement:m,id:l?`${l}-label`:void 0,htmlFor:l,required:N},R),h),o),G=p&&H.createElement(Hy,Qk(Li(Li({key:"description"},g),R),{size:(g==null?void 0:g.size)||R.size,id:(g==null?void 0:g.id)||F}),p),T=H.createElement(d.Fragment,{key:"input"},S(s)),B=typeof u!="boolean"&&u&&H.createElement(By,Qk(Li(Li({},x),R),{size:(x==null?void 0:x.size)||R.size,key:"error",id:(x==null?void 0:x.id)||Y}),u),X=P.map(re=>{switch(re){case"label":return z;case"input":return T;case"description":return G;case"error":return B;default:return null}});return H.createElement(ZY,{value:Li({describedBy:q},tJ(P,{hasDescription:!!G,hasError:!!B}))},H.createElement(Go,Li({className:D(A.root,r),ref:t},O),X))});sM.displayName="@mantine/core/InputWrapper";var gJ=Object.defineProperty,Mh=Object.getOwnPropertySymbols,aM=Object.prototype.hasOwnProperty,iM=Object.prototype.propertyIsEnumerable,Xk=(e,t,n)=>t in e?gJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vJ=(e,t)=>{for(var n in t||(t={}))aM.call(t,n)&&Xk(e,n,t[n]);if(Mh)for(var n of Mh(t))iM.call(t,n)&&Xk(e,n,t[n]);return e},xJ=(e,t)=>{var n={};for(var r in e)aM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Mh)for(var r of Mh(e))t.indexOf(r)<0&&iM.call(e,r)&&(n[r]=e[r]);return n};const bJ={},lM=d.forwardRef((e,t)=>{const n=Nr("InputPlaceholder",bJ,e),{sx:r}=n,o=xJ(n,["sx"]);return H.createElement(Go,vJ({component:"span",sx:[s=>s.fn.placeholderStyles(),...l6(r)],ref:t},o))});lM.displayName="@mantine/core/InputPlaceholder";var yJ=Object.defineProperty,CJ=Object.defineProperties,wJ=Object.getOwnPropertyDescriptors,Yk=Object.getOwnPropertySymbols,SJ=Object.prototype.hasOwnProperty,kJ=Object.prototype.propertyIsEnumerable,Jk=(e,t,n)=>t in e?yJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tm=(e,t)=>{for(var n in t||(t={}))SJ.call(t,n)&&Jk(e,n,t[n]);if(Yk)for(var n of Yk(t))kJ.call(t,n)&&Jk(e,n,t[n]);return e},n1=(e,t)=>CJ(e,wJ(t));const xs={xs:Ge(30),sm:Ge(36),md:Ge(42),lg:Ge(50),xl:Ge(60)},jJ=["default","filled","unstyled"];function _J({theme:e,variant:t}){return jJ.includes(t)?t==="default"?{border:`${Ge(1)} solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[4]}`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,transition:"border-color 100ms ease","&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:t==="filled"?{border:`${Ge(1)} solid transparent`,backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[1],"&:focus, &:focus-within":e.focusRingStyles.inputStyles(e)}:{borderWidth:0,color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,backgroundColor:"transparent",minHeight:Ge(28),outline:0,"&:focus, &:focus-within":{outline:"none",borderColor:"transparent"},"&:disabled":{backgroundColor:"transparent","&:focus, &:focus-within":{outline:"none",borderColor:"transparent"}}}:null}var IJ=Co((e,{multiline:t,radius:n,invalid:r,rightSectionWidth:o,withRightSection:s,iconWidth:i,offsetBottom:l,offsetTop:u,pointer:p},{variant:m,size:h})=>{const g=e.fn.variant({variant:"filled",color:"red"}).background,x=m==="default"||m==="filled"?{minHeight:Xt({size:h,sizes:xs}),paddingLeft:`calc(${Xt({size:h,sizes:xs})} / 3)`,paddingRight:s?o||Xt({size:h,sizes:xs}):`calc(${Xt({size:h,sizes:xs})} / 3)`,borderRadius:e.fn.radius(n)}:m==="unstyled"&&s?{paddingRight:o||Xt({size:h,sizes:xs})}:null;return{wrapper:{position:"relative",marginTop:u?`calc(${e.spacing.xs} / 2)`:void 0,marginBottom:l?`calc(${e.spacing.xs} / 2)`:void 0,"&:has(input:disabled)":{"& .mantine-Input-rightSection":{display:"none"}}},input:n1(tm(tm(n1(tm({},e.fn.fontStyles()),{height:t?m==="unstyled"?void 0:"auto":Xt({size:h,sizes:xs}),WebkitTapHighlightColor:"transparent",lineHeight:t?e.lineHeight:`calc(${Xt({size:h,sizes:xs})} - ${Ge(2)})`,appearance:"none",resize:"none",boxSizing:"border-box",fontSize:Xt({size:h,sizes:e.fontSizes}),width:"100%",color:e.colorScheme==="dark"?e.colors.dark[0]:e.black,display:"block",textAlign:"left",cursor:p?"pointer":void 0}),_J({theme:e,variant:m})),x),{"&:disabled, &[data-disabled]":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,cursor:"not-allowed",pointerEvents:"none","&::placeholder":{color:e.colors.dark[2]}},"&[data-invalid]":{color:g,borderColor:g,"&::placeholder":{opacity:1,color:g}},"&[data-with-icon]":{paddingLeft:typeof i=="number"?Ge(i):Xt({size:h,sizes:xs})},"&::placeholder":n1(tm({},e.fn.placeholderStyles()),{opacity:1}),"&::-webkit-inner-spin-button, &::-webkit-outer-spin-button, &::-webkit-search-decoration, &::-webkit-search-cancel-button, &::-webkit-search-results-button, &::-webkit-search-results-decoration":{appearance:"none"},"&[type=number]":{MozAppearance:"textfield"}}),icon:{pointerEvents:"none",position:"absolute",zIndex:1,left:0,top:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",width:i?Ge(i):Xt({size:h,sizes:xs}),color:r?e.colors.red[e.colorScheme==="dark"?6:7]:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[5]},rightSection:{position:"absolute",top:0,bottom:0,right:0,display:"flex",alignItems:"center",justifyContent:"center",width:o||Xt({size:h,sizes:xs})}}});const PJ=IJ;var EJ=Object.defineProperty,MJ=Object.defineProperties,OJ=Object.getOwnPropertyDescriptors,Oh=Object.getOwnPropertySymbols,cM=Object.prototype.hasOwnProperty,uM=Object.prototype.propertyIsEnumerable,Zk=(e,t,n)=>t in e?EJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nm=(e,t)=>{for(var n in t||(t={}))cM.call(t,n)&&Zk(e,n,t[n]);if(Oh)for(var n of Oh(t))uM.call(t,n)&&Zk(e,n,t[n]);return e},ej=(e,t)=>MJ(e,OJ(t)),RJ=(e,t)=>{var n={};for(var r in e)cM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Oh)for(var r of Oh(e))t.indexOf(r)<0&&uM.call(e,r)&&(n[r]=e[r]);return n};const AJ={size:"sm",variant:"default"},ac=d.forwardRef((e,t)=>{const n=Nr("Input",AJ,e),{className:r,error:o,required:s,disabled:i,variant:l,icon:u,style:p,rightSectionWidth:m,iconWidth:h,rightSection:g,rightSectionProps:x,radius:y,size:b,wrapperProps:C,classNames:S,styles:j,__staticSelector:_,multiline:P,sx:I,unstyled:M,pointer:O}=n,A=RJ(n,["className","error","required","disabled","variant","icon","style","rightSectionWidth","iconWidth","rightSection","rightSectionProps","radius","size","wrapperProps","classNames","styles","__staticSelector","multiline","sx","unstyled","pointer"]),{offsetBottom:D,offsetTop:R,describedBy:N}=eJ(),{classes:Y,cx:F}=PJ({radius:y,multiline:P,invalid:!!o,rightSectionWidth:m?Ge(m):void 0,iconWidth:h,withRightSection:!!g,offsetBottom:D,offsetTop:R,pointer:O},{classNames:S,styles:j,name:["Input",_],unstyled:M,variant:l,size:b}),{systemStyles:V,rest:Q}=zg(A);return H.createElement(Go,nm(nm({className:F(Y.wrapper,r),sx:I,style:p},V),C),u&&H.createElement("div",{className:Y.icon},u),H.createElement(Go,ej(nm({component:"input"},Q),{ref:t,required:s,"aria-invalid":!!o,"aria-describedby":N,disabled:i,"data-disabled":i||void 0,"data-with-icon":!!u||void 0,"data-invalid":!!o||void 0,className:Y.input})),g&&H.createElement("div",ej(nm({},x),{className:Y.rightSection}),g))});ac.displayName="@mantine/core/Input";ac.Wrapper=sM;ac.Label=Fy;ac.Description=Hy;ac.Error=By;ac.Placeholder=lM;const Cu=ac;var DJ=Object.defineProperty,Rh=Object.getOwnPropertySymbols,dM=Object.prototype.hasOwnProperty,fM=Object.prototype.propertyIsEnumerable,tj=(e,t,n)=>t in e?DJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nj=(e,t)=>{for(var n in t||(t={}))dM.call(t,n)&&tj(e,n,t[n]);if(Rh)for(var n of Rh(t))fM.call(t,n)&&tj(e,n,t[n]);return e},TJ=(e,t)=>{var n={};for(var r in e)dM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Rh)for(var r of Rh(e))t.indexOf(r)<0&&fM.call(e,r)&&(n[r]=e[r]);return n};const NJ={multiple:!1},pM=d.forwardRef((e,t)=>{const n=Nr("FileButton",NJ,e),{onChange:r,children:o,multiple:s,accept:i,name:l,form:u,resetRef:p,disabled:m,capture:h,inputProps:g}=n,x=TJ(n,["onChange","children","multiple","accept","name","form","resetRef","disabled","capture","inputProps"]),y=d.useRef(),b=()=>{!m&&y.current.click()},C=j=>{r(s?Array.from(j.currentTarget.files):j.currentTarget.files[0]||null)};return x6(p,()=>{y.current.value=""}),H.createElement(H.Fragment,null,o(nj({onClick:b},x)),H.createElement("input",nj({style:{display:"none"},type:"file",accept:i,multiple:s,onChange:C,ref:Nf(t,y),name:l,form:u,capture:h},g)))});pM.displayName="@mantine/core/FileButton";const mM={xs:Ge(16),sm:Ge(22),md:Ge(26),lg:Ge(30),xl:Ge(36)},$J={xs:Ge(10),sm:Ge(12),md:Ge(14),lg:Ge(16),xl:Ge(18)};var LJ=Co((e,{disabled:t,radius:n,readOnly:r},{size:o,variant:s})=>({defaultValue:{display:"flex",alignItems:"center",backgroundColor:t?e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3]:e.colorScheme==="dark"?e.colors.dark[7]:s==="filled"?e.white:e.colors.gray[1],color:t?e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],height:Xt({size:o,sizes:mM}),paddingLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 1.5)`,paddingRight:t||r?Xt({size:o,sizes:e.spacing}):0,fontWeight:500,fontSize:Xt({size:o,sizes:$J}),borderRadius:Xt({size:n,sizes:e.radius}),cursor:t?"not-allowed":"default",userSelect:"none",maxWidth:`calc(100% - ${Ge(10)})`},defaultValueRemove:{color:e.colorScheme==="dark"?e.colors.dark[0]:e.colors.gray[7],marginLeft:`calc(${Xt({size:o,sizes:e.spacing})} / 6)`},defaultValueLabel:{display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}));const zJ=LJ;var FJ=Object.defineProperty,Ah=Object.getOwnPropertySymbols,hM=Object.prototype.hasOwnProperty,gM=Object.prototype.propertyIsEnumerable,rj=(e,t,n)=>t in e?FJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,BJ=(e,t)=>{for(var n in t||(t={}))hM.call(t,n)&&rj(e,n,t[n]);if(Ah)for(var n of Ah(t))gM.call(t,n)&&rj(e,n,t[n]);return e},HJ=(e,t)=>{var n={};for(var r in e)hM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ah)for(var r of Ah(e))t.indexOf(r)<0&&gM.call(e,r)&&(n[r]=e[r]);return n};const WJ={xs:16,sm:22,md:24,lg:26,xl:30};function vM(e){var t=e,{label:n,classNames:r,styles:o,className:s,onRemove:i,disabled:l,readOnly:u,size:p,radius:m="sm",variant:h,unstyled:g}=t,x=HJ(t,["label","classNames","styles","className","onRemove","disabled","readOnly","size","radius","variant","unstyled"]);const{classes:y,cx:b}=zJ({disabled:l,readOnly:u,radius:m},{name:"MultiSelect",classNames:r,styles:o,unstyled:g,size:p,variant:h});return H.createElement("div",BJ({className:b(y.defaultValue,s)},x),H.createElement("span",{className:y.defaultValueLabel},n),!l&&!u&&H.createElement(Y6,{"aria-hidden":!0,onMouseDown:i,size:WJ[p],radius:2,color:"blue",variant:"transparent",iconSize:"70%",className:y.defaultValueRemove,tabIndex:-1,unstyled:g}))}vM.displayName="@mantine/core/MultiSelect/DefaultValue";function VJ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,disableSelectedItemFiltering:i}){if(!t&&s.length===0)return e;if(!t){const u=[];for(let p=0;pm===e[p].value&&!e[p].disabled))&&u.push(e[p]);return u}const l=[];for(let u=0;up===e[u].value&&!e[u].disabled),e[u])&&l.push(e[u]),!(l.length>=n));u+=1);return l}var UJ=Object.defineProperty,Dh=Object.getOwnPropertySymbols,xM=Object.prototype.hasOwnProperty,bM=Object.prototype.propertyIsEnumerable,oj=(e,t,n)=>t in e?UJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,sj=(e,t)=>{for(var n in t||(t={}))xM.call(t,n)&&oj(e,n,t[n]);if(Dh)for(var n of Dh(t))bM.call(t,n)&&oj(e,n,t[n]);return e},GJ=(e,t)=>{var n={};for(var r in e)xM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Dh)for(var r of Dh(e))t.indexOf(r)<0&&bM.call(e,r)&&(n[r]=e[r]);return n};const qJ={xs:Ge(14),sm:Ge(18),md:Ge(20),lg:Ge(24),xl:Ge(28)};function KJ(e){var t=e,{size:n,error:r,style:o}=t,s=GJ(t,["size","error","style"]);const i=Si(),l=Xt({size:n,sizes:qJ});return H.createElement("svg",sj({viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:sj({color:r?i.colors.red[6]:i.colors.gray[6],width:l,height:l},o),"data-chevron":!0},s),H.createElement("path",{d:"M4.93179 5.43179C4.75605 5.60753 4.75605 5.89245 4.93179 6.06819C5.10753 6.24392 5.39245 6.24392 5.56819 6.06819L7.49999 4.13638L9.43179 6.06819C9.60753 6.24392 9.89245 6.24392 10.0682 6.06819C10.2439 5.89245 10.2439 5.60753 10.0682 5.43179L7.81819 3.18179C7.73379 3.0974 7.61933 3.04999 7.49999 3.04999C7.38064 3.04999 7.26618 3.0974 7.18179 3.18179L4.93179 5.43179ZM10.0682 9.56819C10.2439 9.39245 10.2439 9.10753 10.0682 8.93179C9.89245 8.75606 9.60753 8.75606 9.43179 8.93179L7.49999 10.8636L5.56819 8.93179C5.39245 8.75606 5.10753 8.75606 4.93179 8.93179C4.75605 9.10753 4.75605 9.39245 4.93179 9.56819L7.18179 11.8182C7.35753 11.9939 7.64245 11.9939 7.81819 11.8182L10.0682 9.56819Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"}))}var QJ=Object.defineProperty,XJ=Object.defineProperties,YJ=Object.getOwnPropertyDescriptors,aj=Object.getOwnPropertySymbols,JJ=Object.prototype.hasOwnProperty,ZJ=Object.prototype.propertyIsEnumerable,ij=(e,t,n)=>t in e?QJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eZ=(e,t)=>{for(var n in t||(t={}))JJ.call(t,n)&&ij(e,n,t[n]);if(aj)for(var n of aj(t))ZJ.call(t,n)&&ij(e,n,t[n]);return e},tZ=(e,t)=>XJ(e,YJ(t));function yM({shouldClear:e,clearButtonProps:t,onClear:n,size:r,error:o}){return e?H.createElement(Y6,tZ(eZ({},t),{variant:"transparent",onClick:n,size:r,onMouseDown:s=>s.preventDefault()})):H.createElement(KJ,{error:o,size:r})}yM.displayName="@mantine/core/SelectRightSection";var nZ=Object.defineProperty,rZ=Object.defineProperties,oZ=Object.getOwnPropertyDescriptors,Th=Object.getOwnPropertySymbols,CM=Object.prototype.hasOwnProperty,wM=Object.prototype.propertyIsEnumerable,lj=(e,t,n)=>t in e?nZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,r1=(e,t)=>{for(var n in t||(t={}))CM.call(t,n)&&lj(e,n,t[n]);if(Th)for(var n of Th(t))wM.call(t,n)&&lj(e,n,t[n]);return e},cj=(e,t)=>rZ(e,oZ(t)),sZ=(e,t)=>{var n={};for(var r in e)CM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Th)for(var r of Th(e))t.indexOf(r)<0&&wM.call(e,r)&&(n[r]=e[r]);return n};function SM(e){var t=e,{styles:n,rightSection:r,rightSectionWidth:o,theme:s}=t,i=sZ(t,["styles","rightSection","rightSectionWidth","theme"]);if(r)return{rightSection:r,rightSectionWidth:o,styles:n};const l=typeof n=="function"?n(s):n;return{rightSection:!i.readOnly&&!(i.disabled&&i.shouldClear)&&H.createElement(yM,r1({},i)),styles:cj(r1({},l),{rightSection:cj(r1({},l==null?void 0:l.rightSection),{pointerEvents:i.shouldClear?void 0:"none"})})}}var aZ=Object.defineProperty,iZ=Object.defineProperties,lZ=Object.getOwnPropertyDescriptors,uj=Object.getOwnPropertySymbols,cZ=Object.prototype.hasOwnProperty,uZ=Object.prototype.propertyIsEnumerable,dj=(e,t,n)=>t in e?aZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dZ=(e,t)=>{for(var n in t||(t={}))cZ.call(t,n)&&dj(e,n,t[n]);if(uj)for(var n of uj(t))uZ.call(t,n)&&dj(e,n,t[n]);return e},fZ=(e,t)=>iZ(e,lZ(t)),pZ=Co((e,{invalid:t},{size:n})=>({wrapper:{position:"relative","&:has(input:disabled)":{cursor:"not-allowed",pointerEvents:"none","& .mantine-MultiSelect-input":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.colors.gray[1],color:e.colors.dark[2],opacity:.6,"&::placeholder":{color:e.colors.dark[2]}},"& .mantine-MultiSelect-defaultValue":{backgroundColor:e.colorScheme==="dark"?e.colors.dark[5]:e.colors.gray[3],color:e.colorScheme==="dark"?e.colors.dark[1]:e.colors.gray[7]}}},values:{minHeight:`calc(${Xt({size:n,sizes:xs})} - ${Ge(2)})`,display:"flex",alignItems:"center",flexWrap:"wrap",marginLeft:`calc(-${e.spacing.xs} / 2)`,boxSizing:"border-box","&[data-clearable]":{marginRight:Xt({size:n,sizes:xs})}},value:{margin:`calc(${e.spacing.xs} / 2 - ${Ge(2)}) calc(${e.spacing.xs} / 2)`},searchInput:fZ(dZ({},e.fn.fontStyles()),{flex:1,minWidth:Ge(60),backgroundColor:"transparent",border:0,outline:0,fontSize:Xt({size:n,sizes:e.fontSizes}),padding:0,marginLeft:`calc(${e.spacing.xs} / 2)`,appearance:"none",color:"inherit",maxHeight:Xt({size:n,sizes:mM}),"&::placeholder":{opacity:1,color:t?e.colors.red[e.fn.primaryShade()]:e.colorScheme==="dark"?e.colors.dark[3]:e.colors.gray[5]},"&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}),searchInputEmpty:{width:"100%"},searchInputInputHidden:{flex:0,width:0,minWidth:0,margin:0,overflow:"hidden"},searchInputPointer:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}},input:{cursor:"pointer","&:disabled":{cursor:"not-allowed",pointerEvents:"none"}}}));const mZ=pZ;var hZ=Object.defineProperty,gZ=Object.defineProperties,vZ=Object.getOwnPropertyDescriptors,Nh=Object.getOwnPropertySymbols,kM=Object.prototype.hasOwnProperty,jM=Object.prototype.propertyIsEnumerable,fj=(e,t,n)=>t in e?hZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ac=(e,t)=>{for(var n in t||(t={}))kM.call(t,n)&&fj(e,n,t[n]);if(Nh)for(var n of Nh(t))jM.call(t,n)&&fj(e,n,t[n]);return e},pj=(e,t)=>gZ(e,vZ(t)),xZ=(e,t)=>{var n={};for(var r in e)kM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Nh)for(var r of Nh(e))t.indexOf(r)<0&&jM.call(e,r)&&(n[r]=e[r]);return n};function bZ(e,t,n){return t?!1:n.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function yZ(e,t){return!!e&&!t.some(n=>n.value.toLowerCase()===e.toLowerCase())}function mj(e,t){if(!Array.isArray(e))return;if(t.length===0)return[];const n=t.map(r=>typeof r=="object"?r.value:r);return e.filter(r=>n.includes(r))}const CZ={size:"sm",valueComponent:vM,itemComponent:Ay,transitionProps:{transition:"fade",duration:0},maxDropdownHeight:220,shadow:"sm",searchable:!1,filter:bZ,limit:1/0,clearSearchOnChange:!0,clearable:!1,clearSearchOnBlur:!1,disabled:!1,initiallyOpened:!1,creatable:!1,shouldCreate:yZ,switchDirectionOnFlip:!1,zIndex:Ey("popover"),selectOnBlur:!1,positionDependencies:[],dropdownPosition:"flip"},_M=d.forwardRef((e,t)=>{const n=Nr("MultiSelect",CZ,e),{className:r,style:o,required:s,label:i,description:l,size:u,error:p,classNames:m,styles:h,wrapperProps:g,value:x,defaultValue:y,data:b,onChange:C,valueComponent:S,itemComponent:j,id:_,transitionProps:P,maxDropdownHeight:I,shadow:M,nothingFound:O,onFocus:A,onBlur:D,searchable:R,placeholder:N,filter:Y,limit:F,clearSearchOnChange:V,clearable:Q,clearSearchOnBlur:q,variant:z,onSearchChange:G,searchValue:T,disabled:B,initiallyOpened:X,radius:re,icon:le,rightSection:se,rightSectionWidth:K,creatable:U,getCreateLabel:ee,shouldCreate:de,onCreate:Z,sx:ue,dropdownComponent:fe,onDropdownClose:ge,onDropdownOpen:_e,maxSelectedValues:ye,withinPortal:pe,portalProps:Te,switchDirectionOnFlip:Ae,zIndex:qe,selectOnBlur:Pt,name:tt,dropdownPosition:sn,errorProps:mt,labelProps:ct,descriptionProps:be,form:We,positionDependencies:Rt,onKeyDown:Ut,unstyled:ke,inputContainer:Ct,inputWrapperOrder:Ft,readOnly:Wt,withAsterisk:Le,clearButtonProps:Xe,hoverOnSearchChange:_n,disableSelectedItemFiltering:Me}=n,Ze=xZ(n,["className","style","required","label","description","size","error","classNames","styles","wrapperProps","value","defaultValue","data","onChange","valueComponent","itemComponent","id","transitionProps","maxDropdownHeight","shadow","nothingFound","onFocus","onBlur","searchable","placeholder","filter","limit","clearSearchOnChange","clearable","clearSearchOnBlur","variant","onSearchChange","searchValue","disabled","initiallyOpened","radius","icon","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","onCreate","sx","dropdownComponent","onDropdownClose","onDropdownOpen","maxSelectedValues","withinPortal","portalProps","switchDirectionOnFlip","zIndex","selectOnBlur","name","dropdownPosition","errorProps","labelProps","descriptionProps","form","positionDependencies","onKeyDown","unstyled","inputContainer","inputWrapperOrder","readOnly","withAsterisk","clearButtonProps","hoverOnSearchChange","disableSelectedItemFiltering"]),{classes:Ye,cx:dt,theme:Vt}=mZ({invalid:!!p},{name:"MultiSelect",classNames:m,styles:h,unstyled:ke,size:u,variant:z}),{systemStyles:xr,rest:yn}=zg(Ze),mn=d.useRef(),oo=d.useRef({}),Ar=Oy(_),[nr,rr]=d.useState(X),[or,Qr]=d.useState(-1),[Xo,so]=d.useState("column"),[ao,$s]=Jd({value:T,defaultValue:"",finalValue:void 0,onChange:G}),[Xr,fa]=d.useState(!1),{scrollIntoView:Ls,targetRef:Ua,scrollableRef:pa}=y6({duration:0,offset:5,cancelable:!1,isList:!0}),ne=U&&typeof ee=="function";let ae=null;const ve=b.map(Be=>typeof Be=="string"?{label:Be,value:Be}:Be),Pe=c6({data:ve}),[xe,pt]=Jd({value:mj(x,b),defaultValue:mj(y,b),finalValue:[],onChange:C}),it=d.useRef(!!ye&&ye{if(!Wt){const yt=xe.filter(Lt=>Lt!==Be);pt(yt),ye&&yt.length{$s(Be.currentTarget.value),!B&&!it.current&&R&&rr(!0)},wt=Be=>{typeof A=="function"&&A(Be),!B&&!it.current&&R&&rr(!0)},He=VJ({data:Pe,searchable:R,searchValue:ao,limit:F,filter:Y,value:xe,disableSelectedItemFiltering:Me});ne&&de(ao,Pe)&&(ae=ee(ao),He.push({label:ao,value:ao,creatable:!0}));const Ie=Math.min(or,He.length-1),et=(Be,yt,Lt)=>{let Qt=Be;for(;Lt(Qt);)if(Qt=yt(Qt),!He[Qt].disabled)return Qt;return Be};Js(()=>{Qr(_n&&ao?0:-1)},[ao,_n]),Js(()=>{!B&&xe.length>b.length&&rr(!1),ye&&xe.length=ye&&(it.current=!0,rr(!1))},[xe]);const Et=Be=>{if(!Wt)if(V&&$s(""),xe.includes(Be.value))Kt(Be.value);else{if(Be.creatable&&typeof Z=="function"){const yt=Z(Be.value);typeof yt<"u"&&yt!==null&&pt(typeof yt=="string"?[...xe,yt]:[...xe,yt.value])}else pt([...xe,Be.value]);xe.length===ye-1&&(it.current=!0,rr(!1)),He.length===1&&rr(!1)}},At=Be=>{typeof D=="function"&&D(Be),Pt&&He[Ie]&&nr&&Et(He[Ie]),q&&$s(""),rr(!1)},Ht=Be=>{if(Xr||(Ut==null||Ut(Be),Wt)||Be.key!=="Backspace"&&ye&&it.current)return;const yt=Xo==="column",Lt=()=>{Qr(Nn=>{var Jt;const vn=et(Nn,fn=>fn+1,fn=>fn{Qr(Nn=>{var Jt;const vn=et(Nn,fn=>fn-1,fn=>fn>0);return nr&&(Ua.current=oo.current[(Jt=He[vn])==null?void 0:Jt.value],Ls({alignment:yt?"start":"end"})),vn})};switch(Be.key){case"ArrowUp":{Be.preventDefault(),rr(!0),yt?Qt():Lt();break}case"ArrowDown":{Be.preventDefault(),rr(!0),yt?Lt():Qt();break}case"Enter":{Be.preventDefault(),He[Ie]&&nr?Et(He[Ie]):rr(!0);break}case" ":{R||(Be.preventDefault(),He[Ie]&&nr?Et(He[Ie]):rr(!0));break}case"Backspace":{xe.length>0&&ao.length===0&&(pt(xe.slice(0,-1)),rr(!0),ye&&(it.current=!1));break}case"Home":{if(!R){Be.preventDefault(),nr||rr(!0);const Nn=He.findIndex(Jt=>!Jt.disabled);Qr(Nn),Ls({alignment:yt?"end":"start"})}break}case"End":{if(!R){Be.preventDefault(),nr||rr(!0);const Nn=He.map(Jt=>!!Jt.disabled).lastIndexOf(!1);Qr(Nn),Ls({alignment:yt?"end":"start"})}break}case"Escape":rr(!1)}},Zt=xe.map(Be=>{let yt=Pe.find(Lt=>Lt.value===Be&&!Lt.disabled);return!yt&&ne&&(yt={value:Be,label:Be}),yt}).filter(Be=>!!Be).map((Be,yt)=>H.createElement(S,pj(Ac({},Be),{variant:z,disabled:B,className:Ye.value,readOnly:Wt,onRemove:Lt=>{Lt.preventDefault(),Lt.stopPropagation(),Kt(Be.value)},key:Be.value,size:u,styles:h,classNames:m,radius:re,index:yt}))),ln=Be=>xe.includes(Be),an=()=>{var Be;$s(""),pt([]),(Be=mn.current)==null||Be.focus(),ye&&(it.current=!1)},Yt=!Wt&&(He.length>0?nr:nr&&!!O);return Js(()=>{const Be=Yt?_e:ge;typeof Be=="function"&&Be()},[Yt]),H.createElement(Cu.Wrapper,Ac(Ac({required:s,id:Ar,label:i,error:p,description:l,size:u,className:r,style:o,classNames:m,styles:h,__staticSelector:"MultiSelect",sx:ue,errorProps:mt,descriptionProps:be,labelProps:ct,inputContainer:Ct,inputWrapperOrder:Ft,unstyled:ke,withAsterisk:Le,variant:z},xr),g),H.createElement(Ki,{opened:Yt,transitionProps:P,shadow:"sm",withinPortal:pe,portalProps:Te,__staticSelector:"MultiSelect",onDirectionChange:so,switchDirectionOnFlip:Ae,zIndex:qe,dropdownPosition:sn,positionDependencies:[...Rt,ao],classNames:m,styles:h,unstyled:ke,variant:z},H.createElement(Ki.Target,null,H.createElement("div",{className:Ye.wrapper,role:"combobox","aria-haspopup":"listbox","aria-owns":nr&&Yt?`${Ar}-items`:null,"aria-controls":Ar,"aria-expanded":nr,onMouseLeave:()=>Qr(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:tt,value:xe.join(","),form:We,disabled:B}),H.createElement(Cu,Ac({__staticSelector:"MultiSelect",style:{overflow:"hidden"},component:"div",multiline:!0,size:u,variant:z,disabled:B,error:p,required:s,radius:re,icon:le,unstyled:ke,onMouseDown:Be=>{var yt;Be.preventDefault(),!B&&!it.current&&rr(!nr),(yt=mn.current)==null||yt.focus()},classNames:pj(Ac({},m),{input:dt({[Ye.input]:!R},m==null?void 0:m.input)})},SM({theme:Vt,rightSection:se,rightSectionWidth:K,styles:h,size:u,shouldClear:Q&&xe.length>0,onClear:an,error:p,disabled:B,clearButtonProps:Xe,readOnly:Wt})),H.createElement("div",{className:Ye.values,"data-clearable":Q||void 0},Zt,H.createElement("input",Ac({ref:Nf(t,mn),type:"search",id:Ar,className:dt(Ye.searchInput,{[Ye.searchInputPointer]:!R,[Ye.searchInputInputHidden]:!nr&&xe.length>0||!R&&xe.length>0,[Ye.searchInputEmpty]:xe.length===0}),onKeyDown:Ht,value:ao,onChange:ht,onFocus:wt,onBlur:At,readOnly:!R||it.current||Wt,placeholder:xe.length===0?N:void 0,disabled:B,"data-mantine-stop-propagation":nr,autoComplete:"off",onCompositionStart:()=>fa(!0),onCompositionEnd:()=>fa(!1)},yn)))))),H.createElement(Ki.Dropdown,{component:fe||Wg,maxHeight:I,direction:Xo,id:Ar,innerRef:pa,__staticSelector:"MultiSelect",classNames:m,styles:h},H.createElement(Ry,{data:He,hovered:Ie,classNames:m,styles:h,uuid:Ar,__staticSelector:"MultiSelect",onItemHover:Qr,onItemSelect:Et,itemsRefs:oo,itemComponent:j,size:u,nothingFound:O,isItemSelected:ln,creatable:U&&!!ae,createLabel:ae,unstyled:ke,variant:z}))))});_M.displayName="@mantine/core/MultiSelect";var wZ=Object.defineProperty,SZ=Object.defineProperties,kZ=Object.getOwnPropertyDescriptors,$h=Object.getOwnPropertySymbols,IM=Object.prototype.hasOwnProperty,PM=Object.prototype.propertyIsEnumerable,hj=(e,t,n)=>t in e?wZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,o1=(e,t)=>{for(var n in t||(t={}))IM.call(t,n)&&hj(e,n,t[n]);if($h)for(var n of $h(t))PM.call(t,n)&&hj(e,n,t[n]);return e},jZ=(e,t)=>SZ(e,kZ(t)),_Z=(e,t)=>{var n={};for(var r in e)IM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&$h)for(var r of $h(e))t.indexOf(r)<0&&PM.call(e,r)&&(n[r]=e[r]);return n};const IZ={type:"text",size:"sm",__staticSelector:"TextInput"},EM=d.forwardRef((e,t)=>{const n=QE("TextInput",IZ,e),{inputProps:r,wrapperProps:o}=n,s=_Z(n,["inputProps","wrapperProps"]);return H.createElement(Cu.Wrapper,o1({},o),H.createElement(Cu,jZ(o1(o1({},r),s),{ref:t})))});EM.displayName="@mantine/core/TextInput";function PZ({data:e,searchable:t,limit:n,searchValue:r,filter:o,value:s,filterDataOnExactSearchMatch:i}){if(!t)return e;const l=s!=null&&e.find(p=>p.value===s)||null;if(l&&!i&&(l==null?void 0:l.label)===r){if(n){if(n>=e.length)return e;const p=e.indexOf(l),m=p+n,h=m-e.length;return h>0?e.slice(p-h):e.slice(p,m)}return e}const u=[];for(let p=0;p=n));p+=1);return u}var EZ=Co(()=>({input:{"&:not(:disabled)":{cursor:"pointer","&::selection":{backgroundColor:"transparent"}}}}));const MZ=EZ;var OZ=Object.defineProperty,RZ=Object.defineProperties,AZ=Object.getOwnPropertyDescriptors,Lh=Object.getOwnPropertySymbols,MM=Object.prototype.hasOwnProperty,OM=Object.prototype.propertyIsEnumerable,gj=(e,t,n)=>t in e?OZ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xd=(e,t)=>{for(var n in t||(t={}))MM.call(t,n)&&gj(e,n,t[n]);if(Lh)for(var n of Lh(t))OM.call(t,n)&&gj(e,n,t[n]);return e},s1=(e,t)=>RZ(e,AZ(t)),DZ=(e,t)=>{var n={};for(var r in e)MM.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Lh)for(var r of Lh(e))t.indexOf(r)<0&&OM.call(e,r)&&(n[r]=e[r]);return n};function TZ(e,t){return t.label.toLowerCase().trim().includes(e.toLowerCase().trim())}function NZ(e,t){return!!e&&!t.some(n=>n.label.toLowerCase()===e.toLowerCase())}const $Z={required:!1,size:"sm",shadow:"sm",itemComponent:Ay,transitionProps:{transition:"fade",duration:0},initiallyOpened:!1,filter:TZ,maxDropdownHeight:220,searchable:!1,clearable:!1,limit:1/0,disabled:!1,creatable:!1,shouldCreate:NZ,selectOnBlur:!1,switchDirectionOnFlip:!1,filterDataOnExactSearchMatch:!1,zIndex:Ey("popover"),positionDependencies:[],dropdownPosition:"flip"},Wy=d.forwardRef((e,t)=>{const n=QE("Select",$Z,e),{inputProps:r,wrapperProps:o,shadow:s,data:i,value:l,defaultValue:u,onChange:p,itemComponent:m,onKeyDown:h,onBlur:g,onFocus:x,transitionProps:y,initiallyOpened:b,unstyled:C,classNames:S,styles:j,filter:_,maxDropdownHeight:P,searchable:I,clearable:M,nothingFound:O,limit:A,disabled:D,onSearchChange:R,searchValue:N,rightSection:Y,rightSectionWidth:F,creatable:V,getCreateLabel:Q,shouldCreate:q,selectOnBlur:z,onCreate:G,dropdownComponent:T,onDropdownClose:B,onDropdownOpen:X,withinPortal:re,portalProps:le,switchDirectionOnFlip:se,zIndex:K,name:U,dropdownPosition:ee,allowDeselect:de,placeholder:Z,filterDataOnExactSearchMatch:ue,form:fe,positionDependencies:ge,readOnly:_e,clearButtonProps:ye,hoverOnSearchChange:pe}=n,Te=DZ(n,["inputProps","wrapperProps","shadow","data","value","defaultValue","onChange","itemComponent","onKeyDown","onBlur","onFocus","transitionProps","initiallyOpened","unstyled","classNames","styles","filter","maxDropdownHeight","searchable","clearable","nothingFound","limit","disabled","onSearchChange","searchValue","rightSection","rightSectionWidth","creatable","getCreateLabel","shouldCreate","selectOnBlur","onCreate","dropdownComponent","onDropdownClose","onDropdownOpen","withinPortal","portalProps","switchDirectionOnFlip","zIndex","name","dropdownPosition","allowDeselect","placeholder","filterDataOnExactSearchMatch","form","positionDependencies","readOnly","clearButtonProps","hoverOnSearchChange"]),{classes:Ae,cx:qe,theme:Pt}=MZ(),[tt,sn]=d.useState(b),[mt,ct]=d.useState(-1),be=d.useRef(),We=d.useRef({}),[Rt,Ut]=d.useState("column"),ke=Rt==="column",{scrollIntoView:Ct,targetRef:Ft,scrollableRef:Wt}=y6({duration:0,offset:5,cancelable:!1,isList:!0}),Le=de===void 0?M:de,Xe=ae=>{if(tt!==ae){sn(ae);const ve=ae?X:B;typeof ve=="function"&&ve()}},_n=V&&typeof Q=="function";let Me=null;const Ze=i.map(ae=>typeof ae=="string"?{label:ae,value:ae}:ae),Ye=c6({data:Ze}),[dt,Vt,xr]=Jd({value:l,defaultValue:u,finalValue:null,onChange:p}),yn=Ye.find(ae=>ae.value===dt),[mn,oo]=Jd({value:N,defaultValue:(yn==null?void 0:yn.label)||"",finalValue:void 0,onChange:R}),Ar=ae=>{oo(ae),I&&typeof R=="function"&&R(ae)},nr=()=>{var ae;_e||(Vt(null),xr||Ar(""),(ae=be.current)==null||ae.focus())};d.useEffect(()=>{const ae=Ye.find(ve=>ve.value===dt);ae?Ar(ae.label):(!_n||!dt)&&Ar("")},[dt]),d.useEffect(()=>{yn&&(!I||!tt)&&Ar(yn.label)},[yn==null?void 0:yn.label]);const rr=ae=>{if(!_e)if(Le&&(yn==null?void 0:yn.value)===ae.value)Vt(null),Xe(!1);else{if(ae.creatable&&typeof G=="function"){const ve=G(ae.value);typeof ve<"u"&&ve!==null&&Vt(typeof ve=="string"?ve:ve.value)}else Vt(ae.value);xr||Ar(ae.label),ct(-1),Xe(!1),be.current.focus()}},or=PZ({data:Ye,searchable:I,limit:A,searchValue:mn,filter:_,filterDataOnExactSearchMatch:ue,value:dt});_n&&q(mn,or)&&(Me=Q(mn),or.push({label:mn,value:mn,creatable:!0}));const Qr=(ae,ve,Pe)=>{let xe=ae;for(;Pe(xe);)if(xe=ve(xe),!or[xe].disabled)return xe;return ae};Js(()=>{ct(pe&&mn?0:-1)},[mn,pe]);const Xo=dt?or.findIndex(ae=>ae.value===dt):0,so=!_e&&(or.length>0?tt:tt&&!!O),ao=()=>{ct(ae=>{var ve;const Pe=Qr(ae,xe=>xe-1,xe=>xe>0);return Ft.current=We.current[(ve=or[Pe])==null?void 0:ve.value],so&&Ct({alignment:ke?"start":"end"}),Pe})},$s=()=>{ct(ae=>{var ve;const Pe=Qr(ae,xe=>xe+1,xe=>xewindow.setTimeout(()=>{var ae;Ft.current=We.current[(ae=or[Xo])==null?void 0:ae.value],Ct({alignment:ke?"end":"start"})},50);Js(()=>{so&&Xr()},[so]);const fa=ae=>{switch(typeof h=="function"&&h(ae),ae.key){case"ArrowUp":{ae.preventDefault(),tt?ke?ao():$s():(ct(Xo),Xe(!0),Xr());break}case"ArrowDown":{ae.preventDefault(),tt?ke?$s():ao():(ct(Xo),Xe(!0),Xr());break}case"Home":{if(!I){ae.preventDefault(),tt||Xe(!0);const ve=or.findIndex(Pe=>!Pe.disabled);ct(ve),so&&Ct({alignment:ke?"end":"start"})}break}case"End":{if(!I){ae.preventDefault(),tt||Xe(!0);const ve=or.map(Pe=>!!Pe.disabled).lastIndexOf(!1);ct(ve),so&&Ct({alignment:ke?"end":"start"})}break}case"Escape":{ae.preventDefault(),Xe(!1),ct(-1);break}case" ":{I||(ae.preventDefault(),or[mt]&&tt?rr(or[mt]):(Xe(!0),ct(Xo),Xr()));break}case"Enter":I||ae.preventDefault(),or[mt]&&tt&&(ae.preventDefault(),rr(or[mt]))}},Ls=ae=>{typeof g=="function"&&g(ae);const ve=Ye.find(Pe=>Pe.value===dt);z&&or[mt]&&tt&&rr(or[mt]),Ar((ve==null?void 0:ve.label)||""),Xe(!1)},Ua=ae=>{typeof x=="function"&&x(ae),I&&Xe(!0)},pa=ae=>{_e||(Ar(ae.currentTarget.value),M&&ae.currentTarget.value===""&&Vt(null),ct(-1),Xe(!0))},ne=()=>{_e||(Xe(!tt),dt&&!tt&&ct(Xo))};return H.createElement(Cu.Wrapper,s1(xd({},o),{__staticSelector:"Select"}),H.createElement(Ki,{opened:so,transitionProps:y,shadow:s,withinPortal:re,portalProps:le,__staticSelector:"Select",onDirectionChange:Ut,switchDirectionOnFlip:se,zIndex:K,dropdownPosition:ee,positionDependencies:[...ge,mn],classNames:S,styles:j,unstyled:C,variant:r.variant},H.createElement(Ki.Target,null,H.createElement("div",{role:"combobox","aria-haspopup":"listbox","aria-owns":so?`${r.id}-items`:null,"aria-controls":r.id,"aria-expanded":so,onMouseLeave:()=>ct(-1),tabIndex:-1},H.createElement("input",{type:"hidden",name:U,value:dt||"",form:fe,disabled:D}),H.createElement(Cu,xd(s1(xd(xd({autoComplete:"off",type:"search"},r),Te),{ref:Nf(t,be),onKeyDown:fa,__staticSelector:"Select",value:mn,placeholder:Z,onChange:pa,"aria-autocomplete":"list","aria-controls":so?`${r.id}-items`:null,"aria-activedescendant":mt>=0?`${r.id}-${mt}`:null,onMouseDown:ne,onBlur:Ls,onFocus:Ua,readOnly:!I||_e,disabled:D,"data-mantine-stop-propagation":so,name:null,classNames:s1(xd({},S),{input:qe({[Ae.input]:!I},S==null?void 0:S.input)})}),SM({theme:Pt,rightSection:Y,rightSectionWidth:F,styles:j,size:r.size,shouldClear:M&&!!yn,onClear:nr,error:o.error,clearButtonProps:ye,disabled:D,readOnly:_e}))))),H.createElement(Ki.Dropdown,{component:T||Wg,maxHeight:P,direction:Rt,id:r.id,innerRef:Wt,__staticSelector:"Select",classNames:S,styles:j},H.createElement(Ry,{data:or,hovered:mt,classNames:S,styles:j,isItemSelected:ae=>ae===dt,uuid:r.id,__staticSelector:"Select",onItemHover:ct,onItemSelect:rr,itemsRefs:We,itemComponent:m,size:r.size,nothingFound:O,creatable:_n&&!!Me,createLabel:Me,"aria-label":o.label,unstyled:C,variant:r.variant}))))});Wy.displayName="@mantine/core/Select";const zf=()=>{const[e,t,n,r,o,s,i,l,u,p,m,h,g,x,y,b,C,S,j,_,P,I,M,O,A,D,R,N,Y,F,V,Q,q,z,G,T,B,X,re,le,se,K,U,ee,de,Z,ue,fe,ge,_e,ye,pe,Te,Ae,qe,Pt,tt,sn,mt,ct,be,We,Rt,Ut,ke,Ct,Ft,Wt,Le,Xe,_n,Me,Ze,Ye,dt,Vt]=Ks("colors",["base.50","base.100","base.150","base.200","base.250","base.300","base.350","base.400","base.450","base.500","base.550","base.600","base.650","base.700","base.750","base.800","base.850","base.900","base.950","accent.50","accent.100","accent.150","accent.200","accent.250","accent.300","accent.350","accent.400","accent.450","accent.500","accent.550","accent.600","accent.650","accent.700","accent.750","accent.800","accent.850","accent.900","accent.950","baseAlpha.50","baseAlpha.100","baseAlpha.150","baseAlpha.200","baseAlpha.250","baseAlpha.300","baseAlpha.350","baseAlpha.400","baseAlpha.450","baseAlpha.500","baseAlpha.550","baseAlpha.600","baseAlpha.650","baseAlpha.700","baseAlpha.750","baseAlpha.800","baseAlpha.850","baseAlpha.900","baseAlpha.950","accentAlpha.50","accentAlpha.100","accentAlpha.150","accentAlpha.200","accentAlpha.250","accentAlpha.300","accentAlpha.350","accentAlpha.400","accentAlpha.450","accentAlpha.500","accentAlpha.550","accentAlpha.600","accentAlpha.650","accentAlpha.700","accentAlpha.750","accentAlpha.800","accentAlpha.850","accentAlpha.900","accentAlpha.950"]);return{base50:e,base100:t,base150:n,base200:r,base250:o,base300:s,base350:i,base400:l,base450:u,base500:p,base550:m,base600:h,base650:g,base700:x,base750:y,base800:b,base850:C,base900:S,base950:j,accent50:_,accent100:P,accent150:I,accent200:M,accent250:O,accent300:A,accent350:D,accent400:R,accent450:N,accent500:Y,accent550:F,accent600:V,accent650:Q,accent700:q,accent750:z,accent800:G,accent850:T,accent900:B,accent950:X,baseAlpha50:re,baseAlpha100:le,baseAlpha150:se,baseAlpha200:K,baseAlpha250:U,baseAlpha300:ee,baseAlpha350:de,baseAlpha400:Z,baseAlpha450:ue,baseAlpha500:fe,baseAlpha550:ge,baseAlpha600:_e,baseAlpha650:ye,baseAlpha700:pe,baseAlpha750:Te,baseAlpha800:Ae,baseAlpha850:qe,baseAlpha900:Pt,baseAlpha950:tt,accentAlpha50:sn,accentAlpha100:mt,accentAlpha150:ct,accentAlpha200:be,accentAlpha250:We,accentAlpha300:Rt,accentAlpha350:Ut,accentAlpha400:ke,accentAlpha450:Ct,accentAlpha500:Ft,accentAlpha550:Wt,accentAlpha600:Le,accentAlpha650:Xe,accentAlpha700:_n,accentAlpha750:Me,accentAlpha800:Ze,accentAlpha850:Ye,accentAlpha900:dt,accentAlpha950:Vt}},Ke=(e,t)=>n=>n==="light"?e:t,RM=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=zf(),{colorMode:b}=Ci(),[C]=Ks("shadows",["dark-lg"]),[S,j,_]=Ks("space",[1,2,6]),[P]=Ks("radii",["base"]),[I]=Ks("lineHeights",["base"]);return d.useCallback(()=>({label:{color:Ke(l,r)(b)},separatorLabel:{color:Ke(s,s)(b),"::after":{borderTopColor:Ke(r,l)(b)}},input:{border:"unset",backgroundColor:Ke(e,p)(b),borderRadius:P,borderStyle:"solid",borderWidth:"2px",borderColor:Ke(n,u)(b),color:Ke(p,t)(b),minHeight:"unset",lineHeight:I,height:"auto",paddingRight:0,paddingLeft:0,paddingInlineStart:j,paddingInlineEnd:_,paddingTop:S,paddingBottom:S,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(b)},"&:focus":{borderColor:Ke(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(b)},"&:focus-within":{borderColor:Ke(m,y)(b)},"&[data-disabled]":{backgroundColor:Ke(r,l)(b),color:Ke(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ke(t,p)(b),color:Ke(p,t)(b),button:{color:Ke(p,t)(b)},"&:hover":{backgroundColor:Ke(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,u)(b),borderColor:Ke(n,u)(b),boxShadow:C},item:{backgroundColor:Ke(n,u)(b),color:Ke(u,n)(b),padding:6,"&[data-hovered]":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)},"&[data-active]":{backgroundColor:Ke(r,l)(b),"&:hover":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)}},"&[data-selected]":{backgroundColor:Ke(g,y)(b),color:Ke(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ke(x,x)(b),color:Ke("white",e)(b)}},"&[data-disabled]":{color:Ke(s,i)(b),cursor:"not-allowed"}},rightSection:{width:32,button:{color:Ke(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,C,b,I,P,S,j,_])},AM=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,onChange:s,label:i,disabled:l,...u}=e,p=te(),[m,h]=d.useState(""),g=d.useCallback(C=>{C.shiftKey&&p(Vo(!0))},[p]),x=d.useCallback(C=>{C.shiftKey||p(Vo(!1))},[p]),y=d.useCallback(C=>{s&&s(C)},[s]),b=RM();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,children:a.jsxs(Kn,{ref:t,isDisabled:l,position:"static","data-testid":`select-${i||e.placeholder}`,children:[i&&a.jsx(Rr,{children:i}),a.jsx(Wy,{ref:o,disabled:l,searchValue:m,onSearchChange:h,onChange:y,onKeyDown:g,onKeyUp:x,searchable:n,maxDropdownHeight:300,styles:b,...u})]})})});AM.displayName="IAIMantineSearchableSelect";const tr=d.memo(AM),LZ=ce([we],({changeBoardModal:e})=>{const{isModalOpen:t,imagesToChange:n}=e;return{isModalOpen:t,imagesToChange:n}},je),zZ=()=>{const e=te(),[t,n]=d.useState(),{data:r,isFetching:o}=hf(),{imagesToChange:s,isModalOpen:i}=W(LZ),[l]=CD(),[u]=wD(),{t:p}=J(),m=d.useMemo(()=>{const y=[{label:p("boards.uncategorized"),value:"none"}];return(r??[]).forEach(b=>y.push({label:b.board_name,value:b.board_id})),y},[r,p]),h=d.useCallback(()=>{e(Pw()),e(gb(!1))},[e]),g=d.useCallback(()=>{!s.length||!t||(t==="none"?u({imageDTOs:s}):l({imageDTOs:s,board_id:t}),n(null),e(Pw()))},[l,e,s,u,t]),x=d.useRef(null);return a.jsx(Mf,{isOpen:i,onClose:h,leastDestructiveRef:x,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:p("boards.changeBoard")}),a.jsx(sa,{children:a.jsxs($,{sx:{flexDir:"column",gap:4},children:[a.jsxs(Se,{children:["Moving ",`${s.length}`," image",`${s.length>1?"s":""}`," to board:"]}),a.jsx(tr,{placeholder:p(o?"boards.loading":"boards.selectBoard"),disabled:o,onChange:y=>n(y),value:t,data:m})]})}),a.jsxs(Oa,{children:[a.jsx(Mt,{ref:x,onClick:h,children:p("boards.cancel")}),a.jsx(Mt,{colorScheme:"accent",onClick:g,ml:3,children:p("boards.move")})]})]})})})},FZ=d.memo(zZ),DM=e=>{const{label:t,isDisabled:n=!1,width:r="auto",formControlProps:o,formLabelProps:s,tooltip:i,helperText:l,...u}=e;return a.jsx(Fn,{label:i,hasArrow:!0,placement:"top",isDisabled:!i,children:a.jsx(Kn,{isDisabled:n,width:r,alignItems:"center",...o,children:a.jsxs($,{sx:{flexDir:"column",w:"full"},children:[a.jsxs($,{sx:{alignItems:"center",w:"full"},children:[t&&a.jsx(Rr,{my:1,flexGrow:1,sx:{cursor:n?"not-allowed":"pointer",...s==null?void 0:s.sx,pe:4},...s,children:t}),a.jsx(jy,{...u})]}),l&&a.jsx(FP,{children:a.jsx(Se,{variant:"subtext",children:l})})]})})})};DM.displayName="IAISwitch";const kr=d.memo(DM),BZ=e=>{const{t}=J(),{imageUsage:n,topMessage:r=t("gallery.currentlyInUse"),bottomMessage:o=t("gallery.featuresWillReset")}=e;return!n||!Qs(n)?null:a.jsxs(a.Fragment,{children:[a.jsx(Se,{children:r}),a.jsxs(_f,{sx:{paddingInlineStart:6},children:[n.isInitialImage&&a.jsx(ws,{children:t("common.img2img")}),n.isCanvasImage&&a.jsx(ws,{children:t("common.unifiedCanvas")}),n.isControlImage&&a.jsx(ws,{children:t("common.controlNet")}),n.isNodesImage&&a.jsx(ws,{children:t("common.nodeEditor")})]}),a.jsx(Se,{children:o})]})},TM=d.memo(BZ),HZ=ce([we,SD],(e,t)=>{const{system:n,config:r,deleteImageModal:o}=e,{shouldConfirmOnDelete:s}=n,{canRestoreDeletedImagesFromBin:i}=r,{imagesToDelete:l,isModalOpen:u}=o,p=(l??[]).map(({image_name:h})=>II(e,h)),m={isInitialImage:Qs(p,h=>h.isInitialImage),isCanvasImage:Qs(p,h=>h.isCanvasImage),isNodesImage:Qs(p,h=>h.isNodesImage),isControlImage:Qs(p,h=>h.isControlImage)};return{shouldConfirmOnDelete:s,canRestoreDeletedImagesFromBin:i,imagesToDelete:l,imagesUsage:t,isModalOpen:u,imageUsageSummary:m}},je),WZ=()=>{const e=te(),{t}=J(),{shouldConfirmOnDelete:n,canRestoreDeletedImagesFromBin:r,imagesToDelete:o,imagesUsage:s,isModalOpen:i,imageUsageSummary:l}=W(HZ),u=d.useCallback(g=>e(PI(!g.target.checked)),[e]),p=d.useCallback(()=>{e(Ew()),e(kD(!1))},[e]),m=d.useCallback(()=>{!o.length||!s.length||(e(Ew()),e(jD({imageDTOs:o,imagesUsage:s})))},[e,o,s]),h=d.useRef(null);return a.jsx(Mf,{isOpen:i,onClose:p,leastDestructiveRef:h,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:t("gallery.deleteImage")}),a.jsx(sa,{children:a.jsxs($,{direction:"column",gap:3,children:[a.jsx(TM,{imageUsage:l}),a.jsx(no,{}),a.jsx(Se,{children:t(r?"gallery.deleteImageBin":"gallery.deleteImagePermanent")}),a.jsx(Se,{children:t("common.areYouSure")}),a.jsx(kr,{label:t("common.dontAskMeAgain"),isChecked:!n,onChange:u})]})}),a.jsxs(Oa,{children:[a.jsx(Mt,{ref:h,onClick:p,children:"Cancel"}),a.jsx(Mt,{colorScheme:"error",onClick:m,ml:3,children:"Delete"})]})]})})})},VZ=d.memo(WZ),NM=Oe((e,t)=>{const{role:n,tooltip:r="",tooltipProps:o,isChecked:s,...i}=e;return a.jsx(Fn,{label:r,hasArrow:!0,...o,...o!=null&&o.placement?{placement:o.placement}:{placement:"top"},children:a.jsx(Pa,{ref:t,role:n,colorScheme:s?"accent":"base","data-testid":r,...i})})});NM.displayName="IAIIconButton";const ot=d.memo(NM);var $M={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},vj=H.createContext&&H.createContext($M),Qi=globalThis&&globalThis.__assign||function(){return Qi=Object.assign||function(e){for(var t,n=1,r=arguments.length;n{const t=W(i=>i.config.disabledTabs),n=W(i=>i.config.disabledFeatures),r=W(i=>i.config.disabledSDFeatures),o=d.useMemo(()=>n.includes(e)||r.includes(e)||t.includes(e),[n,r,t,e]),s=d.useMemo(()=>!(n.includes(e)||r.includes(e)||t.includes(e)),[n,r,t,e]);return{isFeatureDisabled:o,isFeatureEnabled:s}};function Ree(e){const{title:t,hotkey:n,description:r}=e;return a.jsxs(tl,{sx:{gridTemplateColumns:"auto max-content",justifyContent:"space-between",alignItems:"center"},children:[a.jsxs(tl,{children:[a.jsx(Se,{fontWeight:600,children:t}),r&&a.jsx(Se,{sx:{fontSize:"sm"},variant:"subtext",children:r})]}),a.jsx(De,{sx:{fontSize:"sm",fontWeight:600,px:2,py:1},children:n})]})}function Aee({children:e}){const{isOpen:t,onOpen:n,onClose:r}=Uo(),{t:o}=J(),s=[{title:o("hotkeys.invoke.title"),desc:o("hotkeys.invoke.desc"),hotkey:"Ctrl+Enter"},{title:o("hotkeys.cancel.title"),desc:o("hotkeys.cancel.desc"),hotkey:"Shift+X"},{title:o("hotkeys.focusPrompt.title"),desc:o("hotkeys.focusPrompt.desc"),hotkey:"Alt+A"},{title:o("hotkeys.toggleOptions.title"),desc:o("hotkeys.toggleOptions.desc"),hotkey:"O"},{title:o("hotkeys.toggleGallery.title"),desc:o("hotkeys.toggleGallery.desc"),hotkey:"G"},{title:o("hotkeys.maximizeWorkSpace.title"),desc:o("hotkeys.maximizeWorkSpace.desc"),hotkey:"F"},{title:o("hotkeys.changeTabs.title"),desc:o("hotkeys.changeTabs.desc"),hotkey:"1-5"}],i=[{title:o("hotkeys.setPrompt.title"),desc:o("hotkeys.setPrompt.desc"),hotkey:"P"},{title:o("hotkeys.setSeed.title"),desc:o("hotkeys.setSeed.desc"),hotkey:"S"},{title:o("hotkeys.setParameters.title"),desc:o("hotkeys.setParameters.desc"),hotkey:"A"},{title:o("hotkeys.upscale.title"),desc:o("hotkeys.upscale.desc"),hotkey:"Shift+U"},{title:o("hotkeys.showInfo.title"),desc:o("hotkeys.showInfo.desc"),hotkey:"I"},{title:o("hotkeys.sendToImageToImage.title"),desc:o("hotkeys.sendToImageToImage.desc"),hotkey:"Shift+I"},{title:o("hotkeys.deleteImage.title"),desc:o("hotkeys.deleteImage.desc"),hotkey:"Del"},{title:o("hotkeys.closePanels.title"),desc:o("hotkeys.closePanels.desc"),hotkey:"Esc"}],l=[{title:o("hotkeys.previousImage.title"),desc:o("hotkeys.previousImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextImage.title"),desc:o("hotkeys.nextImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.increaseGalleryThumbSize.title"),desc:o("hotkeys.increaseGalleryThumbSize.desc"),hotkey:"Shift+Up"},{title:o("hotkeys.decreaseGalleryThumbSize.title"),desc:o("hotkeys.decreaseGalleryThumbSize.desc"),hotkey:"Shift+Down"}],u=[{title:o("hotkeys.selectBrush.title"),desc:o("hotkeys.selectBrush.desc"),hotkey:"B"},{title:o("hotkeys.selectEraser.title"),desc:o("hotkeys.selectEraser.desc"),hotkey:"E"},{title:o("hotkeys.decreaseBrushSize.title"),desc:o("hotkeys.decreaseBrushSize.desc"),hotkey:"["},{title:o("hotkeys.increaseBrushSize.title"),desc:o("hotkeys.increaseBrushSize.desc"),hotkey:"]"},{title:o("hotkeys.decreaseBrushOpacity.title"),desc:o("hotkeys.decreaseBrushOpacity.desc"),hotkey:"Shift + ["},{title:o("hotkeys.increaseBrushOpacity.title"),desc:o("hotkeys.increaseBrushOpacity.desc"),hotkey:"Shift + ]"},{title:o("hotkeys.moveTool.title"),desc:o("hotkeys.moveTool.desc"),hotkey:"V"},{title:o("hotkeys.fillBoundingBox.title"),desc:o("hotkeys.fillBoundingBox.desc"),hotkey:"Shift + F"},{title:o("hotkeys.eraseBoundingBox.title"),desc:o("hotkeys.eraseBoundingBox.desc"),hotkey:"Delete / Backspace"},{title:o("hotkeys.colorPicker.title"),desc:o("hotkeys.colorPicker.desc"),hotkey:"C"},{title:o("hotkeys.toggleSnap.title"),desc:o("hotkeys.toggleSnap.desc"),hotkey:"N"},{title:o("hotkeys.quickToggleMove.title"),desc:o("hotkeys.quickToggleMove.desc"),hotkey:"Hold Space"},{title:o("hotkeys.toggleLayer.title"),desc:o("hotkeys.toggleLayer.desc"),hotkey:"Q"},{title:o("hotkeys.clearMask.title"),desc:o("hotkeys.clearMask.desc"),hotkey:"Shift+C"},{title:o("hotkeys.hideMask.title"),desc:o("hotkeys.hideMask.desc"),hotkey:"H"},{title:o("hotkeys.showHideBoundingBox.title"),desc:o("hotkeys.showHideBoundingBox.desc"),hotkey:"Shift+H"},{title:o("hotkeys.mergeVisible.title"),desc:o("hotkeys.mergeVisible.desc"),hotkey:"Shift+M"},{title:o("hotkeys.saveToGallery.title"),desc:o("hotkeys.saveToGallery.desc"),hotkey:"Shift+S"},{title:o("hotkeys.copyToClipboard.title"),desc:o("hotkeys.copyToClipboard.desc"),hotkey:"Ctrl+C"},{title:o("hotkeys.downloadImage.title"),desc:o("hotkeys.downloadImage.desc"),hotkey:"Shift+D"},{title:o("hotkeys.undoStroke.title"),desc:o("hotkeys.undoStroke.desc"),hotkey:"Ctrl+Z"},{title:o("hotkeys.redoStroke.title"),desc:o("hotkeys.redoStroke.desc"),hotkey:"Ctrl+Shift+Z, Ctrl+Y"},{title:o("hotkeys.resetView.title"),desc:o("hotkeys.resetView.desc"),hotkey:"R"},{title:o("hotkeys.previousStagingImage.title"),desc:o("hotkeys.previousStagingImage.desc"),hotkey:"Arrow Left"},{title:o("hotkeys.nextStagingImage.title"),desc:o("hotkeys.nextStagingImage.desc"),hotkey:"Arrow Right"},{title:o("hotkeys.acceptStagingImage.title"),desc:o("hotkeys.acceptStagingImage.desc"),hotkey:"Enter"}],p=[{title:o("hotkeys.addNodes.title"),desc:o("hotkeys.addNodes.desc"),hotkey:"Shift + A / Space"}],m=h=>a.jsx($,{flexDir:"column",gap:4,children:h.map((g,x)=>a.jsxs($,{flexDir:"column",px:2,gap:4,children:[a.jsx(Ree,{title:g.title,description:g.desc,hotkey:g.hotkey}),x{const{data:t}=_D(),n=d.useRef(null),r=eO(n);return a.jsxs($,{alignItems:"center",gap:5,ps:1,ref:n,children:[a.jsx(wi,{src:vb,alt:"invoke-ai-logo",sx:{w:"32px",h:"32px",minW:"32px",minH:"32px",userSelect:"none"}}),a.jsxs($,{sx:{gap:3,alignItems:"center"},children:[a.jsxs(Se,{sx:{fontSize:"xl",userSelect:"none"},children:["invoke ",a.jsx("strong",{children:"ai"})]}),a.jsx(yo,{children:e&&r&&t&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(Se,{sx:{fontWeight:600,marginTop:1,color:"base.300",fontSize:14},variant:"subtext",children:t.version})},"statusText")})]})]})},Bee=d.memo(Fee),tO=Oe((e,t)=>{const{tooltip:n,inputRef:r,label:o,disabled:s,required:i,...l}=e,u=RM();return a.jsx(Fn,{label:n,placement:"top",hasArrow:!0,children:a.jsxs(Kn,{ref:t,isRequired:i,isDisabled:s,position:"static","data-testid":`select-${o||e.placeholder}`,children:[a.jsx(Rr,{children:o}),a.jsx(Wy,{disabled:s,ref:r,styles:u,...l})]})})});tO.displayName="IAIMantineSelect";const Tr=d.memo(tO),Hee={ar:on.t("common.langArabic",{lng:"ar"}),nl:on.t("common.langDutch",{lng:"nl"}),en:on.t("common.langEnglish",{lng:"en"}),fr:on.t("common.langFrench",{lng:"fr"}),de:on.t("common.langGerman",{lng:"de"}),he:on.t("common.langHebrew",{lng:"he"}),it:on.t("common.langItalian",{lng:"it"}),ja:on.t("common.langJapanese",{lng:"ja"}),ko:on.t("common.langKorean",{lng:"ko"}),pl:on.t("common.langPolish",{lng:"pl"}),pt_BR:on.t("common.langBrPortuguese",{lng:"pt_BR"}),pt:on.t("common.langPortuguese",{lng:"pt"}),ru:on.t("common.langRussian",{lng:"ru"}),zh_CN:on.t("common.langSimplifiedChinese",{lng:"zh_CN"}),es:on.t("common.langSpanish",{lng:"es"}),uk:on.t("common.langUkranian",{lng:"ua"})},Wee={CONNECTED:"common.statusConnected",DISCONNECTED:"common.statusDisconnected",PROCESSING:"common.statusProcessing",ERROR:"common.statusError",LOADING_MODEL:"common.statusLoadingModel"},nO=ce(we,({system:e})=>e.language,je);function Vs(e){const{t}=J(),{label:n,textProps:r,useBadge:o=!1,badgeLabel:s=t("settings.experimental"),badgeProps:i,...l}=e;return a.jsxs($,{justifyContent:"space-between",py:1,children:[a.jsxs($,{gap:2,alignItems:"center",children:[a.jsx(Se,{sx:{fontSize:14,_dark:{color:"base.300"}},...r,children:n}),o&&a.jsx(Ha,{size:"xs",sx:{px:2,color:"base.700",bg:"accent.200",_dark:{bg:"accent.500",color:"base.200"}},...i,children:s})]}),a.jsx(kr,{...l})]})}const Vee=e=>a.jsx($,{sx:{flexDirection:"column",gap:2,p:4,borderRadius:"base",bg:"base.100",_dark:{bg:"base.900"}},children:e.children}),Fc=d.memo(Vee);function Uee(){const{t:e}=J(),t=te(),{data:n}=ID(void 0,{refetchOnMountOrArgChange:!0}),[r,{isLoading:o}]=PD(),{data:s}=Fa(),i=s&&(s.queue.in_progress>0||s.queue.pending>0),l=d.useCallback(()=>{i||r().unwrap().then(u=>{t(EI()),t(MI()),t($t({title:e("settings.intermediatesCleared",{count:u}),status:"info"}))}).catch(()=>{t($t({title:e("settings.intermediatesClearedFailed"),status:"error"}))})},[e,r,t,i]);return a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:e("settings.clearIntermediates")}),a.jsx(Mt,{tooltip:i?e("settings.clearIntermediatesDisabled"):void 0,colorScheme:"warning",onClick:l,isLoading:o,isDisabled:!n||i,children:e("settings.clearIntermediatesWithCount",{count:n??0})}),a.jsx(Se,{fontWeight:"bold",children:e("settings.clearIntermediatesDesc1")}),a.jsx(Se,{variant:"subtext",children:e("settings.clearIntermediatesDesc2")}),a.jsx(Se,{variant:"subtext",children:e("settings.clearIntermediatesDesc3")})]})}const Gee=()=>{const{base50:e,base100:t,base200:n,base300:r,base400:o,base500:s,base600:i,base700:l,base800:u,base900:p,accent200:m,accent300:h,accent400:g,accent500:x,accent600:y}=zf(),{colorMode:b}=Ci(),[C]=Ks("shadows",["dark-lg"]);return d.useCallback(()=>({label:{color:Ke(l,r)(b)},separatorLabel:{color:Ke(s,s)(b),"::after":{borderTopColor:Ke(r,l)(b)}},searchInput:{":placeholder":{color:Ke(r,l)(b)}},input:{backgroundColor:Ke(e,p)(b),borderWidth:"2px",borderColor:Ke(n,u)(b),color:Ke(p,t)(b),paddingRight:24,fontWeight:600,"&:hover":{borderColor:Ke(r,i)(b)},"&:focus":{borderColor:Ke(h,y)(b)},"&:is(:focus, :hover)":{borderColor:Ke(o,s)(b)},"&:focus-within":{borderColor:Ke(m,y)(b)},"&[data-disabled]":{backgroundColor:Ke(r,l)(b),color:Ke(i,o)(b),cursor:"not-allowed"}},value:{backgroundColor:Ke(n,u)(b),color:Ke(p,t)(b),button:{color:Ke(p,t)(b)},"&:hover":{backgroundColor:Ke(r,l)(b),cursor:"pointer"}},dropdown:{backgroundColor:Ke(n,u)(b),borderColor:Ke(n,u)(b),boxShadow:C},item:{backgroundColor:Ke(n,u)(b),color:Ke(u,n)(b),padding:6,"&[data-hovered]":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)},"&[data-active]":{backgroundColor:Ke(r,l)(b),"&:hover":{color:Ke(p,t)(b),backgroundColor:Ke(r,l)(b)}},"&[data-selected]":{backgroundColor:Ke(g,y)(b),color:Ke(e,t)(b),fontWeight:600,"&:hover":{backgroundColor:Ke(x,x)(b),color:Ke("white",e)(b)}},"&[data-disabled]":{color:Ke(s,i)(b),cursor:"not-allowed"}},rightSection:{width:24,padding:20,button:{color:Ke(p,t)(b)}}}),[m,h,g,x,y,t,n,r,o,e,s,i,l,u,p,C,b])},rO=Oe((e,t)=>{const{searchable:n=!0,tooltip:r,inputRef:o,label:s,disabled:i,...l}=e,u=te(),p=d.useCallback(g=>{g.shiftKey&&u(Vo(!0))},[u]),m=d.useCallback(g=>{g.shiftKey||u(Vo(!1))},[u]),h=Gee();return a.jsx(Fn,{label:r,placement:"top",hasArrow:!0,isOpen:!0,children:a.jsxs(Kn,{ref:t,isDisabled:i,position:"static",children:[s&&a.jsx(Rr,{children:s}),a.jsx(_M,{ref:o,disabled:i,onKeyDown:p,onKeyUp:m,searchable:n,maxDropdownHeight:300,styles:h,...l})]})})});rO.displayName="IAIMantineMultiSelect";const qee=d.memo(rO),Kee=Ro(tg,(e,t)=>({value:t,label:e})).sort((e,t)=>e.label.localeCompare(t.label));function Qee(){const e=te(),{t}=J(),n=W(o=>o.ui.favoriteSchedulers),r=d.useCallback(o=>{e(ED(o))},[e]);return a.jsx(qee,{label:t("settings.favoriteSchedulers"),value:n,data:Kee,onChange:r,clearable:!0,searchable:!0,maxSelectedValues:99,placeholder:t("settings.favoriteSchedulersPlaceholder")})}const Xee=ce([we],({system:e,ui:t})=>{const{shouldConfirmOnDelete:n,enableImageDebugging:r,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldEnableInformationalPopovers:p}=e,{shouldUseSliders:m,shouldShowProgressInViewer:h,shouldAutoChangeDimensions:g}=t;return{shouldConfirmOnDelete:n,enableImageDebugging:r,shouldUseSliders:m,shouldShowProgressInViewer:h,consoleLogLevel:o,shouldLogToConsole:s,shouldAntialiasProgressImage:i,shouldUseNSFWChecker:l,shouldUseWatermarker:u,shouldAutoChangeDimensions:g,shouldEnableInformationalPopovers:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),Yee=({children:e,config:t})=>{const n=te(),{t:r}=J(),[o,s]=d.useState(3),i=(t==null?void 0:t.shouldShowDeveloperSettings)??!0,l=(t==null?void 0:t.shouldShowResetWebUiText)??!0,u=(t==null?void 0:t.shouldShowClearIntermediates)??!0,p=(t==null?void 0:t.shouldShowLocalizationToggle)??!0;d.useEffect(()=>{i||n(Mw(!1))},[i,n]);const{isNSFWCheckerAvailable:m,isWatermarkerAvailable:h}=OI(void 0,{selectFromResult:({data:X})=>({isNSFWCheckerAvailable:(X==null?void 0:X.nsfw_methods.includes("nsfw_checker"))??!1,isWatermarkerAvailable:(X==null?void 0:X.watermarking_methods.includes("invisible_watermark"))??!1})}),{isOpen:g,onOpen:x,onClose:y}=Uo(),{isOpen:b,onOpen:C,onClose:S}=Uo(),{shouldConfirmOnDelete:j,enableImageDebugging:_,shouldUseSliders:P,shouldShowProgressInViewer:I,consoleLogLevel:M,shouldLogToConsole:O,shouldAntialiasProgressImage:A,shouldUseNSFWChecker:D,shouldUseWatermarker:R,shouldAutoChangeDimensions:N,shouldEnableInformationalPopovers:Y}=W(Xee),F=d.useCallback(()=>{Object.keys(window.localStorage).forEach(X=>{(MD.includes(X)||X.startsWith(OD))&&localStorage.removeItem(X)}),y(),C(),setInterval(()=>s(X=>X-1),1e3)},[y,C]);d.useEffect(()=>{o<=0&&window.location.reload()},[o]);const V=d.useCallback(X=>{n(RD(X))},[n]),Q=d.useCallback(X=>{n(AD(X))},[n]),q=d.useCallback(X=>{n(Mw(X.target.checked))},[n]),{colorMode:z,toggleColorMode:G}=Ci(),T=jn("localization").isFeatureEnabled,B=W(nO);return a.jsxs(a.Fragment,{children:[d.cloneElement(e,{onClick:x}),a.jsxs(ql,{isOpen:g,onClose:y,size:"2xl",isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Kl,{children:[a.jsx(ra,{bg:"none",children:r("common.settingsLabel")}),a.jsx(Rf,{}),a.jsx(sa,{children:a.jsxs($,{sx:{gap:4,flexDirection:"column"},children:[a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.general")}),a.jsx(Vs,{label:r("settings.confirmOnDelete"),isChecked:j,onChange:X=>n(PI(X.target.checked))})]}),a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.generation")}),a.jsx(Qee,{}),a.jsx(Vs,{label:"Enable NSFW Checker",isDisabled:!m,isChecked:D,onChange:X=>n(DD(X.target.checked))}),a.jsx(Vs,{label:"Enable Invisible Watermark",isDisabled:!h,isChecked:R,onChange:X=>n(TD(X.target.checked))})]}),a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.ui")}),a.jsx(Vs,{label:r("common.darkMode"),isChecked:z==="dark",onChange:G}),a.jsx(Vs,{label:r("settings.useSlidersForAll"),isChecked:P,onChange:X=>n(ND(X.target.checked))}),a.jsx(Vs,{label:r("settings.showProgressInViewer"),isChecked:I,onChange:X=>n(RI(X.target.checked))}),a.jsx(Vs,{label:r("settings.antialiasProgressImages"),isChecked:A,onChange:X=>n($D(X.target.checked))}),a.jsx(Vs,{label:r("settings.autoChangeDimensions"),isChecked:N,onChange:X=>n(LD(X.target.checked))}),p&&a.jsx(Tr,{disabled:!T,label:r("common.languagePickerLabel"),value:B,data:Object.entries(Hee).map(([X,re])=>({value:X,label:re})),onChange:Q}),a.jsx(Vs,{label:"Enable informational popovers",isChecked:Y,onChange:X=>n(zD(X.target.checked))})]}),i&&a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.developer")}),a.jsx(Vs,{label:r("settings.shouldLogToConsole"),isChecked:O,onChange:q}),a.jsx(Tr,{disabled:!O,label:r("settings.consoleLogLevel"),onChange:V,value:M,data:FD.concat()}),a.jsx(Vs,{label:r("settings.enableImageDebugging"),isChecked:_,onChange:X=>n(BD(X.target.checked))})]}),u&&a.jsx(Uee,{}),a.jsxs(Fc,{children:[a.jsx(xo,{size:"sm",children:r("settings.resetWebUI")}),a.jsx(Mt,{colorScheme:"error",onClick:F,children:r("settings.resetWebUI")}),l&&a.jsxs(a.Fragment,{children:[a.jsx(Se,{variant:"subtext",children:r("settings.resetWebUIDesc1")}),a.jsx(Se,{variant:"subtext",children:r("settings.resetWebUIDesc2")})]})]})]})}),a.jsx(Oa,{children:a.jsx(Mt,{onClick:y,children:r("common.close")})})]})]}),a.jsxs(ql,{closeOnOverlayClick:!1,isOpen:b,onClose:S,isCentered:!0,closeOnEsc:!1,children:[a.jsx(oa,{backdropFilter:"blur(40px)"}),a.jsxs(Kl,{children:[a.jsx(ra,{}),a.jsx(sa,{children:a.jsx($,{justifyContent:"center",children:a.jsx(Se,{fontSize:"lg",children:a.jsxs(Se,{children:[r("settings.resetComplete")," Reloading in ",o,"..."]})})})}),a.jsx(Oa,{})]})]})]})},Jee=d.memo(Yee),Zee=ce(we,({system:e})=>{const{isConnected:t,status:n}=e;return{isConnected:t,statusTranslationKey:Wee[n]}},je),Cj={ok:"green.400",working:"yellow.400",error:"red.400"},wj={ok:"green.600",working:"yellow.500",error:"red.500"},ete=()=>{const{isConnected:e,statusTranslationKey:t}=W(Zee),{t:n}=J(),r=d.useRef(null),{data:o}=Fa(),s=d.useMemo(()=>e?o!=null&&o.queue.in_progress?"working":"ok":"error",[o==null?void 0:o.queue.in_progress,e]),i=eO(r);return a.jsxs($,{ref:r,h:"full",px:2,alignItems:"center",gap:5,children:[a.jsx(yo,{children:i&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.15}},exit:{opacity:0,transition:{delay:.8}},children:a.jsx(Se,{sx:{fontSize:"sm",fontWeight:"600",pb:"1px",userSelect:"none",color:wj[s],_dark:{color:Cj[s]}},children:n(t)})},"statusText")}),a.jsx(Lr,{as:ree,sx:{boxSize:"0.5rem",color:wj[s],_dark:{color:Cj[s]}}})]})},tte=d.memo(ete),nte=()=>{const{t:e}=J(),t=jn("bugLink").isFeatureEnabled,n=jn("discordLink").isFeatureEnabled,r=jn("githubLink").isFeatureEnabled,o="http://github.com/invoke-ai/InvokeAI",s="https://discord.gg/ZmtBAhwWhy";return a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Bee,{}),a.jsx(ki,{}),a.jsx(tte,{}),a.jsxs(bg,{children:[a.jsx(yg,{as:ot,variant:"link","aria-label":e("accessibility.menu"),icon:a.jsx(tee,{}),sx:{boxSize:8}}),a.jsxs(Ul,{motionProps:fu,children:[a.jsxs(Xd,{title:e("common.communityLabel"),children:[r&&a.jsx(Wn,{as:"a",href:o,target:"_blank",icon:a.jsx(KZ,{}),children:e("common.githubLabel")}),t&&a.jsx(Wn,{as:"a",href:`${o}/issues`,target:"_blank",icon:a.jsx(nee,{}),children:e("common.reportBugLabel")}),n&&a.jsx(Wn,{as:"a",href:s,target:"_blank",icon:a.jsx(qZ,{}),children:e("common.discordLabel")})]}),a.jsxs(Xd,{title:e("common.settingsLabel"),children:[a.jsx(Aee,{children:a.jsx(Wn,{as:"button",icon:a.jsx(vee,{}),children:e("common.hotkeysLabel")})}),a.jsx(Jee,{children:a.jsx(Wn,{as:"button",icon:a.jsx(HM,{}),children:e("common.settingsLabel")})})]})]})]})]})},rte=d.memo(nte);/*! + * OverlayScrollbars + * Version: 2.2.1 + * + * Copyright (c) Rene Haas | KingSora. + * https://github.com/KingSora + * + * Released under the MIT license. + */function Dn(e,t){if(Xg(e))for(let n=0;nt(e[n],n,e));return e}function bo(e,t){const n=dl(t);if(la(t)||n){let o=n?"":{};if(e){const s=window.getComputedStyle(e,null);o=n?_j(e,s,t):t.reduce((i,l)=>(i[l]=_j(e,s,l),i),o)}return o}e&&Dn(us(t),o=>bte(e,o,t[o]))}const Gs=(e,t)=>{const{o:n,u:r,_:o}=e;let s=n,i;const l=(m,h)=>{const g=s,x=m,y=h||(r?!r(g,x):g!==x);return(y||o)&&(s=x,i=g),[s,y,i]};return[t?m=>l(t(s,i),m):l,m=>[s,!!m,i]]},Ff=()=>typeof window<"u",oO=Ff()&&Node.ELEMENT_NODE,{toString:ote,hasOwnProperty:a1}=Object.prototype,_i=e=>e===void 0,Qg=e=>e===null,ste=e=>_i(e)||Qg(e)?`${e}`:ote.call(e).replace(/^\[object (.+)\]$/,"$1").toLowerCase(),Yi=e=>typeof e=="number",dl=e=>typeof e=="string",Uy=e=>typeof e=="boolean",ia=e=>typeof e=="function",la=e=>Array.isArray(e),ef=e=>typeof e=="object"&&!la(e)&&!Qg(e),Xg=e=>{const t=!!e&&e.length,n=Yi(t)&&t>-1&&t%1==0;return la(e)||!ia(e)&&n?t>0&&ef(e)?t-1 in e:!0:!1},Nx=e=>{if(!e||!ef(e)||ste(e)!=="object")return!1;let t;const n="constructor",r=e[n],o=r&&r.prototype,s=a1.call(e,n),i=o&&a1.call(o,"isPrototypeOf");if(r&&!s&&!i)return!1;for(t in e);return _i(t)||a1.call(e,t)},zh=e=>{const t=HTMLElement;return e?t?e instanceof t:e.nodeType===oO:!1},Yg=e=>{const t=Element;return e?t?e instanceof t:e.nodeType===oO:!1},Gy=(e,t,n)=>e.indexOf(t,n),Un=(e,t,n)=>(!n&&!dl(t)&&Xg(t)?Array.prototype.push.apply(e,t):e.push(t),e),Yl=e=>{const t=Array.from,n=[];return t&&e?t(e):(e instanceof Set?e.forEach(r=>{Un(n,r)}):Dn(e,r=>{Un(n,r)}),n)},qy=e=>!!e&&e.length===0,Wa=(e,t,n)=>{Dn(e,o=>o&&o.apply(void 0,t||[])),!n&&(e.length=0)},Jg=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),us=e=>e?Object.keys(e):[],Sr=(e,t,n,r,o,s,i)=>{const l=[t,n,r,o,s,i];return(typeof e!="object"||Qg(e))&&!ia(e)&&(e={}),Dn(l,u=>{Dn(us(u),p=>{const m=u[p];if(e===m)return!0;const h=la(m);if(m&&(Nx(m)||h)){const g=e[p];let x=g;h&&!la(g)?x=[]:!h&&!Nx(g)&&(x={}),e[p]=Sr(x,m)}else e[p]=m})}),e},Ky=e=>{for(const t in e)return!1;return!0},sO=(e,t,n,r)=>{if(_i(r))return n?n[e]:t;n&&(dl(r)||Yi(r))&&(n[e]=r)},vo=(e,t,n)=>{if(_i(n))return e?e.getAttribute(t):null;e&&e.setAttribute(t,n)},zo=(e,t)=>{e&&e.removeAttribute(t)},$l=(e,t,n,r)=>{if(n){const o=vo(e,t)||"",s=new Set(o.split(" "));s[r?"add":"delete"](n);const i=Yl(s).join(" ").trim();vo(e,t,i)}},ate=(e,t,n)=>{const r=vo(e,t)||"";return new Set(r.split(" ")).has(n)},ea=(e,t)=>sO("scrollLeft",0,e,t),li=(e,t)=>sO("scrollTop",0,e,t),$x=Ff()&&Element.prototype,aO=(e,t)=>{const n=[],r=t?Yg(t)?t:null:document;return r?Un(n,r.querySelectorAll(e)):n},ite=(e,t)=>{const n=t?Yg(t)?t:null:document;return n?n.querySelector(e):null},Fh=(e,t)=>Yg(e)?($x.matches||$x.msMatchesSelector).call(e,t):!1,Qy=e=>e?Yl(e.childNodes):[],mi=e=>e?e.parentElement:null,qc=(e,t)=>{if(Yg(e)){const n=$x.closest;if(n)return n.call(e,t);do{if(Fh(e,t))return e;e=mi(e)}while(e)}return null},lte=(e,t,n)=>{const r=e&&qc(e,t),o=e&&ite(n,r),s=qc(o,t)===r;return r&&o?r===e||o===e||s&&qc(qc(e,n),t)!==r:!1},Xy=(e,t,n)=>{if(n&&e){let r=t,o;Xg(n)?(o=document.createDocumentFragment(),Dn(n,s=>{s===r&&(r=s.previousSibling),o.appendChild(s)})):o=n,t&&(r?r!==t&&(r=r.nextSibling):r=e.firstChild),e.insertBefore(o,r||null)}},Ss=(e,t)=>{Xy(e,null,t)},cte=(e,t)=>{Xy(mi(e),e,t)},Sj=(e,t)=>{Xy(mi(e),e&&e.nextSibling,t)},Aa=e=>{if(Xg(e))Dn(Yl(e),t=>Aa(t));else if(e){const t=mi(e);t&&t.removeChild(e)}},Ll=e=>{const t=document.createElement("div");return e&&vo(t,"class",e),t},iO=e=>{const t=Ll();return t.innerHTML=e.trim(),Dn(Qy(t),n=>Aa(n))},Lx=e=>e.charAt(0).toUpperCase()+e.slice(1),ute=()=>Ll().style,dte=["-webkit-","-moz-","-o-","-ms-"],fte=["WebKit","Moz","O","MS","webkit","moz","o","ms"],i1={},l1={},pte=e=>{let t=l1[e];if(Jg(l1,e))return t;const n=Lx(e),r=ute();return Dn(dte,o=>{const s=o.replace(/-/g,"");return!(t=[e,o+e,s+n,Lx(s)+n].find(l=>r[l]!==void 0))}),l1[e]=t||""},Bf=e=>{if(Ff()){let t=i1[e]||window[e];return Jg(i1,e)||(Dn(fte,n=>(t=t||window[n+Lx(e)],!t)),i1[e]=t),t}},mte=Bf("MutationObserver"),kj=Bf("IntersectionObserver"),Kc=Bf("ResizeObserver"),lO=Bf("cancelAnimationFrame"),cO=Bf("requestAnimationFrame"),Bh=Ff()&&window.setTimeout,zx=Ff()&&window.clearTimeout,hte=/[^\x20\t\r\n\f]+/g,uO=(e,t,n)=>{const r=e&&e.classList;let o,s=0,i=!1;if(r&&t&&dl(t)){const l=t.match(hte)||[];for(i=l.length>0;o=l[s++];)i=!!n(r,o)&&i}return i},Yy=(e,t)=>{uO(e,t,(n,r)=>n.remove(r))},ci=(e,t)=>(uO(e,t,(n,r)=>n.add(r)),Yy.bind(0,e,t)),Zg=(e,t,n,r)=>{if(e&&t){let o=!0;return Dn(n,s=>{const i=r?r(e[s]):e[s],l=r?r(t[s]):t[s];i!==l&&(o=!1)}),o}return!1},dO=(e,t)=>Zg(e,t,["w","h"]),fO=(e,t)=>Zg(e,t,["x","y"]),gte=(e,t)=>Zg(e,t,["t","r","b","l"]),jj=(e,t,n)=>Zg(e,t,["width","height"],n&&(r=>Math.round(r))),ys=()=>{},Bc=e=>{let t;const n=e?Bh:cO,r=e?zx:lO;return[o=>{r(t),t=n(o,ia(e)?e():e)},()=>r(t)]},Jy=(e,t)=>{let n,r,o,s=ys;const{v:i,g:l,p:u}=t||{},p=function(y){s(),zx(n),n=r=void 0,s=ys,e.apply(this,y)},m=x=>u&&r?u(r,x):x,h=()=>{s!==ys&&p(m(o)||o)},g=function(){const y=Yl(arguments),b=ia(i)?i():i;if(Yi(b)&&b>=0){const S=ia(l)?l():l,j=Yi(S)&&S>=0,_=b>0?Bh:cO,P=b>0?zx:lO,M=m(y)||y,O=p.bind(0,M);s();const A=_(O,b);s=()=>P(A),j&&!n&&(n=Bh(h,S)),r=o=M}else p(y)};return g.m=h,g},vte={opacity:1,zindex:1},rm=(e,t)=>{const n=t?parseFloat(e):parseInt(e,10);return n===n?n:0},xte=(e,t)=>!vte[e.toLowerCase()]&&Yi(t)?`${t}px`:t,_j=(e,t,n)=>t!=null?t[n]||t.getPropertyValue(n):e.style[n],bte=(e,t,n)=>{try{const{style:r}=e;_i(r[t])?r.setProperty(t,n):r[t]=xte(t,n)}catch{}},tf=e=>bo(e,"direction")==="rtl",Ij=(e,t,n)=>{const r=t?`${t}-`:"",o=n?`-${n}`:"",s=`${r}top${o}`,i=`${r}right${o}`,l=`${r}bottom${o}`,u=`${r}left${o}`,p=bo(e,[s,i,l,u]);return{t:rm(p[s],!0),r:rm(p[i],!0),b:rm(p[l],!0),l:rm(p[u],!0)}},{round:Pj}=Math,Zy={w:0,h:0},nf=e=>e?{w:e.offsetWidth,h:e.offsetHeight}:Zy,Pm=e=>e?{w:e.clientWidth,h:e.clientHeight}:Zy,Hh=e=>e?{w:e.scrollWidth,h:e.scrollHeight}:Zy,Wh=e=>{const t=parseFloat(bo(e,"height"))||0,n=parseFloat(bo(e,"width"))||0;return{w:n-Pj(n),h:t-Pj(t)}},_a=e=>e.getBoundingClientRect();let om;const yte=()=>{if(_i(om)){om=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get(){om=!0}}))}catch{}}return om},pO=e=>e.split(" "),Cte=(e,t,n,r)=>{Dn(pO(t),o=>{e.removeEventListener(o,n,r)})},Ur=(e,t,n,r)=>{var o;const s=yte(),i=(o=s&&r&&r.S)!=null?o:s,l=r&&r.$||!1,u=r&&r.C||!1,p=[],m=s?{passive:i,capture:l}:l;return Dn(pO(t),h=>{const g=u?x=>{e.removeEventListener(h,g,l),n&&n(x)}:n;Un(p,Cte.bind(null,e,h,g,l)),e.addEventListener(h,g,m)}),Wa.bind(0,p)},mO=e=>e.stopPropagation(),hO=e=>e.preventDefault(),wte={x:0,y:0},c1=e=>{const t=e?_a(e):0;return t?{x:t.left+window.pageYOffset,y:t.top+window.pageXOffset}:wte},Ej=(e,t)=>{Dn(la(t)?t:[t],e)},e2=e=>{const t=new Map,n=(s,i)=>{if(s){const l=t.get(s);Ej(u=>{l&&l[u?"delete":"clear"](u)},i)}else t.forEach(l=>{l.clear()}),t.clear()},r=(s,i)=>{if(dl(s)){const p=t.get(s)||new Set;return t.set(s,p),Ej(m=>{ia(m)&&p.add(m)},i),n.bind(0,s,i)}Uy(i)&&i&&n();const l=us(s),u=[];return Dn(l,p=>{const m=s[p];m&&Un(u,r(p,m))}),Wa.bind(0,u)},o=(s,i)=>{const l=t.get(s);Dn(Yl(l),u=>{i&&!qy(i)?u.apply(0,i):u()})};return r(e||{}),[r,n,o]},Mj=e=>JSON.stringify(e,(t,n)=>{if(ia(n))throw new Error;return n}),Ste={paddingAbsolute:!1,showNativeOverlaidScrollbars:!1,update:{elementEvents:[["img","load"]],debounce:[0,33],attributes:null,ignoreMutation:null},overflow:{x:"scroll",y:"scroll"},scrollbars:{theme:"os-theme-dark",visibility:"auto",autoHide:"never",autoHideDelay:1300,dragScroll:!0,clickScroll:!1,pointers:["mouse","touch","pen"]}},gO=(e,t)=>{const n={},r=us(t).concat(us(e));return Dn(r,o=>{const s=e[o],i=t[o];if(ef(s)&&ef(i))Sr(n[o]={},gO(s,i)),Ky(n[o])&&delete n[o];else if(Jg(t,o)&&i!==s){let l=!0;if(la(s)||la(i))try{Mj(s)===Mj(i)&&(l=!1)}catch{}l&&(n[o]=i)}}),n},vO="os-environment",xO=`${vO}-flexbox-glue`,kte=`${xO}-max`,bO="os-scrollbar-hidden",u1="data-overlayscrollbars-initialize",qs="data-overlayscrollbars",yO=`${qs}-overflow-x`,CO=`${qs}-overflow-y`,lu="overflowVisible",jte="scrollbarHidden",Oj="scrollbarPressed",Vh="updating",Bi="data-overlayscrollbars-viewport",d1="arrange",wO="scrollbarHidden",cu=lu,Fx="data-overlayscrollbars-padding",_te=cu,Rj="data-overlayscrollbars-content",t2="os-size-observer",Ite=`${t2}-appear`,Pte=`${t2}-listener`,Ete="os-trinsic-observer",Mte="os-no-css-vars",Ote="os-theme-none",Ko="os-scrollbar",Rte=`${Ko}-rtl`,Ate=`${Ko}-horizontal`,Dte=`${Ko}-vertical`,SO=`${Ko}-track`,n2=`${Ko}-handle`,Tte=`${Ko}-visible`,Nte=`${Ko}-cornerless`,Aj=`${Ko}-transitionless`,Dj=`${Ko}-interaction`,Tj=`${Ko}-unusable`,Nj=`${Ko}-auto-hidden`,$j=`${Ko}-wheel`,$te=`${SO}-interactive`,Lte=`${n2}-interactive`,kO={},Jl=()=>kO,zte=e=>{const t=[];return Dn(la(e)?e:[e],n=>{const r=us(n);Dn(r,o=>{Un(t,kO[o]=n[o])})}),t},Fte="__osOptionsValidationPlugin",Bte="__osSizeObserverPlugin",r2="__osScrollbarsHidingPlugin",Hte="__osClickScrollPlugin";let f1;const Lj=(e,t,n,r)=>{Ss(e,t);const o=Pm(t),s=nf(t),i=Wh(n);return r&&Aa(t),{x:s.h-o.h+i.h,y:s.w-o.w+i.w}},Wte=e=>{let t=!1;const n=ci(e,bO);try{t=bo(e,pte("scrollbar-width"))==="none"||window.getComputedStyle(e,"::-webkit-scrollbar").getPropertyValue("display")==="none"}catch{}return n(),t},Vte=(e,t)=>{const n="hidden";bo(e,{overflowX:n,overflowY:n,direction:"rtl"}),ea(e,0);const r=c1(e),o=c1(t);ea(e,-999);const s=c1(t);return{i:r.x===o.x,n:o.x!==s.x}},Ute=(e,t)=>{const n=ci(e,xO),r=_a(e),o=_a(t),s=jj(o,r,!0),i=ci(e,kte),l=_a(e),u=_a(t),p=jj(u,l,!0);return n(),i(),s&&p},Gte=()=>{const{body:e}=document,n=iO(`
`)[0],r=n.firstChild,[o,,s]=e2(),[i,l]=Gs({o:Lj(e,n,r),u:fO},Lj.bind(0,e,n,r,!0)),[u]=l(),p=Wte(n),m={x:u.x===0,y:u.y===0},h={elements:{host:null,padding:!p,viewport:j=>p&&j===j.ownerDocument.body&&j,content:!1},scrollbars:{slot:!0},cancel:{nativeScrollbarsOverlaid:!1,body:null}},g=Sr({},Ste),x=Sr.bind(0,{},g),y=Sr.bind(0,{},h),b={k:u,A:m,I:p,L:bo(n,"zIndex")==="-1",B:Vte(n,r),V:Ute(n,r),Y:o.bind(0,"z"),j:o.bind(0,"r"),N:y,q:j=>Sr(h,j)&&y(),F:x,G:j=>Sr(g,j)&&x(),X:Sr({},h),U:Sr({},g)},C=window.addEventListener,S=Jy(j=>s(j?"z":"r"),{v:33,g:99});if(zo(n,"style"),Aa(n),C("resize",S.bind(0,!1)),!p&&(!m.x||!m.y)){let j;C("resize",()=>{const _=Jl()[r2];j=j||_&&_.R(),j&&j(b,i,S.bind(0,!0))})}return b},Qo=()=>(f1||(f1=Gte()),f1),o2=(e,t)=>ia(t)?t.apply(0,e):t,qte=(e,t,n,r)=>{const o=_i(r)?n:r;return o2(e,o)||t.apply(0,e)},jO=(e,t,n,r)=>{const o=_i(r)?n:r,s=o2(e,o);return!!s&&(zh(s)?s:t.apply(0,e))},Kte=(e,t,n)=>{const{nativeScrollbarsOverlaid:r,body:o}=n||{},{A:s,I:i}=Qo(),{nativeScrollbarsOverlaid:l,body:u}=t,p=r??l,m=_i(o)?u:o,h=(s.x||s.y)&&p,g=e&&(Qg(m)?!i:m);return!!h||!!g},s2=new WeakMap,Qte=(e,t)=>{s2.set(e,t)},Xte=e=>{s2.delete(e)},_O=e=>s2.get(e),zj=(e,t)=>e?t.split(".").reduce((n,r)=>n&&Jg(n,r)?n[r]:void 0,e):void 0,Bx=(e,t,n)=>r=>[zj(e,r),n||zj(t,r)!==void 0],IO=e=>{let t=e;return[()=>t,n=>{t=Sr({},t,n)}]},sm="tabindex",am=Ll.bind(0,""),p1=e=>{Ss(mi(e),Qy(e)),Aa(e)},Yte=e=>{const t=Qo(),{N:n,I:r}=t,o=Jl()[r2],s=o&&o.T,{elements:i}=n(),{host:l,padding:u,viewport:p,content:m}=i,h=zh(e),g=h?{}:e,{elements:x}=g,{host:y,padding:b,viewport:C,content:S}=x||{},j=h?e:g.target,_=Fh(j,"textarea"),P=j.ownerDocument,I=P.documentElement,M=j===P.body,O=P.defaultView,A=qte.bind(0,[j]),D=jO.bind(0,[j]),R=o2.bind(0,[j]),N=A.bind(0,am,p),Y=D.bind(0,am,m),F=N(C),V=F===j,Q=V&&M,q=!V&&Y(S),z=!V&&zh(F)&&F===q,G=z&&!!R(m),T=G?N():F,B=G?q:Y(),re=Q?I:z?T:F,le=_?A(am,l,y):j,se=Q?re:le,K=z?B:q,U=P.activeElement,ee=!V&&O.top===O&&U===j,de={W:j,Z:se,J:re,K:!V&&D(am,u,b),tt:K,nt:!V&&!r&&s&&s(t),ot:Q?I:re,st:Q?P:re,et:O,ct:P,rt:_,it:M,lt:h,ut:V,dt:z,ft:(mt,ct)=>ate(re,V?qs:Bi,V?ct:mt),_t:(mt,ct,be)=>$l(re,V?qs:Bi,V?ct:mt,be)},Z=us(de).reduce((mt,ct)=>{const be=de[ct];return Un(mt,be&&!mi(be)?be:!1)},[]),ue=mt=>mt?Gy(Z,mt)>-1:null,{W:fe,Z:ge,K:_e,J:ye,tt:pe,nt:Te}=de,Ae=[()=>{zo(ge,qs),zo(ge,u1),zo(fe,u1),M&&(zo(I,qs),zo(I,u1))}],qe=_&&ue(ge);let Pt=_?fe:Qy([pe,ye,_e,ge,fe].find(mt=>ue(mt)===!1));const tt=Q?fe:pe||ye;return[de,()=>{vo(ge,qs,V?"viewport":"host"),vo(_e,Fx,""),vo(pe,Rj,""),V||vo(ye,Bi,"");const mt=M&&!V?ci(mi(j),bO):ys;if(qe&&(Sj(fe,ge),Un(Ae,()=>{Sj(ge,fe),Aa(ge)})),Ss(tt,Pt),Ss(ge,_e),Ss(_e||ge,!V&&ye),Ss(ye,pe),Un(Ae,()=>{mt(),zo(_e,Fx),zo(pe,Rj),zo(ye,yO),zo(ye,CO),zo(ye,Bi),ue(pe)&&p1(pe),ue(ye)&&p1(ye),ue(_e)&&p1(_e)}),r&&!V&&($l(ye,Bi,wO,!0),Un(Ae,zo.bind(0,ye,Bi))),Te&&(cte(ye,Te),Un(Ae,Aa.bind(0,Te))),ee){const ct=vo(ye,sm);vo(ye,sm,"-1"),ye.focus();const be=()=>ct?vo(ye,sm,ct):zo(ye,sm),We=Ur(P,"pointerdown keydown",()=>{be(),We()});Un(Ae,[be,We])}else U&&U.focus&&U.focus();Pt=0},Wa.bind(0,Ae)]},Jte=(e,t)=>{const{tt:n}=e,[r]=t;return o=>{const{V:s}=Qo(),{ht:i}=r(),{vt:l}=o,u=(n||!s)&&l;return u&&bo(n,{height:i?"":"100%"}),{gt:u,wt:u}}},Zte=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,ut:l}=e,[u,p]=Gs({u:gte,o:Ij()},Ij.bind(0,o,"padding",""));return(m,h,g)=>{let[x,y]=p(g);const{I:b,V:C}=Qo(),{bt:S}=n(),{gt:j,wt:_,yt:P}=m,[I,M]=h("paddingAbsolute");(j||y||!C&&_)&&([x,y]=u(g));const A=!l&&(M||P||y);if(A){const D=!I||!s&&!b,R=x.r+x.l,N=x.t+x.b,Y={marginRight:D&&!S?-R:0,marginBottom:D?-N:0,marginLeft:D&&S?-R:0,top:D?-x.t:0,right:D?S?-x.r:"auto":0,left:D?S?"auto":-x.l:0,width:D?`calc(100% + ${R}px)`:""},F={paddingTop:D?x.t:0,paddingRight:D?x.r:0,paddingBottom:D?x.b:0,paddingLeft:D?x.l:0};bo(s||i,Y),bo(i,F),r({K:x,St:!D,P:s?F:Sr({},Y,F)})}return{xt:A}}},{max:Hx}=Math,Hi=Hx.bind(0,0),PO="visible",Fj="hidden",ene=42,im={u:dO,o:{w:0,h:0}},tne={u:fO,o:{x:Fj,y:Fj}},nne=(e,t)=>{const n=window.devicePixelRatio%1!==0?1:0,r={w:Hi(e.w-t.w),h:Hi(e.h-t.h)};return{w:r.w>n?r.w:0,h:r.h>n?r.h:0}},lm=e=>e.indexOf(PO)===0,rne=(e,t)=>{const[n,r]=t,{Z:o,K:s,J:i,nt:l,ut:u,_t:p,it:m,et:h}=e,{k:g,V:x,I:y,A:b}=Qo(),C=Jl()[r2],S=!u&&!y&&(b.x||b.y),j=m&&u,[_,P]=Gs(im,Wh.bind(0,i)),[I,M]=Gs(im,Hh.bind(0,i)),[O,A]=Gs(im),[D,R]=Gs(im),[N]=Gs(tne),Y=(G,T)=>{if(bo(i,{height:""}),T){const{St:B,K:X}=n(),{$t:re,D:le}=G,se=Wh(o),K=Pm(o),U=bo(i,"boxSizing")==="content-box",ee=B||U?X.b+X.t:0,de=!(b.x&&U);bo(i,{height:K.h+se.h+(re.x&&de?le.x:0)-ee})}},F=(G,T)=>{const B=!y&&!G?ene:0,X=(ue,fe,ge)=>{const _e=bo(i,ue),pe=(T?T[ue]:_e)==="scroll";return[_e,pe,pe&&!y?fe?B:ge:0,fe&&!!B]},[re,le,se,K]=X("overflowX",b.x,g.x),[U,ee,de,Z]=X("overflowY",b.y,g.y);return{Ct:{x:re,y:U},$t:{x:le,y:ee},D:{x:se,y:de},M:{x:K,y:Z}}},V=(G,T,B,X)=>{const re=(ee,de)=>{const Z=lm(ee),ue=de&&Z&&ee.replace(`${PO}-`,"")||"";return[de&&!Z?ee:"",lm(ue)?"hidden":ue]},[le,se]=re(B.x,T.x),[K,U]=re(B.y,T.y);return X.overflowX=se&&K?se:le,X.overflowY=U&&le?U:K,F(G,X)},Q=(G,T,B,X)=>{const{D:re,M:le}=G,{x:se,y:K}=le,{x:U,y:ee}=re,{P:de}=n(),Z=T?"marginLeft":"marginRight",ue=T?"paddingLeft":"paddingRight",fe=de[Z],ge=de.marginBottom,_e=de[ue],ye=de.paddingBottom;X.width=`calc(100% + ${ee+-1*fe}px)`,X[Z]=-ee+fe,X.marginBottom=-U+ge,B&&(X[ue]=_e+(K?ee:0),X.paddingBottom=ye+(se?U:0))},[q,z]=C?C.H(S,x,i,l,n,F,Q):[()=>S,()=>[ys]];return(G,T,B)=>{const{gt:X,Ot:re,wt:le,xt:se,vt:K,yt:U}=G,{ht:ee,bt:de}=n(),[Z,ue]=T("showNativeOverlaidScrollbars"),[fe,ge]=T("overflow"),_e=Z&&b.x&&b.y,ye=!u&&!x&&(X||le||re||ue||K),pe=lm(fe.x),Te=lm(fe.y),Ae=pe||Te;let qe=P(B),Pt=M(B),tt=A(B),sn=R(B),mt;if(ue&&y&&p(wO,jte,!_e),ye&&(mt=F(_e),Y(mt,ee)),X||se||le||U||ue){Ae&&p(cu,lu,!1);const[Me,Ze]=z(_e,de,mt),[Ye,dt]=qe=_(B),[Vt,xr]=Pt=I(B),yn=Pm(i);let mn=Vt,oo=yn;Me(),(xr||dt||ue)&&Ze&&!_e&&q(Ze,Vt,Ye,de)&&(oo=Pm(i),mn=Hh(i));const Ar={w:Hi(Hx(Vt.w,mn.w)+Ye.w),h:Hi(Hx(Vt.h,mn.h)+Ye.h)},nr={w:Hi((j?h.innerWidth:oo.w+Hi(yn.w-Vt.w))+Ye.w),h:Hi((j?h.innerHeight+Ye.h:oo.h+Hi(yn.h-Vt.h))+Ye.h)};sn=D(nr),tt=O(nne(Ar,nr),B)}const[ct,be]=sn,[We,Rt]=tt,[Ut,ke]=Pt,[Ct,Ft]=qe,Wt={x:We.w>0,y:We.h>0},Le=pe&&Te&&(Wt.x||Wt.y)||pe&&Wt.x&&!Wt.y||Te&&Wt.y&&!Wt.x;if(se||U||Ft||ke||be||Rt||ge||ue||ye){const Me={marginRight:0,marginBottom:0,marginLeft:0,width:"",overflowY:"",overflowX:""},Ze=V(_e,Wt,fe,Me),Ye=q(Ze,Ut,Ct,de);u||Q(Ze,de,Ye,Me),ye&&Y(Ze,ee),u?(vo(o,yO,Me.overflowX),vo(o,CO,Me.overflowY)):bo(i,Me)}$l(o,qs,lu,Le),$l(s,Fx,_te,Le),u||$l(i,Bi,cu,Ae);const[Xe,_n]=N(F(_e).Ct);return r({Ct:Xe,zt:{x:ct.w,y:ct.h},Tt:{x:We.w,y:We.h},Et:Wt}),{It:_n,At:be,Lt:Rt}}},Bj=(e,t,n)=>{const r={},o=t||{},s=us(e).concat(us(o));return Dn(s,i=>{const l=e[i],u=o[i];r[i]=!!(n||l||u)}),r},one=(e,t)=>{const{W:n,J:r,_t:o,ut:s}=e,{I:i,A:l,V:u}=Qo(),p=!i&&(l.x||l.y),m=[Jte(e,t),Zte(e,t),rne(e,t)];return(h,g,x)=>{const y=Bj(Sr({gt:!1,xt:!1,yt:!1,vt:!1,At:!1,Lt:!1,It:!1,Ot:!1,wt:!1},g),{},x),b=p||!u,C=b&&ea(r),S=b&&li(r);o("",Vh,!0);let j=y;return Dn(m,_=>{j=Bj(j,_(j,h,!!x)||{},x)}),ea(r,C),li(r,S),o("",Vh),s||(ea(n,0),li(n,0)),j}},sne=(e,t,n)=>{let r,o=!1;const s=()=>{o=!0},i=l=>{if(n){const u=n.reduce((p,m)=>{if(m){const[h,g]=m,x=g&&h&&(l?l(h):aO(h,e));x&&x.length&&g&&dl(g)&&Un(p,[x,g.trim()],!0)}return p},[]);Dn(u,p=>Dn(p[0],m=>{const h=p[1],g=r.get(m)||[];if(e.contains(m)){const y=Ur(m,h,b=>{o?(y(),r.delete(m)):t(b)});r.set(m,Un(g,y))}else Wa(g),r.delete(m)}))}};return n&&(r=new WeakMap,i()),[s,i]},Hj=(e,t,n,r)=>{let o=!1;const{Ht:s,Pt:i,Dt:l,Mt:u,Rt:p,kt:m}=r||{},h=Jy(()=>{o&&n(!0)},{v:33,g:99}),[g,x]=sne(e,h,l),y=s||[],b=i||[],C=y.concat(b),S=(_,P)=>{const I=p||ys,M=m||ys,O=new Set,A=new Set;let D=!1,R=!1;if(Dn(_,N=>{const{attributeName:Y,target:F,type:V,oldValue:Q,addedNodes:q,removedNodes:z}=N,G=V==="attributes",T=V==="childList",B=e===F,X=G&&dl(Y)?vo(F,Y):0,re=X!==0&&Q!==X,le=Gy(b,Y)>-1&&re;if(t&&(T||!B)){const se=!G,K=G&&re,U=K&&u&&Fh(F,u),de=(U?!I(F,Y,Q,X):se||K)&&!M(N,!!U,e,r);Dn(q,Z=>O.add(Z)),Dn(z,Z=>O.add(Z)),R=R||de}!t&&B&&re&&!I(F,Y,Q,X)&&(A.add(Y),D=D||le)}),O.size>0&&x(N=>Yl(O).reduce((Y,F)=>(Un(Y,aO(N,F)),Fh(F,N)?Un(Y,F):Y),[])),t)return!P&&R&&n(!1),[!1];if(A.size>0||D){const N=[Yl(A),D];return!P&&n.apply(0,N),N}},j=new mte(_=>S(_));return j.observe(e,{attributes:!0,attributeOldValue:!0,attributeFilter:C,subtree:t,childList:t,characterData:t}),o=!0,[()=>{o&&(g(),j.disconnect(),o=!1)},()=>{if(o){h.m();const _=j.takeRecords();return!qy(_)&&S(_,!0)}}]},cm=3333333,um=e=>e&&(e.height||e.width),EO=(e,t,n)=>{const{Bt:r=!1,Vt:o=!1}=n||{},s=Jl()[Bte],{B:i}=Qo(),u=iO(`
`)[0],p=u.firstChild,m=tf.bind(0,e),[h]=Gs({o:void 0,_:!0,u:(b,C)=>!(!b||!um(b)&&um(C))}),g=b=>{const C=la(b)&&b.length>0&&ef(b[0]),S=!C&&Uy(b[0]);let j=!1,_=!1,P=!0;if(C){const[I,,M]=h(b.pop().contentRect),O=um(I),A=um(M);j=!M||!O,_=!A&&O,P=!j}else S?[,P]=b:_=b===!0;if(r&&P){const I=S?b[0]:tf(u);ea(u,I?i.n?-cm:i.i?0:cm:cm),li(u,cm)}j||t({gt:!S,Yt:S?b:void 0,Vt:!!_})},x=[];let y=o?g:!1;return[()=>{Wa(x),Aa(u)},()=>{if(Kc){const b=new Kc(g);b.observe(p),Un(x,()=>{b.disconnect()})}else if(s){const[b,C]=s.O(p,g,o);y=b,Un(x,C)}if(r){const[b]=Gs({o:void 0},m);Un(x,Ur(u,"scroll",C=>{const S=b(),[j,_,P]=S;_&&(Yy(p,"ltr rtl"),j?ci(p,"rtl"):ci(p,"ltr"),g([!!j,_,P])),mO(C)}))}y&&(ci(u,Ite),Un(x,Ur(u,"animationstart",y,{C:!!Kc}))),(Kc||s)&&Ss(e,u)}]},ane=e=>e.h===0||e.isIntersecting||e.intersectionRatio>0,ine=(e,t)=>{let n;const r=Ll(Ete),o=[],[s]=Gs({o:!1}),i=(u,p)=>{if(u){const m=s(ane(u)),[,h]=m;if(h)return!p&&t(m),[m]}},l=(u,p)=>{if(u&&u.length>0)return i(u.pop(),p)};return[()=>{Wa(o),Aa(r)},()=>{if(kj)n=new kj(u=>l(u),{root:e}),n.observe(r),Un(o,()=>{n.disconnect()});else{const u=()=>{const h=nf(r);i(h)},[p,m]=EO(r,u);Un(o,p),m(),u()}Ss(e,r)},()=>{if(n)return l(n.takeRecords(),!0)}]},Wj=`[${qs}]`,lne=`[${Bi}]`,m1=["tabindex"],Vj=["wrap","cols","rows"],h1=["id","class","style","open"],cne=(e,t,n)=>{let r,o,s;const{Z:i,J:l,tt:u,rt:p,ut:m,ft:h,_t:g}=e,{V:x}=Qo(),[y]=Gs({u:dO,o:{w:0,h:0}},()=>{const V=h(cu,lu),Q=h(d1,""),q=Q&&ea(l),z=Q&&li(l);g(cu,lu),g(d1,""),g("",Vh,!0);const G=Hh(u),T=Hh(l),B=Wh(l);return g(cu,lu,V),g(d1,"",Q),g("",Vh),ea(l,q),li(l,z),{w:T.w+G.w+B.w,h:T.h+G.h+B.h}}),b=p?Vj:h1.concat(Vj),C=Jy(n,{v:()=>r,g:()=>o,p(V,Q){const[q]=V,[z]=Q;return[us(q).concat(us(z)).reduce((G,T)=>(G[T]=q[T]||z[T],G),{})]}}),S=V=>{Dn(V||m1,Q=>{if(Gy(m1,Q)>-1){const q=vo(i,Q);dl(q)?vo(l,Q,q):zo(l,Q)}})},j=(V,Q)=>{const[q,z]=V,G={vt:z};return t({ht:q}),!Q&&n(G),G},_=({gt:V,Yt:Q,Vt:q})=>{const z=!V||q?n:C;let G=!1;if(Q){const[T,B]=Q;G=B,t({bt:T})}z({gt:V,yt:G})},P=(V,Q)=>{const[,q]=y(),z={wt:q};return q&&!Q&&(V?n:C)(z),z},I=(V,Q,q)=>{const z={Ot:Q};return Q?!q&&C(z):m||S(V),z},[M,O,A]=u||!x?ine(i,j):[ys,ys,ys],[D,R]=m?[ys,ys]:EO(i,_,{Vt:!0,Bt:!0}),[N,Y]=Hj(i,!1,I,{Pt:h1,Ht:h1.concat(m1)}),F=m&&Kc&&new Kc(_.bind(0,{gt:!0}));return F&&F.observe(i),S(),[()=>{M(),D(),s&&s[0](),F&&F.disconnect(),N()},()=>{R(),O()},()=>{const V={},Q=Y(),q=A(),z=s&&s[1]();return Q&&Sr(V,I.apply(0,Un(Q,!0))),q&&Sr(V,j.apply(0,Un(q,!0))),z&&Sr(V,P.apply(0,Un(z,!0))),V},V=>{const[Q]=V("update.ignoreMutation"),[q,z]=V("update.attributes"),[G,T]=V("update.elementEvents"),[B,X]=V("update.debounce"),re=T||z,le=se=>ia(Q)&&Q(se);if(re&&(s&&(s[1](),s[0]()),s=Hj(u||l,!0,P,{Ht:b.concat(q||[]),Dt:G,Mt:Wj,kt:(se,K)=>{const{target:U,attributeName:ee}=se;return(!K&&ee&&!m?lte(U,Wj,lne):!1)||!!qc(U,`.${Ko}`)||!!le(se)}})),X)if(C.m(),la(B)){const se=B[0],K=B[1];r=Yi(se)&&se,o=Yi(K)&&K}else Yi(B)?(r=B,o=!1):(r=!1,o=!1)}]},Uj={x:0,y:0},une=e=>({K:{t:0,r:0,b:0,l:0},St:!1,P:{marginRight:0,marginBottom:0,marginLeft:0,paddingTop:0,paddingRight:0,paddingBottom:0,paddingLeft:0},zt:Uj,Tt:Uj,Ct:{x:"hidden",y:"hidden"},Et:{x:!1,y:!1},ht:!1,bt:tf(e.Z)}),dne=(e,t)=>{const n=Bx(t,{}),[r,o,s]=e2(),[i,l,u]=Yte(e),p=IO(une(i)),[m,h]=p,g=one(i,p),x=(_,P,I)=>{const O=us(_).some(A=>_[A])||!Ky(P)||I;return O&&s("u",[_,P,I]),O},[y,b,C,S]=cne(i,h,_=>x(g(n,_),{},!1)),j=m.bind(0);return j.jt=_=>r("u",_),j.Nt=()=>{const{W:_,J:P}=i,I=ea(_),M=li(_);b(),l(),ea(P,I),li(P,M)},j.qt=i,[(_,P)=>{const I=Bx(t,_,P);return S(I),x(g(I,C(),P),_,!!P)},j,()=>{o(),y(),u()}]},{round:Gj}=Math,fne=e=>{const{width:t,height:n}=_a(e),{w:r,h:o}=nf(e);return{x:Gj(t)/r||1,y:Gj(n)/o||1}},pne=(e,t,n)=>{const r=t.scrollbars,{button:o,isPrimary:s,pointerType:i}=e,{pointers:l}=r;return o===0&&s&&r[n?"dragScroll":"clickScroll"]&&(l||[]).includes(i)},mne=(e,t)=>Ur(e,"mousedown",Ur.bind(0,t,"click",mO,{C:!0,$:!0}),{$:!0}),qj="pointerup pointerleave pointercancel lostpointercapture",hne=(e,t,n,r,o,s,i)=>{const{B:l}=Qo(),{Ft:u,Gt:p,Xt:m}=r,h=`scroll${i?"Left":"Top"}`,g=`client${i?"X":"Y"}`,x=i?"width":"height",y=i?"left":"top",b=i?"w":"h",C=i?"x":"y",S=(j,_)=>P=>{const{Tt:I}=s(),M=nf(p)[b]-nf(u)[b],A=_*P/M*I[C],R=tf(m)&&i?l.n||l.i?1:-1:1;o[h]=j+A*R};return Ur(p,"pointerdown",j=>{const _=qc(j.target,`.${n2}`)===u,P=_?u:p;if($l(t,qs,Oj,!0),pne(j,e,_)){const I=!_&&j.shiftKey,M=()=>_a(u),O=()=>_a(p),A=(T,B)=>(T||M())[y]-(B||O())[y],D=S(o[h]||0,1/fne(o)[C]),R=j[g],N=M(),Y=O(),F=N[x],V=A(N,Y)+F/2,Q=R-Y[y],q=_?0:Q-V,z=T=>{Wa(G),P.releasePointerCapture(T.pointerId)},G=[$l.bind(0,t,qs,Oj),Ur(n,qj,z),Ur(n,"selectstart",T=>hO(T),{S:!1}),Ur(p,qj,z),Ur(p,"pointermove",T=>{const B=T[g]-R;(_||I)&&D(q+B)})];if(I)D(q);else if(!_){const T=Jl()[Hte];T&&Un(G,T.O(D,A,q,F,Q))}P.setPointerCapture(j.pointerId)}})},gne=(e,t)=>(n,r,o,s,i,l)=>{const{Xt:u}=n,[p,m]=Bc(333),h=!!i.scrollBy;let g=!0;return Wa.bind(0,[Ur(u,"pointerenter",()=>{r(Dj,!0)}),Ur(u,"pointerleave pointercancel",()=>{r(Dj)}),Ur(u,"wheel",x=>{const{deltaX:y,deltaY:b,deltaMode:C}=x;h&&g&&C===0&&mi(u)===s&&i.scrollBy({left:y,top:b,behavior:"smooth"}),g=!1,r($j,!0),p(()=>{g=!0,r($j)}),hO(x)},{S:!1,$:!0}),mne(u,o),hne(e,s,o,n,i,t,l),m])},{min:Wx,max:Kj,abs:vne,round:xne}=Math,MO=(e,t,n,r)=>{if(r){const l=n?"x":"y",{Tt:u,zt:p}=r,m=p[l],h=u[l];return Kj(0,Wx(1,m/(m+h)))}const o=n?"width":"height",s=_a(e)[o],i=_a(t)[o];return Kj(0,Wx(1,s/i))},bne=(e,t,n,r,o,s)=>{const{B:i}=Qo(),l=s?"x":"y",u=s?"Left":"Top",{Tt:p}=r,m=xne(p[l]),h=vne(n[`scroll${u}`]),g=s&&o,x=i.i?h:m-h,b=Wx(1,(g?x:h)/m),C=MO(e,t,s);return 1/C*(1-C)*b},yne=(e,t,n)=>{const{N:r,L:o}=Qo(),{scrollbars:s}=r(),{slot:i}=s,{ct:l,W:u,Z:p,J:m,lt:h,ot:g,it:x,ut:y}=t,{scrollbars:b}=h?{}:e,{slot:C}=b||{},S=jO([u,p,m],()=>y&&x?u:p,i,C),j=(q,z,G)=>{const T=G?ci:Yy;Dn(q,B=>{T(B.Xt,z)})},_=(q,z)=>{Dn(q,G=>{const[T,B]=z(G);bo(T,B)})},P=(q,z,G)=>{_(q,T=>{const{Ft:B,Gt:X}=T;return[B,{[G?"width":"height"]:`${(100*MO(B,X,G,z)).toFixed(3)}%`}]})},I=(q,z,G)=>{const T=G?"X":"Y";_(q,B=>{const{Ft:X,Gt:re,Xt:le}=B,se=bne(X,re,g,z,tf(le),G);return[X,{transform:se===se?`translate${T}(${(100*se).toFixed(3)}%)`:""}]})},M=[],O=[],A=[],D=(q,z,G)=>{const T=Uy(G),B=T?G:!0,X=T?!G:!0;B&&j(O,q,z),X&&j(A,q,z)},R=q=>{P(O,q,!0),P(A,q)},N=q=>{I(O,q,!0),I(A,q)},Y=q=>{const z=q?Ate:Dte,G=q?O:A,T=qy(G)?Aj:"",B=Ll(`${Ko} ${z} ${T}`),X=Ll(SO),re=Ll(n2),le={Xt:B,Gt:X,Ft:re};return o||ci(B,Mte),Ss(B,X),Ss(X,re),Un(G,le),Un(M,[Aa.bind(0,B),n(le,D,l,p,g,q)]),le},F=Y.bind(0,!0),V=Y.bind(0,!1),Q=()=>{Ss(S,O[0].Xt),Ss(S,A[0].Xt),Bh(()=>{D(Aj)},300)};return F(),V(),[{Ut:R,Wt:N,Zt:D,Jt:{Kt:O,Qt:F,tn:_.bind(0,O)},nn:{Kt:A,Qt:V,tn:_.bind(0,A)}},Q,Wa.bind(0,M)]},Cne=(e,t,n,r)=>{let o,s,i,l,u,p=0;const m=IO({}),[h]=m,[g,x]=Bc(),[y,b]=Bc(),[C,S]=Bc(100),[j,_]=Bc(100),[P,I]=Bc(()=>p),[M,O,A]=yne(e,n.qt,gne(t,n)),{Z:D,J:R,ot:N,st:Y,ut:F,it:V}=n.qt,{Jt:Q,nn:q,Zt:z,Ut:G,Wt:T}=M,{tn:B}=Q,{tn:X}=q,re=ee=>{const{Xt:de}=ee,Z=F&&!V&&mi(de)===R&&de;return[Z,{transform:Z?`translate(${ea(N)}px, ${li(N)}px)`:""}]},le=(ee,de)=>{if(I(),ee)z(Nj);else{const Z=()=>z(Nj,!0);p>0&&!de?P(Z):Z()}},se=()=>{l=s,l&&le(!0)},K=[S,I,_,b,x,A,Ur(D,"pointerover",se,{C:!0}),Ur(D,"pointerenter",se),Ur(D,"pointerleave",()=>{l=!1,s&&le(!1)}),Ur(D,"pointermove",()=>{o&&g(()=>{S(),le(!0),j(()=>{o&&le(!1)})})}),Ur(Y,"scroll",ee=>{y(()=>{T(n()),i&&le(!0),C(()=>{i&&!l&&le(!1)})}),r(ee),F&&B(re),F&&X(re)})],U=h.bind(0);return U.qt=M,U.Nt=O,[(ee,de,Z)=>{const{At:ue,Lt:fe,It:ge,yt:_e}=Z,{A:ye}=Qo(),pe=Bx(t,ee,de),Te=n(),{Tt:Ae,Ct:qe,bt:Pt}=Te,[tt,sn]=pe("showNativeOverlaidScrollbars"),[mt,ct]=pe("scrollbars.theme"),[be,We]=pe("scrollbars.visibility"),[Rt,Ut]=pe("scrollbars.autoHide"),[ke]=pe("scrollbars.autoHideDelay"),[Ct,Ft]=pe("scrollbars.dragScroll"),[Wt,Le]=pe("scrollbars.clickScroll"),Xe=ue||fe||_e,_n=ge||We,Me=tt&&ye.x&&ye.y,Ze=(Ye,dt)=>{const Vt=be==="visible"||be==="auto"&&Ye==="scroll";return z(Tte,Vt,dt),Vt};if(p=ke,sn&&z(Ote,Me),ct&&(z(u),z(mt,!0),u=mt),Ut&&(o=Rt==="move",s=Rt==="leave",i=Rt!=="never",le(!i,!0)),Ft&&z(Lte,Ct),Le&&z($te,Wt),_n){const Ye=Ze(qe.x,!0),dt=Ze(qe.y,!1);z(Nte,!(Ye&&dt))}Xe&&(G(Te),T(Te),z(Tj,!Ae.x,!0),z(Tj,!Ae.y,!1),z(Rte,Pt&&!V))},U,Wa.bind(0,K)]},OO=(e,t,n)=>{ia(e)&&e(t||void 0,n||void 0)},Gi=(e,t,n)=>{const{F:r,N:o,Y:s,j:i}=Qo(),l=Jl(),u=zh(e),p=u?e:e.target,m=_O(p);if(t&&!m){let h=!1;const g=F=>{const V=Jl()[Fte],Q=V&&V.O;return Q?Q(F,!0):F},x=Sr({},r(),g(t)),[y,b,C]=e2(n),[S,j,_]=dne(e,x),[P,I,M]=Cne(e,x,j,F=>C("scroll",[Y,F])),O=(F,V)=>S(F,!!V),A=O.bind(0,{},!0),D=s(A),R=i(A),N=F=>{Xte(p),D(),R(),M(),_(),h=!0,C("destroyed",[Y,!!F]),b()},Y={options(F,V){if(F){const Q=V?r():{},q=gO(x,Sr(Q,g(F)));Ky(q)||(Sr(x,q),O(q))}return Sr({},x)},on:y,off:(F,V)=>{F&&V&&b(F,V)},state(){const{zt:F,Tt:V,Ct:Q,Et:q,K:z,St:G,bt:T}=j();return Sr({},{overflowEdge:F,overflowAmount:V,overflowStyle:Q,hasOverflow:q,padding:z,paddingAbsolute:G,directionRTL:T,destroyed:h})},elements(){const{W:F,Z:V,K:Q,J:q,tt:z,ot:G,st:T}=j.qt,{Jt:B,nn:X}=I.qt,re=se=>{const{Ft:K,Gt:U,Xt:ee}=se;return{scrollbar:ee,track:U,handle:K}},le=se=>{const{Kt:K,Qt:U}=se,ee=re(K[0]);return Sr({},ee,{clone:()=>{const de=re(U());return P({},!0,{}),de}})};return Sr({},{target:F,host:V,padding:Q||q,viewport:q,content:z||q,scrollOffsetElement:G,scrollEventElement:T,scrollbarHorizontal:le(B),scrollbarVertical:le(X)})},update:F=>O({},F),destroy:N.bind(0)};return j.jt((F,V,Q)=>{P(V,Q,F)}),Qte(p,Y),Dn(us(l),F=>OO(l[F],0,Y)),Kte(j.qt.it,o().cancel,!u&&e.cancel)?(N(!0),Y):(j.Nt(),I.Nt(),C("initialized",[Y]),j.jt((F,V,Q)=>{const{gt:q,yt:z,vt:G,At:T,Lt:B,It:X,wt:re,Ot:le}=F;C("updated",[Y,{updateHints:{sizeChanged:q,directionChanged:z,heightIntrinsicChanged:G,overflowEdgeChanged:T,overflowAmountChanged:B,overflowStyleChanged:X,contentMutation:re,hostMutation:le},changedOptions:V,force:Q}])}),Y.update(!0),Y)}return m};Gi.plugin=e=>{Dn(zte(e),t=>OO(t,Gi))};Gi.valid=e=>{const t=e&&e.elements,n=ia(t)&&t();return Nx(n)&&!!_O(n.target)};Gi.env=()=>{const{k:e,A:t,I:n,B:r,V:o,L:s,X:i,U:l,N:u,q:p,F:m,G:h}=Qo();return Sr({},{scrollbarsSize:e,scrollbarsOverlaid:t,scrollbarsHiding:n,rtlScrollBehavior:r,flexboxGlue:o,cssCustomProperties:s,staticDefaultInitialization:i,staticDefaultOptions:l,getDefaultInitialization:u,setDefaultInitialization:p,getDefaultOptions:m,setDefaultOptions:h})};const wne=()=>{if(typeof window>"u"){const p=()=>{};return[p,p]}let e,t;const n=window,r=typeof n.requestIdleCallback=="function",o=n.requestAnimationFrame,s=n.cancelAnimationFrame,i=r?n.requestIdleCallback:o,l=r?n.cancelIdleCallback:s,u=()=>{l(e),s(t)};return[(p,m)=>{u(),e=i(r?()=>{u(),t=o(p)}:p,typeof m=="object"?m:{timeout:2233})},u]},a2=e=>{const{options:t,events:n,defer:r}=e||{},[o,s]=d.useMemo(wne,[]),i=d.useRef(null),l=d.useRef(r),u=d.useRef(t),p=d.useRef(n);return d.useEffect(()=>{l.current=r},[r]),d.useEffect(()=>{const{current:m}=i;u.current=t,Gi.valid(m)&&m.options(t||{},!0)},[t]),d.useEffect(()=>{const{current:m}=i;p.current=n,Gi.valid(m)&&m.on(n||{},!0)},[n]),d.useEffect(()=>()=>{var m;s(),(m=i.current)==null||m.destroy()},[]),d.useMemo(()=>[m=>{const h=i.current;if(Gi.valid(h))return;const g=l.current,x=u.current||{},y=p.current||{},b=()=>i.current=Gi(m,x,y);g?o(b,g):b()},()=>i.current],[])},Sne=(e,t)=>{const{element:n="div",options:r,events:o,defer:s,children:i,...l}=e,u=n,p=d.useRef(null),m=d.useRef(null),[h,g]=a2({options:r,events:o,defer:s});return d.useEffect(()=>{const{current:x}=p,{current:y}=m;return x&&y&&h({target:x,elements:{viewport:y,content:y}}),()=>{var b;return(b=g())==null?void 0:b.destroy()}},[h,n]),d.useImperativeHandle(t,()=>({osInstance:g,getElement:()=>p.current}),[]),H.createElement(u,{"data-overlayscrollbars-initialize":"",ref:p,...l},H.createElement("div",{ref:m},i))},e0=d.forwardRef(Sne);var RO={exports:{}},AO={};const ts=xb(HD),bd=xb(WD),kne=xb(VD);(function(e){var t,n,r=wc&&wc.__generator||function(ne,ae){var ve,Pe,xe,pt,it={label:0,sent:function(){if(1&xe[0])throw xe[1];return xe[1]},trys:[],ops:[]};return pt={next:Kt(0),throw:Kt(1),return:Kt(2)},typeof Symbol=="function"&&(pt[Symbol.iterator]=function(){return this}),pt;function Kt(ht){return function(wt){return function(He){if(ve)throw new TypeError("Generator is already executing.");for(;it;)try{if(ve=1,Pe&&(xe=2&He[0]?Pe.return:He[0]?Pe.throw||((xe=Pe.return)&&xe.call(Pe),0):Pe.next)&&!(xe=xe.call(Pe,He[1])).done)return xe;switch(Pe=0,xe&&(He=[2&He[0],xe.value]),He[0]){case 0:case 1:xe=He;break;case 4:return it.label++,{value:He[1],done:!1};case 5:it.label++,Pe=He[1],He=[0];continue;case 7:He=it.ops.pop(),it.trys.pop();continue;default:if(!((xe=(xe=it.trys).length>0&&xe[xe.length-1])||He[0]!==6&&He[0]!==2)){it=0;continue}if(He[0]===3&&(!xe||He[1]>xe[0]&&He[1]=200&&ne.status<=299},Y=function(ne){return/ion\/(vnd\.api\+)?json/.test(ne.get("content-type")||"")};function F(ne){if(!(0,D.isPlainObject)(ne))return ne;for(var ae=C({},ne),ve=0,Pe=Object.entries(ae);ve"u"&&it===R&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(an,Yt){return I(ae,null,function(){var Be,yt,Lt,Qt,Nn,Jt,vn,fn,Fr,cr,Ot,$n,Hn,ur,_r,Qn,Xn,xn,On,Ln,In,Pn,Je,Dt,kt,lt,St,Gt,vt,st,$e,Re,ze,Ve,nt,zt;return r(this,function(Tt){switch(Tt.label){case 0:return Be=Yt.signal,yt=Yt.getState,Lt=Yt.extra,Qt=Yt.endpoint,Nn=Yt.forced,Jt=Yt.type,Fr=(fn=typeof an=="string"?{url:an}:an).url,Ot=(cr=fn.headers)===void 0?new Headers(Zt.headers):cr,Hn=($n=fn.params)===void 0?void 0:$n,_r=(ur=fn.responseHandler)===void 0?At??"json":ur,Xn=(Qn=fn.validateStatus)===void 0?Ht??N:Qn,On=(xn=fn.timeout)===void 0?Et:xn,Ln=_(fn,["url","headers","params","responseHandler","validateStatus","timeout"]),In=C(S(C({},Zt),{signal:Be}),Ln),Ot=new Headers(F(Ot)),Pn=In,[4,xe(Ot,{getState:yt,extra:Lt,endpoint:Qt,forced:Nn,type:Jt})];case 1:Pn.headers=Tt.sent()||Ot,Je=function(Ue){return typeof Ue=="object"&&((0,D.isPlainObject)(Ue)||Array.isArray(Ue)||typeof Ue.toJSON=="function")},!In.headers.has("content-type")&&Je(In.body)&&In.headers.set("content-type",Ie),Je(In.body)&&wt(In.headers)&&(In.body=JSON.stringify(In.body,et)),Hn&&(Dt=~Fr.indexOf("?")?"&":"?",kt=Kt?Kt(Hn):new URLSearchParams(F(Hn)),Fr+=Dt+kt),Fr=function(Ue,cn){if(!Ue)return cn;if(!cn)return Ue;if(function(Cn){return new RegExp("(^|:)//").test(Cn)}(cn))return cn;var En=Ue.endsWith("/")||!cn.startsWith("?")?"/":"";return Ue=function(Cn){return Cn.replace(/\/$/,"")}(Ue),""+Ue+En+function(Cn){return Cn.replace(/^\//,"")}(cn)}(ve,Fr),lt=new Request(Fr,In),St=lt.clone(),vn={request:St},vt=!1,st=On&&setTimeout(function(){vt=!0,Yt.abort()},On),Tt.label=2;case 2:return Tt.trys.push([2,4,5,6]),[4,it(lt)];case 3:return Gt=Tt.sent(),[3,6];case 4:return $e=Tt.sent(),[2,{error:{status:vt?"TIMEOUT_ERROR":"FETCH_ERROR",error:String($e)},meta:vn}];case 5:return st&&clearTimeout(st),[7];case 6:Re=Gt.clone(),vn.response=Re,Ve="",Tt.label=7;case 7:return Tt.trys.push([7,9,,10]),[4,Promise.all([ln(Gt,_r).then(function(Ue){return ze=Ue},function(Ue){return nt=Ue}),Re.text().then(function(Ue){return Ve=Ue},function(){})])];case 8:if(Tt.sent(),nt)throw nt;return[3,10];case 9:return zt=Tt.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:Gt.status,data:Ve,error:String(zt)},meta:vn}];case 10:return[2,Xn(Gt,ze)?{data:ze,meta:vn}:{error:{status:Gt.status,data:ze},meta:vn}]}})})};function ln(an,Yt){return I(this,null,function(){var Be;return r(this,function(yt){switch(yt.label){case 0:return typeof Yt=="function"?[2,Yt(an)]:(Yt==="content-type"&&(Yt=wt(an.headers)?"json":"text"),Yt!=="json"?[3,2]:[4,an.text()]);case 1:return[2,(Be=yt.sent()).length?JSON.parse(Be):null];case 2:return[2,an.text()]}})})}}var Q=function(ne,ae){ae===void 0&&(ae=void 0),this.value=ne,this.meta=ae};function q(ne,ae){return ne===void 0&&(ne=0),ae===void 0&&(ae=5),I(this,null,function(){var ve,Pe;return r(this,function(xe){switch(xe.label){case 0:return ve=Math.min(ne,ae),Pe=~~((Math.random()+.4)*(300<=Re)}var Ln=(0,qe.createAsyncThunk)(Hn+"/executeQuery",xn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je},condition:function(Je,Dt){var kt,lt,St,Gt=(0,Dt.getState)(),vt=(lt=(kt=Gt[Hn])==null?void 0:kt.queries)==null?void 0:lt[Je.queryCacheKey],st=vt==null?void 0:vt.fulfilledTimeStamp,$e=Je.originalArgs,Re=vt==null?void 0:vt.originalArgs,ze=_r[Je.endpointName];return!(!pe(Je)&&((vt==null?void 0:vt.status)==="pending"||!On(Je,Gt)&&(!Z(ze)||!((St=ze==null?void 0:ze.forceRefetch)!=null&&St.call(ze,{currentArg:$e,previousArg:Re,endpointState:vt,state:Gt})))&&st))},dispatchConditionRejection:!0}),In=(0,qe.createAsyncThunk)(Hn+"/executeMutation",xn,{getPendingMeta:function(){var Je;return(Je={startedTimeStamp:Date.now()})[qe.SHOULD_AUTOBATCH]=!0,Je}});function Pn(Je){return function(Dt){var kt,lt;return((lt=(kt=Dt==null?void 0:Dt.meta)==null?void 0:kt.arg)==null?void 0:lt.endpointName)===Je}}return{queryThunk:Ln,mutationThunk:In,prefetch:function(Je,Dt,kt){return function(lt,St){var Gt=function(ze){return"force"in ze}(kt)&&kt.force,vt=function(ze){return"ifOlderThan"in ze}(kt)&&kt.ifOlderThan,st=function(ze){return ze===void 0&&(ze=!0),Xn.endpoints[Je].initiate(Dt,{forceRefetch:ze})},$e=Xn.endpoints[Je].select(Dt)(St());if(Gt)lt(st());else if(vt){var Re=$e==null?void 0:$e.fulfilledTimeStamp;if(!Re)return void lt(st());(Number(new Date)-Number(new Date(Re)))/1e3>=vt&<(st())}else lt(st(!1))}},updateQueryData:function(Je,Dt,kt){return function(lt,St){var Gt,vt,st=Xn.endpoints[Je].select(Dt)(St()),$e={patches:[],inversePatches:[],undo:function(){return lt(Xn.util.patchQueryData(Je,Dt,$e.inversePatches))}};if(st.status===t.uninitialized)return $e;if("data"in st)if((0,Ae.isDraftable)(st.data)){var Re=(0,Ae.produceWithPatches)(st.data,kt),ze=Re[2];(Gt=$e.patches).push.apply(Gt,Re[1]),(vt=$e.inversePatches).push.apply(vt,ze)}else{var Ve=kt(st.data);$e.patches.push({op:"replace",path:[],value:Ve}),$e.inversePatches.push({op:"replace",path:[],value:st.data})}return lt(Xn.util.patchQueryData(Je,Dt,$e.patches)),$e}},upsertQueryData:function(Je,Dt,kt){return function(lt){var St;return lt(Xn.endpoints[Je].initiate(Dt,((St={subscribe:!1,forceRefetch:!0})[ye]=function(){return{data:kt}},St)))}},patchQueryData:function(Je,Dt,kt){return function(lt){lt(Xn.internalActions.queryResultPatched({queryCacheKey:Qn({queryArgs:Dt,endpointDefinition:_r[Je],endpointName:Je}),patches:kt}))}},buildMatchThunkActions:function(Je,Dt){return{matchPending:(0,Te.isAllOf)((0,Te.isPending)(Je),Pn(Dt)),matchFulfilled:(0,Te.isAllOf)((0,Te.isFulfilled)(Je),Pn(Dt)),matchRejected:(0,Te.isAllOf)((0,Te.isRejected)(Je),Pn(Dt))}}}}({baseQuery:Pe,reducerPath:xe,context:ve,api:ne,serializeQueryArgs:pt}),et=Ie.queryThunk,Et=Ie.mutationThunk,At=Ie.patchQueryData,Ht=Ie.updateQueryData,Zt=Ie.upsertQueryData,ln=Ie.prefetch,an=Ie.buildMatchThunkActions,Yt=function(Ot){var $n=Ot.reducerPath,Hn=Ot.queryThunk,ur=Ot.mutationThunk,_r=Ot.context,Qn=_r.endpointDefinitions,Xn=_r.apiUid,xn=_r.extractRehydrationInfo,On=_r.hasRehydrationInfo,Ln=Ot.assertTagType,In=Ot.config,Pn=(0,ge.createAction)($n+"/resetApiState"),Je=(0,ge.createSlice)({name:$n+"/queries",initialState:Rt,reducers:{removeQueryResult:{reducer:function(st,$e){delete st[$e.payload.queryCacheKey]},prepare:(0,ge.prepareAutoBatched)()},queryResultPatched:function(st,$e){var Re=$e.payload,ze=Re.patches;ct(st,Re.queryCacheKey,function(Ve){Ve.data=(0,mt.applyPatches)(Ve.data,ze.concat())})}},extraReducers:function(st){st.addCase(Hn.pending,function($e,Re){var ze,Ve=Re.meta,nt=Re.meta.arg,zt=pe(nt);(nt.subscribe||zt)&&($e[ze=nt.queryCacheKey]!=null||($e[ze]={status:t.uninitialized,endpointName:nt.endpointName})),ct($e,nt.queryCacheKey,function(Tt){Tt.status=t.pending,Tt.requestId=zt&&Tt.requestId?Tt.requestId:Ve.requestId,nt.originalArgs!==void 0&&(Tt.originalArgs=nt.originalArgs),Tt.startedTimeStamp=Ve.startedTimeStamp})}).addCase(Hn.fulfilled,function($e,Re){var ze=Re.meta,Ve=Re.payload;ct($e,ze.arg.queryCacheKey,function(nt){var zt;if(nt.requestId===ze.requestId||pe(ze.arg)){var Tt=Qn[ze.arg.endpointName].merge;if(nt.status=t.fulfilled,Tt)if(nt.data!==void 0){var Ue=ze.fulfilledTimeStamp,cn=ze.arg,En=ze.baseQueryMeta,Cn=ze.requestId,Ir=(0,ge.createNextState)(nt.data,function(ir){return Tt(ir,Ve,{arg:cn.originalArgs,baseQueryMeta:En,fulfilledTimeStamp:Ue,requestId:Cn})});nt.data=Ir}else nt.data=Ve;else nt.data=(zt=Qn[ze.arg.endpointName].structuralSharing)==null||zt?A((0,sn.isDraft)(nt.data)?(0,mt.original)(nt.data):nt.data,Ve):Ve;delete nt.error,nt.fulfilledTimeStamp=ze.fulfilledTimeStamp}})}).addCase(Hn.rejected,function($e,Re){var ze=Re.meta,Ve=ze.condition,nt=ze.requestId,zt=Re.error,Tt=Re.payload;ct($e,ze.arg.queryCacheKey,function(Ue){if(!Ve){if(Ue.requestId!==nt)return;Ue.status=t.rejected,Ue.error=Tt??zt}})}).addMatcher(On,function($e,Re){for(var ze=xn(Re).queries,Ve=0,nt=Object.entries(ze);Ve"u"||navigator.onLine===void 0||navigator.onLine,focused:typeof document>"u"||document.visibilityState!=="hidden",middlewareRegistered:!1},In),reducers:{middlewareRegistered:function(st,$e){st.middlewareRegistered=st.middlewareRegistered!=="conflict"&&Xn===$e.payload||"conflict"}},extraReducers:function(st){st.addCase(re,function($e){$e.online=!0}).addCase(le,function($e){$e.online=!1}).addCase(B,function($e){$e.focused=!0}).addCase(X,function($e){$e.focused=!1}).addMatcher(On,function($e){return C({},$e)})}}),vt=(0,ge.combineReducers)({queries:Je.reducer,mutations:Dt.reducer,provided:kt.reducer,subscriptions:St.reducer,config:Gt.reducer});return{reducer:function(st,$e){return vt(Pn.match($e)?void 0:st,$e)},actions:S(C(C(C(C(C({},Gt.actions),Je.actions),lt.actions),St.actions),Dt.actions),{unsubscribeMutationResult:Dt.actions.removeMutationResult,resetApiState:Pn})}}({context:ve,queryThunk:et,mutationThunk:Et,reducerPath:xe,assertTagType:He,config:{refetchOnFocus:ht,refetchOnReconnect:wt,refetchOnMountOrArgChange:Kt,keepUnusedDataFor:it,reducerPath:xe}}),Be=Yt.reducer,yt=Yt.actions;Xr(ne.util,{patchQueryData:At,updateQueryData:Ht,upsertQueryData:Zt,prefetch:ln,resetApiState:yt.resetApiState}),Xr(ne.internalActions,yt);var Lt=function(Ot){var $n=Ot.reducerPath,Hn=Ot.queryThunk,ur=Ot.api,_r=Ot.context,Qn=_r.apiUid,Xn={invalidateTags:(0,xr.createAction)($n+"/invalidateTags")},xn=[so,yn,oo,Ar,or,Xo];return{middleware:function(Ln){var In=!1,Pn=S(C({},Ot),{internalState:{currentSubscriptions:{}},refetchQuery:On}),Je=xn.map(function(lt){return lt(Pn)}),Dt=function(lt){var St=lt.api,Gt=lt.queryThunk,vt=lt.internalState,st=St.reducerPath+"/subscriptions",$e=null,Re=!1,ze=St.internalActions,Ve=ze.updateSubscriptionOptions,nt=ze.unsubscribeQueryResult;return function(zt,Tt){var Ue,cn;if($e||($e=JSON.parse(JSON.stringify(vt.currentSubscriptions))),St.util.resetApiState.match(zt))return $e=vt.currentSubscriptions={},[!0,!1];if(St.internalActions.internal_probeSubscription.match(zt)){var En=zt.payload;return[!1,!!((Ue=vt.currentSubscriptions[En.queryCacheKey])!=null&&Ue[En.requestId])]}var Cn=function(Sn,sr){var wo,bn,Yn,io,Br,Pi,qf,Yo,Ga;if(Ve.match(sr)){var ma=sr.payload,qa=ma.queryCacheKey,So=ma.requestId;return(wo=Sn==null?void 0:Sn[qa])!=null&&wo[So]&&(Sn[qa][So]=ma.options),!0}if(nt.match(sr)){var ko=sr.payload;return So=ko.requestId,Sn[qa=ko.queryCacheKey]&&delete Sn[qa][So],!0}if(St.internalActions.removeQueryResult.match(sr))return delete Sn[sr.payload.queryCacheKey],!0;if(Gt.pending.match(sr)){var jo=sr.meta;if(So=jo.requestId,(uo=jo.arg).subscribe)return(ds=(Yn=Sn[bn=uo.queryCacheKey])!=null?Yn:Sn[bn]={})[So]=(Br=(io=uo.subscriptionOptions)!=null?io:ds[So])!=null?Br:{},!0}if(Gt.rejected.match(sr)){var ds,Jo=sr.meta,uo=Jo.arg;if(So=Jo.requestId,Jo.condition&&uo.subscribe)return(ds=(qf=Sn[Pi=uo.queryCacheKey])!=null?qf:Sn[Pi]={})[So]=(Ga=(Yo=uo.subscriptionOptions)!=null?Yo:ds[So])!=null?Ga:{},!0}return!1}(vt.currentSubscriptions,zt);if(Cn){Re||($s(function(){var Sn=JSON.parse(JSON.stringify(vt.currentSubscriptions)),sr=(0,ao.produceWithPatches)($e,function(){return Sn});Tt.next(St.internalActions.subscriptionsUpdated(sr[1])),$e=Sn,Re=!1}),Re=!0);var Ir=!!((cn=zt.type)!=null&&cn.startsWith(st)),ir=Gt.rejected.match(zt)&&zt.meta.condition&&!!zt.meta.arg.subscribe;return[!Ir&&!ir,!1]}return[!0,!1]}}(Pn),kt=function(lt){var St=lt.reducerPath,Gt=lt.context,vt=lt.refetchQuery,st=lt.internalState,$e=lt.api.internalActions.removeQueryResult;function Re(ze,Ve){var nt=ze.getState()[St],zt=nt.queries,Tt=st.currentSubscriptions;Gt.batch(function(){for(var Ue=0,cn=Object.keys(Tt);Ue{const{boardToDelete:t,setBoardToDelete:n}=e,{t:r}=J(),o=W(j=>j.config.canRestoreDeletedImagesFromBin),{currentData:s,isFetching:i}=UD((t==null?void 0:t.board_id)??Os.skipToken),l=d.useMemo(()=>ce([we],j=>{const _=(s??[]).map(I=>II(j,I));return{imageUsageSummary:{isInitialImage:Qs(_,I=>I.isInitialImage),isCanvasImage:Qs(_,I=>I.isCanvasImage),isNodesImage:Qs(_,I=>I.isNodesImage),isControlImage:Qs(_,I=>I.isControlImage)}}}),[s]),[u,{isLoading:p}]=GD(),[m,{isLoading:h}]=qD(),{imageUsageSummary:g}=W(l),x=d.useCallback(()=>{t&&(u(t.board_id),n(void 0))},[t,u,n]),y=d.useCallback(()=>{t&&(m(t.board_id),n(void 0))},[t,m,n]),b=d.useCallback(()=>{n(void 0)},[n]),C=d.useRef(null),S=d.useMemo(()=>h||p||i,[h,p,i]);return t?a.jsx(Mf,{isOpen:!!t,onClose:b,leastDestructiveRef:C,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsxs(ra,{fontSize:"lg",fontWeight:"bold",children:["Delete ",t.board_name]}),a.jsx(sa,{children:a.jsxs($,{direction:"column",gap:3,children:[i?a.jsx(Og,{children:a.jsx($,{sx:{w:"full",h:32}})}):a.jsx(TM,{imageUsage:g,topMessage:r("boards.topMessage"),bottomMessage:r("boards.bottomMessage")}),a.jsx(Se,{children:"Deleted boards cannot be restored."}),a.jsx(Se,{children:r(o?"gallery.deleteImageBin":"gallery.deleteImagePermanent")})]})}),a.jsx(Oa,{children:a.jsxs($,{sx:{justifyContent:"space-between",width:"full",gap:2},children:[a.jsx(Mt,{ref:C,onClick:b,children:"Cancel"}),a.jsx(Mt,{colorScheme:"warning",isLoading:S,onClick:x,children:"Delete Board Only"}),a.jsx(Mt,{colorScheme:"error",isLoading:S,onClick:y,children:"Delete Board and Images"})]})})]})})}):null},_ne=d.memo(jne),Ine=()=>{const{t:e}=J(),[t,{isLoading:n}]=KD(),r=e("boards.myBoard"),o=d.useCallback(()=>{t(r)},[t,r]);return a.jsx(ot,{icon:a.jsx(Xi,{}),isLoading:n,tooltip:e("boards.addBoard"),"aria-label":e("boards.addBoard"),onClick:o,size:"sm","data-testid":"add-board-button"})},Pne=d.memo(Ine);var DO=lg({displayName:"ExternalLinkIcon",path:a.jsxs("g",{fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:"2",children:[a.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),a.jsx("path",{d:"M15 3h6v6"}),a.jsx("path",{d:"M10 14L21 3"})]})}),t0=lg({d:"M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z",displayName:"ChevronUpIcon"}),Ene=lg({displayName:"CloseIcon",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"}),Mne=lg({displayName:"DeleteIcon",path:a.jsx("g",{fill:"currentColor",children:a.jsx("path",{d:"M19.452 7.5H4.547a.5.5 0 00-.5.545l1.287 14.136A2 2 0 007.326 24h9.347a2 2 0 001.992-1.819L19.95 8.045a.5.5 0 00-.129-.382.5.5 0 00-.369-.163zm-9.2 13a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zm5 0a.75.75 0 01-1.5 0v-9a.75.75 0 011.5 0zM22 4h-4.75a.25.25 0 01-.25-.25V2.5A2.5 2.5 0 0014.5 0h-5A2.5 2.5 0 007 2.5v1.25a.25.25 0 01-.25.25H2a1 1 0 000 2h20a1 1 0 000-2zM9 3.75V2.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5v1.25a.25.25 0 01-.25.25h-5.5A.25.25 0 019 3.75z"})})});const One=ce([we],({gallery:e})=>{const{boardSearchText:t}=e;return{boardSearchText:t}},je),Rne=()=>{const e=te(),{boardSearchText:t}=W(One),n=d.useRef(null),{t:r}=J(),o=d.useCallback(u=>{e(Ow(u))},[e]),s=d.useCallback(()=>{e(Ow(""))},[e]),i=d.useCallback(u=>{u.key==="Escape"&&s()},[s]),l=d.useCallback(u=>{o(u.target.value)},[o]);return d.useEffect(()=>{n.current&&n.current.focus()},[]),a.jsxs(L3,{children:[a.jsx(gg,{ref:n,placeholder:r("boards.searchBoard"),value:t,onKeyDown:i,onChange:l,"data-testid":"board-search-input"}),t&&t.length&&a.jsx(ay,{children:a.jsx(Pa,{onClick:s,size:"xs",variant:"ghost","aria-label":r("boards.clearSearch"),opacity:.5,icon:a.jsx(Ene,{boxSize:2})})})]})},Ane=d.memo(Rne);function TO(e){return QD(e)}function Dne(e){return XD(e)}const NO=(e,t)=>{var o,s;if(!e||!(t!=null&&t.data.current))return!1;const{actionType:n}=e,{payloadType:r}=t.data.current;if(e.id===t.data.current.id)return!1;switch(n){case"ADD_FIELD_TO_LINEAR":return r==="NODE_FIELD";case"SET_CURRENT_IMAGE":return r==="IMAGE_DTO";case"SET_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_CONTROL_ADAPTER_IMAGE":return r==="IMAGE_DTO";case"SET_CANVAS_INITIAL_IMAGE":return r==="IMAGE_DTO";case"SET_NODES_IMAGE":return r==="IMAGE_DTO";case"SET_MULTI_NODES_IMAGE":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BATCH":return r==="IMAGE_DTO"||"IMAGE_DTOS";case"ADD_TO_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:l}=t.data.current.payload,u=l.board_id??"none",p=e.context.boardId;return u!==p}if(r==="IMAGE_DTOS"){const{imageDTOs:l}=t.data.current.payload,u=((o=l[0])==null?void 0:o.board_id)??"none",p=e.context.boardId;return u!==p}return!1}case"REMOVE_FROM_BOARD":{if(!(r==="IMAGE_DTO"||"IMAGE_DTOS"))return!1;if(r==="IMAGE_DTO"){const{imageDTO:l}=t.data.current.payload;return(l.board_id??"none")!=="none"}if(r==="IMAGE_DTOS"){const{imageDTOs:l}=t.data.current.payload;return(((s=l[0])==null?void 0:s.board_id)??"none")!=="none"}return!1}default:return!1}},Tne=e=>{const{isOver:t,label:n="Drop"}=e,r=d.useRef(oi()),{colorMode:o}=Ci();return a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsxs($,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full"},children:[a.jsx($,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",bg:Ke("base.700","base.900")(o),opacity:.7,borderRadius:"base",alignItems:"center",justifyContent:"center",transitionProperty:"common",transitionDuration:"0.1s"}}),a.jsx($,{sx:{position:"absolute",top:.5,insetInlineStart:.5,insetInlineEnd:.5,bottom:.5,opacity:1,borderWidth:2,borderColor:t?Ke("base.50","base.50")(o):Ke("base.200","base.300")(o),borderRadius:"lg",borderStyle:"dashed",transitionProperty:"common",transitionDuration:"0.1s",alignItems:"center",justifyContent:"center"},children:a.jsx(De,{sx:{fontSize:"2xl",fontWeight:600,transform:t?"scale(1.1)":"scale(1)",color:t?Ke("base.50","base.50")(o):Ke("base.200","base.300")(o),transitionProperty:"common",transitionDuration:"0.1s"},children:n})})]})},r.current)},$O=d.memo(Tne),Nne=e=>{const{dropLabel:t,data:n,disabled:r}=e,o=d.useRef(oi()),{isOver:s,setNodeRef:i,active:l}=TO({id:o.current,disabled:r,data:n});return a.jsx(De,{ref:i,position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",pointerEvents:l?"auto":"none",children:a.jsx(yo,{children:NO(n,l)&&a.jsx($O,{isOver:s,label:t})})})},i2=d.memo(Nne),$ne=({isSelected:e,isHovered:t})=>a.jsx(De,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e?1:.7,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:e?t?"hoverSelected.light":"selected.light":t?"hoverUnselected.light":void 0,_dark:{shadow:e?t?"hoverSelected.dark":"selected.dark":t?"hoverUnselected.dark":void 0}}}),l2=d.memo($ne),Lne=()=>{const{t:e}=J();return a.jsx($,{sx:{position:"absolute",insetInlineEnd:0,top:0,p:1},children:a.jsx(Ha,{variant:"solid",sx:{bg:"accent.400",_dark:{bg:"accent.500"}},children:e("common.auto")})})},LO=d.memo(Lne);function c2(e){const[t,n]=d.useState(!1),[r,o]=d.useState(!1),[s,i]=d.useState(!1),[l,u]=d.useState([0,0]),p=d.useRef(null),m=W(g=>g.ui.globalContextMenuCloseTrigger);d.useEffect(()=>{if(t)setTimeout(()=>{o(!0),setTimeout(()=>{i(!0)})});else{i(!1);const g=setTimeout(()=>{o(t)},1e3);return()=>clearTimeout(g)}},[t]),d.useEffect(()=>{n(!1),i(!1),o(!1)},[m]),$F("contextmenu",g=>{var x;(x=p.current)!=null&&x.contains(g.target)||g.target===p.current?(g.preventDefault(),n(!0),u([g.pageX,g.pageY])):n(!1)});const h=d.useCallback(()=>{var g,x;(x=(g=e.menuProps)==null?void 0:g.onClose)==null||x.call(g),n(!1)},[e.menuProps]);return a.jsxs(a.Fragment,{children:[e.children(p),r&&a.jsx(Eu,{...e.portalProps,children:a.jsxs(bg,{isOpen:s,gutter:0,...e.menuProps,onClose:h,children:[a.jsx(yg,{"aria-hidden":!0,w:1,h:1,style:{position:"absolute",left:l[0],top:l[1],cursor:"default"},...e.menuButtonProps}),e.renderMenu()]})})]})}const n0=e=>{const{boardName:t}=hf(void 0,{selectFromResult:({data:n})=>{const r=n==null?void 0:n.find(s=>s.board_id===e);return{boardName:(r==null?void 0:r.board_name)||AI("boards.uncategorized")}}});return t},zne=({board:e,setBoardToDelete:t})=>{const n=d.useCallback(()=>{t&&t(e)},[e,t]);return a.jsxs(a.Fragment,{children:[e.image_count>0&&a.jsx(a.Fragment,{}),a.jsx(Wn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClick:n,children:"Delete Board"})]})},Fne=d.memo(zne),Bne=()=>a.jsx(a.Fragment,{}),Hne=d.memo(Bne),Wne=({board:e,board_id:t,setBoardToDelete:n,children:r})=>{const{t:o}=J(),s=te(),i=d.useMemo(()=>ce(we,({gallery:b})=>{const C=b.autoAddBoardId===t,S=b.autoAssignBoardOnClick;return{isAutoAdd:C,autoAssignBoardOnClick:S}},je),[t]),{isAutoAdd:l,autoAssignBoardOnClick:u}=W(i),p=n0(t),m=jn("bulkDownload").isFeatureEnabled,[h]=DI(),g=d.useCallback(()=>{s(ng(t))},[t,s]),x=d.useCallback(async()=>{try{const b=await h({image_names:[],board_id:t}).unwrap();s($t({title:o("gallery.preparingDownload"),status:"success",...b.response?{description:b.response}:{}}))}catch{s($t({title:o("gallery.preparingDownloadFailed"),status:"error"}))}},[o,t,h,s]),y=d.useCallback(b=>{b.preventDefault()},[]);return a.jsx(c2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:y,children:a.jsxs(Xd,{title:p,children:[a.jsx(Wn,{icon:a.jsx(Xi,{}),isDisabled:l||u,onClick:g,children:o("boards.menuItemAutoAdd")}),m&&a.jsx(Wn,{icon:a.jsx(zu,{}),onClickCapture:x,children:o("boards.downloadBoard")}),!e&&a.jsx(Hne,{}),e&&a.jsx(Fne,{board:e,setBoardToDelete:n})]})}),children:r})},zO=d.memo(Wne),Vne=({board:e,isSelected:t,setBoardToDelete:n})=>{const r=te(),o=d.useMemo(()=>ce(we,({gallery:D})=>{const R=e.board_id===D.autoAddBoardId,N=D.autoAssignBoardOnClick;return{isSelectedForAutoAdd:R,autoAssignBoardOnClick:N}},je),[e.board_id]),{isSelectedForAutoAdd:s,autoAssignBoardOnClick:i}=W(o),[l,u]=d.useState(!1),p=d.useCallback(()=>{u(!0)},[]),m=d.useCallback(()=>{u(!1)},[]),{data:h}=bb(e.board_id),{data:g}=yb(e.board_id),x=d.useMemo(()=>{if(!((h==null?void 0:h.total)===void 0||(g==null?void 0:g.total)===void 0))return`${h.total} image${h.total===1?"":"s"}, ${g.total} asset${g.total===1?"":"s"}`},[g,h]),{currentData:y}=Ps(e.cover_image_name??Os.skipToken),{board_name:b,board_id:C}=e,[S,j]=d.useState(b),_=d.useCallback(()=>{r(TI({boardId:C})),i&&r(ng(C))},[C,i,r]),[P,{isLoading:I}]=YD(),M=d.useMemo(()=>({id:C,actionType:"ADD_TO_BOARD",context:{boardId:C}}),[C]),O=d.useCallback(async D=>{if(!D.trim()){j(b);return}if(D!==b)try{const{board_name:R}=await P({board_id:C,changes:{board_name:D}}).unwrap();j(R)}catch{j(b)}},[C,b,P]),A=d.useCallback(D=>{j(D)},[]);return a.jsx(De,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx($,{onMouseOver:p,onMouseOut:m,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",w:"full",h:"full"},children:a.jsx(zO,{board:e,board_id:C,setBoardToDelete:n,children:D=>a.jsx(Fn,{label:x,openDelay:1e3,hasArrow:!0,children:a.jsxs($,{ref:D,onClick:_,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[y!=null&&y.thumbnail_url?a.jsx(wi,{src:y==null?void 0:y.thumbnail_url,draggable:!1,sx:{objectFit:"cover",w:"full",h:"full",maxH:"full",borderRadius:"base",borderBottomRadius:"lg"}}):a.jsx($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(Lr,{boxSize:12,as:Oee,sx:{mt:-6,opacity:.7,color:"base.500",_dark:{color:"base.500"}}})}),s&&a.jsx(LO,{}),a.jsx(l2,{isSelected:t,isHovered:l}),a.jsx($,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:t?"accent.400":"base.500",color:t?"base.50":"base.100",_dark:{bg:t?"accent.500":"base.600",color:t?"base.50":"base.100"},lineHeight:"short",fontSize:"xs"},children:a.jsxs(pg,{value:S,isDisabled:I,submitOnBlur:!0,onChange:A,onSubmit:O,sx:{w:"full"},children:[a.jsx(fg,{sx:{p:0,fontWeight:t?700:500,textAlign:"center",overflow:"hidden",textOverflow:"ellipsis"},noOfLines:1}),a.jsx(dg,{sx:{p:0,_focusVisible:{p:0,textAlign:"center",boxShadow:"none"}}})]})}),a.jsx(i2,{data:M,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})},Une=d.memo(Vne),Gne=ce(we,({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),FO=d.memo(({isSelected:e})=>{const t=te(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(Gne),o=n0("none"),s=d.useCallback(()=>{t(TI({boardId:"none"})),r&&t(ng("none"))},[t,r]),[i,l]=d.useState(!1),{data:u}=bb("none"),{data:p}=yb("none"),m=d.useMemo(()=>{if(!((u==null?void 0:u.total)===void 0||(p==null?void 0:p.total)===void 0))return`${u.total} image${u.total===1?"":"s"}, ${p.total} asset${p.total===1?"":"s"}`},[p,u]),h=d.useCallback(()=>{l(!0)},[]),g=d.useCallback(()=>{l(!1)},[]),x=d.useMemo(()=>({id:"no_board",actionType:"REMOVE_FROM_BOARD"}),[]);return a.jsx(De,{sx:{w:"full",h:"full",touchAction:"none",userSelect:"none"},children:a.jsx($,{onMouseOver:h,onMouseOut:g,sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1",borderRadius:"base",w:"full",h:"full"},children:a.jsx(zO,{board_id:"none",children:y=>a.jsx(Fn,{label:m,openDelay:1e3,hasArrow:!0,children:a.jsxs($,{ref:y,onClick:s,sx:{w:"full",h:"full",position:"relative",justifyContent:"center",alignItems:"center",borderRadius:"base",cursor:"pointer",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center"},children:a.jsx(wi,{src:vb,alt:"invoke-ai-logo",sx:{opacity:.4,filter:"grayscale(1)",mt:-6,w:16,h:16,minW:16,minH:16,userSelect:"none"}})}),n==="none"&&a.jsx(LO,{}),a.jsx($,{sx:{position:"absolute",bottom:0,left:0,p:1,justifyContent:"center",alignItems:"center",w:"full",maxW:"full",borderBottomRadius:"base",bg:e?"accent.400":"base.500",color:e?"base.50":"base.100",_dark:{bg:e?"accent.500":"base.600",color:e?"base.50":"base.100"},lineHeight:"short",fontSize:"xs",fontWeight:e?700:500},children:o}),a.jsx(l2,{isSelected:e,isHovered:i}),a.jsx(i2,{data:x,dropLabel:a.jsx(Se,{fontSize:"md",children:"Move"})})]})})})})})});FO.displayName="HoverableBoard";const qne=d.memo(FO),Kne=ce([we],({gallery:e})=>{const{selectedBoardId:t,boardSearchText:n}=e;return{selectedBoardId:t,boardSearchText:n}},je),Qne=e=>{const{isOpen:t}=e,{selectedBoardId:n,boardSearchText:r}=W(Kne),{data:o}=hf(),s=r?o==null?void 0:o.filter(u=>u.board_name.toLowerCase().includes(r.toLowerCase())):o,[i,l]=d.useState();return a.jsxs(a.Fragment,{children:[a.jsx(wf,{in:t,animateOpacity:!0,children:a.jsxs($,{layerStyle:"first",sx:{flexDir:"column",gap:2,p:2,mt:2,borderRadius:"base"},children:[a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(Ane,{}),a.jsx(Pne,{})]}),a.jsx(e0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"move",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsxs(tl,{className:"list-container","data-testid":"boards-list",sx:{gridTemplateColumns:"repeat(auto-fill, minmax(108px, 1fr));",maxH:346},children:[a.jsx(qd,{sx:{p:1.5},"data-testid":"no-board",children:a.jsx(qne,{isSelected:n==="none"})}),s&&s.map((u,p)=>a.jsx(qd,{sx:{p:1.5},"data-testid":`board-${p}`,children:a.jsx(Une,{board:u,isSelected:n===u.board_id,setBoardToDelete:l})},u.board_id))]})})]})}),a.jsx(_ne,{boardToDelete:i,setBoardToDelete:l})]})},Xne=d.memo(Qne),Yne=ce([we],e=>{const{selectedBoardId:t}=e.gallery;return{selectedBoardId:t}},je),Jne=e=>{const{isOpen:t,onToggle:n}=e,{selectedBoardId:r}=W(Yne),o=n0(r),s=d.useMemo(()=>o.length>20?`${o.substring(0,20)}...`:o,[o]);return a.jsxs($,{as:el,onClick:n,size:"sm",sx:{position:"relative",gap:2,w:"full",justifyContent:"space-between",alignItems:"center",px:2},children:[a.jsx(Se,{noOfLines:1,sx:{fontWeight:600,w:"100%",textAlign:"center",color:"base.800",_dark:{color:"base.200"}},children:s}),a.jsx(t0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]})},Zne=d.memo(Jne),ere=e=>{const{triggerComponent:t,children:n,hasArrow:r=!0,isLazy:o=!0,...s}=e;return a.jsxs(Af,{isLazy:o,...s,children:[a.jsx(Eg,{children:t}),a.jsxs(Df,{shadow:"dark-lg",children:[r&&a.jsx(x5,{}),n]})]})},Hf=d.memo(ere);function tre(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M12 16c1.671 0 3-1.331 3-3s-1.329-3-3-3-3 1.331-3 3 1.329 3 3 3z"}},{tag:"path",attr:{d:"M20.817 11.186a8.94 8.94 0 0 0-1.355-3.219 9.053 9.053 0 0 0-2.43-2.43 8.95 8.95 0 0 0-3.219-1.355 9.028 9.028 0 0 0-1.838-.18V2L8 5l3.975 3V6.002c.484-.002.968.044 1.435.14a6.961 6.961 0 0 1 2.502 1.053 7.005 7.005 0 0 1 1.892 1.892A6.967 6.967 0 0 1 19 13a7.032 7.032 0 0 1-.55 2.725 7.11 7.11 0 0 1-.644 1.188 7.2 7.2 0 0 1-.858 1.039 7.028 7.028 0 0 1-3.536 1.907 7.13 7.13 0 0 1-2.822 0 6.961 6.961 0 0 1-2.503-1.054 7.002 7.002 0 0 1-1.89-1.89A6.996 6.996 0 0 1 5 13H3a9.02 9.02 0 0 0 1.539 5.034 9.096 9.096 0 0 0 2.428 2.428A8.95 8.95 0 0 0 12 22a9.09 9.09 0 0 0 1.814-.183 9.014 9.014 0 0 0 3.218-1.355 8.886 8.886 0 0 0 1.331-1.099 9.228 9.228 0 0 0 1.1-1.332A8.952 8.952 0 0 0 21 13a9.09 9.09 0 0 0-.183-1.814z"}}]})(e)}const BO=Oe((e,t)=>{const[n,r]=d.useState(!1),{label:o,value:s,min:i=1,max:l=100,step:u=1,onChange:p,tooltipSuffix:m="",withSliderMarks:h=!1,withInput:g=!1,isInteger:x=!1,inputWidth:y=16,withReset:b=!1,hideTooltip:C=!1,isCompact:S=!1,isDisabled:j=!1,sliderMarks:_,handleReset:P,sliderFormControlProps:I,sliderFormLabelProps:M,sliderMarkProps:O,sliderTrackProps:A,sliderThumbProps:D,sliderNumberInputProps:R,sliderNumberInputFieldProps:N,sliderNumberInputStepperProps:Y,sliderTooltipProps:F,sliderIAIIconButtonProps:V,...Q}=e,q=te(),{t:z}=J(),[G,T]=d.useState(String(s));d.useEffect(()=>{T(s)},[s]);const B=d.useMemo(()=>R!=null&&R.min?R.min:i,[i,R==null?void 0:R.min]),X=d.useMemo(()=>R!=null&&R.max?R.max:l,[l,R==null?void 0:R.max]),re=d.useCallback(Z=>{p(Z)},[p]),le=d.useCallback(Z=>{Z.target.value===""&&(Z.target.value=String(B));const ue=Fl(x?Math.floor(Number(Z.target.value)):Number(G),B,X),fe=kd(ue,u);p(fe),T(fe)},[x,G,B,X,p,u]),se=d.useCallback(Z=>{T(Z)},[]),K=d.useCallback(()=>{P&&P()},[P]),U=d.useCallback(Z=>{Z.target instanceof HTMLDivElement&&Z.target.focus()},[]),ee=d.useCallback(Z=>{Z.shiftKey&&q(Vo(!0))},[q]),de=d.useCallback(Z=>{Z.shiftKey||q(Vo(!1))},[q]);return a.jsxs(Kn,{ref:t,onClick:U,sx:S?{display:"flex",flexDirection:"row",alignItems:"center",columnGap:4,margin:0,padding:0}:{},isDisabled:j,...I,children:[o&&a.jsx(Rr,{sx:g?{mb:-1.5}:{},...M,children:o}),a.jsxs(cy,{w:"100%",gap:2,alignItems:"center",children:[a.jsxs(Cy,{"aria-label":o,value:s,min:i,max:l,step:u,onChange:re,onMouseEnter:()=>r(!0),onMouseLeave:()=>r(!1),focusThumbOnChange:!1,isDisabled:j,...Q,children:[h&&!_&&a.jsxs(a.Fragment,{children:[a.jsx(zc,{value:i,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...O,children:i}),a.jsx(zc,{value:l,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...O,children:l})]}),h&&_&&a.jsx(a.Fragment,{children:_.map((Z,ue)=>ue===0?a.jsx(zc,{value:Z,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},...O,children:Z},Z):ue===_.length-1?a.jsx(zc,{value:Z,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},...O,children:Z},Z):a.jsx(zc,{value:Z,sx:{transform:"translateX(-50%)"},...O,children:Z},Z))}),a.jsx(Sy,{...A,children:a.jsx(ky,{})}),a.jsx(Fn,{hasArrow:!0,placement:"top",isOpen:n,label:`${s}${m}`,hidden:C,...F,children:a.jsx(wy,{...D,zIndex:0})})]}),g&&a.jsxs(Sg,{min:B,max:X,step:u,value:G,onChange:se,onBlur:le,focusInputOnChange:!1,...R,children:[a.jsx(jg,{onKeyDown:ee,onKeyUp:de,minWidth:y,...N}),a.jsxs(kg,{...Y,children:[a.jsx(Ig,{onClick:()=>p(Number(G))}),a.jsx(_g,{onClick:()=>p(Number(G))})]})]}),b&&a.jsx(ot,{size:"sm","aria-label":z("accessibility.reset"),tooltip:z("accessibility.reset"),icon:a.jsx(tre,{}),isDisabled:j,onClick:K,...V})]})]})});BO.displayName="IAISlider";const jt=d.memo(BO),HO=d.forwardRef(({label:e,tooltip:t,description:n,disabled:r,...o},s)=>a.jsx(Fn,{label:t,placement:"top",hasArrow:!0,openDelay:500,children:a.jsx(De,{ref:s,...o,children:a.jsxs(De,{children:[a.jsx(vu,{children:e}),n&&a.jsx(vu,{size:"xs",color:"base.600",children:n})]})})}));HO.displayName="IAIMantineSelectItemWithTooltip";const fl=d.memo(HO),nre=ce([we],({gallery:e})=>{const{autoAddBoardId:t,autoAssignBoardOnClick:n}=e;return{autoAddBoardId:t,autoAssignBoardOnClick:n}},je),rre=()=>{const e=te(),{t}=J(),{autoAddBoardId:n,autoAssignBoardOnClick:r}=W(nre),o=d.useRef(null),{boards:s,hasBoards:i}=hf(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{boards:p,hasBoards:p.length>1}}}),l=d.useCallback(u=>{u&&e(ng(u))},[e]);return a.jsx(tr,{label:t("boards.autoAddBoard"),inputRef:o,autoFocus:!0,placeholder:t("boards.selectBoard"),value:n,data:s,nothingFound:t("boards.noMatching"),itemComponent:fl,disabled:!i||r,filter:(u,p)=>{var m;return((m=p.label)==null?void 0:m.toLowerCase().includes(u.toLowerCase().trim()))||p.value.toLowerCase().includes(u.toLowerCase().trim())},onChange:l})},ore=d.memo(rre),sre=e=>{const{label:t,...n}=e,{colorMode:r}=Ci();return a.jsx(jf,{colorScheme:"accent",...n,children:a.jsx(Se,{sx:{fontSize:"sm",color:Ke("base.800","base.200")(r)},children:t})})},Io=d.memo(sre),are=ce([we],e=>{const{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}=e.gallery;return{galleryImageMinimumWidth:t,shouldAutoSwitch:n,autoAssignBoardOnClick:r}},je),ire=()=>{const e=te(),{t}=J(),{galleryImageMinimumWidth:n,shouldAutoSwitch:r,autoAssignBoardOnClick:o}=W(are),s=d.useCallback(u=>{e(Rw(u))},[e]),i=d.useCallback(()=>{e(Rw(64))},[e]),l=d.useCallback(u=>{e(JD(u.target.checked))},[e]);return a.jsx(Hf,{triggerComponent:a.jsx(ot,{tooltip:t("gallery.gallerySettings"),"aria-label":t("gallery.gallerySettings"),size:"sm",icon:a.jsx(ZM,{})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(jt,{value:n,onChange:s,min:45,max:256,hideTooltip:!0,label:t("gallery.galleryImageSize"),withReset:!0,handleReset:i}),a.jsx(kr,{label:t("gallery.autoSwitchNewImages"),isChecked:r,onChange:l}),a.jsx(Io,{label:t("gallery.autoAssignBoardOnClick"),isChecked:o,onChange:u=>e(ZD(u.target.checked))}),a.jsx(ore,{})]})})},lre=d.memo(ire),cre=e=>e.image?a.jsx(Og,{sx:{w:`${e.image.width}px`,h:"auto",objectFit:"contain",aspectRatio:`${e.image.width}/${e.image.height}`}}):a.jsx($,{sx:{opacity:.7,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(vi,{size:"xl"})}),eo=e=>{const{icon:t=Xl,boxSize:n=16,sx:r,...o}=e;return a.jsxs($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...r},...o,children:[t&&a.jsx(Lr,{as:t,boxSize:n,opacity:.7}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},ure=e=>{const{sx:t,...n}=e;return a.jsxs($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",flexDir:"column",gap:2,userSelect:"none",opacity:.7,color:"base.700",_dark:{color:"base.500"},...t},...n,children:[a.jsx(vi,{size:"xl"}),e.label&&a.jsx(Se,{textAlign:"center",children:e.label})]})},r0=0,pl=1,Fu=2,WO=4;function VO(e,t){return n=>e(t(n))}function dre(e,t){return t(e)}function UO(e,t){return n=>e(t,n)}function Qj(e,t){return()=>e(t)}function o0(e,t){return t(e),e}function vr(...e){return e}function fre(e){e()}function Xj(e){return()=>e}function pre(...e){return()=>{e.map(fre)}}function u2(e){return e!==void 0}function Bu(){}function qn(e,t){return e(pl,t)}function dn(e,t){e(r0,t)}function d2(e){e(Fu)}function ks(e){return e(WO)}function Nt(e,t){return qn(e,UO(t,r0))}function hi(e,t){const n=e(pl,r=>{n(),t(r)});return n}function Mn(){const e=[];return(t,n)=>{switch(t){case Fu:e.splice(0,e.length);return;case pl:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case r0:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function at(e){let t=e;const n=Mn();return(r,o)=>{switch(r){case pl:o(t);break;case r0:t=o;break;case WO:return t}return n(r,o)}}function mre(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case pl:return s?n===s?void 0:(r(),n=s,t=qn(e,s),t):(r(),Bu);case Fu:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function is(e){return o0(Mn(),t=>Nt(e,t))}function Eo(e,t){return o0(at(t),n=>Nt(e,n))}function hre(...e){return t=>e.reduceRight(dre,t)}function Ne(e,...t){const n=hre(...t);return(r,o)=>{switch(r){case pl:return qn(e,n(o));case Fu:d2(e);return}}}function GO(e,t){return e===t}function mr(e=GO){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function tn(e){return t=>n=>{e(n)&&t(n)}}function bt(e){return t=>VO(t,e)}function ei(e){return t=>()=>t(e)}function Ia(e,t){return n=>r=>n(t=e(t,r))}function Su(e){return t=>n=>{e>0?e--:t(n)}}function qi(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Yj(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function hn(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);qn(s,u=>{const p=n;n=n|l,t[i]=u,p!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const l=()=>s([i].concat(t));n===o?l():r=l}}function Jj(...e){return function(t,n){switch(t){case pl:return pre(...e.map(r=>qn(r,n)));case Fu:return;default:throw new Error(`unrecognized action ${t}`)}}}function en(e,t=GO){return Ne(e,mr(t))}function to(...e){const t=Mn(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const l=Math.pow(2,i);qn(s,u=>{n[i]=u,r=r|l,r===o&&dn(t,n)})}),function(s,i){switch(s){case pl:return r===o&&i(n),qn(t,i);case Fu:return d2(t);default:throw new Error(`unrecognized action ${s}`)}}}function Vn(e,t=[],{singleton:n}={singleton:!0}){return{id:gre(),constructor:e,dependencies:t,singleton:n}}const gre=()=>Symbol();function vre(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:i})=>{if(i&&t.has(r))return t.get(r);const l=o(s.map(u=>n(u)));return i&&t.set(r,l),l};return n(e)}function xre(e,t){const n={},r={};let o=0;const s=e.length;for(;o(C[S]=j=>{const _=b[t.methods[S]];dn(_,j)},C),{})}function m(b){return i.reduce((C,S)=>(C[S]=mre(b[t.events[S]]),C),{})}return{Component:H.forwardRef((b,C)=>{const{children:S,...j}=b,[_]=H.useState(()=>o0(vre(e),I=>u(I,j))),[P]=H.useState(Qj(m,_));return dm(()=>{for(const I of i)I in j&&qn(P[I],j[I]);return()=>{Object.values(P).map(d2)}},[j,P,_]),dm(()=>{u(_,j)}),H.useImperativeHandle(C,Xj(p(_))),H.createElement(l.Provider,{value:_},n?H.createElement(n,xre([...r,...o,...i],j),S):S)}),usePublisher:b=>H.useCallback(UO(dn,H.useContext(l)[b]),[b]),useEmitterValue:b=>{const S=H.useContext(l)[b],[j,_]=H.useState(Qj(ks,S));return dm(()=>qn(S,P=>{P!==j&&_(Xj(P))}),[S,j]),j},useEmitter:(b,C)=>{const j=H.useContext(l)[b];dm(()=>qn(j,C),[C,j])}}}const bre=typeof document<"u"?H.useLayoutEffect:H.useEffect,yre=bre;var ls=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(ls||{});const Cre={0:"debug",1:"log",2:"warn",3:"error"},wre=()=>typeof globalThis>"u"?window:globalThis,ml=Vn(()=>{const e=at(3);return{log:at((n,r,o=1)=>{var s;const i=(s=wre().VIRTUOSO_LOG_LEVEL)!=null?s:ks(e);o>=i&&console[Cre[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function f2(e,t=!0){const n=H.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=H.useMemo(()=>new ResizeObserver(s=>{const i=s[0].target;i.offsetParent!==null&&e(i)}),[e]);r=s=>{s&&t?(o.observe(s),n.current=s):(n.current&&o.unobserve(n.current),n.current=null)}}return{ref:n,callbackRef:r}}function ic(e,t=!0){return f2(e,t).callbackRef}function Sre(e,t,n,r,o,s,i){const l=H.useCallback(u=>{const p=kre(u.children,t,"offsetHeight",o);let m=u.parentElement;for(;!m.dataset.virtuosoScroller;)m=m.parentElement;const h=m.lastElementChild.dataset.viewportType==="window",g=i?i.scrollTop:h?window.pageYOffset||document.documentElement.scrollTop:m.scrollTop,x=i?i.scrollHeight:h?document.documentElement.scrollHeight:m.scrollHeight,y=i?i.offsetHeight:h?window.innerHeight:m.offsetHeight;r({scrollTop:Math.max(g,0),scrollHeight:x,viewportHeight:y}),s==null||s(jre("row-gap",getComputedStyle(u).rowGap,o)),p!==null&&e(p)},[e,t,o,s,i,r]);return f2(l,n)}function kre(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i{const g=h.target,x=g===window||g===document,y=x?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=x?document.documentElement.scrollHeight:g.scrollHeight,C=x?window.innerHeight:g.offsetHeight,S=()=>{e({scrollTop:Math.max(y,0),scrollHeight:b,viewportHeight:C})};h.suppressFlushSync?S():e7.flushSync(S),i.current!==null&&(y===i.current||y<=0||y===b-C)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);H.useEffect(()=>{const h=o||s.current;return r(o||s.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[s,u,n,r,o]);function p(h){const g=s.current;if(!g||"offsetHeight"in g&&g.offsetHeight===0)return;const x=h.behavior==="smooth";let y,b,C;g===window?(b=Math.max(sl(document.documentElement,"height"),document.documentElement.scrollHeight),y=window.innerHeight,C=document.documentElement.scrollTop):(b=g.scrollHeight,y=sl(g,"height"),C=g.scrollTop);const S=b-y;if(h.top=Math.ceil(Math.max(Math.min(S,h.top),0)),KO(y,b)||h.top===C){e({scrollTop:C,scrollHeight:b,viewportHeight:y}),x&&t(!0);return}x?(i.current=h.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,g.scrollTo(h)}function m(h){s.current.scrollBy(h)}return{scrollerRef:s,scrollByCallback:m,scrollToCallback:p}}const Do=Vn(()=>{const e=Mn(),t=Mn(),n=at(0),r=Mn(),o=at(0),s=Mn(),i=Mn(),l=at(0),u=at(0),p=at(0),m=at(0),h=Mn(),g=Mn(),x=at(!1);return Nt(Ne(e,bt(({scrollTop:y})=>y)),t),Nt(Ne(e,bt(({scrollHeight:y})=>y)),i),Nt(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:l,fixedHeaderHeight:u,fixedFooterHeight:p,footerHeight:m,scrollHeight:i,smoothScrollTargetReached:r,scrollTo:h,scrollBy:g,statefulScrollTop:o,deviation:n,scrollingInProgress:x}},[],{singleton:!0}),rf={lvl:0};function XO(e,t,n,r=rf,o=rf){return{k:e,v:t,lvl:n,l:r,r:o}}function er(e){return e===rf}function uu(){return rf}function Vx(e,t){if(er(e))return rf;const{k:n,l:r,r:o}=e;if(t===n){if(er(r))return o;if(er(o))return r;{const[s,i]=YO(r);return Em(Vr(e,{k:s,v:i,l:JO(r)}))}}else return tt&&(l=l.concat(Ux(s,t,n))),r>=t&&r<=n&&l.push({k:r,v:o}),r<=n&&(l=l.concat(Ux(i,t,n))),l}function Ol(e){return er(e)?[]:[...Ol(e.l),{k:e.k,v:e.v},...Ol(e.r)]}function YO(e){return er(e.r)?[e.k,e.v]:YO(e.r)}function JO(e){return er(e.r)?e.l:Em(Vr(e,{r:JO(e.r)}))}function Vr(e,t){return XO(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function g1(e){return er(e)||e.lvl>e.r.lvl}function Zj(e){return Gx(e8(e))}function Em(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(g1(t))return e8(Vr(e,{lvl:r-1}));if(!er(t)&&!er(t.r))return Vr(t.r,{l:Vr(t,{r:t.r.l}),r:Vr(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(g1(e))return Gx(Vr(e,{lvl:r-1}));if(!er(n)&&!er(n.l)){const o=n.l,s=g1(o)?n.lvl-1:n.lvl;return Vr(o,{l:Vr(e,{r:o.l,lvl:r-1}),r:Gx(Vr(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function s0(e,t,n){if(er(e))return[];const r=ca(e,t)[0];return _re(Ux(e,r,n))}function ZO(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i({index:t,value:n}))}function Gx(e){const{r:t,lvl:n}=e;return!er(t)&&!er(t.r)&&t.lvl===n&&t.r.lvl===n?Vr(t,{l:Vr(e,{r:t.l}),lvl:n+1}):e}function e8(e){const{l:t}=e;return!er(t)&&t.lvl===e.lvl?Vr(t,{r:Vr(e,{l:t.r})}):e}function Uh(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],l=n(i,t);if(l===0)return s;if(l===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function t8(e,t,n){return e[Uh(e,t,n)]}function Ire(e,t,n,r){const o=Uh(e,t,r),s=Uh(e,n,r,o);return e.slice(o,s+1)}const p2=Vn(()=>({recalcInProgress:at(!1)}),[],{singleton:!0});function Pre(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function e_(e,t){let n=0,r=0;for(;n=m||o===g)&&(e=Vx(e,m)):(p=g!==o,u=!0),h>i&&i>=m&&g!==o&&(e=os(e,i+1,g));p&&(e=os(e,s,o))}return[e,n]}function Mre(){return{offsetTree:[],sizeTree:uu(),groupOffsetTree:uu(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function m2({index:e},t){return t===e?0:t0&&(t=Math.max(t,t8(e,r,m2).offset)),ZO(Ire(e,t,n,Ore),Rre)}function qx(e,t,n,r){let o=e,s=0,i=0,l=0,u=0;if(t!==0){u=Uh(o,t-1,m2),l=o[u].offset;const m=ca(n,t-1);s=m[0],i=m[1],o.length&&o[u].size===ca(n,t)[1]&&(u-=1),o=o.slice(0,u+1)}else o=[];for(const{start:p,value:m}of s0(n,t,1/0)){const h=p-s,g=h*i+l+h*r;o.push({offset:g,size:m,index:p}),s=p,l=g,i=m}return{offsetTree:o,lastIndex:s,lastOffset:l,lastSize:i}}function Dre(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,ls.DEBUG);const s=e.sizeTree;let i=s,l=0;if(n.length>0&&er(s)&&t.length===2){const g=t[0].size,x=t[1].size;i=n.reduce((y,b)=>os(os(y,b,g),b+1,x),i)}else[i,l]=Ere(i,t);if(i===s)return e;const{offsetTree:u,lastIndex:p,lastSize:m,lastOffset:h}=qx(e.offsetTree,l,i,o);return{sizeTree:i,offsetTree:u,lastIndex:p,lastOffset:h,lastSize:m,groupOffsetTree:n.reduce((g,x)=>os(g,x,sf(x,u,o)),uu()),groupIndices:n}}function sf(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=t8(t,e,m2),i=e-o,l=s*i+(i-1)*n+r;return l>0?l+n:l}function Tre(e){return typeof e.groupIndex<"u"}function n8(e,t,n){if(Tre(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=r8(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function r8(e,t){if(!a0(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function a0(e){return!er(e.groupOffsetTree)}function Nre(e){return Ol(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],i=s?s.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const $re={offsetHeight:"height",offsetWidth:"width"},Va=Vn(([{log:e},{recalcInProgress:t}])=>{const n=Mn(),r=Mn(),o=Eo(r,0),s=Mn(),i=Mn(),l=at(0),u=at([]),p=at(void 0),m=at(void 0),h=at((I,M)=>sl(I,$re[M])),g=at(void 0),x=at(0),y=Mre(),b=Eo(Ne(n,hn(u,e,x),Ia(Dre,y),mr()),y),C=Eo(Ne(u,mr(),Ia((I,M)=>({prev:I.current,current:M}),{prev:[],current:[]}),bt(({prev:I})=>I)),[]);Nt(Ne(u,tn(I=>I.length>0),hn(b,x),bt(([I,M,O])=>{const A=I.reduce((D,R,N)=>os(D,R,sf(R,M.offsetTree,O)||N),uu());return{...M,groupIndices:I,groupOffsetTree:A}})),b),Nt(Ne(r,hn(b),tn(([I,{lastIndex:M}])=>I[{startIndex:I,endIndex:M,size:O}])),n),Nt(p,m);const S=Eo(Ne(p,bt(I=>I===void 0)),!0);Nt(Ne(m,tn(I=>I!==void 0&&er(ks(b).sizeTree)),bt(I=>[{startIndex:0,endIndex:0,size:I}])),n);const j=is(Ne(n,hn(b),Ia(({sizes:I},[M,O])=>({changed:O!==I,sizes:O}),{changed:!1,sizes:y}),bt(I=>I.changed)));qn(Ne(l,Ia((I,M)=>({diff:I.prev-M,prev:M}),{diff:0,prev:0}),bt(I=>I.diff)),I=>{const{groupIndices:M}=ks(b);if(I>0)dn(t,!0),dn(s,I+e_(I,M));else if(I<0){const O=ks(C);O.length>0&&(I-=e_(-I,O)),dn(i,I)}}),qn(Ne(l,hn(e)),([I,M])=>{I<0&&M("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:l},ls.ERROR)});const _=is(s);Nt(Ne(s,hn(b),bt(([I,M])=>{const O=M.groupIndices.length>0,A=[],D=M.lastSize;if(O){const R=of(M.sizeTree,0);let N=0,Y=0;for(;N{let G=Q.ranges;return Q.prevSize!==0&&(G=[...Q.ranges,{startIndex:Q.prevIndex,endIndex:q+I-1,size:Q.prevSize}]),{ranges:G,prevIndex:q+I,prevSize:z}},{ranges:A,prevIndex:I,prevSize:0}).ranges}return Ol(M.sizeTree).reduce((R,{k:N,v:Y})=>({ranges:[...R.ranges,{startIndex:R.prevIndex,endIndex:N+I-1,size:R.prevSize}],prevIndex:N+I,prevSize:Y}),{ranges:[],prevIndex:0,prevSize:D}).ranges})),n);const P=is(Ne(i,hn(b,x),bt(([I,{offsetTree:M},O])=>{const A=-I;return sf(A,M,O)})));return Nt(Ne(i,hn(b,x),bt(([I,M,O])=>{if(M.groupIndices.length>0){if(er(M.sizeTree))return M;let D=uu();const R=ks(C);let N=0,Y=0,F=0;for(;N<-I;){F=R[Y];const Q=R[Y+1]-F-1;Y++,N+=Q+1}if(D=Ol(M.sizeTree).reduce((Q,{k:q,v:z})=>os(Q,Math.max(0,q+I),z),D),N!==-I){const Q=of(M.sizeTree,F);D=os(D,0,Q);const q=ca(M.sizeTree,-I+1)[1];D=os(D,1,q)}return{...M,sizeTree:D,...qx(M.offsetTree,0,D,O)}}else{const D=Ol(M.sizeTree).reduce((R,{k:N,v:Y})=>os(R,Math.max(0,N+I),Y),uu());return{...M,sizeTree:D,...qx(M.offsetTree,0,D,O)}}})),b),{data:g,totalCount:r,sizeRanges:n,groupIndices:u,defaultItemSize:m,fixedItemSize:p,unshiftWith:s,shiftWith:i,shiftWithOffset:P,beforeUnshiftWith:_,firstItemIndex:l,gap:x,sizes:b,listRefresh:j,statefulTotalCount:o,trackItemSizes:S,itemSize:h}},vr(ml,p2),{singleton:!0}),Lre=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function o8(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Lre)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Wf=Vn(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:i,smoothScrollTargetReached:l,headerHeight:u,footerHeight:p,fixedHeaderHeight:m,fixedFooterHeight:h},{log:g}])=>{const x=Mn(),y=at(0);let b=null,C=null,S=null;function j(){b&&(b(),b=null),S&&(S(),S=null),C&&(clearTimeout(C),C=null),dn(o,!1)}return Nt(Ne(x,hn(e,s,t,y,u,p,g),hn(r,m,h),bt(([[_,P,I,M,O,A,D,R],N,Y,F])=>{const V=o8(_),{align:Q,behavior:q,offset:z}=V,G=M-1,T=n8(V,P,G);let B=sf(T,P.offsetTree,N)+A;Q==="end"?(B+=Y+ca(P.sizeTree,T)[1]-I+F,T===G&&(B+=D)):Q==="center"?B+=(Y+ca(P.sizeTree,T)[1]-I+F)/2:B-=O,z&&(B+=z);const X=re=>{j(),re?(R("retrying to scroll to",{location:_},ls.DEBUG),dn(x,_)):R("list did not change, scroll successful",{},ls.DEBUG)};if(j(),q==="smooth"){let re=!1;S=qn(n,le=>{re=re||le}),b=hi(l,()=>{X(re)})}else b=hi(Ne(n,zre(150)),X);return C=setTimeout(()=>{j()},1200),dn(o,!0),R("scrolling from index to",{index:T,top:B,behavior:q},ls.DEBUG),{top:B,behavior:q}})),i),{scrollToIndex:x,topListHeight:y}},vr(Va,Do,ml),{singleton:!0});function zre(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const af="up",Nd="down",Fre="none",Bre={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Hre=0,Vf=Vn(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const i=at(!1),l=at(!0),u=Mn(),p=Mn(),m=at(4),h=at(Hre),g=Eo(Ne(Jj(Ne(en(t),Su(1),ei(!0)),Ne(en(t),Su(1),ei(!1),Yj(100))),mr()),!1),x=Eo(Ne(Jj(Ne(s,ei(!0)),Ne(s,ei(!1),Yj(200))),mr()),!1);Nt(Ne(to(en(t),en(h)),bt(([j,_])=>j<=_),mr()),l),Nt(Ne(l,qi(50)),p);const y=is(Ne(to(e,en(n),en(r),en(o),en(m)),Ia((j,[{scrollTop:_,scrollHeight:P},I,M,O,A])=>{const D=_+I-P>-A,R={viewportHeight:I,scrollTop:_,scrollHeight:P};if(D){let Y,F;return _>j.state.scrollTop?(Y="SCROLLED_DOWN",F=j.state.scrollTop-_):(Y="SIZE_DECREASED",F=j.state.scrollTop-_||j.scrollTopDelta),{atBottom:!0,state:R,atBottomBecause:Y,scrollTopDelta:F}}let N;return R.scrollHeight>j.state.scrollHeight?N="SIZE_INCREASED":Ij&&j.atBottom===_.atBottom))),b=Eo(Ne(e,Ia((j,{scrollTop:_,scrollHeight:P,viewportHeight:I})=>{if(KO(j.scrollHeight,P))return{scrollTop:_,scrollHeight:P,jump:0,changed:!1};{const M=P-(_+I)<1;return j.scrollTop!==_&&M?{scrollHeight:P,scrollTop:_,jump:j.scrollTop-_,changed:!0}:{scrollHeight:P,scrollTop:_,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),tn(j=>j.changed),bt(j=>j.jump)),0);Nt(Ne(y,bt(j=>j.atBottom)),i),Nt(Ne(i,qi(50)),u);const C=at(Nd);Nt(Ne(e,bt(({scrollTop:j})=>j),mr(),Ia((j,_)=>ks(x)?{direction:j.direction,prevScrollTop:_}:{direction:_j.direction)),C),Nt(Ne(e,qi(50),ei(Fre)),C);const S=at(0);return Nt(Ne(g,tn(j=>!j),ei(0)),S),Nt(Ne(t,qi(100),hn(g),tn(([j,_])=>!!_),Ia(([j,_],[P])=>[_,P],[0,0]),bt(([j,_])=>_-j)),S),{isScrolling:g,isAtTop:l,isAtBottom:i,atBottomState:y,atTopStateChange:p,atBottomStateChange:u,scrollDirection:C,atBottomThreshold:m,atTopThreshold:h,scrollVelocity:S,lastJumpDueToItemResize:b}},vr(Do)),hl=Vn(([{log:e}])=>{const t=at(!1),n=is(Ne(t,tn(r=>r),mr()));return qn(t,r=>{r&&ks(e)("props updated",{},ls.DEBUG)}),{propsReady:t,didMount:n}},vr(ml),{singleton:!0});function h2(e,t){e==0?t():requestAnimationFrame(()=>h2(e-1,t))}function g2(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Uf=Vn(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o},{didMount:s}])=>{const i=at(!0),l=at(0),u=at(!1);return Nt(Ne(s,hn(l),tn(([p,m])=>!!m),ei(!1)),i),qn(Ne(to(t,s),hn(i,e,n,u),tn(([[,p],m,{sizeTree:h},g,x])=>p&&(!er(h)||u2(g))&&!m&&!x),hn(l)),([,p])=>{dn(u,!0),h2(3,()=>{hi(r,()=>dn(i,!0)),dn(o,p)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l}},vr(Va,Do,Wf,hl),{singleton:!0});function t_(e){return e?e==="smooth"?"smooth":"auto":!1}const Wre=(e,t)=>typeof e=="function"?t_(e(t)):t&&t_(e),Vre=Vn(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:i,didMount:l},{log:u},{scrollingInProgress:p}])=>{const m=at(!1),h=Mn();let g=null;function x(b){dn(o,{index:"LAST",align:"end",behavior:b})}qn(Ne(to(Ne(en(e),Su(1)),l),hn(en(m),n,s,p),bt(([[b,C],S,j,_,P])=>{let I=C&&_,M="auto";return I&&(M=Wre(S,j||P),I=I&&!!M),{totalCount:b,shouldFollow:I,followOutputBehavior:M}}),tn(({shouldFollow:b})=>b)),({totalCount:b,followOutputBehavior:C})=>{g&&(g(),g=null),g=hi(t,()=>{ks(u)("following output to ",{totalCount:b},ls.DEBUG),x(C),g=null})});function y(b){const C=hi(r,S=>{b&&!S.atBottom&&S.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(ks(u)("scrolling to bottom due to increased size",{},ls.DEBUG),x("auto"))});setTimeout(C,100)}return qn(Ne(to(en(m),e,i),tn(([b,,C])=>b&&C),Ia(({value:b},[,C])=>({refreshed:b===C,value:C}),{refreshed:!1,value:0}),tn(({refreshed:b})=>b),hn(m,e)),([,b])=>{y(b!==!1)}),qn(h,()=>{y(ks(m)!==!1)}),qn(to(en(m),r),([b,C])=>{b&&!C.atBottom&&C.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&x("auto")}),{followOutput:m,autoscrollToBottom:h}},vr(Va,Vf,Wf,Uf,hl,ml,Do));function Ure(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const s8=Vn(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Mn(),i=Mn(),l=is(Ne(s,bt(Ure)));return Nt(Ne(l,bt(u=>u.totalCount)),e),Nt(Ne(l,bt(u=>u.groupIndices)),t),Nt(Ne(to(r,n,o),tn(([u,p])=>a0(p)),bt(([u,p,m])=>ca(p.groupOffsetTree,Math.max(u-m,0),"v")[0]),mr(),bt(u=>[u])),i),{groupCounts:s,topItemsIndexes:i}},vr(Va,Do));function lf(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function a8(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Gh="top",qh="bottom",n_="none";function r_(e,t,n){return typeof e=="number"?n===af&&t===Gh||n===Nd&&t===qh?e:0:n===af?t===Gh?e.main:e.reverse:t===qh?e.main:e.reverse}function o_(e,t){return typeof e=="number"?e:e[t]||0}const v2=Vn(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Mn(),i=at(0),l=at(0),u=at(0),p=Eo(Ne(to(en(e),en(t),en(r),en(s,lf),en(u),en(i),en(o),en(n),en(l)),bt(([m,h,g,[x,y],b,C,S,j,_])=>{const P=m-j,I=C+S,M=Math.max(g-P,0);let O=n_;const A=o_(_,Gh),D=o_(_,qh);return x-=j,x+=g+S,y+=g+S,y-=j,x>m+I-A&&(O=af),ym!=null),mr(lf)),[0,0]);return{listBoundary:s,overscan:u,topListHeight:i,increaseViewportBy:l,visibleRange:p}},vr(Do),{singleton:!0});function Gre(e,t,n){if(a0(t)){const r=r8(e,t);return[{index:ca(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const s_={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function a_(e,t,n){if(e.length===0)return[];if(!a0(t))return e.map(p=>({...p,index:p.index+n,originalIndex:p.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=s0(t.groupOffsetTree,r,o);let l,u=0;for(const p of e){(!l||l.end0){p=e[0].offset;const b=e[e.length-1];m=b.offset+b.size}const h=n-u,g=l+h*i+(h-1)*r,x=p,y=g-m;return{items:a_(e,o,s),topItems:a_(t,o,s),topListHeight:t.reduce((b,C)=>C.size+b,0),offsetTop:p,offsetBottom:y,top:x,bottom:m,totalCount:n,firstItemIndex:s}}const lc=Vn(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:i,listBoundary:l,topListHeight:u},{scrolledToInitialItem:p,initialTopMostItemIndex:m},{topListHeight:h},g,{didMount:x},{recalcInProgress:y}])=>{const b=at([]),C=Mn();Nt(s.topItemsIndexes,b);const S=Eo(Ne(to(x,y,en(i,lf),en(t),en(e),en(m),p,en(b),en(r),en(o),n),tn(([I,M,,O,,,,,,,A])=>{const D=A&&A.length!==O;return I&&!M&&!D}),bt(([,,[I,M],O,A,D,R,N,Y,F,V])=>{const Q=A,{sizeTree:q,offsetTree:z}=Q;if(O===0||I===0&&M===0)return{...s_,totalCount:O};if(er(q))return Mm(Gre(g2(D,O),Q,V),[],O,F,Q,Y);const G=[];if(N.length>0){const le=N[0],se=N[N.length-1];let K=0;for(const U of s0(q,le,se)){const ee=U.value,de=Math.max(U.start,le),Z=Math.min(U.end,se);for(let ue=de;ue<=Z;ue++)G.push({index:ue,size:ee,offset:K,data:V&&V[ue]}),K+=ee}}if(!R)return Mm([],G,O,F,Q,Y);const T=N.length>0?N[N.length-1]+1:0,B=Are(z,I,M,T);if(B.length===0)return null;const X=O-1,re=o0([],le=>{for(const se of B){const K=se.value;let U=K.offset,ee=se.start;const de=K.size;if(K.offset=M);ue++)le.push({index:ue,size:de,offset:U,data:V&&V[ue]}),U+=de+F}});return Mm(re,G,O,F,Q,Y)}),tn(I=>I!==null),mr()),s_);Nt(Ne(n,tn(u2),bt(I=>I==null?void 0:I.length)),t),Nt(Ne(S,bt(I=>I.topListHeight)),h),Nt(h,u),Nt(Ne(S,bt(I=>[I.top,I.bottom])),l),Nt(Ne(S,bt(I=>I.items)),C);const j=is(Ne(S,tn(({items:I})=>I.length>0),hn(t,n),tn(([{items:I},M])=>I[I.length-1].originalIndex===M-1),bt(([,I,M])=>[I-1,M]),mr(lf),bt(([I])=>I))),_=is(Ne(S,qi(200),tn(({items:I,topItems:M})=>I.length>0&&I[0].originalIndex===M.length),bt(({items:I})=>I[0].index),mr())),P=is(Ne(S,tn(({items:I})=>I.length>0),bt(({items:I})=>{let M=0,O=I.length-1;for(;I[M].type==="group"&&MM;)O--;return{startIndex:I[M].index,endIndex:I[O].index}}),mr(a8)));return{listState:S,topItemsIndexes:b,endReached:j,startReached:_,rangeChanged:P,itemsRendered:C,...g}},vr(Va,s8,v2,Uf,Wf,Vf,hl,p2),{singleton:!0}),qre=Vn(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{listState:s},{didMount:i}])=>{const l=at(0);return Nt(Ne(i,hn(l),tn(([,u])=>u!==0),hn(o,e,t,r,n),bt(([[,u],p,m,h,g,x=[]])=>{let y=0;if(m.groupIndices.length>0)for(const j of m.groupIndices){if(j-y>=u)break;y++}const b=u+y,C=g2(p,b),S=Array.from({length:b}).map((j,_)=>({index:_+C,size:0,offset:0,data:x[_+C]}));return Mm(S,[],b,g,m,h)})),s),{initialItemCount:l}},vr(Va,Uf,lc,hl),{singleton:!0}),i8=Vn(([{scrollVelocity:e}])=>{const t=at(!1),n=Mn(),r=at(!1);return Nt(Ne(e,hn(r,t,n),tn(([o,s])=>!!s),bt(([o,s,i,l])=>{const{exit:u,enter:p}=s;if(i){if(u(o,l))return!1}else if(p(o,l))return!0;return i}),mr()),t),qn(Ne(to(t,e,n),hn(r)),([[o,s,i],l])=>o&&l&&l.change&&l.change(s,i)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},vr(Vf),{singleton:!0}),Kre=Vn(([{topItemsIndexes:e}])=>{const t=at(0);return Nt(Ne(t,tn(n=>n>0),bt(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},vr(lc)),l8=Vn(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Mn(),i=Eo(Ne(to(e,r,t,n,o),bt(([l,u,p,m,h])=>l+u+p+m+h.offsetBottom+h.bottom)),0);return Nt(en(i),s),{totalListHeight:i,totalListHeightChanged:s}},vr(Do,lc),{singleton:!0});function c8(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const Qre=c8(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Xre=Vn(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:i,lastJumpDueToItemResize:l},{listState:u},{beforeUnshiftWith:p,shiftWithOffset:m,sizes:h,gap:g},{log:x},{recalcInProgress:y}])=>{const b=is(Ne(u,hn(l),Ia(([,S,j,_],[{items:P,totalCount:I,bottom:M,offsetBottom:O},A])=>{const D=M+O;let R=0;return j===I&&S.length>0&&P.length>0&&(P[0].originalIndex===0&&S[0].originalIndex===0||(R=D-_,R!==0&&(R+=A))),[R,P,I,D]},[0,[],0,0]),tn(([S])=>S!==0),hn(t,i,r,s,x,y),tn(([,S,j,_,,,P])=>!P&&!_&&S!==0&&j===af),bt(([[S],,,,,j])=>(j("Upward scrolling compensation",{amount:S},ls.DEBUG),S))));function C(S){S>0?(dn(e,{top:-S,behavior:"auto"}),dn(n,0)):(dn(n,0),dn(e,{top:-S,behavior:"auto"}))}return qn(Ne(b,hn(n,o)),([S,j,_])=>{_&&Qre()?dn(n,j-S):C(-S)}),qn(Ne(to(Eo(o,!1),n,y),tn(([S,j,_])=>!S&&!_&&j!==0),bt(([S,j])=>j),qi(1)),C),Nt(Ne(m,bt(S=>({top:-S}))),e),qn(Ne(p,hn(h,g),bt(([S,{lastSize:j,groupIndices:_,sizeTree:P},I])=>{function M(O){return O*(j+I)}if(_.length===0)return M(S);{let O=0;const A=of(P,0);let D=0,R=0;for(;DS&&(O-=A,N=S-D+1),D+=N,O+=M(N),R++}return O}})),S=>{dn(n,S),requestAnimationFrame(()=>{dn(e,{top:S}),requestAnimationFrame(()=>{dn(n,0),dn(y,!1)})})}),{deviation:n}},vr(Do,Vf,lc,Va,ml,p2)),Yre=Vn(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=at(0);return qn(Ne(e,hn(r),tn(([,o])=>o!==0),bt(([,o])=>({top:o}))),o=>{hi(Ne(n,Su(1),tn(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{dn(t,o)})})}),{initialScrollTop:r}},vr(hl,Do,lc),{singleton:!0}),Jre=Vn(([{viewportHeight:e},{totalListHeight:t}])=>{const n=at(!1),r=Eo(Ne(to(n,e,t),tn(([o])=>o),bt(([,o,s])=>Math.max(0,o-s)),qi(0),mr()),0);return{alignToBottom:n,paddingTopAddition:r}},vr(Do,l8),{singleton:!0}),x2=Vn(([{scrollTo:e,scrollContainerState:t}])=>{const n=Mn(),r=Mn(),o=Mn(),s=at(!1),i=at(void 0);return Nt(Ne(to(n,r),bt(([{viewportHeight:l,scrollTop:u,scrollHeight:p},{offsetTop:m}])=>({scrollTop:Math.max(0,u-m),scrollHeight:p,viewportHeight:l}))),t),Nt(Ne(e,hn(r),bt(([l,{offsetTop:u}])=>({...l,top:l.top+u}))),o),{useWindowScroll:s,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},vr(Do)),Zre=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...i}})=>er?{...i,behavior:o,align:s??"end"}:null,eoe=Vn(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:i,fixedFooterHeight:l,scrollingInProgress:u},{scrollToIndex:p}])=>{const m=Mn();return Nt(Ne(m,hn(e,o,t,s,i,l,r),hn(n),bt(([[h,g,x,y,b,C,S,j],_])=>{const{done:P,behavior:I,align:M,calculateViewLocation:O=Zre,...A}=h,D=n8(h,g,y-1),R=sf(D,g.offsetTree,_)+b+C,N=R+ca(g.sizeTree,D)[1],Y=j+C,F=j+x-S,V=O({itemTop:R,itemBottom:N,viewportTop:Y,viewportBottom:F,locationParams:{behavior:I,align:M,...A}});return V?P&&hi(Ne(u,tn(Q=>Q===!1),Su(ks(u)?1:2)),P):P&&P(),V}),tn(h=>h!==null)),p),{scrollIntoView:m}},vr(Va,Do,Wf,lc,ml),{singleton:!0}),toe=Vn(([{sizes:e,sizeRanges:t},{scrollTop:n},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:s,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Mn(),p=at(void 0),m=at(null),h=at(null);return Nt(i,m),Nt(l,h),qn(Ne(u,hn(e,n,s,m,h)),([g,x,y,b,C,S])=>{const j=Nre(x.sizeTree);b&&C!==null&&S!==null&&(y=C.scrollTop-S.offsetTop),g({ranges:j,scrollTop:y})}),Nt(Ne(p,tn(u2),bt(noe)),r),Nt(Ne(o,hn(p),tn(([,g])=>g!==void 0),mr(),bt(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:p}},vr(Va,Do,Uf,hl,x2));function noe(e){return{offset:e.scrollTop,index:0,align:"start"}}const roe=Vn(([e,t,n,r,o,s,i,l,u,p])=>({...e,...t,...n,...r,...o,...s,...i,...l,...u,...p}),vr(v2,qre,hl,i8,l8,Yre,Jre,x2,eoe,ml)),ooe=Vn(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:i,firstItemIndex:l,groupIndices:u,statefulTotalCount:p,gap:m,sizes:h},{initialTopMostItemIndex:g,scrolledToInitialItem:x},y,b,C,{listState:S,topItemsIndexes:j,..._},{scrollToIndex:P},I,{topItemCount:M},{groupCounts:O},A])=>(Nt(_.rangeChanged,A.scrollSeekRangeChanged),Nt(Ne(A.windowViewportRect,bt(D=>D.visibleHeight)),y.viewportHeight),{totalCount:e,data:i,firstItemIndex:l,sizeRanges:t,initialTopMostItemIndex:g,scrolledToInitialItem:x,topItemsIndexes:j,topItemCount:M,groupCounts:O,fixedItemHeight:n,defaultItemHeight:r,gap:m,...C,statefulTotalCount:p,listState:S,scrollToIndex:P,trackItemSizes:o,itemSize:s,groupIndices:u,..._,...A,...y,sizes:h,...b}),vr(Va,Uf,Do,toe,Vre,lc,Wf,Xre,Kre,s8,roe)),v1="-webkit-sticky",i_="sticky",u8=c8(()=>{if(typeof document>"u")return i_;const e=document.createElement("div");return e.style.position=v1,e.style.position===v1?v1:i_});function d8(e,t){const n=H.useRef(null),r=H.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),p=u.width;let m,h;if(t){const g=t.getBoundingClientRect(),x=u.top-g.top;m=g.height-Math.max(0,x),h=x+t.scrollTop}else m=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;n.current={offsetTop:h,visibleHeight:m,visibleWidth:p},e(n.current)},[e,t]),{callbackRef:o,ref:s}=f2(r),i=H.useCallback(()=>{r(s.current)},[r,s]);return H.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(i);return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}const f8=H.createContext(void 0),p8=H.createContext(void 0);function m8(e){return e}const soe=Vn(()=>{const e=at(u=>`Item ${u}`),t=at(null),n=at(u=>`Group ${u}`),r=at({}),o=at(m8),s=at("div"),i=at(Bu),l=(u,p=null)=>Eo(Ne(r,bt(m=>m[u]),mr()),p);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,headerFooterTag:s,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),TopItemListComponent:l("TopItemList"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),GroupComponent:l("Group","div"),ScrollerComponent:l("Scroller","div"),EmptyPlaceholder:l("EmptyPlaceholder"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder")}}),aoe=Vn(([e,t])=>({...e,...t}),vr(ooe,soe)),ioe=({height:e})=>H.createElement("div",{style:{height:e}}),loe={position:u8(),zIndex:1,overflowAnchor:"none"},coe={overflowAnchor:"none"},l_=H.memo(function({showTopList:t=!1}){const n=kn("listState"),r=js("sizeRanges"),o=kn("useWindowScroll"),s=kn("customScrollParent"),i=js("windowScrollContainerState"),l=js("scrollContainerState"),u=s||o?i:l,p=kn("itemContent"),m=kn("context"),h=kn("groupContent"),g=kn("trackItemSizes"),x=kn("itemSize"),y=kn("log"),b=js("gap"),{callbackRef:C}=Sre(r,x,g,t?Bu:u,y,b,s),[S,j]=H.useState(0);b2("deviation",V=>{S!==V&&j(V)});const _=kn("EmptyPlaceholder"),P=kn("ScrollSeekPlaceholder")||ioe,I=kn("ListComponent"),M=kn("ItemComponent"),O=kn("GroupComponent"),A=kn("computeItemKey"),D=kn("isSeeking"),R=kn("groupIndices").length>0,N=kn("paddingTopAddition"),Y=kn("scrolledToInitialItem"),F=t?{}:{boxSizing:"border-box",paddingTop:n.offsetTop+N,paddingBottom:n.offsetBottom,marginTop:S,...Y?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&_?H.createElement(_,Bo(_,m)):H.createElement(I,{...Bo(I,m),ref:C,style:F,"data-test-id":t?"virtuoso-top-item-list":"virtuoso-item-list"},(t?n.topItems:n.items).map(V=>{const Q=V.originalIndex,q=A(Q+n.firstItemIndex,V.data,m);return D?H.createElement(P,{...Bo(P,m),key:q,index:V.index,height:V.size,type:V.type||"item",...V.type==="group"?{}:{groupIndex:V.groupIndex}}):V.type==="group"?H.createElement(O,{...Bo(O,m),key:q,"data-index":Q,"data-known-size":V.size,"data-item-index":V.index,style:loe},h(V.index,m)):H.createElement(M,{...Bo(M,m),key:q,"data-index":Q,"data-known-size":V.size,"data-item-index":V.index,"data-item-group-index":V.groupIndex,item:V.data,style:coe},R?p(V.index,V.groupIndex,V.data,m):p(V.index,V.data,m))}))}),uoe={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},i0={width:"100%",height:"100%",position:"absolute",top:0},doe={width:"100%",position:u8(),top:0,zIndex:1};function Bo(e,t){if(typeof e!="string")return{context:t}}const foe=H.memo(function(){const t=kn("HeaderComponent"),n=js("headerHeight"),r=kn("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=kn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null}),poe=H.memo(function(){const t=kn("FooterComponent"),n=js("footerHeight"),r=kn("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=kn("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null});function h8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("scrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("scrollerRef"),g=n("context"),{scrollerRef:x,scrollByCallback:y,scrollToCallback:b}=QO(u,m,p,h);return t("scrollTo",b),t("scrollBy",y),H.createElement(p,{ref:x,style:{...uoe,...s},"data-test-id":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...l,...Bo(p,g)},i)})}function g8({usePublisher:e,useEmitter:t,useEmitterValue:n}){return H.memo(function({style:s,children:i,...l}){const u=e("windowScrollContainerState"),p=n("ScrollerComponent"),m=e("smoothScrollTargetReached"),h=n("totalListHeight"),g=n("deviation"),x=n("customScrollParent"),y=n("context"),{scrollerRef:b,scrollByCallback:C,scrollToCallback:S}=QO(u,m,p,Bu,x);return yre(()=>(b.current=x||window,()=>{b.current=null}),[b,x]),t("windowScrollTo",S),t("scrollBy",C),H.createElement(p,{style:{position:"relative",...s,...h!==0?{height:h+g}:{}},"data-virtuoso-scroller":!0,...l,...Bo(p,y)},i)})}const moe=({children:e})=>{const t=H.useContext(f8),n=js("viewportHeight"),r=js("fixedItemHeight"),o=ic(VO(n,s=>sl(s,"height")));return H.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),H.createElement("div",{style:i0,ref:o,"data-viewport-type":"element"},e)},hoe=({children:e})=>{const t=H.useContext(f8),n=js("windowViewportRect"),r=js("fixedItemHeight"),o=kn("customScrollParent"),s=d8(n,o);return H.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),H.createElement("div",{ref:s,style:i0,"data-viewport-type":"window"},e)},goe=({children:e})=>{const t=kn("TopItemListComponent"),n=kn("headerHeight"),r={...doe,marginTop:`${n}px`},o=kn("context");return H.createElement(t||"div",{style:r,context:o},e)},voe=H.memo(function(t){const n=kn("useWindowScroll"),r=kn("topItemsIndexes").length>0,o=kn("customScrollParent"),s=o||n?yoe:boe,i=o||n?hoe:moe;return H.createElement(s,{...t},r&&H.createElement(goe,null,H.createElement(l_,{showTopList:!0})),H.createElement(i,null,H.createElement(foe,null),H.createElement(l_,null),H.createElement(poe,null)))}),{Component:xoe,usePublisher:js,useEmitterValue:kn,useEmitter:b2}=qO(aoe,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedItemHeight:"fixedItemHeight",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},voe),boe=h8({usePublisher:js,useEmitterValue:kn,useEmitter:b2}),yoe=g8({usePublisher:js,useEmitterValue:kn,useEmitter:b2}),Coe=xoe,c_={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},woe={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:u_,ceil:d_,floor:Kh,min:x1,max:$d}=Math;function Soe(e){return{...woe,items:e}}function f_(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function koe(e,t){return e&&e.column===t.column&&e.row===t.row}function fm(e,t){return e&&e.width===t.width&&e.height===t.height}const joe=Vn(([{overscan:e,visibleRange:t,listBoundary:n},{scrollTop:r,viewportHeight:o,scrollBy:s,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:p,headerHeight:m},h,g,{propsReady:x,didMount:y},{windowViewportRect:b,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,windowScrollTo:_},P])=>{const I=at(0),M=at(0),O=at(c_),A=at({height:0,width:0}),D=at({height:0,width:0}),R=Mn(),N=Mn(),Y=at(0),F=at(null),V=at({row:0,column:0}),Q=Mn(),q=Mn(),z=at(!1),G=at(0),T=at(!0),B=at(!1);qn(Ne(y,hn(G),tn(([U,ee])=>!!ee)),()=>{dn(T,!1),dn(M,0)}),qn(Ne(to(y,T,D,A,G,B),tn(([U,ee,de,Z,,ue])=>U&&!ee&&de.height!==0&&Z.height!==0&&!ue)),([,,,,U])=>{dn(B,!0),h2(1,()=>{dn(R,U)}),hi(Ne(r),()=>{dn(n,[0,0]),dn(T,!0)})}),Nt(Ne(q,tn(U=>U!=null&&U.scrollTop>0),ei(0)),M),qn(Ne(y,hn(q),tn(([,U])=>U!=null)),([,U])=>{U&&(dn(A,U.viewport),dn(D,U==null?void 0:U.item),dn(V,U.gap),U.scrollTop>0&&(dn(z,!0),hi(Ne(r,Su(1)),ee=>{dn(z,!1)}),dn(i,{top:U.scrollTop})))}),Nt(Ne(A,bt(({height:U})=>U)),o),Nt(Ne(to(en(A,fm),en(D,fm),en(V,(U,ee)=>U&&U.column===ee.column&&U.row===ee.row),en(r)),bt(([U,ee,de,Z])=>({viewport:U,item:ee,gap:de,scrollTop:Z}))),Q),Nt(Ne(to(en(I),t,en(V,koe),en(D,fm),en(A,fm),en(F),en(M),en(z),en(T),en(G)),tn(([,,,,,,,U])=>!U),bt(([U,[ee,de],Z,ue,fe,ge,_e,,ye,pe])=>{const{row:Te,column:Ae}=Z,{height:qe,width:Pt}=ue,{width:tt}=fe;if(_e===0&&(U===0||tt===0))return c_;if(Pt===0){const Ft=g2(pe,U),Wt=Ft===0?Math.max(_e-1,0):Ft;return Soe(f_(Ft,Wt,ge))}const sn=v8(tt,Pt,Ae);let mt,ct;ye?ee===0&&de===0&&_e>0?(mt=0,ct=_e-1):(mt=sn*Kh((ee+Te)/(qe+Te)),ct=sn*d_((de+Te)/(qe+Te))-1,ct=x1(U-1,$d(ct,sn-1)),mt=x1(ct,$d(0,mt))):(mt=0,ct=-1);const be=f_(mt,ct,ge),{top:We,bottom:Rt}=p_(fe,Z,ue,be),Ut=d_(U/sn),Ct=Ut*qe+(Ut-1)*Te-Rt;return{items:be,offsetTop:We,offsetBottom:Ct,top:We,bottom:Rt,itemHeight:qe,itemWidth:Pt}})),O),Nt(Ne(F,tn(U=>U!==null),bt(U=>U.length)),I),Nt(Ne(to(A,D,O,V),tn(([U,ee,{items:de}])=>de.length>0&&ee.height!==0&&U.height!==0),bt(([U,ee,{items:de},Z])=>{const{top:ue,bottom:fe}=p_(U,Z,ee,de);return[ue,fe]}),mr(lf)),n);const X=at(!1);Nt(Ne(r,hn(X),bt(([U,ee])=>ee||U!==0)),X);const re=is(Ne(en(O),tn(({items:U})=>U.length>0),hn(I,X),tn(([{items:U},ee,de])=>de&&U[U.length-1].index===ee-1),bt(([,U])=>U-1),mr())),le=is(Ne(en(O),tn(({items:U})=>U.length>0&&U[0].index===0),ei(0),mr())),se=is(Ne(en(O),hn(z),tn(([{items:U},ee])=>U.length>0&&!ee),bt(([{items:U}])=>({startIndex:U[0].index,endIndex:U[U.length-1].index})),mr(a8),qi(0)));Nt(se,g.scrollSeekRangeChanged),Nt(Ne(R,hn(A,D,I,V),bt(([U,ee,de,Z,ue])=>{const fe=o8(U),{align:ge,behavior:_e,offset:ye}=fe;let pe=fe.index;pe==="LAST"&&(pe=Z-1),pe=$d(0,pe,x1(Z-1,pe));let Te=Kx(ee,ue,de,pe);return ge==="end"?Te=u_(Te-ee.height+de.height):ge==="center"&&(Te=u_(Te-ee.height/2+de.height/2)),ye&&(Te+=ye),{top:Te,behavior:_e}})),i);const K=Eo(Ne(O,bt(U=>U.offsetBottom+U.bottom)),0);return Nt(Ne(b,bt(U=>({width:U.visibleWidth,height:U.visibleHeight}))),A),{data:F,totalCount:I,viewportDimensions:A,itemDimensions:D,scrollTop:r,scrollHeight:N,overscan:e,scrollBy:s,scrollTo:i,scrollToIndex:R,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:_,useWindowScroll:C,customScrollParent:S,windowScrollContainerState:j,deviation:Y,scrollContainerState:u,footerHeight:p,headerHeight:m,initialItemCount:M,gap:V,restoreStateFrom:q,...g,initialTopMostItemIndex:G,gridState:O,totalListHeight:K,...h,startReached:le,endReached:re,rangeChanged:se,stateChanged:Q,propsReady:x,stateRestoreInProgress:z,...P}},vr(v2,Do,Vf,i8,hl,x2,ml));function p_(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=Kx(e,t,n,r[0].index),i=Kx(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:i}}function Kx(e,t,n,r){const o=v8(e.width,n.width,t.column),s=Kh(r/o),i=s*n.height+$d(0,s-1)*t.row;return i>0?i+t.row:i}function v8(e,t,n){return $d(1,Kh((e+n)/(Kh(t)+n)))}const _oe=Vn(()=>{const e=at(p=>`Item ${p}`),t=at({}),n=at(null),r=at("virtuoso-grid-item"),o=at("virtuoso-grid-list"),s=at(m8),i=at("div"),l=at(Bu),u=(p,m=null)=>Eo(Ne(t,bt(h=>h[p]),mr()),m);return{context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:i,scrollerRef:l,FooterComponent:u("Footer"),HeaderComponent:u("Header"),ListComponent:u("List","div"),ItemComponent:u("Item","div"),ScrollerComponent:u("Scroller","div"),ScrollSeekPlaceholder:u("ScrollSeekPlaceholder","div")}}),Ioe=Vn(([e,t])=>({...e,...t}),vr(joe,_oe)),Poe=H.memo(function(){const t=wr("gridState"),n=wr("listClassName"),r=wr("itemClassName"),o=wr("itemContent"),s=wr("computeItemKey"),i=wr("isSeeking"),l=ta("scrollHeight"),u=wr("ItemComponent"),p=wr("ListComponent"),m=wr("ScrollSeekPlaceholder"),h=wr("context"),g=ta("itemDimensions"),x=ta("gap"),y=wr("log"),b=wr("stateRestoreInProgress"),C=ic(S=>{const j=S.parentElement.parentElement.scrollHeight;l(j);const _=S.firstChild;if(_){const{width:P,height:I}=_.getBoundingClientRect();g({width:P,height:I})}x({row:m_("row-gap",getComputedStyle(S).rowGap,y),column:m_("column-gap",getComputedStyle(S).columnGap,y)})});return b?null:H.createElement(p,{ref:C,className:n,...Bo(p,h),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-test-id":"virtuoso-item-list"},t.items.map(S=>{const j=s(S.index,S.data,h);return i?H.createElement(m,{key:j,...Bo(m,h),index:S.index,height:t.itemHeight,width:t.itemWidth}):H.createElement(u,{...Bo(u,h),className:r,"data-index":S.index,key:j},o(S.index,S.data,h))}))}),Eoe=H.memo(function(){const t=wr("HeaderComponent"),n=ta("headerHeight"),r=wr("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=wr("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null}),Moe=H.memo(function(){const t=wr("FooterComponent"),n=ta("footerHeight"),r=wr("headerFooterTag"),o=ic(i=>n(sl(i,"height"))),s=wr("context");return t?H.createElement(r,{ref:o},H.createElement(t,Bo(t,s))):null}),Ooe=({children:e})=>{const t=H.useContext(p8),n=ta("itemDimensions"),r=ta("viewportDimensions"),o=ic(s=>{r(s.getBoundingClientRect())});return H.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),H.createElement("div",{style:i0,ref:o},e)},Roe=({children:e})=>{const t=H.useContext(p8),n=ta("windowViewportRect"),r=ta("itemDimensions"),o=wr("customScrollParent"),s=d8(n,o);return H.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),H.createElement("div",{ref:s,style:i0},e)},Aoe=H.memo(function({...t}){const n=wr("useWindowScroll"),r=wr("customScrollParent"),o=r||n?Noe:Toe,s=r||n?Roe:Ooe;return H.createElement(o,{...t},H.createElement(s,null,H.createElement(Eoe,null),H.createElement(Poe,null),H.createElement(Moe,null)))}),{Component:Doe,usePublisher:ta,useEmitterValue:wr,useEmitter:x8}=qO(Ioe,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged"}},Aoe),Toe=h8({usePublisher:ta,useEmitterValue:wr,useEmitter:x8}),Noe=g8({usePublisher:ta,useEmitterValue:wr,useEmitter:x8});function m_(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,ls.WARN),t==="normal"?0:parseInt(t??"0",10)}const $oe=Doe,Loe=e=>{const t=W(s=>s.gallery.galleryView),{data:n}=bb(e),{data:r}=yb(e),o=d.useMemo(()=>t==="images"?n==null?void 0:n.total:r==null?void 0:r.total,[t,r,n]);return{totalImages:n,totalAssets:r,currentViewTotal:o}},zoe=({imageDTO:e})=>a.jsx($,{sx:{pointerEvents:"none",flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,p:2,alignItems:"flex-start",gap:2},children:a.jsxs(Ha,{variant:"solid",colorScheme:"base",children:[e.width," × ",e.height]})}),Foe=d.memo(zoe),y2=({postUploadAction:e,isDisabled:t})=>{const n=W(u=>u.gallery.autoAddBoardId),[r]=_I(),o=d.useCallback(u=>{const p=u[0];p&&r({file:p,image_category:"user",is_intermediate:!1,postUploadAction:e??{type:"TOAST"},board_id:n==="none"?void 0:n})},[n,e,r]),{getRootProps:s,getInputProps:i,open:l}=Iy({accept:{"image/png":[".png"],"image/jpeg":[".jpg",".jpeg",".png"]},onDropAccepted:o,disabled:t,noDrag:!0,multiple:!1});return{getUploadButtonProps:s,getUploadInputProps:i,openUploader:l}},Boe=ce(we,({generation:e})=>e.model,je),l0=()=>{const e=te(),t=oc(),{t:n}=J(),r=W(Boe),o=d.useCallback(()=>{t({title:n("toast.parameterSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),s=d.useCallback(T=>{t({title:n("toast.parameterNotSet"),description:T,status:"warning",duration:2500,isClosable:!0})},[n,t]),i=d.useCallback(()=>{t({title:n("toast.parametersSet"),status:"info",duration:2500,isClosable:!0})},[n,t]),l=d.useCallback(T=>{t({title:n("toast.parametersNotSet"),status:"warning",description:T,duration:2500,isClosable:!0})},[n,t]),u=d.useCallback((T,B,X,re)=>{if(Mp(T)||Op(B)||dd(X)||kv(re)){Mp(T)&&e(Md(T)),Op(B)&&e(Od(B)),dd(X)&&e(Rd(X)),dd(re)&&e(Ad(re)),o();return}s()},[e,o,s]),p=d.useCallback(T=>{if(!Mp(T)){s();return}e(Md(T)),o()},[e,o,s]),m=d.useCallback(T=>{if(!Op(T)){s();return}e(Od(T)),o()},[e,o,s]),h=d.useCallback(T=>{if(!dd(T)){s();return}e(Rd(T)),o()},[e,o,s]),g=d.useCallback(T=>{if(!kv(T)){s();return}e(Ad(T)),o()},[e,o,s]),x=d.useCallback(T=>{if(!Aw(T)){s();return}e(Am(T)),o()},[e,o,s]),y=d.useCallback(T=>{if(!jv(T)){s();return}e(Dm(T)),o()},[e,o,s]),b=d.useCallback(T=>{if(!Dw(T)){s();return}e(N1(T)),o()},[e,o,s]),C=d.useCallback(T=>{if(!_v(T)){s();return}e($1(T)),o()},[e,o,s]),S=d.useCallback(T=>{if(!Iv(T)){s();return}e(Tm(T)),o()},[e,o,s]),j=d.useCallback(T=>{if(!Tw(T)){s();return}e(Bl(T)),o()},[e,o,s]),_=d.useCallback(T=>{if(!Nw(T)){s();return}e(Hl(T)),o()},[e,o,s]),P=d.useCallback(T=>{if(!$w(T)){s();return}e(Nm(T)),o()},[e,o,s]),{data:I}=gf(void 0),M=d.useCallback(T=>{if(!NI(T.lora))return{lora:null,error:"Invalid LoRA model"};const{base_model:B,model_name:X}=T.lora,re=I?t7.getSelectors().selectById(I,`${B}/lora/${X}`):void 0;return re?(re==null?void 0:re.base_model)===(r==null?void 0:r.base_model)?{lora:re,error:null}:{lora:null,error:"LoRA incompatible with currently-selected model"}:{lora:null,error:"LoRA model is not installed"}},[I,r==null?void 0:r.base_model]),O=d.useCallback(T=>{const B=M(T);if(!B.lora){s(B.error);return}e(Lw({...B.lora,weight:T.weight})),o()},[M,e,o,s]),{data:A}=Cb(void 0),D=d.useCallback(T=>{if(!$m(T.control_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:B,control_model:X,control_weight:re,begin_step_percent:le,end_step_percent:se,control_mode:K,resize_mode:U}=T,ee=A?$I.getSelectors().selectById(A,`${X.base_model}/controlnet/${X.model_name}`):void 0;if(!ee)return{controlnet:null,error:"ControlNet model is not installed"};if(!((ee==null?void 0:ee.base_model)===(r==null?void 0:r.base_model)))return{controlnet:null,error:"ControlNet incompatible with currently-selected model"};const Z="none",ue=Oo.none.default;return{controlnet:{type:"controlnet",isEnabled:!0,model:ee,weight:typeof re=="number"?re:fd.weight,beginStepPct:le||fd.beginStepPct,endStepPct:se||fd.endStepPct,controlMode:K||fd.controlMode,resizeMode:U||fd.resizeMode,controlImage:(B==null?void 0:B.image_name)||null,processedControlImage:(B==null?void 0:B.image_name)||null,processorType:Z,processorNode:ue,shouldAutoConfig:!0,id:oi()},error:null}},[A,r==null?void 0:r.base_model]),R=d.useCallback(T=>{const B=D(T);if(!B.controlnet){s(B.error);return}e(Sc(B.controlnet)),o()},[D,e,o,s]),{data:N}=wb(void 0),Y=d.useCallback(T=>{if(!$m(T.t2i_adapter_model))return{controlnet:null,error:"Invalid ControlNet model"};const{image:B,t2i_adapter_model:X,weight:re,begin_step_percent:le,end_step_percent:se,resize_mode:K}=T,U=N?LI.getSelectors().selectById(N,`${X.base_model}/t2i_adapter/${X.model_name}`):void 0;if(!U)return{controlnet:null,error:"ControlNet model is not installed"};if(!((U==null?void 0:U.base_model)===(r==null?void 0:r.base_model)))return{t2iAdapter:null,error:"ControlNet incompatible with currently-selected model"};const de="none",Z=Oo.none.default;return{t2iAdapter:{type:"t2i_adapter",isEnabled:!0,model:U,weight:typeof re=="number"?re:Rp.weight,beginStepPct:le||Rp.beginStepPct,endStepPct:se||Rp.endStepPct,resizeMode:K||Rp.resizeMode,controlImage:(B==null?void 0:B.image_name)||null,processedControlImage:(B==null?void 0:B.image_name)||null,processorType:de,processorNode:Z,shouldAutoConfig:!0,id:oi()},error:null}},[r==null?void 0:r.base_model,N]),F=d.useCallback(T=>{const B=Y(T);if(!B.t2iAdapter){s(B.error);return}e(Sc(B.t2iAdapter)),o()},[Y,e,o,s]),{data:V}=Sb(void 0),Q=d.useCallback(T=>{if(!n7(T==null?void 0:T.ip_adapter_model))return{ipAdapter:null,error:"Invalid IP Adapter model"};const{image:B,ip_adapter_model:X,weight:re,begin_step_percent:le,end_step_percent:se}=T,K=V?zI.getSelectors().selectById(V,`${X.base_model}/ip_adapter/${X.model_name}`):void 0;return K?(K==null?void 0:K.base_model)===(r==null?void 0:r.base_model)?{ipAdapter:{id:oi(),type:"ip_adapter",isEnabled:!0,controlImage:(B==null?void 0:B.image_name)??null,model:K,weight:re??Pv.weight,beginStepPct:le??Pv.beginStepPct,endStepPct:se??Pv.endStepPct},error:null}:{ipAdapter:null,error:"IP Adapter incompatible with currently-selected model"}:{ipAdapter:null,error:"IP Adapter model is not installed"}},[V,r==null?void 0:r.base_model]),q=d.useCallback(T=>{const B=Q(T);if(!B.ipAdapter){s(B.error);return}e(Sc(B.ipAdapter)),o()},[Q,e,o,s]),z=d.useCallback(T=>{e(rg(T))},[e]),G=d.useCallback(T=>{if(!T){l();return}const{cfg_scale:B,height:X,model:re,positive_prompt:le,negative_prompt:se,scheduler:K,seed:U,steps:ee,width:de,strength:Z,positive_style_prompt:ue,negative_style_prompt:fe,refiner_model:ge,refiner_cfg_scale:_e,refiner_steps:ye,refiner_scheduler:pe,refiner_positive_aesthetic_score:Te,refiner_negative_aesthetic_score:Ae,refiner_start:qe,loras:Pt,controlnets:tt,ipAdapters:sn,t2iAdapters:mt}=T;jv(B)&&e(Dm(B)),Dw(re)&&e(N1(re)),Mp(le)&&e(Md(le)),Op(se)&&e(Od(se)),_v(K)&&e($1(K)),Aw(U)&&e(Am(U)),Iv(ee)&&e(Tm(ee)),Tw(de)&&e(Bl(de)),Nw(X)&&e(Hl(X)),$w(Z)&&e(Nm(Z)),dd(ue)&&e(Rd(ue)),kv(fe)&&e(Ad(fe)),r7(ge)&&e(FI(ge)),Iv(ye)&&e(L1(ye)),jv(_e)&&e(z1(_e)),_v(pe)&&e(BI(pe)),o7(Te)&&e(F1(Te)),s7(Ae)&&e(B1(Ae)),a7(qe)&&e(H1(qe)),e(i7()),Pt==null||Pt.forEach(ct=>{const be=M(ct);be.lora&&e(Lw({...be.lora,weight:ct.weight}))}),e(EI()),tt==null||tt.forEach(ct=>{const be=D(ct);be.controlnet&&e(Sc(be.controlnet))}),sn==null||sn.forEach(ct=>{const be=Q(ct);be.ipAdapter&&e(Sc(be.ipAdapter))}),mt==null||mt.forEach(ct=>{const be=Y(ct);be.t2iAdapter&&e(Sc(be.t2iAdapter))}),i()},[e,i,l,M,D,Q,Y]);return{recallBothPrompts:u,recallPositivePrompt:p,recallNegativePrompt:m,recallSDXLPositiveStylePrompt:h,recallSDXLNegativeStylePrompt:g,recallSeed:x,recallCfgScale:y,recallModel:b,recallScheduler:C,recallSteps:S,recallWidth:j,recallHeight:_,recallStrength:P,recallLoRA:O,recallControlNet:R,recallIPAdapter:q,recallT2IAdapter:F,recallAllParameters:G,sendToImageToImage:z}},Hoe=()=>d.useCallback(async t=>new Promise(n=>{const r=new Image;r.onload=()=>{const o=document.createElement("canvas");o.width=r.width,o.height=r.height;const s=o.getContext("2d");s&&(s.drawImage(r,0,0),n(new Promise(i=>{o.toBlob(function(l){i(l)},"image/png")})))},r.crossOrigin=HI.get()?"use-credentials":"anonymous",r.src=t}),[]),b8=()=>{const e=oc(),{t}=J(),n=Hoe(),r=d.useMemo(()=>!!navigator.clipboard&&!!window.ClipboardItem,[]),o=d.useCallback(async s=>{r||e({title:t("toast.problemCopyingImage"),description:"Your browser doesn't support the Clipboard API.",status:"error",duration:2500,isClosable:!0});try{const i=await n(s);if(!i)throw new Error("Unable to create Blob");l7(i),e({title:t("toast.imageCopied"),status:"success",duration:2500,isClosable:!0})}catch(i){e({title:t("toast.problemCopyingImage"),description:String(i),status:"error",duration:2500,isClosable:!0})}},[n,r,t,e]);return{isClipboardAPIAvailable:r,copyImageToClipboard:o}};function Woe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M125.7 160H176c17.7 0 32 14.3 32 32s-14.3 32-32 32H48c-17.7 0-32-14.3-32-32V64c0-17.7 14.3-32 32-32s32 14.3 32 32v51.2L97.6 97.6c87.5-87.5 229.3-87.5 316.8 0s87.5 229.3 0 316.8s-229.3 87.5-316.8 0c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0c62.5 62.5 163.8 62.5 226.3 0s62.5-163.8 0-226.3s-163.8-62.5-226.3 0L125.7 160z"}}]})(e)}function Voe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 384 512"},child:[{tag:"path",attr:{d:"M0 256L28.5 28c2-16 15.6-28 31.8-28H228.9c15 0 27.1 12.1 27.1 27.1c0 3.2-.6 6.5-1.7 9.5L208 160H347.3c20.2 0 36.7 16.4 36.7 36.7c0 7.4-2.2 14.6-6.4 20.7l-192.2 281c-5.9 8.6-15.6 13.7-25.9 13.7h-2.9c-15.7 0-28.5-12.8-28.5-28.5c0-2.3 .3-4.6 .9-6.9L176 288H32c-17.7 0-32-14.3-32-32z"}}]})(e)}function Uoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 512A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm0-384c13.3 0 24 10.7 24 24V264c0 13.3-10.7 24-24 24s-24-10.7-24-24V152c0-13.3 10.7-24 24-24zM224 352a32 32 0 1 1 64 0 32 32 0 1 1 -64 0z"}}]})(e)}function C2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M418.4 157.9c35.3-8.3 61.6-40 61.6-77.9c0-44.2-35.8-80-80-80c-43.4 0-78.7 34.5-80 77.5L136.2 151.1C121.7 136.8 101.9 128 80 128c-44.2 0-80 35.8-80 80s35.8 80 80 80c12.2 0 23.8-2.7 34.1-7.6L259.7 407.8c-2.4 7.6-3.7 15.8-3.7 24.2c0 44.2 35.8 80 80 80s80-35.8 80-80c0-27.7-14-52.1-35.4-66.4l37.8-207.7zM156.3 232.2c2.2-6.9 3.5-14.2 3.7-21.7l183.8-73.5c3.6 3.5 7.4 6.7 11.6 9.5L317.6 354.1c-5.5 1.3-10.8 3.1-15.8 5.5L156.3 232.2z"}}]})(e)}function Goe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M8 256a56 56 0 1 1 112 0A56 56 0 1 1 8 256zm160 0a56 56 0 1 1 112 0 56 56 0 1 1 -112 0zm216-56a56 56 0 1 1 0 112 56 56 0 1 1 0-112z"}}]})(e)}function qoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM136 184c-13.3 0-24 10.7-24 24s10.7 24 24 24H280c13.3 0 24-10.7 24-24s-10.7-24-24-24H136z"}}]})(e)}function Koe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM184 296c0 13.3 10.7 24 24 24s24-10.7 24-24V232h64c13.3 0 24-10.7 24-24s-10.7-24-24-24H232V120c0-13.3-10.7-24-24-24s-24 10.7-24 24v64H120c-13.3 0-24 10.7-24 24s10.7 24 24 24h64v64z"}}]})(e)}function Qoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M17 16l-4-4V8.82C14.16 8.4 15 7.3 15 6c0-1.66-1.34-3-3-3S9 4.34 9 6c0 1.3.84 2.4 2 2.82V12l-4 4H3v5h5v-3.05l4-4.2 4 4.2V21h5v-5h-4z"}}]})(e)}function Xoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 20H4v-4h4v4zm0-6H4v-4h4v4zm0-6H4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4zm6 12h-4v-4h4v4zm0-6h-4v-4h4v4zm0-6h-4V4h4v4z"}}]})(e)}function Yoe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 16V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2zm-11-4l2.03 2.71L16 11l4 5H8l3-4zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z"}}]})(e)}function w2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"}}]})(e)}function S2(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"}},{tag:"path",attr:{d:"M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}}]})(e)}function y8(e){return Qe({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"}},{tag:"path",attr:{d:"M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3zm7 14.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"}}]})(e)}function Joe(e,t,n){var r=this,o=d.useRef(null),s=d.useRef(0),i=d.useRef(null),l=d.useRef([]),u=d.useRef(),p=d.useRef(),m=d.useRef(e),h=d.useRef(!0);d.useEffect(function(){m.current=e},[e]);var g=!t&&t!==0&&typeof window<"u";if(typeof e!="function")throw new TypeError("Expected a function");t=+t||0;var x=!!(n=n||{}).leading,y=!("trailing"in n)||!!n.trailing,b="maxWait"in n,C=b?Math.max(+n.maxWait||0,t):null;d.useEffect(function(){return h.current=!0,function(){h.current=!1}},[]);var S=d.useMemo(function(){var j=function(A){var D=l.current,R=u.current;return l.current=u.current=null,s.current=A,p.current=m.current.apply(R,D)},_=function(A,D){g&&cancelAnimationFrame(i.current),i.current=g?requestAnimationFrame(A):setTimeout(A,D)},P=function(A){if(!h.current)return!1;var D=A-o.current;return!o.current||D>=t||D<0||b&&A-s.current>=C},I=function(A){return i.current=null,y&&l.current?j(A):(l.current=u.current=null,p.current)},M=function A(){var D=Date.now();if(P(D))return I(D);if(h.current){var R=t-(D-o.current),N=b?Math.min(R,C-(D-s.current)):R;_(A,N)}},O=function(){var A=Date.now(),D=P(A);if(l.current=[].slice.call(arguments),u.current=r,o.current=A,D){if(!i.current&&h.current)return s.current=o.current,_(M,t),x?j(o.current):p.current;if(b)return _(M,t),j(o.current)}return i.current||_(M,t),p.current};return O.cancel=function(){i.current&&(g?cancelAnimationFrame(i.current):clearTimeout(i.current)),s.current=0,l.current=o.current=u.current=i.current=null},O.isPending=function(){return!!i.current},O.flush=function(){return i.current?I(Date.now()):p.current},O},[x,b,t,C,y,g]);return S}function Zoe(e,t){return e===t}function h_(e){return typeof e=="function"?function(){return e}:e}function k2(e,t,n){var r,o,s=n&&n.equalityFn||Zoe,i=(r=d.useState(h_(e)),o=r[1],[r[0],d.useCallback(function(h){return o(h_(h))},[])]),l=i[0],u=i[1],p=Joe(d.useCallback(function(h){return u(h)},[u]),t,n),m=d.useRef(e);return s(m.current,e)||(p(e),m.current=e),[l,p]}const j2=e=>{const t=W(s=>s.config.metadataFetchDebounce),[n]=k2(e,t??0),{data:r,isLoading:o}=WI(n??VI);return{metadata:r,isLoading:o}},ese=c7.injectEndpoints({endpoints:e=>({getWorkflow:e.query({query:t=>`workflows/i/${t}`,providesTags:(t,n,r)=>[{type:"Workflow",id:r}],transformResponse:t=>{if(t){const n=UI.safeParse(t);if(n.success)return n.data;yi("images").warn("Problem parsing workflow")}}})})}),{useGetWorkflowQuery:tse}=ese,_2=e=>{const t=W(s=>s.config.workflowFetchDebounce),[n]=k2(e,t??0),{data:r,isLoading:o}=tse(n??VI);return{workflow:r,isLoading:o}};kb("gallery/requestedBoardImagesDeletion");const nse=kb("gallery/sentImageToCanvas"),C8=kb("gallery/sentImageToImg2Img"),rse=e=>{const{imageDTO:t}=e,n=te(),{t:r}=J(),o=oc(),s=jn("unifiedCanvas").isFeatureEnabled,i=Lg(jb),{metadata:l,isLoading:u}=j2(t==null?void 0:t.image_name),{workflow:p,isLoading:m}=_2(t==null?void 0:t.workflow_id),[h]=_b(),[g]=Ib(),{isClipboardAPIAvailable:x,copyImageToClipboard:y}=b8(),b=d.useCallback(()=>{t&&n(og([t]))},[n,t]),{recallBothPrompts:C,recallSeed:S,recallAllParameters:j}=l0(),_=d.useCallback(()=>{C(l==null?void 0:l.positive_prompt,l==null?void 0:l.negative_prompt,l==null?void 0:l.positive_style_prompt,l==null?void 0:l.negative_style_prompt)},[l==null?void 0:l.negative_prompt,l==null?void 0:l.positive_prompt,l==null?void 0:l.positive_style_prompt,l==null?void 0:l.negative_style_prompt,C]),P=d.useCallback(()=>{S(l==null?void 0:l.seed)},[l==null?void 0:l.seed,S]),I=d.useCallback(()=>{p&&n(Pb(p))},[n,p]),M=d.useCallback(()=>{n(C8()),n(rg(t))},[n,t]),O=d.useCallback(()=>{n(nse()),rs.flushSync(()=>{n(ti("unifiedCanvas"))}),n(GI(t)),o({title:r("toast.sentToUnifiedCanvas"),status:"success",duration:2500,isClosable:!0})},[n,t,r,o]),A=d.useCallback(()=>{j(l)},[l,j]),D=d.useCallback(()=>{n(qI([t])),n(gb(!0))},[n,t]),R=d.useCallback(()=>{y(t.image_url)},[y,t.image_url]),N=d.useCallback(()=>{t&&h({imageDTOs:[t]})},[h,t]),Y=d.useCallback(()=>{t&&g({imageDTOs:[t]})},[g,t]);return a.jsxs(a.Fragment,{children:[a.jsx(Wn,{as:"a",href:t.image_url,target:"_blank",icon:a.jsx(Vy,{}),children:r("common.openInNewTab")}),x&&a.jsx(Wn,{icon:a.jsx(Lu,{}),onClickCapture:R,children:r("parameters.copyImage")}),a.jsx(Wn,{as:"a",download:!0,href:t.image_url,target:"_blank",icon:a.jsx(zu,{}),w:"100%",children:r("parameters.downloadImage")}),a.jsx(Wn,{icon:m?a.jsx(pm,{}):a.jsx(C2,{}),onClickCapture:I,isDisabled:m||!p,children:r("nodes.loadWorkflow")}),a.jsx(Wn,{icon:u?a.jsx(pm,{}):a.jsx(QM,{}),onClickCapture:_,isDisabled:u||(l==null?void 0:l.positive_prompt)===void 0&&(l==null?void 0:l.negative_prompt)===void 0,children:r("parameters.usePrompt")}),a.jsx(Wn,{icon:u?a.jsx(pm,{}):a.jsx(XM,{}),onClickCapture:P,isDisabled:u||(l==null?void 0:l.seed)===void 0,children:r("parameters.useSeed")}),a.jsx(Wn,{icon:u?a.jsx(pm,{}):a.jsx(zM,{}),onClickCapture:A,isDisabled:u||!l,children:r("parameters.useAll")}),a.jsx(Wn,{icon:a.jsx(xj,{}),onClickCapture:M,id:"send-to-img2img",children:r("parameters.sendToImg2Img")}),s&&a.jsx(Wn,{icon:a.jsx(xj,{}),onClickCapture:O,id:"send-to-canvas",children:r("parameters.sendToUnifiedCanvas")}),a.jsx(Wn,{icon:a.jsx(VM,{}),onClickCapture:D,children:"Change Board"}),t.starred?a.jsx(Wn,{icon:i?i.off.icon:a.jsx(S2,{}),onClickCapture:Y,children:i?i.off.text:"Unstar Image"}):a.jsx(Wn,{icon:i?i.on.icon:a.jsx(w2,{}),onClickCapture:N,children:i?i.on.text:"Star Image"}),a.jsx(Wn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:b,children:r("gallery.deleteImage")})]})},w8=d.memo(rse),pm=()=>a.jsx($,{w:"14px",alignItems:"center",justifyContent:"center",children:a.jsx(vi,{size:"xs"})}),ose=()=>{const{t:e}=J(),t=te(),n=W(b=>b.gallery.selection),r=Lg(jb),o=jn("bulkDownload").isFeatureEnabled,[s]=_b(),[i]=Ib(),[l]=DI(),u=d.useCallback(()=>{t(qI(n)),t(gb(!0))},[t,n]),p=d.useCallback(()=>{t(og(n))},[t,n]),m=d.useCallback(()=>{s({imageDTOs:n})},[s,n]),h=d.useCallback(()=>{i({imageDTOs:n})},[i,n]),g=d.useCallback(async()=>{try{const b=await l({image_names:n.map(C=>C.image_name)}).unwrap();t($t({title:e("gallery.preparingDownload"),status:"success",...b.response?{description:b.response}:{}}))}catch{t($t({title:e("gallery.preparingDownloadFailed"),status:"error"}))}},[e,n,l,t]),x=d.useMemo(()=>n.every(b=>b.starred),[n]),y=d.useMemo(()=>n.every(b=>!b.starred),[n]);return a.jsxs(a.Fragment,{children:[x&&a.jsx(Wn,{icon:r?r.on.icon:a.jsx(w2,{}),onClickCapture:h,children:r?r.off.text:"Unstar All"}),(y||!x&&!y)&&a.jsx(Wn,{icon:r?r.on.icon:a.jsx(S2,{}),onClickCapture:m,children:r?r.on.text:"Star All"}),o&&a.jsx(Wn,{icon:a.jsx(zu,{}),onClickCapture:g,children:e("gallery.downloadSelection")}),a.jsx(Wn,{icon:a.jsx(VM,{}),onClickCapture:u,children:"Change Board"}),a.jsx(Wn,{sx:{color:"error.600",_dark:{color:"error.300"}},icon:a.jsx(qo,{}),onClickCapture:p,children:"Delete Selection"})]})},sse=d.memo(ose),ase=ce([we],({gallery:e})=>({selectionCount:e.selection.length}),je),ise=({imageDTO:e,children:t})=>{const{selectionCount:n}=W(ase),r=d.useCallback(o=>{o.preventDefault()},[]);return a.jsx(c2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>e?n>1?a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(sse,{})}):a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:r,children:a.jsx(w8,{imageDTO:e})}):null,children:t})},lse=d.memo(ise),cse=e=>{const{data:t,disabled:n,...r}=e,o=d.useRef(oi()),{attributes:s,listeners:i,setNodeRef:l}=Dne({id:o.current,disabled:n,data:t});return a.jsx(De,{ref:l,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,...s,...i,...r})},use=d.memo(cse),dse=a.jsx(Lr,{as:Kg,sx:{boxSize:16}}),fse=a.jsx(eo,{icon:Xl}),pse=e=>{const{imageDTO:t,onError:n,onClick:r,withMetadataOverlay:o=!1,isDropDisabled:s=!1,isDragDisabled:i=!1,isUploadDisabled:l=!1,minSize:u=24,postUploadAction:p,imageSx:m,fitContainer:h=!1,droppableData:g,draggableData:x,dropLabel:y,isSelected:b=!1,thumbnail:C=!1,noContentFallback:S=fse,uploadElement:j=dse,useThumbailFallback:_,withHoverOverlay:P=!1,children:I,onMouseOver:M,onMouseOut:O,dataTestId:A}=e,{colorMode:D}=Ci(),[R,N]=d.useState(!1),Y=d.useCallback(z=>{M&&M(z),N(!0)},[M]),F=d.useCallback(z=>{O&&O(z),N(!1)},[O]),{getUploadButtonProps:V,getUploadInputProps:Q}=y2({postUploadAction:p,isDisabled:l}),q=l?{}:{cursor:"pointer",bg:Ke("base.200","base.700")(D),_hover:{bg:Ke("base.300","base.650")(D),color:Ke("base.500","base.300")(D)}};return a.jsx(lse,{imageDTO:t,children:z=>a.jsxs($,{ref:z,onMouseOver:Y,onMouseOut:F,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative",minW:u||void 0,minH:u||void 0,userSelect:"none",cursor:i||!t?"default":"pointer"},children:[t&&a.jsxs($,{sx:{w:"full",h:"full",position:h?"absolute":"relative",alignItems:"center",justifyContent:"center"},children:[a.jsx(wi,{src:C?t.thumbnail_url:t.image_url,fallbackStrategy:"beforeLoadOrError",fallbackSrc:_?t.thumbnail_url:void 0,fallback:_?void 0:a.jsx(cre,{image:t}),onError:n,draggable:!1,sx:{w:t.width,objectFit:"contain",maxW:"full",maxH:"full",borderRadius:"base",...m},"data-testid":A}),o&&a.jsx(Foe,{imageDTO:t}),a.jsx(l2,{isSelected:b,isHovered:P?R:!1})]}),!t&&!l&&a.jsx(a.Fragment,{children:a.jsxs($,{sx:{minH:u,w:"full",h:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",transitionProperty:"common",transitionDuration:"0.1s",color:Ke("base.500","base.500")(D),...q},...V(),children:[a.jsx("input",{...Q()}),j]})}),!t&&l&&S,t&&!i&&a.jsx(use,{data:x,disabled:i||!t,onClick:r}),I,!s&&a.jsx(i2,{data:g,disabled:s,dropLabel:y})]})})},al=d.memo(pse),mse=()=>a.jsx(Og,{sx:{position:"relative",height:"full",width:"full","::before":{content:"''",display:"block",pt:"100%"}},children:a.jsx(De,{sx:{position:"absolute",top:0,insetInlineStart:0,height:"full",width:"full"}})}),hse=d.memo(mse),gse=ce([we,Eb],({gallery:e},t)=>{const n=e.selection;return{queryArgs:t,selection:n}},je),vse=e=>{const t=te(),{queryArgs:n,selection:r}=W(gse),{imageDTOs:o}=KI(n,{selectFromResult:p=>({imageDTOs:p.data?u7.selectAll(p.data):[]})}),s=jn("multiselect").isFeatureEnabled,i=d.useCallback(p=>{var m;if(e){if(!s){t(pd([e]));return}if(p.shiftKey){const h=e.image_name,g=(m=r[r.length-1])==null?void 0:m.image_name,x=o.findIndex(b=>b.image_name===g),y=o.findIndex(b=>b.image_name===h);if(x>-1&&y>-1){const b=Math.min(x,y),C=Math.max(x,y),S=o.slice(b,C+1);t(pd(r.concat(S)))}}else p.ctrlKey||p.metaKey?r.some(h=>h.image_name===e.image_name)&&r.length>1?t(pd(r.filter(h=>h.image_name!==e.image_name))):t(pd(r.concat(e))):t(pd([e]))}},[t,e,o,r,s]),l=d.useMemo(()=>e?r.some(p=>p.image_name===e.image_name):!1,[e,r]),u=d.useMemo(()=>r.length,[r.length]);return{selection:r,selectionCount:u,isSelected:l,handleClick:i}},xse=e=>{const{onClick:t,tooltip:n,icon:r,styleOverrides:o}=e,s=di("drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-600))","drop-shadow(0px 0px 0.1rem var(--invokeai-colors-base-800))");return a.jsx(ot,{onClick:t,"aria-label":n,tooltip:n,icon:r,size:"sm",variant:"link",sx:{position:"absolute",top:1,insetInlineEnd:1,p:0,minW:0,svg:{transitionProperty:"common",transitionDuration:"normal",fill:"base.100",_hover:{fill:"base.50"},filter:s},...o},"data-testid":n})},du=d.memo(xse),bse=e=>{const t=te(),{imageName:n}=e,{currentData:r}=Ps(n),o=W(M=>M.hotkeys.shift),{t:s}=J(),{handleClick:i,isSelected:l,selection:u,selectionCount:p}=vse(r),m=Lg(jb),h=d.useCallback(M=>{M.stopPropagation(),r&&t(og([r]))},[t,r]),g=d.useMemo(()=>{if(p>1)return{id:"gallery-image",payloadType:"IMAGE_DTOS",payload:{imageDTOs:u}};if(r)return{id:"gallery-image",payloadType:"IMAGE_DTO",payload:{imageDTO:r}}},[r,u,p]),[x]=_b(),[y]=Ib(),b=d.useCallback(()=>{r&&(r.starred&&y({imageDTOs:[r]}),r.starred||x({imageDTOs:[r]}))},[x,y,r]),[C,S]=d.useState(!1),j=d.useCallback(()=>{S(!0)},[]),_=d.useCallback(()=>{S(!1)},[]),P=d.useMemo(()=>{if(r!=null&&r.starred)return m?m.on.icon:a.jsx(S2,{size:"20"});if(!(r!=null&&r.starred)&&C)return m?m.off.icon:a.jsx(w2,{size:"20"})},[r==null?void 0:r.starred,C,m]),I=d.useMemo(()=>r!=null&&r.starred?m?m.off.text:"Unstar":r!=null&&r.starred?"":m?m.on.text:"Star",[r==null?void 0:r.starred,m]);return r?a.jsx(De,{sx:{w:"full",h:"full",touchAction:"none"},"data-testid":`image-${r.image_name}`,children:a.jsx($,{userSelect:"none",sx:{position:"relative",justifyContent:"center",alignItems:"center",aspectRatio:"1/1"},children:a.jsx(al,{onClick:i,imageDTO:r,draggableData:g,isSelected:l,minSize:0,imageSx:{w:"full",h:"full"},isDropDisabled:!0,isUploadDisabled:!0,thumbnail:!0,withHoverOverlay:!0,onMouseOver:j,onMouseOut:_,children:a.jsxs(a.Fragment,{children:[a.jsx(du,{onClick:b,icon:P,tooltip:I}),C&&o&&a.jsx(du,{onClick:h,icon:a.jsx(qo,{}),tooltip:s("gallery.deleteImage"),styleOverrides:{bottom:2,top:"auto"}})]})})})}):a.jsx(hse,{})},yse=d.memo(bse),Cse=Oe((e,t)=>a.jsx(De,{className:"item-container",ref:t,p:1.5,"data-testid":"image-item-container",children:e.children})),wse=d.memo(Cse),Sse=Oe((e,t)=>{const n=W(r=>r.gallery.galleryImageMinimumWidth);return a.jsx(tl,{...e,className:"list-container",ref:t,sx:{gridTemplateColumns:`repeat(auto-fill, minmax(${n}px, 1fr));`},"data-testid":"image-list-container",children:e.children})}),kse=d.memo(Sse),jse={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},_se=()=>{const{t:e}=J(),t=d.useRef(null),[n,r]=d.useState(null),[o,s]=a2(jse),i=W(C=>C.gallery.selectedBoardId),{currentViewTotal:l}=Loe(i),u=W(Eb),{currentData:p,isFetching:m,isSuccess:h,isError:g}=KI(u),[x]=QI(),y=d.useMemo(()=>!p||!l?!1:p.ids.length{y&&x({...u,offset:(p==null?void 0:p.ids.length)??0,limit:XI})},[y,x,u,p==null?void 0:p.ids.length]);return d.useEffect(()=>{const{current:C}=t;return n&&C&&o({target:C,elements:{viewport:n}}),()=>{var S;return(S=s())==null?void 0:S.destroy()}},[n,o,s]),p?h&&(p==null?void 0:p.ids.length)===0?a.jsx($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.noImagesInGallery"),icon:Xl})}):h&&p?a.jsxs(a.Fragment,{children:[a.jsx(De,{ref:t,"data-overlayscrollbars":"",h:"100%",children:a.jsx($oe,{style:{height:"100%"},data:p.ids,endReached:b,components:{Item:wse,List:kse},scrollerRef:r,itemContent:(C,S)=>a.jsx(yse,{imageName:S},S)})}),a.jsx(Mt,{onClick:b,isDisabled:!y,isLoading:m,loadingText:e("gallery.loading"),flexShrink:0,children:`Load More (${p.ids.length} of ${l})`})]}):g?a.jsx(De,{sx:{w:"full",h:"full"},children:a.jsx(eo,{label:e("gallery.unableToLoad"),icon:lee})}):null:a.jsx($,{sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(eo,{label:e("gallery.loading"),icon:Xl})})},Ise=d.memo(_se),Pse=ce([we],e=>{const{galleryView:t}=e.gallery;return{galleryView:t}},je),Ese=()=>{const{t:e}=J(),t=d.useRef(null),n=d.useRef(null),{galleryView:r}=W(Pse),o=te(),{isOpen:s,onToggle:i}=Uo({defaultIsOpen:!0}),l=d.useCallback(()=>{o(zw("images"))},[o]),u=d.useCallback(()=>{o(zw("assets"))},[o]);return a.jsxs(V3,{layerStyle:"first",sx:{flexDirection:"column",h:"full",w:"full",borderRadius:"base",p:2},children:[a.jsxs(De,{sx:{w:"full"},children:[a.jsxs($,{ref:t,sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:[a.jsx(Zne,{isOpen:s,onToggle:i}),a.jsx(lre,{})]}),a.jsx(De,{children:a.jsx(Xne,{isOpen:s})})]}),a.jsxs($,{ref:n,direction:"column",gap:2,h:"full",w:"full",children:[a.jsx($,{sx:{alignItems:"center",justifyContent:"space-between",gap:2},children:a.jsx(nc,{index:r==="images"?0:1,variant:"unstyled",size:"sm",sx:{w:"full"},children:a.jsx(rc,{children:a.jsxs(zn,{isAttached:!0,sx:{w:"full"},children:[a.jsx(Po,{as:Mt,size:"sm",isChecked:r==="images",onClick:l,sx:{w:"full"},leftIcon:a.jsx(gee,{}),"data-testid":"images-tab",children:e("gallery.images")}),a.jsx(Po,{as:Mt,size:"sm",isChecked:r==="assets",onClick:u,sx:{w:"full"},leftIcon:a.jsx(Pee,{}),"data-testid":"assets-tab",children:e("gallery.assets")})]})})})}),a.jsx(Ise,{})]})]})},Mse=d.memo(Ese),Ose=()=>{const e=W(p=>p.system.isConnected),{data:t}=Fa(),[n,{isLoading:r}]=Mb(),o=te(),{t:s}=J(),i=d.useMemo(()=>t==null?void 0:t.queue.item_id,[t==null?void 0:t.queue.item_id]),l=d.useCallback(async()=>{if(i)try{await n(i).unwrap(),o($t({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o($t({title:s("queue.cancelFailed"),status:"error"}))}},[i,o,s,n]),u=d.useMemo(()=>!e||Wd(i),[e,i]);return{cancelQueueItem:l,isLoading:r,currentQueueItemId:i,isDisabled:u}},Rse=({label:e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,asIconButton:i,isLoading:l,loadingText:u,sx:p})=>i?a.jsx(ot,{"aria-label":e,tooltip:t,icon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,sx:p,"data-testid":e}):a.jsx(Mt,{"aria-label":e,tooltip:t,leftIcon:n,onClick:r,isDisabled:o,colorScheme:s,isLoading:l,loadingText:u??e,flexGrow:1,sx:p,"data-testid":e,children:e}),cc=d.memo(Rse),Ase=({asIconButton:e,sx:t})=>{const{t:n}=J(),{cancelQueueItem:r,isLoading:o,isDisabled:s}=Ose();return a.jsx(cc,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.cancel"),tooltip:n("queue.cancelTooltip"),icon:a.jsx(wu,{}),onClick:r,colorScheme:"error",sx:t})},S8=d.memo(Ase),Dse=()=>{const{t:e}=J(),t=te(),{data:n}=Fa(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=YI({fixedCacheKey:"clearQueue"}),i=d.useCallback(async()=>{if(n!=null&&n.queue.total)try{await o().unwrap(),t($t({title:e("queue.clearSucceeded"),status:"success"})),t(Ob(void 0)),t(Rb(void 0))}catch{t($t({title:e("queue.clearFailed"),status:"error"}))}},[n==null?void 0:n.queue.total,o,t,e]),l=d.useMemo(()=>!r||!(n!=null&&n.queue.total),[r,n==null?void 0:n.queue.total]);return{clearQueue:i,isLoading:s,queueStatus:n,isDisabled:l}},Tse=Oe((e,t)=>{const{t:n}=J(),{acceptButtonText:r=n("common.accept"),acceptCallback:o,cancelButtonText:s=n("common.cancel"),cancelCallback:i,children:l,title:u,triggerComponent:p}=e,{isOpen:m,onOpen:h,onClose:g}=Uo(),x=d.useRef(null),y=()=>{o(),g()},b=()=>{i&&i(),g()};return a.jsxs(a.Fragment,{children:[d.cloneElement(p,{onClick:h,ref:t}),a.jsx(Mf,{isOpen:m,leastDestructiveRef:x,onClose:g,isCentered:!0,children:a.jsx(oa,{children:a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:u}),a.jsx(sa,{children:l}),a.jsxs(Oa,{children:[a.jsx(Mt,{ref:x,onClick:b,children:s}),a.jsx(Mt,{colorScheme:"error",onClick:y,ml:3,children:r})]})]})})})]})}),c0=d.memo(Tse),Nse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{clearQueue:r,isLoading:o,isDisabled:s}=Dse();return a.jsxs(c0,{title:n("queue.clearTooltip"),acceptCallback:r,acceptButtonText:n("queue.clear"),triggerComponent:a.jsx(cc,{isDisabled:s,isLoading:o,asIconButton:e,label:n("queue.clear"),tooltip:n("queue.clearTooltip"),icon:a.jsx(qo,{}),colorScheme:"error",sx:t}),children:[a.jsx(Se,{children:n("queue.clearQueueAlertDialog")}),a.jsx("br",{}),a.jsx(Se,{children:n("queue.clearQueueAlertDialog2")})]})},I2=d.memo(Nse),$se=()=>{const e=te(),{t}=J(),n=W(p=>p.system.isConnected),{data:r}=Fa(),[o,{isLoading:s}]=JI({fixedCacheKey:"pauseProcessor"}),i=d.useMemo(()=>!!(r!=null&&r.processor.is_started),[r==null?void 0:r.processor.is_started]),l=d.useCallback(async()=>{if(i)try{await o().unwrap(),e($t({title:t("queue.pauseSucceeded"),status:"success"}))}catch{e($t({title:t("queue.pauseFailed"),status:"error"}))}},[i,o,e,t]),u=d.useMemo(()=>!n||!i,[n,i]);return{pauseProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},Lse=({asIconButton:e})=>{const{t}=J(),{pauseProcessor:n,isLoading:r,isDisabled:o}=$se();return a.jsx(cc,{asIconButton:e,label:t("queue.pause"),tooltip:t("queue.pauseTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(wee,{}),onClick:n,colorScheme:"gold"})},k8=d.memo(Lse),zse=ce([we,ro],({controlAdapters:e,generation:t,system:n,nodes:r,dynamicPrompts:o},s)=>{const{initialImage:i,model:l}=t,{isConnected:u}=n,p=[];return u||p.push(on.t("parameters.invoke.systemDisconnected")),s==="img2img"&&!i&&p.push(on.t("parameters.invoke.noInitialImageSelected")),s==="nodes"?r.shouldValidateGraph&&(r.nodes.length||p.push(on.t("parameters.invoke.noNodesInGraph")),r.nodes.forEach(m=>{if(!Or(m))return;const h=r.nodeTemplates[m.data.type];if(!h){p.push(on.t("parameters.invoke.missingNodeTemplate"));return}const g=d7([m],r.edges);qr(m.data.inputs,x=>{const y=h.inputs[x.name],b=g.some(C=>C.target===m.id&&C.targetHandle===x.name);if(!y){p.push(on.t("parameters.invoke.missingFieldTemplate"));return}if(y.required&&x.value===void 0&&!b){p.push(on.t("parameters.invoke.missingInputForField",{nodeLabel:m.data.label||h.title,fieldLabel:x.label||y.title}));return}})})):(o.prompts.length===0&&p.push(on.t("parameters.invoke.noPrompts")),l||p.push(on.t("parameters.invoke.noModelSelected")),f7(e).forEach((m,h)=>{m.isEnabled&&(m.model?m.model.base_model!==(l==null?void 0:l.base_model)&&p.push(on.t("parameters.invoke.incompatibleBaseModelForControlAdapter",{number:h+1})):p.push(on.t("parameters.invoke.noModelForControlAdapter",{number:h+1})),(!m.controlImage||Mu(m)&&!m.processedControlImage&&m.processorType!=="none")&&p.push(on.t("parameters.invoke.noControlImageForControlAdapter",{number:h+1})))})),{isReady:!p.length,reasons:p}},je),P2=()=>{const{isReady:e,reasons:t}=W(zse);return{isReady:e,reasons:t}},j8=()=>{const e=te(),t=W(ro),{isReady:n}=P2(),[r,{isLoading:o}]=sg({fixedCacheKey:"enqueueBatch"}),s=d.useMemo(()=>!n,[n]);return{queueBack:d.useCallback(()=>{s||(e(Ab()),e(ZI({tabName:t,prepend:!1})))},[e,s,t]),isLoading:o,isDisabled:s}},Fse=ce([we],({gallery:e})=>{const{autoAddBoardId:t}=e;return{autoAddBoardId:t}},je),Bse=({prepend:e=!1})=>{const{t}=J(),{isReady:n,reasons:r}=P2(),{autoAddBoardId:o}=W(Fse),s=n0(o),[i,{isLoading:l}]=sg({fixedCacheKey:"enqueueBatch"}),u=d.useMemo(()=>t(l?"queue.enqueueing":n?e?"queue.queueFront":"queue.queueBack":"queue.notReady"),[l,n,e,t]);return a.jsxs($,{flexDir:"column",gap:1,children:[a.jsx(Se,{fontWeight:600,children:u}),r.length>0&&a.jsx(_f,{children:r.map((p,m)=>a.jsx(ws,{children:a.jsx(Se,{fontWeight:400,children:p})},`${p}.${m}`))}),a.jsx(I8,{}),a.jsxs(Se,{fontWeight:400,fontStyle:"oblique 10deg",children:[t("parameters.invoke.addingImagesTo")," ",a.jsx(Se,{as:"span",fontWeight:600,children:s||t("boards.uncategorized")})]})]})},_8=d.memo(Bse),I8=d.memo(()=>a.jsx(no,{opacity:.2,borderColor:"base.50",_dark:{borderColor:"base.900"}}));I8.displayName="StyledDivider";const Hse=()=>a.jsx(De,{pos:"relative",w:4,h:4,children:a.jsx(wi,{src:vb,alt:"invoke-ai-logo",pos:"absolute",top:-.5,insetInlineStart:-.5,w:5,h:5,minW:5,minH:5,filter:"saturate(0)"})}),Wse=d.memo(Hse),Vse=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueBack:r,isLoading:o,isDisabled:s}=j8();return a.jsx(cc,{asIconButton:e,colorScheme:"accent",label:n("parameters.invoke.invoke"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(_8,{}),sx:t,icon:e?a.jsx(Wse,{}):void 0})},P8=d.memo(Vse),E8=()=>{const e=te(),t=W(ro),{isReady:n}=P2(),[r,{isLoading:o}]=sg({fixedCacheKey:"enqueueBatch"}),s=jn("prependQueue").isFeatureEnabled,i=d.useMemo(()=>!n||!s,[n,s]);return{queueFront:d.useCallback(()=>{i||(e(Ab()),e(ZI({tabName:t,prepend:!0})))},[e,i,t]),isLoading:o,isDisabled:i}},Use=({asIconButton:e,sx:t})=>{const{t:n}=J(),{queueFront:r,isLoading:o,isDisabled:s}=E8();return a.jsx(cc,{asIconButton:e,colorScheme:"base",label:n("queue.queueFront"),isDisabled:s,isLoading:o,onClick:r,tooltip:a.jsx(_8,{prepend:!0}),icon:a.jsx(Voe,{}),sx:t})},Gse=d.memo(Use),qse=()=>{const e=te(),t=W(p=>p.system.isConnected),{data:n}=Fa(),{t:r}=J(),[o,{isLoading:s}]=eP({fixedCacheKey:"resumeProcessor"}),i=d.useMemo(()=>!!(n!=null&&n.processor.is_started),[n==null?void 0:n.processor.is_started]),l=d.useCallback(async()=>{if(!i)try{await o().unwrap(),e($t({title:r("queue.resumeSucceeded"),status:"success"}))}catch{e($t({title:r("queue.resumeFailed"),status:"error"}))}},[i,o,e,r]),u=d.useMemo(()=>!t||i,[t,i]);return{resumeProcessor:l,isLoading:s,isStarted:i,isDisabled:u}},Kse=({asIconButton:e})=>{const{t}=J(),{resumeProcessor:n,isLoading:r,isDisabled:o}=qse();return a.jsx(cc,{asIconButton:e,label:t("queue.resume"),tooltip:t("queue.resumeTooltip"),isDisabled:o,isLoading:r,icon:a.jsx(See,{}),onClick:n,colorScheme:"green"})},M8=d.memo(Kse),Qse=ce(we,({system:e})=>{var t;return{isConnected:e.isConnected,hasSteps:!!e.denoiseProgress,value:(((t=e.denoiseProgress)==null?void 0:t.percentage)??0)*100}},je),Xse=()=>{const{t:e}=J(),{data:t}=Fa(),{hasSteps:n,value:r,isConnected:o}=W(Qse);return a.jsx(S5,{value:r,"aria-label":e("accessibility.invokeProgressBar"),isIndeterminate:o&&!!(t!=null&&t.queue.in_progress)&&!n,h:"full",w:"full",borderRadius:2,colorScheme:"accent"})},Yse=d.memo(Xse),Jse=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled,n=jn("prependQueue").isFeatureEnabled;return a.jsxs($,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,gap:2,flexDir:"column"},children:[a.jsxs($,{gap:2,w:"full",children:[a.jsxs(zn,{isAttached:!0,flexGrow:2,children:[a.jsx(P8,{}),n?a.jsx(Gse,{asIconButton:!0}):a.jsx(a.Fragment,{}),a.jsx(S8,{asIconButton:!0})]}),a.jsxs(zn,{isAttached:!0,children:[t?a.jsx(M8,{asIconButton:!0}):a.jsx(a.Fragment,{}),e?a.jsx(k8,{asIconButton:!0}):a.jsx(a.Fragment,{})]}),a.jsx(I2,{asIconButton:!0})]}),a.jsx($,{h:3,w:"full",children:a.jsx(Yse,{})}),a.jsx(R8,{})]})},O8=d.memo(Jse),R8=d.memo(()=>{const{t:e}=J(),t=te(),{hasItems:n,pending:r}=Fa(void 0,{selectFromResult:({data:s})=>{if(!s)return{hasItems:!1,pending:0};const{pending:i,in_progress:l}=s.queue;return{hasItems:i+l>0,pending:i}}}),o=d.useCallback(()=>{t(ti("queue"))},[t]);return a.jsxs($,{justifyContent:"space-between",alignItems:"center",pe:1,"data-testid":"queue-count",children:[a.jsx(ki,{}),a.jsx(el,{onClick:o,size:"sm",variant:"link",fontWeight:400,opacity:.7,fontStyle:"oblique 10deg",children:n?e("queue.queuedCount",{pending:r}):e("queue.queueEmpty")})]})});R8.displayName="QueueCounts";const{createElement:ku,createContext:Zse,forwardRef:A8,useCallback:Ja,useContext:D8,useEffect:ui,useImperativeHandle:T8,useLayoutEffect:eae,useMemo:tae,useRef:ns,useState:Ld}=hb,g_=hb["useId".toString()],zd=eae,nae=typeof g_=="function"?g_:()=>null;let rae=0;function E2(e=null){const t=nae(),n=ns(e||t||null);return n.current===null&&(n.current=""+rae++),n.current}const u0=Zse(null);u0.displayName="PanelGroupContext";function N8({children:e=null,className:t="",collapsedSize:n=0,collapsible:r=!1,defaultSize:o=null,forwardedRef:s,id:i=null,maxSize:l=null,minSize:u,onCollapse:p=null,onResize:m=null,order:h=null,style:g={},tagName:x="div"}){const y=D8(u0);if(y===null)throw Error("Panel components must be rendered within a PanelGroup container");const b=E2(i),{collapsePanel:C,expandPanel:S,getPanelSize:j,getPanelStyle:_,registerPanel:P,resizePanel:I,units:M,unregisterPanel:O}=y;u==null&&(M==="percentages"?u=10:u=0);const A=ns({onCollapse:p,onResize:m});ui(()=>{A.current.onCollapse=p,A.current.onResize=m});const D=_(b,o),R=ns({size:v_(D)}),N=ns({callbacksRef:A,collapsedSize:n,collapsible:r,defaultSize:o,id:b,idWasAutoGenerated:i==null,maxSize:l,minSize:u,order:h});return zd(()=>{R.current.size=v_(D),N.current.callbacksRef=A,N.current.collapsedSize=n,N.current.collapsible=r,N.current.defaultSize=o,N.current.id=b,N.current.idWasAutoGenerated=i==null,N.current.maxSize=l,N.current.minSize=u,N.current.order=h}),zd(()=>(P(b,N),()=>{O(b)}),[h,b,P,O]),T8(s,()=>({collapse:()=>C(b),expand:()=>S(b),getCollapsed(){return R.current.size===0},getId(){return b},getSize(Y){return j(b,Y)},resize:(Y,F)=>I(b,Y,F)}),[C,S,j,b,I]),ku(x,{children:e,className:t,"data-panel":"","data-panel-collapsible":r||void 0,"data-panel-id":b,"data-panel-size":parseFloat(""+D.flexGrow).toFixed(1),id:`data-panel-id-${b}`,style:{...D,...g}})}const Ji=A8((e,t)=>ku(N8,{...e,forwardedRef:t}));N8.displayName="Panel";Ji.displayName="forwardRef(Panel)";function v_(e){const{flexGrow:t}=e;return typeof t=="string"?parseFloat(t):t}const Zl=10;function Id(e,t,n,r,o,s,i,l){const{id:u,panels:p,units:m}=t,h=m==="pixels"?Wi(u):NaN,{sizes:g}=l||{},x=g||s,y=Fo(p),b=x.concat();let C=0;{const _=o<0?r:n,P=y.findIndex(A=>A.current.id===_),I=y[P],M=x[P],O=Qx(m,h,I,M,M+Math.abs(o),e);if(M===O)return x;O===0&&M>0&&i.set(_,M),o=o<0?M-O:O-M}let S=o<0?n:r,j=y.findIndex(_=>_.current.id===S);for(;;){const _=y[j],P=x[j],I=Math.abs(o)-Math.abs(C),M=Qx(m,h,_,P,P-I,e);if(P!==M&&(M===0&&P>0&&i.set(_.current.id,P),C+=P-M,b[j]=M,C.toPrecision(Zl).localeCompare(Math.abs(o).toPrecision(Zl),void 0,{numeric:!0})>=0))break;if(o<0){if(--j<0)break}else if(++j>=y.length)break}return C===0?x:(S=o<0?r:n,j=y.findIndex(_=>_.current.id===S),b[j]=x[j]+C,b)}function Dc(e,t,n){t.forEach((r,o)=>{const s=e[o];if(!s)return;const{callbacksRef:i,collapsedSize:l,collapsible:u,id:p}=s.current,m=n[p];if(m!==r){n[p]=r;const{onCollapse:h,onResize:g}=i.current;g&&g(r,m),u&&h&&((m==null||m===l)&&r!==l?h(!1):m!==l&&r===l&&h(!0))}})}function oae({groupId:e,panels:t,units:n}){const r=n==="pixels"?Wi(e):NaN,o=Fo(t),s=Array(o.length);let i=0,l=100;for(let u=0;ui.current.id===e);if(n<0)return[null,null];const r=n===t.length-1,o=r?t[n-1].current.id:e,s=r?e:t[n+1].current.id;return[o,s]}function Wi(e){const t=cf(e);if(t==null)return NaN;const n=t.getAttribute("data-panel-group-direction"),r=M2(e);return n==="horizontal"?t.offsetWidth-r.reduce((o,s)=>o+s.offsetWidth,0):t.offsetHeight-r.reduce((o,s)=>o+s.offsetHeight,0)}function $8(e,t,n){if(e.size===1)return"100";const o=Fo(e).findIndex(i=>i.current.id===t),s=n[o];return s==null?"0":s.toPrecision(Zl)}function sae(e){const t=document.querySelector(`[data-panel-id="${e}"]`);return t||null}function cf(e){const t=document.querySelector(`[data-panel-group-id="${e}"]`);return t||null}function d0(e){const t=document.querySelector(`[data-panel-resize-handle-id="${e}"]`);return t||null}function aae(e){return L8().findIndex(r=>r.getAttribute("data-panel-resize-handle-id")===e)??null}function L8(){return Array.from(document.querySelectorAll("[data-panel-resize-handle-id]"))}function M2(e){return Array.from(document.querySelectorAll(`[data-panel-resize-handle-id][data-panel-group-id="${e}"]`))}function O2(e,t,n){var u,p,m,h;const r=d0(t),o=M2(e),s=r?o.indexOf(r):-1,i=((p=(u=n[s])==null?void 0:u.current)==null?void 0:p.id)??null,l=((h=(m=n[s+1])==null?void 0:m.current)==null?void 0:h.id)??null;return[i,l]}function Fo(e){return Array.from(e.values()).sort((t,n)=>{const r=t.current.order,o=n.current.order;return r==null&&o==null?0:r==null?-1:o==null?1:r-o})}function Qx(e,t,n,r,o,s=null){var m;let{collapsedSize:i,collapsible:l,maxSize:u,minSize:p}=n.current;if(e==="pixels"&&(i=i/t*100,u!=null&&(u=u/t*100),p=p/t*100),l){if(r>i){if(o<=p/2+i)return i}else if(!((m=s==null?void 0:s.type)==null?void 0:m.startsWith("key"))&&o100)&&(t.current.minSize=0),o!=null&&(o<0||e==="percentages"&&o>100)&&(t.current.maxSize=null),r!==null&&(r<0||e==="percentages"&&r>100?t.current.defaultSize=null:ro&&(t.current.defaultSize=o))}function y1({groupId:e,panels:t,nextSizes:n,prevSizes:r,units:o}){n=[...n];const s=Fo(t),i=o==="pixels"?Wi(e):NaN;let l=0;for(let u=0;u{const{direction:i,panels:l}=e.current,u=cf(t);z8(u!=null,`No group found for id "${t}"`);const{height:p,width:m}=u.getBoundingClientRect(),g=M2(t).map(x=>{const y=x.getAttribute("data-panel-resize-handle-id"),b=Fo(l),[C,S]=O2(t,y,b);if(C==null||S==null)return()=>{};let j=0,_=100,P=0,I=0;b.forEach(N=>{const{id:Y,maxSize:F,minSize:V}=N.current;Y===C?(j=V,_=F??100):(P+=V,I+=F??100)});const M=Math.min(_,100-P),O=Math.max(j,(b.length-1)*100-I),A=$8(l,C,o);x.setAttribute("aria-valuemax",""+Math.round(M)),x.setAttribute("aria-valuemin",""+Math.round(O)),x.setAttribute("aria-valuenow",""+Math.round(parseInt(A)));const D=N=>{if(!N.defaultPrevented)switch(N.key){case"Enter":{N.preventDefault();const Y=b.findIndex(F=>F.current.id===C);if(Y>=0){const F=b[Y],V=o[Y];if(V!=null){let Q=0;V.toPrecision(Zl)<=F.current.minSize.toPrecision(Zl)?Q=i==="horizontal"?m:p:Q=-(i==="horizontal"?m:p);const q=Id(N,e.current,C,S,Q,o,s.current,null);o!==q&&r(q)}}break}}};x.addEventListener("keydown",D);const R=sae(C);return R!=null&&x.setAttribute("aria-controls",R.id),()=>{x.removeAttribute("aria-valuemax"),x.removeAttribute("aria-valuemin"),x.removeAttribute("aria-valuenow"),x.removeEventListener("keydown",D),R!=null&&x.removeAttribute("aria-controls")}});return()=>{g.forEach(x=>x())}},[e,t,n,s,r,o])}function cae({disabled:e,handleId:t,resizeHandler:n}){ui(()=>{if(e||n==null)return;const r=d0(t);if(r==null)return;const o=s=>{if(!s.defaultPrevented)switch(s.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{s.preventDefault(),n(s);break}case"F6":{s.preventDefault();const i=L8(),l=aae(t);z8(l!==null);const u=s.shiftKey?l>0?l-1:i.length-1:l+1{r.removeEventListener("keydown",o)}},[e,t,n])}function C1(e,t){if(e.length!==t.length)return!1;for(let n=0;nO.current.id===P),M=r[I];if(M.current.collapsible){const O=m[I];(O===0||O.toPrecision(Zl)===M.current.minSize.toPrecision(Zl))&&(S=S<0?-M.current.minSize*y:M.current.minSize*y)}return S}else return F8(e,n,o,l,u)}function dae(e){return e.type==="keydown"}function Xx(e){return e.type.startsWith("mouse")}function Yx(e){return e.type.startsWith("touch")}let Jx=null,Rl=null;function B8(e){switch(e){case"horizontal":return"ew-resize";case"horizontal-max":return"w-resize";case"horizontal-min":return"e-resize";case"vertical":return"ns-resize";case"vertical-max":return"n-resize";case"vertical-min":return"s-resize"}}function fae(){Rl!==null&&(document.head.removeChild(Rl),Jx=null,Rl=null)}function w1(e){if(Jx===e)return;Jx=e;const t=B8(e);Rl===null&&(Rl=document.createElement("style"),document.head.appendChild(Rl)),Rl.innerHTML=`*{cursor: ${t}!important;}`}function pae(e,t=10){let n=null;return(...o)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...o)},t)}}function H8(e){return e.map(t=>{const{minSize:n,order:r}=t.current;return r?`${r}:${n}`:`${n}`}).sort((t,n)=>t.localeCompare(n)).join(",")}function W8(e,t){try{const n=t.getItem(`PanelGroup:sizes:${e}`);if(n){const r=JSON.parse(n);if(typeof r=="object"&&r!=null)return r}}catch{}return null}function mae(e,t,n){const r=W8(e,n);if(r){const o=H8(t);return r[o]??null}return null}function hae(e,t,n,r){const o=H8(t),s=W8(e,r)||{};s[o]=n;try{r.setItem(`PanelGroup:sizes:${e}`,JSON.stringify(s))}catch(i){console.error(i)}}const S1={};function x_(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}const Pd={getItem:e=>(x_(Pd),Pd.getItem(e)),setItem:(e,t)=>{x_(Pd),Pd.setItem(e,t)}};function V8({autoSaveId:e,children:t=null,className:n="",direction:r,disablePointerEventsDuringResize:o=!1,forwardedRef:s,id:i=null,onLayout:l,storage:u=Pd,style:p={},tagName:m="div",units:h="percentages"}){const g=E2(i),[x,y]=Ld(null),[b,C]=Ld(new Map),S=ns(null);ns({didLogDefaultSizeWarning:!1,didLogIdAndOrderWarning:!1,didLogInvalidLayoutWarning:!1,prevPanelIds:[]});const j=ns({onLayout:l});ui(()=>{j.current.onLayout=l});const _=ns({}),[P,I]=Ld([]),M=ns(new Map),O=ns(0),A=ns({direction:r,id:g,panels:b,sizes:P,units:h});T8(s,()=>({getId:()=>g,getLayout:T=>{const{sizes:B,units:X}=A.current;if((T??X)==="pixels"){const le=Wi(g);return B.map(se=>se/100*le)}else return B},setLayout:(T,B)=>{const{id:X,panels:re,sizes:le,units:se}=A.current;if((B||se)==="pixels"){const de=Wi(X);T=T.map(Z=>Z/de*100)}const K=_.current,U=Fo(re),ee=y1({groupId:X,panels:re,nextSizes:T,prevSizes:le,units:se});C1(le,ee)||(I(ee),Dc(U,ee,K))}}),[g]),zd(()=>{A.current.direction=r,A.current.id=g,A.current.panels=b,A.current.sizes=P,A.current.units=h}),lae({committedValuesRef:A,groupId:g,panels:b,setSizes:I,sizes:P,panelSizeBeforeCollapse:M}),ui(()=>{const{onLayout:T}=j.current,{panels:B,sizes:X}=A.current;if(X.length>0){T&&T(X);const re=_.current,le=Fo(B);Dc(le,X,re)}},[P]),zd(()=>{const{id:T,sizes:B,units:X}=A.current;if(B.length===b.size)return;let re=null;if(e){const le=Fo(b);re=mae(e,le,u)}if(re!=null){const le=y1({groupId:T,panels:b,nextSizes:re,prevSizes:re,units:X});I(le)}else{const le=oae({groupId:T,panels:b,units:X});I(le)}},[e,b,u]),ui(()=>{if(e){if(P.length===0||P.length!==b.size)return;const T=Fo(b);S1[e]||(S1[e]=pae(hae,100)),S1[e](e,T,P,u)}},[e,b,P,u]),zd(()=>{if(h==="pixels"){const T=new ResizeObserver(()=>{const{panels:B,sizes:X}=A.current,re=y1({groupId:g,panels:B,nextSizes:X,prevSizes:X,units:h});C1(X,re)||I(re)});return T.observe(cf(g)),()=>{T.disconnect()}}},[g,h]);const D=Ja((T,B)=>{const{panels:X,units:re}=A.current,se=Fo(X).findIndex(ee=>ee.current.id===T),K=P[se];if((B??re)==="pixels"){const ee=Wi(g);return K/100*ee}else return K},[g,P]),R=Ja((T,B)=>{const{panels:X}=A.current;return X.size===0?{flexBasis:0,flexGrow:B??void 0,flexShrink:1,overflow:"hidden"}:{flexBasis:0,flexGrow:$8(X,T,P),flexShrink:1,overflow:"hidden",pointerEvents:o&&x!==null?"none":void 0}},[x,o,P]),N=Ja((T,B)=>{const{units:X}=A.current;iae(X,B),C(re=>{if(re.has(T))return re;const le=new Map(re);return le.set(T,B),le})},[]),Y=Ja(T=>X=>{X.preventDefault();const{direction:re,panels:le,sizes:se}=A.current,K=Fo(le),[U,ee]=O2(g,T,K);if(U==null||ee==null)return;let de=uae(X,g,T,K,re,se,S.current);if(de===0)return;const ue=cf(g).getBoundingClientRect(),fe=re==="horizontal";document.dir==="rtl"&&fe&&(de=-de);const ge=fe?ue.width:ue.height,_e=de/ge*100,ye=Id(X,A.current,U,ee,_e,se,M.current,S.current),pe=!C1(se,ye);if((Xx(X)||Yx(X))&&O.current!=_e&&w1(pe?fe?"horizontal":"vertical":fe?de<0?"horizontal-min":"horizontal-max":de<0?"vertical-min":"vertical-max"),pe){const Te=_.current;I(ye),Dc(K,ye,Te)}O.current=_e},[g]),F=Ja(T=>{C(B=>{if(!B.has(T))return B;const X=new Map(B);return X.delete(T),X})},[]),V=Ja(T=>{const{panels:B,sizes:X}=A.current,re=B.get(T);if(re==null)return;const{collapsedSize:le,collapsible:se}=re.current;if(!se)return;const K=Fo(B),U=K.indexOf(re);if(U<0)return;const ee=X[U];if(ee===le)return;M.current.set(T,ee);const[de,Z]=b1(T,K);if(de==null||Z==null)return;const fe=U===K.length-1?ee:le-ee,ge=Id(null,A.current,de,Z,fe,X,M.current,null);if(X!==ge){const _e=_.current;I(ge),Dc(K,ge,_e)}},[]),Q=Ja(T=>{const{panels:B,sizes:X}=A.current,re=B.get(T);if(re==null)return;const{collapsedSize:le,minSize:se}=re.current,K=M.current.get(T)||se;if(!K)return;const U=Fo(B),ee=U.indexOf(re);if(ee<0||X[ee]!==le)return;const[Z,ue]=b1(T,U);if(Z==null||ue==null)return;const ge=ee===U.length-1?le-K:K,_e=Id(null,A.current,Z,ue,ge,X,M.current,null);if(X!==_e){const ye=_.current;I(_e),Dc(U,_e,ye)}},[]),q=Ja((T,B,X)=>{const{id:re,panels:le,sizes:se,units:K}=A.current;if((X||K)==="pixels"){const Pt=Wi(re);B=B/Pt*100}const U=le.get(T);if(U==null)return;let{collapsedSize:ee,collapsible:de,maxSize:Z,minSize:ue}=U.current;if(K==="pixels"){const Pt=Wi(re);ue=ue/Pt*100,Z!=null&&(Z=Z/Pt*100)}const fe=Fo(le),ge=fe.indexOf(U);if(ge<0)return;const _e=se[ge];if(_e===B)return;de&&B===ee||(B=Math.min(Z??100,Math.max(ue,B)));const[ye,pe]=b1(T,fe);if(ye==null||pe==null)return;const Ae=ge===fe.length-1?_e-B:B-_e,qe=Id(null,A.current,ye,pe,Ae,se,M.current,null);if(se!==qe){const Pt=_.current;I(qe),Dc(fe,qe,Pt)}},[]),z=tae(()=>({activeHandleId:x,collapsePanel:V,direction:r,expandPanel:Q,getPanelSize:D,getPanelStyle:R,groupId:g,registerPanel:N,registerResizeHandle:Y,resizePanel:q,startDragging:(T,B)=>{if(y(T),Xx(B)||Yx(B)){const X=d0(T);S.current={dragHandleRect:X.getBoundingClientRect(),dragOffset:F8(B,T,r),sizes:A.current.sizes}}},stopDragging:()=>{fae(),y(null),S.current=null},units:h,unregisterPanel:F}),[x,V,r,Q,D,R,g,N,Y,q,h,F]),G={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return ku(u0.Provider,{children:ku(m,{children:t,className:n,"data-panel-group":"","data-panel-group-direction":r,"data-panel-group-id":g,"data-panel-group-units":h,style:{...G,...p}}),value:z})}const f0=A8((e,t)=>ku(V8,{...e,forwardedRef:t}));V8.displayName="PanelGroup";f0.displayName="forwardRef(PanelGroup)";function Zx({children:e=null,className:t="",disabled:n=!1,id:r=null,onDragging:o,style:s={},tagName:i="div"}){const l=ns(null),u=ns({onDragging:o});ui(()=>{u.current.onDragging=o});const p=D8(u0);if(p===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{activeHandleId:m,direction:h,groupId:g,registerResizeHandle:x,startDragging:y,stopDragging:b}=p,C=E2(r),S=m===C,[j,_]=Ld(!1),[P,I]=Ld(null),M=Ja(()=>{l.current.blur(),b();const{onDragging:D}=u.current;D&&D(!1)},[b]);ui(()=>{if(n)I(null);else{const A=x(C);I(()=>A)}},[n,C,x]),ui(()=>{if(n||P==null||!S)return;const A=Y=>{P(Y)},D=Y=>{P(Y)},N=l.current.ownerDocument;return N.body.addEventListener("contextmenu",M),N.body.addEventListener("mousemove",A),N.body.addEventListener("touchmove",A),N.body.addEventListener("mouseleave",D),window.addEventListener("mouseup",M),window.addEventListener("touchend",M),()=>{N.body.removeEventListener("contextmenu",M),N.body.removeEventListener("mousemove",A),N.body.removeEventListener("touchmove",A),N.body.removeEventListener("mouseleave",D),window.removeEventListener("mouseup",M),window.removeEventListener("touchend",M)}},[h,n,S,P,M]),cae({disabled:n,handleId:C,resizeHandler:P});const O={cursor:B8(h),touchAction:"none",userSelect:"none"};return ku(i,{children:e,className:t,"data-resize-handle-active":S?"pointer":j?"keyboard":void 0,"data-panel-group-direction":h,"data-panel-group-id":g,"data-panel-resize-handle-enabled":!n,"data-panel-resize-handle-id":C,onBlur:()=>_(!1),onFocus:()=>_(!0),onMouseDown:A=>{y(C,A.nativeEvent);const{onDragging:D}=u.current;D&&D(!0)},onMouseUp:M,onTouchCancel:M,onTouchEnd:M,onTouchStart:A=>{y(C,A.nativeEvent);const{onDragging:D}=u.current;D&&D(!0)},ref:l,role:"separator",style:{...O,...s},tabIndex:0})}Zx.displayName="PanelResizeHandle";const gae=e=>{const{direction:t="horizontal",collapsedDirection:n,isCollapsed:r=!1,...o}=e,s=di("base.100","base.850"),i=di("base.300","base.700");return t==="horizontal"?a.jsx(Zx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx($,{className:"resize-handle-horizontal",sx:{w:n?2.5:4,h:"full",justifyContent:n?n==="left"?"flex-start":"flex-end":"center",alignItems:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(De,{sx:{w:1,h:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})}):a.jsx(Zx,{style:{visibility:r?"hidden":"visible",width:r?0:"auto"},children:a.jsx($,{className:"resize-handle-vertical",sx:{w:"full",h:n?2.5:4,alignItems:n?n==="top"?"flex-start":"flex-end":"center",justifyContent:"center",div:{bg:s},_hover:{div:{bg:i}}},...o,children:a.jsx(De,{sx:{h:1,w:"calc(100% - 1rem)",borderRadius:"base",transitionProperty:"common",transitionDuration:"normal"}})})})},Qh=d.memo(gae),R2=()=>{const e=te(),t=W(o=>o.ui.panels),n=d.useCallback(o=>t[o]??"",[t]),r=d.useCallback((o,s)=>{e(p7({name:o,value:s}))},[e]);return{getItem:n,setItem:r}};const vae=e=>{const{label:t,data:n,fileName:r,withDownload:o=!0,withCopy:s=!0}=e,i=d.useMemo(()=>m7(n)?n:JSON.stringify(n,null,2),[n]),l=d.useCallback(()=>{navigator.clipboard.writeText(i)},[i]),u=d.useCallback(()=>{const m=new Blob([i]),h=document.createElement("a");h.href=URL.createObjectURL(m),h.download=`${r||t}.json`,document.body.appendChild(h),h.click(),h.remove()},[i,t,r]),{t:p}=J();return a.jsxs($,{layerStyle:"second",sx:{borderRadius:"base",flexGrow:1,w:"full",h:"full",position:"relative"},children:[a.jsx(De,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0,overflow:"auto",p:4,fontSize:"sm"},children:a.jsx(e0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"}},children:a.jsx("pre",{children:i})})}),a.jsxs($,{sx:{position:"absolute",top:0,insetInlineEnd:0,p:2},children:[o&&a.jsx(Fn,{label:`${p("gallery.download")} ${t} JSON`,children:a.jsx(Pa,{"aria-label":`${p("gallery.download")} ${t} JSON`,icon:a.jsx(zu,{}),variant:"ghost",opacity:.7,onClick:u})}),s&&a.jsx(Fn,{label:`${p("gallery.copy")} ${t} JSON`,children:a.jsx(Pa,{"aria-label":`${p("gallery.copy")} ${t} JSON`,icon:a.jsx(Lu,{}),variant:"ghost",opacity:.7,onClick:l})})]})]})},Zi=d.memo(vae),xae=ce(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(r=>r.id===t);return{data:n==null?void 0:n.data}},je),bae=()=>{const{data:e}=W(xae);return e?a.jsx(Zi,{data:e,label:"Node Data"}):a.jsx(eo,{label:"No node selected",icon:null})},yae=d.memo(bae),Cae=({children:e,maxHeight:t})=>a.jsx($,{sx:{w:"full",h:"full",maxHeight:t,position:"relative"},children:a.jsx(De,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(e0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:e})})}),Hu=d.memo(Cae),wae=({output:e})=>{const{image:t}=e,{data:n}=Ps(t.image_name);return a.jsx(al,{imageDTO:n})},Sae=d.memo(wae),kae=ce(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(s=>s.id===t),r=n?e.nodeTemplates[n.data.type]:void 0,o=e.nodeExecutionStates[t??"__UNKNOWN_NODE__"];return{node:n,template:r,nes:o}},je),jae=()=>{const{node:e,template:t,nes:n}=W(kae),{t:r}=J();return!e||!n||!Or(e)?a.jsx(eo,{label:r("nodes.noNodeSelected"),icon:null}):n.outputs.length===0?a.jsx(eo,{label:r("nodes.noOutputRecorded"),icon:null}):a.jsx(De,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Hu,{children:a.jsx($,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:(t==null?void 0:t.outputType)==="image_output"?n.outputs.map((o,s)=>a.jsx(Sae,{output:o},Iae(o,s))):a.jsx(Zi,{data:n.outputs,label:r("nodes.nodeOutputs")})})})})},_ae=d.memo(jae),Iae=(e,t)=>`${e.type}-${t}`,Pae=ce(we,({nodes:e})=>{const t=e.selectedNodes[e.selectedNodes.length-1],n=e.nodes.find(o=>o.id===t);return{template:n?e.nodeTemplates[n.data.type]:void 0}},je),Eae=()=>{const{template:e}=W(Pae),{t}=J();return e?a.jsx(Zi,{data:e,label:t("nodes.nodeTemplate")}):a.jsx(eo,{label:t("nodes.noNodeSelected"),icon:null})},Mae=d.memo(Eae),Oae=()=>a.jsx($,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(nc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(rc,{children:[a.jsx(Po,{children:"Outputs"}),a.jsx(Po,{children:"Data"}),a.jsx(Po,{children:"Template"})]}),a.jsxs(Tu,{children:[a.jsx(ss,{children:a.jsx(_ae,{})}),a.jsx(ss,{children:a.jsx(yae,{})}),a.jsx(ss,{children:a.jsx(Mae,{})})]})]})}),Rae=d.memo(Oae),A2=e=>{e.stopPropagation()},Aae={display:"flex",flexDirection:"row",alignItems:"center",gap:10},Dae=e=>{const{label:t="",labelPos:n="top",isDisabled:r=!1,isInvalid:o,formControlProps:s,...i}=e,l=te(),u=d.useCallback(m=>{m.shiftKey&&l(Vo(!0))},[l]),p=d.useCallback(m=>{m.shiftKey||l(Vo(!1))},[l]);return a.jsxs(Kn,{isInvalid:o,isDisabled:r,...s,style:n==="side"?Aae:void 0,children:[t!==""&&a.jsx(Rr,{children:t}),a.jsx(gg,{...i,onPaste:A2,onKeyDown:u,onKeyUp:p})]})},Cs=d.memo(Dae),Tae=Oe((e,t)=>{const n=te(),r=d.useCallback(s=>{s.shiftKey&&n(Vo(!0))},[n]),o=d.useCallback(s=>{s.shiftKey||n(Vo(!1))},[n]);return a.jsx(U5,{ref:t,onPaste:A2,onKeyDown:r,onKeyUp:o,...e})}),gi=d.memo(Tae),Nae=ce(we,({nodes:e})=>{const{author:t,name:n,description:r,tags:o,version:s,contact:i,notes:l}=e.workflow;return{name:n,author:t,description:r,tags:o,version:s,contact:i,notes:l}},je),$ae=()=>{const{author:e,name:t,description:n,tags:r,version:o,contact:s,notes:i}=W(Nae),l=te(),u=d.useCallback(C=>{l(h7(C.target.value))},[l]),p=d.useCallback(C=>{l(g7(C.target.value))},[l]),m=d.useCallback(C=>{l(v7(C.target.value))},[l]),h=d.useCallback(C=>{l(x7(C.target.value))},[l]),g=d.useCallback(C=>{l(b7(C.target.value))},[l]),x=d.useCallback(C=>{l(y7(C.target.value))},[l]),y=d.useCallback(C=>{l(C7(C.target.value))},[l]),{t:b}=J();return a.jsx(Hu,{children:a.jsxs($,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:[a.jsxs($,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:b("nodes.workflowName"),value:t,onChange:u}),a.jsx(Cs,{label:b("nodes.workflowVersion"),value:o,onChange:h})]}),a.jsxs($,{sx:{gap:2,w:"full"},children:[a.jsx(Cs,{label:b("nodes.workflowAuthor"),value:e,onChange:p}),a.jsx(Cs,{label:b("nodes.workflowContact"),value:s,onChange:m})]}),a.jsx(Cs,{label:b("nodes.workflowTags"),value:r,onChange:x}),a.jsxs(Kn,{as:$,sx:{flexDir:"column"},children:[a.jsx(Rr,{children:b("nodes.workflowDescription")}),a.jsx(gi,{onChange:g,value:n,fontSize:"sm",sx:{resize:"none"}})]}),a.jsxs(Kn,{as:$,sx:{flexDir:"column",h:"full"},children:[a.jsx(Rr,{children:b("nodes.workflowNotes")}),a.jsx(gi,{onChange:y,value:i,fontSize:"sm",sx:{h:"full",resize:"none"}})]})]})})},Lae=d.memo($ae),U8=()=>{const e=W(r=>r.nodes),[t]=k2(e,300);return d.useMemo(()=>w7(t),[t])},zae=()=>{const e=U8(),{t}=J();return a.jsx($,{sx:{flexDir:"column",alignItems:"flex-start",gap:2,h:"full"},children:a.jsx(Zi,{data:e,label:t("nodes.workflow")})})},Fae=d.memo(zae),Bae=({isSelected:e,isHovered:t})=>{const n=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.light";if(e)return"nodeSelected.light";if(t)return"nodeHovered.light"},[t,e]),r=d.useMemo(()=>{if(e&&t)return"nodeHoveredSelected.dark";if(e)return"nodeSelected.dark";if(t)return"nodeHovered.dark"},[t,e]);return a.jsx(De,{className:"selection-box",sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",opacity:e||t?1:.5,transitionProperty:"common",transitionDuration:"0.1s",pointerEvents:"none",shadow:n,_dark:{shadow:r}}})},G8=d.memo(Bae),q8=e=>{const t=te(),n=d.useMemo(()=>ce(we,({nodes:i})=>i.mouseOverNode===e,je),[e]),r=W(n),o=d.useCallback(()=>{!r&&t(Fw(e))},[t,e,r]),s=d.useCallback(()=>{r&&t(Fw(null))},[t,r]);return{isMouseOverNode:r,handleMouseOver:o,handleMouseOut:s}},K8=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Or(s))return(i=s==null?void 0:s.data.inputs[t])==null?void 0:i.label},je),[t,e]);return W(n)},Q8=(e,t,n)=>{const r=d.useMemo(()=>ce(we,({nodes:s})=>{var u;const i=s.nodes.find(p=>p.id===e);if(!Or(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return(u=l==null?void 0:l[Db[n]][t])==null?void 0:u.title},je),[t,n,e]);return W(r)},X8=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{const s=o.nodes.find(i=>i.id===e);if(Or(s))return s==null?void 0:s.data.inputs[t]},je),[t,e]);return W(n)},p0=(e,t,n)=>{const r=d.useMemo(()=>ce(we,({nodes:s})=>{const i=s.nodes.find(u=>u.id===e);if(!Or(i))return;const l=s.nodeTemplates[(i==null?void 0:i.data.type)??""];return l==null?void 0:l[Db[n]][t]},je),[t,n,e]);return W(r)},Hae=({nodeId:e,fieldName:t,kind:n})=>{const r=X8(e,t),o=p0(e,t,n),s=S7(o),{t:i}=J(),l=d.useMemo(()=>k7(r)?r.label&&(o!=null&&o.title)?`${r.label} (${o.title})`:r.label&&!o?r.label:!r.label&&o?o.title:i("nodes.unknownField"):(o==null?void 0:o.title)||i("nodes.unknownField"),[r,o,i]);return a.jsxs($,{sx:{flexDir:"column"},children:[a.jsx(Se,{sx:{fontWeight:600},children:l}),o&&a.jsx(Se,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:o.description}),o&&a.jsxs(Se,{children:["Type: ",vf[o.type].title]}),s&&a.jsxs(Se,{children:["Input: ",j7(o.input)]})]})},D2=d.memo(Hae),Wae=Oe((e,t)=>{const{nodeId:n,fieldName:r,kind:o,isMissingInput:s=!1,withTooltip:i=!1}=e,l=K8(n,r),u=Q8(n,r,o),{t:p}=J(),m=te(),[h,g]=d.useState(l||u||p("nodes.unknownField")),x=d.useCallback(async b=>{b&&(b===l||b===u)||(g(b||u||p("nodes.unknownField")),m(_7({nodeId:n,fieldName:r,label:b})))},[l,u,m,n,r,p]),y=d.useCallback(b=>{g(b)},[]);return d.useEffect(()=>{g(l||u||p("nodes.unknownField"))},[l,u,p]),a.jsx(Fn,{label:i?a.jsx(D2,{nodeId:n,fieldName:r,kind:"input"}):void 0,openDelay:ag,placement:"top",hasArrow:!0,children:a.jsx($,{ref:t,sx:{position:"relative",overflow:"hidden",alignItems:"center",justifyContent:"flex-start",gap:1,h:"full"},children:a.jsxs(pg,{value:h,onChange:y,onSubmit:x,as:$,sx:{position:"relative",alignItems:"center",h:"full"},children:[a.jsx(fg,{sx:{p:0,fontWeight:s?600:400,textAlign:"left",_hover:{fontWeight:"600 !important"}},noOfLines:1}),a.jsx(dg,{className:"nodrag",sx:{p:0,w:"full",fontWeight:600,color:"base.900",_dark:{color:"base.100"},_focusVisible:{p:0,textAlign:"left",boxShadow:"none"}}}),a.jsx(J8,{})]})})})}),Y8=d.memo(Wae),J8=d.memo(()=>{const{isEditing:e,getEditButtonProps:t}=YP(),n=d.useCallback(r=>{const{onClick:o}=t();o&&(o(r),r.preventDefault())},[t]);return e?null:a.jsx($,{onClick:n,position:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,cursor:"text"})});J8.displayName="EditableControls";const Vae=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(I7({nodeId:t,fieldName:n.name,value:s.target.checked}))},[r,n.name,t]);return a.jsx(jy,{className:"nodrag",onChange:o,isChecked:n.value})},Uae=d.memo(Vae);function m0(){return(m0=Object.assign||function(e){for(var t=1;t=0||(o[n]=e[n]);return o}function eb(e){var t=d.useRef(e),n=d.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var ju=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e0:C.buttons>0)&&o.current?s(b_(o.current,C,l.current)):b(!1)},y=function(){return b(!1)};function b(C){var S=u.current,j=tb(o.current),_=C?j.addEventListener:j.removeEventListener;_(S?"touchmove":"mousemove",x),_(S?"touchend":"mouseup",y)}return[function(C){var S=C.nativeEvent,j=o.current;if(j&&(y_(S),!function(P,I){return I&&!Fd(P)}(S,u.current)&&j)){if(Fd(S)){u.current=!0;var _=S.changedTouches||[];_.length&&(l.current=_[0].identifier)}j.focus(),s(b_(j,S,l.current)),b(!0)}},function(C){var S=C.which||C.keyCode;S<37||S>40||(C.preventDefault(),i({left:S===39?.05:S===37?-.05:0,top:S===40?.05:S===38?-.05:0}))},b]},[i,s]),m=p[0],h=p[1],g=p[2];return d.useEffect(function(){return g},[g]),H.createElement("div",m0({},r,{onTouchStart:m,onMouseDown:m,className:"react-colorful__interactive",ref:o,onKeyDown:h,tabIndex:0,role:"slider"}))}),h0=function(e){return e.filter(Boolean).join(" ")},N2=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=h0(["react-colorful__pointer",e.className]);return H.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},H.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Mo=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},eR=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:Mo(e.h),s:Mo(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:Mo(o/2),a:Mo(r,2)}},nb=function(e){var t=eR(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},k1=function(e){var t=eR(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Gae=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),i=r*(1-n),l=r*(1-(t-s)*n),u=r*(1-(1-t+s)*n),p=s%6;return{r:Mo(255*[r,l,i,i,u,r][p]),g:Mo(255*[u,r,r,l,i,i][p]),b:Mo(255*[i,i,u,r,r,l][p]),a:Mo(o,2)}},qae=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),i=s-Math.min(t,n,r),l=i?s===t?(n-r)/i:s===n?2+(r-t)/i:4+(t-n)/i:0;return{h:Mo(60*(l<0?l+6:l)),s:Mo(s?i/s*100:0),v:Mo(s/255*100),a:o}},Kae=H.memo(function(e){var t=e.hue,n=e.onChange,r=h0(["react-colorful__hue",e.className]);return H.createElement("div",{className:r},H.createElement(T2,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:ju(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":Mo(t),"aria-valuemax":"360","aria-valuemin":"0"},H.createElement(N2,{className:"react-colorful__hue-pointer",left:t/360,color:nb({h:t,s:100,v:100,a:1})})))}),Qae=H.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:nb({h:t.h,s:100,v:100,a:1})};return H.createElement("div",{className:"react-colorful__saturation",style:r},H.createElement(T2,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:ju(t.s+100*o.left,0,100),v:ju(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Mo(t.s)+"%, Brightness "+Mo(t.v)+"%"},H.createElement(N2,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:nb(t)})))}),tR=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0};function Xae(e,t,n){var r=eb(n),o=d.useState(function(){return e.toHsva(t)}),s=o[0],i=o[1],l=d.useRef({color:t,hsva:s});d.useEffect(function(){if(!e.equal(t,l.current.color)){var p=e.toHsva(t);l.current={hsva:p,color:t},i(p)}},[t,e]),d.useEffect(function(){var p;tR(s,l.current.hsva)||e.equal(p=e.fromHsva(s),l.current.color)||(l.current={hsva:s,color:p},r(p))},[s,e,r]);var u=d.useCallback(function(p){i(function(m){return Object.assign({},m,p)})},[]);return[s,u]}var Yae=typeof window<"u"?d.useLayoutEffect:d.useEffect,Jae=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},C_=new Map,Zae=function(e){Yae(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!C_.has(t)){var n=t.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,C_.set(t,n);var r=Jae();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},eie=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+k1(Object.assign({},n,{a:0}))+", "+k1(Object.assign({},n,{a:1}))+")"},s=h0(["react-colorful__alpha",t]),i=Mo(100*n.a);return H.createElement("div",{className:s},H.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),H.createElement(T2,{onMove:function(l){r({a:l.left})},onKey:function(l){r({a:ju(n.a+l.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},H.createElement(N2,{className:"react-colorful__alpha-pointer",left:n.a,color:k1(n)})))},tie=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,i=Z8(e,["className","colorModel","color","onChange"]),l=d.useRef(null);Zae(l);var u=Xae(n,o,s),p=u[0],m=u[1],h=h0(["react-colorful",t]);return H.createElement("div",m0({},i,{ref:l,className:h}),H.createElement(Qae,{hsva:p,onChange:m}),H.createElement(Kae,{hue:p.h,onChange:m}),H.createElement(eie,{hsva:p,onChange:m,className:"react-colorful__last-control"}))},nie={defaultColor:{r:0,g:0,b:0,a:1},toHsva:qae,fromHsva:Gae,equal:tR},nR=function(e){return H.createElement(tie,m0({},e,{colorModel:nie}))};const rie=e=>{const{nodeId:t,field:n}=e,r=te(),o=d.useCallback(s=>{r(P7({nodeId:t,fieldName:n.name,value:s}))},[r,n.name,t]);return a.jsx(nR,{className:"nodrag",color:n.value,onChange:o})},oie=d.memo(rie),rR=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=E7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({controlNetModelId:e,errors:s.error.format()},"Failed to parse ControlNet model id");return}return s.data},sie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Cb(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/controlnet/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=rR(p);m&&o(M7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Tr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},aie=d.memo(sie),iie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(O7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return a.jsx(_5,{className:"nowheel nodrag",onChange:s,value:n.value,children:r.options.map(i=>a.jsx("option",{value:i,children:r.ui_choice_labels?r.ui_choice_labels[i]:i},i))})},lie=d.memo(iie),cie=e=>{var p;const{nodeId:t,field:n}=e,r=te(),{currentData:o}=Ps(((p=n.value)==null?void 0:p.image_name)??Os.skipToken),s=d.useCallback(()=>{r(R7({nodeId:t,fieldName:n.name,value:void 0}))},[r,n.name,t]),i=d.useMemo(()=>{if(o)return{id:`node-${t}-${n.name}`,payloadType:"IMAGE_DTO",payload:{imageDTO:o}}},[n.name,o,t]),l=d.useMemo(()=>({id:`node-${t}-${n.name}`,actionType:"SET_NODES_IMAGE",context:{nodeId:t,fieldName:n.name}}),[n.name,t]),u=d.useMemo(()=>({type:"SET_NODES_IMAGE",nodeId:t,fieldName:n.name}),[t,n.name]);return a.jsx($,{className:"nodrag",sx:{w:"full",h:"full",alignItems:"center",justifyContent:"center"},children:a.jsx(al,{imageDTO:o,droppableData:l,draggableData:i,postUploadAction:u,useThumbailFallback:!0,uploadElement:a.jsx(oR,{}),dropLabel:a.jsx(sR,{}),minSize:8,children:a.jsx(du,{onClick:s,icon:o?a.jsx(qg,{}):void 0,tooltip:"Reset Image"})})})},uie=d.memo(cie),oR=d.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop or Upload"}));oR.displayName="UploadElement";const sR=d.memo(()=>a.jsx(Se,{fontSize:16,fontWeight:600,children:"Drop"}));sR.displayName="DropLabel";const die=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=A7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({loraModelId:e,errors:s.error.format()},"Failed to parse LoRA model id");return}return s.data},fie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=gf(),{t:i}=J(),l=d.useMemo(()=>{if(!s)return[];const m=[];return qr(s.entities,(h,g)=>{h&&m.push({value:g,label:h.model_name,group:gr[h.base_model]})}),m.sort((h,g)=>h.disabled&&!g.disabled?1:-1)},[s]),u=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/lora/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r==null?void 0:r.base_model,r==null?void 0:r.model_name]),p=d.useCallback(m=>{if(!m)return;const h=die(m);h&&o(D7({nodeId:t,fieldName:n.name,value:h}))},[o,n.name,t]);return(s==null?void 0:s.ids.length)===0?a.jsx($,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:"No LoRAs Loaded"})}):a.jsx(tr,{className:"nowheel nodrag",value:(u==null?void 0:u.id)??null,placeholder:l.length>0?i("models.selectLoRA"):i("models.noLoRAsAvailable"),data:l,nothingFound:i("models.noMatchingLoRAs"),itemComponent:fl,disabled:l.length===0,filter:(m,h)=>{var g;return((g=h.label)==null?void 0:g.toLowerCase().includes(m.toLowerCase().trim()))||h.value.toLowerCase().includes(m.toLowerCase().trim())},error:!u,onChange:p,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},pie=d.memo(fie),g0=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=T7.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data};function Wu(e){const{iconMode:t=!1,...n}=e,r=te(),{t:o}=J(),[s,{isLoading:i}]=N7(),l=()=>{s().unwrap().then(u=>{r($t(Gn({title:`${o("modelManager.modelsSynced")}`,status:"success"})))}).catch(u=>{u&&r($t(Gn({title:`${o("modelManager.modelSyncFailed")}`,status:"error"})))})};return t?a.jsx(ot,{icon:a.jsx(JM,{}),tooltip:o("modelManager.syncModels"),"aria-label":o("modelManager.syncModels"),isLoading:i,onClick:l,size:"sm",...n}):a.jsx(Mt,{isLoading:i,onClick:l,minW:"max-content",...n,children:"Sync Models"})}const mie=e=>{var y,b;const{nodeId:t,field:n}=e,r=te(),o=jn("syncModels").isFeatureEnabled,{t:s}=J(),{data:i,isLoading:l}=Bd(Bw),{data:u,isLoading:p}=na(Bw),m=d.useMemo(()=>l||p,[l,p]),h=d.useMemo(()=>{if(!u)return[];const C=[];return qr(u.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),i&&qr(i.entities,(S,j)=>{S&&C.push({value:j,label:S.model_name,group:gr[S.base_model]})}),C},[u,i]),g=d.useMemo(()=>{var C,S,j,_;return((u==null?void 0:u.entities[`${(C=n.value)==null?void 0:C.base_model}/main/${(S=n.value)==null?void 0:S.model_name}`])||(i==null?void 0:i.entities[`${(j=n.value)==null?void 0:j.base_model}/onnx/${(_=n.value)==null?void 0:_.model_name}`]))??null},[(y=n.value)==null?void 0:y.base_model,(b=n.value)==null?void 0:b.model_name,u==null?void 0:u.entities,i==null?void 0:i.entities]),x=d.useCallback(C=>{if(!C)return;const S=g0(C);S&&r(tP({nodeId:t,fieldName:n.name,value:S}))},[r,n.name,t]);return a.jsxs($,{sx:{w:"full",alignItems:"center",gap:2},children:[m?a.jsx(Se,{variant:"subtext",children:"Loading..."}):a.jsx(tr,{className:"nowheel nodrag",tooltip:g==null?void 0:g.description,value:g==null?void 0:g.id,placeholder:h.length>0?s("models.selectModel"):s("models.noModelsAvailable"),data:h,error:!g,disabled:h.length===0,onChange:x,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),o&&a.jsx(Wu,{className:"nodrag",iconMode:!0})]})},hie=d.memo(mie),Xh=/^-?(0\.)?\.?$/,aR=Oe((e,t)=>{const{label:n,isDisabled:r=!1,showStepper:o=!0,isInvalid:s,value:i,onChange:l,min:u,max:p,isInteger:m=!0,formControlProps:h,formLabelProps:g,numberInputFieldProps:x,numberInputStepperProps:y,tooltipProps:b,...C}=e,S=te(),[j,_]=d.useState(String(i));d.useEffect(()=>{!j.match(Xh)&&i!==Number(j)&&_(String(i))},[i,j]);const P=A=>{_(A),A.match(Xh)||l(m?Math.floor(Number(A)):Number(A))},I=A=>{const D=Fl(m?Math.floor(Number(A.target.value)):Number(A.target.value),u,p);_(String(D)),l(D)},M=d.useCallback(A=>{A.shiftKey&&S(Vo(!0))},[S]),O=d.useCallback(A=>{A.shiftKey||S(Vo(!1))},[S]);return a.jsx(Fn,{...b,children:a.jsxs(Kn,{ref:t,isDisabled:r,isInvalid:s,...h,children:[n&&a.jsx(Rr,{...g,children:n}),a.jsxs(Sg,{value:j,min:u,max:p,keepWithinRange:!0,clampValueOnBlur:!1,onChange:P,onBlur:I,...C,onPaste:A2,children:[a.jsx(jg,{...x,onKeyDown:M,onKeyUp:O}),o&&a.jsxs(kg,{children:[a.jsx(Ig,{...y}),a.jsx(_g,{...y})]})]})]})})});aR.displayName="IAINumberInput";const Vu=d.memo(aR),gie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),[s,i]=d.useState(String(n.value)),l=d.useMemo(()=>r.type==="integer",[r.type]),u=p=>{i(p),p.match(Xh)||o($7({nodeId:t,fieldName:n.name,value:l?Math.floor(Number(p)):Number(p)}))};return d.useEffect(()=>{!s.match(Xh)&&n.value!==Number(s)&&i(String(n.value))},[n.value,s]),a.jsxs(Sg,{onChange:u,value:s,step:l?1:.1,precision:l?0:3,children:[a.jsx(jg,{className:"nodrag"}),a.jsxs(kg,{children:[a.jsx(Ig,{}),a.jsx(_g,{})]})]})},vie=d.memo(gie),xie=e=>{var h,g;const{nodeId:t,field:n}=e,r=te(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i,isLoading:l}=na(Tb),u=d.useMemo(()=>{if(!i)return[];const x=[];return qr(i.entities,(y,b)=>{y&&x.push({value:b,label:y.model_name,group:gr[y.base_model]})}),x},[i]),p=d.useMemo(()=>{var x,y;return(i==null?void 0:i.entities[`${(x=n.value)==null?void 0:x.base_model}/main/${(y=n.value)==null?void 0:y.model_name}`])??null},[(h=n.value)==null?void 0:h.base_model,(g=n.value)==null?void 0:g.model_name,i==null?void 0:i.entities]),m=d.useCallback(x=>{if(!x)return;const y=g0(x);y&&r(L7({nodeId:t,fieldName:n.name,value:y}))},[r,n.name,t]);return l?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{className:"nowheel nodrag",tooltip:p==null?void 0:p.description,value:p==null?void 0:p.id,placeholder:u.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:u,error:!p,disabled:u.length===0,onChange:m,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Wu,{className:"nodrag",iconMode:!0})]})},bie=d.memo(xie),yie=e=>{var g,x;const{nodeId:t,field:n}=e,r=te(),{t:o}=J(),s=jn("syncModels").isFeatureEnabled,{data:i}=Bd(Hw),{data:l,isLoading:u}=na(Hw),p=d.useMemo(()=>{if(!l)return[];const y=[];return qr(l.entities,(b,C)=>{!b||b.base_model!=="sdxl"||y.push({value:C,label:b.model_name,group:gr[b.base_model]})}),i&&qr(i.entities,(b,C)=>{!b||b.base_model!=="sdxl"||y.push({value:C,label:b.model_name,group:gr[b.base_model]})}),y},[l,i]),m=d.useMemo(()=>{var y,b,C,S;return((l==null?void 0:l.entities[`${(y=n.value)==null?void 0:y.base_model}/main/${(b=n.value)==null?void 0:b.model_name}`])||(i==null?void 0:i.entities[`${(C=n.value)==null?void 0:C.base_model}/onnx/${(S=n.value)==null?void 0:S.model_name}`]))??null},[(g=n.value)==null?void 0:g.base_model,(x=n.value)==null?void 0:x.model_name,l==null?void 0:l.entities,i==null?void 0:i.entities]),h=d.useCallback(y=>{if(!y)return;const b=g0(y);b&&r(tP({nodeId:t,fieldName:n.name,value:b}))},[r,n.name,t]);return u?a.jsx(tr,{label:o("modelManager.model"),placeholder:o("models.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{className:"nowheel nodrag",tooltip:m==null?void 0:m.description,value:m==null?void 0:m.id,placeholder:p.length>0?o("models.selectModel"):o("models.noModelsAvailable"),data:p,error:!m,disabled:p.length===0,onChange:h,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}}),s&&a.jsx(Wu,{className:"nodrag",iconMode:!0})]})},Cie=d.memo(yie),wie=ce([we],({ui:e})=>{const{favoriteSchedulers:t}=e;return{data:Ro(tg,(r,o)=>({value:o,label:r,group:t.includes(o)?"Favorites":void 0})).sort((r,o)=>r.label.localeCompare(o.label))}},je),Sie=e=>{const{nodeId:t,field:n}=e,r=te(),{data:o}=W(wie),s=d.useCallback(i=>{i&&r(z7({nodeId:t,fieldName:n.name,value:i}))},[r,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",value:n.value,data:o,onChange:s})},kie=d.memo(Sie),jie=e=>{const{nodeId:t,field:n,fieldTemplate:r}=e,o=te(),s=d.useCallback(i=>{o(F7({nodeId:t,fieldName:n.name,value:i.target.value}))},[o,n.name,t]);return r.ui_component==="textarea"?a.jsx(gi,{className:"nodrag",onChange:s,value:n.value,rows:5,resize:"none"}):a.jsx(Cs,{onChange:s,value:n.value})},_ie=d.memo(jie),iR=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=B7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({vaeModelId:e,errors:s.error.format()},"Failed to parse VAE model id");return}return s.data},Iie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=nP(),i=d.useMemo(()=>{if(!s)return[];const p=[{value:"default",label:"Default",group:"Default"}];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p.sort((m,h)=>m.disabled&&!h.disabled?1:-1)},[s]),l=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[s==null?void 0:s.entities,r]),u=d.useCallback(p=>{if(!p)return;const m=iR(p);m&&o(H7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",itemComponent:fl,tooltip:l==null?void 0:l.description,value:(l==null?void 0:l.id)??"default",placeholder:"Default",data:i,onChange:u,disabled:i.length===0,error:!l,clearable:!0,sx:{width:"100%",".mantine-Select-dropdown":{width:"16rem !important"}}})},Pie=d.memo(Iie),Eie=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=W7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({ipAdapterModelId:e,errors:s.error.format()},"Failed to parse IP-Adapter model id");return}return s.data},Mie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=Sb(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/ip_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=Eie(p);m&&o(V7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Tr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Oie=d.memo(Mie),Rie=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=U7.safeParse({base_model:n,model_name:o});if(!s.success){t.error({t2iAdapterModelId:e,errors:s.error.format()},"Failed to parse T2I-Adapter model id");return}return s.data},Aie=e=>{const{nodeId:t,field:n}=e,r=n.value,o=te(),{data:s}=wb(),i=d.useMemo(()=>(s==null?void 0:s.entities[`${r==null?void 0:r.base_model}/t2i_adapter/${r==null?void 0:r.model_name}`])??null,[r==null?void 0:r.base_model,r==null?void 0:r.model_name,s==null?void 0:s.entities]),l=d.useMemo(()=>{if(!s)return[];const p=[];return qr(s.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[s]),u=d.useCallback(p=>{if(!p)return;const m=Rie(p);m&&o(G7({nodeId:t,fieldName:n.name,value:m}))},[o,n.name,t]);return a.jsx(Tr,{className:"nowheel nodrag",tooltip:i==null?void 0:i.description,value:(i==null?void 0:i.id)??null,placeholder:"Pick one",error:!i,data:l,onChange:u,sx:{width:"100%"}})},Die=d.memo(Aie),Tie=e=>{var l;const{nodeId:t,field:n}=e,r=te(),{data:o,hasBoards:s}=hf(void 0,{selectFromResult:({data:u})=>{const p=[{label:"None",value:"none"}];return u==null||u.forEach(({board_id:m,board_name:h})=>{p.push({label:h,value:m})}),{data:p,hasBoards:p.length>1}}}),i=d.useCallback(u=>{r(q7({nodeId:t,fieldName:n.name,value:u&&u!=="none"?{board_id:u}:void 0}))},[r,n.name,t]);return a.jsx(tr,{className:"nowheel nodrag",value:((l=n.value)==null?void 0:l.board_id)??"none",data:o,onChange:i,disabled:!s})},Nie=d.memo(Tie),$ie=({nodeId:e,fieldName:t})=>{const n=X8(e,t),r=p0(e,t,"input");return(r==null?void 0:r.fieldKind)==="output"?a.jsxs(De,{p:2,children:["Output field in input: ",n==null?void 0:n.type]}):(n==null?void 0:n.type)==="string"&&(r==null?void 0:r.type)==="string"||(n==null?void 0:n.type)==="StringPolymorphic"&&(r==null?void 0:r.type)==="StringPolymorphic"?a.jsx(_ie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="boolean"&&(r==null?void 0:r.type)==="boolean"||(n==null?void 0:n.type)==="BooleanPolymorphic"&&(r==null?void 0:r.type)==="BooleanPolymorphic"?a.jsx(Uae,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="integer"&&(r==null?void 0:r.type)==="integer"||(n==null?void 0:n.type)==="float"&&(r==null?void 0:r.type)==="float"||(n==null?void 0:n.type)==="FloatPolymorphic"&&(r==null?void 0:r.type)==="FloatPolymorphic"||(n==null?void 0:n.type)==="IntegerPolymorphic"&&(r==null?void 0:r.type)==="IntegerPolymorphic"?a.jsx(vie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="enum"&&(r==null?void 0:r.type)==="enum"?a.jsx(lie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ImageField"&&(r==null?void 0:r.type)==="ImageField"||(n==null?void 0:n.type)==="ImagePolymorphic"&&(r==null?void 0:r.type)==="ImagePolymorphic"?a.jsx(uie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="BoardField"&&(r==null?void 0:r.type)==="BoardField"?a.jsx(Nie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="MainModelField"&&(r==null?void 0:r.type)==="MainModelField"?a.jsx(hie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLRefinerModelField"&&(r==null?void 0:r.type)==="SDXLRefinerModelField"?a.jsx(bie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="VaeModelField"&&(r==null?void 0:r.type)==="VaeModelField"?a.jsx(Pie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="LoRAModelField"&&(r==null?void 0:r.type)==="LoRAModelField"?a.jsx(pie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ControlNetModelField"&&(r==null?void 0:r.type)==="ControlNetModelField"?a.jsx(aie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="IPAdapterModelField"&&(r==null?void 0:r.type)==="IPAdapterModelField"?a.jsx(Oie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="T2IAdapterModelField"&&(r==null?void 0:r.type)==="T2IAdapterModelField"?a.jsx(Die,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="ColorField"&&(r==null?void 0:r.type)==="ColorField"?a.jsx(oie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="SDXLMainModelField"&&(r==null?void 0:r.type)==="SDXLMainModelField"?a.jsx(Cie,{nodeId:e,field:n,fieldTemplate:r}):(n==null?void 0:n.type)==="Scheduler"&&(r==null?void 0:r.type)==="Scheduler"?a.jsx(kie,{nodeId:e,field:n,fieldTemplate:r}):n&&r?null:a.jsx(De,{p:1,children:a.jsxs(Se,{sx:{fontSize:"sm",fontWeight:600,color:"error.400",_dark:{color:"error.300"}},children:["Unknown field type: ",n==null?void 0:n.type]})})},lR=d.memo($ie),Lie=({nodeId:e,fieldName:t})=>{const n=te(),{isMouseOverNode:r,handleMouseOut:o,handleMouseOver:s}=q8(e),{t:i}=J(),l=d.useCallback(()=>{n(rP({nodeId:e,fieldName:t}))},[n,t,e]);return a.jsxs($,{onMouseEnter:s,onMouseLeave:o,layerStyle:"second",sx:{position:"relative",borderRadius:"base",w:"full",p:2},children:[a.jsxs(Kn,{as:$,sx:{flexDir:"column",gap:1,flexShrink:1},children:[a.jsxs(Rr,{sx:{display:"flex",alignItems:"center",mb:0},children:[a.jsx(Y8,{nodeId:e,fieldName:t,kind:"input"}),a.jsx(ki,{}),a.jsx(Fn,{label:a.jsx(D2,{nodeId:e,fieldName:t,kind:"input"}),openDelay:ag,placement:"top",hasArrow:!0,children:a.jsx($,{h:"full",alignItems:"center",children:a.jsx(Lr,{as:UM})})}),a.jsx(ot,{"aria-label":i("nodes.removeLinearView"),tooltip:i("nodes.removeLinearView"),variant:"ghost",size:"sm",onClick:l,icon:a.jsx(qo,{})})]}),a.jsx(lR,{nodeId:e,fieldName:t})]}),a.jsx(G8,{isSelected:!1,isHovered:r})]})},zie=d.memo(Lie),Fie=ce(we,({nodes:e})=>({fields:e.workflow.exposedFields}),je),Bie=()=>{const{fields:e}=W(Fie),{t}=J();return a.jsx(De,{sx:{position:"relative",w:"full",h:"full"},children:a.jsx(Hu,{children:a.jsx($,{sx:{position:"relative",flexDir:"column",alignItems:"flex-start",p:1,gap:2,h:"full",w:"full"},children:e.length?e.map(({nodeId:n,fieldName:r})=>a.jsx(zie,{nodeId:n,fieldName:r},`${n}.${r}`)):a.jsx(eo,{label:t("nodes.noFieldsLinearview"),icon:null})})})})},Hie=d.memo(Bie),Wie=()=>a.jsx($,{layerStyle:"first",sx:{flexDir:"column",w:"full",h:"full",borderRadius:"base",p:2,gap:2},children:a.jsxs(nc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(rc,{children:[a.jsx(Po,{children:"Linear"}),a.jsx(Po,{children:"Details"}),a.jsx(Po,{children:"JSON"})]}),a.jsxs(Tu,{children:[a.jsx(ss,{children:a.jsx(Hie,{})}),a.jsx(ss,{children:a.jsx(Lae,{})}),a.jsx(ss,{children:a.jsx(Fae,{})})]})]})}),Vie=d.memo(Wie),Uie={paramNegativeConditioning:{placement:"right"},controlNet:{href:"https://support.invoke.ai/support/solutions/articles/151000105880"},lora:{href:"https://support.invoke.ai/support/solutions/articles/151000159072"},compositingCoherenceMode:{href:"https://support.invoke.ai/support/solutions/articles/151000158838"},infillMethod:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},scaleBeforeProcessing:{href:"https://support.invoke.ai/support/solutions/articles/151000158841"},paramIterations:{href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramPositiveConditioning:{href:"https://support.invoke.ai/support/solutions/articles/151000096606-tips-on-crafting-prompts",placement:"right"},paramScheduler:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000159073"},paramModel:{placement:"right",href:"https://support.invoke.ai/support/solutions/articles/151000096601-what-is-a-model-which-should-i-use-"},paramRatio:{gutter:16},controlNetControlMode:{placement:"right"},controlNetResizeMode:{placement:"right"},paramVAE:{placement:"right"},paramVAEPrecision:{placement:"right"}},Gie=1e3,qie=[{name:"preventOverflow",options:{padding:10}}],cR=Oe(({feature:e,children:t,wrapperProps:n,...r},o)=>{const{t:s}=J(),i=W(g=>g.system.shouldEnableInformationalPopovers),l=d.useMemo(()=>Uie[e],[e]),u=d.useMemo(()=>K7(Q7(l,["image","href","buttonLabel"]),r),[l,r]),p=d.useMemo(()=>s(`popovers.${e}.heading`),[e,s]),m=d.useMemo(()=>s(`popovers.${e}.paragraphs`,{returnObjects:!0})??[],[e,s]),h=d.useCallback(()=>{l!=null&&l.href&&window.open(l.href)},[l==null?void 0:l.href]);return i?a.jsxs(Af,{isLazy:!0,closeOnBlur:!1,trigger:"hover",variant:"informational",openDelay:Gie,modifiers:qie,placement:"top",...u,children:[a.jsx(Eg,{children:a.jsx(De,{ref:o,w:"full",...n,children:t})}),a.jsx(Eu,{children:a.jsxs(Df,{w:96,children:[a.jsx(b5,{}),a.jsx(Mg,{children:a.jsxs($,{sx:{gap:2,flexDirection:"column",alignItems:"flex-start"},children:[p&&a.jsxs(a.Fragment,{children:[a.jsx(xo,{size:"sm",children:p}),a.jsx(no,{})]}),(l==null?void 0:l.image)&&a.jsxs(a.Fragment,{children:[a.jsx(wi,{sx:{objectFit:"contain",maxW:"60%",maxH:"60%",backgroundColor:"white"},src:l.image,alt:"Optional Image"}),a.jsx(no,{})]}),m.map(g=>a.jsx(Se,{children:g},g)),(l==null?void 0:l.href)&&a.jsxs(a.Fragment,{children:[a.jsx(no,{}),a.jsx(el,{pt:1,onClick:h,leftIcon:a.jsx(Vy,{}),alignSelf:"flex-end",variant:"link",children:s("common.learnMore")??p})]})]})})]})})]}):a.jsx(De,{ref:o,w:"full",...n,children:t})});cR.displayName="IAIInformationalPopover";const wn=d.memo(cR),Kie=ce([we],e=>{const{initial:t,min:n,sliderMax:r,inputMax:o,fineStep:s,coarseStep:i}=e.config.sd.iterations,{iterations:l}=e.generation,{shouldUseSliders:u}=e.ui,p=e.hotkeys.shift?s:i;return{iterations:l,initial:t,min:n,sliderMax:r,inputMax:o,step:p,shouldUseSliders:u}},je),Qie=({asSlider:e})=>{const{iterations:t,initial:n,min:r,sliderMax:o,inputMax:s,step:i,shouldUseSliders:l}=W(Kie),u=te(),{t:p}=J(),m=d.useCallback(g=>{u(Ww(g))},[u]),h=d.useCallback(()=>{u(Ww(n))},[u,n]);return e||l?a.jsx(wn,{feature:"paramIterations",children:a.jsx(jt,{label:p("parameters.iterations"),step:i,min:r,max:o,onChange:m,handleReset:h,value:t,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s}})}):a.jsx(wn,{feature:"paramIterations",children:a.jsx(Vu,{label:p("parameters.iterations"),step:i,min:r,max:s,onChange:m,value:t,numberInputFieldProps:{textAlign:"center"}})})},ua=d.memo(Qie),Xie=()=>{const[e,t]=d.useState(!1),[n,r]=d.useState(!1),o=d.useRef(null),s=R2(),i=d.useCallback(()=>{o.current&&o.current.setLayout([50,50])},[]);return a.jsxs($,{sx:{flexDir:"column",gap:2,height:"100%",width:"100%"},children:[a.jsx(O8,{}),a.jsx($,{layerStyle:"first",sx:{w:"full",position:"relative",borderRadius:"base",p:2,pb:3,gap:2,flexDir:"column"},children:a.jsx(ua,{asSlider:!0})}),a.jsxs(f0,{ref:o,id:"workflow-panel-group",autoSaveId:"workflow-panel-group",direction:"vertical",style:{height:"100%",width:"100%"},storage:s,children:[a.jsx(Ji,{id:"workflow",collapsible:!0,onCollapse:t,minSize:25,children:a.jsx(Vie,{})}),a.jsx(Qh,{direction:"vertical",onDoubleClick:i,collapsedDirection:e?"top":n?"bottom":void 0}),a.jsx(Ji,{id:"inspector",collapsible:!0,onCollapse:r,minSize:25,children:a.jsx(Rae,{})})]})]})},Yie=d.memo(Xie),w_=(e,t)=>{const n=d.useRef(null),[r,o]=d.useState(()=>{var p;return!!((p=n.current)!=null&&p.getCollapsed())}),s=d.useCallback(()=>{var p;(p=n.current)!=null&&p.getCollapsed()?rs.flushSync(()=>{var m;(m=n.current)==null||m.expand()}):rs.flushSync(()=>{var m;(m=n.current)==null||m.collapse()})},[]),i=d.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.expand()})},[]),l=d.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.collapse()})},[]),u=d.useCallback(()=>{rs.flushSync(()=>{var p;(p=n.current)==null||p.resize(e,t)})},[e,t]);return{ref:n,minSize:e,isCollapsed:r,setIsCollapsed:o,reset:u,toggle:s,expand:i,collapse:l}},Jie=({isGalleryCollapsed:e,galleryPanelRef:t})=>{const{t:n}=J(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Eu,{children:a.jsx($,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineEnd:"1.63rem",children:a.jsx(ot,{tooltip:"Show Gallery (G)",tooltipProps:{placement:"top"},"aria-label":n("accessibility.showGalleryPanel"),onClick:r,icon:a.jsx(Yoe,{}),sx:{p:0,px:3,h:48,borderEndRadius:0}})})}):null},Zie=d.memo(Jie),mm={borderStartRadius:0,flexGrow:1},ele=({isSidePanelCollapsed:e,sidePanelRef:t})=>{const{t:n}=J(),r=()=>{var o;(o=t.current)==null||o.expand()};return e?a.jsx(Eu,{children:a.jsxs($,{pos:"absolute",transform:"translate(0, -50%)",minW:8,top:"50%",insetInlineStart:"5.13rem",direction:"column",gap:2,h:48,children:[a.jsxs(zn,{isAttached:!0,orientation:"vertical",flexGrow:3,children:[a.jsx(ot,{tooltip:n("parameters.showOptionsPanel"),"aria-label":n("parameters.showOptionsPanel"),onClick:r,sx:mm,icon:a.jsx(YM,{})}),a.jsx(P8,{asIconButton:!0,sx:mm}),a.jsx(S8,{asIconButton:!0,sx:mm})]}),a.jsx(I2,{asIconButton:!0,sx:mm})]})}):null},tle=d.memo(ele),nle=e=>{const{label:t,activeLabel:n,children:r,defaultIsOpen:o=!1}=e,{isOpen:s,onToggle:i}=Uo({defaultIsOpen:o}),{colorMode:l}=Ci();return a.jsxs(De,{children:[a.jsxs($,{onClick:i,sx:{alignItems:"center",p:2,px:4,gap:2,borderTopRadius:"base",borderBottomRadius:s?0:"base",bg:Ke("base.250","base.750")(l),color:Ke("base.900","base.100")(l),_hover:{bg:Ke("base.300","base.700")(l)},fontSize:"sm",fontWeight:600,cursor:"pointer",transitionProperty:"common",transitionDuration:"normal",userSelect:"none"},"data-testid":`${t} collapsible`,children:[t,a.jsx(yo,{children:n&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},children:a.jsx(Se,{sx:{color:"accent.500",_dark:{color:"accent.300"}},children:n})},"statusText")}),a.jsx(ki,{}),a.jsx(t0,{sx:{w:"1rem",h:"1rem",transform:s?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})]}),a.jsx(wf,{in:s,animateOpacity:!0,style:{overflow:"unset"},children:a.jsx(De,{sx:{p:4,pb:4,borderBottomRadius:"base",bg:"base.150",_dark:{bg:"base.800"}},children:r})})]})},Ao=d.memo(nle),rle=ce(we,e=>{const{maxPrompts:t,combinatorial:n}=e.dynamicPrompts,{min:r,sliderMax:o,inputMax:s}=e.config.sd.dynamicPrompts.maxPrompts;return{maxPrompts:t,min:r,sliderMax:o,inputMax:s,isDisabled:!n}},je),ole=()=>{const{maxPrompts:e,min:t,sliderMax:n,inputMax:r,isDisabled:o}=W(rle),s=te(),{t:i}=J(),l=d.useCallback(p=>{s(X7(p))},[s]),u=d.useCallback(()=>{s(Y7())},[s]);return a.jsx(wn,{feature:"dynamicPromptsMaxPrompts",children:a.jsx(jt,{label:i("dynamicPrompts.maxPrompts"),isDisabled:o,min:t,max:n,value:e,onChange:l,sliderNumberInputProps:{max:r},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})})},sle=d.memo(ole),ale=ce(we,e=>{const{isLoading:t,isError:n,prompts:r,parsingError:o}=e.dynamicPrompts;return{prompts:r,parsingError:o,isError:n,isLoading:t}},je),ile={"&::marker":{color:"base.500",_dark:{color:"base.500"}}},lle=()=>{const{prompts:e,parsingError:t,isLoading:n,isError:r}=W(ale);return r?a.jsx(wn,{feature:"dynamicPrompts",children:a.jsx($,{w:"full",h:"full",layerStyle:"second",alignItems:"center",justifyContent:"center",p:8,children:a.jsx(eo,{icon:Uoe,label:"Problem generating prompts"})})}):a.jsx(wn,{feature:"dynamicPrompts",children:a.jsxs(Kn,{isInvalid:!!t,children:[a.jsxs(Rr,{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",children:["Prompts Preview (",e.length,")",t&&` - ${t}`]}),a.jsxs($,{h:64,pos:"relative",layerStyle:"third",borderRadius:"base",p:2,children:[a.jsx(Hu,{children:a.jsx(B3,{stylePosition:"inside",ms:0,children:e.map((o,s)=>a.jsx(ws,{fontSize:"sm",sx:ile,children:a.jsx(Se,{as:"span",children:o})},`${o}.${s}`))})}),n&&a.jsx($,{pos:"absolute",w:"full",h:"full",top:0,insetInlineStart:0,layerStyle:"second",opacity:.7,alignItems:"center",justifyContent:"center",children:a.jsx(vi,{})})]})]})})},cle=d.memo(lle),uR=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx(De,{ref:r,...n,children:a.jsxs(De,{children:[a.jsx(Se,{fontWeight:600,children:e}),t&&a.jsx(Se,{size:"xs",variant:"subtext",children:t})]})}));uR.displayName="IAIMantineSelectItemWithDescription";const ule=d.memo(uR),dle=()=>{const e=te(),{t}=J(),n=W(s=>s.dynamicPrompts.seedBehaviour),r=d.useMemo(()=>[{value:"PER_ITERATION",label:t("dynamicPrompts.seedBehaviour.perIterationLabel"),description:t("dynamicPrompts.seedBehaviour.perIterationDesc")},{value:"PER_PROMPT",label:t("dynamicPrompts.seedBehaviour.perPromptLabel"),description:t("dynamicPrompts.seedBehaviour.perPromptDesc")}],[t]),o=d.useCallback(s=>{s&&e(J7(s))},[e]);return a.jsx(wn,{feature:"dynamicPromptsSeedBehaviour",children:a.jsx(Tr,{label:t("dynamicPrompts.seedBehaviour.label"),value:n,data:r,itemComponent:ule,onChange:o})})},fle=d.memo(dle),ple=()=>{const{t:e}=J(),t=d.useMemo(()=>ce(we,({dynamicPrompts:o})=>{const s=o.prompts.length;if(s>1)return e("dynamicPrompts.promptsWithCount_other",{count:s})}),[e]),n=W(t);return jn("dynamicPrompting").isFeatureEnabled?a.jsx(Ao,{label:e("dynamicPrompts.dynamicPrompts"),activeLabel:n,children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(cle,{}),a.jsx(fle,{}),a.jsx(sle,{})]})}):null},Uu=d.memo(ple),mle=e=>{const t=te(),{lora:n}=e,r=d.useCallback(i=>{t(Z7({id:n.id,weight:i}))},[t,n.id]),o=d.useCallback(()=>{t(eT(n.id))},[t,n.id]),s=d.useCallback(()=>{t(tT(n.id))},[t,n.id]);return a.jsx(wn,{feature:"lora",children:a.jsxs($,{sx:{gap:2.5,alignItems:"flex-end"},children:[a.jsx(jt,{label:n.model_name,value:n.weight,onChange:r,min:-1,max:2,step:.01,withInput:!0,withReset:!0,handleReset:o,withSliderMarks:!0,sliderMarks:[-1,0,1,2],sliderNumberInputProps:{min:-50,max:50}}),a.jsx(ot,{size:"sm",onClick:s,tooltip:"Remove LoRA","aria-label":"Remove LoRA",icon:a.jsx(qo,{}),colorScheme:"error"})]})})},hle=d.memo(mle),gle=ce(we,({lora:e})=>({lorasArray:Ro(e.loras)}),je),vle=()=>{const{lorasArray:e}=W(gle);return a.jsx(a.Fragment,{children:e.map((t,n)=>a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[n>0&&a.jsx(no,{pt:1}),a.jsx(hle,{lora:t})]},t.model_name))})},xle=d.memo(vle),ble=ce(we,({lora:e})=>({loras:e.loras}),je),yle=()=>{const e=te(),{loras:t}=W(ble),{data:n}=gf(),{t:r}=J(),o=W(l=>l.generation.model),s=d.useMemo(()=>{if(!n)return[];const l=[];return qr(n.entities,(u,p)=>{if(!u||p in t)return;const m=(o==null?void 0:o.base_model)!==u.base_model;l.push({value:p,label:u.model_name,disabled:m,group:gr[u.base_model],tooltip:m?`Incompatible base model: ${u.base_model}`:void 0})}),l.sort((u,p)=>u.label&&!p.label?1:-1),l.sort((u,p)=>u.disabled&&!p.disabled?1:-1)},[t,n,o==null?void 0:o.base_model]),i=d.useCallback(l=>{if(!l)return;const u=n==null?void 0:n.entities[l];u&&e(nT(u))},[e,n==null?void 0:n.entities]);return(n==null?void 0:n.ids.length)===0?a.jsx($,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:r("models.noLoRAsInstalled")})}):a.jsx(tr,{placeholder:s.length===0?"All LoRAs added":"Add LoRA",value:null,data:s,nothingFound:"No matching LoRAs",itemComponent:fl,disabled:s.length===0,filter:(l,u)=>{var p;return((p=u.label)==null?void 0:p.toLowerCase().includes(l.toLowerCase().trim()))||u.value.toLowerCase().includes(l.toLowerCase().trim())},onChange:i,"data-testid":"add-lora"})},Cle=d.memo(yle),wle=ce(we,e=>{const t=oP(e.lora.loras);return{activeLabel:t>0?`${t} Active`:void 0}},je),Sle=()=>{const{t:e}=J(),{activeLabel:t}=W(wle);return jn("lora").isFeatureEnabled?a.jsx(Ao,{label:e("modelManager.loraModels"),activeLabel:t,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(Cle,{}),a.jsx(xle,{})]})}):null},Gu=d.memo(Sle),kle=()=>{const e=te(),t=W(o=>o.generation.shouldUseCpuNoise),{t:n}=J(),r=d.useCallback(o=>{e(rT(o.target.checked))},[e]);return a.jsx(wn,{feature:"noiseUseCPU",children:a.jsx(kr,{label:n("parameters.useCpuNoise"),isChecked:t,onChange:r})})},da=e=>e.generation,jle=ce(da,e=>{const{seamlessXAxis:t}=e;return{seamlessXAxis:t}},je),_le=()=>{const{t:e}=J(),{seamlessXAxis:t}=W(jle),n=te(),r=d.useCallback(o=>{n(oT(o.target.checked))},[n]);return a.jsx(kr,{label:e("parameters.seamlessXAxis"),"aria-label":e("parameters.seamlessXAxis"),isChecked:t,onChange:r})},Ile=d.memo(_le),Ple=ce(da,e=>{const{seamlessYAxis:t}=e;return{seamlessYAxis:t}},je),Ele=()=>{const{t:e}=J(),{seamlessYAxis:t}=W(Ple),n=te(),r=d.useCallback(o=>{n(sT(o.target.checked))},[n]);return a.jsx(kr,{label:e("parameters.seamlessYAxis"),"aria-label":e("parameters.seamlessYAxis"),isChecked:t,onChange:r})},Mle=d.memo(Ele),Ole=()=>{const{t:e}=J();return jn("seamless").isFeatureEnabled?a.jsxs(Kn,{children:[a.jsx(Rr,{children:e("parameters.seamlessTiling")})," ",a.jsxs($,{sx:{gap:5},children:[a.jsx(De,{flexGrow:1,children:a.jsx(Ile,{})}),a.jsx(De,{flexGrow:1,children:a.jsx(Mle,{})})]})]}):null},Rle=d.memo(Ole);function Ale(){const e=W(u=>u.generation.clipSkip),{model:t}=W(u=>u.generation),n=te(),{t:r}=J(),o=d.useCallback(u=>{n(Vw(u))},[n]),s=d.useCallback(()=>{n(Vw(0))},[n]),i=d.useMemo(()=>t?Ap[t.base_model].maxClip:Ap["sd-1"].maxClip,[t]),l=d.useMemo(()=>t?Ap[t.base_model].markers:Ap["sd-1"].markers,[t]);return(t==null?void 0:t.base_model)==="sdxl"?null:a.jsx(wn,{feature:"clipSkip",placement:"top",children:a.jsx(jt,{label:r("parameters.clipSkip"),"aria-label":r("parameters.clipSkip"),min:0,max:i,step:1,value:e,onChange:o,withSliderMarks:!0,sliderMarks:l,withInput:!0,withReset:!0,handleReset:s})})}const Dle=ce(we,e=>{const{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}=e.generation;return{clipSkip:t,model:n,seamlessXAxis:r,seamlessYAxis:o,shouldUseCpuNoise:s}},je);function qu(){const{clipSkip:e,model:t,seamlessXAxis:n,seamlessYAxis:r,shouldUseCpuNoise:o}=W(Dle),{t:s}=J(),i=d.useMemo(()=>{const l=[];return o||l.push(s("parameters.gpuNoise")),e>0&&t&&t.base_model!=="sdxl"&&l.push(s("parameters.clipSkipWithLayerCount",{layerCount:e})),n&&r?l.push(s("parameters.seamlessX&Y")):n?l.push(s("parameters.seamlessX")):r&&l.push(s("parameters.seamlessY")),l.join(", ")},[e,t,n,r,o,s]);return a.jsx(Ao,{label:s("common.advanced"),activeLabel:i,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(Rle,{}),a.jsx(no,{}),t&&(t==null?void 0:t.base_model)!=="sdxl"&&a.jsxs(a.Fragment,{children:[a.jsx(Ale,{}),a.jsx(no,{pt:2})]}),a.jsx(kle,{})]})})}const Ii=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return((o=Rs(r,e))==null?void 0:o.isEnabled)??!1},je),[e]);return W(t)},Tle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.model},je),[e]);return W(t)},dR=e=>{const{data:t}=Cb(),n=d.useMemo(()=>t?$I.getSelectors().selectAll(t):[],[t]),{data:r}=wb(),o=d.useMemo(()=>r?LI.getSelectors().selectAll(r):[],[r]),{data:s}=Sb(),i=d.useMemo(()=>s?zI.getSelectors().selectAll(s):[],[s]);return e==="controlnet"?n:e==="t2i_adapter"?o:e==="ip_adapter"?i:[]},fR=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.type},je),[e]);return W(t)},Nle=ce(we,({generation:e})=>{const{model:t}=e;return{mainModel:t}},je),$le=({id:e})=>{const t=Ii(e),n=fR(e),r=Tle(e),o=te(),{mainModel:s}=W(Nle),{t:i}=J(),l=dR(n),u=d.useMemo(()=>{if(!l)return[];const h=[];return l.forEach(g=>{if(!g)return;const x=(g==null?void 0:g.base_model)!==(s==null?void 0:s.base_model);h.push({value:g.id,label:g.model_name,group:gr[g.base_model],disabled:x,tooltip:x?`${i("controlnet.incompatibleBaseModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>g.disabled?1:x.disabled?-1:g.label.localeCompare(x.label)),h},[s==null?void 0:s.base_model,l,i]),p=d.useMemo(()=>l.find(h=>(h==null?void 0:h.id)===`${r==null?void 0:r.base_model}/${n}/${r==null?void 0:r.model_name}`),[n,r==null?void 0:r.base_model,r==null?void 0:r.model_name,l]),m=d.useCallback(h=>{if(!h)return;const g=rR(h);g&&o(aT({id:e,model:g}))},[o,e]);return a.jsx(tr,{itemComponent:fl,data:u,error:!p||(s==null?void 0:s.base_model)!==p.base_model,placeholder:i("controlnet.selectModel"),value:(p==null?void 0:p.id)??null,onChange:m,disabled:!t,tooltip:p==null?void 0:p.description})},Lle=d.memo($le),zle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.weight},je),[e]);return W(t)},Fle=({id:e})=>{const t=Ii(e),n=zle(e),r=te(),{t:o}=J(),s=d.useCallback(i=>{r(iT({id:e,weight:i}))},[r,e]);return Wd(n)?null:a.jsx(wn,{feature:"controlNetWeight",children:a.jsx(jt,{isDisabled:!t,label:o("controlnet.weight"),value:n,onChange:s,min:0,max:2,step:.01,withSliderMarks:!0,sliderMarks:[0,1,2]})})},Ble=d.memo(Fle),Hle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{var o;return(o=Rs(r,e))==null?void 0:o.controlImage},je),[e]);return W(t)},Wle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Mu(o)?o.processedControlImage:void 0},je),[e]);return W(t)},Vle=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Mu(o)?o.processorType:void 0},je),[e]);return W(t)},Ule=ce(we,({controlAdapters:e,gallery:t})=>{const{pendingControlImages:n}=e,{autoAddBoardId:r}=t;return{pendingControlImages:n,autoAddBoardId:r}},je),Gle=({isSmall:e,id:t})=>{const n=Hle(t),r=Wle(t),o=Vle(t),s=te(),{t:i}=J(),{pendingControlImages:l,autoAddBoardId:u}=W(Ule),p=W(ro),[m,h]=d.useState(!1),{currentData:g}=Ps(n??Os.skipToken),{currentData:x}=Ps(r??Os.skipToken),[y]=lT(),[b]=cT(),[C]=uT(),S=d.useCallback(()=>{s(dT({id:t,controlImage:null}))},[t,s]),j=d.useCallback(async()=>{x&&(await y({imageDTO:x,is_intermediate:!1}).unwrap(),u!=="none"?b({imageDTO:x,board_id:u}):C({imageDTO:x}))},[x,y,u,b,C]),_=d.useCallback(()=>{g&&(p==="unifiedCanvas"?s(Xs({width:g.width,height:g.height})):(s(Bl(g.width)),s(Hl(g.height))))},[g,p,s]),P=d.useCallback(()=>{h(!0)},[]),I=d.useCallback(()=>{h(!1)},[]),M=d.useMemo(()=>{if(g)return{id:t,payloadType:"IMAGE_DTO",payload:{imageDTO:g}}},[g,t]),O=d.useMemo(()=>({id:t,actionType:"SET_CONTROL_ADAPTER_IMAGE",context:{id:t}}),[t]),A=d.useMemo(()=>({type:"SET_CONTROL_ADAPTER_IMAGE",id:t}),[t]),D=g&&x&&!m&&!l.includes(t)&&o!=="none";return a.jsxs($,{onMouseEnter:P,onMouseLeave:I,sx:{position:"relative",w:"full",h:e?28:366,alignItems:"center",justifyContent:"center"},children:[a.jsx(al,{draggableData:M,droppableData:O,imageDTO:g,isDropDisabled:D,postUploadAction:A}),a.jsx(De,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",opacity:D?1:0,transitionProperty:"common",transitionDuration:"normal",pointerEvents:"none"},children:a.jsx(al,{draggableData:M,droppableData:O,imageDTO:x,isUploadDisabled:!0})}),a.jsxs(a.Fragment,{children:[a.jsx(du,{onClick:S,icon:g?a.jsx(qg,{}):void 0,tooltip:i("controlnet.resetControlImage")}),a.jsx(du,{onClick:j,icon:g?a.jsx(Gg,{size:16}):void 0,tooltip:i("controlnet.saveControlImage"),styleOverrides:{marginTop:6}}),a.jsx(du,{onClick:_,icon:g?a.jsx(_ee,{size:16}):void 0,tooltip:i("controlnet.setControlImageDimensions"),styleOverrides:{marginTop:12}})]}),l.includes(t)&&a.jsx($,{sx:{position:"absolute",top:0,insetInlineStart:0,w:"full",h:"full",alignItems:"center",justifyContent:"center",opacity:.8,borderRadius:"base",bg:"base.400",_dark:{bg:"base.900"}},children:a.jsx(vi,{size:"xl",sx:{color:"base.100",_dark:{color:"base.400"}}})})]})},S_=d.memo(Gle),Ds=()=>{const e=te();return d.useCallback((n,r)=>{e(fT({id:n,params:r}))},[e])};function Ts(e){return a.jsx($,{sx:{flexDirection:"column",gap:2,pb:2},children:e.children})}const k_=Oo.canny_image_processor.default,qle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{low_threshold:o,high_threshold:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{low_threshold:g})},[t,i]),p=d.useCallback(()=>{i(t,{low_threshold:k_.low_threshold})},[t,i]),m=d.useCallback(g=>{i(t,{high_threshold:g})},[t,i]),h=d.useCallback(()=>{i(t,{high_threshold:k_.high_threshold})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{isDisabled:!r,label:l("controlnet.lowThreshold"),value:o,onChange:u,handleReset:p,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0}),a.jsx(jt,{isDisabled:!r,label:l("controlnet.highThreshold"),value:s,onChange:m,handleReset:h,withReset:!0,min:0,max:255,withInput:!0,withSliderMarks:!0})]})},Kle=d.memo(qle),Qle=Oo.color_map_image_processor.default,Xle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{color_map_tile_size:o}=n,s=Ds(),{t:i}=J(),l=d.useCallback(p=>{s(t,{color_map_tile_size:p})},[t,s]),u=d.useCallback(()=>{s(t,{color_map_tile_size:Qle.color_map_tile_size})},[t,s]);return a.jsx(Ts,{children:a.jsx(jt,{isDisabled:!r,label:i("controlnet.colorMapTileSize"),value:o,onChange:l,handleReset:u,withReset:!0,min:1,max:256,step:1,withInput:!0,withSliderMarks:!0,sliderNumberInputProps:{max:4096}})})},Yle=d.memo(Xle),yd=Oo.content_shuffle_image_processor.default,Jle=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,w:i,h:l,f:u}=n,p=Ds(),{t:m}=J(),h=d.useCallback(I=>{p(t,{detect_resolution:I})},[t,p]),g=d.useCallback(()=>{p(t,{detect_resolution:yd.detect_resolution})},[t,p]),x=d.useCallback(I=>{p(t,{image_resolution:I})},[t,p]),y=d.useCallback(()=>{p(t,{image_resolution:yd.image_resolution})},[t,p]),b=d.useCallback(I=>{p(t,{w:I})},[t,p]),C=d.useCallback(()=>{p(t,{w:yd.w})},[t,p]),S=d.useCallback(I=>{p(t,{h:I})},[t,p]),j=d.useCallback(()=>{p(t,{h:yd.h})},[t,p]),_=d.useCallback(I=>{p(t,{f:I})},[t,p]),P=d.useCallback(()=>{p(t,{f:yd.f})},[t,p]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:m("controlnet.detectResolution"),value:s,onChange:h,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.imageResolution"),value:o,onChange:x,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.w"),value:i,onChange:b,handleReset:C,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.h"),value:l,onChange:S,handleReset:j,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:m("controlnet.f"),value:u,onChange:_,handleReset:P,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},Zle=d.memo(Jle),j_=Oo.hed_image_processor.default,ece=e=>{const{controlNetId:t,processorNode:{detect_resolution:n,image_resolution:r,scribble:o},isEnabled:s}=e,i=Ds(),{t:l}=J(),u=d.useCallback(x=>{i(t,{detect_resolution:x})},[t,i]),p=d.useCallback(x=>{i(t,{image_resolution:x})},[t,i]),m=d.useCallback(x=>{i(t,{scribble:x.target.checked})},[t,i]),h=d.useCallback(()=>{i(t,{detect_resolution:j_.detect_resolution})},[t,i]),g=d.useCallback(()=>{i(t,{image_resolution:j_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.detectResolution"),value:n,onChange:u,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(jt,{label:l("controlnet.imageResolution"),value:r,onChange:p,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!s}),a.jsx(kr,{label:l("controlnet.scribble"),isChecked:o,onChange:m,isDisabled:!s})]})},tce=d.memo(ece),__=Oo.lineart_anime_image_processor.default,nce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:__.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:__.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},rce=d.memo(nce),I_=Oo.lineart_image_processor.default,oce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,coarse:i}=n,l=Ds(),{t:u}=J(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:I_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:I_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{coarse:y.target.checked})},[t,l]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(kr,{label:u("controlnet.coarse"),isChecked:i,onChange:x,isDisabled:!r})]})},sce=d.memo(oce),P_=Oo.mediapipe_face_processor.default,ace=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{max_faces:o,min_confidence:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{max_faces:g})},[t,i]),p=d.useCallback(g=>{i(t,{min_confidence:g})},[t,i]),m=d.useCallback(()=>{i(t,{max_faces:P_.max_faces})},[t,i]),h=d.useCallback(()=>{i(t,{min_confidence:P_.min_confidence})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.maxFaces"),value:o,onChange:u,handleReset:m,withReset:!0,min:1,max:20,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.minConfidence"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},ice=d.memo(ace),E_=Oo.midas_depth_image_processor.default,lce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{a_mult:o,bg_th:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{a_mult:g})},[t,i]),p=d.useCallback(g=>{i(t,{bg_th:g})},[t,i]),m=d.useCallback(()=>{i(t,{a_mult:E_.a_mult})},[t,i]),h=d.useCallback(()=>{i(t,{bg_th:E_.bg_th})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.amult"),value:o,onChange:u,handleReset:m,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.bgth"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:20,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},cce=d.memo(lce),hm=Oo.mlsd_image_processor.default,uce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,thr_d:i,thr_v:l}=n,u=Ds(),{t:p}=J(),m=d.useCallback(j=>{u(t,{detect_resolution:j})},[t,u]),h=d.useCallback(j=>{u(t,{image_resolution:j})},[t,u]),g=d.useCallback(j=>{u(t,{thr_d:j})},[t,u]),x=d.useCallback(j=>{u(t,{thr_v:j})},[t,u]),y=d.useCallback(()=>{u(t,{detect_resolution:hm.detect_resolution})},[t,u]),b=d.useCallback(()=>{u(t,{image_resolution:hm.image_resolution})},[t,u]),C=d.useCallback(()=>{u(t,{thr_d:hm.thr_d})},[t,u]),S=d.useCallback(()=>{u(t,{thr_v:hm.thr_v})},[t,u]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:y,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:b,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:p("controlnet.w"),value:i,onChange:g,handleReset:C,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:p("controlnet.h"),value:l,onChange:x,handleReset:S,withReset:!0,min:0,max:1,step:.01,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},dce=d.memo(uce),M_=Oo.normalbae_image_processor.default,fce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s}=n,i=Ds(),{t:l}=J(),u=d.useCallback(g=>{i(t,{detect_resolution:g})},[t,i]),p=d.useCallback(g=>{i(t,{image_resolution:g})},[t,i]),m=d.useCallback(()=>{i(t,{detect_resolution:M_.detect_resolution})},[t,i]),h=d.useCallback(()=>{i(t,{image_resolution:M_.image_resolution})},[t,i]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:l("controlnet.detectResolution"),value:s,onChange:u,handleReset:m,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:l("controlnet.imageResolution"),value:o,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r})]})},pce=d.memo(fce),O_=Oo.openpose_image_processor.default,mce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,hand_and_face:i}=n,l=Ds(),{t:u}=J(),p=d.useCallback(y=>{l(t,{detect_resolution:y})},[t,l]),m=d.useCallback(y=>{l(t,{image_resolution:y})},[t,l]),h=d.useCallback(()=>{l(t,{detect_resolution:O_.detect_resolution})},[t,l]),g=d.useCallback(()=>{l(t,{image_resolution:O_.image_resolution})},[t,l]),x=d.useCallback(y=>{l(t,{hand_and_face:y.target.checked})},[t,l]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:u("controlnet.detectResolution"),value:s,onChange:p,handleReset:h,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:u("controlnet.imageResolution"),value:o,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(kr,{label:u("controlnet.handAndFace"),isChecked:i,onChange:x,isDisabled:!r})]})},hce=d.memo(mce),R_=Oo.pidi_image_processor.default,gce=e=>{const{controlNetId:t,processorNode:n,isEnabled:r}=e,{image_resolution:o,detect_resolution:s,scribble:i,safe:l}=n,u=Ds(),{t:p}=J(),m=d.useCallback(C=>{u(t,{detect_resolution:C})},[t,u]),h=d.useCallback(C=>{u(t,{image_resolution:C})},[t,u]),g=d.useCallback(()=>{u(t,{detect_resolution:R_.detect_resolution})},[t,u]),x=d.useCallback(()=>{u(t,{image_resolution:R_.image_resolution})},[t,u]),y=d.useCallback(C=>{u(t,{scribble:C.target.checked})},[t,u]),b=d.useCallback(C=>{u(t,{safe:C.target.checked})},[t,u]);return a.jsxs(Ts,{children:[a.jsx(jt,{label:p("controlnet.detectResolution"),value:s,onChange:m,handleReset:g,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(jt,{label:p("controlnet.imageResolution"),value:o,onChange:h,handleReset:x,withReset:!0,min:0,max:4096,withInput:!0,withSliderMarks:!0,isDisabled:!r}),a.jsx(kr,{label:p("controlnet.scribble"),isChecked:i,onChange:y}),a.jsx(kr,{label:p("controlnet.safe"),isChecked:l,onChange:b,isDisabled:!r})]})},vce=d.memo(gce),xce=e=>null,bce=d.memo(xce),pR=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o&&Mu(o)?o.processorNode:void 0},je),[e]);return W(t)},yce=({id:e})=>{const t=Ii(e),n=pR(e);return n?n.type==="canny_image_processor"?a.jsx(Kle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="color_map_image_processor"?a.jsx(Yle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="hed_image_processor"?a.jsx(tce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_image_processor"?a.jsx(sce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="content_shuffle_image_processor"?a.jsx(Zle,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="lineart_anime_image_processor"?a.jsx(rce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mediapipe_face_processor"?a.jsx(ice,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="midas_depth_image_processor"?a.jsx(cce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="mlsd_image_processor"?a.jsx(dce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="normalbae_image_processor"?a.jsx(pce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="openpose_image_processor"?a.jsx(hce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="pidi_image_processor"?a.jsx(vce,{controlNetId:e,processorNode:n,isEnabled:t}):n.type==="zoe_depth_image_processor"?a.jsx(bce,{controlNetId:e,processorNode:n,isEnabled:t}):null:null},Cce=d.memo(yce),wce=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Mu(o))return o.shouldAutoConfig},je),[e]);return W(t)},Sce=({id:e})=>{const t=Ii(e),n=wce(e),r=te(),{t:o}=J(),s=d.useCallback(()=>{r(pT({id:e}))},[e,r]);return Wd(n)?null:a.jsx(kr,{label:o("controlnet.autoConfigure"),"aria-label":o("controlnet.autoConfigure"),isChecked:n,onChange:s,isDisabled:!t})},kce=d.memo(Sce),jce=e=>{const{id:t}=e,n=te(),{t:r}=J(),o=d.useCallback(()=>{n(mT({id:t}))},[t,n]),s=d.useCallback(()=>{n(hT({id:t}))},[t,n]);return a.jsxs($,{sx:{gap:2},children:[a.jsx(ot,{size:"sm",icon:a.jsx(Xl,{}),tooltip:r("controlnet.importImageFromCanvas"),"aria-label":r("controlnet.importImageFromCanvas"),onClick:o}),a.jsx(ot,{size:"sm",icon:a.jsx(KM,{}),tooltip:r("controlnet.importMaskFromCanvas"),"aria-label":r("controlnet.importMaskFromCanvas"),onClick:s})]})},_ce=d.memo(jce),Ice=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);return o?{beginStepPct:o.beginStepPct,endStepPct:o.endStepPct}:void 0},je),[e]);return W(t)},A_=e=>`${Math.round(e*100)}%`,Pce=({id:e})=>{const t=Ii(e),n=Ice(e),r=te(),{t:o}=J(),s=d.useCallback(i=>{r(gT({id:e,beginStepPct:i[0]})),r(vT({id:e,endStepPct:i[1]}))},[r,e]);return n?a.jsx(wn,{feature:"controlNetBeginEnd",children:a.jsxs(Kn,{isDisabled:!t,children:[a.jsx(Rr,{children:o("controlnet.beginEndStepPercent")}),a.jsx(cy,{w:"100%",gap:2,alignItems:"center",children:a.jsxs(T5,{"aria-label":["Begin Step %","End Step %!"],value:[n.beginStepPct,n.endStepPct],onChange:s,min:0,max:1,step:.01,minStepsBetweenThumbs:5,isDisabled:!t,children:[a.jsx(N5,{children:a.jsx($5,{})}),a.jsx(Fn,{label:A_(n.beginStepPct),placement:"top",hasArrow:!0,children:a.jsx(vx,{index:0})}),a.jsx(Fn,{label:A_(n.endStepPct),placement:"top",hasArrow:!0,children:a.jsx(vx,{index:1})}),a.jsx(km,{value:0,sx:{insetInlineStart:"0 !important",insetInlineEnd:"unset !important"},children:"0%"}),a.jsx(km,{value:.5,sx:{insetInlineStart:"50% !important",transform:"translateX(-50%)"},children:"50%"}),a.jsx(km,{value:1,sx:{insetInlineStart:"unset !important",insetInlineEnd:"0 !important"},children:"100%"})]})})]})}):null},Ece=d.memo(Pce),Mce=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&xT(o))return o.controlMode},je),[e]);return W(t)};function Oce({id:e}){const t=Ii(e),n=Mce(e),r=te(),{t:o}=J(),s=[{label:o("controlnet.balanced"),value:"balanced"},{label:o("controlnet.prompt"),value:"more_prompt"},{label:o("controlnet.control"),value:"more_control"},{label:o("controlnet.megaControl"),value:"unbalanced"}],i=d.useCallback(l=>{r(bT({id:e,controlMode:l}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetControlMode",children:a.jsx(Tr,{disabled:!t,label:o("controlnet.controlMode"),data:s,value:n,onChange:i})}):null}const Rce=e=>e.config,Ace=ce(Rce,e=>Ro(Oo,n=>({value:n.type,label:n.label})).sort((n,r)=>n.value==="none"?-1:r.value==="none"?1:n.label.localeCompare(r.label)).filter(n=>!e.sd.disabledControlNetProcessors.includes(n.value)),je),Dce=({id:e})=>{const t=Ii(e),n=pR(e),r=te(),o=W(Ace),{t:s}=J(),i=d.useCallback(l=>{r(yT({id:e,processorType:l}))},[e,r]);return n?a.jsx(tr,{label:s("controlnet.processor"),value:n.type??"canny_image_processor",data:o,onChange:i,disabled:!t}):null},Tce=d.memo(Dce),Nce=e=>{const t=d.useMemo(()=>ce(we,({controlAdapters:r})=>{const o=Rs(r,e);if(o&&Mu(o))return o.resizeMode},je),[e]);return W(t)};function $ce({id:e}){const t=Ii(e),n=Nce(e),r=te(),{t:o}=J(),s=[{label:o("controlnet.resize"),value:"just_resize"},{label:o("controlnet.crop"),value:"crop_resize"},{label:o("controlnet.fill"),value:"fill_resize"}],i=d.useCallback(l=>{r(CT({id:e,resizeMode:l}))},[e,r]);return n?a.jsx(wn,{feature:"controlNetResizeMode",children:a.jsx(Tr,{disabled:!t,label:o("controlnet.resizeMode"),data:s,value:n,onChange:i})}):null}const Lce=e=>{const{id:t,number:n}=e,r=fR(t),o=te(),{t:s}=J(),i=W(ro),l=Ii(t),[u,p]=Nee(!1),m=d.useCallback(()=>{o(wT({id:t}))},[t,o]),h=d.useCallback(()=>{o(ST(t))},[t,o]),g=d.useCallback(x=>{o(kT({id:t,isEnabled:x.target.checked}))},[t,o]);return r?a.jsxs($,{sx:{flexDir:"column",gap:3,p:2,borderRadius:"base",position:"relative",bg:"base.250",_dark:{bg:"base.750"}},children:[a.jsx($,{sx:{gap:2,alignItems:"center",justifyContent:"space-between"},children:a.jsx(kr,{label:s(`controlnet.${r}`,{number:n}),"aria-label":s("controlnet.toggleControlNet"),isChecked:l,onChange:g,formControlProps:{w:"full"},formLabelProps:{fontWeight:600}})}),a.jsxs($,{sx:{gap:2,alignItems:"center"},children:[a.jsx(De,{sx:{w:"full",minW:0,transitionProperty:"common",transitionDuration:"0.1s"},children:a.jsx(Lle,{id:t})}),i==="unifiedCanvas"&&a.jsx(_ce,{id:t}),a.jsx(ot,{size:"sm",tooltip:s("controlnet.duplicate"),"aria-label":s("controlnet.duplicate"),onClick:h,icon:a.jsx(Lu,{})}),a.jsx(ot,{size:"sm",tooltip:s("controlnet.delete"),"aria-label":s("controlnet.delete"),colorScheme:"error",onClick:m,icon:a.jsx(qo,{})}),a.jsx(ot,{size:"sm",tooltip:s(u?"controlnet.hideAdvanced":"controlnet.showAdvanced"),"aria-label":s(u?"controlnet.hideAdvanced":"controlnet.showAdvanced"),onClick:p,variant:"ghost",sx:{_hover:{bg:"none"}},icon:a.jsx(t0,{sx:{boxSize:4,color:"base.700",transform:u?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal",_dark:{color:"base.300"}}})})]}),a.jsxs($,{sx:{w:"full",flexDirection:"column",gap:3},children:[a.jsxs($,{sx:{gap:4,w:"full",alignItems:"center"},children:[a.jsxs($,{sx:{flexDir:"column",gap:3,h:28,w:"full",paddingInlineStart:1,paddingInlineEnd:u?1:0,pb:2,justifyContent:"space-between"},children:[a.jsx(Ble,{id:t}),a.jsx(Ece,{id:t})]}),!u&&a.jsx($,{sx:{alignItems:"center",justifyContent:"center",h:28,w:28,aspectRatio:"1/1"},children:a.jsx(S_,{id:t,isSmall:!0})})]}),a.jsxs($,{sx:{gap:2},children:[a.jsx(Oce,{id:t}),a.jsx($ce,{id:t})]}),a.jsx(Tce,{id:t})]}),u&&a.jsxs(a.Fragment,{children:[a.jsx(S_,{id:t}),a.jsx(kce,{id:t}),a.jsx(Cce,{id:t})]})]}):null},zce=d.memo(Lce),j1=e=>{const t=W(l=>{var u;return(u=l.generation.model)==null?void 0:u.base_model}),n=te(),r=dR(e),o=d.useMemo(()=>{const l=r.filter(u=>t?u.base_model===t:!0)[0];return l||r[0]},[t,r]),s=d.useMemo(()=>!o,[o]);return[d.useCallback(()=>{s||n(jT({type:e,overrides:{model:o}}))},[n,o,s,e]),s]},Fce=ce([we],({controlAdapters:e})=>{const t=[];let n=!1;const r=_T(e).filter(m=>m.isEnabled).length,o=IT(e).length;r>0&&t.push(`${r} IP`),r>o&&(n=!0);const s=PT(e).filter(m=>m.isEnabled).length,i=ET(e).length;s>0&&t.push(`${s} ControlNet`),s>i&&(n=!0);const l=MT(e).filter(m=>m.isEnabled).length,u=OT(e).length;return l>0&&t.push(`${l} T2I`),l>u&&(n=!0),{controlAdapterIds:RT(e).map(String),activeLabel:t.join(", "),isError:n}},je),Bce=()=>{const{t:e}=J(),{controlAdapterIds:t,activeLabel:n}=W(Fce),r=jn("controlNet").isFeatureDisabled,[o,s]=j1("controlnet"),[i,l]=j1("ip_adapter"),[u,p]=j1("t2i_adapter");return r?null:a.jsx(Ao,{label:e("controlnet.controlAdapter_other"),activeLabel:n,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsxs(zn,{size:"sm",w:"full",justifyContent:"space-between",children:[a.jsx(Mt,{tooltip:e("controlnet.addControlNet"),leftIcon:a.jsx(Xi,{}),onClick:o,"data-testid":"add controlnet",flexGrow:1,isDisabled:s,children:e("common.controlNet")}),a.jsx(Mt,{tooltip:e("controlnet.addIPAdapter"),leftIcon:a.jsx(Xi,{}),onClick:i,"data-testid":"add ip adapter",flexGrow:1,isDisabled:l,children:e("common.ipAdapter")}),a.jsx(Mt,{tooltip:e("controlnet.addT2IAdapter"),leftIcon:a.jsx(Xi,{}),onClick:u,"data-testid":"add t2i adapter",flexGrow:1,isDisabled:p,children:e("common.t2iAdapter")})]}),t.map((m,h)=>a.jsxs(d.Fragment,{children:[a.jsx(no,{}),a.jsx(zce,{id:m,number:h+1})]},m))]})})},Ku=d.memo(Bce),Hce=e=>{const{onClick:t}=e,{t:n}=J();return a.jsx(ot,{size:"sm","aria-label":n("embedding.addEmbedding"),tooltip:n("embedding.addEmbedding"),icon:a.jsx(BM,{}),sx:{p:2,color:"base.500",_hover:{color:"base.600"},_active:{color:"base.700"},_dark:{color:"base.500",_hover:{color:"base.400"},_active:{color:"base.300"}}},variant:"link",onClick:t})},v0=d.memo(Hce),Wce="28rem",Vce=e=>{const{onSelect:t,isOpen:n,onClose:r,children:o}=e,{data:s}=AT(),i=d.useRef(null),{t:l}=J(),u=W(h=>h.generation.model),p=d.useMemo(()=>{if(!s)return[];const h=[];return qr(s.entities,(g,x)=>{if(!g)return;const y=(u==null?void 0:u.base_model)!==g.base_model;h.push({value:g.model_name,label:g.model_name,group:gr[g.base_model],disabled:y,tooltip:y?`${l("embedding.incompatibleModel")} ${g.base_model}`:void 0})}),h.sort((g,x)=>{var y;return g.label&&x.label?(y=g.label)!=null&&y.localeCompare(x.label)?-1:1:-1}),h.sort((g,x)=>g.disabled&&!x.disabled?1:-1)},[s,u==null?void 0:u.base_model,l]),m=d.useCallback(h=>{h&&t(h)},[t]);return a.jsxs(Af,{initialFocusRef:i,isOpen:n,onClose:r,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(Eg,{children:o}),a.jsx(Df,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Mg,{sx:{p:0,w:`calc(${Wce} - 2rem )`},children:p.length===0?a.jsx($,{sx:{justifyContent:"center",p:2,fontSize:"sm",color:"base.500",_dark:{color:"base.700"}},children:a.jsx(Se,{children:"No Embeddings Loaded"})}):a.jsx(tr,{inputRef:i,autoFocus:!0,placeholder:l("embedding.addEmbedding"),value:null,data:p,nothingFound:l("embedding.noMatchingEmbedding"),itemComponent:fl,disabled:p.length===0,onDropdownClose:r,filter:(h,g)=>{var x;return((x=g.label)==null?void 0:x.toLowerCase().includes(h.toLowerCase().trim()))||g.value.toLowerCase().includes(h.toLowerCase().trim())},onChange:m})})})]})},x0=d.memo(Vce),Uce=()=>{const e=W(h=>h.generation.negativePrompt),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Uo(),s=te(),{t:i}=J(),l=d.useCallback(h=>{s(Od(h.target.value))},[s]),u=d.useCallback(h=>{h.key==="<"&&o()},[o]),p=d.useCallback(h=>{if(!t.current)return;const g=t.current.selectionStart;if(g===void 0)return;let x=e.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=e.slice(g),rs.flushSync(()=>{s(Od(x))}),t.current.selectionEnd=y,r()},[s,r,e]),m=jn("embedding").isFeatureEnabled;return a.jsxs(Kn,{children:[a.jsx(x0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(wn,{feature:"paramNegativeConditioning",placement:"right",children:a.jsx(gi,{id:"negativePrompt",name:"negativePrompt",ref:t,value:e,placeholder:i("parameters.negativePromptPlaceholder"),onChange:l,resize:"vertical",fontSize:"sm",minH:16,...m&&{onKeyDown:u}})})}),!n&&m&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:o})})]})},mR=d.memo(Uce),Gce=ce([we],({generation:e})=>({prompt:e.positivePrompt}),{memoizeOptions:{resultEqualityCheck:Tn}}),qce=()=>{const e=te(),{prompt:t}=W(Gce),n=d.useRef(null),{isOpen:r,onClose:o,onOpen:s}=Uo(),{t:i}=J(),l=d.useCallback(h=>{e(Md(h.target.value))},[e]);It("alt+a",()=>{var h;(h=n.current)==null||h.focus()},[]);const u=d.useCallback(h=>{if(!n.current)return;const g=n.current.selectionStart;if(g===void 0)return;let x=t.slice(0,g);x[x.length-1]!=="<"&&(x+="<"),x+=`${h}>`;const y=x.length;x+=t.slice(g),rs.flushSync(()=>{e(Md(x))}),n.current.selectionStart=y,n.current.selectionEnd=y,o()},[e,o,t]),p=jn("embedding").isFeatureEnabled,m=d.useCallback(h=>{p&&h.key==="<"&&s()},[s,p]);return a.jsxs(De,{position:"relative",children:[a.jsx(Kn,{children:a.jsx(x0,{isOpen:r,onClose:o,onSelect:u,children:a.jsx(wn,{feature:"paramPositiveConditioning",placement:"right",children:a.jsx(gi,{id:"prompt",name:"prompt",ref:n,value:t,placeholder:i("parameters.positivePromptPlaceholder"),onChange:l,onKeyDown:m,resize:"vertical",minH:32})})})}),!r&&p&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:s})})]})},hR=d.memo(qce);function Kce(){const e=W(o=>o.sdxl.shouldConcatSDXLStylePrompt),t=te(),{t:n}=J(),r=()=>{t(DT(!e))};return a.jsx(ot,{"aria-label":n("sdxl.concatPromptStyle"),tooltip:n("sdxl.concatPromptStyle"),variant:"outline",isChecked:e,onClick:r,icon:a.jsx(GM,{}),size:"xs",sx:{position:"absolute",insetInlineEnd:1,top:6,border:"none",color:e?"accent.500":"base.500",_hover:{bg:"none"}}})}const D_={position:"absolute",bg:"none",w:"full",minH:2,borderRadius:0,borderLeft:"none",borderRight:"none",zIndex:2,maskImage:"radial-gradient(circle at center, black, black 65%, black 30%, black 15%, transparent)"};function gR(){return a.jsxs($,{children:[a.jsx(De,{as:Mr.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"1px",borderTop:"none",borderColor:"base.400",...D_,_dark:{borderColor:"accent.500"}}}),a.jsx(De,{as:Mr.div,initial:{opacity:0,scale:0},animate:{opacity:[0,1,1,1],scale:[0,.75,1.5,1],transition:{duration:.42,times:[0,.25,.5,1]}},exit:{opacity:0,scale:0},sx:{zIndex:3,position:"absolute",left:"48%",top:"3px",p:1,borderRadius:4,bg:"accent.400",color:"base.50",_dark:{bg:"accent.500"}},children:a.jsx(GM,{size:12})}),a.jsx(De,{as:Mr.div,initial:{scaleX:0,borderWidth:0,display:"none"},animate:{display:["block","block","block","none"],scaleX:[0,.25,.5,1],borderWidth:[0,3,3,0],transition:{duration:.37,times:[0,.25,.5,1]}},sx:{top:"17px",borderBottom:"none",borderColor:"base.400",...D_,_dark:{borderColor:"accent.500"}}})]})}const Qce=ce([we],({sdxl:e})=>{const{negativeStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),Xce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Uo(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Qce),u=d.useCallback(g=>{e(Ad(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),rs.flushSync(()=>{e(Ad(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=jn("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(De,{position:"relative",children:[a.jsx(yo,{children:l&&a.jsx(De,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(gR,{})})}),a.jsx(Kn,{children:a.jsx(x0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(gi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.negStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",fontSize:"sm",minH:16})})}),!n&&m&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:o})})]})},Yce=d.memo(Xce),Jce=ce([we],({sdxl:e})=>{const{positiveStylePrompt:t,shouldConcatSDXLStylePrompt:n}=e;return{prompt:t,shouldConcatSDXLStylePrompt:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),Zce=()=>{const e=te(),t=d.useRef(null),{isOpen:n,onClose:r,onOpen:o}=Uo(),{t:s}=J(),{prompt:i,shouldConcatSDXLStylePrompt:l}=W(Jce),u=d.useCallback(g=>{e(Rd(g.target.value))},[e]),p=d.useCallback(g=>{if(!t.current)return;const x=t.current.selectionStart;if(x===void 0)return;let y=i.slice(0,x);y[y.length-1]!=="<"&&(y+="<"),y+=`${g}>`;const b=y.length;y+=i.slice(x),rs.flushSync(()=>{e(Rd(y))}),t.current.selectionStart=b,t.current.selectionEnd=b,r()},[e,r,i]),m=jn("embedding").isFeatureEnabled,h=d.useCallback(g=>{m&&g.key==="<"&&o()},[o,m]);return a.jsxs(De,{position:"relative",children:[a.jsx(yo,{children:l&&a.jsx(De,{sx:{position:"absolute",left:"3",w:"94%",top:"-17px"},children:a.jsx(gR,{})})}),a.jsx(Kn,{children:a.jsx(x0,{isOpen:n,onClose:r,onSelect:p,children:a.jsx(gi,{id:"prompt",name:"prompt",ref:t,value:i,placeholder:s("sdxl.posStylePrompt"),onChange:u,onKeyDown:h,resize:"vertical",minH:16})})}),!n&&m&&a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0},children:a.jsx(v0,{onClick:o})})]})},eue=d.memo(Zce);function $2(){return a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(hR,{}),a.jsx(Kce,{}),a.jsx(eue,{}),a.jsx(mR,{}),a.jsx(Yce,{})]})}const gl=()=>{const{isRefinerAvailable:e}=na(Tb,{selectFromResult:({data:t})=>({isRefinerAvailable:t?t.ids.length>0:!1})});return e},tue=ce([we],({sdxl:e,ui:t,hotkeys:n})=>{const{refinerCFGScale:r}=e,{shouldUseSliders:o}=t,{shift:s}=n;return{refinerCFGScale:r,shouldUseSliders:o,shift:s}},je),nue=()=>{const{refinerCFGScale:e,shouldUseSliders:t,shift:n}=W(tue),r=gl(),o=te(),{t:s}=J(),i=d.useCallback(u=>o(z1(u)),[o]),l=d.useCallback(()=>o(z1(7)),[o]);return t?a.jsx(jt,{label:s("sdxl.cfgScale"),step:n?.1:.5,min:1,max:20,onChange:i,handleReset:l,value:e,sliderNumberInputProps:{max:200},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!r}):a.jsx(Vu,{label:s("sdxl.cfgScale"),step:.5,min:1,max:200,onChange:i,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"},isDisabled:!r})},rue=d.memo(nue),oue=e=>{const t=yi("models"),[n,r,o]=e.split("/"),s=TT.safeParse({base_model:n,model_name:o,model_type:r});if(!s.success){t.error({mainModelId:e,errors:s.error.format()},"Failed to parse main model id");return}return s.data},sue=ce(we,e=>({model:e.sdxl.refinerModel}),je),aue=()=>{const e=te(),t=jn("syncModels").isFeatureEnabled,{model:n}=W(sue),{t:r}=J(),{data:o,isLoading:s}=na(Tb),i=d.useMemo(()=>{if(!o)return[];const p=[];return qr(o.entities,(m,h)=>{m&&p.push({value:h,label:m.model_name,group:gr[m.base_model]})}),p},[o]),l=d.useMemo(()=>(o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])??null,[o==null?void 0:o.entities,n]),u=d.useCallback(p=>{if(!p)return;const m=oue(p);m&&e(FI(m))},[e]);return s?a.jsx(tr,{label:r("sdxl.refinermodel"),placeholder:r("sdxl.loading"),disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:2,children:[a.jsx(tr,{tooltip:l==null?void 0:l.description,label:r("sdxl.refinermodel"),value:l==null?void 0:l.id,placeholder:i.length>0?r("sdxl.selectAModel"):r("sdxl.noModelsAvailable"),data:i,error:i.length===0,disabled:i.length===0,onChange:u,w:"100%"}),t&&a.jsx(De,{mt:7,children:a.jsx(Wu,{iconMode:!0})})]})},iue=d.memo(aue),lue=ce([we],({sdxl:e,hotkeys:t})=>{const{refinerNegativeAestheticScore:n}=e,{shift:r}=t;return{refinerNegativeAestheticScore:n,shift:r}},je),cue=()=>{const{refinerNegativeAestheticScore:e,shift:t}=W(lue),n=gl(),r=te(),{t:o}=J(),s=d.useCallback(l=>r(B1(l)),[r]),i=d.useCallback(()=>r(B1(2.5)),[r]);return a.jsx(jt,{label:o("sdxl.negAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},uue=d.memo(cue),due=ce([we],({sdxl:e,hotkeys:t})=>{const{refinerPositiveAestheticScore:n}=e,{shift:r}=t;return{refinerPositiveAestheticScore:n,shift:r}},je),fue=()=>{const{refinerPositiveAestheticScore:e,shift:t}=W(due),n=gl(),r=te(),{t:o}=J(),s=d.useCallback(l=>r(F1(l)),[r]),i=d.useCallback(()=>r(F1(6)),[r]);return a.jsx(jt,{label:o("sdxl.posAestheticScore"),step:t?.1:.5,min:1,max:10,onChange:s,handleReset:i,value:e,sliderNumberInputProps:{max:10},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},pue=d.memo(fue),mue=ce(we,({ui:e,sdxl:t})=>{const{refinerScheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(tg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{refinerScheduler:n,data:o}},je),hue=()=>{const e=te(),{t}=J(),{refinerScheduler:n,data:r}=W(mue),o=gl(),s=d.useCallback(i=>{i&&e(BI(i))},[e]);return a.jsx(tr,{w:"100%",label:t("sdxl.scheduler"),value:n,data:r,onChange:s,disabled:!o})},gue=d.memo(hue),vue=ce([we],({sdxl:e})=>{const{refinerStart:t}=e;return{refinerStart:t}},je),xue=()=>{const{refinerStart:e}=W(vue),t=te(),n=gl(),r=d.useCallback(i=>t(H1(i)),[t]),{t:o}=J(),s=d.useCallback(()=>t(H1(.8)),[t]);return a.jsx(jt,{label:o("sdxl.refinerStart"),step:.01,min:0,max:1,onChange:r,handleReset:s,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1,isDisabled:!n})},bue=d.memo(xue),yue=ce([we],({sdxl:e,ui:t})=>{const{refinerSteps:n}=e,{shouldUseSliders:r}=t;return{refinerSteps:n,shouldUseSliders:r}},je),Cue=()=>{const{refinerSteps:e,shouldUseSliders:t}=W(yue),n=gl(),r=te(),{t:o}=J(),s=d.useCallback(l=>{r(L1(l))},[r]),i=d.useCallback(()=>{r(L1(20))},[r]);return t?a.jsx(jt,{label:o("sdxl.steps"),min:1,max:100,step:1,onChange:s,handleReset:i,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:500},isDisabled:!n}):a.jsx(Vu,{label:o("sdxl.steps"),min:1,max:500,step:1,onChange:s,value:e,numberInputFieldProps:{textAlign:"center"},isDisabled:!n})},wue=d.memo(Cue);function Sue(){const e=W(s=>s.sdxl.shouldUseSDXLRefiner),t=gl(),n=te(),{t:r}=J(),o=s=>{n(NT(s.target.checked))};return a.jsx(kr,{label:r("sdxl.useRefiner"),isChecked:e,onChange:o,isDisabled:!t})}const kue=ce(we,e=>{const{shouldUseSDXLRefiner:t}=e.sdxl,{shouldUseSliders:n}=e.ui;return{activeLabel:t?"Enabled":void 0,shouldUseSliders:n}},je),jue=()=>{const{activeLabel:e,shouldUseSliders:t}=W(kue),{t:n}=J();return gl()?a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Sue,{}),a.jsx(iue,{}),a.jsxs($,{gap:2,flexDirection:t?"column":"row",children:[a.jsx(wue,{}),a.jsx(rue,{})]}),a.jsx(gue,{}),a.jsx(pue,{}),a.jsx(uue,{}),a.jsx(bue,{})]})}):a.jsx(Ao,{label:n("sdxl.refiner"),activeLabel:e,children:a.jsx($,{sx:{justifyContent:"center",p:2},children:a.jsx(Se,{sx:{fontSize:"sm",color:"base.500",_dark:"base.700"},children:n("models.noRefinerModelsInstalled")})})})},L2=d.memo(jue),_ue=ce([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l}=t.sd.guidance,{cfgScale:u}=e,{shouldUseSliders:p}=n,{shift:m}=r;return{cfgScale:u,initial:o,min:s,sliderMax:i,inputMax:l,shouldUseSliders:p,shift:m}},je),Iue=()=>{const{cfgScale:e,initial:t,min:n,sliderMax:r,inputMax:o,shouldUseSliders:s,shift:i}=W(_ue),l=te(),{t:u}=J(),p=d.useCallback(h=>l(Dm(h)),[l]),m=d.useCallback(()=>l(Dm(t)),[l,t]);return s?a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(jt,{label:u("parameters.cfgScale"),step:i?.1:.5,min:n,max:r,onChange:p,handleReset:m,value:e,sliderNumberInputProps:{max:o},withInput:!0,withReset:!0,withSliderMarks:!0,isInteger:!1})}):a.jsx(wn,{feature:"paramCFGScale",children:a.jsx(Vu,{label:u("parameters.cfgScale"),step:.5,min:n,max:o,onChange:p,value:e,isInteger:!1,numberInputFieldProps:{textAlign:"center"}})})},Da=d.memo(Iue),Pue=ce(we,e=>({model:e.generation.model}),je),Eue=()=>{const e=te(),{t}=J(),{model:n}=W(Pue),r=jn("syncModels").isFeatureEnabled,{data:o,isLoading:s}=na(Uw),{data:i,isLoading:l}=Bd(Uw),u=W(ro),p=d.useMemo(()=>{if(!o)return[];const g=[];return qr(o.entities,(x,y)=>{x&&g.push({value:y,label:x.model_name,group:gr[x.base_model]})}),qr(i==null?void 0:i.entities,(x,y)=>{!x||u==="unifiedCanvas"||u==="img2img"||g.push({value:y,label:x.model_name,group:gr[x.base_model]})}),g},[o,i,u]),m=d.useMemo(()=>((o==null?void 0:o.entities[`${n==null?void 0:n.base_model}/main/${n==null?void 0:n.model_name}`])||(i==null?void 0:i.entities[`${n==null?void 0:n.base_model}/onnx/${n==null?void 0:n.model_name}`]))??null,[o==null?void 0:o.entities,n,i==null?void 0:i.entities]),h=d.useCallback(g=>{if(!g)return;const x=g0(g);x&&e(N1(x))},[e]);return s||l?a.jsx(tr,{label:t("modelManager.model"),placeholder:"Loading...",disabled:!0,data:[]}):a.jsxs($,{w:"100%",alignItems:"center",gap:3,children:[a.jsx(wn,{feature:"paramModel",children:a.jsx(tr,{tooltip:m==null?void 0:m.description,label:t("modelManager.model"),value:m==null?void 0:m.id,placeholder:p.length>0?"Select a model":"No models available",data:p,error:p.length===0,disabled:p.length===0,onChange:h,w:"100%"})}),r&&a.jsx(De,{mt:6,children:a.jsx(Wu,{iconMode:!0})})]})},Mue=d.memo(Eue),Oue=ce(we,({generation:e})=>{const{model:t,vae:n}=e;return{model:t,vae:n}},je),Rue=()=>{const e=te(),{t}=J(),{model:n,vae:r}=W(Oue),{data:o}=nP(),s=d.useMemo(()=>{if(!o)return[];const u=[{value:"default",label:"Default",group:"Default"}];return qr(o.entities,(p,m)=>{if(!p)return;const h=(n==null?void 0:n.base_model)!==p.base_model;u.push({value:m,label:p.model_name,group:gr[p.base_model],disabled:h,tooltip:h?`Incompatible base model: ${p.base_model}`:void 0})}),u.sort((p,m)=>p.disabled&&!m.disabled?1:-1)},[o,n==null?void 0:n.base_model]),i=d.useMemo(()=>(o==null?void 0:o.entities[`${r==null?void 0:r.base_model}/vae/${r==null?void 0:r.model_name}`])??null,[o==null?void 0:o.entities,r]),l=d.useCallback(u=>{if(!u||u==="default"){e(Gw(null));return}const p=iR(u);p&&e(Gw(p))},[e]);return a.jsx(wn,{feature:"paramVAE",children:a.jsx(tr,{itemComponent:fl,tooltip:i==null?void 0:i.description,label:t("modelManager.vae"),value:(i==null?void 0:i.id)??"default",placeholder:"Default",data:s,onChange:l,disabled:s.length===0,clearable:!0})})},Aue=d.memo(Rue),Due=ce([sP,da],(e,t)=>{const{scheduler:n}=t,{favoriteSchedulers:r}=e,o=Ro(tg,(s,i)=>({value:i,label:s,group:r.includes(i)?"Favorites":void 0})).sort((s,i)=>s.label.localeCompare(i.label));return{scheduler:n,data:o}},je),Tue=()=>{const e=te(),{t}=J(),{scheduler:n,data:r}=W(Due),o=d.useCallback(s=>{s&&e($1(s))},[e]);return a.jsx(wn,{feature:"paramScheduler",children:a.jsx(tr,{label:t("parameters.scheduler"),value:n,data:r,onChange:o})})},Nue=d.memo(Tue),$ue=ce(we,({generation:e})=>{const{vaePrecision:t}=e;return{vaePrecision:t}},je),Lue=["fp16","fp32"],zue=()=>{const{t:e}=J(),t=te(),{vaePrecision:n}=W($ue),r=d.useCallback(o=>{o&&t($T(o))},[t]);return a.jsx(wn,{feature:"paramVAEPrecision",children:a.jsx(Tr,{label:e("modelManager.vaePrecision"),value:n,data:Lue,onChange:r})})},Fue=d.memo(zue),Bue=()=>{const e=jn("vae").isFeatureEnabled;return a.jsxs($,{gap:3,w:"full",flexWrap:e?"wrap":"nowrap",children:[a.jsx(De,{w:"full",children:a.jsx(Mue,{})}),a.jsx(De,{w:"full",children:a.jsx(Nue,{})}),e&&a.jsxs($,{w:"full",gap:3,children:[a.jsx(Aue,{}),a.jsx(Fue,{})]})]})},Ta=d.memo(Bue),vR=[{name:on.t("parameters.aspectRatioFree"),value:null},{name:"2:3",value:2/3},{name:"16:9",value:16/9},{name:"1:1",value:1/1}],xR=vR.map(e=>e.value);function bR(){const e=W(o=>o.generation.aspectRatio),t=te(),n=W(o=>o.generation.shouldFitToWidthHeight),r=W(ro);return a.jsx(zn,{isAttached:!0,children:vR.map(o=>a.jsx(Mt,{size:"sm",isChecked:e===o.value,isDisabled:r==="img2img"?!n:!1,onClick:()=>{t(Us(o.value)),t(Hd(!1))},children:o.name},o.name))})}const Hue=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.height,{model:u,height:p}=e,{aspectRatio:m}=e,h=t.shift?i:l;return{model:u,height:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),Wue=e=>{const{model:t,height:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(Hue),u=te(),{t:p}=J(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Hl(x)),l){const y=Gr(x*l,8);u(Bl(y))}},[u,l]),g=d.useCallback(()=>{if(u(Hl(m)),l){const x=Gr(m*l,8);u(Bl(x))}},[u,m,l]);return a.jsx(jt,{label:p("parameters.height"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},Vue=d.memo(Wue),Uue=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,sliderMax:o,inputMax:s,fineStep:i,coarseStep:l}=n.sd.width,{model:u,width:p,aspectRatio:m}=e,h=t.shift?i:l;return{model:u,width:p,min:r,sliderMax:o,inputMax:s,step:h,aspectRatio:m}},je),Gue=e=>{const{model:t,width:n,min:r,sliderMax:o,inputMax:s,step:i,aspectRatio:l}=W(Uue),u=te(),{t:p}=J(),m=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,h=d.useCallback(x=>{if(u(Bl(x)),l){const y=Gr(x/l,8);u(Hl(y))}},[u,l]),g=d.useCallback(()=>{if(u(Bl(m)),l){const x=Gr(m/l,8);u(Hl(x))}},[u,m,l]);return a.jsx(jt,{label:p("parameters.width"),value:n,min:r,step:i,max:o,onChange:h,handleReset:g,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:s},...e})},que=d.memo(Gue),Kue=ce([da,ro],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}=e;return{activeTabName:t,shouldFitToWidthHeight:n,shouldLockAspectRatio:r,width:o,height:s}},je);function _u(){const{t:e}=J(),t=te(),{activeTabName:n,shouldFitToWidthHeight:r,shouldLockAspectRatio:o,width:s,height:i}=W(Kue),l=d.useCallback(()=>{o?(t(Hd(!1)),xR.includes(s/i)?t(Us(s/i)):t(Us(null))):(t(Hd(!0)),t(Us(s/i)))},[o,s,i,t]),u=d.useCallback(()=>{t(LT()),t(Us(null)),o&&t(Us(i/s))},[t,o,s,i]);return a.jsxs($,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.150",_dark:{bg:"base.750"}},children:[a.jsx(wn,{feature:"paramRatio",children:a.jsxs(Kn,{as:$,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(Rr,{children:e("parameters.aspectRatio")}),a.jsx(ki,{}),a.jsx(bR,{}),a.jsx(ot,{tooltip:e("ui.swapSizes"),"aria-label":e("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,isDisabled:n==="img2img"?!r:!1,onClick:u}),a.jsx(ot,{tooltip:e("ui.lockRatio"),"aria-label":e("ui.lockRatio"),size:"sm",icon:a.jsx(qM,{}),isChecked:o,isDisabled:n==="img2img"?!r:!1,onClick:l})]})}),a.jsx($,{gap:2,alignItems:"center",children:a.jsxs($,{gap:2,flexDirection:"column",width:"full",children:[a.jsx(que,{isDisabled:n==="img2img"?!r:!1}),a.jsx(Vue,{isDisabled:n==="img2img"?!r:!1})]})})]})}const Que=ce([we],({generation:e,config:t,ui:n,hotkeys:r})=>{const{initial:o,min:s,sliderMax:i,inputMax:l,fineStep:u,coarseStep:p}=t.sd.steps,{steps:m}=e,{shouldUseSliders:h}=n,g=r.shift?u:p;return{steps:m,initial:o,min:s,sliderMax:i,inputMax:l,step:g,shouldUseSliders:h}},je),Xue=()=>{const{steps:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s,shouldUseSliders:i}=W(Que),l=te(),{t:u}=J(),p=d.useCallback(g=>{l(Tm(g))},[l]),m=d.useCallback(()=>{l(Tm(t))},[l,t]),h=d.useCallback(()=>{l(Ab())},[l]);return i?a.jsx(wn,{feature:"paramSteps",children:a.jsx(jt,{label:u("parameters.steps"),min:n,max:r,step:s,onChange:p,handleReset:m,value:e,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:o}})}):a.jsx(wn,{feature:"paramSteps",children:a.jsx(Vu,{label:u("parameters.steps"),min:n,max:o,step:s,onChange:p,value:e,numberInputFieldProps:{textAlign:"center"},onBlur:h})})},Na=d.memo(Xue);function yR(){const e=te(),t=W(o=>o.generation.shouldFitToWidthHeight),n=o=>e(zT(o.target.checked)),{t:r}=J();return a.jsx(kr,{label:r("parameters.imageFit"),isChecked:t,onChange:n})}function Yue(){const e=W(i=>i.generation.seed),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.shouldGenerateVariations),{t:r}=J(),o=te(),s=i=>o(Am(i));return a.jsx(Vu,{label:r("parameters.seed"),step:1,precision:0,flexGrow:1,min:aP,max:iP,isDisabled:t,isInvalid:e<0&&n,onChange:s,value:e})}const Jue=(e,t)=>Math.floor(Math.random()*(t-e+1)+e);function Zue(){const e=te(),t=W(o=>o.generation.shouldRandomizeSeed),{t:n}=J(),r=()=>e(Am(Jue(aP,iP)));return a.jsx(ot,{size:"sm",isDisabled:t,"aria-label":n("parameters.shuffle"),tooltip:n("parameters.shuffle"),onClick:r,icon:a.jsx(kee,{})})}const ede=()=>{const e=te(),{t}=J(),n=W(o=>o.generation.shouldRandomizeSeed),r=o=>e(FT(o.target.checked));return a.jsx(kr,{label:t("common.random"),isChecked:n,onChange:r})},tde=d.memo(ede),nde=()=>a.jsx(wn,{feature:"paramSeed",children:a.jsxs($,{sx:{gap:3,alignItems:"flex-end"},children:[a.jsx(Yue,{}),a.jsx(Zue,{}),a.jsx(tde,{})]})}),$a=d.memo(nde),CR=Oe((e,t)=>a.jsxs($,{ref:t,sx:{flexDir:"column",gap:2,bg:"base.100",px:4,pt:2,pb:4,borderRadius:"base",_dark:{bg:"base.750"}},children:[a.jsx(Se,{fontSize:"sm",fontWeight:"bold",sx:{color:"base.600",_dark:{color:"base.300"}},children:e.label}),e.children]}));CR.displayName="SubSettingsWrapper";const Iu=d.memo(CR),rde=ce([we],({sdxl:e})=>{const{sdxlImg2ImgDenoisingStrength:t}=e;return{sdxlImg2ImgDenoisingStrength:t}},je),ode=()=>{const{sdxlImg2ImgDenoisingStrength:e}=W(rde),t=te(),{t:n}=J(),r=d.useCallback(s=>t(qw(s)),[t]),o=d.useCallback(()=>{t(qw(.7))},[t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Iu,{children:a.jsx(jt,{label:n("sdxl.denoisingStrength"),step:.01,min:0,max:1,onChange:r,handleReset:o,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0})})})},wR=d.memo(ode),sde=ce([sP,da],(e,t)=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),ade=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=W(sde);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}),a.jsx(wR,{}),a.jsx(yR,{})]})})},ide=d.memo(ade),lde=()=>a.jsxs(a.Fragment,{children:[a.jsx($2,{}),a.jsx(ide,{}),a.jsx(L2,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(qu,{})]}),cde=d.memo(lde),z2=()=>{const{t:e}=J(),t=W(i=>i.generation.shouldRandomizeSeed),n=W(i=>i.generation.iterations),r=d.useMemo(()=>n===1?e("parameters.iterationsWithCount_one",{count:1}):e("parameters.iterationsWithCount_other",{count:n}),[n,e]),o=d.useMemo(()=>e(t?"parameters.randomSeed":"parameters.manualSeed"),[t,e]);return{iterationsAndSeedLabel:d.useMemo(()=>[r,o].join(", "),[r,o]),iterationsLabel:r,seedLabel:o}},ude=()=>{const{t:e}=J(),t=W(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsx($,{sx:{flexDirection:"column",gap:3},children:t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]})})})},SR=d.memo(ude),dde=()=>a.jsxs(a.Fragment,{children:[a.jsx($2,{}),a.jsx(SR,{}),a.jsx(L2,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(qu,{})]}),fde=d.memo(dde),pde=[{label:"Unmasked",value:"unmasked"},{label:"Mask",value:"mask"},{label:"Mask Edge",value:"edge"}],mde=()=>{const e=te(),t=W(o=>o.generation.canvasCoherenceMode),{t:n}=J(),r=o=>{o&&e(BT(o))};return a.jsx(wn,{feature:"compositingCoherenceMode",children:a.jsx(Tr,{label:n("parameters.coherenceMode"),data:pde,value:t,onChange:r})})},hde=d.memo(mde),gde=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceSteps),{t:n}=J();return a.jsx(wn,{feature:"compositingCoherenceSteps",children:a.jsx(jt,{label:n("parameters.coherenceSteps"),min:1,max:100,step:1,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(Kw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Kw(20))}})})},vde=d.memo(gde),xde=()=>{const e=te(),t=W(r=>r.generation.canvasCoherenceStrength),{t:n}=J();return a.jsx(wn,{feature:"compositingStrength",children:a.jsx(jt,{label:n("parameters.coherenceStrength"),min:0,max:1,step:.01,sliderNumberInputProps:{max:999},value:t,onChange:r=>{e(Qw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Qw(.3))}})})},bde=d.memo(xde);function yde(){const e=te(),t=W(r=>r.generation.maskBlur),{t:n}=J();return a.jsx(wn,{feature:"compositingBlur",children:a.jsx(jt,{label:n("parameters.maskBlur"),min:0,max:64,sliderNumberInputProps:{max:512},value:t,onChange:r=>{e(Xw(r))},withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>{e(Xw(16))}})})}const Cde=[{label:"Box Blur",value:"box"},{label:"Gaussian Blur",value:"gaussian"}];function wde(){const e=W(o=>o.generation.maskBlurMethod),t=te(),{t:n}=J(),r=o=>{o&&t(HT(o))};return a.jsx(wn,{feature:"compositingBlurMethod",children:a.jsx(Tr,{value:e,onChange:r,label:n("parameters.maskBlurMethod"),data:Cde})})}const Sde=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.compositingSettingsHeader"),children:a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsxs(Iu,{label:e("parameters.coherencePassHeader"),children:[a.jsx(hde,{}),a.jsx(vde,{}),a.jsx(bde,{})]}),a.jsx(no,{}),a.jsxs(Iu,{label:e("parameters.maskAdjustmentsHeader"),children:[a.jsx(yde,{}),a.jsx(wde,{})]})]})})},kR=d.memo(Sde),kde=ce([we],({generation:e})=>{const{infillMethod:t}=e;return{infillMethod:t}},je),jde=()=>{const e=te(),{infillMethod:t}=W(kde),{data:n,isLoading:r}=OI(),o=n==null?void 0:n.infill_methods,{t:s}=J(),i=d.useCallback(l=>{e(WT(l))},[e]);return a.jsx(wn,{feature:"infillMethod",children:a.jsx(Tr,{disabled:(o==null?void 0:o.length)===0,placeholder:r?"Loading...":void 0,label:s("parameters.infillMethod"),value:t,data:o??[],onChange:i})})},_de=d.memo(jde),Ide=ce([da],e=>{const{infillPatchmatchDownscaleSize:t,infillMethod:n}=e;return{infillPatchmatchDownscaleSize:t,infillMethod:n}},je),Pde=()=>{const e=te(),{infillPatchmatchDownscaleSize:t,infillMethod:n}=W(Ide),{t:r}=J(),o=d.useCallback(i=>{e(Yw(i))},[e]),s=d.useCallback(()=>{e(Yw(2))},[e]);return a.jsx(jt,{isDisabled:n!=="patchmatch",label:r("parameters.patchmatchDownScaleSize"),min:1,max:10,value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Ede=d.memo(Pde),Mde=ce([da],e=>{const{infillTileSize:t,infillMethod:n}=e;return{infillTileSize:t,infillMethod:n}},je),Ode=()=>{const e=te(),{infillTileSize:t,infillMethod:n}=W(Mde),{t:r}=J(),o=d.useCallback(i=>{e(Jw(i))},[e]),s=d.useCallback(()=>{e(Jw(32))},[e]);return a.jsx(jt,{isDisabled:n!=="tile",label:r("parameters.tileSize"),min:16,max:64,sliderNumberInputProps:{max:256},value:t,onChange:o,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:s})},Rde=d.memo(Ode),Ade=ce([da],e=>{const{infillMethod:t}=e;return{infillMethod:t}},je);function Dde(){const{infillMethod:e}=W(Ade);return a.jsxs($,{children:[e==="tile"&&a.jsx(Rde,{}),e==="patchmatch"&&a.jsx(Ede,{})]})}const jr=e=>e.canvas,Ns=ce([we],({canvas:e})=>e.batchIds.length>0||e.layerState.stagingArea.images.length>0),Tde=ce([jr],e=>{const{boundingBoxScaleMethod:t}=e;return{boundingBoxScale:t}},je),Nde=()=>{const e=te(),{boundingBoxScale:t}=W(Tde),{t:n}=J(),r=o=>{e(UT(o))};return a.jsx(wn,{feature:"scaleBeforeProcessing",children:a.jsx(tr,{label:n("parameters.scaleBeforeProcessing"),data:VT,value:t,onChange:r})})},$de=d.memo(Nde),Lde=ce([da,jr],(e,t)=>{const{scaledBoundingBoxDimensions:n,boundingBoxScaleMethod:r}=t,{model:o,aspectRatio:s}=e;return{model:o,scaledBoundingBoxDimensions:n,isManual:r==="manual",aspectRatio:s}},je),zde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(Lde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),l=p=>{let m=r.width;const h=Math.floor(p);o&&(m=Gr(h*o,64)),e(Lm({width:m,height:h}))},u=()=>{let p=r.width;const m=Math.floor(s);o&&(p=Gr(m*o,64)),e(Lm({width:p,height:m}))};return a.jsx(jt,{isDisabled:!n,label:i("parameters.scaledHeight"),min:64,max:1536,step:64,value:r.height,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Fde=d.memo(zde),Bde=ce([jr,da],(e,t)=>{const{boundingBoxScaleMethod:n,scaledBoundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,scaledBoundingBoxDimensions:r,aspectRatio:s,isManual:n==="manual"}},je),Hde=()=>{const e=te(),{model:t,isManual:n,scaledBoundingBoxDimensions:r,aspectRatio:o}=W(Bde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),l=p=>{const m=Math.floor(p);let h=r.height;o&&(h=Gr(m/o,64)),e(Lm({width:m,height:h}))},u=()=>{const p=Math.floor(s);let m=r.height;o&&(m=Gr(p/o,64)),e(Lm({width:p,height:m}))};return a.jsx(jt,{isDisabled:!n,label:i("parameters.scaledWidth"),min:64,max:1536,step:64,value:r.width,onChange:l,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Wde=d.memo(Hde),Vde=()=>{const{t:e}=J();return a.jsx(Ao,{label:e("parameters.infillScalingHeader"),children:a.jsxs($,{sx:{gap:2,flexDirection:"column"},children:[a.jsxs(Iu,{children:[a.jsx(_de,{}),a.jsx(Dde,{})]}),a.jsx(no,{}),a.jsxs(Iu,{children:[a.jsx($de,{}),a.jsx(Wde,{}),a.jsx(Fde,{})]})]})})},jR=d.memo(Vde),Ude=ce([we,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),Gde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(Ude),{t:s}=J(),i=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,l=p=>{if(e(Xs({...n,height:Math.floor(p)})),o){const m=Gr(p*o,64);e(Xs({width:m,height:Math.floor(p)}))}},u=()=>{if(e(Xs({...n,height:Math.floor(i)})),o){const p=Gr(i*o,64);e(Xs({width:p,height:Math.floor(i)}))}};return a.jsx(jt,{label:s("parameters.boundingBoxHeight"),min:64,max:1536,step:64,value:n.height,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},qde=d.memo(Gde),Kde=ce([we,Ns],({canvas:e,generation:t},n)=>{const{boundingBoxDimensions:r}=e,{model:o,aspectRatio:s}=t;return{model:o,boundingBoxDimensions:r,isStaging:n,aspectRatio:s}},je),Qde=()=>{const e=te(),{model:t,boundingBoxDimensions:n,isStaging:r,aspectRatio:o}=W(Kde),s=["sdxl","sdxl-refiner"].includes(t==null?void 0:t.base_model)?1024:512,{t:i}=J(),l=p=>{if(e(Xs({...n,width:Math.floor(p)})),o){const m=Gr(p/o,64);e(Xs({width:Math.floor(p),height:m}))}},u=()=>{if(e(Xs({...n,width:Math.floor(s)})),o){const p=Gr(s/o,64);e(Xs({width:Math.floor(s),height:p}))}};return a.jsx(jt,{label:i("parameters.boundingBoxWidth"),min:64,max:1536,step:64,value:n.width,onChange:l,isDisabled:r,sliderNumberInputProps:{max:4096},withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:u})},Xde=d.memo(Qde),Yde=ce([da,jr],(e,t)=>{const{shouldFitToWidthHeight:n,shouldLockAspectRatio:r}=e,{boundingBoxDimensions:o}=t;return{shouldFitToWidthHeight:n,shouldLockAspectRatio:r,boundingBoxDimensions:o}});function Yh(){const e=te(),{t}=J(),{shouldLockAspectRatio:n,boundingBoxDimensions:r}=W(Yde),o=d.useCallback(()=>{n?(e(Hd(!1)),xR.includes(r.width/r.height)?e(Us(r.width/r.height)):e(Us(null))):(e(Hd(!0)),e(Us(r.width/r.height)))},[n,r,e]),s=d.useCallback(()=>{e(GT()),e(Us(null)),n&&e(Us(r.height/r.width))},[e,n,r]);return a.jsxs($,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(wn,{feature:"paramRatio",children:a.jsxs(Kn,{as:$,flexDir:"row",alignItems:"center",gap:2,children:[a.jsx(Rr,{children:t("parameters.aspectRatio")}),a.jsx(ki,{}),a.jsx(bR,{}),a.jsx(ot,{tooltip:t("ui.swapSizes"),"aria-label":t("ui.swapSizes"),size:"sm",icon:a.jsx(y8,{}),fontSize:20,onClick:s}),a.jsx(ot,{tooltip:t("ui.lockRatio"),"aria-label":t("ui.lockRatio"),size:"sm",icon:a.jsx(qM,{}),isChecked:n,onClick:o})]})}),a.jsx(Xde,{}),a.jsx(qde,{})]})}const Jde=ce(we,({ui:e,generation:t})=>{const{shouldUseSliders:n}=e,{shouldRandomizeSeed:r}=t;return{shouldUseSliders:n,activeLabel:r?void 0:"Manual Seed"}},je),Zde=()=>{const{t:e}=J(),{shouldUseSliders:t,activeLabel:n}=W(Jde);return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}),a.jsx(wR,{})]})})},efe=d.memo(Zde);function tfe(){return a.jsxs(a.Fragment,{children:[a.jsx($2,{}),a.jsx(efe,{}),a.jsx(L2,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(jR,{}),a.jsx(kR,{}),a.jsx(qu,{})]})}function F2(){return a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(hR,{}),a.jsx(mR,{})]})}function nfe(){const e=W(o=>o.generation.horizontalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=J();return a.jsx(jt,{label:r("parameters.hSymmetryStep"),value:e,onChange:o=>n(Zw(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(Zw(0))})}function rfe(){const e=W(o=>o.generation.verticalSymmetrySteps),t=W(o=>o.generation.steps),n=te(),{t:r}=J();return a.jsx(jt,{label:r("parameters.vSymmetryStep"),value:e,onChange:o=>n(eS(o)),min:0,max:t,step:1,withInput:!0,withSliderMarks:!0,withReset:!0,handleReset:()=>n(eS(0))})}function ofe(){const e=W(n=>n.generation.shouldUseSymmetry),t=te();return a.jsx(kr,{label:"Enable Symmetry",isChecked:e,onChange:n=>t(qT(n.target.checked))})}const sfe=ce(we,e=>({activeLabel:e.generation.shouldUseSymmetry?"Enabled":void 0}),je),afe=()=>{const{t:e}=J(),{activeLabel:t}=W(sfe);return jn("symmetry").isFeatureEnabled?a.jsx(Ao,{label:e("parameters.symmetry"),activeLabel:t,children:a.jsxs($,{sx:{gap:2,flexDirection:"column"},children:[a.jsx(ofe,{}),a.jsx(nfe,{}),a.jsx(rfe,{})]})}):null},B2=d.memo(afe),ife=ce([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.img2imgStrength,{img2imgStrength:p}=e,m=t.shift?l:u;return{img2imgStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:m}},je),lfe=()=>{const{img2imgStrength:e,initial:t,min:n,sliderMax:r,inputMax:o,step:s}=W(ife),i=te(),{t:l}=J(),u=d.useCallback(m=>i(Nm(m)),[i]),p=d.useCallback(()=>{i(Nm(t))},[i,t]);return a.jsx(wn,{feature:"paramDenoisingStrength",children:a.jsx(Iu,{children:a.jsx(jt,{label:`${l("parameters.denoisingStrength")}`,step:s,min:n,max:r,onChange:u,handleReset:p,value:e,isInteger:!1,withInput:!0,withSliderMarks:!0,withReset:!0,sliderNumberInputProps:{max:o}})})})},_R=d.memo(lfe),cfe=()=>{const{t:e}=J(),t=W(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(_u,{})]}),a.jsx(_R,{}),a.jsx(yR,{})]})})},ufe=d.memo(cfe),dfe=()=>a.jsxs(a.Fragment,{children:[a.jsx(F2,{}),a.jsx(ufe,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(B2,{}),a.jsx(qu,{})]}),ffe=d.memo(dfe);function pfe(e){return Math.floor((e-1)/8)*8}const mfe=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,fineStep:o,coarseStep:s}=n.sd.height,{model:i,height:l,hrfHeight:u,aspectRatio:p,hrfEnabled:m}=e,h=t.shift?o:s;return{model:i,height:l,hrfHeight:u,min:r,step:h,aspectRatio:p,hrfEnabled:m}},je),hfe=e=>{const{height:t,hrfHeight:n,min:r,step:o,aspectRatio:s,hrfEnabled:i}=W(mfe),l=te(),u=Math.max(pfe(t),r),p=d.useCallback(h=>{if(l(zm(h)),s){const g=Gr(h*s,8);l(Fm(g))}},[l,s]),m=d.useCallback(()=>{if(l(zm(u)),s){const h=Gr(u*s,8);l(Fm(h))}},[l,u,s]);return a.jsx(jt,{label:"Initial Height",value:n,min:r,step:o,max:u,onChange:p,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:u},isDisabled:!i,...e})},gfe=d.memo(hfe),vfe=ce([we],({generation:e,hotkeys:t,config:n})=>{const{initial:r,min:o,sliderMax:s,inputMax:i,fineStep:l,coarseStep:u}=n.sd.hrfStrength,{hrfStrength:p,hrfEnabled:m}=e,h=t.shift?l:u;return{hrfStrength:p,initial:r,min:o,sliderMax:s,inputMax:i,step:h,hrfEnabled:m}},je),xfe=()=>{const{hrfStrength:e,initial:t,min:n,sliderMax:r,step:o,hrfEnabled:s}=W(vfe),i=te(),l=d.useCallback(()=>{i(tS(t))},[i,t]),u=d.useCallback(p=>{i(tS(p))},[i]);return a.jsx(jt,{label:"Denoising Strength","aria-label":"High Resolution Denoising Strength",min:n,max:r,step:o,value:e,onChange:u,withSliderMarks:!0,withInput:!0,withReset:!0,handleReset:l,isDisabled:!s})},bfe=d.memo(xfe);function yfe(){const e=te(),t=W(r=>r.generation.hrfEnabled),n=d.useCallback(r=>e(KT(r.target.checked)),[e]);return a.jsx(kr,{label:"Enable High Resolution Fix",isChecked:t,onChange:n})}function Cfe(e){return Math.floor((e-1)/8)*8}const wfe=ce([we],({generation:e,hotkeys:t,config:n})=>{const{min:r,fineStep:o,coarseStep:s}=n.sd.width,{model:i,width:l,hrfWidth:u,aspectRatio:p,hrfEnabled:m}=e,h=t.shift?o:s;return{model:i,width:l,hrfWidth:u,min:r,step:h,aspectRatio:p,hrfEnabled:m}},je),Sfe=e=>{const{width:t,hrfWidth:n,min:r,step:o,aspectRatio:s,hrfEnabled:i}=W(wfe),l=te(),u=Math.max(Cfe(t),r),p=d.useCallback(h=>{if(l(Fm(h)),s){const g=Gr(h/s,8);l(zm(g))}},[l,s]),m=d.useCallback(()=>{if(l(Fm(u)),s){const h=Gr(u/s,8);l(zm(h))}},[l,u,s]);return a.jsx(jt,{label:"Initial Width",value:n,min:r,step:o,max:u,onChange:p,handleReset:m,withInput:!0,withReset:!0,withSliderMarks:!0,sliderNumberInputProps:{max:u},isDisabled:!i,...e})},kfe=d.memo(Sfe),jfe=ce(we,e=>{const{hrfEnabled:t}=e.generation;return{hrfEnabled:t}},je);function _fe(){const{t:e}=J(),t=jn("hrf").isFeatureEnabled,{hrfEnabled:n}=W(jfe),r=d.useMemo(()=>{if(n)return e("common.on")},[e,n]);return t?a.jsx(Ao,{label:"High Resolution Fix",activeLabel:r,children:a.jsxs($,{sx:{flexDir:"column",gap:2},children:[a.jsx(yfe,{}),n&&a.jsxs($,{sx:{gap:2,p:4,borderRadius:4,flexDirection:"column",w:"full",bg:"base.100",_dark:{bg:"base.750"}},children:[a.jsx(kfe,{}),a.jsx(gfe,{})]}),n&&a.jsx(bfe,{})]})}):null}const Ife=()=>a.jsxs(a.Fragment,{children:[a.jsx(F2,{}),a.jsx(SR,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(B2,{}),a.jsx(_fe,{}),a.jsx(qu,{})]}),Pfe=d.memo(Ife),Efe=()=>{const{t:e}=J(),t=W(r=>r.ui.shouldUseSliders),{iterationsAndSeedLabel:n}=z2();return a.jsx(Ao,{label:e("parameters.general"),activeLabel:n,defaultIsOpen:!0,children:a.jsxs($,{sx:{flexDirection:"column",gap:3},children:[t?a.jsxs(a.Fragment,{children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}):a.jsxs(a.Fragment,{children:[a.jsxs($,{gap:3,children:[a.jsx(ua,{}),a.jsx(Na,{}),a.jsx(Da,{})]}),a.jsx(Ta,{}),a.jsx(De,{pt:2,children:a.jsx($a,{})}),a.jsx(Yh,{})]}),a.jsx(_R,{})]})})},Mfe=d.memo(Efe),Ofe=()=>a.jsxs(a.Fragment,{children:[a.jsx(F2,{}),a.jsx(Mfe,{}),a.jsx(Ku,{}),a.jsx(Gu,{}),a.jsx(Uu,{}),a.jsx(B2,{}),a.jsx(jR,{}),a.jsx(kR,{}),a.jsx(qu,{})]}),Rfe=d.memo(Ofe),Afe=()=>{const e=W(ro),t=W(n=>n.generation.model);return e==="txt2img"?a.jsx(Om,{children:t&&t.base_model==="sdxl"?a.jsx(fde,{}):a.jsx(Pfe,{})}):e==="img2img"?a.jsx(Om,{children:t&&t.base_model==="sdxl"?a.jsx(cde,{}):a.jsx(ffe,{})}):e==="unifiedCanvas"?a.jsx(Om,{children:t&&t.base_model==="sdxl"?a.jsx(tfe,{}):a.jsx(Rfe,{})}):null},Dfe=d.memo(Afe),Om=d.memo(e=>a.jsxs($,{sx:{w:"full",h:"full",flexDir:"column",gap:2},children:[a.jsx(O8,{}),a.jsx($,{layerStyle:"first",sx:{w:"full",h:"full",position:"relative",borderRadius:"base",p:2},children:a.jsx($,{sx:{w:"full",h:"full",position:"relative"},children:a.jsx(De,{sx:{position:"absolute",top:0,left:0,right:0,bottom:0},children:a.jsx(e0,{defer:!0,style:{height:"100%",width:"100%"},options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:800,theme:"os-theme-dark"},overflow:{x:"hidden"}},children:a.jsx($,{sx:{gap:2,flexDirection:"column",h:"full",w:"full"},children:e.children})})})})})]}));Om.displayName="ParametersPanelWrapper";const Tfe=ce([we],e=>{const{initialImage:t}=e.generation;return{initialImage:t,isResetButtonDisabled:!t}},je),Nfe=()=>{const{initialImage:e}=W(Tfe),{currentData:t}=Ps((e==null?void 0:e.imageName)??Os.skipToken),n=d.useMemo(()=>{if(t)return{id:"initial-image",payloadType:"IMAGE_DTO",payload:{imageDTO:t}}},[t]),r=d.useMemo(()=>({id:"initial-image",actionType:"SET_INITIAL_IMAGE"}),[]);return a.jsx(al,{imageDTO:t,droppableData:r,draggableData:n,isUploadDisabled:!0,fitContainer:!0,dropLabel:"Set as Initial Image",noContentFallback:a.jsx(eo,{label:"No initial image selected"}),dataTestId:"initial-image"})},$fe=d.memo(Nfe),Lfe=ce([we],e=>{const{initialImage:t}=e.generation;return{isResetButtonDisabled:!t}},je),zfe={type:"SET_INITIAL_IMAGE"},Ffe=()=>{const{isResetButtonDisabled:e}=W(Lfe),t=te(),{getUploadButtonProps:n,getUploadInputProps:r}=y2({postUploadAction:zfe}),o=d.useCallback(()=>{t(QT())},[t]);return a.jsxs($,{layerStyle:"first",sx:{position:"relative",flexDirection:"column",height:"full",width:"full",alignItems:"center",justifyContent:"center",borderRadius:"base",p:2,gap:4},children:[a.jsxs($,{sx:{w:"full",flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(Se,{sx:{ps:2,fontWeight:600,userSelect:"none",color:"base.700",_dark:{color:"base.200"}},children:"Initial Image"}),a.jsx(ki,{}),a.jsx(ot,{tooltip:"Upload Initial Image","aria-label":"Upload Initial Image",icon:a.jsx(Kg,{}),...n()}),a.jsx(ot,{tooltip:"Reset Initial Image","aria-label":"Reset Initial Image",icon:a.jsx(qg,{}),onClick:o,isDisabled:e})]}),a.jsx($fe,{}),a.jsx("input",{...r()})]})},Bfe=d.memo(Ffe),Hfe=e=>{const{onClick:t,isDisabled:n}=e,{t:r}=J(),o=W(s=>s.system.isConnected);return a.jsx(ot,{onClick:t,icon:a.jsx(qo,{}),tooltip:`${r("gallery.deleteImage")} (Del)`,"aria-label":`${r("gallery.deleteImage")} (Del)`,isDisabled:n||!o,colorScheme:"error"})},IR=()=>{const[e,{isLoading:t}]=sg({fixedCacheKey:"enqueueBatch"}),[n,{isLoading:r}]=eP({fixedCacheKey:"resumeProcessor"}),[o,{isLoading:s}]=JI({fixedCacheKey:"pauseProcessor"}),[i,{isLoading:l}]=Mb({fixedCacheKey:"cancelQueueItem"}),[u,{isLoading:p}]=YI({fixedCacheKey:"clearQueue"}),[m,{isLoading:h}]=lP({fixedCacheKey:"pruneQueue"});return t||r||s||l||p||h},Wfe=[{label:"RealESRGAN x2 Plus",value:"RealESRGAN_x2plus.pth",tooltip:"Attempts to retain sharpness, low smoothing",group:"x2 Upscalers"},{label:"RealESRGAN x4 Plus",value:"RealESRGAN_x4plus.pth",tooltip:"Best for photos and highly detailed images, medium smoothing",group:"x4 Upscalers"},{label:"RealESRGAN x4 Plus (anime 6B)",value:"RealESRGAN_x4plus_anime_6B.pth",tooltip:"Best for anime/manga, high smoothing",group:"x4 Upscalers"},{label:"ESRGAN SRx4",value:"ESRGAN_SRx4_DF2KOST_official-ff704c30.pth",tooltip:"Retains sharpness, low smoothing",group:"x4 Upscalers"}];function Vfe(){const e=W(r=>r.postprocessing.esrganModelName),t=te(),n=r=>t(XT(r));return a.jsx(Tr,{label:"ESRGAN Model",value:e,itemComponent:fl,onChange:n,data:Wfe})}const Ufe=e=>{const{imageDTO:t}=e,n=te(),r=IR(),{t:o}=J(),{isOpen:s,onOpen:i,onClose:l}=Uo(),{isAllowedToUpscale:u,detail:p}=YT(t),m=d.useCallback(()=>{l(),!(!t||!u)&&n(cP({imageDTO:t}))},[n,t,u,l]);return a.jsx(Hf,{isOpen:s,onClose:l,triggerComponent:a.jsx(ot,{tooltip:o("parameters.upscale"),onClick:i,icon:a.jsx(WM,{}),"aria-label":o("parameters.upscale")}),children:a.jsxs($,{sx:{flexDirection:"column",gap:4},children:[a.jsx(Vfe,{}),a.jsx(Mt,{tooltip:p,size:"sm",isDisabled:!t||r||!u,onClick:m,children:o("parameters.upscaleImage")})]})})},Gfe=d.memo(Ufe),qfe=ce([we,ro],({gallery:e,system:t,ui:n,config:r},o)=>{const{isConnected:s,shouldConfirmOnDelete:i,denoiseProgress:l}=t,{shouldShowImageDetails:u,shouldHidePreview:p,shouldShowProgressInViewer:m}=n,{shouldFetchMetadataFromApi:h}=r,g=e.selection[e.selection.length-1];return{shouldConfirmOnDelete:i,isConnected:s,shouldDisableToolbarButtons:!!(l!=null&&l.progress_image)||!g,shouldShowImageDetails:u,activeTabName:o,shouldHidePreview:p,shouldShowProgressInViewer:m,lastSelectedImage:g,shouldFetchMetadataFromApi:h}},{memoizeOptions:{resultEqualityCheck:Tn}}),Kfe=()=>{const e=te(),{isConnected:t,shouldDisableToolbarButtons:n,shouldShowImageDetails:r,lastSelectedImage:o,shouldShowProgressInViewer:s}=W(qfe),i=jn("upscaling").isFeatureEnabled,l=IR(),u=oc(),{t:p}=J(),{recallBothPrompts:m,recallSeed:h,recallAllParameters:g}=l0(),{currentData:x}=Ps((o==null?void 0:o.image_name)??Os.skipToken),{metadata:y,isLoading:b}=j2(o==null?void 0:o.image_name),{workflow:C,isLoading:S}=_2(o==null?void 0:o.workflow_id),j=d.useCallback(()=>{C&&e(Pb(C))},[e,C]),_=d.useCallback(()=>{g(y)},[y,g]);It("a",_,[y]);const P=d.useCallback(()=>{h(y==null?void 0:y.seed)},[y==null?void 0:y.seed,h]);It("s",P,[x]);const I=d.useCallback(()=>{m(y==null?void 0:y.positive_prompt,y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt)},[y==null?void 0:y.negative_prompt,y==null?void 0:y.positive_prompt,y==null?void 0:y.positive_style_prompt,y==null?void 0:y.negative_style_prompt,m]);It("p",I,[x]),It("w",j,[C]);const M=d.useCallback(()=>{e(C8()),e(rg(x))},[e,x]);It("shift+i",M,[x]);const O=d.useCallback(()=>{x&&e(cP({imageDTO:x}))},[e,x]),A=d.useCallback(()=>{x&&e(og([x]))},[e,x]);It("Shift+U",()=>{O()},{enabled:()=>!!(i&&!n&&t)},[i,x,n,t]);const D=d.useCallback(()=>e(JT(!r)),[e,r]);It("i",()=>{x?D():u({title:p("toast.metadataLoadFailed"),status:"error",duration:2500,isClosable:!0})},[x,r,u]),It("delete",()=>{A()},[e,x]);const R=d.useCallback(()=>{e(RI(!s))},[e,s]);return a.jsx(a.Fragment,{children:a.jsxs($,{sx:{flexWrap:"wrap",justifyContent:"center",alignItems:"center",gap:2},children:[a.jsx(zn,{isAttached:!0,isDisabled:n,children:a.jsxs(bg,{isLazy:!0,children:[a.jsx(yg,{as:ot,"aria-label":p("parameters.imageActions"),tooltip:p("parameters.imageActions"),isDisabled:!x,icon:a.jsx(Goe,{})}),a.jsx(Ul,{motionProps:fu,children:x&&a.jsx(w8,{imageDTO:x})})]})}),a.jsxs(zn,{isAttached:!0,isDisabled:n,children:[a.jsx(ot,{isLoading:S,icon:a.jsx(C2,{}),tooltip:`${p("nodes.loadWorkflow")} (W)`,"aria-label":`${p("nodes.loadWorkflow")} (W)`,isDisabled:!C,onClick:j}),a.jsx(ot,{isLoading:b,icon:a.jsx(QM,{}),tooltip:`${p("parameters.usePrompt")} (P)`,"aria-label":`${p("parameters.usePrompt")} (P)`,isDisabled:!(y!=null&&y.positive_prompt),onClick:I}),a.jsx(ot,{isLoading:b,icon:a.jsx(XM,{}),tooltip:`${p("parameters.useSeed")} (S)`,"aria-label":`${p("parameters.useSeed")} (S)`,isDisabled:(y==null?void 0:y.seed)===null||(y==null?void 0:y.seed)===void 0,onClick:P}),a.jsx(ot,{isLoading:b,icon:a.jsx(zM,{}),tooltip:`${p("parameters.useAll")} (A)`,"aria-label":`${p("parameters.useAll")} (A)`,isDisabled:!y,onClick:_})]}),i&&a.jsx(zn,{isAttached:!0,isDisabled:l,children:i&&a.jsx(Gfe,{imageDTO:x})}),a.jsx(zn,{isAttached:!0,children:a.jsx(ot,{icon:a.jsx(BM,{}),tooltip:`${p("parameters.info")} (I)`,"aria-label":`${p("parameters.info")} (I)`,isChecked:r,onClick:D})}),a.jsx(zn,{isAttached:!0,children:a.jsx(ot,{"aria-label":p("settings.displayInProgress"),tooltip:p("settings.displayInProgress"),icon:a.jsx(hee,{}),isChecked:s,onClick:R})}),a.jsx(zn,{isAttached:!0,children:a.jsx(Hfe,{onClick:A})})]})})},Qfe=d.memo(Kfe),Xfe=ce([we,Eb],(e,t)=>{var j,_;const{data:n,status:r}=ZT.endpoints.listImages.select(t)(e),{data:o}=e.gallery.galleryView==="images"?nS.endpoints.getBoardImagesTotal.select(t.board_id??"none")(e):nS.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(e),s=e.gallery.selection[e.gallery.selection.length-1],i=r==="pending";if(!n||!s||(o==null?void 0:o.total)===0)return{isFetching:i,queryArgs:t,isOnFirstImage:!0,isOnLastImage:!0};const l={...t,offset:n.ids.length,limit:XI},u=eN.getSelectors(),p=u.selectAll(n),m=p.findIndex(P=>P.image_name===s.image_name),h=Fl(m+1,0,p.length-1),g=Fl(m-1,0,p.length-1),x=(j=p[h])==null?void 0:j.image_name,y=(_=p[g])==null?void 0:_.image_name,b=x?u.selectById(n,x):void 0,C=y?u.selectById(n,y):void 0,S=p.length;return{loadedImagesCount:p.length,currentImageIndex:m,areMoreImagesAvailable:((o==null?void 0:o.total)??0)>S,isFetching:r==="pending",nextImage:b,prevImage:C,queryArgs:l}},{memoizeOptions:{resultEqualityCheck:Tn}}),PR=()=>{const e=te(),{nextImage:t,prevImage:n,areMoreImagesAvailable:r,isFetching:o,queryArgs:s,loadedImagesCount:i,currentImageIndex:l}=W(Xfe),u=d.useCallback(()=>{n&&e(rS(n))},[e,n]),p=d.useCallback(()=>{t&&e(rS(t))},[e,t]),[m]=QI(),h=d.useCallback(()=>{m(s)},[m,s]);return{handlePrevImage:u,handleNextImage:p,isOnFirstImage:l===0,isOnLastImage:l!==void 0&&l===i-1,nextImage:t,prevImage:n,areMoreImagesAvailable:r,handleLoadMoreImages:h,isFetching:o}};function Yfe(e){return Qe({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M245.09 327.74v-37.32c57.07 0 84.51 13.47 108.58 38.68 5.4 5.65 15 1.32 14.29-6.43-5.45-61.45-34.14-117.09-122.87-117.09v-37.32a8.32 8.32 0 00-14.05-6L146.58 242a8.2 8.2 0 000 11.94L231 333.71a8.32 8.32 0 0014.09-5.97z"}},{tag:"path",attr:{fill:"none",strokeMiterlimit:"10",strokeWidth:"32",d:"M256 64C150 64 64 150 64 256s86 192 192 192 192-86 192-192S362 64 256 64z"}}]})(e)}const Jfe=({label:e,value:t,onClick:n,isLink:r,labelPosition:o,withCopy:s=!1})=>{const{t:i}=J();return t?a.jsxs($,{gap:2,children:[n&&a.jsx(Fn,{label:`Recall ${e}`,children:a.jsx(Pa,{"aria-label":i("accessibility.useThisParameter"),icon:a.jsx(Yfe,{}),size:"xs",variant:"ghost",fontSize:20,onClick:n})}),s&&a.jsx(Fn,{label:`Copy ${e}`,children:a.jsx(Pa,{"aria-label":`Copy ${e}`,icon:a.jsx(Lu,{}),size:"xs",variant:"ghost",fontSize:14,onClick:()=>navigator.clipboard.writeText(t.toString())})}),a.jsxs($,{direction:o?"column":"row",children:[a.jsxs(Se,{fontWeight:"semibold",whiteSpace:"pre-wrap",pr:2,children:[e,":"]}),r?a.jsxs(vg,{href:t.toString(),isExternal:!0,wordBreak:"break-all",children:[t.toString()," ",a.jsx(DO,{mx:"2px"})]}):a.jsx(Se,{overflowY:"scroll",wordBreak:"break-all",children:t.toString()})]})]}):null},go=d.memo(Jfe),Zfe=e=>{const{metadata:t}=e,{t:n}=J(),{recallPositivePrompt:r,recallNegativePrompt:o,recallSeed:s,recallCfgScale:i,recallModel:l,recallScheduler:u,recallSteps:p,recallWidth:m,recallHeight:h,recallStrength:g,recallLoRA:x,recallControlNet:y,recallIPAdapter:b,recallT2IAdapter:C}=l0(),S=d.useCallback(()=>{r(t==null?void 0:t.positive_prompt)},[t==null?void 0:t.positive_prompt,r]),j=d.useCallback(()=>{o(t==null?void 0:t.negative_prompt)},[t==null?void 0:t.negative_prompt,o]),_=d.useCallback(()=>{s(t==null?void 0:t.seed)},[t==null?void 0:t.seed,s]),P=d.useCallback(()=>{l(t==null?void 0:t.model)},[t==null?void 0:t.model,l]),I=d.useCallback(()=>{m(t==null?void 0:t.width)},[t==null?void 0:t.width,m]),M=d.useCallback(()=>{h(t==null?void 0:t.height)},[t==null?void 0:t.height,h]),O=d.useCallback(()=>{u(t==null?void 0:t.scheduler)},[t==null?void 0:t.scheduler,u]),A=d.useCallback(()=>{p(t==null?void 0:t.steps)},[t==null?void 0:t.steps,p]),D=d.useCallback(()=>{i(t==null?void 0:t.cfg_scale)},[t==null?void 0:t.cfg_scale,i]),R=d.useCallback(()=>{g(t==null?void 0:t.strength)},[t==null?void 0:t.strength,g]),N=d.useCallback(G=>{x(G)},[x]),Y=d.useCallback(G=>{y(G)},[y]),F=d.useCallback(G=>{b(G)},[b]),V=d.useCallback(G=>{C(G)},[C]),Q=d.useMemo(()=>t!=null&&t.controlnets?t.controlnets.filter(G=>$m(G.control_model)):[],[t==null?void 0:t.controlnets]),q=d.useMemo(()=>t!=null&&t.ipAdapters?t.ipAdapters.filter(G=>$m(G.ip_adapter_model)):[],[t==null?void 0:t.ipAdapters]),z=d.useMemo(()=>t!=null&&t.t2iAdapters?t.t2iAdapters.filter(G=>tN(G.t2i_adapter_model)):[],[t==null?void 0:t.t2iAdapters]);return!t||Object.keys(t).length===0?null:a.jsxs(a.Fragment,{children:[t.created_by&&a.jsx(go,{label:n("metadata.createdBy"),value:t.created_by}),t.generation_mode&&a.jsx(go,{label:n("metadata.generationMode"),value:t.generation_mode}),t.positive_prompt&&a.jsx(go,{label:n("metadata.positivePrompt"),labelPosition:"top",value:t.positive_prompt,onClick:S}),t.negative_prompt&&a.jsx(go,{label:n("metadata.negativePrompt"),labelPosition:"top",value:t.negative_prompt,onClick:j}),t.seed!==void 0&&t.seed!==null&&a.jsx(go,{label:n("metadata.seed"),value:t.seed,onClick:_}),t.model!==void 0&&t.model!==null&&t.model.model_name&&a.jsx(go,{label:n("metadata.model"),value:t.model.model_name,onClick:P}),t.width&&a.jsx(go,{label:n("metadata.width"),value:t.width,onClick:I}),t.height&&a.jsx(go,{label:n("metadata.height"),value:t.height,onClick:M}),t.scheduler&&a.jsx(go,{label:n("metadata.scheduler"),value:t.scheduler,onClick:O}),t.steps&&a.jsx(go,{label:n("metadata.steps"),value:t.steps,onClick:A}),t.cfg_scale!==void 0&&t.cfg_scale!==null&&a.jsx(go,{label:n("metadata.cfgScale"),value:t.cfg_scale,onClick:D}),t.strength&&a.jsx(go,{label:n("metadata.strength"),value:t.strength,onClick:R}),t.loras&&t.loras.map((G,T)=>{if(NI(G.lora))return a.jsx(go,{label:"LoRA",value:`${G.lora.model_name} - ${G.weight}`,onClick:()=>N(G)},T)}),Q.map((G,T)=>{var B;return a.jsx(go,{label:"ControlNet",value:`${(B=G.control_model)==null?void 0:B.model_name} - ${G.control_weight}`,onClick:()=>Y(G)},T)}),q.map((G,T)=>{var B;return a.jsx(go,{label:"IP Adapter",value:`${(B=G.ip_adapter_model)==null?void 0:B.model_name} - ${G.weight}`,onClick:()=>F(G)},T)}),z.map((G,T)=>{var B;return a.jsx(go,{label:"T2I Adapter",value:`${(B=G.t2i_adapter_model)==null?void 0:B.model_name} - ${G.weight}`,onClick:()=>V(G)},T)})]})},epe=d.memo(Zfe),tpe=({image:e})=>{const{t}=J(),{metadata:n}=j2(e.image_name),{workflow:r}=_2(e.workflow_id);return a.jsxs($,{layerStyle:"first",sx:{padding:4,gap:1,flexDirection:"column",width:"full",height:"full",borderRadius:"base",position:"absolute",overflow:"hidden"},children:[a.jsxs($,{gap:2,children:[a.jsx(Se,{fontWeight:"semibold",children:"File:"}),a.jsxs(vg,{href:e.image_url,isExternal:!0,maxW:"calc(100% - 3rem)",children:[e.image_name,a.jsx(DO,{mx:"2px"})]})]}),a.jsxs(nc,{variant:"line",sx:{display:"flex",flexDir:"column",w:"full",h:"full"},children:[a.jsxs(rc,{children:[a.jsx(Po,{children:t("metadata.recallParameters")}),a.jsx(Po,{children:t("metadata.metadata")}),a.jsx(Po,{children:t("metadata.imageDetails")}),a.jsx(Po,{children:t("metadata.workflow")})]}),a.jsxs(Tu,{children:[a.jsx(ss,{children:n?a.jsx(Hu,{children:a.jsx(epe,{metadata:n})}):a.jsx(eo,{label:t("metadata.noRecallParameters")})}),a.jsx(ss,{children:n?a.jsx(Zi,{data:n,label:t("metadata.metadata")}):a.jsx(eo,{label:t("metadata.noMetaData")})}),a.jsx(ss,{children:e?a.jsx(Zi,{data:e,label:t("metadata.imageDetails")}):a.jsx(eo,{label:t("metadata.noImageDetails")})}),a.jsx(ss,{children:r?a.jsx(Zi,{data:r,label:t("metadata.workflow")}):a.jsx(eo,{label:t("nodes.noWorkflow")})})]})]})]})},npe=d.memo(tpe),_1={color:"base.100",pointerEvents:"auto"},rpe=()=>{const{t:e}=J(),{handlePrevImage:t,handleNextImage:n,isOnFirstImage:r,isOnLastImage:o,handleLoadMoreImages:s,areMoreImagesAvailable:i,isFetching:l}=PR();return a.jsxs(De,{sx:{position:"relative",height:"100%",width:"100%"},children:[a.jsx(De,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineStart:0},children:!r&&a.jsx(Pa,{"aria-label":e("accessibility.previousImage"),icon:a.jsx(XZ,{size:64}),variant:"unstyled",onClick:t,boxSize:16,sx:_1})}),a.jsxs(De,{sx:{pos:"absolute",top:"50%",transform:"translate(0, -50%)",insetInlineEnd:0},children:[!o&&a.jsx(Pa,{"aria-label":e("accessibility.nextImage"),icon:a.jsx(YZ,{size:64}),variant:"unstyled",onClick:n,boxSize:16,sx:_1}),o&&i&&!l&&a.jsx(Pa,{"aria-label":e("accessibility.loadMore"),icon:a.jsx(QZ,{size:64}),variant:"unstyled",onClick:s,boxSize:16,sx:_1}),o&&i&&l&&a.jsx($,{sx:{w:16,h:16,alignItems:"center",justifyContent:"center"},children:a.jsx(vi,{opacity:.5,size:"xl"})})]})]})},ER=d.memo(rpe),ope=ce([we,nN],({ui:e,system:t},n)=>{const{shouldShowImageDetails:r,shouldHidePreview:o,shouldShowProgressInViewer:s}=e,{denoiseProgress:i,shouldAntialiasProgressImage:l}=t;return{shouldShowImageDetails:r,shouldHidePreview:o,imageName:n==null?void 0:n.image_name,denoiseProgress:i,shouldShowProgressInViewer:s,shouldAntialiasProgressImage:l}},{memoizeOptions:{resultEqualityCheck:Tn}}),spe=()=>{const{shouldShowImageDetails:e,imageName:t,denoiseProgress:n,shouldShowProgressInViewer:r,shouldAntialiasProgressImage:o}=W(ope),{handlePrevImage:s,handleNextImage:i,isOnLastImage:l,handleLoadMoreImages:u,areMoreImagesAvailable:p,isFetching:m}=PR();It("left",()=>{s()},[s]),It("right",()=>{if(l&&p&&!m){u();return}l||i()},[l,p,u,m,i]);const{currentData:h}=Ps(t??Os.skipToken),g=d.useMemo(()=>{if(h)return{id:"current-image",payloadType:"IMAGE_DTO",payload:{imageDTO:h}}},[h]),x=d.useMemo(()=>({id:"current-image",actionType:"SET_CURRENT_IMAGE"}),[]),[y,b]=d.useState(!1),C=d.useRef(0),{t:S}=J(),j=d.useCallback(()=>{b(!0),window.clearTimeout(C.current)},[]),_=d.useCallback(()=>{C.current=window.setTimeout(()=>{b(!1)},500)},[]);return a.jsxs($,{onMouseOver:j,onMouseOut:_,sx:{width:"full",height:"full",alignItems:"center",justifyContent:"center",position:"relative"},children:[n!=null&&n.progress_image&&r?a.jsx(wi,{src:n.progress_image.dataURL,width:n.progress_image.width,height:n.progress_image.height,draggable:!1,"data-testid":"progress-image",sx:{objectFit:"contain",maxWidth:"full",maxHeight:"full",height:"auto",position:"absolute",borderRadius:"base",imageRendering:o?"auto":"pixelated"}}):a.jsx(al,{imageDTO:h,droppableData:x,draggableData:g,isUploadDisabled:!0,fitContainer:!0,useThumbailFallback:!0,dropLabel:S("gallery.setCurrentImage"),noContentFallback:a.jsx(eo,{icon:Xl,label:"No image selected"}),dataTestId:"image-preview"}),e&&h&&a.jsx(De,{sx:{position:"absolute",top:"0",width:"full",height:"full",borderRadius:"base"},children:a.jsx(npe,{image:h})}),a.jsx(yo,{children:!e&&h&&y&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:"0",width:"100%",height:"100%",pointerEvents:"none"},children:a.jsx(ER,{})},"nextPrevButtons")})]})},ape=d.memo(spe),ipe=()=>a.jsxs($,{sx:{position:"relative",flexDirection:"column",height:"100%",width:"100%",rowGap:4,alignItems:"center",justifyContent:"center"},children:[a.jsx(Qfe,{}),a.jsx(ape,{})]}),lpe=d.memo(ipe),cpe=()=>a.jsx(De,{layerStyle:"first",sx:{position:"relative",width:"100%",height:"100%",p:2,borderRadius:"base"},children:a.jsx($,{sx:{width:"100%",height:"100%"},children:a.jsx(lpe,{})})}),MR=d.memo(cpe),upe=()=>{const e=d.useRef(null),t=d.useCallback(()=>{e.current&&e.current.setLayout([50,50])},[]),n=R2();return a.jsx(De,{sx:{w:"full",h:"full"},children:a.jsxs(f0,{ref:e,autoSaveId:"imageTab.content",direction:"horizontal",style:{height:"100%",width:"100%"},storage:n,units:"percentages",children:[a.jsx(Ji,{id:"imageTab.content.initImage",order:0,defaultSize:50,minSize:25,style:{position:"relative"},children:a.jsx(Bfe,{})}),a.jsx(Qh,{onDoubleClick:t}),a.jsx(Ji,{id:"imageTab.content.selectedImage",order:1,defaultSize:50,minSize:25,children:a.jsx(MR,{})})]})})},dpe=d.memo(upe);var fpe=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,o,s;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(o=r;o--!==0;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(s=Object.keys(t),r=s.length,r!==Object.keys(n).length)return!1;for(o=r;o--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[o]))return!1;for(o=r;o--!==0;){var i=s[o];if(!e(t[i],n[i]))return!1}return!0}return t!==t&&n!==n};const T_=pf(fpe);function rb(e){return e===null||typeof e!="object"?{}:Object.keys(e).reduce((t,n)=>{const r=e[n];return r!=null&&r!==!1&&(t[n]=r),t},{})}var ppe=Object.defineProperty,N_=Object.getOwnPropertySymbols,mpe=Object.prototype.hasOwnProperty,hpe=Object.prototype.propertyIsEnumerable,$_=(e,t,n)=>t in e?ppe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,gpe=(e,t)=>{for(var n in t||(t={}))mpe.call(t,n)&&$_(e,n,t[n]);if(N_)for(var n of N_(t))hpe.call(t,n)&&$_(e,n,t[n]);return e};function OR(e,t){if(t===null||typeof t!="object")return{};const n=gpe({},t);return Object.keys(t).forEach(r=>{r.includes(`${String(e)}.`)&&delete n[r]}),n}const vpe="__MANTINE_FORM_INDEX__";function L_(e,t){return t?typeof t=="boolean"?t:Array.isArray(t)?t.includes(e.replace(/[.][0-9]/g,`.${vpe}`)):!1:!1}function z_(e,t,n){typeof n.value=="object"&&(n.value=Qc(n.value)),!n.enumerable||n.get||n.set||!n.configurable||!n.writable||t==="__proto__"?Object.defineProperty(e,t,n):e[t]=n.value}function Qc(e){if(typeof e!="object")return e;var t=0,n,r,o,s=Object.prototype.toString.call(e);if(s==="[object Object]"?o=Object.create(e.__proto__||null):s==="[object Array]"?o=Array(e.length):s==="[object Set]"?(o=new Set,e.forEach(function(i){o.add(Qc(i))})):s==="[object Map]"?(o=new Map,e.forEach(function(i,l){o.set(Qc(l),Qc(i))})):s==="[object Date]"?o=new Date(+e):s==="[object RegExp]"?o=new RegExp(e.source,e.flags):s==="[object DataView]"?o=new e.constructor(Qc(e.buffer)):s==="[object ArrayBuffer]"?o=e.slice(0):s.slice(-6)==="Array]"&&(o=new e.constructor(e)),o){for(r=Object.getOwnPropertySymbols(e);t0,errors:t}}function ob(e,t,n="",r={}){return typeof e!="object"||e===null?r:Object.keys(e).reduce((o,s)=>{const i=e[s],l=`${n===""?"":`${n}.`}${s}`,u=ni(l,t);let p=!1;return typeof i=="function"&&(o[l]=i(u,t,l)),typeof i=="object"&&Array.isArray(u)&&(p=!0,u.forEach((m,h)=>ob(i,t,`${l}.${h}`,o))),typeof i=="object"&&typeof u=="object"&&u!==null&&(p||ob(i,t,l,o)),o},r)}function sb(e,t){return F_(typeof e=="function"?e(t):ob(e,t))}function gm(e,t,n){if(typeof e!="string")return{hasError:!1,error:null};const r=sb(t,n),o=Object.keys(r.errors).find(s=>e.split(".").every((i,l)=>i===s.split(".")[l]));return{hasError:!!o,error:o?r.errors[o]:null}}function xpe(e,{from:t,to:n},r){const o=ni(e,r);if(!Array.isArray(o))return r;const s=[...o],i=o[t];return s.splice(t,1),s.splice(n,0,i),b0(e,s,r)}var bpe=Object.defineProperty,B_=Object.getOwnPropertySymbols,ype=Object.prototype.hasOwnProperty,Cpe=Object.prototype.propertyIsEnumerable,H_=(e,t,n)=>t in e?bpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,wpe=(e,t)=>{for(var n in t||(t={}))ype.call(t,n)&&H_(e,n,t[n]);if(B_)for(var n of B_(t))Cpe.call(t,n)&&H_(e,n,t[n]);return e};function Spe(e,{from:t,to:n},r){const o=`${e}.${t}`,s=`${e}.${n}`,i=wpe({},r);return Object.keys(r).every(l=>{let u,p;if(l.startsWith(o)&&(u=l,p=l.replace(o,s)),l.startsWith(s)&&(u=l.replace(s,o),p=l),u&&p){const m=i[u],h=i[p];return h===void 0?delete i[u]:i[u]=h,m===void 0?delete i[p]:i[p]=m,!1}return!0}),i}function kpe(e,t,n){const r=ni(e,n);return Array.isArray(r)?b0(e,r.filter((o,s)=>s!==t),n):n}var jpe=Object.defineProperty,W_=Object.getOwnPropertySymbols,_pe=Object.prototype.hasOwnProperty,Ipe=Object.prototype.propertyIsEnumerable,V_=(e,t,n)=>t in e?jpe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ppe=(e,t)=>{for(var n in t||(t={}))_pe.call(t,n)&&V_(e,n,t[n]);if(W_)for(var n of W_(t))Ipe.call(t,n)&&V_(e,n,t[n]);return e};function U_(e,t){const n=e.substring(t.length+1).split(".")[0];return parseInt(n,10)}function G_(e,t,n,r){if(t===void 0)return n;const o=`${String(e)}`;let s=n;r===-1&&(s=OR(`${o}.${t}`,s));const i=Ppe({},s),l=new Set;return Object.entries(s).filter(([u])=>{if(!u.startsWith(`${o}.`))return!1;const p=U_(u,o);return Number.isNaN(p)?!1:p>=t}).forEach(([u,p])=>{const m=U_(u,o),h=u.replace(`${o}.${m}`,`${o}.${m+r}`);i[h]=p,l.add(h),l.has(u)||delete i[u]}),i}function Epe(e,t,n,r){const o=ni(e,r);if(!Array.isArray(o))return r;const s=[...o];return s.splice(typeof n=="number"?n:s.length,0,t),b0(e,s,r)}function q_(e,t){const n=Object.keys(e);if(typeof t=="string"){const r=n.filter(o=>o.startsWith(`${t}.`));return e[t]||r.some(o=>e[o])||!1}return n.some(r=>e[r])}function Mpe(e){return t=>{if(!t)e(t);else if(typeof t=="function")e(t);else if(typeof t=="object"&&"nativeEvent"in t){const{currentTarget:n}=t;n instanceof HTMLInputElement?n.type==="checkbox"?e(n.checked):e(n.value):(n instanceof HTMLTextAreaElement||n instanceof HTMLSelectElement)&&e(n.value)}else e(t)}}var Ope=Object.defineProperty,Rpe=Object.defineProperties,Ape=Object.getOwnPropertyDescriptors,K_=Object.getOwnPropertySymbols,Dpe=Object.prototype.hasOwnProperty,Tpe=Object.prototype.propertyIsEnumerable,Q_=(e,t,n)=>t in e?Ope(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zi=(e,t)=>{for(var n in t||(t={}))Dpe.call(t,n)&&Q_(e,n,t[n]);if(K_)for(var n of K_(t))Tpe.call(t,n)&&Q_(e,n,t[n]);return e},I1=(e,t)=>Rpe(e,Ape(t));function uc({initialValues:e={},initialErrors:t={},initialDirty:n={},initialTouched:r={},clearInputErrorOnChange:o=!0,validateInputOnChange:s=!1,validateInputOnBlur:i=!1,transformValues:l=p=>p,validate:u}={}){const[p,m]=d.useState(r),[h,g]=d.useState(n),[x,y]=d.useState(e),[b,C]=d.useState(rb(t)),S=d.useRef(e),j=K=>{S.current=K},_=d.useCallback(()=>m({}),[]),P=K=>{const U=K?zi(zi({},x),K):x;j(U),g({})},I=d.useCallback(K=>C(U=>rb(typeof K=="function"?K(U):K)),[]),M=d.useCallback(()=>C({}),[]),O=d.useCallback(()=>{y(e),M(),j(e),g({}),_()},[]),A=d.useCallback((K,U)=>I(ee=>I1(zi({},ee),{[K]:U})),[]),D=d.useCallback(K=>I(U=>{if(typeof K!="string")return U;const ee=zi({},U);return delete ee[K],ee}),[]),R=d.useCallback(K=>g(U=>{if(typeof K!="string")return U;const ee=OR(K,U);return delete ee[K],ee}),[]),N=d.useCallback((K,U)=>{const ee=L_(K,s);R(K),m(de=>I1(zi({},de),{[K]:!0})),y(de=>{const Z=b0(K,U,de);if(ee){const ue=gm(K,u,Z);ue.hasError?A(K,ue.error):D(K)}return Z}),!ee&&o&&A(K,null)},[]),Y=d.useCallback(K=>{y(U=>{const ee=typeof K=="function"?K(U):K;return zi(zi({},U),ee)}),o&&M()},[]),F=d.useCallback((K,U)=>{R(K),y(ee=>xpe(K,U,ee)),C(ee=>Spe(K,U,ee))},[]),V=d.useCallback((K,U)=>{R(K),y(ee=>kpe(K,U,ee)),C(ee=>G_(K,U,ee,-1))},[]),Q=d.useCallback((K,U,ee)=>{R(K),y(de=>Epe(K,U,ee,de)),C(de=>G_(K,ee,de,1))},[]),q=d.useCallback(()=>{const K=sb(u,x);return C(K.errors),K},[x,u]),z=d.useCallback(K=>{const U=gm(K,u,x);return U.hasError?A(K,U.error):D(K),U},[x,u]),G=(K,{type:U="input",withError:ee=!0,withFocus:de=!0}={})=>{const ue={onChange:Mpe(fe=>N(K,fe))};return ee&&(ue.error=b[K]),U==="checkbox"?ue.checked=ni(K,x):ue.value=ni(K,x),de&&(ue.onFocus=()=>m(fe=>I1(zi({},fe),{[K]:!0})),ue.onBlur=()=>{if(L_(K,i)){const fe=gm(K,u,x);fe.hasError?A(K,fe.error):D(K)}}),ue},T=(K,U)=>ee=>{ee==null||ee.preventDefault();const de=q();de.hasErrors?U==null||U(de.errors,x,ee):K==null||K(l(x),ee)},B=K=>l(K||x),X=d.useCallback(K=>{K.preventDefault(),O()},[]),re=K=>{if(K){const ee=ni(K,h);if(typeof ee=="boolean")return ee;const de=ni(K,x),Z=ni(K,S.current);return!T_(de,Z)}return Object.keys(h).length>0?q_(h):!T_(x,S.current)},le=d.useCallback(K=>q_(p,K),[p]),se=d.useCallback(K=>K?!gm(K,u,x).hasError:!sb(u,x).hasErrors,[x,u]);return{values:x,errors:b,setValues:Y,setErrors:I,setFieldValue:N,setFieldError:A,clearFieldError:D,clearErrors:M,reset:O,validate:q,validateField:z,reorderListItem:F,removeListItem:V,insertListItem:Q,getInputProps:G,onSubmit:T,onReset:X,isDirty:re,isTouched:le,setTouched:m,setDirty:g,resetTouched:_,resetDirty:P,isValid:se,getTransformedValues:B}}function Er(e){const{...t}=e,{base50:n,base100:r,base200:o,base300:s,base800:i,base700:l,base900:u,accent500:p,accent300:m}=zf(),{colorMode:h}=Ci();return a.jsx(EM,{styles:()=>({input:{color:Ke(u,r)(h),backgroundColor:Ke(n,u)(h),borderColor:Ke(o,i)(h),borderWidth:2,outline:"none",":focus":{borderColor:Ke(m,p)(h)}},label:{color:Ke(l,s)(h),fontWeight:"normal",marginBottom:4}}),...t})}const Npe=[{value:"sd-1",label:gr["sd-1"]},{value:"sd-2",label:gr["sd-2"]},{value:"sdxl",label:gr.sdxl},{value:"sdxl-refiner",label:gr["sdxl-refiner"]}];function Gf(e){const{...t}=e,{t:n}=J();return a.jsx(Tr,{label:n("modelManager.baseModel"),data:Npe,...t})}function AR(e){const{data:t}=uP(),{...n}=e;return a.jsx(Tr,{label:"Config File",placeholder:"Select A Config File",data:t||[],...n})}const $pe=[{value:"normal",label:"Normal"},{value:"inpaint",label:"Inpaint"},{value:"depth",label:"Depth"}];function y0(e){const{...t}=e,{t:n}=J();return a.jsx(Tr,{label:n("modelManager.variant"),data:$pe,...t})}function Jh(e,t=!0){let n;t?n=new RegExp("[^\\\\/]+(?=\\.)"):n=new RegExp("[^\\\\/]+(?=[\\\\/]?$)");const r=e.match(n);return r?r[0]:""}function DR(e){const{t}=J(),n=te(),{model_path:r}=e,o=uc({initialValues:{model_name:r?Jh(r):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"checkpoint",error:void 0,vae:"",variant:"normal",config:"configs\\stable-diffusion\\v1-inference.yaml"}}),[s]=dP(),[i,l]=d.useState(!1),u=p=>{s({body:p}).unwrap().then(m=>{n($t(Gn({title:t("modelManager.modelAdded",{modelName:p.model_name}),status:"success"}))),o.reset(),r&&n(xf(null))}).catch(m=>{m&&n($t(Gn({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(p=>u(p)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",gap:2,children:[a.jsx(Er,{label:t("modelManager.model"),required:!0,...o.getInputProps("model_name")}),a.jsx(Gf,{label:t("modelManager.baseModel"),...o.getInputProps("base_model")}),a.jsx(Er,{label:t("modelManager.modelLocation"),required:!0,...o.getInputProps("path"),onBlur:p=>{if(o.values.model_name===""){const m=Jh(p.currentTarget.value);m&&o.setFieldValue("model_name",m)}}}),a.jsx(Er,{label:t("modelManager.description"),...o.getInputProps("description")}),a.jsx(Er,{label:t("modelManager.vaeLocation"),...o.getInputProps("vae")}),a.jsx(y0,{label:t("modelManager.variant"),...o.getInputProps("variant")}),a.jsxs($,{flexDirection:"column",width:"100%",gap:2,children:[i?a.jsx(Er,{required:!0,label:t("modelManager.customConfigFileLocation"),...o.getInputProps("config")}):a.jsx(AR,{required:!0,width:"100%",...o.getInputProps("config")}),a.jsx(Io,{isChecked:i,onChange:()=>l(!i),label:t("modelManager.useCustomConfig")}),a.jsx(Mt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})]})})}function TR(e){const{t}=J(),n=te(),{model_path:r}=e,[o]=dP(),s=uc({initialValues:{model_name:r?Jh(r,!1):"",base_model:"sd-1",model_type:"main",path:r||"",description:"",model_format:"diffusers",error:void 0,vae:"",variant:"normal"}}),i=l=>{o({body:l}).unwrap().then(u=>{n($t(Gn({title:t("modelManager.modelAdded",{modelName:l.model_name}),status:"success"}))),s.reset(),r&&n(xf(null))}).catch(u=>{u&&n($t(Gn({title:t("toast.modelAddFailed"),status:"error"})))})};return a.jsx("form",{onSubmit:s.onSubmit(l=>i(l)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",gap:2,children:[a.jsx(Er,{required:!0,label:t("modelManager.model"),...s.getInputProps("model_name")}),a.jsx(Gf,{label:t("modelManager.baseModel"),...s.getInputProps("base_model")}),a.jsx(Er,{required:!0,label:t("modelManager.modelLocation"),placeholder:t("modelManager.modelLocationValidationMsg"),...s.getInputProps("path"),onBlur:l=>{if(s.values.model_name===""){const u=Jh(l.currentTarget.value,!1);u&&s.setFieldValue("model_name",u)}}}),a.jsx(Er,{label:t("modelManager.description"),...s.getInputProps("description")}),a.jsx(Er,{label:t("modelManager.vaeLocation"),...s.getInputProps("vae")}),a.jsx(y0,{label:t("modelManager.variant"),...s.getInputProps("variant")}),a.jsx(Mt,{mt:2,type:"submit",children:t("modelManager.addModel")})]})})}const NR=[{label:"Diffusers",value:"diffusers"},{label:"Checkpoint / Safetensors",value:"checkpoint"}];function Lpe(){const[e,t]=d.useState("diffusers"),{t:n}=J();return a.jsxs($,{flexDirection:"column",gap:4,width:"100%",children:[a.jsx(Tr,{label:n("modelManager.modelType"),value:e,data:NR,onChange:r=>{r&&t(r)}}),a.jsxs($,{sx:{p:4,borderRadius:4,bg:"base.300",_dark:{bg:"base.850"}},children:[e==="diffusers"&&a.jsx(TR,{}),e==="checkpoint"&&a.jsx(DR,{})]})]})}const zpe=[{label:"None",value:"none"},{label:"v_prediction",value:"v_prediction"},{label:"epsilon",value:"epsilon"},{label:"sample",value:"sample"}];function Fpe(){const e=te(),{t}=J(),[n,{isLoading:r}]=fP(),o=uc({initialValues:{location:"",prediction_type:void 0}}),s=i=>{const l={location:i.location,prediction_type:i.prediction_type==="none"?void 0:i.prediction_type};n({body:l}).unwrap().then(u=>{e($t(Gn({title:t("toast.modelAddedSimple"),status:"success"}))),o.reset()}).catch(u=>{u&&e($t(Gn({title:`${u.data.detail} `,status:"error"})))})};return a.jsx("form",{onSubmit:o.onSubmit(i=>s(i)),style:{width:"100%"},children:a.jsxs($,{flexDirection:"column",width:"100%",gap:4,children:[a.jsx(Er,{label:t("modelManager.modelLocation"),placeholder:t("modelManager.simpleModelDesc"),w:"100%",...o.getInputProps("location")}),a.jsx(Tr,{label:t("modelManager.predictionType"),data:zpe,defaultValue:"none",...o.getInputProps("prediction_type")}),a.jsx(Mt,{type:"submit",isLoading:r,children:t("modelManager.addModel")})]})})}function Bpe(){const[e,t]=d.useState("simple");return a.jsxs($,{flexDirection:"column",width:"100%",overflow:"scroll",maxHeight:window.innerHeight-250,gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Mt,{size:"sm",isChecked:e=="simple",onClick:()=>t("simple"),children:"Simple"}),a.jsx(Mt,{size:"sm",isChecked:e=="advanced",onClick:()=>t("advanced"),children:"Advanced"})]}),a.jsxs($,{sx:{p:4,borderRadius:4,background:"base.200",_dark:{background:"base.800"}},children:[e==="simple"&&a.jsx(Fpe,{}),e==="advanced"&&a.jsx(Lpe,{})]})]})}function Hpe(e){const{...t}=e;return a.jsx(wE,{w:"100%",...t,children:e.children})}function Wpe(){const e=W(b=>b.modelmanager.searchFolder),[t,n]=d.useState(""),{data:r}=na(Ml),{foundModels:o,alreadyInstalled:s,filteredModels:i}=pP({search_path:e||""},{selectFromResult:({data:b})=>{const C=y$(r==null?void 0:r.entities),S=Ro(C,"path"),j=h$(b,S),_=j$(b,S);return{foundModels:b,alreadyInstalled:X_(_,t),filteredModels:X_(j,t)}}}),[l,{isLoading:u}]=fP(),p=te(),{t:m}=J(),h=d.useCallback(b=>{const C=b.currentTarget.id.split("\\").splice(-1)[0];l({body:{location:b.currentTarget.id}}).unwrap().then(S=>{p($t(Gn({title:`Added Model: ${C}`,status:"success"})))}).catch(S=>{S&&p($t(Gn({title:m("toast.modelAddFailed"),status:"error"})))})},[p,l,m]),g=d.useCallback(b=>{n(b.target.value)},[]),x=({models:b,showActions:C=!0})=>b.map(S=>a.jsxs($,{sx:{p:4,gap:4,alignItems:"center",borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs($,{w:"100%",sx:{flexDirection:"column",minW:"25%"},children:[a.jsx(Se,{sx:{fontWeight:600},children:S.split("\\").slice(-1)[0]}),a.jsx(Se,{sx:{fontSize:"sm",color:"base.600",_dark:{color:"base.400"}},children:S})]}),C?a.jsxs($,{gap:2,children:[a.jsx(Mt,{id:S,onClick:h,isLoading:u,children:m("modelManager.quickAdd")}),a.jsx(Mt,{onClick:()=>p(xf(S)),isLoading:u,children:m("modelManager.advanced")})]}):a.jsx(Se,{sx:{fontWeight:600,p:2,borderRadius:4,color:"accent.50",bg:"accent.400",_dark:{color:"accent.100",bg:"accent.600"}},children:"Installed"})]},S));return(()=>e?!o||o.length===0?a.jsx($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",height:96,userSelect:"none",bg:"base.200",_dark:{bg:"base.900"}},children:a.jsx(Se,{variant:"subtext",children:m("modelManager.noModels")})}):a.jsxs($,{sx:{flexDirection:"column",gap:2,w:"100%",minW:"50%"},children:[a.jsx(Cs,{onChange:g,label:m("modelManager.search"),labelPos:"side"}),a.jsxs($,{p:2,gap:2,children:[a.jsxs(Se,{sx:{fontWeight:600},children:["Models Found: ",o.length]}),a.jsxs(Se,{sx:{fontWeight:600,color:"accent.500",_dark:{color:"accent.200"}},children:["Not Installed: ",i.length]})]}),a.jsx(Hpe,{offsetScrollbars:!0,children:a.jsxs($,{gap:2,flexDirection:"column",children:[x({models:i}),x({models:s,showActions:!1})]})})]}):null)()}const X_=(e,t)=>{const n=[];return qr(e,r=>{if(!r)return null;r.includes(t)&&n.push(r)}),n};function Vpe(){const e=W(l=>l.modelmanager.advancedAddScanModel),{t}=J(),[n,r]=d.useState("diffusers"),[o,s]=d.useState(!0);d.useEffect(()=>{e&&[".ckpt",".safetensors",".pth",".pt"].some(l=>e.endsWith(l))?r("checkpoint"):r("diffusers")},[e,r,o]);const i=te();return e?a.jsxs(De,{as:Mr.div,initial:{x:-100,opacity:0},animate:{x:0,opacity:1,transition:{duration:.2}},sx:{display:"flex",flexDirection:"column",minWidth:"40%",maxHeight:window.innerHeight-300,overflow:"scroll",p:4,gap:4,borderRadius:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs($,{justifyContent:"space-between",alignItems:"center",children:[a.jsx(Se,{size:"xl",fontWeight:600,children:o||n==="checkpoint"?"Add Checkpoint Model":"Add Diffusers Model"}),a.jsx(ot,{icon:a.jsx(wu,{}),"aria-label":t("modelManager.closeAdvanced"),onClick:()=>i(xf(null)),size:"sm"})]}),a.jsx(Tr,{label:t("modelManager.modelType"),value:n,data:NR,onChange:l=>{l&&(r(l),s(l==="checkpoint"))}}),o?a.jsx(DR,{model_path:e},e):a.jsx(TR,{model_path:e},e)]}):null}function Upe(){const e=te(),{t}=J(),n=W(l=>l.modelmanager.searchFolder),{refetch:r}=pP({search_path:n||""}),o=uc({initialValues:{folder:""}}),s=d.useCallback(l=>{e(oS(l.folder))},[e]),i=()=>{r()};return a.jsx("form",{onSubmit:o.onSubmit(l=>s(l)),style:{width:"100%"},children:a.jsxs($,{sx:{w:"100%",gap:2,borderRadius:4,alignItems:"center"},children:[a.jsxs($,{w:"100%",alignItems:"center",gap:4,minH:12,children:[a.jsx(Se,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",minW:"max-content",_dark:{color:"base.300"}},children:"Folder"}),n?a.jsx($,{sx:{w:"100%",p:2,px:4,bg:"base.300",borderRadius:4,fontSize:"sm",fontWeight:"bold",_dark:{bg:"base.700"}},children:n}):a.jsx(Cs,{w:"100%",size:"md",...o.getInputProps("folder")})]}),a.jsxs($,{gap:2,children:[n?a.jsx(ot,{"aria-label":t("modelManager.scanAgain"),tooltip:t("modelManager.scanAgain"),icon:a.jsx(JM,{}),onClick:i,fontSize:18,size:"sm"}):a.jsx(ot,{"aria-label":t("modelManager.findModels"),tooltip:t("modelManager.findModels"),icon:a.jsx(Iee,{}),fontSize:18,size:"sm",type:"submit"}),a.jsx(ot,{"aria-label":t("modelManager.clearCheckpointFolder"),tooltip:t("modelManager.clearCheckpointFolder"),icon:a.jsx(qo,{}),size:"sm",onClick:()=>{e(oS(null)),e(xf(null))},isDisabled:!n,colorScheme:"red"})]})]})})}const Gpe=d.memo(Upe);function qpe(){return a.jsxs($,{flexDirection:"column",w:"100%",gap:4,children:[a.jsx(Gpe,{}),a.jsxs($,{gap:4,children:[a.jsx($,{sx:{maxHeight:window.innerHeight-300,overflow:"scroll",gap:4,w:"100%"},children:a.jsx(Wpe,{})}),a.jsx(Vpe,{})]})]})}function Kpe(){const[e,t]=d.useState("add"),{t:n}=J();return a.jsxs($,{flexDirection:"column",gap:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Mt,{onClick:()=>t("add"),isChecked:e=="add",size:"sm",width:"100%",children:n("modelManager.addModel")}),a.jsx(Mt,{onClick:()=>t("scan"),isChecked:e=="scan",size:"sm",width:"100%",children:n("modelManager.scanForModels")})]}),e=="add"&&a.jsx(Bpe,{}),e=="scan"&&a.jsx(qpe,{})]})}const Qpe=[{label:"Stable Diffusion 1",value:"sd-1"},{label:"Stable Diffusion 2",value:"sd-2"}];function Xpe(){var z,G;const{t:e}=J(),t=te(),{data:n}=na(Ml),[r,{isLoading:o}]=rN(),[s,i]=d.useState("sd-1"),l=vS(n==null?void 0:n.entities,(T,B)=>(T==null?void 0:T.model_format)==="diffusers"&&(T==null?void 0:T.base_model)==="sd-1"),u=vS(n==null?void 0:n.entities,(T,B)=>(T==null?void 0:T.model_format)==="diffusers"&&(T==null?void 0:T.base_model)==="sd-2"),p=d.useMemo(()=>({"sd-1":l,"sd-2":u}),[l,u]),[m,h]=d.useState(((z=Object.keys(p[s]))==null?void 0:z[0])??null),[g,x]=d.useState(((G=Object.keys(p[s]))==null?void 0:G[1])??null),[y,b]=d.useState(null),[C,S]=d.useState(""),[j,_]=d.useState(.5),[P,I]=d.useState("weighted_sum"),[M,O]=d.useState("root"),[A,D]=d.useState(""),[R,N]=d.useState(!1),Y=Object.keys(p[s]).filter(T=>T!==g&&T!==y),F=Object.keys(p[s]).filter(T=>T!==m&&T!==y),V=Object.keys(p[s]).filter(T=>T!==m&&T!==g),Q=T=>{i(T),h(null),x(null)},q=()=>{const T=[];let B=[m,g,y];B=B.filter(re=>re!==null),B.forEach(re=>{var se;const le=(se=re==null?void 0:re.split("/"))==null?void 0:se[2];le&&T.push(le)});const X={model_names:T,merged_model_name:C!==""?C:T.join("-"),alpha:j,interp:P,force:R,merge_dest_directory:M==="root"?void 0:A};r({base_model:s,body:{body:X}}).unwrap().then(re=>{t($t(Gn({title:e("modelManager.modelsMerged"),status:"success"})))}).catch(re=>{re&&t($t(Gn({title:e("modelManager.modelsMergeFailed"),status:"error"})))})};return a.jsxs($,{flexDirection:"column",rowGap:4,children:[a.jsxs($,{sx:{flexDirection:"column",rowGap:1},children:[a.jsx(Se,{children:e("modelManager.modelMergeHeaderHelp1")}),a.jsx(Se,{fontSize:"sm",variant:"subtext",children:e("modelManager.modelMergeHeaderHelp2")})]}),a.jsxs($,{columnGap:4,children:[a.jsx(Tr,{label:"Model Type",w:"100%",data:Qpe,value:s,onChange:Q}),a.jsx(tr,{label:e("modelManager.modelOne"),w:"100%",value:m,placeholder:e("modelManager.selectModel"),data:Y,onChange:T=>h(T)}),a.jsx(tr,{label:e("modelManager.modelTwo"),w:"100%",placeholder:e("modelManager.selectModel"),value:g,data:F,onChange:T=>x(T)}),a.jsx(tr,{label:e("modelManager.modelThree"),data:V,w:"100%",placeholder:e("modelManager.selectModel"),clearable:!0,onChange:T=>{T?(b(T),I("weighted_sum")):(b(null),I("add_difference"))}})]}),a.jsx(Cs,{label:e("modelManager.mergedModelName"),value:C,onChange:T=>S(T.target.value)}),a.jsxs($,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(jt,{label:e("modelManager.alpha"),min:.01,max:.99,step:.01,value:j,onChange:T=>_(T),withInput:!0,withReset:!0,handleReset:()=>_(.5),withSliderMarks:!0}),a.jsx(Se,{variant:"subtext",fontSize:"sm",children:e("modelManager.modelMergeAlphaHelp")})]}),a.jsxs($,{sx:{padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(Se,{fontWeight:500,fontSize:"sm",variant:"subtext",children:e("modelManager.interpolationType")}),a.jsx(Xm,{value:P,onChange:T=>I(T),children:a.jsx($,{columnGap:4,children:y===null?a.jsxs(a.Fragment,{children:[a.jsx(Za,{value:"weighted_sum",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.weightedSum")})}),a.jsx(Za,{value:"sigmoid",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.sigmoid")})}),a.jsx(Za,{value:"inv_sigmoid",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.inverseSigmoid")})})]}):a.jsx(Za,{value:"add_difference",children:a.jsx(Fn,{label:e("modelManager.modelMergeInterpAddDifferenceHelp"),children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.addDifference")})})})})})]}),a.jsxs($,{sx:{flexDirection:"column",padding:4,borderRadius:"base",gap:4,bg:"base.200",_dark:{bg:"base.900"}},children:[a.jsxs($,{columnGap:4,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:e("modelManager.mergedModelSaveLocation")}),a.jsx(Xm,{value:M,onChange:T=>O(T),children:a.jsxs($,{columnGap:4,children:[a.jsx(Za,{value:"root",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.invokeAIFolder")})}),a.jsx(Za,{value:"custom",children:a.jsx(Se,{fontSize:"sm",children:e("modelManager.custom")})})]})})]}),M==="custom"&&a.jsx(Cs,{label:e("modelManager.mergedModelCustomSaveLocation"),value:A,onChange:T=>D(T.target.value)})]}),a.jsx(Io,{label:e("modelManager.ignoreMismatch"),isChecked:R,onChange:T=>N(T.target.checked),fontWeight:"500"}),a.jsx(Mt,{onClick:q,isLoading:o,isDisabled:m===null||g===null,children:e("modelManager.merge")})]})}function Ype(e){const{model:t}=e,n=te(),{t:r}=J(),[o,{isLoading:s}]=oN(),[i,l]=d.useState("InvokeAIRoot"),[u,p]=d.useState("");d.useEffect(()=>{l("InvokeAIRoot")},[t]);const m=()=>{l("InvokeAIRoot")},h=()=>{const g={base_model:t.base_model,model_name:t.model_name,convert_dest_directory:i==="Custom"?u:void 0};if(i==="Custom"&&u===""){n($t(Gn({title:r("modelManager.noCustomLocationProvided"),status:"error"})));return}n($t(Gn({title:`${r("modelManager.convertingModelBegin")}: ${t.model_name}`,status:"info"}))),o(g).unwrap().then(()=>{n($t(Gn({title:`${r("modelManager.modelConverted")}: ${t.model_name}`,status:"success"})))}).catch(()=>{n($t(Gn({title:`${r("modelManager.modelConversionFailed")}: ${t.model_name}`,status:"error"})))})};return a.jsxs(c0,{title:`${r("modelManager.convert")} ${t.model_name}`,acceptCallback:h,cancelCallback:m,acceptButtonText:`${r("modelManager.convert")}`,triggerComponent:a.jsxs(Mt,{size:"sm","aria-label":r("modelManager.convertToDiffusers"),className:" modal-close-btn",isLoading:s,children:["🧨 ",r("modelManager.convertToDiffusers")]}),motionPreset:"slideInBottom",children:[a.jsxs($,{flexDirection:"column",rowGap:4,children:[a.jsx(Se,{children:r("modelManager.convertToDiffusersHelpText1")}),a.jsxs(_f,{children:[a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText2")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText3")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText4")}),a.jsx(ws,{children:r("modelManager.convertToDiffusersHelpText5")})]}),a.jsx(Se,{children:r("modelManager.convertToDiffusersHelpText6")})]}),a.jsxs($,{flexDir:"column",gap:2,children:[a.jsxs($,{marginTop:4,flexDir:"column",gap:2,children:[a.jsx(Se,{fontWeight:"600",children:r("modelManager.convertToDiffusersSaveLocation")}),a.jsx(Xm,{value:i,onChange:g=>l(g),children:a.jsxs($,{gap:4,children:[a.jsx(Za,{value:"InvokeAIRoot",children:a.jsx(Fn,{label:"Save converted model in the InvokeAI root folder",children:r("modelManager.invokeRoot")})}),a.jsx(Za,{value:"Custom",children:a.jsx(Fn,{label:"Save converted model in a custom folder",children:r("modelManager.custom")})})]})})]}),i==="Custom"&&a.jsxs($,{flexDirection:"column",rowGap:2,children:[a.jsx(Se,{fontWeight:"500",fontSize:"sm",variant:"subtext",children:r("modelManager.customSaveLocation")}),a.jsx(Cs,{value:u,onChange:g=>{p(g.target.value)},width:"full"})]})]})]})}function Jpe(e){const{model:t}=e,[n,{isLoading:r}]=mP(),{data:o}=uP(),[s,i]=d.useState(!1);d.useEffect(()=>{o!=null&&o.includes(t.config)||i(!0)},[o,t.config]);const l=te(),{t:u}=J(),p=uc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"checkpoint",vae:t.vae?t.vae:"",config:t.config?t.config:"",variant:t.variant},validate:{path:h=>h.trim().length===0?"Must provide a path":null}}),m=d.useCallback(h=>{const g={base_model:t.base_model,model_name:t.model_name,body:h};n(g).unwrap().then(x=>{p.setValues(x),l($t(Gn({title:u("modelManager.modelUpdated"),status:"success"})))}).catch(x=>{p.reset(),l($t(Gn({title:u("modelManager.modelUpdateFailed"),status:"error"})))})},[p,l,t.base_model,t.model_name,u,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{justifyContent:"space-between",alignItems:"center",children:[a.jsxs($,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model"]})]}),[""].includes(t.base_model)?a.jsx(Ha,{sx:{p:2,borderRadius:4,bg:"error.200",_dark:{bg:"error.400"}},children:"Conversion Not Supported"}):a.jsx(Ype,{model:t})]}),a.jsx(no,{}),a.jsx($,{flexDirection:"column",maxHeight:window.innerHeight-270,overflowY:"scroll",children:a.jsx("form",{onSubmit:p.onSubmit(h=>m(h)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Er,{label:u("modelManager.name"),...p.getInputProps("model_name")}),a.jsx(Er,{label:u("modelManager.description"),...p.getInputProps("description")}),a.jsx(Gf,{required:!0,...p.getInputProps("base_model")}),a.jsx(y0,{required:!0,...p.getInputProps("variant")}),a.jsx(Er,{required:!0,label:u("modelManager.modelLocation"),...p.getInputProps("path")}),a.jsx(Er,{label:u("modelManager.vaeLocation"),...p.getInputProps("vae")}),a.jsxs($,{flexDirection:"column",gap:2,children:[s?a.jsx(Er,{required:!0,label:u("modelManager.config"),...p.getInputProps("config")}):a.jsx(AR,{required:!0,...p.getInputProps("config")}),a.jsx(Io,{isChecked:s,onChange:()=>i(!s),label:"Use Custom Config"})]}),a.jsx(Mt,{type:"submit",isLoading:r,children:u("modelManager.updateModel")})]})})})]})}function Zpe(e){const{model:t}=e,[n,{isLoading:r}]=mP(),o=te(),{t:s}=J(),i=uc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"main",path:t.path?t.path:"",description:t.description?t.description:"",model_format:"diffusers",vae:t.vae?t.vae:"",variant:t.variant},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o($t(Gn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o($t(Gn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[i,o,t.base_model,t.model_name,s,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model"]})]}),a.jsx(no,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Er,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Er,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Gf,{required:!0,...i.getInputProps("base_model")}),a.jsx(y0,{required:!0,...i.getInputProps("variant")}),a.jsx(Er,{required:!0,label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Er,{label:s("modelManager.vaeLocation"),...i.getInputProps("vae")}),a.jsx(Mt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function eme(e){const{model:t}=e,[n,{isLoading:r}]=sN(),o=te(),{t:s}=J(),i=uc({initialValues:{model_name:t.model_name?t.model_name:"",base_model:t.base_model,model_type:"lora",path:t.path?t.path:"",description:t.description?t.description:"",model_format:t.model_format},validate:{path:u=>u.trim().length===0?"Must provide a path":null}}),l=d.useCallback(u=>{const p={base_model:t.base_model,model_name:t.model_name,body:u};n(p).unwrap().then(m=>{i.setValues(m),o($t(Gn({title:s("modelManager.modelUpdated"),status:"success"})))}).catch(m=>{i.reset(),o($t(Gn({title:s("modelManager.modelUpdateFailed"),status:"error"})))})},[o,i,t.base_model,t.model_name,s,n]);return a.jsxs($,{flexDirection:"column",rowGap:4,width:"100%",children:[a.jsxs($,{flexDirection:"column",children:[a.jsx(Se,{fontSize:"lg",fontWeight:"bold",children:t.model_name}),a.jsxs(Se,{fontSize:"sm",color:"base.400",children:[gr[t.base_model]," Model ⋅"," ",aN[t.model_format]," format"]})]}),a.jsx(no,{}),a.jsx("form",{onSubmit:i.onSubmit(u=>l(u)),children:a.jsxs($,{flexDirection:"column",overflowY:"scroll",gap:4,children:[a.jsx(Er,{label:s("modelManager.name"),...i.getInputProps("model_name")}),a.jsx(Er,{label:s("modelManager.description"),...i.getInputProps("description")}),a.jsx(Gf,{...i.getInputProps("base_model")}),a.jsx(Er,{label:s("modelManager.modelLocation"),...i.getInputProps("path")}),a.jsx(Mt,{type:"submit",isLoading:r,children:s("modelManager.updateModel")})]})})]})}function tme(e){const{t}=J(),n=te(),[r]=iN(),[o]=lN(),{model:s,isSelected:i,setSelectedModelId:l}=e,u=d.useCallback(()=>{l(s.id)},[s.id,l]),p=d.useCallback(()=>{const m={main:r,lora:o,onnx:r}[s.model_type];m(s).unwrap().then(h=>{n($t(Gn({title:`${t("modelManager.modelDeleted")}: ${s.model_name}`,status:"success"})))}).catch(h=>{h&&n($t(Gn({title:`${t("modelManager.modelDeleteFailed")}: ${s.model_name}`,status:"error"})))}),l(void 0)},[r,o,s,l,n,t]);return a.jsxs($,{sx:{gap:2,alignItems:"center",w:"full"},children:[a.jsx($,{as:Mt,isChecked:i,sx:{justifyContent:"start",p:2,borderRadius:"base",w:"full",alignItems:"center",bg:i?"accent.400":"base.100",color:i?"base.50":"base.800",_hover:{bg:i?"accent.500":"base.300",color:i?"base.50":"base.800"},_dark:{color:i?"base.50":"base.100",bg:i?"accent.600":"base.850",_hover:{color:i?"base.50":"base.100",bg:i?"accent.550":"base.700"}}},onClick:u,children:a.jsxs($,{gap:4,alignItems:"center",children:[a.jsx(Ha,{minWidth:14,p:.5,fontSize:"sm",variant:"solid",children:cN[s.base_model]}),a.jsx(Fn,{label:s.description,hasArrow:!0,placement:"bottom",children:a.jsx(Se,{sx:{fontWeight:500},children:s.model_name})})]})}),a.jsx(c0,{title:t("modelManager.deleteModel"),acceptCallback:p,acceptButtonText:t("modelManager.delete"),triggerComponent:a.jsx(ot,{icon:a.jsx(Mne,{}),"aria-label":t("modelManager.deleteConfig"),colorScheme:"error"}),children:a.jsxs($,{rowGap:4,flexDirection:"column",children:[a.jsx("p",{style:{fontWeight:"bold"},children:t("modelManager.deleteMsg1")}),a.jsx("p",{children:t("modelManager.deleteMsg2")})]})})]})}const nme=e=>{const{selectedModelId:t,setSelectedModelId:n}=e,{t:r}=J(),[o,s]=d.useState(""),[i,l]=d.useState("all"),{filteredDiffusersModels:u,isLoadingDiffusersModels:p}=na(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredDiffusersModels:Cd(_,"main","diffusers",o),isLoadingDiffusersModels:P})}),{filteredCheckpointModels:m,isLoadingCheckpointModels:h}=na(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredCheckpointModels:Cd(_,"main","checkpoint",o),isLoadingCheckpointModels:P})}),{filteredLoraModels:g,isLoadingLoraModels:x}=gf(void 0,{selectFromResult:({data:_,isLoading:P})=>({filteredLoraModels:Cd(_,"lora",void 0,o),isLoadingLoraModels:P})}),{filteredOnnxModels:y,isLoadingOnnxModels:b}=Bd(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredOnnxModels:Cd(_,"onnx","onnx",o),isLoadingOnnxModels:P})}),{filteredOliveModels:C,isLoadingOliveModels:S}=Bd(Ml,{selectFromResult:({data:_,isLoading:P})=>({filteredOliveModels:Cd(_,"onnx","olive",o),isLoadingOliveModels:P})}),j=d.useCallback(_=>{s(_.target.value)},[]);return a.jsx($,{flexDirection:"column",rowGap:4,width:"50%",minWidth:"50%",children:a.jsxs($,{flexDirection:"column",gap:4,paddingInlineEnd:4,children:[a.jsxs(zn,{isAttached:!0,children:[a.jsx(Mt,{onClick:()=>l("all"),isChecked:i==="all",size:"sm",children:r("modelManager.allModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("diffusers"),isChecked:i==="diffusers",children:r("modelManager.diffusersModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("checkpoint"),isChecked:i==="checkpoint",children:r("modelManager.checkpointModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("onnx"),isChecked:i==="onnx",children:r("modelManager.onnxModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("olive"),isChecked:i==="olive",children:r("modelManager.oliveModels")}),a.jsx(Mt,{size:"sm",onClick:()=>l("lora"),isChecked:i==="lora",children:r("modelManager.loraModels")})]}),a.jsx(Cs,{onChange:j,label:r("modelManager.search"),labelPos:"side"}),a.jsxs($,{flexDirection:"column",gap:4,maxHeight:window.innerHeight-280,overflow:"scroll",children:[p&&a.jsx(Wc,{loadingMessage:"Loading Diffusers..."}),["all","diffusers"].includes(i)&&!p&&u.length>0&&a.jsx(Hc,{title:"Diffusers",modelList:u,selected:{selectedModelId:t,setSelectedModelId:n}},"diffusers"),h&&a.jsx(Wc,{loadingMessage:"Loading Checkpoints..."}),["all","checkpoint"].includes(i)&&!h&&m.length>0&&a.jsx(Hc,{title:"Checkpoints",modelList:m,selected:{selectedModelId:t,setSelectedModelId:n}},"checkpoints"),x&&a.jsx(Wc,{loadingMessage:"Loading LoRAs..."}),["all","lora"].includes(i)&&!x&&g.length>0&&a.jsx(Hc,{title:"LoRAs",modelList:g,selected:{selectedModelId:t,setSelectedModelId:n}},"loras"),S&&a.jsx(Wc,{loadingMessage:"Loading Olives..."}),["all","olive"].includes(i)&&!S&&C.length>0&&a.jsx(Hc,{title:"Olives",modelList:C,selected:{selectedModelId:t,setSelectedModelId:n}},"olive"),b&&a.jsx(Wc,{loadingMessage:"Loading ONNX..."}),["all","onnx"].includes(i)&&!b&&y.length>0&&a.jsx(Hc,{title:"ONNX",modelList:y,selected:{selectedModelId:t,setSelectedModelId:n}},"onnx")]})]})})},rme=d.memo(nme),Cd=(e,t,n,r)=>{const o=[];return qr(e==null?void 0:e.entities,s=>{if(!s)return;const i=s.model_name.toLowerCase().includes(r.toLowerCase()),l=n===void 0||s.model_format===n,u=s.model_type===t;i&&l&&u&&o.push(s)}),o},H2=d.memo(e=>a.jsx($,{flexDirection:"column",gap:4,borderRadius:4,p:4,sx:{bg:"base.200",_dark:{bg:"base.800"}},children:e.children}));H2.displayName="StyledModelContainer";const Hc=d.memo(e=>{const{title:t,modelList:n,selected:r}=e;return a.jsx(H2,{children:a.jsxs($,{sx:{gap:2,flexDir:"column"},children:[a.jsx(Se,{variant:"subtext",fontSize:"sm",children:t}),n.map(o=>a.jsx(tme,{model:o,isSelected:r.selectedModelId===o.id,setSelectedModelId:r.setSelectedModelId},o.id))]})})});Hc.displayName="ModelListWrapper";const Wc=d.memo(({loadingMessage:e})=>a.jsx(H2,{children:a.jsxs($,{justifyContent:"center",alignItems:"center",flexDirection:"column",p:4,gap:8,children:[a.jsx(vi,{}),a.jsx(Se,{variant:"subtext",children:e||"Fetching..."})]})}));Wc.displayName="FetchingModelsLoader";function ome(){const[e,t]=d.useState(),{mainModel:n}=na(Ml,{selectFromResult:({data:s})=>({mainModel:e?s==null?void 0:s.entities[e]:void 0})}),{loraModel:r}=gf(void 0,{selectFromResult:({data:s})=>({loraModel:e?s==null?void 0:s.entities[e]:void 0})}),o=n||r;return a.jsxs($,{sx:{gap:8,w:"full",h:"full"},children:[a.jsx(rme,{selectedModelId:e,setSelectedModelId:t}),a.jsx(sme,{model:o})]})}const sme=e=>{const{model:t}=e;return(t==null?void 0:t.model_format)==="checkpoint"?a.jsx(Jpe,{model:t},t.id):(t==null?void 0:t.model_format)==="diffusers"?a.jsx(Zpe,{model:t},t.id):(t==null?void 0:t.model_type)==="lora"?a.jsx(eme,{model:t},t.id):a.jsx($,{sx:{w:"full",h:"full",justifyContent:"center",alignItems:"center",maxH:96,userSelect:"none"},children:a.jsx(Se,{variant:"subtext",children:"No Model Selected"})})};function ame(){const{t:e}=J();return a.jsxs($,{sx:{w:"full",p:4,borderRadius:4,gap:4,justifyContent:"space-between",alignItems:"center",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsxs($,{sx:{flexDirection:"column",gap:2},children:[a.jsx(Se,{sx:{fontWeight:600},children:e("modelManager.syncModels")}),a.jsx(Se,{fontSize:"sm",sx:{_dark:{color:"base.400"}},children:e("modelManager.syncModelsDesc")})]}),a.jsx(Wu,{})]})}function ime(){return a.jsx($,{children:a.jsx(ame,{})})}const Y_=[{id:"modelManager",label:on.t("modelManager.modelManager"),content:a.jsx(ome,{})},{id:"importModels",label:on.t("modelManager.importModels"),content:a.jsx(Kpe,{})},{id:"mergeModels",label:on.t("modelManager.mergeModels"),content:a.jsx(Xpe,{})},{id:"settings",label:on.t("modelManager.settings"),content:a.jsx(ime,{})}],lme=()=>a.jsxs(nc,{isLazy:!0,variant:"line",layerStyle:"first",sx:{w:"full",h:"full",p:4,gap:4,borderRadius:"base"},children:[a.jsx(rc,{children:Y_.map(e=>a.jsx(Po,{sx:{borderTopRadius:"base"},children:e.label},e.id))}),a.jsx(Tu,{sx:{w:"full",h:"full"},children:Y_.map(e=>a.jsx(ss,{sx:{w:"full",h:"full"},children:e.content},e.id))})]}),cme=d.memo(lme),ume={Any:void 0,enum:"",BoardField:void 0,boolean:!1,BooleanCollection:[],BooleanPolymorphic:!1,ClipField:void 0,Collection:[],CollectionItem:void 0,ColorCollection:[],ColorField:void 0,ColorPolymorphic:void 0,ConditioningCollection:[],ConditioningField:void 0,ConditioningPolymorphic:void 0,ControlCollection:[],ControlField:void 0,ControlNetModelField:void 0,ControlPolymorphic:void 0,DenoiseMaskField:void 0,float:0,FloatCollection:[],FloatPolymorphic:0,ImageCollection:[],ImageField:void 0,ImagePolymorphic:void 0,integer:0,IntegerCollection:[],IntegerPolymorphic:0,IPAdapterCollection:[],IPAdapterField:void 0,IPAdapterModelField:void 0,IPAdapterPolymorphic:void 0,LatentsCollection:[],LatentsField:void 0,LatentsPolymorphic:void 0,MetadataItemField:void 0,MetadataItemCollection:[],MetadataItemPolymorphic:void 0,MetadataField:void 0,MetadataCollection:[],LoRAModelField:void 0,MainModelField:void 0,ONNXModelField:void 0,Scheduler:"euler",SDXLMainModelField:void 0,SDXLRefinerModelField:void 0,string:"",StringCollection:[],StringPolymorphic:"",T2IAdapterCollection:[],T2IAdapterField:void 0,T2IAdapterModelField:void 0,T2IAdapterPolymorphic:void 0,UNetField:void 0,VaeField:void 0,VaeModelField:void 0},dme=(e,t)=>{const n={id:e,name:t.name,type:t.type,label:"",fieldKind:"input"};return n.value=t.default??ume[t.type],n},fme=ce([e=>e.nodes],e=>e.nodeTemplates),P1={dragHandle:`.${ec}`},pme=()=>{const e=W(fme),t=Nb();return d.useCallback(n=>{var x;const r=oi();let o=window.innerWidth/2,s=window.innerHeight/2;const i=(x=document.querySelector("#workflow-editor"))==null?void 0:x.getBoundingClientRect();i&&(o=i.width/2-W1/2,s=i.height/2-W1/2);const{x:l,y:u}=t.project({x:o,y:s});if(n==="current_image")return{...P1,id:r,type:"current_image",position:{x:l,y:u},data:{id:r,type:"current_image",isOpen:!0,label:"Current Image"}};if(n==="notes")return{...P1,id:r,type:"notes",position:{x:l,y:u},data:{id:r,isOpen:!0,label:"Notes",notes:"",type:"notes"}};const p=e[n];if(p===void 0){console.error(`Unable to find template ${n}.`);return}const m=sS(p.inputs,(y,b,C)=>{const S=oi(),j=dme(S,b);return y[C]=j,y},{}),h=sS(p.outputs,(y,b,C)=>{const j={id:oi(),name:C,type:b.type,fieldKind:"output"};return y[C]=j,y},{});return{...P1,id:r,type:"invocation",position:{x:l,y:u},data:{id:r,type:n,version:p.version,label:"",notes:"",isOpen:!0,embedWorkflow:!1,isIntermediate:n!=="save_image",inputs:m,outputs:h,useCache:p.useCache}}},[e,t])},$R=d.forwardRef(({label:e,description:t,...n},r)=>a.jsx("div",{ref:r,...n,children:a.jsxs("div",{children:[a.jsx(Se,{fontWeight:600,children:e}),a.jsx(Se,{size:"xs",sx:{color:"base.600",_dark:{color:"base.500"}},children:t})]})}));$R.displayName="AddNodePopoverSelectItem";const mme=(e,t)=>{const n=new RegExp(e.trim().replace(/[-[\]{}()*+!<=:?./\\^$|#,]/g,"").split(" ").join(".*"),"gi");return n.test(t.label)||n.test(t.description)||t.tags.some(r=>n.test(r))},hme=()=>{const e=te(),t=pme(),n=oc(),{t:r}=J(),o=W(C=>C.nodes.currentConnectionFieldType),s=W(C=>{var S;return(S=C.nodes.connectionStartParams)==null?void 0:S.handleType}),i=ce([we],({nodes:C})=>{const S=o?v$(C.nodeTemplates,_=>{const P=s=="source"?_.inputs:_.outputs;return Qs(P,I=>{const M=s=="source"?o:I.type,O=s=="target"?o:I.type;return $b(M,O)})}):Ro(C.nodeTemplates),j=Ro(S,_=>({label:_.title,value:_.type,description:_.description,tags:_.tags}));return o===null&&(j.push({label:r("nodes.currentImage"),value:"current_image",description:r("nodes.currentImageDescription"),tags:["progress"]}),j.push({label:r("nodes.notes"),value:"notes",description:r("nodes.notesDescription"),tags:["notes"]})),j.sort((_,P)=>_.label.localeCompare(P.label)),{data:j,t:r}},je),{data:l}=W(i),u=W(C=>C.nodes.isAddNodePopoverOpen),p=d.useRef(null),m=d.useCallback(C=>{const S=t(C);if(!S){const j=r("nodes.unknownNode",{nodeType:C});n({status:"error",title:j});return}e(uN(S))},[e,t,n,r]),h=d.useCallback(C=>{C&&m(C)},[m]),g=d.useCallback(()=>{e(dN())},[e]),x=d.useCallback(()=>{e(hP())},[e]),y=d.useCallback(C=>{C.preventDefault(),x(),setTimeout(()=>{var S;(S=p.current)==null||S.focus()},0)},[x]),b=d.useCallback(()=>{g()},[g]);return It(["shift+a","space"],y),It(["escape"],b),a.jsxs(Af,{initialFocusRef:p,isOpen:u,onClose:g,placement:"bottom",openDelay:0,closeDelay:0,closeOnBlur:!0,returnFocusOnClose:!0,children:[a.jsx(v5,{children:a.jsx($,{sx:{position:"absolute",top:"15%",insetInlineStart:"50%",pointerEvents:"none"}})}),a.jsx(Df,{sx:{p:0,top:-1,shadow:"dark-lg",borderColor:"accent.300",borderWidth:"2px",borderStyle:"solid",_dark:{borderColor:"accent.400"}},children:a.jsx(Mg,{sx:{p:0},children:a.jsx(tr,{inputRef:p,selectOnBlur:!1,placeholder:r("nodes.nodeSearch"),value:null,data:l,maxDropdownHeight:400,nothingFound:r("nodes.noMatchingNodes"),itemComponent:$R,filter:mme,onChange:h,hoverOnSearchChange:!0,onDropdownClose:g,sx:{width:"32rem",input:{padding:"0.5rem"}}})})})]})},gme=d.memo(hme),vme=()=>{const e=Nb(),t=W(r=>r.nodes.shouldValidateGraph);return d.useCallback(({source:r,sourceHandle:o,target:s,targetHandle:i})=>{var x,y;const l=e.getEdges(),u=e.getNodes();if(!(r&&o&&s&&i))return!1;const p=e.getNode(r),m=e.getNode(s);if(!(p&&m&&p.data&&m.data))return!1;const h=(x=p.data.outputs[o])==null?void 0:x.type,g=(y=m.data.inputs[i])==null?void 0:y.type;return!h||!g||r===s?!1:t?l.find(b=>{b.target===s&&b.targetHandle===i&&b.source===r&&b.sourceHandle})||l.find(b=>b.target===s&&b.targetHandle===i)&&g!=="CollectionItem"||!$b(h,g)?!1:gP(r,s,u,l):!0},[e,t])},uf=e=>`var(--invokeai-colors-${e.split(".").join("-")})`,xme=ce(we,({nodes:e})=>{const{shouldAnimateEdges:t,currentConnectionFieldType:n,shouldColorEdges:r}=e,o=uf(n&&r?vf[n].color:"base.500");let s="react-flow__custom_connection-path";return t&&(s=s.concat(" animated")),{stroke:o,className:s}}),bme=({fromX:e,fromY:t,fromPosition:n,toX:r,toY:o,toPosition:s})=>{const{stroke:i,className:l}=W(xme),u={sourceX:e,sourceY:t,sourcePosition:n,targetX:r,targetY:o,targetPosition:s},[p]=Lb(u);return a.jsx("g",{children:a.jsx("path",{fill:"none",stroke:i,strokeWidth:2,className:l,d:p,style:{opacity:.8}})})},yme=d.memo(bme),LR=(e,t,n,r,o)=>ce(we,({nodes:s})=>{var g,x;const i=s.nodes.find(y=>y.id===e),l=s.nodes.find(y=>y.id===n),u=Or(i)&&Or(l),p=(i==null?void 0:i.selected)||(l==null?void 0:l.selected)||o,m=u?(x=(g=i==null?void 0:i.data)==null?void 0:g.outputs[t||""])==null?void 0:x.type:void 0,h=m&&s.shouldColorEdges?uf(vf[m].color):uf("base.500");return{isSelected:p,shouldAnimate:s.shouldAnimateEdges&&p,stroke:h}},je),Cme=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,data:l,selected:u,source:p,target:m,sourceHandleId:h,targetHandleId:g})=>{const x=d.useMemo(()=>LR(p,h,m,g,u),[u,p,h,m,g]),{isSelected:y,shouldAnimate:b}=W(x),[C,S,j]=Lb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s}),{base500:_}=zf();return a.jsxs(a.Fragment,{children:[a.jsx(vP,{path:C,markerEnd:i,style:{strokeWidth:y?3:2,stroke:_,opacity:y?.8:.5,animation:b?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:b?5:"none"}}),(l==null?void 0:l.count)&&l.count>1&&a.jsx(fN,{children:a.jsx($,{sx:{position:"absolute",transform:`translate(-50%, -50%) translate(${S}px,${j}px)`},className:"nodrag nopan",children:a.jsx(Ha,{variant:"solid",sx:{bg:"base.500",opacity:y?.8:.5,boxShadow:"base"},children:l.count})})})]})},wme=d.memo(Cme),Sme=({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:o,targetPosition:s,markerEnd:i,selected:l,source:u,target:p,sourceHandleId:m,targetHandleId:h})=>{const g=d.useMemo(()=>LR(u,m,p,h,l),[u,m,p,h,l]),{isSelected:x,shouldAnimate:y,stroke:b}=W(g),[C]=Lb({sourceX:e,sourceY:t,sourcePosition:o,targetX:n,targetY:r,targetPosition:s});return a.jsx(vP,{path:C,markerEnd:i,style:{strokeWidth:x?3:2,stroke:b,opacity:x?.8:.5,animation:y?"dashdraw 0.5s linear infinite":void 0,strokeDasharray:y?5:"none"}})},kme=d.memo(Sme),jme=e=>{const{nodeId:t,width:n,children:r,selected:o}=e,{isMouseOverNode:s,handleMouseOut:i,handleMouseOver:l}=q8(t),u=d.useMemo(()=>ce(we,({nodes:j})=>{var _;return((_=j.nodeExecutionStates[t])==null?void 0:_.status)===ri.IN_PROGRESS}),[t]),p=W(u),[m,h,g,x]=Ks("shadows",["nodeInProgress.light","nodeInProgress.dark","shadows.xl","shadows.base"]),y=te(),b=di(m,h),C=W(j=>j.nodes.nodeOpacity),S=d.useCallback(j=>{!j.ctrlKey&&!j.altKey&&!j.metaKey&&!j.shiftKey&&y(pN(t)),y(xP())},[y,t]);return a.jsxs(De,{onClick:S,onMouseEnter:l,onMouseLeave:i,className:ec,sx:{h:"full",position:"relative",borderRadius:"base",w:n??W1,transitionProperty:"common",transitionDuration:"0.1s",cursor:"grab",opacity:C},children:[a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"base",pointerEvents:"none",shadow:`${g}, ${x}, ${x}`,zIndex:-1}}),a.jsx(De,{sx:{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,borderRadius:"md",pointerEvents:"none",transitionProperty:"common",transitionDuration:"0.1s",opacity:.7,shadow:p?b:void 0,zIndex:-1}}),r,a.jsx(G8,{isSelected:o,isHovered:s})]})},C0=d.memo(jme),_me=ce(we,({system:e,gallery:t})=>{var r;return{imageDTO:t.selection[t.selection.length-1],progressImage:(r=e.denoiseProgress)==null?void 0:r.progress_image}}),Ime=e=>{const{progressImage:t,imageDTO:n}=mN(_me);return t?a.jsx(E1,{nodeProps:e,children:a.jsx(wi,{src:t.dataURL,sx:{w:"full",h:"full",objectFit:"contain",borderRadius:"base"}})}):n?a.jsx(E1,{nodeProps:e,children:a.jsx(al,{imageDTO:n,isDragDisabled:!0,useThumbailFallback:!0})}):a.jsx(E1,{nodeProps:e,children:a.jsx(eo,{})})},Pme=d.memo(Ime),E1=e=>{const[t,n]=d.useState(!1),r=()=>{n(!0)},o=()=>{n(!1)};return a.jsx(C0,{nodeId:e.nodeProps.id,selected:e.nodeProps.selected,width:384,children:a.jsxs($,{onMouseEnter:r,onMouseLeave:o,className:ec,sx:{position:"relative",flexDirection:"column"},children:[a.jsx($,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",alignItems:"center",justifyContent:"center",h:8},children:a.jsx(Se,{sx:{fontSize:"sm",fontWeight:600,color:"base.700",_dark:{color:"base.200"}},children:"Current Image"})}),a.jsxs($,{layerStyle:"nodeBody",sx:{w:"full",h:"full",borderBottomRadius:"base",p:2},children:[e.children,t&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.1}},exit:{opacity:0,transition:{duration:.1}},style:{position:"absolute",top:40,left:-2,right:-2,bottom:0,pointerEvents:"none"},children:a.jsx(ER,{})},"nextPrevButtons")]})]})})},W2=e=>{const t=e.filter(o=>!o.ui_hidden),n=t.filter(o=>!Wd(o.ui_order)).sort((o,s)=>(o.ui_order??0)-(s.ui_order??0)),r=t.filter(o=>Wd(o.ui_order));return n.concat(r).map(o=>o.name).filter(o=>o!=="is_intermediate")},Eme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);if(!Or(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(l=>(["any","direct"].includes(l.input)||zb.includes(l.type))&&bP.includes(l.type));return W2(i)},je),[e]);return W(t)},Mme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(l=>l.id===e);if(!Or(o))return[];const s=r.nodeTemplates[o.data.type];if(!s)return[];const i=Ro(s.inputs).filter(l=>l.input==="connection"&&!zb.includes(l.type)||!bP.includes(l.type));return W2(i)},je),[e]);return W(t)},Ome=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Or(o))return[];const s=r.nodeTemplates[o.data.type];return s?W2(Ro(s.outputs)):[]},je),[e]);return W(t)},V2=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?Qs(o.data.outputs,s=>hN.includes(s.type)&&o.data.type!=="image"):!1},je),[e]);return W(t)},Rme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.embedWorkflow:!1},je),[e]);return W(t)},Ame=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Or(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return s?s.withWorkflow:!1},je),[e]);return W(t)},Dme=({nodeId:e})=>{const t=te(),n=Ame(e),r=Rme(e),o=d.useCallback(s=>{t(gN({nodeId:e,embedWorkflow:s.target.checked}))},[t,e]);return n?a.jsxs(Kn,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(Rr,{sx:{fontSize:"xs",mb:"1px"},children:"Workflow"}),a.jsx(jf,{className:"nopan",size:"sm",onChange:o,isChecked:r})]}):null},Tme=d.memo(Dme),Nme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.isIntermediate:!1},je),[e]);return W(t)},$me=({nodeId:e})=>{const t=te(),n=V2(e),r=Nme(e),o=d.useCallback(s=>{t(vN({nodeId:e,isIntermediate:!s.target.checked}))},[t,e]);return n?a.jsxs(Kn,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(Rr,{sx:{fontSize:"xs",mb:"1px"},children:"Save to Gallery"}),a.jsx(jf,{className:"nopan",size:"sm",onChange:o,isChecked:!r})]}):null},Lme=d.memo($me),zme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.useCache:!1},je),[e]);return W(t)},Fme=({nodeId:e})=>{const t=te(),n=zme(e),r=d.useCallback(o=>{t(xN({nodeId:e,useCache:o.target.checked}))},[t,e]);return a.jsxs(Kn,{as:$,sx:{alignItems:"center",gap:2,w:"auto"},children:[a.jsx(Rr,{sx:{fontSize:"xs",mb:"1px"},children:"Use Cache"}),a.jsx(jf,{className:"nopan",size:"sm",onChange:r,isChecked:n})]})},Bme=d.memo(Fme),Hme=({nodeId:e})=>{const t=V2(e),n=jn("invocationCache").isFeatureEnabled;return a.jsxs($,{className:ec,layerStyle:"nodeFooter",sx:{w:"full",borderBottomRadius:"base",px:2,py:0,h:6,justifyContent:"space-between"},children:[n&&a.jsx(Bme,{nodeId:e}),t&&a.jsx(Tme,{nodeId:e}),t&&a.jsx(Lme,{nodeId:e})]})},Wme=d.memo(Hme),Vme=({nodeId:e,isOpen:t})=>{const n=te(),r=bN(),o=d.useCallback(()=>{n(yN({nodeId:e,isOpen:!t})),r(e)},[n,t,e,r]);return a.jsx(ot,{className:"nodrag",onClick:o,"aria-label":"Minimize",sx:{minW:8,w:8,h:8,color:"base.500",_dark:{color:"base.500"},_hover:{color:"base.700",_dark:{color:"base.300"}}},variant:"link",icon:a.jsx(t0,{sx:{transform:t?"rotate(0deg)":"rotate(180deg)",transitionProperty:"common",transitionDuration:"normal"}})})},U2=d.memo(Vme),zR=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return Or(o)?o.data.label:!1},je),[e]);return W(t)},FR=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);if(!Or(o))return!1;const s=o?r.nodeTemplates[o.data.type]:void 0;return s==null?void 0:s.title},je),[e]);return W(t)},Ume=({nodeId:e,title:t})=>{const n=te(),r=zR(e),o=FR(e),{t:s}=J(),[i,l]=d.useState(""),u=d.useCallback(async m=>{n(CN({nodeId:e,label:m})),l(r||t||o||s("nodes.problemSettingTitle"))},[n,e,t,o,r,s]),p=d.useCallback(m=>{l(m)},[]);return d.useEffect(()=>{l(r||t||o||s("nodes.problemSettingTitle"))},[r,o,t,s]),a.jsx($,{sx:{overflow:"hidden",w:"full",h:"full",alignItems:"center",justifyContent:"center",cursor:"text"},children:a.jsxs(pg,{as:$,value:i,onChange:p,onSubmit:u,sx:{alignItems:"center",position:"relative",w:"full",h:"full"},children:[a.jsx(fg,{fontSize:"sm",sx:{p:0,w:"full"},noOfLines:1}),a.jsx(dg,{className:"nodrag",fontSize:"sm",sx:{p:0,fontWeight:700,_focusVisible:{p:0,boxShadow:"none"}}}),a.jsx(Gme,{})]})})},BR=d.memo(Ume);function Gme(){const{isEditing:e,getEditButtonProps:t}=YP(),n=d.useCallback(r=>{const{onClick:o}=t();o&&o(r)},[t]);return e?null:a.jsx(De,{className:ec,onDoubleClick:n,sx:{position:"absolute",w:"full",h:"full",top:0,cursor:"grab"}})}const G2=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(s=>s.id===e);return o==null?void 0:o.data},je),[e]);return W(t)},qme=({nodeId:e})=>{const t=G2(e),{base400:n,base600:r}=zf(),o=di(n,r),s=d.useMemo(()=>({borderWidth:0,borderRadius:"3px",width:"1rem",height:"1rem",backgroundColor:o,zIndex:-1}),[o]);return Bm(t)?a.jsxs(a.Fragment,{children:[a.jsx(jd,{type:"target",id:`${t.id}-collapsed-target`,isConnectable:!1,position:Vc.Left,style:{...s,left:"-0.5rem"}}),Ro(t.inputs,i=>a.jsx(jd,{type:"target",id:i.name,isConnectable:!1,position:Vc.Left,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-input-handle`)),a.jsx(jd,{type:"source",id:`${t.id}-collapsed-source`,isConnectable:!1,position:Vc.Right,style:{...s,right:"-0.5rem"}}),Ro(t.outputs,i=>a.jsx(jd,{type:"source",id:i.name,isConnectable:!1,position:Vc.Right,style:{visibility:"hidden"}},`${t.id}-${i.name}-collapsed-output-handle`))]}):null},Kme=d.memo(qme),Qme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{const o=r.nodes.find(i=>i.id===e);return r.nodeTemplates[(o==null?void 0:o.data.type)??""]},je),[e]);return W(t)},Xme=({nodeId:e})=>{const t=te(),n=G2(e),{t:r}=J(),o=d.useCallback(s=>{t(wN({nodeId:e,notes:s.target.value}))},[t,e]);return Bm(n)?a.jsxs(Kn,{children:[a.jsx(Rr,{children:r("nodes.notes")}),a.jsx(gi,{value:n==null?void 0:n.notes,onChange:o,rows:10})]}):null},Yme=d.memo(Xme),Jme=e=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>{var i;const o=r.nodes.find(l=>l.id===e);if(!Or(o))return!1;const s=r.nodeTemplates[(o==null?void 0:o.data.type)??""];return!(s!=null&&s.version)||!((i=o.data)!=null&&i.version)?!1:CI(s.version,o.data.version)===0},je),[e]);return W(t)},Zme=({nodeId:e})=>{const{isOpen:t,onOpen:n,onClose:r}=Uo(),o=zR(e),s=FR(e),i=Jme(e),{t:l}=J();return a.jsxs(a.Fragment,{children:[a.jsx(Fn,{label:a.jsx(HR,{nodeId:e}),placement:"top",shouldWrapChildren:!0,children:a.jsx($,{className:"nodrag",onClick:n,sx:{alignItems:"center",justifyContent:"center",w:8,h:8,cursor:"pointer"},children:a.jsx(Lr,{as:UM,sx:{boxSize:4,w:8,color:i?"base.400":"error.400"}})})}),a.jsxs(ql,{isOpen:t,onClose:r,isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Kl,{children:[a.jsx(ra,{children:o||s||l("nodes.unknownNode")}),a.jsx(Rf,{}),a.jsx(sa,{children:a.jsx(Yme,{nodeId:e})}),a.jsx(Oa,{})]})]})]})},ehe=d.memo(Zme),HR=d.memo(({nodeId:e})=>{const t=G2(e),n=Qme(e),{t:r}=J(),o=d.useMemo(()=>t!=null&&t.label&&(n!=null&&n.title)?`${t.label} (${n.title})`:t!=null&&t.label&&!n?t.label:!(t!=null&&t.label)&&n?n.title:r("nodes.unknownNode"),[t,n,r]),s=d.useMemo(()=>!Bm(t)||!n?null:t.version?n.version?xS(t.version,n.version,"<")?a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateNode"),")"]}):xS(t.version,n.version,">")?a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.updateApp"),")"]}):a.jsxs(Se,{as:"span",children:[r("nodes.version")," ",t.version]}):a.jsxs(Se,{as:"span",sx:{color:"error.500"},children:[r("nodes.version")," ",t.version," (",r("nodes.unknownTemplate"),")"]}):a.jsx(Se,{as:"span",sx:{color:"error.500"},children:r("nodes.versionUnknown")}),[t,n,r]);return Bm(t)?a.jsxs($,{sx:{flexDir:"column"},children:[a.jsx(Se,{as:"span",sx:{fontWeight:600},children:o}),a.jsx(Se,{sx:{opacity:.7,fontStyle:"oblique 5deg"},children:n==null?void 0:n.description}),s,(t==null?void 0:t.notes)&&a.jsx(Se,{children:t.notes})]}):a.jsx(Se,{sx:{fontWeight:600},children:r("nodes.unknownNode")})});HR.displayName="TooltipContent";const M1=3,J_={circle:{transitionProperty:"none",transitionDuration:"0s"},".chakra-progress__track":{stroke:"transparent"}},the=({nodeId:e})=>{const t=d.useMemo(()=>ce(we,({nodes:r})=>r.nodeExecutionStates[e]),[e]),n=W(t);return n?a.jsx(Fn,{label:a.jsx(WR,{nodeExecutionState:n}),placement:"top",children:a.jsx($,{className:ec,sx:{w:5,h:"full",alignItems:"center",justifyContent:"flex-end"},children:a.jsx(VR,{nodeExecutionState:n})})}):null},nhe=d.memo(the),WR=d.memo(({nodeExecutionState:e})=>{const{status:t,progress:n,progressImage:r}=e,{t:o}=J();return t===ri.PENDING?a.jsx(Se,{children:"Pending"}):t===ri.IN_PROGRESS?r?a.jsxs($,{sx:{pos:"relative",pt:1.5,pb:.5},children:[a.jsx(wi,{src:r.dataURL,sx:{w:32,h:32,borderRadius:"base",objectFit:"contain"}}),n!==null&&a.jsxs(Ha,{variant:"solid",sx:{pos:"absolute",top:2.5,insetInlineEnd:1},children:[Math.round(n*100),"%"]})]}):n!==null?a.jsxs(Se,{children:[o("nodes.executionStateInProgress")," (",Math.round(n*100),"%)"]}):a.jsx(Se,{children:o("nodes.executionStateInProgress")}):t===ri.COMPLETED?a.jsx(Se,{children:o("nodes.executionStateCompleted")}):t===ri.FAILED?a.jsx(Se,{children:o("nodes.executionStateError")}):null});WR.displayName="TooltipLabel";const VR=d.memo(e=>{const{progress:t,status:n}=e.nodeExecutionState;return n===ri.PENDING?a.jsx(Lr,{as:aee,sx:{boxSize:M1,color:"base.600",_dark:{color:"base.300"}}}):n===ri.IN_PROGRESS?t===null?a.jsx(mx,{isIndeterminate:!0,size:"14px",color:"base.500",thickness:14,sx:J_}):a.jsx(mx,{value:Math.round(t*100),size:"14px",color:"base.500",thickness:14,sx:J_}):n===ri.COMPLETED?a.jsx(Lr,{as:FM,sx:{boxSize:M1,color:"ok.600",_dark:{color:"ok.300"}}}):n===ri.FAILED?a.jsx(Lr,{as:cee,sx:{boxSize:M1,color:"error.600",_dark:{color:"error.300"}}}):null});VR.displayName="StatusIcon";const rhe=({nodeId:e,isOpen:t})=>a.jsxs($,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",justifyContent:"space-between",h:8,textAlign:"center",fontWeight:500,color:"base.700",_dark:{color:"base.200"}},children:[a.jsx(U2,{nodeId:e,isOpen:t}),a.jsx(BR,{nodeId:e}),a.jsxs($,{alignItems:"center",children:[a.jsx(nhe,{nodeId:e}),a.jsx(ehe,{nodeId:e})]}),!t&&a.jsx(Kme,{nodeId:e})]}),ohe=d.memo(rhe),she=(e,t,n,r)=>ce(we,o=>{if(!r)return on.t("nodes.noFieldType");const{currentConnectionFieldType:s,connectionStartParams:i,nodes:l,edges:u}=o.nodes;if(!i||!s)return on.t("nodes.noConnectionInProgress");const{handleType:p,nodeId:m,handleId:h}=i;if(!p||!m||!h)return on.t("nodes.noConnectionData");const g=n==="target"?r:s,x=n==="source"?r:s;if(e===m)return on.t("nodes.cannotConnectToSelf");if(n===p)return n==="source"?on.t("nodes.cannotConnectOutputToOutput"):on.t("nodes.cannotConnectInputToInput");const y=n==="target"?e:m,b=n==="target"?t:h,C=n==="source"?e:m,S=n==="source"?t:h;return u.find(_=>{_.target===y&&_.targetHandle===b&&_.source===C&&_.sourceHandle})?on.t("nodes.cannotDuplicateConnection"):u.find(_=>_.target===y&&_.targetHandle===b)&&g!=="CollectionItem"?on.t("nodes.inputMayOnlyHaveOneConnection"):$b(x,g)?gP(p==="source"?m:e,p==="source"?e:m,l,u)?null:on.t("nodes.connectionWouldCreateCycle"):on.t("nodes.fieldTypesMustMatch")}),ahe=(e,t,n)=>{const r=d.useMemo(()=>ce(we,({nodes:s})=>{var l;const i=s.nodes.find(u=>u.id===e);if(Or(i))return(l=i==null?void 0:i.data[Db[n]][t])==null?void 0:l.type},je),[t,n,e]);return W(r)},ihe=ce(we,({nodes:e})=>e.currentConnectionFieldType!==null&&e.connectionStartParams!==null),UR=({nodeId:e,fieldName:t,kind:n})=>{const r=ahe(e,t,n),o=d.useMemo(()=>ce(we,({nodes:g})=>!!g.edges.filter(x=>(n==="input"?x.target:x.source)===e&&(n==="input"?x.targetHandle:x.sourceHandle)===t).length),[t,n,e]),s=d.useMemo(()=>she(e,t,n==="input"?"target":"source",r),[e,t,n,r]),i=d.useMemo(()=>ce(we,({nodes:g})=>{var x,y,b;return((x=g.connectionStartParams)==null?void 0:x.nodeId)===e&&((y=g.connectionStartParams)==null?void 0:y.handleId)===t&&((b=g.connectionStartParams)==null?void 0:b.handleType)==={input:"target",output:"source"}[n]}),[t,n,e]),l=W(o),u=W(ihe),p=W(i),m=W(s),h=d.useMemo(()=>!!(u&&m&&!p),[m,u,p]);return{isConnected:l,isConnectionInProgress:u,isConnectionStartField:p,connectionError:m,shouldDim:h}},lhe=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{var i;const s=o.nodes.find(l=>l.id===e);if(Or(s))return((i=s==null?void 0:s.data.inputs[t])==null?void 0:i.value)!==void 0},je),[t,e]);return W(n)},che=(e,t)=>{const n=d.useMemo(()=>ce(we,({nodes:o})=>{const s=o.nodes.find(u=>u.id===e);if(!Or(s))return;const i=o.nodeTemplates[(s==null?void 0:s.data.type)??""],l=i==null?void 0:i.inputs[t];return l==null?void 0:l.input},je),[t,e]);return W(n)},uhe=({nodeId:e,fieldName:t,kind:n,children:r})=>{const o=te(),s=K8(e,t),i=Q8(e,t,n),l=che(e,t),{t:u}=J(),p=d.useCallback(C=>{C.preventDefault()},[]),m=d.useMemo(()=>ce(we,({nodes:C})=>({isExposed:!!C.workflow.exposedFields.find(j=>j.nodeId===e&&j.fieldName===t)}),je),[t,e]),h=d.useMemo(()=>["any","direct"].includes(l??"__UNKNOWN_INPUT__"),[l]),{isExposed:g}=W(m),x=d.useCallback(()=>{o(SN({nodeId:e,fieldName:t}))},[o,t,e]),y=d.useCallback(()=>{o(rP({nodeId:e,fieldName:t}))},[o,t,e]),b=d.useMemo(()=>{const C=[];return h&&!g&&C.push(a.jsx(Wn,{icon:a.jsx(Xi,{}),onClick:x,children:"Add to Linear View"},`${e}.${t}.expose-field`)),h&&g&&C.push(a.jsx(Wn,{icon:a.jsx(yee,{}),onClick:y,children:"Remove from Linear View"},`${e}.${t}.unexpose-field`)),C},[t,x,y,g,h,e]);return a.jsx(c2,{menuProps:{size:"sm",isLazy:!0},menuButtonProps:{bg:"transparent",_hover:{bg:"transparent"}},renderMenu:()=>b.length?a.jsx(Ul,{sx:{visibility:"visible !important"},motionProps:fu,onContextMenu:p,children:a.jsx(Xd,{title:s||i||u("nodes.unknownField"),children:b})}):null,children:r})},dhe=d.memo(uhe),fhe=e=>{const{fieldTemplate:t,handleType:n,isConnectionInProgress:r,isConnectionStartField:o,connectionError:s}=e,{name:i,type:l}=t,{color:u,title:p}=vf[l],m=d.useMemo(()=>{const g=kN.includes(l),x=zb.includes(l),y=jN.includes(l),b=uf(u),C={backgroundColor:g||x?"var(--invokeai-colors-base-900)":b,position:"absolute",width:"1rem",height:"1rem",borderWidth:g||x?4:0,borderStyle:"solid",borderColor:b,borderRadius:y?4:"100%",zIndex:1};return n==="target"?C.insetInlineStart="-1rem":C.insetInlineEnd="-1rem",r&&!o&&s&&(C.filter="opacity(0.4) grayscale(0.7)"),r&&s?o?C.cursor="grab":C.cursor="not-allowed":C.cursor="crosshair",C},[s,n,r,o,l,u]),h=d.useMemo(()=>r&&o?p:r&&s?s??p:p,[s,r,o,p]);return a.jsx(Fn,{label:h,placement:n==="target"?"start":"end",hasArrow:!0,openDelay:ag,children:a.jsx(jd,{type:n,id:i,position:n==="target"?Vc.Left:Vc.Right,style:m})})},GR=d.memo(fhe),phe=({nodeId:e,fieldName:t})=>{const n=p0(e,t,"input"),r=lhe(e,t),{isConnected:o,isConnectionInProgress:s,isConnectionStartField:i,connectionError:l,shouldDim:u}=UR({nodeId:e,fieldName:t,kind:"input"}),p=d.useMemo(()=>{if((n==null?void 0:n.fieldKind)!=="input"||!n.required)return!1;if(!o&&n.input==="connection"||!r&&!o&&n.input==="any")return!0},[n,o,r]);return(n==null?void 0:n.fieldKind)!=="input"?a.jsx(ab,{shouldDim:u,children:a.jsxs(Kn,{sx:{color:"error.400",textAlign:"left",fontSize:"sm"},children:["Unknown input: ",t]})}):a.jsxs(ab,{shouldDim:u,children:[a.jsxs(Kn,{isInvalid:p,isDisabled:o,sx:{alignItems:"stretch",justifyContent:"space-between",ps:n.input==="direct"?0:2,gap:2,h:"full",w:"full"},children:[a.jsx(dhe,{nodeId:e,fieldName:t,kind:"input",children:m=>a.jsx(Rr,{sx:{display:"flex",alignItems:"center",h:"full",mb:0,px:1,gap:2},children:a.jsx(Y8,{ref:m,nodeId:e,fieldName:t,kind:"input",isMissingInput:p,withTooltip:!0})})}),a.jsx(De,{children:a.jsx(lR,{nodeId:e,fieldName:t})})]}),n.input!=="direct"&&a.jsx(GR,{fieldTemplate:n,handleType:"target",isConnectionInProgress:s,isConnectionStartField:i,connectionError:l})]})},Z_=d.memo(phe),ab=d.memo(({shouldDim:e,children:t})=>a.jsx($,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",w:"full",h:"full"},children:t}));ab.displayName="InputFieldWrapper";const mhe=({nodeId:e,fieldName:t})=>{const n=p0(e,t,"output"),{isConnected:r,isConnectionInProgress:o,isConnectionStartField:s,connectionError:i,shouldDim:l}=UR({nodeId:e,fieldName:t,kind:"output"});return(n==null?void 0:n.fieldKind)!=="output"?a.jsx(ib,{shouldDim:l,children:a.jsxs(Kn,{sx:{color:"error.400",textAlign:"right",fontSize:"sm"},children:["Unknown output: ",t]})}):a.jsxs(ib,{shouldDim:l,children:[a.jsx(Fn,{label:a.jsx(D2,{nodeId:e,fieldName:t,kind:"output"}),openDelay:ag,placement:"top",shouldWrapChildren:!0,hasArrow:!0,children:a.jsx(Kn,{isDisabled:r,pe:2,children:a.jsx(Rr,{sx:{mb:0,fontWeight:500},children:n==null?void 0:n.title})})}),a.jsx(GR,{fieldTemplate:n,handleType:"source",isConnectionInProgress:o,isConnectionStartField:s,connectionError:i})]})},hhe=d.memo(mhe),ib=d.memo(({shouldDim:e,children:t})=>a.jsx($,{sx:{position:"relative",minH:8,py:.5,alignItems:"center",opacity:e?.5:1,transitionProperty:"opacity",transitionDuration:"0.1s",justifyContent:"flex-end"},children:t}));ib.displayName="OutputFieldWrapper";const ghe=e=>{const t=V2(e),n=jn("invocationCache").isFeatureEnabled;return d.useMemo(()=>t||n,[t,n])},vhe=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>{const s=Mme(e),i=Eme(e),l=ghe(e),u=Ome(e);return a.jsxs(C0,{nodeId:e,selected:o,children:[a.jsx(ohe,{nodeId:e,isOpen:t,label:n,selected:o,type:r}),t&&a.jsxs(a.Fragment,{children:[a.jsx($,{layerStyle:"nodeBody",sx:{flexDirection:"column",w:"full",h:"full",py:2,gap:1,borderBottomRadius:l?0:"base"},children:a.jsxs($,{sx:{flexDir:"column",px:2,w:"full",h:"full"},children:[a.jsxs(tl,{gridTemplateColumns:"1fr auto",gridAutoRows:"1fr",children:[s.map((p,m)=>a.jsx(qd,{gridColumnStart:1,gridRowStart:m+1,children:a.jsx(Z_,{nodeId:e,fieldName:p})},`${e}.${p}.input-field`)),u.map((p,m)=>a.jsx(qd,{gridColumnStart:2,gridRowStart:m+1,children:a.jsx(hhe,{nodeId:e,fieldName:p})},`${e}.${p}.output-field`))]}),i.map(p=>a.jsx(Z_,{nodeId:e,fieldName:p},`${e}.${p}.input-field`))]})}),l&&a.jsx(Wme,{nodeId:e})]})]})},xhe=d.memo(vhe),bhe=({nodeId:e,isOpen:t,label:n,type:r,selected:o})=>a.jsxs(C0,{nodeId:e,selected:o,children:[a.jsxs($,{className:ec,layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:t?0:"base",alignItems:"center",h:8,fontWeight:600,fontSize:"sm"},children:[a.jsx(U2,{nodeId:e,isOpen:t}),a.jsx(Se,{sx:{w:"full",textAlign:"center",pe:8,color:"error.500",_dark:{color:"error.300"}},children:n?`${n} (${r})`:r})]}),t&&a.jsx($,{layerStyle:"nodeBody",sx:{userSelect:"auto",flexDirection:"column",w:"full",h:"full",p:4,gap:1,borderBottomRadius:"base",fontSize:"sm"},children:a.jsxs(De,{children:[a.jsx(Se,{as:"span",children:"Unknown node type: "}),a.jsx(Se,{as:"span",fontWeight:600,children:r})]})})]}),yhe=d.memo(bhe),Che=e=>{const{data:t,selected:n}=e,{id:r,type:o,isOpen:s,label:i}=t,l=d.useMemo(()=>ce(we,({nodes:p})=>!!p.nodeTemplates[o]),[o]);return W(l)?a.jsx(xhe,{nodeId:r,isOpen:s,label:i,type:o,selected:n}):a.jsx(yhe,{nodeId:r,isOpen:s,label:i,type:o,selected:n})},whe=d.memo(Che),She=e=>{const{id:t,data:n,selected:r}=e,{notes:o,isOpen:s}=n,i=te(),l=d.useCallback(u=>{i(_N({nodeId:t,value:u.target.value}))},[i,t]);return a.jsxs(C0,{nodeId:t,selected:r,children:[a.jsxs($,{layerStyle:"nodeHeader",sx:{borderTopRadius:"base",borderBottomRadius:s?0:"base",alignItems:"center",justifyContent:"space-between",h:8},children:[a.jsx(U2,{nodeId:t,isOpen:s}),a.jsx(BR,{nodeId:t,title:"Notes"}),a.jsx(De,{minW:8})]}),s&&a.jsx(a.Fragment,{children:a.jsx($,{layerStyle:"nodeBody",className:"nopan",sx:{cursor:"auto",flexDirection:"column",borderBottomRadius:"base",w:"full",h:"full",p:2,gap:1},children:a.jsx($,{className:"nopan",sx:{flexDir:"column",w:"full",h:"full"},children:a.jsx(gi,{value:o,onChange:l,rows:8,resize:"none",sx:{fontSize:"xs"}})})})})]})},khe=d.memo(She),jhe=["Delete","Backspace"],_he={collapsed:wme,default:kme},Ihe={invocation:whe,current_image:Pme,notes:khe},Phe={hideAttribution:!0},Ehe=ce(we,({nodes:e})=>{const{shouldSnapToGrid:t,selectionMode:n}=e;return{shouldSnapToGrid:t,selectionMode:n}},je),Mhe=()=>{const e=te(),t=W(R=>R.nodes.nodes),n=W(R=>R.nodes.edges),r=W(R=>R.nodes.viewport),{shouldSnapToGrid:o,selectionMode:s}=W(Ehe),i=d.useRef(null),l=d.useRef(),u=vme(),[p]=Ks("radii",["base"]),m=d.useCallback(R=>{e(IN(R))},[e]),h=d.useCallback(R=>{e(PN(R))},[e]),g=d.useCallback((R,N)=>{e(EN(N))},[e]),x=d.useCallback(R=>{e(aS(R))},[e]),y=d.useCallback(()=>{e(MN({cursorPosition:l.current}))},[e]),b=d.useCallback(R=>{e(ON(R))},[e]),C=d.useCallback(R=>{e(RN(R))},[e]),S=d.useCallback(({nodes:R,edges:N})=>{e(AN(R?R.map(Y=>Y.id):[])),e(DN(N?N.map(Y=>Y.id):[]))},[e]),j=d.useCallback((R,N)=>{e(TN(N))},[e]),_=d.useCallback(()=>{e(xP())},[e]),P=d.useCallback(R=>{iS.set(R),R.fitView()},[]),I=d.useCallback(R=>{var Y,F;const N=(Y=i.current)==null?void 0:Y.getBoundingClientRect();if(N){const V=(F=iS.get())==null?void 0:F.project({x:R.clientX-N.left,y:R.clientY-N.top});l.current=V}},[]),M=d.useRef(),O=d.useCallback((R,N,Y)=>{M.current=R,e(NN(N.id)),e($N())},[e]),A=d.useCallback((R,N)=>{e(aS(N))},[e]),D=d.useCallback((R,N,Y)=>{var F,V;!("touches"in R)&&((F=M.current)==null?void 0:F.clientX)===R.clientX&&((V=M.current)==null?void 0:V.clientY)===R.clientY&&e(LN(N)),M.current=void 0},[e]);return It(["Ctrl+c","Meta+c"],R=>{R.preventDefault(),e(zN())}),It(["Ctrl+a","Meta+a"],R=>{R.preventDefault(),e(FN())}),It(["Ctrl+v","Meta+v"],R=>{R.preventDefault(),e(BN({cursorPosition:l.current}))}),a.jsx(HN,{id:"workflow-editor",ref:i,defaultViewport:r,nodeTypes:Ihe,edgeTypes:_he,nodes:t,edges:n,onInit:P,onMouseMove:I,onNodesChange:m,onEdgesChange:h,onEdgesDelete:b,onEdgeUpdate:A,onEdgeUpdateStart:O,onEdgeUpdateEnd:D,onNodesDelete:C,onConnectStart:g,onConnect:x,onConnectEnd:y,onMoveEnd:j,connectionLineComponent:yme,onSelectionChange:S,isValidConnection:u,minZoom:.1,snapToGrid:o,snapGrid:[25,25],connectionRadius:30,proOptions:Phe,style:{borderRadius:p},onPaneClick:_,deleteKeyCode:jhe,selectionMode:s,children:a.jsx(U$,{})})},Ohe=()=>{const e=te(),{t}=J(),n=d.useCallback(()=>{e(hP())},[e]);return a.jsx($,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:2},children:a.jsx(ot,{tooltip:t("nodes.addNodeToolTip"),"aria-label":t("nodes.addNode"),icon:a.jsx(Xi,{}),onClick:n})})},Rhe=d.memo(Ohe),Ahe=()=>{const e=te(),t=G5("nodes"),{t:n}=J();return d.useCallback(o=>{if(!o)return;const s=new FileReader;s.onload=async()=>{const i=s.result;try{const l=JSON.parse(String(i)),u=UI.safeParse(l);if(!u.success){const{message:p}=WN(u.error,{prefix:n("nodes.workflowValidation")});t.error({error:VN(u.error)},p),e($t(Gn({title:n("nodes.unableToValidateWorkflow"),status:"error",duration:5e3}))),s.abort();return}e(Pb(u.data)),s.abort()}catch{e($t(Gn({title:n("nodes.unableToLoadWorkflow"),status:"error"})))}},s.readAsText(o)},[e,t,n])},Dhe=d.memo(e=>e.error.issues[0]?a.jsx(Se,{children:lS(e.error.issues[0],{prefix:null}).toString()}):a.jsx(_f,{children:e.error.issues.map((t,n)=>a.jsx(ws,{children:a.jsx(Se,{children:lS(t,{prefix:null}).toString()})},n))}));Dhe.displayName="WorkflowValidationErrorContent";const The=()=>{const{t:e}=J(),t=d.useRef(null),n=Ahe();return a.jsx(pM,{resetRef:t,accept:"application/json",onChange:n,children:r=>a.jsx(ot,{icon:a.jsx(Kg,{}),tooltip:e("nodes.loadWorkflow"),"aria-label":e("nodes.loadWorkflow"),...r})})},Nhe=d.memo(The),$he=()=>{const{t:e}=J(),t=te(),{isOpen:n,onOpen:r,onClose:o}=Uo(),s=d.useRef(null),i=W(u=>u.nodes.nodes.length),l=d.useCallback(()=>{t(UN()),t($t(Gn({title:e("toast.nodesCleared"),status:"success"}))),o()},[t,e,o]);return a.jsxs(a.Fragment,{children:[a.jsx(ot,{icon:a.jsx(qo,{}),tooltip:e("nodes.resetWorkflow"),"aria-label":e("nodes.resetWorkflow"),onClick:r,isDisabled:!i,colorScheme:"error"}),a.jsxs(Mf,{isOpen:n,onClose:o,leastDestructiveRef:s,isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Of,{children:[a.jsx(ra,{fontSize:"lg",fontWeight:"bold",children:e("nodes.resetWorkflow")}),a.jsx(sa,{py:4,children:a.jsxs($,{flexDir:"column",gap:2,children:[a.jsx(Se,{children:e("nodes.resetWorkflowDesc")}),a.jsx(Se,{variant:"subtext",children:e("nodes.resetWorkflowDesc2")})]})}),a.jsxs(Oa,{children:[a.jsx(el,{ref:s,onClick:o,children:e("common.cancel")}),a.jsx(el,{colorScheme:"error",ml:3,onClick:l,children:e("common.accept")})]})]})]})]})},Lhe=d.memo($he),zhe=()=>{const{t:e}=J(),t=U8(),n=d.useCallback(()=>{const r=new Blob([JSON.stringify(t,null,2)]),o=document.createElement("a");o.href=URL.createObjectURL(r),o.download=`${t.name||"My Workflow"}.json`,document.body.appendChild(o),o.click(),o.remove()},[t]);return a.jsx(ot,{icon:a.jsx(zu,{}),tooltip:e("nodes.downloadWorkflow"),"aria-label":e("nodes.downloadWorkflow"),onClick:n})},Fhe=d.memo(zhe),Bhe=()=>a.jsxs($,{sx:{gap:2,position:"absolute",top:2,insetInlineStart:"50%",transform:"translate(-50%)"},children:[a.jsx(Fhe,{}),a.jsx(Nhe,{}),a.jsx(Lhe,{})]}),Hhe=d.memo(Bhe),Whe=()=>a.jsx($,{sx:{gap:2,flexDir:"column"},children:Ro(vf,({title:e,description:t,color:n},r)=>a.jsx(Fn,{label:t,children:a.jsx(Ha,{sx:{userSelect:"none",color:parseInt(n.split(".")[1]??"0",10)<500?"base.800":"base.50",bg:n},textAlign:"center",children:e})},r))}),Vhe=d.memo(Whe),Uhe=()=>{const{t:e}=J(),t=te(),n=d.useCallback(()=>{t(GN())},[t]);return a.jsx(Mt,{leftIcon:a.jsx(Mee,{}),tooltip:e("nodes.reloadNodeTemplates"),"aria-label":e("nodes.reloadNodeTemplates"),onClick:n,children:e("nodes.reloadNodeTemplates")})},Ghe=d.memo(Uhe),wd={fontWeight:600},qhe=ce(we,({nodes:e})=>{const{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionMode:s}=e;return{shouldAnimateEdges:t,shouldValidateGraph:n,shouldSnapToGrid:r,shouldColorEdges:o,selectionModeIsChecked:s===qN.Full}},je),Khe=Oe((e,t)=>{const{isOpen:n,onOpen:r,onClose:o}=Uo(),s=te(),{shouldAnimateEdges:i,shouldValidateGraph:l,shouldSnapToGrid:u,shouldColorEdges:p,selectionModeIsChecked:m}=W(qhe),h=d.useCallback(S=>{s(KN(S.target.checked))},[s]),g=d.useCallback(S=>{s(QN(S.target.checked))},[s]),x=d.useCallback(S=>{s(XN(S.target.checked))},[s]),y=d.useCallback(S=>{s(YN(S.target.checked))},[s]),b=d.useCallback(S=>{s(JN(S.target.checked))},[s]),{t:C}=J();return a.jsxs(a.Fragment,{children:[a.jsx(ot,{ref:t,"aria-label":C("nodes.workflowSettings"),tooltip:C("nodes.workflowSettings"),icon:a.jsx(HM,{}),onClick:r}),a.jsxs(ql,{isOpen:n,onClose:o,size:"2xl",isCentered:!0,children:[a.jsx(oa,{}),a.jsxs(Kl,{children:[a.jsx(ra,{children:C("nodes.workflowSettings")}),a.jsx(Rf,{}),a.jsx(sa,{children:a.jsxs($,{sx:{flexDirection:"column",gap:4,py:4},children:[a.jsx(xo,{size:"sm",children:"General"}),a.jsx(kr,{formLabelProps:wd,onChange:g,isChecked:i,label:C("nodes.animatedEdges"),helperText:C("nodes.animatedEdgesHelp")}),a.jsx(no,{}),a.jsx(kr,{formLabelProps:wd,isChecked:u,onChange:x,label:C("nodes.snapToGrid"),helperText:C("nodes.snapToGridHelp")}),a.jsx(no,{}),a.jsx(kr,{formLabelProps:wd,isChecked:p,onChange:y,label:C("nodes.colorCodeEdges"),helperText:C("nodes.colorCodeEdgesHelp")}),a.jsx(kr,{formLabelProps:wd,isChecked:m,onChange:b,label:C("nodes.fullyContainNodes"),helperText:C("nodes.fullyContainNodesHelp")}),a.jsx(xo,{size:"sm",pt:4,children:"Advanced"}),a.jsx(kr,{formLabelProps:wd,isChecked:l,onChange:h,label:C("nodes.validateConnections"),helperText:C("nodes.validateConnectionsHelp")}),a.jsx(Ghe,{})]})})]})]})]})}),Qhe=d.memo(Khe),Xhe=()=>{const e=W(t=>t.nodes.shouldShowFieldTypeLegend);return a.jsxs($,{sx:{gap:2,position:"absolute",top:2,insetInlineEnd:2},children:[a.jsx(Qhe,{}),e&&a.jsx(Vhe,{})]})},Yhe=d.memo(Xhe);function Jhe(){const e=te(),t=W(o=>o.nodes.nodeOpacity),{t:n}=J(),r=d.useCallback(o=>{e(ZN(o))},[e]);return a.jsx($,{alignItems:"center",children:a.jsxs(Cy,{"aria-label":n("nodes.nodeOpacity"),value:t,min:.5,max:1,step:.01,onChange:r,orientation:"vertical",defaultValue:30,h:"calc(100% - 0.5rem)",children:[a.jsx(Sy,{children:a.jsx(ky,{})}),a.jsx(wy,{})]})})}const Zhe=()=>{const{t:e}=J(),{zoomIn:t,zoomOut:n,fitView:r}=Nb(),o=te(),s=W(m=>m.nodes.shouldShowMinimapPanel),i=d.useCallback(()=>{t()},[t]),l=d.useCallback(()=>{n()},[n]),u=d.useCallback(()=>{r()},[r]),p=d.useCallback(()=>{o(e9(!s))},[s,o]);return a.jsxs(zn,{isAttached:!0,orientation:"vertical",children:[a.jsx(ot,{tooltip:e("nodes.zoomInNodes"),"aria-label":e("nodes.zoomInNodes"),onClick:i,icon:a.jsx(Koe,{})}),a.jsx(ot,{tooltip:e("nodes.zoomOutNodes"),"aria-label":e("nodes.zoomOutNodes"),onClick:l,icon:a.jsx(qoe,{})}),a.jsx(ot,{tooltip:e("nodes.fitViewportNodes"),"aria-label":e("nodes.fitViewportNodes"),onClick:u,icon:a.jsx(WM,{})}),a.jsx(ot,{tooltip:e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),"aria-label":e(s?"nodes.hideMinimapnodes":"nodes.showMinimapnodes"),isChecked:s,onClick:p,icon:a.jsx(bee,{})})]})},ege=d.memo(Zhe),tge=()=>a.jsxs($,{sx:{gap:2,position:"absolute",bottom:2,insetInlineStart:2},children:[a.jsx(ege,{}),a.jsx(Jhe,{})]}),nge=d.memo(tge),rge=Ee(z$),oge=()=>{const e=W(r=>r.nodes.shouldShowMinimapPanel),t=di("var(--invokeai-colors-accent-300)","var(--invokeai-colors-accent-600)"),n=di("var(--invokeai-colors-blackAlpha-300)","var(--invokeai-colors-blackAlpha-600)");return a.jsx($,{sx:{gap:2,position:"absolute",bottom:2,insetInlineEnd:2},children:e&&a.jsx(rge,{pannable:!0,zoomable:!0,nodeBorderRadius:15,sx:{m:"0 !important",backgroundColor:"base.200 !important",borderRadius:"base",_dark:{backgroundColor:"base.500 !important"},svg:{borderRadius:"inherit"}},nodeColor:t,maskColor:n})})},sge=d.memo(oge),age=()=>{const e=W(n=>n.nodes.isReady),{t}=J();return a.jsxs($,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center"},children:[a.jsx(yo,{children:e&&a.jsxs(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"relative",width:"100%",height:"100%"},children:[a.jsx(Mhe,{}),a.jsx(gme,{}),a.jsx(Rhe,{}),a.jsx(Hhe,{}),a.jsx(Yhe,{}),a.jsx(nge,{}),a.jsx(sge,{})]})}),a.jsx(yo,{children:!e&&a.jsx(Mr.div,{initial:{opacity:0},animate:{opacity:1,transition:{duration:.2}},exit:{opacity:0,transition:{duration:.2}},style:{position:"absolute",width:"100%",height:"100%"},children:a.jsx($,{layerStyle:"first",sx:{position:"relative",width:"full",height:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",pointerEvents:"none"},children:a.jsx(eo,{label:t("nodes.loadingNodes"),icon:Qoe})})})})]})},ige=d.memo(age),lge=()=>a.jsx(t9,{children:a.jsx(ige,{})}),cge=d.memo(lge),uge=()=>{const{t:e}=J(),t=te(),{data:n}=bf(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=n9({fixedCacheKey:"clearInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.size)||!r,[n==null?void 0:n.size,r]);return{clearInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t($t({title:e("invocationCache.clearSucceeded"),status:"success"}))}catch{t($t({title:e("invocationCache.clearFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},dge=()=>{const{t:e}=J(),{clearInvocationCache:t,isDisabled:n,isLoading:r}=uge();return a.jsx(Mt,{isDisabled:n,isLoading:r,onClick:t,children:e("invocationCache.clear")})},fge=d.memo(dge),pge=()=>{const{t:e}=J(),t=te(),{data:n}=bf(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=r9({fixedCacheKey:"disableInvocationCache"}),i=d.useMemo(()=>!(n!=null&&n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{disableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t($t({title:e("invocationCache.disableSucceeded"),status:"success"}))}catch{t($t({title:e("invocationCache.disableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},mge=()=>{const{t:e}=J(),t=te(),{data:n}=bf(),r=W(u=>u.system.isConnected),[o,{isLoading:s}]=o9({fixedCacheKey:"enableInvocationCache"}),i=d.useMemo(()=>(n==null?void 0:n.enabled)||!r||(n==null?void 0:n.max_size)===0,[n==null?void 0:n.enabled,n==null?void 0:n.max_size,r]);return{enableInvocationCache:d.useCallback(async()=>{if(!i)try{await o().unwrap(),t($t({title:e("invocationCache.enableSucceeded"),status:"success"}))}catch{t($t({title:e("invocationCache.enableFailed"),status:"error"}))}},[i,o,t,e]),isLoading:s,cacheStatus:n,isDisabled:i}},hge=()=>{const{t:e}=J(),{data:t}=bf(),{enableInvocationCache:n,isDisabled:r,isLoading:o}=mge(),{disableInvocationCache:s,isDisabled:i,isLoading:l}=pge();return t!=null&&t.enabled?a.jsx(Mt,{isDisabled:i,isLoading:l,onClick:s,children:e("invocationCache.disable")}):a.jsx(Mt,{isDisabled:r,isLoading:o,onClick:n,children:e("invocationCache.enable")})},gge=d.memo(hge),vge=({children:e,...t})=>a.jsx(F5,{alignItems:"center",justifyContent:"center",w:"full",h:"full",layerStyle:"second",borderRadius:"base",py:2,px:3,gap:6,flexWrap:"nowrap",...t,children:e}),qR=d.memo(vge),xge={'&[aria-disabled="true"]':{color:"base.400",_dark:{color:"base.500"}}},bge=({label:e,value:t,isDisabled:n=!1,...r})=>a.jsxs(z5,{flexGrow:1,textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap","aria-disabled":n,sx:xge,...r,children:[a.jsx(B5,{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",children:e}),a.jsx(H5,{children:t})]}),Sa=d.memo(bge),yge=()=>{const{t:e}=J(),{data:t}=bf(void 0);return a.jsxs(qR,{children:[a.jsx(Sa,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.cacheSize"),value:(t==null?void 0:t.size)??0}),a.jsx(Sa,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.hits"),value:(t==null?void 0:t.hits)??0}),a.jsx(Sa,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.misses"),value:(t==null?void 0:t.misses)??0}),a.jsx(Sa,{isDisabled:!(t!=null&&t.enabled),label:e("invocationCache.maxCacheSize"),value:(t==null?void 0:t.max_size)??0}),a.jsxs(zn,{w:24,orientation:"vertical",size:"xs",children:[a.jsx(fge,{}),a.jsx(gge,{})]})]})},Cge=d.memo(yge),KR=e=>{const t=W(l=>l.system.isConnected),[n,{isLoading:r}]=Mb(),o=te(),{t:s}=J();return{cancelQueueItem:d.useCallback(async()=>{try{await n(e).unwrap(),o($t({title:s("queue.cancelSucceeded"),status:"success"}))}catch{o($t({title:s("queue.cancelFailed"),status:"error"}))}},[o,e,s,n]),isLoading:r,isDisabled:!t}},QR=(e,t)=>Number(((Date.parse(t)-Date.parse(e))/1e3).toFixed(2)),eI={pending:{colorScheme:"cyan",translationKey:"queue.pending"},in_progress:{colorScheme:"yellow",translationKey:"queue.in_progress"},completed:{colorScheme:"green",translationKey:"queue.completed"},failed:{colorScheme:"red",translationKey:"queue.failed"},canceled:{colorScheme:"orange",translationKey:"queue.canceled"}},wge=({status:e})=>{const{t}=J();return a.jsx(Ha,{colorScheme:eI[e].colorScheme,children:t(eI[e].translationKey)})},Sge=d.memo(wge),kge=e=>{const t=W(u=>u.system.isConnected),{isCanceled:n}=s9({batch_id:e},{selectFromResult:({data:u})=>u?{isCanceled:(u==null?void 0:u.in_progress)===0&&(u==null?void 0:u.pending)===0}:{isCanceled:!0}}),[r,{isLoading:o}]=a9({fixedCacheKey:"cancelByBatchIds"}),s=te(),{t:i}=J();return{cancelBatch:d.useCallback(async()=>{if(!n)try{await r({batch_ids:[e]}).unwrap(),s($t({title:i("queue.cancelBatchSucceeded"),status:"success"}))}catch{s($t({title:i("queue.cancelBatchFailed"),status:"error"}))}},[e,s,n,i,r]),isLoading:o,isCanceled:n,isDisabled:!t}},jge=({queueItemDTO:e})=>{const{session_id:t,batch_id:n,item_id:r}=e,{t:o}=J(),{cancelBatch:s,isLoading:i,isCanceled:l}=kge(n),{cancelQueueItem:u,isLoading:p}=KR(r),{data:m}=i9(r),h=d.useMemo(()=>{if(!m)return o("common.loading");if(!m.completed_at||!m.started_at)return o(`queue.${m.status}`);const g=QR(m.started_at,m.completed_at);return m.status==="completed"?`${o("queue.completedIn")} ${g}${g===1?"":"s"}`:`${g}s`},[m,o]);return a.jsxs($,{layerStyle:"third",flexDir:"column",p:2,pt:0,borderRadius:"base",gap:2,children:[a.jsxs($,{layerStyle:"second",p:2,gap:2,justifyContent:"space-between",alignItems:"center",borderRadius:"base",h:20,children:[a.jsx(vm,{label:o("queue.status"),data:h}),a.jsx(vm,{label:o("queue.item"),data:r}),a.jsx(vm,{label:o("queue.batch"),data:n}),a.jsx(vm,{label:o("queue.session"),data:t}),a.jsxs(zn,{size:"xs",orientation:"vertical",children:[a.jsx(Mt,{onClick:u,isLoading:p,isDisabled:m?["canceled","completed","failed"].includes(m.status):!0,"aria-label":o("queue.cancelItem"),icon:a.jsx(wu,{}),colorScheme:"error",children:o("queue.cancelItem")}),a.jsx(Mt,{onClick:s,isLoading:i,isDisabled:l,"aria-label":o("queue.cancelBatch"),icon:a.jsx(wu,{}),colorScheme:"error",children:o("queue.cancelBatch")})]})]}),(m==null?void 0:m.error)&&a.jsxs($,{layerStyle:"second",p:3,gap:1,justifyContent:"space-between",alignItems:"flex-start",borderRadius:"base",flexDir:"column",children:[a.jsx(xo,{size:"sm",color:"error.500",_dark:{color:"error.400"},children:"Error"}),a.jsx("pre",{children:m.error})]}),a.jsx($,{layerStyle:"second",h:512,w:"full",borderRadius:"base",alignItems:"center",justifyContent:"center",children:m?a.jsx(Hu,{children:a.jsx(Zi,{label:"Queue Item",data:m})}):a.jsx(vi,{opacity:.5})})]})},_ge=d.memo(jge),vm=({label:e,data:t})=>a.jsxs($,{flexDir:"column",justifyContent:"flex-start",p:1,gap:1,overflow:"hidden",h:"full",w:"full",children:[a.jsx(xo,{size:"md",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:e}),a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",children:t})]}),ja={number:"3rem",statusBadge:"5.7rem",statusDot:2,time:"4rem",batchId:"5rem",fieldValues:"auto",actions:"auto"},tI={bg:"base.300",_dark:{bg:"base.750"}},Ige={_hover:tI,"&[aria-selected='true']":tI},Pge=({index:e,item:t,context:n})=>{const{t:r}=J(),o=d.useCallback(()=>{n.toggleQueueItem(t.item_id)},[n,t.item_id]),{cancelQueueItem:s,isLoading:i}=KR(t.item_id),l=d.useCallback(h=>{h.stopPropagation(),s()},[s]),u=d.useMemo(()=>n.openQueueItems.includes(t.item_id),[n.openQueueItems,t.item_id]),p=d.useMemo(()=>!t.completed_at||!t.started_at?void 0:`${QR(t.started_at,t.completed_at)}s`,[t]),m=d.useMemo(()=>["canceled","completed","failed"].includes(t.status),[t.status]);return a.jsxs($,{flexDir:"column","aria-selected":u,fontSize:"sm",borderRadius:"base",justifyContent:"center",sx:Ige,"data-testid":"queue-item",children:[a.jsxs($,{minH:9,alignItems:"center",gap:4,p:1.5,cursor:"pointer",onClick:o,children:[a.jsx($,{w:ja.number,justifyContent:"flex-end",alignItems:"center",flexShrink:0,children:a.jsx(Se,{variant:"subtext",children:e+1})}),a.jsx($,{w:ja.statusBadge,alignItems:"center",flexShrink:0,children:a.jsx(Sge,{status:t.status})}),a.jsx($,{w:ja.time,alignItems:"center",flexShrink:0,children:p||"-"}),a.jsx($,{w:ja.batchId,flexShrink:0,children:a.jsx(Se,{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",alignItems:"center",children:t.batch_id})}),a.jsx($,{alignItems:"center",overflow:"hidden",flexGrow:1,children:t.field_values&&a.jsx($,{gap:2,w:"full",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",children:t.field_values.filter(h=>h.node_path!=="metadata_accumulator").map(({node_path:h,field_name:g,value:x})=>a.jsxs(Se,{as:"span",children:[a.jsxs(Se,{as:"span",fontWeight:600,children:[h,".",g]}),": ",x]},`${t.item_id}.${h}.${g}.${x}`))})}),a.jsx($,{alignItems:"center",w:ja.actions,pe:3,children:a.jsx(zn,{size:"xs",variant:"ghost",children:a.jsx(ot,{onClick:l,isDisabled:m,isLoading:i,"aria-label":r("queue.cancelItem"),icon:a.jsx(wu,{})})})})]}),a.jsx(wf,{in:u,transition:{enter:{duration:.1},exit:{duration:.1}},unmountOnExit:!0,children:a.jsx(_ge,{queueItemDTO:t})})]})},Ege=d.memo(Pge),Mge=d.memo(Oe((e,t)=>a.jsx($,{...e,ref:t,flexDirection:"column",gap:.5,children:e.children}))),Oge=d.memo(Mge),Rge=()=>a.jsxs($,{alignItems:"center",gap:4,p:1,pb:2,textTransform:"uppercase",fontWeight:700,fontSize:"xs",letterSpacing:1,children:[a.jsx($,{w:ja.number,justifyContent:"flex-end",alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"#"})}),a.jsx($,{ps:.5,w:ja.statusBadge,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"status"})}),a.jsx($,{ps:.5,w:ja.time,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"time"})}),a.jsx($,{ps:.5,w:ja.batchId,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch"})}),a.jsx($,{ps:.5,w:ja.fieldValues,alignItems:"center",children:a.jsx(Se,{variant:"subtext",children:"batch field values"})})]}),Age=d.memo(Rge),Dge={defer:!0,options:{scrollbars:{visibility:"auto",autoHide:"scroll",autoHideDelay:1300,theme:"os-theme-dark"},overflow:{x:"hidden"}}},Tge=ce(we,({queue:e})=>{const{listCursor:t,listPriority:n}=e;return{listCursor:t,listPriority:n}},je),Nge=(e,t)=>t.item_id,$ge={List:Oge},Lge=(e,t,n)=>a.jsx(Ege,{index:e,item:t,context:n}),zge=()=>{const{listCursor:e,listPriority:t}=W(Tge),n=te(),r=d.useRef(null),[o,s]=d.useState(null),[i,l]=a2(Dge),{t:u}=J();d.useEffect(()=>{const{current:S}=r;return o&&S&&i({target:S,elements:{viewport:o}}),()=>{var j;return(j=l())==null?void 0:j.destroy()}},[o,i,l]);const{data:p,isLoading:m}=l9({cursor:e,priority:t}),h=d.useMemo(()=>p?c9.getSelectors().selectAll(p):[],[p]),g=d.useCallback(()=>{if(!(p!=null&&p.has_more))return;const S=h[h.length-1];S&&(n(Ob(S.item_id)),n(Rb(S.priority)))},[n,p==null?void 0:p.has_more,h]),[x,y]=d.useState([]),b=d.useCallback(S=>{y(j=>j.includes(S)?j.filter(_=>_!==S):[...j,S])},[]),C=d.useMemo(()=>({openQueueItems:x,toggleQueueItem:b}),[x,b]);return m?a.jsx(ure,{}):h.length?a.jsxs($,{w:"full",h:"full",flexDir:"column",children:[a.jsx(Age,{}),a.jsx($,{ref:r,w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(Coe,{data:h,endReached:g,scrollerRef:s,itemContent:Lge,computeItemKey:Nge,components:$ge,context:C})})]}):a.jsx($,{w:"full",h:"full",alignItems:"center",justifyContent:"center",children:a.jsx(xo,{color:"base.400",_dark:{color:"base.500"},children:u("queue.queueEmpty")})})},Fge=d.memo(zge),Bge=()=>{const{data:e}=Fa(),{t}=J();return a.jsxs(qR,{"data-testid":"queue-status",children:[a.jsx(Sa,{label:t("queue.in_progress"),value:(e==null?void 0:e.queue.in_progress)??0}),a.jsx(Sa,{label:t("queue.pending"),value:(e==null?void 0:e.queue.pending)??0}),a.jsx(Sa,{label:t("queue.completed"),value:(e==null?void 0:e.queue.completed)??0}),a.jsx(Sa,{label:t("queue.failed"),value:(e==null?void 0:e.queue.failed)??0}),a.jsx(Sa,{label:t("queue.canceled"),value:(e==null?void 0:e.queue.canceled)??0}),a.jsx(Sa,{label:t("queue.total"),value:(e==null?void 0:e.queue.total)??0})]})},Hge=d.memo(Bge);function Wge(e){return Qe({tag:"svg",attr:{fill:"currentColor",viewBox:"0 0 16 16"},child:[{tag:"path",attr:{d:"M7.657 6.247c.11-.33.576-.33.686 0l.645 1.937a2.89 2.89 0 0 0 1.829 1.828l1.936.645c.33.11.33.576 0 .686l-1.937.645a2.89 2.89 0 0 0-1.828 1.829l-.645 1.936a.361.361 0 0 1-.686 0l-.645-1.937a2.89 2.89 0 0 0-1.828-1.828l-1.937-.645a.361.361 0 0 1 0-.686l1.937-.645a2.89 2.89 0 0 0 1.828-1.828l.645-1.937zM3.794 1.148a.217.217 0 0 1 .412 0l.387 1.162c.173.518.579.924 1.097 1.097l1.162.387a.217.217 0 0 1 0 .412l-1.162.387A1.734 1.734 0 0 0 4.593 5.69l-.387 1.162a.217.217 0 0 1-.412 0L3.407 5.69A1.734 1.734 0 0 0 2.31 4.593l-1.162-.387a.217.217 0 0 1 0-.412l1.162-.387A1.734 1.734 0 0 0 3.407 2.31l.387-1.162zM10.863.099a.145.145 0 0 1 .274 0l.258.774c.115.346.386.617.732.732l.774.258a.145.145 0 0 1 0 .274l-.774.258a1.156 1.156 0 0 0-.732.732l-.258.774a.145.145 0 0 1-.274 0l-.258-.774a1.156 1.156 0 0 0-.732-.732L9.1 2.137a.145.145 0 0 1 0-.274l.774-.258c.346-.115.617-.386.732-.732L10.863.1z"}}]})(e)}const Vge=()=>{const e=te(),{t}=J(),n=W(u=>u.system.isConnected),[r,{isLoading:o}]=lP({fixedCacheKey:"pruneQueue"}),{finishedCount:s}=Fa(void 0,{selectFromResult:({data:u})=>u?{finishedCount:u.queue.completed+u.queue.canceled+u.queue.failed}:{finishedCount:0}}),i=d.useCallback(async()=>{if(s)try{const u=await r().unwrap();e($t({title:t("queue.pruneSucceeded",{item_count:u.deleted}),status:"success"})),e(Ob(void 0)),e(Rb(void 0))}catch{e($t({title:t("queue.pruneFailed"),status:"error"}))}},[s,r,e,t]),l=d.useMemo(()=>!n||!s,[s,n]);return{pruneQueue:i,isLoading:o,finishedCount:s,isDisabled:l}},Uge=({asIconButton:e})=>{const{t}=J(),{pruneQueue:n,isLoading:r,finishedCount:o,isDisabled:s}=Vge();return a.jsx(cc,{isDisabled:s,isLoading:r,asIconButton:e,label:t("queue.prune"),tooltip:t("queue.pruneTooltip",{item_count:o}),icon:a.jsx(Wge,{}),onClick:n,colorScheme:"blue"})},Gge=d.memo(Uge),qge=()=>{const e=jn("pauseQueue").isFeatureEnabled,t=jn("resumeQueue").isFeatureEnabled;return a.jsxs($,{layerStyle:"second",borderRadius:"base",p:2,gap:2,children:[e||t?a.jsxs(zn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[t?a.jsx(M8,{}):a.jsx(a.Fragment,{}),e?a.jsx(k8,{}):a.jsx(a.Fragment,{})]}):a.jsx(a.Fragment,{}),a.jsxs(zn,{w:28,orientation:"vertical",isAttached:!0,size:"sm",children:[a.jsx(Gge,{}),a.jsx(I2,{})]})]})},Kge=d.memo(qge),Qge=()=>{const e=jn("invocationCache").isFeatureEnabled;return a.jsxs($,{layerStyle:"first",borderRadius:"base",w:"full",h:"full",p:2,flexDir:"column",gap:2,children:[a.jsxs($,{gap:2,w:"full",children:[a.jsx(Kge,{}),a.jsx(Hge,{}),e&&a.jsx(Cge,{})]}),a.jsx(De,{layerStyle:"second",p:2,borderRadius:"base",w:"full",h:"full",children:a.jsx(Fge,{})})]})},Xge=d.memo(Qge),Yge=()=>a.jsx(Xge,{}),Jge=d.memo(Yge),Zge=()=>a.jsx(MR,{}),e0e=d.memo(Zge);var lb={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Konva=void 0;var n=cS;Object.defineProperty(t,"Konva",{enumerable:!0,get:function(){return n.Konva}});const r=cS;e.exports=r.Konva})(lb,lb.exports);var t0e=lb.exports;const df=pf(t0e);var XR={exports:{}};/** + * @license React + * react-reconciler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var n0e=function(t){var n={},r=d,o=xm,s=Object.assign;function i(c){for(var f="https://reactjs.org/docs/error-decoder.html?invariant="+c,v=1;voe||k[L]!==E[oe]){var he=` +`+k[L].replace(" at new "," at ");return c.displayName&&he.includes("")&&(he=he.replace("",c.displayName)),he}while(1<=L&&0<=oe);break}}}finally{Zt=!1,Error.prepareStackTrace=v}return(c=c?c.displayName||c.name:"")?Ht(c):""}var an=Object.prototype.hasOwnProperty,Yt=[],Be=-1;function yt(c){return{current:c}}function Lt(c){0>Be||(c.current=Yt[Be],Yt[Be]=null,Be--)}function Qt(c,f){Be++,Yt[Be]=c.current,c.current=f}var Nn={},Jt=yt(Nn),vn=yt(!1),fn=Nn;function Fr(c,f){var v=c.type.contextTypes;if(!v)return Nn;var w=c.stateNode;if(w&&w.__reactInternalMemoizedUnmaskedChildContext===f)return w.__reactInternalMemoizedMaskedChildContext;var k={},E;for(E in v)k[E]=f[E];return w&&(c=c.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=f,c.__reactInternalMemoizedMaskedChildContext=k),k}function cr(c){return c=c.childContextTypes,c!=null}function Ot(){Lt(vn),Lt(Jt)}function $n(c,f,v){if(Jt.current!==Nn)throw Error(i(168));Qt(Jt,f),Qt(vn,v)}function Hn(c,f,v){var w=c.stateNode;if(f=f.childContextTypes,typeof w.getChildContext!="function")return v;w=w.getChildContext();for(var k in w)if(!(k in f))throw Error(i(108,A(c)||"Unknown",k));return s({},v,w)}function ur(c){return c=(c=c.stateNode)&&c.__reactInternalMemoizedMergedChildContext||Nn,fn=Jt.current,Qt(Jt,c),Qt(vn,vn.current),!0}function _r(c,f,v){var w=c.stateNode;if(!w)throw Error(i(169));v?(c=Hn(c,f,fn),w.__reactInternalMemoizedMergedChildContext=c,Lt(vn),Lt(Jt),Qt(Jt,c)):Lt(vn),Qt(vn,v)}var Qn=Math.clz32?Math.clz32:On,Xn=Math.log,xn=Math.LN2;function On(c){return c>>>=0,c===0?32:31-(Xn(c)/xn|0)|0}var Ln=64,In=4194304;function Pn(c){switch(c&-c){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return c&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return c&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return c}}function Je(c,f){var v=c.pendingLanes;if(v===0)return 0;var w=0,k=c.suspendedLanes,E=c.pingedLanes,L=v&268435455;if(L!==0){var oe=L&~k;oe!==0?w=Pn(oe):(E&=L,E!==0&&(w=Pn(E)))}else L=v&~k,L!==0?w=Pn(L):E!==0&&(w=Pn(E));if(w===0)return 0;if(f!==0&&f!==w&&!(f&k)&&(k=w&-w,E=f&-f,k>=E||k===16&&(E&4194240)!==0))return f;if(w&4&&(w|=v&16),f=c.entangledLanes,f!==0)for(c=c.entanglements,f&=w;0v;v++)f.push(c);return f}function vt(c,f,v){c.pendingLanes|=f,f!==536870912&&(c.suspendedLanes=0,c.pingedLanes=0),c=c.eventTimes,f=31-Qn(f),c[f]=v}function st(c,f){var v=c.pendingLanes&~f;c.pendingLanes=f,c.suspendedLanes=0,c.pingedLanes=0,c.expiredLanes&=f,c.mutableReadLanes&=f,c.entangledLanes&=f,f=c.entanglements;var w=c.eventTimes;for(c=c.expirationTimes;0>=L,k-=L,Jo=1<<32-Qn(f)+k|v<Rn?(Zr=rn,rn=null):Zr=rn.sibling;var An=ut(me,rn,Ce[Rn],ft);if(An===null){rn===null&&(rn=Zr);break}c&&rn&&An.alternate===null&&f(me,rn),ie=E(An,ie,Rn),un===null?Bt=An:un.sibling=An,un=An,rn=Zr}if(Rn===Ce.length)return v(me,rn),dr&&xl(me,Rn),Bt;if(rn===null){for(;RnRn?(Zr=rn,rn=null):Zr=rn.sibling;var Ni=ut(me,rn,An.value,ft);if(Ni===null){rn===null&&(rn=Zr);break}c&&rn&&Ni.alternate===null&&f(me,rn),ie=E(Ni,ie,Rn),un===null?Bt=Ni:un.sibling=Ni,un=Ni,rn=Zr}if(An.done)return v(me,rn),dr&&xl(me,Rn),Bt;if(rn===null){for(;!An.done;Rn++,An=Ce.next())An=nn(me,An.value,ft),An!==null&&(ie=E(An,ie,Rn),un===null?Bt=An:un.sibling=An,un=An);return dr&&xl(me,Rn),Bt}for(rn=w(me,rn);!An.done;Rn++,An=Ce.next())An=lr(rn,me,Rn,An.value,ft),An!==null&&(c&&An.alternate!==null&&rn.delete(An.key===null?Rn:An.key),ie=E(An,ie,Rn),un===null?Bt=An:un.sibling=An,un=An);return c&&rn.forEach(function(FA){return f(me,FA)}),dr&&xl(me,Rn),Bt}function Ya(me,ie,Ce,ft){if(typeof Ce=="object"&&Ce!==null&&Ce.type===m&&Ce.key===null&&(Ce=Ce.props.children),typeof Ce=="object"&&Ce!==null){switch(Ce.$$typeof){case u:e:{for(var Bt=Ce.key,un=ie;un!==null;){if(un.key===Bt){if(Bt=Ce.type,Bt===m){if(un.tag===7){v(me,un.sibling),ie=k(un,Ce.props.children),ie.return=me,me=ie;break e}}else if(un.elementType===Bt||typeof Bt=="object"&&Bt!==null&&Bt.$$typeof===_&&uC(Bt)===un.type){v(me,un.sibling),ie=k(un,Ce.props),ie.ref=Xu(me,un,Ce),ie.return=me,me=ie;break e}v(me,un);break}else f(me,un);un=un.sibling}Ce.type===m?(ie=jl(Ce.props.children,me.mode,ft,Ce.key),ie.return=me,me=ie):(ft=Ip(Ce.type,Ce.key,Ce.props,null,me.mode,ft),ft.ref=Xu(me,ie,Ce),ft.return=me,me=ft)}return L(me);case p:e:{for(un=Ce.key;ie!==null;){if(ie.key===un)if(ie.tag===4&&ie.stateNode.containerInfo===Ce.containerInfo&&ie.stateNode.implementation===Ce.implementation){v(me,ie.sibling),ie=k(ie,Ce.children||[]),ie.return=me,me=ie;break e}else{v(me,ie);break}else f(me,ie);ie=ie.sibling}ie=Sv(Ce,me.mode,ft),ie.return=me,me=ie}return L(me);case _:return un=Ce._init,Ya(me,ie,un(Ce._payload),ft)}if(Q(Ce))return Jn(me,ie,Ce,ft);if(M(Ce))return Lo(me,ie,Ce,ft);tp(me,Ce)}return typeof Ce=="string"&&Ce!==""||typeof Ce=="number"?(Ce=""+Ce,ie!==null&&ie.tag===6?(v(me,ie.sibling),ie=k(ie,Ce),ie.return=me,me=ie):(v(me,ie),ie=wv(Ce,me.mode,ft),ie.return=me,me=ie),L(me)):v(me,ie)}return Ya}var hc=dC(!0),fC=dC(!1),Yu={},ms=yt(Yu),Ju=yt(Yu),gc=yt(Yu);function ga(c){if(c===Yu)throw Error(i(174));return c}function N0(c,f){Qt(gc,f),Qt(Ju,c),Qt(ms,Yu),c=z(f),Lt(ms),Qt(ms,c)}function vc(){Lt(ms),Lt(Ju),Lt(gc)}function pC(c){var f=ga(gc.current),v=ga(ms.current);f=G(v,c.type,f),v!==f&&(Qt(Ju,c),Qt(ms,f))}function $0(c){Ju.current===c&&(Lt(ms),Lt(Ju))}var br=yt(0);function np(c){for(var f=c;f!==null;){if(f.tag===13){var v=f.memoizedState;if(v!==null&&(v=v.dehydrated,v===null||Xr(v)||fa(v)))return f}else if(f.tag===19&&f.memoizedProps.revealOrder!==void 0){if(f.flags&128)return f}else if(f.child!==null){f.child.return=f,f=f.child;continue}if(f===c)break;for(;f.sibling===null;){if(f.return===null||f.return===c)return null;f=f.return}f.sibling.return=f.return,f=f.sibling}return null}var L0=[];function z0(){for(var c=0;cv?v:4,c(!0);var w=F0.transition;F0.transition={};try{c(!1),f()}finally{Re=v,F0.transition=w}}function OC(){return hs().memoizedState}function pA(c,f,v){var w=Ai(c);if(v={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null},RC(c))AC(f,v);else if(v=nC(c,f,v,w),v!==null){var k=ho();gs(v,c,w,k),DC(v,f,w)}}function mA(c,f,v){var w=Ai(c),k={lane:w,action:v,hasEagerState:!1,eagerState:null,next:null};if(RC(c))AC(f,k);else{var E=c.alternate;if(c.lanes===0&&(E===null||E.lanes===0)&&(E=f.lastRenderedReducer,E!==null))try{var L=f.lastRenderedState,oe=E(L,v);if(k.hasEagerState=!0,k.eagerState=oe,bn(oe,L)){var he=f.interleaved;he===null?(k.next=k,R0(f)):(k.next=he.next,he.next=k),f.interleaved=k;return}}catch{}finally{}v=nC(c,f,k,w),v!==null&&(k=ho(),gs(v,c,w,k),DC(v,f,w))}}function RC(c){var f=c.alternate;return c===yr||f!==null&&f===yr}function AC(c,f){Zu=op=!0;var v=c.pending;v===null?f.next=f:(f.next=v.next,v.next=f),c.pending=f}function DC(c,f,v){if(v&4194240){var w=f.lanes;w&=c.pendingLanes,v|=w,f.lanes=v,$e(c,v)}}var ip={readContext:ps,useCallback:fo,useContext:fo,useEffect:fo,useImperativeHandle:fo,useInsertionEffect:fo,useLayoutEffect:fo,useMemo:fo,useReducer:fo,useRef:fo,useState:fo,useDebugValue:fo,useDeferredValue:fo,useTransition:fo,useMutableSource:fo,useSyncExternalStore:fo,useId:fo,unstable_isNewReconciler:!1},hA={readContext:ps,useCallback:function(c,f){return va().memoizedState=[c,f===void 0?null:f],c},useContext:ps,useEffect:SC,useImperativeHandle:function(c,f,v){return v=v!=null?v.concat([c]):null,sp(4194308,4,_C.bind(null,f,c),v)},useLayoutEffect:function(c,f){return sp(4194308,4,c,f)},useInsertionEffect:function(c,f){return sp(4,2,c,f)},useMemo:function(c,f){var v=va();return f=f===void 0?null:f,c=c(),v.memoizedState=[c,f],c},useReducer:function(c,f,v){var w=va();return f=v!==void 0?v(f):f,w.memoizedState=w.baseState=f,c={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:c,lastRenderedState:f},w.queue=c,c=c.dispatch=pA.bind(null,yr,c),[w.memoizedState,c]},useRef:function(c){var f=va();return c={current:c},f.memoizedState=c},useState:CC,useDebugValue:q0,useDeferredValue:function(c){return va().memoizedState=c},useTransition:function(){var c=CC(!1),f=c[0];return c=fA.bind(null,c[1]),va().memoizedState=c,[f,c]},useMutableSource:function(){},useSyncExternalStore:function(c,f,v){var w=yr,k=va();if(dr){if(v===void 0)throw Error(i(407));v=v()}else{if(v=f(),Jr===null)throw Error(i(349));yl&30||gC(w,f,v)}k.memoizedState=v;var E={value:v,getSnapshot:f};return k.queue=E,SC(xC.bind(null,w,E,c),[c]),w.flags|=2048,nd(9,vC.bind(null,w,E,v,f),void 0,null),v},useId:function(){var c=va(),f=Jr.identifierPrefix;if(dr){var v=uo,w=Jo;v=(w&~(1<<32-Qn(w)-1)).toString(32)+v,f=":"+f+"R"+v,v=ed++,0mv&&(f.flags|=128,w=!0,sd(k,!1),f.lanes=4194304)}else{if(!w)if(c=np(E),c!==null){if(f.flags|=128,w=!0,c=c.updateQueue,c!==null&&(f.updateQueue=c,f.flags|=4),sd(k,!0),k.tail===null&&k.tailMode==="hidden"&&!E.alternate&&!dr)return po(f),null}else 2*Ue()-k.renderingStartTime>mv&&v!==1073741824&&(f.flags|=128,w=!0,sd(k,!1),f.lanes=4194304);k.isBackwards?(E.sibling=f.child,f.child=E):(c=k.last,c!==null?c.sibling=E:f.child=E,k.last=E)}return k.tail!==null?(f=k.tail,k.rendering=f,k.tail=f.sibling,k.renderingStartTime=Ue(),f.sibling=null,c=br.current,Qt(br,w?c&1|2:c&1),f):(po(f),null);case 22:case 23:return bv(),v=f.memoizedState!==null,c!==null&&c.memoizedState!==null!==v&&(f.flags|=8192),v&&f.mode&1?es&1073741824&&(po(f),fe&&f.subtreeFlags&6&&(f.flags|=8192)):po(f),null;case 24:return null;case 25:return null}throw Error(i(156,f.tag))}function SA(c,f){switch(k0(f),f.tag){case 1:return cr(f.type)&&Ot(),c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 3:return vc(),Lt(vn),Lt(Jt),z0(),c=f.flags,c&65536&&!(c&128)?(f.flags=c&-65537|128,f):null;case 5:return $0(f),null;case 13:if(Lt(br),c=f.memoizedState,c!==null&&c.dehydrated!==null){if(f.alternate===null)throw Error(i(340));fc()}return c=f.flags,c&65536?(f.flags=c&-65537|128,f):null;case 19:return Lt(br),null;case 4:return vc(),null;case 10:return M0(f.type._context),null;case 22:case 23:return bv(),null;case 24:return null;default:return null}}var fp=!1,mo=!1,kA=typeof WeakSet=="function"?WeakSet:Set,gt=null;function bc(c,f){var v=c.ref;if(v!==null)if(typeof v=="function")try{v(null)}catch(w){fr(c,f,w)}else v.current=null}function nv(c,f,v){try{v()}catch(w){fr(c,f,w)}}var ZC=!1;function jA(c,f){for(T(c.containerInfo),gt=f;gt!==null;)if(c=gt,f=c.child,(c.subtreeFlags&1028)!==0&&f!==null)f.return=c,gt=f;else for(;gt!==null;){c=gt;try{var v=c.alternate;if(c.flags&1024)switch(c.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var w=v.memoizedProps,k=v.memoizedState,E=c.stateNode,L=E.getSnapshotBeforeUpdate(c.elementType===c.type?w:Fs(c.type,w),k);E.__reactInternalSnapshotBeforeUpdate=L}break;case 3:fe&&mn(c.stateNode.containerInfo);break;case 5:case 6:case 4:case 17:break;default:throw Error(i(163))}}catch(oe){fr(c,c.return,oe)}if(f=c.sibling,f!==null){f.return=c.return,gt=f;break}gt=c.return}return v=ZC,ZC=!1,v}function ad(c,f,v){var w=f.updateQueue;if(w=w!==null?w.lastEffect:null,w!==null){var k=w=w.next;do{if((k.tag&c)===c){var E=k.destroy;k.destroy=void 0,E!==void 0&&nv(f,v,E)}k=k.next}while(k!==w)}}function pp(c,f){if(f=f.updateQueue,f=f!==null?f.lastEffect:null,f!==null){var v=f=f.next;do{if((v.tag&c)===c){var w=v.create;v.destroy=w()}v=v.next}while(v!==f)}}function rv(c){var f=c.ref;if(f!==null){var v=c.stateNode;switch(c.tag){case 5:c=q(v);break;default:c=v}typeof f=="function"?f(c):f.current=c}}function ew(c){var f=c.alternate;f!==null&&(c.alternate=null,ew(f)),c.child=null,c.deletions=null,c.sibling=null,c.tag===5&&(f=c.stateNode,f!==null&&Ae(f)),c.stateNode=null,c.return=null,c.dependencies=null,c.memoizedProps=null,c.memoizedState=null,c.pendingProps=null,c.stateNode=null,c.updateQueue=null}function tw(c){return c.tag===5||c.tag===3||c.tag===4}function nw(c){e:for(;;){for(;c.sibling===null;){if(c.return===null||tw(c.return))return null;c=c.return}for(c.sibling.return=c.return,c=c.sibling;c.tag!==5&&c.tag!==6&&c.tag!==18;){if(c.flags&2||c.child===null||c.tag===4)continue e;c.child.return=c,c=c.child}if(!(c.flags&2))return c.stateNode}}function ov(c,f,v){var w=c.tag;if(w===5||w===6)c=c.stateNode,f?_n(v,c,f):Ct(v,c);else if(w!==4&&(c=c.child,c!==null))for(ov(c,f,v),c=c.sibling;c!==null;)ov(c,f,v),c=c.sibling}function sv(c,f,v){var w=c.tag;if(w===5||w===6)c=c.stateNode,f?Xe(v,c,f):ke(v,c);else if(w!==4&&(c=c.child,c!==null))for(sv(c,f,v),c=c.sibling;c!==null;)sv(c,f,v),c=c.sibling}var lo=null,Bs=!1;function ba(c,f,v){for(v=v.child;v!==null;)av(c,f,v),v=v.sibling}function av(c,f,v){if(Sn&&typeof Sn.onCommitFiberUnmount=="function")try{Sn.onCommitFiberUnmount(ir,v)}catch{}switch(v.tag){case 5:mo||bc(v,f);case 6:if(fe){var w=lo,k=Bs;lo=null,ba(c,f,v),lo=w,Bs=k,lo!==null&&(Bs?Ze(lo,v.stateNode):Me(lo,v.stateNode))}else ba(c,f,v);break;case 18:fe&&lo!==null&&(Bs?He(lo,v.stateNode):wt(lo,v.stateNode));break;case 4:fe?(w=lo,k=Bs,lo=v.stateNode.containerInfo,Bs=!0,ba(c,f,v),lo=w,Bs=k):(ge&&(w=v.stateNode.containerInfo,k=Ar(w),or(w,k)),ba(c,f,v));break;case 0:case 11:case 14:case 15:if(!mo&&(w=v.updateQueue,w!==null&&(w=w.lastEffect,w!==null))){k=w=w.next;do{var E=k,L=E.destroy;E=E.tag,L!==void 0&&(E&2||E&4)&&nv(v,f,L),k=k.next}while(k!==w)}ba(c,f,v);break;case 1:if(!mo&&(bc(v,f),w=v.stateNode,typeof w.componentWillUnmount=="function"))try{w.props=v.memoizedProps,w.state=v.memoizedState,w.componentWillUnmount()}catch(oe){fr(v,f,oe)}ba(c,f,v);break;case 21:ba(c,f,v);break;case 22:v.mode&1?(mo=(w=mo)||v.memoizedState!==null,ba(c,f,v),mo=w):ba(c,f,v);break;default:ba(c,f,v)}}function rw(c){var f=c.updateQueue;if(f!==null){c.updateQueue=null;var v=c.stateNode;v===null&&(v=c.stateNode=new kA),f.forEach(function(w){var k=DA.bind(null,c,w);v.has(w)||(v.add(w),w.then(k,k))})}}function Hs(c,f){var v=f.deletions;if(v!==null)for(var w=0;w";case hp:return":has("+(cv(c)||"")+")";case gp:return'[role="'+c.value+'"]';case xp:return'"'+c.value+'"';case vp:return'[data-testname="'+c.value+'"]';default:throw Error(i(365))}}function cw(c,f){var v=[];c=[c,0];for(var w=0;wk&&(k=L),w&=~E}if(w=k,w=Ue()-w,w=(120>w?120:480>w?480:1080>w?1080:1920>w?1920:3e3>w?3e3:4320>w?4320:1960*IA(w/1960))-w,10c?16:c,Ri===null)var w=!1;else{if(c=Ri,Ri=null,Sp=0,pn&6)throw Error(i(331));var k=pn;for(pn|=4,gt=c.current;gt!==null;){var E=gt,L=E.child;if(gt.flags&16){var oe=E.deletions;if(oe!==null){for(var he=0;heUe()-pv?wl(c,0):fv|=v),$o(c,f)}function xw(c,f){f===0&&(c.mode&1?(f=In,In<<=1,!(In&130023424)&&(In=4194304)):f=1);var v=ho();c=ha(c,f),c!==null&&(vt(c,f,v),$o(c,v))}function AA(c){var f=c.memoizedState,v=0;f!==null&&(v=f.retryLane),xw(c,v)}function DA(c,f){var v=0;switch(c.tag){case 13:var w=c.stateNode,k=c.memoizedState;k!==null&&(v=k.retryLane);break;case 19:w=c.stateNode;break;default:throw Error(i(314))}w!==null&&w.delete(f),xw(c,v)}var bw;bw=function(c,f,v){if(c!==null)if(c.memoizedProps!==f.pendingProps||vn.current)To=!0;else{if(!(c.lanes&v)&&!(f.flags&128))return To=!1,CA(c,f,v);To=!!(c.flags&131072)}else To=!1,dr&&f.flags&1048576&&X2(f,So,f.index);switch(f.lanes=0,f.tag){case 2:var w=f.type;cp(c,f),c=f.pendingProps;var k=Fr(f,Jt.current);mc(f,v),k=H0(null,f,w,c,k,v);var E=W0();return f.flags|=1,typeof k=="object"&&k!==null&&typeof k.render=="function"&&k.$$typeof===void 0?(f.tag=1,f.memoizedState=null,f.updateQueue=null,cr(w)?(E=!0,ur(f)):E=!1,f.memoizedState=k.state!==null&&k.state!==void 0?k.state:null,A0(f),k.updater=ep,f.stateNode=k,k._reactInternals=f,T0(f,w,c,v),f=Y0(null,f,w,!0,E,v)):(f.tag=0,dr&&E&&S0(f),_o(null,f,k,v),f=f.child),f;case 16:w=f.elementType;e:{switch(cp(c,f),c=f.pendingProps,k=w._init,w=k(w._payload),f.type=w,k=f.tag=NA(w),c=Fs(w,c),k){case 0:f=X0(null,f,w,c,v);break e;case 1:f=UC(null,f,w,c,v);break e;case 11:f=FC(null,f,w,c,v);break e;case 14:f=BC(null,f,w,Fs(w.type,c),v);break e}throw Error(i(306,w,""))}return f;case 0:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),X0(c,f,w,k,v);case 1:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),UC(c,f,w,k,v);case 3:e:{if(GC(f),c===null)throw Error(i(387));w=f.pendingProps,E=f.memoizedState,k=E.element,rC(c,f),Zf(f,w,null,v);var L=f.memoizedState;if(w=L.element,_e&&E.isDehydrated)if(E={element:w,isDehydrated:!1,cache:L.cache,pendingSuspenseBoundaries:L.pendingSuspenseBoundaries,transitions:L.transitions},f.updateQueue.baseState=E,f.memoizedState=E,f.flags&256){k=xc(Error(i(423)),f),f=qC(c,f,w,v,k);break e}else if(w!==k){k=xc(Error(i(424)),f),f=qC(c,f,w,v,k);break e}else for(_e&&(fs=ae(f.stateNode.containerInfo),Zo=f,dr=!0,zs=null,Qu=!1),v=fC(f,null,w,v),f.child=v;v;)v.flags=v.flags&-3|4096,v=v.sibling;else{if(fc(),w===k){f=Qa(c,f,v);break e}_o(c,f,w,v)}f=f.child}return f;case 5:return pC(f),c===null&&_0(f),w=f.type,k=f.pendingProps,E=c!==null?c.memoizedProps:null,L=k.children,K(w,k)?L=null:E!==null&&K(w,E)&&(f.flags|=32),VC(c,f),_o(c,f,L,v),f.child;case 6:return c===null&&_0(f),null;case 13:return KC(c,f,v);case 4:return N0(f,f.stateNode.containerInfo),w=f.pendingProps,c===null?f.child=hc(f,null,w,v):_o(c,f,w,v),f.child;case 11:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),FC(c,f,w,k,v);case 7:return _o(c,f,f.pendingProps,v),f.child;case 8:return _o(c,f,f.pendingProps.children,v),f.child;case 12:return _o(c,f,f.pendingProps.children,v),f.child;case 10:e:{if(w=f.type._context,k=f.pendingProps,E=f.memoizedProps,L=k.value,tC(f,w,L),E!==null)if(bn(E.value,L)){if(E.children===k.children&&!vn.current){f=Qa(c,f,v);break e}}else for(E=f.child,E!==null&&(E.return=f);E!==null;){var oe=E.dependencies;if(oe!==null){L=E.child;for(var he=oe.firstContext;he!==null;){if(he.context===w){if(E.tag===1){he=Ka(-1,v&-v),he.tag=2;var Fe=E.updateQueue;if(Fe!==null){Fe=Fe.shared;var xt=Fe.pending;xt===null?he.next=he:(he.next=xt.next,xt.next=he),Fe.pending=he}}E.lanes|=v,he=E.alternate,he!==null&&(he.lanes|=v),O0(E.return,v,f),oe.lanes|=v;break}he=he.next}}else if(E.tag===10)L=E.type===f.type?null:E.child;else if(E.tag===18){if(L=E.return,L===null)throw Error(i(341));L.lanes|=v,oe=L.alternate,oe!==null&&(oe.lanes|=v),O0(L,v,f),L=E.sibling}else L=E.child;if(L!==null)L.return=E;else for(L=E;L!==null;){if(L===f){L=null;break}if(E=L.sibling,E!==null){E.return=L.return,L=E;break}L=L.return}E=L}_o(c,f,k.children,v),f=f.child}return f;case 9:return k=f.type,w=f.pendingProps.children,mc(f,v),k=ps(k),w=w(k),f.flags|=1,_o(c,f,w,v),f.child;case 14:return w=f.type,k=Fs(w,f.pendingProps),k=Fs(w.type,k),BC(c,f,w,k,v);case 15:return HC(c,f,f.type,f.pendingProps,v);case 17:return w=f.type,k=f.pendingProps,k=f.elementType===w?k:Fs(w,k),cp(c,f),f.tag=1,cr(w)?(c=!0,ur(f)):c=!1,mc(f,v),lC(f,w,k),T0(f,w,k,v),Y0(null,f,w,!0,c,v);case 19:return XC(c,f,v);case 22:return WC(c,f,v)}throw Error(i(156,f.tag))};function yw(c,f){return Ve(c,f)}function TA(c,f,v,w){this.tag=c,this.key=v,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=f,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function vs(c,f,v,w){return new TA(c,f,v,w)}function Cv(c){return c=c.prototype,!(!c||!c.isReactComponent)}function NA(c){if(typeof c=="function")return Cv(c)?1:0;if(c!=null){if(c=c.$$typeof,c===b)return 11;if(c===j)return 14}return 2}function Ti(c,f){var v=c.alternate;return v===null?(v=vs(c.tag,f,c.key,c.mode),v.elementType=c.elementType,v.type=c.type,v.stateNode=c.stateNode,v.alternate=c,c.alternate=v):(v.pendingProps=f,v.type=c.type,v.flags=0,v.subtreeFlags=0,v.deletions=null),v.flags=c.flags&14680064,v.childLanes=c.childLanes,v.lanes=c.lanes,v.child=c.child,v.memoizedProps=c.memoizedProps,v.memoizedState=c.memoizedState,v.updateQueue=c.updateQueue,f=c.dependencies,v.dependencies=f===null?null:{lanes:f.lanes,firstContext:f.firstContext},v.sibling=c.sibling,v.index=c.index,v.ref=c.ref,v}function Ip(c,f,v,w,k,E){var L=2;if(w=c,typeof c=="function")Cv(c)&&(L=1);else if(typeof c=="string")L=5;else e:switch(c){case m:return jl(v.children,k,E,f);case h:L=8,k|=8;break;case g:return c=vs(12,v,f,k|2),c.elementType=g,c.lanes=E,c;case C:return c=vs(13,v,f,k),c.elementType=C,c.lanes=E,c;case S:return c=vs(19,v,f,k),c.elementType=S,c.lanes=E,c;case P:return Pp(v,k,E,f);default:if(typeof c=="object"&&c!==null)switch(c.$$typeof){case x:L=10;break e;case y:L=9;break e;case b:L=11;break e;case j:L=14;break e;case _:L=16,w=null;break e}throw Error(i(130,c==null?c:typeof c,""))}return f=vs(L,v,f,k),f.elementType=c,f.type=w,f.lanes=E,f}function jl(c,f,v,w){return c=vs(7,c,w,f),c.lanes=v,c}function Pp(c,f,v,w){return c=vs(22,c,w,f),c.elementType=P,c.lanes=v,c.stateNode={isHidden:!1},c}function wv(c,f,v){return c=vs(6,c,null,f),c.lanes=v,c}function Sv(c,f,v){return f=vs(4,c.children!==null?c.children:[],c.key,f),f.lanes=v,f.stateNode={containerInfo:c.containerInfo,pendingChildren:null,implementation:c.implementation},f}function $A(c,f,v,w,k){this.tag=f,this.containerInfo=c,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=Z,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Gt(0),this.expirationTimes=Gt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Gt(0),this.identifierPrefix=w,this.onRecoverableError=k,_e&&(this.mutableSourceEagerHydrationData=null)}function Cw(c,f,v,w,k,E,L,oe,he){return c=new $A(c,f,v,oe,he),f===1?(f=1,E===!0&&(f|=8)):f=0,E=vs(3,null,null,f),c.current=E,E.stateNode=c,E.memoizedState={element:w,isDehydrated:v,cache:null,transitions:null,pendingSuspenseBoundaries:null},A0(E),c}function ww(c){if(!c)return Nn;c=c._reactInternals;e:{if(D(c)!==c||c.tag!==1)throw Error(i(170));var f=c;do{switch(f.tag){case 3:f=f.stateNode.context;break e;case 1:if(cr(f.type)){f=f.stateNode.__reactInternalMemoizedMergedChildContext;break e}}f=f.return}while(f!==null);throw Error(i(171))}if(c.tag===1){var v=c.type;if(cr(v))return Hn(c,v,f)}return f}function Sw(c){var f=c._reactInternals;if(f===void 0)throw typeof c.render=="function"?Error(i(188)):(c=Object.keys(c).join(","),Error(i(268,c)));return c=Y(f),c===null?null:c.stateNode}function kw(c,f){if(c=c.memoizedState,c!==null&&c.dehydrated!==null){var v=c.retryLane;c.retryLane=v!==0&&v=Fe&&E>=nn&&k<=xt&&L<=ut){c.splice(f,1);break}else if(w!==Fe||v.width!==he.width||utL){if(!(E!==nn||v.height!==he.height||xtk)){Fe>w&&(he.width+=Fe-w,he.x=w),xtE&&(he.height+=nn-E,he.y=E),utv&&(v=L)),L ")+` + +No matching component was found for: + `)+c.join(" > ")}return null},n.getPublicRootInstance=function(c){if(c=c.current,!c.child)return null;switch(c.child.tag){case 5:return q(c.child.stateNode);default:return c.child.stateNode}},n.injectIntoDevTools=function(c){if(c={bundleType:c.bundleType,version:c.version,rendererPackageName:c.rendererPackageName,rendererConfig:c.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:l.ReactCurrentDispatcher,findHostInstanceByFiber:LA,findFiberByHostInstance:c.findFiberByHostInstance||zA,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.2.0"},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")c=!1;else{var f=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(f.isDisabled||!f.supportsFiber)c=!0;else{try{ir=f.inject(c),Sn=f}catch{}c=!!f.checkDCE}}return c},n.isAlreadyRendering=function(){return!1},n.observeVisibleRects=function(c,f,v,w){if(!tt)throw Error(i(363));c=uv(c,f);var k=Ut(c,v,w).disconnect;return{disconnect:function(){k()}}},n.registerMutableSourceForHydration=function(c,f){var v=f._getVersion;v=v(f._source),c.mutableSourceEagerHydrationData==null?c.mutableSourceEagerHydrationData=[f,v]:c.mutableSourceEagerHydrationData.push(f,v)},n.runWithPriority=function(c,f){var v=Re;try{return Re=c,f()}finally{Re=v}},n.shouldError=function(){return null},n.shouldSuspend=function(){return!1},n.updateContainer=function(c,f,v,w){var k=f.current,E=ho(),L=Ai(k);return v=ww(v),f.context===null?f.context=v:f.pendingContext=v,f=Ka(E,L),f.payload={element:c},w=w===void 0?null:w,w!==null&&(f.callback=w),c=Mi(k,f,L),c!==null&&(gs(c,k,L,E),Jf(c,k,L)),L},n};XR.exports=n0e;var r0e=XR.exports;const o0e=pf(r0e);var YR={exports:{}},dc={};/** + * @license React + * react-reconciler-constants.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */dc.ConcurrentRoot=1;dc.ContinuousEventPriority=4;dc.DefaultEventPriority=16;dc.DiscreteEventPriority=1;dc.IdleEventPriority=536870912;dc.LegacyRoot=0;YR.exports=dc;var JR=YR.exports;const nI={children:!0,ref:!0,key:!0,style:!0,forwardedRef:!0,unstable_applyCache:!0,unstable_applyDrawHitFromCache:!0};let rI=!1,oI=!1;const q2=".react-konva-event",s0e=`ReactKonva: You have a Konva node with draggable = true and position defined but no onDragMove or onDragEnd events are handled. +Position of a node will be changed during drag&drop, so you should update state of the react app as well. +Consider to add onDragMove or onDragEnd events. +For more info see: https://github.com/konvajs/react-konva/issues/256 +`,a0e=`ReactKonva: You are using "zIndex" attribute for a Konva node. +react-konva may get confused with ordering. Just define correct order of elements in your render function of a component. +For more info see: https://github.com/konvajs/react-konva/issues/194 +`,i0e={};function w0(e,t,n=i0e){if(!rI&&"zIndex"in t&&(console.warn(a0e),rI=!0),!oI&&t.draggable){var r=t.x!==void 0||t.y!==void 0,o=t.onDragEnd||t.onDragMove;r&&!o&&(console.warn(s0e),oI=!0)}for(var s in n)if(!nI[s]){var i=s.slice(0,2)==="on",l=n[s]!==t[s];if(i&&l){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),e.off(u,n[s])}var p=!t.hasOwnProperty(s);p&&e.setAttr(s,void 0)}var m=t._useStrictMode,h={},g=!1;const x={};for(var s in t)if(!nI[s]){var i=s.slice(0,2)==="on",y=n[s]!==t[s];if(i&&y){var u=s.substr(2).toLowerCase();u.substr(0,7)==="content"&&(u="content"+u.substr(7,1).toUpperCase()+u.substr(8)),t[s]&&(x[u]=t[s])}!i&&(t[s]!==n[s]||m&&t[s]!==e.getAttr(s))&&(g=!0,h[s]=t[s])}g&&(e.setAttrs(h),vl(e));for(var u in x)e.on(u+q2,x[u])}function vl(e){if(!u9.Konva.autoDrawEnabled){var t=e.getLayer()||e.getStage();t&&t.batchDraw()}}const ZR={},l0e={};df.Node.prototype._applyProps=w0;function c0e(e,t){if(typeof t=="string"){console.error(`Do not use plain text as child of Konva.Node. You are using text: ${t}`);return}e.add(t),vl(e)}function u0e(e,t,n){let r=df[e];r||(console.error(`Konva has no node with the type ${e}. Group will be used instead. If you use minimal version of react-konva, just import required nodes into Konva: "import "konva/lib/shapes/${e}" If you want to render DOM elements as part of canvas tree take a look into this demo: https://konvajs.github.io/docs/react/DOM_Portal.html`),r=df.Group);const o={},s={};for(var i in t){var l=i.slice(0,2)==="on";l?s[i]=t[i]:o[i]=t[i]}const u=new r(o);return w0(u,s),u}function d0e(e,t,n){console.error(`Text components are not supported for now in ReactKonva. Your text is: "${e}"`)}function f0e(e,t,n){return!1}function p0e(e){return e}function m0e(){return null}function h0e(){return null}function g0e(e,t,n,r){return l0e}function v0e(){}function x0e(e){}function b0e(e,t){return!1}function y0e(){return ZR}function C0e(){return ZR}const w0e=setTimeout,S0e=clearTimeout,k0e=-1;function j0e(e,t){return!1}const _0e=!1,I0e=!0,P0e=!0;function E0e(e,t){t.parent===e?t.moveToTop():e.add(t),vl(e)}function M0e(e,t){t.parent===e?t.moveToTop():e.add(t),vl(e)}function eA(e,t,n){t._remove(),e.add(t),t.setZIndex(n.getZIndex()),vl(e)}function O0e(e,t,n){eA(e,t,n)}function R0e(e,t){t.destroy(),t.off(q2),vl(e)}function A0e(e,t){t.destroy(),t.off(q2),vl(e)}function D0e(e,t,n){console.error(`Text components are not yet supported in ReactKonva. You text is: "${n}"`)}function T0e(e,t,n){}function N0e(e,t,n,r,o){w0(e,o,r)}function $0e(e){e.hide(),vl(e)}function L0e(e){}function z0e(e,t){(t.visible==null||t.visible)&&e.show()}function F0e(e,t){}function B0e(e){}function H0e(){}const W0e=()=>JR.DefaultEventPriority,V0e=Object.freeze(Object.defineProperty({__proto__:null,appendChild:E0e,appendChildToContainer:M0e,appendInitialChild:c0e,cancelTimeout:S0e,clearContainer:B0e,commitMount:T0e,commitTextUpdate:D0e,commitUpdate:N0e,createInstance:u0e,createTextInstance:d0e,detachDeletedInstance:H0e,finalizeInitialChildren:f0e,getChildHostContext:C0e,getCurrentEventPriority:W0e,getPublicInstance:p0e,getRootHostContext:y0e,hideInstance:$0e,hideTextInstance:L0e,idlePriority:xm.unstable_IdlePriority,insertBefore:eA,insertInContainerBefore:O0e,isPrimaryRenderer:_0e,noTimeout:k0e,now:xm.unstable_now,prepareForCommit:m0e,preparePortalMount:h0e,prepareUpdate:g0e,removeChild:R0e,removeChildFromContainer:A0e,resetAfterCommit:v0e,resetTextContent:x0e,run:xm.unstable_runWithPriority,scheduleTimeout:w0e,shouldDeprioritizeSubtree:b0e,shouldSetTextContent:j0e,supportsMutation:P0e,unhideInstance:z0e,unhideTextInstance:F0e,warnsIfNotActing:I0e},Symbol.toStringTag,{value:"Module"}));var U0e=Object.defineProperty,G0e=Object.defineProperties,q0e=Object.getOwnPropertyDescriptors,sI=Object.getOwnPropertySymbols,K0e=Object.prototype.hasOwnProperty,Q0e=Object.prototype.propertyIsEnumerable,aI=(e,t,n)=>t in e?U0e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iI=(e,t)=>{for(var n in t||(t={}))K0e.call(t,n)&&aI(e,n,t[n]);if(sI)for(var n of sI(t))Q0e.call(t,n)&&aI(e,n,t[n]);return e},X0e=(e,t)=>G0e(e,q0e(t));function tA(e,t,n){if(!e)return;if(n(e)===!0)return e;let r=t?e.return:e.child;for(;r;){const o=tA(r,t,n);if(o)return o;r=t?null:r.sibling}}function nA(e){try{return Object.defineProperties(e,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return e}}const K2=nA(d.createContext(null));class rA extends d.Component{render(){return d.createElement(K2.Provider,{value:this._reactInternals},this.props.children)}}const{ReactCurrentOwner:lI,ReactCurrentDispatcher:cI}=d.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function Y0e(){const e=d.useContext(K2);if(e===null)throw new Error("its-fine: useFiber must be called within a !");const t=d.useId();return d.useMemo(()=>{for(const r of[lI==null?void 0:lI.current,e,e==null?void 0:e.alternate]){if(!r)continue;const o=tA(r,!1,s=>{let i=s.memoizedState;for(;i;){if(i.memoizedState===t)return!0;i=i.next}});if(o)return o}},[e,t])}function J0e(){var e,t;const n=Y0e(),[r]=d.useState(()=>new Map);r.clear();let o=n;for(;o;){const s=(e=o.type)==null?void 0:e._context;s&&s!==K2&&!r.has(s)&&r.set(s,(t=cI==null?void 0:cI.current)==null?void 0:t.readContext(nA(s))),o=o.return}return r}function Z0e(){const e=J0e();return d.useMemo(()=>Array.from(e.keys()).reduce((t,n)=>r=>d.createElement(t,null,d.createElement(n.Provider,X0e(iI({},r),{value:e.get(n)}))),t=>d.createElement(rA,iI({},t))),[e])}function eve(e){const t=H.useRef({});return H.useLayoutEffect(()=>{t.current=e}),H.useLayoutEffect(()=>()=>{t.current={}},[]),t.current}const tve=e=>{const t=H.useRef(),n=H.useRef(),r=H.useRef(),o=eve(e),s=Z0e(),i=l=>{const{forwardedRef:u}=e;u&&(typeof u=="function"?u(l):u.current=l)};return H.useLayoutEffect(()=>(n.current=new df.Stage({width:e.width,height:e.height,container:t.current}),i(n.current),r.current=Ed.createContainer(n.current,JR.LegacyRoot,!1,null),Ed.updateContainer(H.createElement(s,{},e.children),r.current),()=>{df.isBrowser&&(i(null),Ed.updateContainer(null,r.current,null),n.current.destroy())}),[]),H.useLayoutEffect(()=>{i(n.current),w0(n.current,e,o),Ed.updateContainer(H.createElement(s,{},e.children),r.current,null)}),H.createElement("div",{ref:t,id:e.id,accessKey:e.accessKey,className:e.className,role:e.role,style:e.style,tabIndex:e.tabIndex,title:e.title})},Sd="Layer",La="Group",za="Rect",_l="Circle",Zh="Line",oA="Image",nve="Text",rve="Transformer",Ed=o0e(V0e);Ed.injectIntoDevTools({findHostInstanceByFiber:()=>null,bundleType:0,version:H.version,rendererPackageName:"react-konva"});const ove=H.forwardRef((e,t)=>H.createElement(rA,{},H.createElement(tve,{...e,forwardedRef:t}))),sve=ce([jr,Ns],(e,t)=>{const{tool:n,isMovingBoundingBox:r}=e;return{tool:n,isStaging:t,isMovingBoundingBox:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),ave=()=>{const e=te(),{tool:t,isStaging:n,isMovingBoundingBox:r}=W(sve);return{handleDragStart:d.useCallback(()=>{(t==="move"||n)&&!r&&e(Hm(!0))},[e,r,n,t]),handleDragMove:d.useCallback(o=>{if(!((t==="move"||n)&&!r))return;const s={x:o.target.x(),y:o.target.y()};e(yP(s))},[e,r,n,t]),handleDragEnd:d.useCallback(()=>{(t==="move"||n)&&!r&&e(Hm(!1))},[e,r,n,t])}},ive=ce([jr,ro,Ns],(e,t,n)=>{const{cursorPosition:r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isMaskEnabled:l,shouldSnapToGrid:u}=e;return{activeTabName:t,isCursorOnCanvas:!!r,shouldLockBoundingBox:o,shouldShowBoundingBox:s,tool:i,isStaging:n,isMaskEnabled:l,shouldSnapToGrid:u}},{memoizeOptions:{resultEqualityCheck:Tn}}),lve=()=>{const e=te(),{activeTabName:t,shouldShowBoundingBox:n,tool:r,isStaging:o,isMaskEnabled:s,shouldSnapToGrid:i}=W(ive),l=d.useRef(null),u=CP(),p=()=>e(wP());It(["shift+c"],()=>{p()},{enabled:()=>!o,preventDefault:!0},[]);const m=()=>e(Fb(!s));It(["h"],()=>{m()},{enabled:()=>!o,preventDefault:!0},[s]),It(["n"],()=>{e(Wm(!i))},{enabled:!0,preventDefault:!0},[i]),It("esc",()=>{e(d9())},{enabled:()=>!0,preventDefault:!0}),It("shift+h",()=>{e(f9(!n))},{enabled:()=>!o,preventDefault:!0},[t,n]),It(["space"],h=>{h.repeat||(u==null||u.container().focus(),r!=="move"&&(l.current=r,e(Jc("move"))),r==="move"&&l.current&&l.current!=="move"&&(e(Jc(l.current)),l.current="move"))},{keyup:!0,keydown:!0,preventDefault:!0},[r,l])},Q2=e=>{const t=e.getPointerPosition(),n=e.getAbsoluteTransform().copy();if(!t||!n)return;const r=n.invert().point(t);return{x:r.x,y:r.y}},sA=()=>{const e=te(),t=V1(),n=CP();return{updateColorUnderCursor:()=>{if(!n||!t)return;const r=n.getPointerPosition();if(!r)return;const o=p9.pixelRatio,[s,i,l,u]=t.getContext().getImageData(r.x*o,r.y*o,1,1).data;s===void 0||i===void 0||l===void 0||u===void 0||e(m9({r:s,g:i,b:l,a:u}))},commitColorUnderCursor:()=>{e(h9())}}},cve=ce([ro,jr,Ns],(e,t,n)=>{const{tool:r}=t;return{tool:r,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),uve=e=>{const t=te(),{tool:n,isStaging:r}=W(cve),{commitColorUnderCursor:o}=sA();return d.useCallback(s=>{if(!e.current)return;if(e.current.container().focus(),n==="move"||r){t(Hm(!0));return}if(n==="colorPicker"){o();return}const i=Q2(e.current);i&&(s.evt.preventDefault(),t(SP(!0)),t(g9([i.x,i.y])))},[e,n,r,t,o])},dve=ce([ro,jr,Ns],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),fve=(e,t,n)=>{const r=te(),{isDrawing:o,tool:s,isStaging:i}=W(dve),{updateColorUnderCursor:l}=sA();return d.useCallback(()=>{if(!e.current)return;const u=Q2(e.current);if(u){if(r(v9(u)),n.current=u,s==="colorPicker"){l();return}!o||s==="move"||i||(t.current=!0,r(kP([u.x,u.y])))}},[t,r,o,i,n,e,s,l])},pve=()=>{const e=te();return d.useCallback(()=>{e(x9())},[e])},mve=ce([ro,jr,Ns],(e,t,n)=>{const{tool:r,isDrawing:o}=t;return{tool:r,isDrawing:o,activeTabName:e,isStaging:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),hve=(e,t)=>{const n=te(),{tool:r,isDrawing:o,isStaging:s}=W(mve);return d.useCallback(()=>{if(r==="move"||s){n(Hm(!1));return}if(!t.current&&o&&e.current){const i=Q2(e.current);if(!i)return;n(kP([i.x,i.y]))}else t.current=!1;n(SP(!1))},[t,n,o,s,e,r])},gve=ce([jr],e=>{const{isMoveStageKeyHeld:t,stageScale:n}=e;return{isMoveStageKeyHeld:t,stageScale:n}},{memoizeOptions:{resultEqualityCheck:Tn}}),vve=e=>{const t=te(),{isMoveStageKeyHeld:n,stageScale:r}=W(gve);return d.useCallback(o=>{if(!e.current||n)return;o.evt.preventDefault();const s=e.current.getPointerPosition();if(!s)return;const i={x:(s.x-e.current.x())/r,y:(s.y-e.current.y())/r};let l=o.evt.deltaY;o.evt.ctrlKey&&(l=-l);const u=Fl(r*C9**l,y9,b9),p={x:s.x-i.x*u,y:s.y-i.y*u};t(w9(u)),t(yP(p))},[e,n,r,t])},xve=ce(jr,e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,stageDimensions:r,stageScale:o,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i}=e;return{boundingBoxCoordinates:t,boundingBoxDimensions:n,shouldDarkenOutsideBoundingBox:s,stageCoordinates:i,stageDimensions:r,stageScale:o}},{memoizeOptions:{resultEqualityCheck:Tn}}),bve=()=>{const{boundingBoxCoordinates:e,boundingBoxDimensions:t,shouldDarkenOutsideBoundingBox:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(xve);return a.jsxs(La,{children:[a.jsx(za,{offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fill:"rgba(0,0,0,0.4)",listening:!1,visible:n}),a.jsx(za,{x:e.x,y:e.y,width:t.width,height:t.height,fill:"rgb(255,255,255)",listening:!1,visible:n,globalCompositeOperation:"destination-out"})]})},yve=d.memo(bve),Cve=ce([jr],e=>{const{stageScale:t,stageCoordinates:n,stageDimensions:r}=e;return{stageScale:t,stageCoordinates:n,stageDimensions:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),wve=()=>{const{stageScale:e,stageCoordinates:t,stageDimensions:n}=W(Cve),{colorMode:r}=Ci(),[o,s]=d.useState([]),[i,l]=Ks("colors",["base.800","base.200"]),u=d.useCallback(p=>p/e,[e]);return d.useLayoutEffect(()=>{const{width:p,height:m}=n,{x:h,y:g}=t,x={x1:0,y1:0,x2:p,y2:m,offset:{x:u(h),y:u(g)}},y={x:Math.ceil(u(h)/64)*64,y:Math.ceil(u(g)/64)*64},b={x1:-y.x,y1:-y.y,x2:u(p)-y.x+64,y2:u(m)-y.y+64},S={x1:Math.min(x.x1,b.x1),y1:Math.min(x.y1,b.y1),x2:Math.max(x.x2,b.x2),y2:Math.max(x.y2,b.y2)},j=S.x2-S.x1,_=S.y2-S.y1,P=Math.round(j/64)+1,I=Math.round(_/64)+1,M=uS(0,P).map(A=>a.jsx(Zh,{x:S.x1+A*64,y:S.y1,points:[0,0,0,_],stroke:r==="dark"?i:l,strokeWidth:1},`x_${A}`)),O=uS(0,I).map(A=>a.jsx(Zh,{x:S.x1,y:S.y1+A*64,points:[0,0,j,0],stroke:r==="dark"?i:l,strokeWidth:1},`y_${A}`));s(M.concat(O))},[e,t,n,u,r,i,l]),a.jsx(La,{children:o})},Sve=d.memo(wve),kve=ce([we],({system:e,canvas:t})=>{const{denoiseProgress:n}=e,{boundingBox:r}=t.layerState.stagingArea,{batchIds:o}=t;return{boundingBox:r,progressImage:n&&o.includes(n.batch_id)?n.progress_image:void 0}},{memoizeOptions:{resultEqualityCheck:Tn}}),jve=e=>{const{...t}=e,{progressImage:n,boundingBox:r}=W(kve),[o,s]=d.useState(null);return d.useEffect(()=>{if(!n)return;const i=new Image;i.onload=()=>{s(i)},i.src=n.dataURL},[n]),n&&r&&o?a.jsx(oA,{x:r.x,y:r.y,width:r.width,height:r.height,image:o,listening:!1,...t}):null},_ve=d.memo(jve),zl=e=>{const{r:t,g:n,b:r,a:o}=e;return`rgba(${t}, ${n}, ${r}, ${o})`},Ive=ce(jr,e=>{const{maskColor:t,stageCoordinates:n,stageDimensions:r,stageScale:o}=e;return{stageCoordinates:n,stageDimensions:r,stageScale:o,maskColorString:zl(t)}}),uI=e=>`data:image/svg+xml;utf8, + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +`.replaceAll("black",e),Pve=e=>{const{...t}=e,{maskColorString:n,stageCoordinates:r,stageDimensions:o,stageScale:s}=W(Ive),[i,l]=d.useState(null),[u,p]=d.useState(0),m=d.useRef(null),h=d.useCallback(()=>{p(u+1),setTimeout(h,500)},[u]);return d.useEffect(()=>{if(i)return;const g=new Image;g.onload=()=>{l(g)},g.src=uI(n)},[i,n]),d.useEffect(()=>{i&&(i.src=uI(n))},[i,n]),d.useEffect(()=>{const g=setInterval(()=>p(x=>(x+1)%5),50);return()=>clearInterval(g)},[]),!i||!kc(r.x)||!kc(r.y)||!kc(s)||!kc(o.width)||!kc(o.height)?null:a.jsx(za,{ref:m,offsetX:r.x/s,offsetY:r.y/s,height:o.height/s,width:o.width/s,fillPatternImage:i,fillPatternOffsetY:kc(u)?u:0,fillPatternRepeat:"repeat",fillPatternScale:{x:1/s,y:1/s},listening:!0,globalCompositeOperation:"source-in",...t})},Eve=d.memo(Pve),Mve=ce([jr],e=>({objects:e.layerState.objects}),{memoizeOptions:{resultEqualityCheck:Tn}}),Ove=e=>{const{...t}=e,{objects:n}=W(Mve);return a.jsx(La,{listening:!1,...t,children:n.filter(S9).map((r,o)=>a.jsx(Zh,{points:r.points,stroke:"rgb(0,0,0)",strokeWidth:r.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:r.tool==="brush"?"source-over":"destination-out"},o))})},Rve=d.memo(Ove);var Il=d,Ave=function(t,n,r){const o=Il.useRef("loading"),s=Il.useRef(),[i,l]=Il.useState(0),u=Il.useRef(),p=Il.useRef(),m=Il.useRef();return(u.current!==t||p.current!==n||m.current!==r)&&(o.current="loading",s.current=void 0,u.current=t,p.current=n,m.current=r),Il.useLayoutEffect(function(){if(!t)return;var h=document.createElement("img");function g(){o.current="loaded",s.current=h,l(Math.random())}function x(){o.current="failed",s.current=void 0,l(Math.random())}return h.addEventListener("load",g),h.addEventListener("error",x),n&&(h.crossOrigin=n),r&&(h.referrerPolicy=r),h.src=t,function(){h.removeEventListener("load",g),h.removeEventListener("error",x)}},[t,n,r]),[s.current,o.current]};const Dve=pf(Ave),Tve=({canvasImage:e})=>{const[t,n,r,o]=Ks("colors",["base.400","base.500","base.700","base.900"]),s=di(t,n),i=di(r,o),{t:l}=J();return a.jsxs(La,{children:[a.jsx(za,{x:e.x,y:e.y,width:e.width,height:e.height,fill:s}),a.jsx(nve,{x:e.x,y:e.y,width:e.width,height:e.height,align:"center",verticalAlign:"middle",fontFamily:'"Inter Variable", sans-serif',fontSize:e.width/16,fontStyle:"600",text:l("common.imageFailedToLoad"),fill:i})]})},Nve=d.memo(Tve),$ve=e=>{const{x:t,y:n,imageName:r}=e.canvasImage,{currentData:o,isError:s}=Ps(r??Os.skipToken),[i,l]=Dve((o==null?void 0:o.image_url)??"",HI.get()?"use-credentials":"anonymous");return s||l==="failed"?a.jsx(Nve,{canvasImage:e.canvasImage}):a.jsx(oA,{x:t,y:n,image:i,listening:!1})},aA=d.memo($ve),Lve=ce([jr],e=>{const{layerState:{objects:t}}=e;return{objects:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),zve=()=>{const{objects:e}=W(Lve);return e?a.jsx(La,{name:"outpainting-objects",listening:!1,children:e.map((t,n)=>{if(k9(t))return a.jsx(aA,{canvasImage:t},n);if(j9(t)){const r=a.jsx(Zh,{points:t.points,stroke:t.color?zl(t.color):"rgb(0,0,0)",strokeWidth:t.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,listening:!1,globalCompositeOperation:t.tool==="brush"?"source-over":"destination-out"},n);return t.clip?a.jsx(La,{clipX:t.clip.x,clipY:t.clip.y,clipWidth:t.clip.width,clipHeight:t.clip.height,children:r},n):r}else{if(_9(t))return a.jsx(za,{x:t.x,y:t.y,width:t.width,height:t.height,fill:zl(t.color)},n);if(I9(t))return a.jsx(za,{x:t.x,y:t.y,width:t.width,height:t.height,fill:"rgb(255, 255, 255)",globalCompositeOperation:"destination-out"},n)}})}):null},Fve=d.memo(zve),Bve=ce([jr],e=>{const{layerState:t,shouldShowStagingImage:n,shouldShowStagingOutline:r,boundingBoxCoordinates:o,boundingBoxDimensions:s}=e,{selectedImageIndex:i,images:l,boundingBox:u}=t.stagingArea;return{currentStagingAreaImage:l.length>0&&i!==void 0?l[i]:void 0,isOnFirstImage:i===0,isOnLastImage:i===l.length-1,shouldShowStagingImage:n,shouldShowStagingOutline:r,x:(u==null?void 0:u.x)??o.x,y:(u==null?void 0:u.y)??o.y,width:(u==null?void 0:u.width)??s.width,height:(u==null?void 0:u.height)??s.height}},{memoizeOptions:{resultEqualityCheck:Tn}}),Hve=e=>{const{...t}=e,{currentStagingAreaImage:n,shouldShowStagingImage:r,shouldShowStagingOutline:o,x:s,y:i,width:l,height:u}=W(Bve);return a.jsxs(La,{...t,children:[r&&n&&a.jsx(aA,{canvasImage:n}),o&&a.jsxs(La,{children:[a.jsx(za,{x:s,y:i,width:l,height:u,strokeWidth:1,stroke:"white",strokeScaleEnabled:!1}),a.jsx(za,{x:s,y:i,width:l,height:u,dash:[4,4],strokeWidth:1,stroke:"black",strokeScaleEnabled:!1})]})]})},Wve=d.memo(Hve),Vve=ce([jr],e=>{const{layerState:{stagingArea:{images:t,selectedImageIndex:n}},shouldShowStagingOutline:r,shouldShowStagingImage:o}=e;return{currentIndex:n,total:t.length,currentStagingAreaImage:t.length>0?t[n]:void 0,shouldShowStagingImage:o,shouldShowStagingOutline:r}},je),Uve=()=>{const e=te(),{currentStagingAreaImage:t,shouldShowStagingImage:n,currentIndex:r,total:o}=W(Vve),{t:s}=J(),i=d.useCallback(()=>{e(dS(!0))},[e]),l=d.useCallback(()=>{e(dS(!1))},[e]),u=d.useCallback(()=>e(P9()),[e]),p=d.useCallback(()=>e(E9()),[e]),m=d.useCallback(()=>e(M9()),[e]);It(["left"],u,{enabled:()=>!0,preventDefault:!0}),It(["right"],p,{enabled:()=>!0,preventDefault:!0}),It(["enter"],()=>m,{enabled:()=>!0,preventDefault:!0});const{data:h}=Ps((t==null?void 0:t.imageName)??Os.skipToken),g=d.useCallback(()=>{e(O9(!n))},[e,n]),x=d.useCallback(()=>{h&&e(R9({imageDTO:h}))},[e,h]),y=d.useCallback(()=>{e(A9())},[e]);return t?a.jsxs($,{pos:"absolute",bottom:4,gap:2,w:"100%",align:"center",justify:"center",onMouseEnter:i,onMouseLeave:l,children:[a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(ot,{tooltip:`${s("unifiedCanvas.previous")} (Left)`,"aria-label":`${s("unifiedCanvas.previous")} (Left)`,icon:a.jsx(JZ,{}),onClick:u,colorScheme:"accent",isDisabled:!n}),a.jsx(Mt,{colorScheme:"base",pointerEvents:"none",isDisabled:!n,minW:20,children:`${r+1}/${o}`}),a.jsx(ot,{tooltip:`${s("unifiedCanvas.next")} (Right)`,"aria-label":`${s("unifiedCanvas.next")} (Right)`,icon:a.jsx(ZZ,{}),onClick:p,colorScheme:"accent",isDisabled:!n})]}),a.jsxs(zn,{isAttached:!0,borderRadius:"base",shadow:"dark-lg",children:[a.jsx(ot,{tooltip:`${s("unifiedCanvas.accept")} (Enter)`,"aria-label":`${s("unifiedCanvas.accept")} (Enter)`,icon:a.jsx(FM,{}),onClick:m,colorScheme:"accent"}),a.jsx(ot,{tooltip:s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"aria-label":s(n?"unifiedCanvas.showResultsOn":"unifiedCanvas.showResultsOff"),"data-alert":!n,icon:n?a.jsx(fee,{}):a.jsx(dee,{}),onClick:g,colorScheme:"accent"}),a.jsx(ot,{tooltip:s("unifiedCanvas.saveToGallery"),"aria-label":s("unifiedCanvas.saveToGallery"),isDisabled:!h||!h.is_intermediate,icon:a.jsx(Gg,{}),onClick:x,colorScheme:"accent"}),a.jsx(ot,{tooltip:s("unifiedCanvas.discardAll"),"aria-label":s("unifiedCanvas.discardAll"),icon:a.jsx(wu,{}),onClick:y,colorScheme:"error",fontSize:20})]})]}):null},Gve=d.memo(Uve),qve=()=>{const e=W(l=>l.canvas.layerState),t=W(l=>l.canvas.boundingBoxCoordinates),n=W(l=>l.canvas.boundingBoxDimensions),r=W(l=>l.canvas.isMaskEnabled),o=W(l=>l.canvas.shouldPreserveMaskedArea),[s,i]=d.useState();return d.useEffect(()=>{i(void 0)},[e,t,n,r,o]),Lee(async()=>{const l=await D9(e,t,n,r,o);if(!l)return;const{baseImageData:u,maskImageData:p}=l,m=T9(u,p);i(m)},1e3,[e,t,n,r,o]),s},Kve={txt2img:"Text to Image",img2img:"Image to Image",inpaint:"Inpaint",outpaint:"Inpaint"},Qve=()=>{const e=qve();return a.jsxs(De,{children:["Mode: ",e?Kve[e]:"..."]})},Xve=d.memo(Qve),Xc=e=>Math.round(e*100)/100,Yve=ce([jr],e=>{const{cursorPosition:t}=e,{cursorX:n,cursorY:r}=t?{cursorX:t.x,cursorY:t.y}:{cursorX:-1,cursorY:-1};return{cursorCoordinatesString:`(${Xc(n)}, ${Xc(r)})`}},{memoizeOptions:{resultEqualityCheck:Tn}});function Jve(){const{cursorCoordinatesString:e}=W(Yve),{t}=J();return a.jsx(De,{children:`${t("unifiedCanvas.cursorPosition")}: ${e}`})}const cb="var(--invokeai-colors-warning-500)",Zve=ce([jr],e=>{const{stageDimensions:{width:t,height:n},stageCoordinates:{x:r,y:o},boundingBoxDimensions:{width:s,height:i},scaledBoundingBoxDimensions:{width:l,height:u},boundingBoxCoordinates:{x:p,y:m},stageScale:h,shouldShowCanvasDebugInfo:g,layer:x,boundingBoxScaleMethod:y,shouldPreserveMaskedArea:b}=e;let C="inherit";return(y==="none"&&(s<512||i<512)||y==="manual"&&l*u<512*512)&&(C=cb),{activeLayerColor:x==="mask"?cb:"inherit",layer:x,boundingBoxColor:C,boundingBoxCoordinatesString:`(${Xc(p)}, ${Xc(m)})`,boundingBoxDimensionsString:`${s}×${i}`,scaledBoundingBoxDimensionsString:`${l}×${u}`,canvasCoordinatesString:`${Xc(r)}×${Xc(o)}`,canvasDimensionsString:`${t}×${n}`,canvasScaleString:Math.round(h*100),shouldShowCanvasDebugInfo:g,shouldShowBoundingBox:y!=="auto",shouldShowScaledBoundingBox:y!=="none",shouldPreserveMaskedArea:b}},{memoizeOptions:{resultEqualityCheck:Tn}}),e1e=()=>{const{activeLayerColor:e,layer:t,boundingBoxColor:n,boundingBoxCoordinatesString:r,boundingBoxDimensionsString:o,scaledBoundingBoxDimensionsString:s,shouldShowScaledBoundingBox:i,canvasCoordinatesString:l,canvasDimensionsString:u,canvasScaleString:p,shouldShowCanvasDebugInfo:m,shouldShowBoundingBox:h,shouldPreserveMaskedArea:g}=W(Zve),{t:x}=J();return a.jsxs($,{sx:{flexDirection:"column",position:"absolute",top:0,insetInlineStart:0,opacity:.65,display:"flex",fontSize:"sm",padding:1,px:2,minWidth:48,margin:1,borderRadius:"base",pointerEvents:"none",bg:"base.200",_dark:{bg:"base.800"}},children:[a.jsx(Xve,{}),a.jsx(De,{style:{color:e},children:`${x("unifiedCanvas.activeLayer")}: ${x(`unifiedCanvas.${t}`)}`}),a.jsx(De,{children:`${x("unifiedCanvas.canvasScale")}: ${p}%`}),g&&a.jsxs(De,{style:{color:cb},children:[x("unifiedCanvas.preserveMaskedArea"),": ",x("common.on")]}),h&&a.jsx(De,{style:{color:n},children:`${x("unifiedCanvas.boundingBox")}: ${o}`}),i&&a.jsx(De,{style:{color:n},children:`${x("unifiedCanvas.scaledBoundingBox")}: ${s}`}),m&&a.jsxs(a.Fragment,{children:[a.jsx(De,{children:`${x("unifiedCanvas.boundingBoxPosition")}: ${r}`}),a.jsx(De,{children:`${x("unifiedCanvas.canvasDimensions")}: ${u}`}),a.jsx(De,{children:`${x("unifiedCanvas.canvasPosition")}: ${l}`}),a.jsx(Jve,{})]})]})},t1e=d.memo(e1e),n1e=ce([we],({canvas:e,generation:t})=>{const{boundingBoxCoordinates:n,boundingBoxDimensions:r,stageScale:o,isDrawing:s,isTransformingBoundingBox:i,isMovingBoundingBox:l,tool:u,shouldSnapToGrid:p}=e,{aspectRatio:m}=t;return{boundingBoxCoordinates:n,boundingBoxDimensions:r,isDrawing:s,isMovingBoundingBox:l,isTransformingBoundingBox:i,stageScale:o,shouldSnapToGrid:p,tool:u,hitStrokeWidth:20/o,aspectRatio:m}},{memoizeOptions:{resultEqualityCheck:Tn}}),r1e=e=>{const{...t}=e,n=te(),{boundingBoxCoordinates:r,boundingBoxDimensions:o,isDrawing:s,isMovingBoundingBox:i,isTransformingBoundingBox:l,stageScale:u,shouldSnapToGrid:p,tool:m,hitStrokeWidth:h,aspectRatio:g}=W(n1e),x=d.useRef(null),y=d.useRef(null),[b,C]=d.useState(!1);d.useEffect(()=>{var F;!x.current||!y.current||(x.current.nodes([y.current]),(F=x.current.getLayer())==null||F.batchDraw())},[]);const S=64*u;It("N",()=>{n(Wm(!p))});const j=d.useCallback(F=>{if(!p){n(Ev({x:Math.floor(F.target.x()),y:Math.floor(F.target.y())}));return}const V=F.target.x(),Q=F.target.y(),q=Gr(V,64),z=Gr(Q,64);F.target.x(q),F.target.y(z),n(Ev({x:q,y:z}))},[n,p]),_=d.useCallback(()=>{if(!y.current)return;const F=y.current,V=F.scaleX(),Q=F.scaleY(),q=Math.round(F.width()*V),z=Math.round(F.height()*Q),G=Math.round(F.x()),T=Math.round(F.y());if(g){const B=Gr(q/g,64);n(Xs({width:q,height:B}))}else n(Xs({width:q,height:z}));n(Ev({x:p?kd(G,64):G,y:p?kd(T,64):T})),F.scaleX(1),F.scaleY(1)},[n,p,g]),P=d.useCallback((F,V,Q)=>{const q=F.x%S,z=F.y%S;return{x:kd(V.x,S)+q,y:kd(V.y,S)+z}},[S]),I=d.useCallback(()=>{n(Mv(!0))},[n]),M=d.useCallback(()=>{n(Mv(!1)),n(Ov(!1)),n(Dp(!1)),C(!1)},[n]),O=d.useCallback(()=>{n(Ov(!0))},[n]),A=d.useCallback(()=>{n(Mv(!1)),n(Ov(!1)),n(Dp(!1)),C(!1)},[n]),D=d.useCallback(()=>{C(!0)},[]),R=d.useCallback(()=>{!l&&!i&&C(!1)},[i,l]),N=d.useCallback(()=>{n(Dp(!0))},[n]),Y=d.useCallback(()=>{n(Dp(!1))},[n]);return a.jsxs(La,{...t,children:[a.jsx(za,{height:o.height,width:o.width,x:r.x,y:r.y,onMouseEnter:N,onMouseOver:N,onMouseLeave:Y,onMouseOut:Y}),a.jsx(za,{draggable:!0,fillEnabled:!1,height:o.height,hitStrokeWidth:h,listening:!s&&m==="move",onDragStart:O,onDragEnd:A,onDragMove:j,onMouseDown:O,onMouseOut:R,onMouseOver:D,onMouseEnter:D,onMouseUp:A,onTransform:_,onTransformEnd:M,ref:y,stroke:b?"rgba(255,255,255,0.7)":"white",strokeWidth:(b?8:1)/u,width:o.width,x:r.x,y:r.y}),a.jsx(rve,{anchorCornerRadius:3,anchorDragBoundFunc:P,anchorFill:"rgba(212,216,234,1)",anchorSize:15,anchorStroke:"rgb(42,42,42)",borderDash:[4,4],borderEnabled:!0,borderStroke:"black",draggable:!1,enabledAnchors:m==="move"?void 0:[],flipEnabled:!1,ignoreStroke:!0,keepRatio:!1,listening:!s&&m==="move",onDragStart:O,onDragEnd:A,onMouseDown:I,onMouseUp:M,onTransformEnd:M,ref:x,rotateEnabled:!1})]})},o1e=d.memo(r1e),s1e=ce(jr,e=>{const{cursorPosition:t,brushSize:n,colorPickerColor:r,maskColor:o,brushColor:s,tool:i,layer:l,shouldShowBrush:u,isMovingBoundingBox:p,isTransformingBoundingBox:m,stageScale:h,stageDimensions:g,boundingBoxCoordinates:x,boundingBoxDimensions:y,shouldRestrictStrokesToBox:b}=e,C=b?{clipX:x.x,clipY:x.y,clipWidth:y.width,clipHeight:y.height}:{};return{cursorPosition:t,brushX:t?t.x:g.width/2,brushY:t?t.y:g.height/2,radius:n/2,colorPickerOuterRadius:fS/h,colorPickerInnerRadius:(fS-U1+1)/h,maskColorString:zl({...o,a:.5}),brushColorString:zl(s),colorPickerColorString:zl(r),tool:i,layer:l,shouldShowBrush:u,shouldDrawBrushPreview:!(p||m||!t)&&u,strokeWidth:1.5/h,dotRadius:1.5/h,clip:C}},{memoizeOptions:{resultEqualityCheck:Tn}}),a1e=e=>{const{...t}=e,{brushX:n,brushY:r,radius:o,maskColorString:s,tool:i,layer:l,shouldDrawBrushPreview:u,dotRadius:p,strokeWidth:m,brushColorString:h,colorPickerColorString:g,colorPickerInnerRadius:x,colorPickerOuterRadius:y,clip:b}=W(s1e);return u?a.jsxs(La,{listening:!1,...b,...t,children:[i==="colorPicker"?a.jsxs(a.Fragment,{children:[a.jsx(_l,{x:n,y:r,radius:y,stroke:h,strokeWidth:U1,strokeScaleEnabled:!1}),a.jsx(_l,{x:n,y:r,radius:x,stroke:g,strokeWidth:U1,strokeScaleEnabled:!1})]}):a.jsxs(a.Fragment,{children:[a.jsx(_l,{x:n,y:r,radius:o,fill:l==="mask"?s:h,globalCompositeOperation:i==="eraser"?"destination-out":"source-out"}),a.jsx(_l,{x:n,y:r,radius:o,stroke:"rgba(255,255,255,0.4)",strokeWidth:m*2,strokeEnabled:!0,listening:!1}),a.jsx(_l,{x:n,y:r,radius:o,stroke:"rgba(0,0,0,1)",strokeWidth:m,strokeEnabled:!0,listening:!1})]}),a.jsx(_l,{x:n,y:r,radius:p*2,fill:"rgba(255,255,255,0.4)",listening:!1}),a.jsx(_l,{x:n,y:r,radius:p,fill:"rgba(0,0,0,1)",listening:!1})]}):null},i1e=d.memo(a1e),l1e=ce([jr,Ns],(e,t)=>{const{isMaskEnabled:n,stageScale:r,shouldShowBoundingBox:o,isTransformingBoundingBox:s,isMouseOverBoundingBox:i,isMovingBoundingBox:l,stageDimensions:u,stageCoordinates:p,tool:m,isMovingStage:h,shouldShowIntermediates:g,shouldShowGrid:x,shouldRestrictStrokesToBox:y,shouldAntialias:b}=e;let C="none";return m==="move"||t?h?C="grabbing":C="grab":s?C=void 0:y&&!i&&(C="default"),{isMaskEnabled:n,isModifyingBoundingBox:s||l,shouldShowBoundingBox:o,shouldShowGrid:x,stageCoordinates:p,stageCursor:C,stageDimensions:u,stageScale:r,tool:m,isStaging:t,shouldShowIntermediates:g,shouldAntialias:b}},je),c1e=Ee(ove,{shouldForwardProp:e=>!["sx"].includes(e)}),u1e=()=>{const{isMaskEnabled:e,isModifyingBoundingBox:t,shouldShowBoundingBox:n,shouldShowGrid:r,stageCoordinates:o,stageCursor:s,stageDimensions:i,stageScale:l,tool:u,isStaging:p,shouldShowIntermediates:m,shouldAntialias:h}=W(l1e);lve();const g=te(),x=d.useRef(null),y=d.useRef(null),b=d.useRef(null),C=d.useCallback(F=>{N9(F),y.current=F},[]),S=d.useCallback(F=>{$9(F),b.current=F},[]),j=d.useRef({x:0,y:0}),_=d.useRef(!1),P=vve(y),I=uve(y),M=hve(y,_),O=fve(y,_,j),A=pve(),{handleDragStart:D,handleDragMove:R,handleDragEnd:N}=ave(),Y=d.useCallback(F=>F.evt.preventDefault(),[]);return d.useEffect(()=>{if(!x.current)return;const F=new ResizeObserver(q=>{for(const z of q)if(z.contentBoxSize){const{width:G,height:T}=z.contentRect;g(pS({width:G,height:T}))}});F.observe(x.current);const{width:V,height:Q}=x.current.getBoundingClientRect();return g(pS({width:V,height:Q})),()=>{F.disconnect()}},[g]),a.jsxs($,{id:"canvas-container",ref:x,sx:{position:"relative",height:"100%",width:"100%",borderRadius:"base"},children:[a.jsx(De,{sx:{position:"absolute"},children:a.jsxs(c1e,{tabIndex:-1,ref:C,sx:{outline:"none",overflow:"hidden",cursor:s||void 0,canvas:{outline:"none"}},x:o.x,y:o.y,width:i.width,height:i.height,scale:{x:l,y:l},onTouchStart:I,onTouchMove:O,onTouchEnd:M,onMouseDown:I,onMouseLeave:A,onMouseMove:O,onMouseUp:M,onDragStart:D,onDragMove:R,onDragEnd:N,onContextMenu:Y,onWheel:P,draggable:(u==="move"||p)&&!t,children:[a.jsx(Sd,{id:"grid",visible:r,children:a.jsx(Sve,{})}),a.jsx(Sd,{id:"base",ref:S,listening:!1,imageSmoothingEnabled:h,children:a.jsx(Fve,{})}),a.jsxs(Sd,{id:"mask",visible:e&&!p,listening:!1,children:[a.jsx(Rve,{visible:!0,listening:!1}),a.jsx(Eve,{listening:!1})]}),a.jsx(Sd,{children:a.jsx(yve,{})}),a.jsxs(Sd,{id:"preview",imageSmoothingEnabled:h,children:[!p&&a.jsx(i1e,{visible:u!=="move",listening:!1}),a.jsx(Wve,{visible:p}),m&&a.jsx(_ve,{}),a.jsx(o1e,{visible:n&&!p})]})]})}),a.jsx(t1e,{}),a.jsx(Gve,{})]})},d1e=d.memo(u1e);function f1e(e,t,n=250){const[r,o]=d.useState(0);return d.useEffect(()=>{const s=setTimeout(()=>{r===1&&e(),o(0)},n);return r===2&&t(),()=>clearTimeout(s)},[r,e,t,n]),()=>o(s=>s+1)}const O1={width:6,height:6,borderColor:"base.100"},p1e={".react-colorful__hue-pointer":O1,".react-colorful__saturation-pointer":O1,".react-colorful__alpha-pointer":O1},m1e=e=>a.jsx(De,{sx:p1e,children:a.jsx(nR,{...e})}),iA=d.memo(m1e),h1e=ce([jr,Ns],(e,t)=>{const{maskColor:n,layer:r,isMaskEnabled:o,shouldPreserveMaskedArea:s}=e;return{layer:r,maskColor:n,maskColorString:zl(n),isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:t}},{memoizeOptions:{resultEqualityCheck:Tn}}),g1e=()=>{const e=te(),{t}=J(),{layer:n,maskColor:r,isMaskEnabled:o,shouldPreserveMaskedArea:s,isStaging:i}=W(h1e);It(["q"],()=>{l()},{enabled:()=>!i,preventDefault:!0},[n]),It(["shift+c"],()=>{u()},{enabled:()=>!i,preventDefault:!0},[]),It(["h"],()=>{p()},{enabled:()=>!i,preventDefault:!0},[o]);const l=()=>{e(jP(n==="mask"?"base":"mask"))},u=()=>e(wP()),p=()=>e(Fb(!o)),m=async()=>{e(F9())};return a.jsx(Hf,{triggerComponent:a.jsx(zn,{children:a.jsx(ot,{"aria-label":t("unifiedCanvas.maskingOptions"),tooltip:t("unifiedCanvas.maskingOptions"),icon:a.jsx(KM,{}),isChecked:n==="mask",isDisabled:i})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(Io,{label:`${t("unifiedCanvas.enableMask")} (H)`,isChecked:o,onChange:p}),a.jsx(Io,{label:t("unifiedCanvas.preserveMaskedArea"),isChecked:s,onChange:h=>e(L9(h.target.checked))}),a.jsx(De,{sx:{paddingTop:2,paddingBottom:2},children:a.jsx(iA,{color:r,onChange:h=>e(z9(h))})}),a.jsx(Mt,{size:"sm",leftIcon:a.jsx(Gg,{}),onClick:m,children:"Save Mask"}),a.jsxs(Mt,{size:"sm",leftIcon:a.jsx(qo,{}),onClick:u,children:[t("unifiedCanvas.clearMask")," (Shift+C)"]})]})})},v1e=d.memo(g1e),x1e=ce([we,ro],({canvas:e},t)=>{const{futureLayerStates:n}=e;return{canRedo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function b1e(){const e=te(),{canRedo:t,activeTabName:n}=W(x1e),{t:r}=J(),o=()=>{e(B9())};return It(["meta+shift+z","ctrl+shift+z","control+y","meta+y"],()=>{o()},{enabled:()=>t,preventDefault:!0},[n,t]),a.jsx(ot,{"aria-label":`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,tooltip:`${r("unifiedCanvas.redo")} (Ctrl+Shift+Z)`,icon:a.jsx(jee,{}),onClick:o,isDisabled:!t})}const y1e=()=>{const e=W(Ns),t=te(),{t:n}=J();return a.jsxs(c0,{title:n("unifiedCanvas.clearCanvasHistory"),acceptCallback:()=>t(H9()),acceptButtonText:n("unifiedCanvas.clearHistory"),triggerComponent:a.jsx(Mt,{size:"sm",leftIcon:a.jsx(qo,{}),isDisabled:e,children:n("unifiedCanvas.clearCanvasHistory")}),children:[a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryMessage")}),a.jsx("br",{}),a.jsx("p",{children:n("unifiedCanvas.clearCanvasHistoryConfirm")})]})},C1e=d.memo(y1e),w1e=ce([jr],e=>{const{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}=e;return{shouldAutoSave:t,shouldCropToBoundingBoxOnSave:n,shouldDarkenOutsideBoundingBox:r,shouldShowCanvasDebugInfo:o,shouldShowGrid:s,shouldShowIntermediates:i,shouldSnapToGrid:l,shouldRestrictStrokesToBox:u,shouldAntialias:p}},{memoizeOptions:{resultEqualityCheck:Tn}}),S1e=()=>{const e=te(),{t}=J(),{shouldAutoSave:n,shouldCropToBoundingBoxOnSave:r,shouldDarkenOutsideBoundingBox:o,shouldShowCanvasDebugInfo:s,shouldShowGrid:i,shouldShowIntermediates:l,shouldSnapToGrid:u,shouldRestrictStrokesToBox:p,shouldAntialias:m}=W(w1e);It(["n"],()=>{e(Wm(!u))},{enabled:!0,preventDefault:!0},[u]);const h=g=>e(Wm(g.target.checked));return a.jsx(Hf,{isLazy:!1,triggerComponent:a.jsx(ot,{tooltip:t("unifiedCanvas.canvasSettings"),"aria-label":t("unifiedCanvas.canvasSettings"),icon:a.jsx(ZM,{})}),children:a.jsxs($,{direction:"column",gap:2,children:[a.jsx(Io,{label:t("unifiedCanvas.showIntermediates"),isChecked:l,onChange:g=>e(W9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.showGrid"),isChecked:i,onChange:g=>e(V9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.snapToGrid"),isChecked:u,onChange:h}),a.jsx(Io,{label:t("unifiedCanvas.darkenOutsideSelection"),isChecked:o,onChange:g=>e(U9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.autoSaveToGallery"),isChecked:n,onChange:g=>e(G9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.saveBoxRegionOnly"),isChecked:r,onChange:g=>e(q9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.limitStrokesToBox"),isChecked:p,onChange:g=>e(K9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.showCanvasDebugInfo"),isChecked:s,onChange:g=>e(Q9(g.target.checked))}),a.jsx(Io,{label:t("unifiedCanvas.antialiasing"),isChecked:m,onChange:g=>e(X9(g.target.checked))}),a.jsx(C1e,{})]})})},k1e=d.memo(S1e),j1e=ce([we,Ns],({canvas:e},t)=>{const{tool:n,brushColor:r,brushSize:o}=e;return{tool:n,isStaging:t,brushColor:r,brushSize:o}},{memoizeOptions:{resultEqualityCheck:Tn}}),_1e=()=>{const e=te(),{tool:t,brushColor:n,brushSize:r,isStaging:o}=W(j1e),{t:s}=J();It(["b"],()=>{i()},{enabled:()=>!o,preventDefault:!0},[]),It(["e"],()=>{l()},{enabled:()=>!o,preventDefault:!0},[t]),It(["c"],()=>{u()},{enabled:()=>!o,preventDefault:!0},[t]),It(["shift+f"],()=>{p()},{enabled:()=>!o,preventDefault:!0}),It(["delete","backspace"],()=>{m()},{enabled:()=>!o,preventDefault:!0}),It(["BracketLeft"],()=>{r-5<=5?e(Tp(Math.max(r-1,1))):e(Tp(Math.max(r-5,1)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["BracketRight"],()=>{e(Tp(Math.min(r+5,500)))},{enabled:()=>!o,preventDefault:!0},[r]),It(["Shift+BracketLeft"],()=>{e(Rv({...n,a:Fl(n.a-.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]),It(["Shift+BracketRight"],()=>{e(Rv({...n,a:Fl(n.a+.05,.05,1)}))},{enabled:()=>!o,preventDefault:!0},[n]);const i=()=>e(Jc("brush")),l=()=>e(Jc("eraser")),u=()=>e(Jc("colorPicker")),p=()=>e(Y9()),m=()=>e(J9());return a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${s("unifiedCanvas.brush")} (B)`,tooltip:`${s("unifiedCanvas.brush")} (B)`,icon:a.jsx(Cee,{}),isChecked:t==="brush"&&!o,onClick:i,isDisabled:o}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.eraser")} (E)`,tooltip:`${s("unifiedCanvas.eraser")} (E)`,icon:a.jsx(iee,{}),isChecked:t==="eraser"&&!o,isDisabled:o,onClick:l}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,tooltip:`${s("unifiedCanvas.fillBoundingBox")} (Shift+F)`,icon:a.jsx(pee,{}),isDisabled:o,onClick:p}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,tooltip:`${s("unifiedCanvas.eraseBoundingBox")} (Del/Backspace)`,icon:a.jsx(Xi,{style:{transform:"rotate(45deg)"}}),isDisabled:o,onClick:m}),a.jsx(ot,{"aria-label":`${s("unifiedCanvas.colorPicker")} (C)`,tooltip:`${s("unifiedCanvas.colorPicker")} (C)`,icon:a.jsx(uee,{}),isChecked:t==="colorPicker"&&!o,isDisabled:o,onClick:u}),a.jsx(Hf,{triggerComponent:a.jsx(ot,{"aria-label":s("unifiedCanvas.brushOptions"),tooltip:s("unifiedCanvas.brushOptions"),icon:a.jsx(YM,{})}),children:a.jsxs($,{minWidth:60,direction:"column",gap:4,width:"100%",children:[a.jsx($,{gap:4,justifyContent:"space-between",children:a.jsx(jt,{label:s("unifiedCanvas.brushSize"),value:r,withInput:!0,onChange:h=>e(Tp(h)),sliderNumberInputProps:{max:500}})}),a.jsx(De,{sx:{width:"100%",paddingTop:2,paddingBottom:2},children:a.jsx(iA,{color:n,onChange:h=>e(Rv(h))})})]})})]})},I1e=d.memo(_1e),P1e=ce([we,ro],({canvas:e},t)=>{const{pastLayerStates:n}=e;return{canUndo:n.length>0,activeTabName:t}},{memoizeOptions:{resultEqualityCheck:Tn}});function E1e(){const e=te(),{t}=J(),{canUndo:n,activeTabName:r}=W(P1e),o=()=>{e(Z9())};return It(["meta+z","ctrl+z"],()=>{o()},{enabled:()=>n,preventDefault:!0},[r,n]),a.jsx(ot,{"aria-label":`${t("unifiedCanvas.undo")} (Ctrl+Z)`,tooltip:`${t("unifiedCanvas.undo")} (Ctrl+Z)`,icon:a.jsx(qg,{}),onClick:o,isDisabled:!n})}const M1e=ce([we,Ns],({canvas:e},t)=>{const{tool:n,shouldCropToBoundingBoxOnSave:r,layer:o,isMaskEnabled:s}=e;return{isStaging:t,isMaskEnabled:s,tool:n,layer:o,shouldCropToBoundingBoxOnSave:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),O1e=()=>{const e=te(),{isStaging:t,isMaskEnabled:n,layer:r,tool:o}=W(M1e),s=V1(),{t:i}=J(),{isClipboardAPIAvailable:l}=b8(),{getUploadButtonProps:u,getUploadInputProps:p}=y2({postUploadAction:{type:"SET_CANVAS_INITIAL_IMAGE"}});It(["v"],()=>{m()},{enabled:()=>!t,preventDefault:!0},[]),It(["r"],()=>{g()},{enabled:()=>!0,preventDefault:!0},[s]),It(["shift+m"],()=>{y()},{enabled:()=>!t,preventDefault:!0},[s]),It(["shift+s"],()=>{b()},{enabled:()=>!t,preventDefault:!0},[s]),It(["meta+c","ctrl+c"],()=>{C()},{enabled:()=>!t&&l,preventDefault:!0},[s,l]),It(["shift+d"],()=>{S()},{enabled:()=>!t,preventDefault:!0},[s]);const m=()=>e(Jc("move")),h=f1e(()=>g(!1),()=>g(!0)),g=(_=!1)=>{const P=V1();if(!P)return;const I=P.getClientRect({skipTransform:!0});e(t$({contentRect:I,shouldScaleTo1:_}))},x=()=>{e(MI())},y=()=>{e(n$())},b=()=>{e(r$())},C=()=>{l&&e(o$())},S=()=>{e(s$())},j=_=>{const P=_;e(jP(P)),P==="mask"&&!n&&e(Fb(!0))};return a.jsxs($,{sx:{alignItems:"center",gap:2,flexWrap:"wrap"},children:[a.jsx(De,{w:24,children:a.jsx(Tr,{tooltip:`${i("unifiedCanvas.layer")} (Q)`,value:r,data:e$,onChange:j,disabled:t})}),a.jsx(v1e,{}),a.jsx(I1e,{}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${i("unifiedCanvas.move")} (V)`,tooltip:`${i("unifiedCanvas.move")} (V)`,icon:a.jsx(eee,{}),isChecked:o==="move"||t,onClick:m}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.resetView")} (R)`,tooltip:`${i("unifiedCanvas.resetView")} (R)`,icon:a.jsx(oee,{}),onClick:h})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,tooltip:`${i("unifiedCanvas.mergeVisible")} (Shift+M)`,icon:a.jsx(xee,{}),onClick:y,isDisabled:t}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,tooltip:`${i("unifiedCanvas.saveToGallery")} (Shift+S)`,icon:a.jsx(Gg,{}),onClick:b,isDisabled:t}),l&&a.jsx(ot,{"aria-label":`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,tooltip:`${i("unifiedCanvas.copyToClipboard")} (Cmd/Ctrl+C)`,icon:a.jsx(Lu,{}),onClick:C,isDisabled:t}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,tooltip:`${i("unifiedCanvas.downloadAsImage")} (Shift+D)`,icon:a.jsx(zu,{}),onClick:S,isDisabled:t})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(E1e,{}),a.jsx(b1e,{})]}),a.jsxs(zn,{isAttached:!0,children:[a.jsx(ot,{"aria-label":`${i("common.upload")}`,tooltip:`${i("common.upload")}`,icon:a.jsx(Kg,{}),isDisabled:t,...u()}),a.jsx("input",{...p()}),a.jsx(ot,{"aria-label":`${i("unifiedCanvas.clearCanvas")}`,tooltip:`${i("unifiedCanvas.clearCanvas")}`,icon:a.jsx(qo,{}),onClick:x,colorScheme:"error",isDisabled:t})]}),a.jsx(zn,{isAttached:!0,children:a.jsx(k1e,{})})]})},R1e=d.memo(O1e),dI={id:"canvas-intial-image",actionType:"SET_CANVAS_INITIAL_IMAGE"},A1e=()=>{const{isOver:e,setNodeRef:t,active:n}=TO({id:"unifiedCanvas",data:dI});return a.jsxs($,{layerStyle:"first",ref:t,tabIndex:-1,sx:{flexDirection:"column",alignItems:"center",gap:4,p:2,borderRadius:"base",w:"full",h:"full"},children:[a.jsx(R1e,{}),a.jsx(d1e,{}),NO(dI,n)&&a.jsx($O,{isOver:e,label:"Set Canvas Initial Image"})]})},D1e=d.memo(A1e),T1e=()=>a.jsx(D1e,{}),N1e=d.memo(T1e),$1e=[{id:"txt2img",translationKey:"common.txt2img",icon:a.jsx(Lr,{as:mee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(e0e,{})},{id:"img2img",translationKey:"common.img2img",icon:a.jsx(Lr,{as:Xl,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(dpe,{})},{id:"unifiedCanvas",translationKey:"common.unifiedCanvas",icon:a.jsx(Lr,{as:Xoe,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(N1e,{})},{id:"nodes",translationKey:"common.nodes",icon:a.jsx(Lr,{as:C2,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(cge,{})},{id:"modelManager",translationKey:"modelManager.modelManager",icon:a.jsx(Lr,{as:see,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(cme,{})},{id:"queue",translationKey:"queue.queue",icon:a.jsx(Lr,{as:Eee,sx:{boxSize:6,pointerEvents:"none"}}),content:a.jsx(Jge,{})}],L1e=ce([we],({config:e})=>{const{disabledTabs:t}=e;return $1e.filter(r=>!t.includes(r.id))},{memoizeOptions:{resultEqualityCheck:Tn}}),z1e=448,F1e=448,B1e=360,H1e=["modelManager","queue"],W1e=["modelManager","queue"],V1e=()=>{const e=W(a$),t=W(ro),n=W(L1e),{t:r}=J(),o=te(),s=d.useCallback(R=>{R.target instanceof HTMLElement&&R.target.blur()},[]),i=d.useMemo(()=>n.map(R=>a.jsx(Fn,{hasArrow:!0,label:String(r(R.translationKey)),placement:"end",children:a.jsxs(Po,{onClick:s,children:[a.jsx(HP,{children:String(r(R.translationKey))}),R.icon]})},R.id)),[n,r,s]),l=d.useMemo(()=>n.map(R=>a.jsx(ss,{children:R.content},R.id)),[n]),u=d.useCallback(R=>{const N=n[R];N&&o(ti(N.id))},[o,n]),{minSize:p,isCollapsed:m,setIsCollapsed:h,ref:g,reset:x,expand:y,collapse:b,toggle:C}=w_(z1e,"pixels"),{ref:S,minSize:j,isCollapsed:_,setIsCollapsed:P,reset:I,expand:M,collapse:O,toggle:A}=w_(B1e,"pixels");It("f",()=>{_||m?(M(),y()):(b(),O())},[o,_,m]),It(["t","o"],()=>{C()},[o]),It("g",()=>{A()},[o]);const D=R2();return a.jsxs(nc,{variant:"appTabs",defaultIndex:e,index:e,onChange:u,sx:{flexGrow:1,gap:4},isLazy:!0,children:[a.jsxs(rc,{sx:{pt:2,gap:4,flexDir:"column"},children:[i,a.jsx(ki,{})]}),a.jsxs(f0,{id:"app",autoSaveId:"app",direction:"horizontal",style:{height:"100%",width:"100%"},storage:D,units:"pixels",children:[!W1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Ji,{order:0,id:"side",ref:g,defaultSize:p,minSize:p,onCollapse:h,collapsible:!0,children:t==="nodes"?a.jsx(Yie,{}):a.jsx(Dfe,{})}),a.jsx(Qh,{onDoubleClick:x,collapsedDirection:m?"left":void 0}),a.jsx(tle,{isSidePanelCollapsed:m,sidePanelRef:g})]}),a.jsx(Ji,{id:"main",order:1,minSize:F1e,children:a.jsx(Tu,{style:{height:"100%",width:"100%"},children:l})}),!H1e.includes(t)&&a.jsxs(a.Fragment,{children:[a.jsx(Qh,{onDoubleClick:I,collapsedDirection:_?"right":void 0}),a.jsx(Ji,{id:"gallery",ref:S,order:2,defaultSize:j,minSize:j,onCollapse:P,collapsible:!0,children:a.jsx(Mse,{})}),a.jsx(Zie,{isGalleryCollapsed:_,galleryPanelRef:S})]})]})]})},U1e=d.memo(V1e),G1e=d.createContext(null),R1={didCatch:!1,error:null};class q1e extends d.Component{constructor(t){super(t),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=R1}static getDerivedStateFromError(t){return{didCatch:!0,error:t}}resetErrorBoundary(){const{error:t}=this.state;if(t!==null){for(var n,r,o=arguments.length,s=new Array(o),i=0;i0&&arguments[0]!==void 0?arguments[0]:[],t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return e.length!==t.length||e.some((n,r)=>!Object.is(n,t[r]))}function Q1e(e={}){let t;if(e.repoUrl)t=e.repoUrl;else if(e.user&&e.repo)t=`https://github.com/${e.user}/${e.repo}`;else throw new Error("You need to specify either the `repoUrl` option or both the `user` and `repo` options");const n=new URL(`${t}/issues/new`),r=["body","title","labels","template","milestone","assignee","projects"];for(const o of r){let s=e[o];if(s!==void 0){if(o==="labels"||o==="projects"){if(!Array.isArray(s))throw new TypeError(`The \`${o}\` option should be an array`);s=s.join(",")}n.searchParams.set(o,s)}}return n.toString()}const X1e=[EvalError,RangeError,ReferenceError,SyntaxError,TypeError,URIError,globalThis.DOMException,globalThis.AssertionError,globalThis.SystemError].filter(Boolean).map(e=>[e.name,e]),Y1e=new Map(X1e),J1e=[{property:"name",enumerable:!1},{property:"message",enumerable:!1},{property:"stack",enumerable:!1},{property:"code",enumerable:!0},{property:"cause",enumerable:!1}],ub=new WeakSet,Z1e=e=>{ub.add(e);const t=e.toJSON();return ub.delete(e),t},exe=e=>Y1e.get(e)??Error,lA=({from:e,seen:t,to:n,forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l})=>{if(!n)if(Array.isArray(e))n=[];else if(!l&&fI(e)){const p=exe(e.name);n=new p}else n={};if(t.push(e),s>=o)return n;if(i&&typeof e.toJSON=="function"&&!ub.has(e))return Z1e(e);const u=p=>lA({from:p,seen:[...t],forceEnumerable:r,maxDepth:o,depth:s,useToJSON:i,serialize:l});for(const[p,m]of Object.entries(e)){if(typeof Buffer=="function"&&Buffer.isBuffer(m)){n[p]="[object Buffer]";continue}if(m!==null&&typeof m=="object"&&typeof m.pipe=="function"){n[p]="[object Stream]";continue}if(typeof m!="function"){if(!m||typeof m!="object"){n[p]=m;continue}if(!t.includes(e[p])){s++,n[p]=u(e[p]);continue}n[p]="[Circular]"}}for(const{property:p,enumerable:m}of J1e)typeof e[p]<"u"&&e[p]!==null&&Object.defineProperty(n,p,{value:fI(e[p])?u(e[p]):e[p],enumerable:r?!0:m,configurable:!0,writable:!0});return n};function txe(e,t={}){const{maxDepth:n=Number.POSITIVE_INFINITY,useToJSON:r=!0}=t;return typeof e=="object"&&e!==null?lA({from:e,seen:[],forceEnumerable:!0,maxDepth:n,depth:0,useToJSON:r,serialize:!0}):typeof e=="function"?`[Function: ${e.name??"anonymous"}]`:e}function fI(e){return!!e&&typeof e=="object"&&"name"in e&&"message"in e&&"stack"in e}const nxe=({error:e,resetErrorBoundary:t})=>{const n=DP(),r=d.useCallback(()=>{const s=JSON.stringify(txe(e),null,2);navigator.clipboard.writeText(`\`\`\` +${s} +\`\`\``),n({title:"Error Copied"})},[e,n]),o=d.useMemo(()=>Q1e({user:"invoke-ai",repo:"InvokeAI",template:"BUG_REPORT.yml",title:`[bug]: ${e.name}: ${e.message}`}),[e.message,e.name]);return a.jsx($,{layerStyle:"body",sx:{w:"100vw",h:"100vh",alignItems:"center",justifyContent:"center",p:4},children:a.jsxs($,{layerStyle:"first",sx:{flexDir:"column",borderRadius:"base",justifyContent:"center",gap:8,p:16},children:[a.jsx(xo,{children:"Something went wrong"}),a.jsx($,{layerStyle:"second",sx:{px:8,py:4,borderRadius:"base",gap:4,justifyContent:"space-between",alignItems:"center"},children:a.jsxs(Se,{sx:{fontWeight:600,color:"error.500",_dark:{color:"error.400"}},children:[e.name,": ",e.message]})}),a.jsxs($,{sx:{gap:4},children:[a.jsx(Mt,{leftIcon:a.jsx(Woe,{}),onClick:t,children:"Reset UI"}),a.jsx(Mt,{leftIcon:a.jsx(Lu,{}),onClick:r,children:"Copy Error"}),a.jsx(vg,{href:o,isExternal:!0,children:a.jsx(Mt,{leftIcon:a.jsx(Vy,{}),children:"Create Issue"})})]})]})})},rxe=d.memo(nxe),oxe=ce([we],({hotkeys:e})=>{const{shift:t,ctrl:n,meta:r}=e;return{shift:t,ctrl:n,meta:r}},{memoizeOptions:{resultEqualityCheck:Tn}}),sxe=()=>{const e=te(),{shift:t,ctrl:n,meta:r}=W(oxe),{queueBack:o,isDisabled:s,isLoading:i}=j8();It(["ctrl+enter","meta+enter"],o,{enabled:()=>!s&&!i,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[o,s,i]);const{queueFront:l,isDisabled:u,isLoading:p}=E8();return It(["ctrl+shift+enter","meta+shift+enter"],l,{enabled:()=>!u&&!p,preventDefault:!0,enableOnFormTags:["input","textarea","select"]},[l,u,p]),It("*",()=>{_m("shift")?!t&&e(Vo(!0)):t&&e(Vo(!1)),_m("ctrl")?!n&&e(mS(!0)):n&&e(mS(!1)),_m("meta")?!r&&e(hS(!0)):r&&e(hS(!1))},{keyup:!0,keydown:!0},[t,n,r]),It("1",()=>{e(ti("txt2img"))}),It("2",()=>{e(ti("img2img"))}),It("3",()=>{e(ti("unifiedCanvas"))}),It("4",()=>{e(ti("nodes"))}),It("5",()=>{e(ti("modelManager"))}),null},axe=d.memo(sxe),ixe=e=>{const t=te(),{recallAllParameters:n}=l0(),r=oc(),{currentData:o}=Ps((e==null?void 0:e.imageName)??Os.skipToken),{currentData:s}=WI((e==null?void 0:e.imageName)??Os.skipToken),i=d.useCallback(()=>{o&&(t(GI(o)),t(ti("unifiedCanvas")),r({title:AI("toast.sentToUnifiedCanvas"),status:"info",duration:2500,isClosable:!0}))},[t,r,o]),l=d.useCallback(()=>{o&&t(rg(o))},[t,o]),u=d.useCallback(()=>{s&&n(s.metadata)},[s]);return d.useEffect(()=>{e&&e.action==="sendToCanvas"&&i()},[e,i]),d.useEffect(()=>{e&&e.action==="sendToImg2Img"&&l()},[e,l]),d.useEffect(()=>{e&&e.action==="useAllParameters"&&u()},[e,u]),{handleSendToCanvas:i,handleSendToImg2Img:l,handleUseAllMetadata:u}},lxe=e=>(ixe(e.selectedImage),null),cxe=d.memo(lxe),uxe={},dxe=({config:e=uxe,selectedImage:t})=>{const n=W(nO),r=G5("system"),o=te(),s=d.useCallback(()=>(localStorage.clear(),location.reload(),!1),[]);d.useEffect(()=>{on.changeLanguage(n)},[n]),d.useEffect(()=>{oP(e)&&(r.info({config:e},"Received config"),o(i$(e)))},[o,e,r]),d.useEffect(()=>{o(l$())},[o]);const i=Lg(c$);return a.jsxs(q1e,{onReset:s,FallbackComponent:rxe,children:[a.jsx(tl,{w:"100vw",h:"100vh",position:"relative",overflow:"hidden",children:a.jsx(PG,{children:a.jsxs(tl,{sx:{gap:4,p:4,gridAutoRows:"min-content auto",w:"full",h:"full"},children:[i||a.jsx(rte,{}),a.jsx($,{sx:{gap:4,w:"full",h:"full"},children:a.jsx(U1e,{})})]})})}),a.jsx(VZ,{}),a.jsx(FZ,{}),a.jsx(vU,{}),a.jsx(axe,{}),a.jsx(cxe,{selectedImage:t})]})},vxe=d.memo(dxe);export{vxe as default}; diff --git a/invokeai/frontend/web/dist/assets/MantineProvider-17a58e64.js b/invokeai/frontend/web/dist/assets/MantineProvider-17a58e64.js new file mode 100644 index 0000000000..6e41062cba --- /dev/null +++ b/invokeai/frontend/web/dist/assets/MantineProvider-17a58e64.js @@ -0,0 +1 @@ +import{aa as d,ia as _,v as h,im as X}from"./index-54a1ea80.js";const Y={dark:["#C1C2C5","#A6A7AB","#909296","#5c5f66","#373A40","#2C2E33","#25262b","#1A1B1E","#141517","#101113"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]};function q(r){return()=>({fontFamily:r.fontFamily||"sans-serif"})}var J=Object.defineProperty,x=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,z=(r,e,o)=>e in r?J(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,j=(r,e)=>{for(var o in e||(e={}))K.call(e,o)&&z(r,o,e[o]);if(x)for(var o of x(e))Q.call(e,o)&&z(r,o,e[o]);return r};function Z(r){return e=>({WebkitTapHighlightColor:"transparent",[e||"&:focus"]:j({},r.focusRing==="always"||r.focusRing==="auto"?r.focusRingStyles.styles(r):r.focusRingStyles.resetStyles(r)),[e?e.replace(":focus",":focus:not(:focus-visible)"):"&:focus:not(:focus-visible)"]:j({},r.focusRing==="auto"||r.focusRing==="never"?r.focusRingStyles.resetStyles(r):null)})}function y(r){return e=>typeof r.primaryShade=="number"?r.primaryShade:r.primaryShade[e||r.colorScheme]}function w(r){const e=y(r);return(o,n,a=!0,t=!0)=>{if(typeof o=="string"&&o.includes(".")){const[s,l]=o.split("."),g=parseInt(l,10);if(s in r.colors&&g>=0&&g<10)return r.colors[s][typeof n=="number"&&!t?n:g]}const i=typeof n=="number"?n:e();return o in r.colors?r.colors[o][i]:a?r.colors[r.primaryColor][i]:o}}function T(r){let e="";for(let o=1;o{const a={from:(n==null?void 0:n.from)||r.defaultGradient.from,to:(n==null?void 0:n.to)||r.defaultGradient.to,deg:(n==null?void 0:n.deg)||r.defaultGradient.deg};return`linear-gradient(${a.deg}deg, ${e(a.from,o(),!1)} 0%, ${e(a.to,o(),!1)} 100%)`}}function D(r){return e=>{if(typeof e=="number")return`${e/16}${r}`;if(typeof e=="string"){const o=e.replace("px","");if(!Number.isNaN(Number(o)))return`${Number(o)/16}${r}`}return e}}const u=D("rem"),k=D("em");function V({size:r,sizes:e,units:o}){return r in e?e[r]:typeof r=="number"?o==="em"?k(r):u(r):r||e.md}function S(r){return typeof r=="number"?r:typeof r=="string"&&r.includes("rem")?Number(r.replace("rem",""))*16:typeof r=="string"&&r.includes("em")?Number(r.replace("em",""))*16:Number(r)}function er(r){return e=>`@media (min-width: ${k(S(V({size:e,sizes:r.breakpoints})))})`}function or(r){return e=>`@media (max-width: ${k(S(V({size:e,sizes:r.breakpoints}))-1)})`}function nr(r){return/^#?([0-9A-F]{3}){1,2}$/i.test(r)}function tr(r){let e=r.replace("#","");if(e.length===3){const i=e.split("");e=[i[0],i[0],i[1],i[1],i[2],i[2]].join("")}const o=parseInt(e,16),n=o>>16&255,a=o>>8&255,t=o&255;return{r:n,g:a,b:t,a:1}}function ar(r){const[e,o,n,a]=r.replace(/[^0-9,.]/g,"").split(",").map(Number);return{r:e,g:o,b:n,a:a||1}}function C(r){return nr(r)?tr(r):r.startsWith("rgb")?ar(r):{r:0,g:0,b:0,a:1}}function p(r,e){if(typeof r!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(r.startsWith("var(--"))return r;const{r:o,g:n,b:a}=C(r);return`rgba(${o}, ${n}, ${a}, ${e})`}function ir(r=0){return{position:"absolute",top:u(r),right:u(r),left:u(r),bottom:u(r)}}function sr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=1-e,s=l=>Math.round(l*i);return`rgba(${s(o)}, ${s(n)}, ${s(a)}, ${t})`}function lr(r,e){if(typeof r=="string"&&r.startsWith("var(--"))return r;const{r:o,g:n,b:a,a:t}=C(r),i=s=>Math.round(s+(255-s)*e);return`rgba(${i(o)}, ${i(n)}, ${i(a)}, ${t})`}function fr(r){return e=>{if(typeof e=="number")return u(e);const o=typeof r.defaultRadius=="number"?r.defaultRadius:r.radius[r.defaultRadius]||r.defaultRadius;return r.radius[e]||e||o}}function cr(r,e){if(typeof r=="string"&&r.includes(".")){const[o,n]=r.split("."),a=parseInt(n,10);if(o in e.colors&&a>=0&&a<10)return{isSplittedColor:!0,key:o,shade:a}}return{isSplittedColor:!1}}function dr(r){const e=w(r),o=y(r),n=G(r);return({variant:a,color:t,gradient:i,primaryFallback:s})=>{const l=cr(t,r);switch(a){case"light":return{border:"transparent",background:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1),color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?7:1,s,!1),r.colorScheme==="dark"?.25:.65)};case"subtle":return{border:"transparent",background:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),hover:p(e(t,r.colorScheme==="dark"?8:0,s,!1),r.colorScheme==="dark"?.2:1)};case"outline":return{border:e(t,r.colorScheme==="dark"?5:o("light")),background:"transparent",color:e(t,r.colorScheme==="dark"?5:o("light")),hover:r.colorScheme==="dark"?p(e(t,5,s,!1),.05):p(e(t,0,s,!1),.35)};case"default":return{border:r.colorScheme==="dark"?r.colors.dark[4]:r.colors.gray[4],background:r.colorScheme==="dark"?r.colors.dark[6]:r.white,color:r.colorScheme==="dark"?r.white:r.black,hover:r.colorScheme==="dark"?r.colors.dark[5]:r.colors.gray[0]};case"white":return{border:"transparent",background:r.white,color:e(t,o()),hover:null};case"transparent":return{border:"transparent",color:t==="dark"?r.colorScheme==="dark"?r.colors.dark[0]:r.colors.dark[9]:e(t,r.colorScheme==="dark"?2:o("light")),background:"transparent",hover:null};case"gradient":return{background:n(i),color:r.white,border:"transparent",hover:null};default:{const g=o(),$=l.isSplittedColor?l.shade:g,O=l.isSplittedColor?l.key:t;return{border:"transparent",background:e(O,$,s),color:r.white,hover:e(O,$===9?8:$+1)}}}}}function ur(r){return e=>{const o=y(r)(e);return r.colors[r.primaryColor][o]}}function pr(r){return{"@media (hover: hover)":{"&:hover":r},"@media (hover: none)":{"&:active":r}}}function gr(r){return()=>({userSelect:"none",color:r.colorScheme==="dark"?r.colors.dark[3]:r.colors.gray[5]})}function br(r){return()=>r.colorScheme==="dark"?r.colors.dark[2]:r.colors.gray[6]}const f={fontStyles:q,themeColor:w,focusStyles:Z,linearGradient:B,radialGradient:rr,smallerThan:or,largerThan:er,rgba:p,cover:ir,darken:sr,lighten:lr,radius:fr,variant:dr,primaryShade:y,hover:pr,gradient:G,primaryColor:ur,placeholderStyles:gr,dimmed:br};var mr=Object.defineProperty,yr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,vr=Object.prototype.hasOwnProperty,_r=Object.prototype.propertyIsEnumerable,F=(r,e,o)=>e in r?mr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,hr=(r,e)=>{for(var o in e||(e={}))vr.call(e,o)&&F(r,o,e[o]);if(R)for(var o of R(e))_r.call(e,o)&&F(r,o,e[o]);return r},kr=(r,e)=>yr(r,Sr(e));function U(r){return kr(hr({},r),{fn:{fontStyles:f.fontStyles(r),themeColor:f.themeColor(r),focusStyles:f.focusStyles(r),largerThan:f.largerThan(r),smallerThan:f.smallerThan(r),radialGradient:f.radialGradient,linearGradient:f.linearGradient,gradient:f.gradient(r),rgba:f.rgba,cover:f.cover,lighten:f.lighten,darken:f.darken,primaryShade:f.primaryShade(r),radius:f.radius(r),variant:f.variant(r),hover:f.hover,primaryColor:f.primaryColor(r),placeholderStyles:f.placeholderStyles(r),dimmed:f.dimmed(r)}})}const $r={dir:"ltr",primaryShade:{light:6,dark:8},focusRing:"auto",loader:"oval",colorScheme:"light",white:"#fff",black:"#000",defaultRadius:"sm",transitionTimingFunction:"ease",colors:Y,lineHeight:1.55,fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",primaryColor:"blue",respectReducedMotion:!0,cursorType:"default",defaultGradient:{from:"indigo",to:"cyan",deg:45},shadows:{xs:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.1)",sm:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 0.625rem 0.9375rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.4375rem 0.4375rem -0.3125rem",md:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.25rem 1.5625rem -0.3125rem, rgba(0, 0, 0, 0.04) 0 0.625rem 0.625rem -0.3125rem",lg:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 1.75rem 1.4375rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 0.75rem 0.75rem -0.4375rem",xl:"0 0.0625rem 0.1875rem rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 2.25rem 1.75rem -0.4375rem, rgba(0, 0, 0, 0.04) 0 1.0625rem 1.0625rem -0.4375rem"},fontSizes:{xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem"},radius:{xs:"0.125rem",sm:"0.25rem",md:"0.5rem",lg:"1rem",xl:"2rem"},spacing:{xs:"0.625rem",sm:"0.75rem",md:"1rem",lg:"1.25rem",xl:"1.5rem"},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},headings:{fontFamily:"-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",fontWeight:700,sizes:{h1:{fontSize:"2.125rem",lineHeight:1.3,fontWeight:void 0},h2:{fontSize:"1.625rem",lineHeight:1.35,fontWeight:void 0},h3:{fontSize:"1.375rem",lineHeight:1.4,fontWeight:void 0},h4:{fontSize:"1.125rem",lineHeight:1.45,fontWeight:void 0},h5:{fontSize:"1rem",lineHeight:1.5,fontWeight:void 0},h6:{fontSize:"0.875rem",lineHeight:1.5,fontWeight:void 0}}},other:{},components:{},activeStyles:{transform:"translateY(0.0625rem)"},datesLocale:"en",globalStyles:void 0,focusRingStyles:{styles:r=>({outlineOffset:"0.125rem",outline:`0.125rem solid ${r.colors[r.primaryColor][r.colorScheme==="dark"?7:5]}`}),resetStyles:()=>({outline:"none"}),inputStyles:r=>({outline:"none",borderColor:r.colors[r.primaryColor][typeof r.primaryShade=="object"?r.primaryShade[r.colorScheme]:r.primaryShade]})}},E=U($r);var Pr=Object.defineProperty,wr=Object.defineProperties,Cr=Object.getOwnPropertyDescriptors,H=Object.getOwnPropertySymbols,Er=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,M=(r,e,o)=>e in r?Pr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,xr=(r,e)=>{for(var o in e||(e={}))Er.call(e,o)&&M(r,o,e[o]);if(H)for(var o of H(e))Or.call(e,o)&&M(r,o,e[o]);return r},zr=(r,e)=>wr(r,Cr(e));function jr({theme:r}){return d.createElement(_,{styles:{"*, *::before, *::after":{boxSizing:"border-box"},html:{colorScheme:r.colorScheme==="dark"?"dark":"light"},body:zr(xr({},r.fn.fontStyles()),{backgroundColor:r.colorScheme==="dark"?r.colors.dark[7]:r.white,color:r.colorScheme==="dark"?r.colors.dark[0]:r.black,lineHeight:r.lineHeight,fontSize:r.fontSizes.md,WebkitFontSmoothing:"antialiased",MozOsxFontSmoothing:"grayscale"})}})}function b(r,e,o,n=u){Object.keys(e).forEach(a=>{r[`--mantine-${o}-${a}`]=n(e[a])})}function Rr({theme:r}){const e={"--mantine-color-white":r.white,"--mantine-color-black":r.black,"--mantine-transition-timing-function":r.transitionTimingFunction,"--mantine-line-height":`${r.lineHeight}`,"--mantine-font-family":r.fontFamily,"--mantine-font-family-monospace":r.fontFamilyMonospace,"--mantine-font-family-headings":r.headings.fontFamily,"--mantine-heading-font-weight":`${r.headings.fontWeight}`};b(e,r.shadows,"shadow"),b(e,r.fontSizes,"font-size"),b(e,r.radius,"radius"),b(e,r.spacing,"spacing"),b(e,r.breakpoints,"breakpoints",k),Object.keys(r.colors).forEach(n=>{r.colors[n].forEach((a,t)=>{e[`--mantine-color-${n}-${t}`]=a})});const o=r.headings.sizes;return Object.keys(o).forEach(n=>{e[`--mantine-${n}-font-size`]=o[n].fontSize,e[`--mantine-${n}-line-height`]=`${o[n].lineHeight}`}),d.createElement(_,{styles:{":root":e}})}var Fr=Object.defineProperty,Hr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,I=Object.getOwnPropertySymbols,Ir=Object.prototype.hasOwnProperty,Ar=Object.prototype.propertyIsEnumerable,A=(r,e,o)=>e in r?Fr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,c=(r,e)=>{for(var o in e||(e={}))Ir.call(e,o)&&A(r,o,e[o]);if(I)for(var o of I(e))Ar.call(e,o)&&A(r,o,e[o]);return r},P=(r,e)=>Hr(r,Mr(e));function Nr(r,e){var o;if(!e)return r;const n=Object.keys(r).reduce((a,t)=>{if(t==="headings"&&e.headings){const i=e.headings.sizes?Object.keys(r.headings.sizes).reduce((s,l)=>(s[l]=c(c({},r.headings.sizes[l]),e.headings.sizes[l]),s),{}):r.headings.sizes;return P(c({},a),{headings:P(c(c({},r.headings),e.headings),{sizes:i})})}if(t==="breakpoints"&&e.breakpoints){const i=c(c({},r.breakpoints),e.breakpoints);return P(c({},a),{breakpoints:Object.fromEntries(Object.entries(i).sort((s,l)=>S(s[1])-S(l[1])))})}return a[t]=typeof e[t]=="object"?c(c({},r[t]),e[t]):typeof e[t]=="number"||typeof e[t]=="boolean"||typeof e[t]=="function"?e[t]:e[t]||r[t],a},{});if(e!=null&&e.fontFamily&&!((o=e==null?void 0:e.headings)!=null&&o.fontFamily)&&(n.headings.fontFamily=e.fontFamily),!(n.primaryColor in n.colors))throw new Error("MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color");return n}function Wr(r,e){return U(Nr(r,e))}function Tr(r){return Object.keys(r).reduce((e,o)=>(r[o]!==void 0&&(e[o]=r[o]),e),{})}const Gr={html:{fontFamily:"sans-serif",lineHeight:"1.15",textSizeAdjust:"100%"},body:{margin:0},"article, aside, footer, header, nav, section, figcaption, figure, main":{display:"block"},h1:{fontSize:"2em"},hr:{boxSizing:"content-box",height:0,overflow:"visible"},pre:{fontFamily:"monospace, monospace",fontSize:"1em"},a:{background:"transparent",textDecorationSkip:"objects"},"a:active, a:hover":{outlineWidth:0},"abbr[title]":{borderBottom:"none",textDecoration:"underline"},"b, strong":{fontWeight:"bolder"},"code, kbp, samp":{fontFamily:"monospace, monospace",fontSize:"1em"},dfn:{fontStyle:"italic"},mark:{backgroundColor:"#ff0",color:"#000"},small:{fontSize:"80%"},"sub, sup":{fontSize:"75%",lineHeight:0,position:"relative",verticalAlign:"baseline"},sup:{top:"-0.5em"},sub:{bottom:"-0.25em"},"audio, video":{display:"inline-block"},"audio:not([controls])":{display:"none",height:0},img:{borderStyle:"none",verticalAlign:"middle"},"svg:not(:root)":{overflow:"hidden"},"button, input, optgroup, select, textarea":{fontFamily:"sans-serif",fontSize:"100%",lineHeight:"1.15",margin:0},"button, input":{overflow:"visible"},"button, select":{textTransform:"none"},"button, [type=reset], [type=submit]":{WebkitAppearance:"button"},"button::-moz-focus-inner, [type=button]::-moz-focus-inner, [type=reset]::-moz-focus-inner, [type=submit]::-moz-focus-inner":{borderStyle:"none",padding:0},"button:-moz-focusring, [type=button]:-moz-focusring, [type=reset]:-moz-focusring, [type=submit]:-moz-focusring":{outline:`${u(1)} dotted ButtonText`},legend:{boxSizing:"border-box",color:"inherit",display:"table",maxWidth:"100%",padding:0,whiteSpace:"normal"},progress:{display:"inline-block",verticalAlign:"baseline"},textarea:{overflow:"auto"},"[type=checkbox], [type=radio]":{boxSizing:"border-box",padding:0},"[type=number]::-webkit-inner-spin-button, [type=number]::-webkit-outer-spin-button":{height:"auto"},"[type=search]":{appearance:"none"},"[type=search]::-webkit-search-cancel-button, [type=search]::-webkit-search-decoration":{appearance:"none"},"::-webkit-file-upload-button":{appearance:"button",font:"inherit"},"details, menu":{display:"block"},summary:{display:"list-item"},canvas:{display:"inline-block"},template:{display:"none"}};function Dr(){return d.createElement(_,{styles:Gr})}var Vr=Object.defineProperty,N=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,W=(r,e,o)=>e in r?Vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o,m=(r,e)=>{for(var o in e||(e={}))Ur.call(e,o)&&W(r,o,e[o]);if(N)for(var o of N(e))Lr.call(e,o)&&W(r,o,e[o]);return r};const v=h.createContext({theme:E});function L(){var r;return((r=h.useContext(v))==null?void 0:r.theme)||E}function qr(r){const e=L(),o=n=>{var a,t,i,s;return{styles:((a=e.components[n])==null?void 0:a.styles)||{},classNames:((t=e.components[n])==null?void 0:t.classNames)||{},variants:(i=e.components[n])==null?void 0:i.variants,sizes:(s=e.components[n])==null?void 0:s.sizes}};return Array.isArray(r)?r.map(o):[o(r)]}function Jr(){var r;return(r=h.useContext(v))==null?void 0:r.emotionCache}function Kr(r,e,o){var n;const a=L(),t=(n=a.components[r])==null?void 0:n.defaultProps,i=typeof t=="function"?t(a):t;return m(m(m({},e),i),Tr(o))}function Xr({theme:r,emotionCache:e,withNormalizeCSS:o=!1,withGlobalStyles:n=!1,withCSSVariables:a=!1,inherit:t=!1,children:i}){const s=h.useContext(v),l=Wr(E,t?m(m({},s.theme),r):r);return d.createElement(X,{theme:l},d.createElement(v.Provider,{value:{theme:l,emotionCache:e}},o&&d.createElement(Dr,null),n&&d.createElement(jr,{theme:l}),a&&d.createElement(Rr,{theme:l}),typeof l.globalStyles=="function"&&d.createElement(_,{styles:l.globalStyles(l)}),i))}Xr.displayName="@mantine/core/MantineProvider";export{Xr as M,L as a,qr as b,V as c,Kr as d,Tr as f,S as g,u as r,Jr as u}; diff --git a/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-58d6b3b6.js b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-58d6b3b6.js new file mode 100644 index 0000000000..ec492be9d8 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/ThemeLocaleProvider-58d6b3b6.js @@ -0,0 +1,280 @@ +import{w as s,ia as T,v as l,a2 as I,ib as R,ae as V,ic as z,id as j,ie as D,ig as F,ih as G,ii as W,ij as K,aG as H,ik as U,il as Y}from"./index-54a1ea80.js";import{M as Z}from"./MantineProvider-17a58e64.js";var P=String.raw,E=P` + :root, + :host { + --chakra-vh: 100vh; + } + + @supports (height: -webkit-fill-available) { + :root, + :host { + --chakra-vh: -webkit-fill-available; + } + } + + @supports (height: -moz-fill-available) { + :root, + :host { + --chakra-vh: -moz-fill-available; + } + } + + @supports (height: 100dvh) { + :root, + :host { + --chakra-vh: 100dvh; + } + } +`,B=()=>s.jsx(T,{styles:E}),J=({scope:e=""})=>s.jsx(T,{styles:P` + html { + line-height: 1.5; + -webkit-text-size-adjust: 100%; + font-family: system-ui, sans-serif; + -webkit-font-smoothing: antialiased; + text-rendering: optimizeLegibility; + -moz-osx-font-smoothing: grayscale; + touch-action: manipulation; + } + + body { + position: relative; + min-height: 100%; + margin: 0; + font-feature-settings: "kern"; + } + + ${e} :where(*, *::before, *::after) { + border-width: 0; + border-style: solid; + box-sizing: border-box; + word-wrap: break-word; + } + + main { + display: block; + } + + ${e} hr { + border-top-width: 1px; + box-sizing: content-box; + height: 0; + overflow: visible; + } + + ${e} :where(pre, code, kbd,samp) { + font-family: SFMono-Regular, Menlo, Monaco, Consolas, monospace; + font-size: 1em; + } + + ${e} a { + background-color: transparent; + color: inherit; + text-decoration: inherit; + } + + ${e} abbr[title] { + border-bottom: none; + text-decoration: underline; + -webkit-text-decoration: underline dotted; + text-decoration: underline dotted; + } + + ${e} :where(b, strong) { + font-weight: bold; + } + + ${e} small { + font-size: 80%; + } + + ${e} :where(sub,sup) { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; + } + + ${e} sub { + bottom: -0.25em; + } + + ${e} sup { + top: -0.5em; + } + + ${e} img { + border-style: none; + } + + ${e} :where(button, input, optgroup, select, textarea) { + font-family: inherit; + font-size: 100%; + line-height: 1.15; + margin: 0; + } + + ${e} :where(button, input) { + overflow: visible; + } + + ${e} :where(button, select) { + text-transform: none; + } + + ${e} :where( + button::-moz-focus-inner, + [type="button"]::-moz-focus-inner, + [type="reset"]::-moz-focus-inner, + [type="submit"]::-moz-focus-inner + ) { + border-style: none; + padding: 0; + } + + ${e} fieldset { + padding: 0.35em 0.75em 0.625em; + } + + ${e} legend { + box-sizing: border-box; + color: inherit; + display: table; + max-width: 100%; + padding: 0; + white-space: normal; + } + + ${e} progress { + vertical-align: baseline; + } + + ${e} textarea { + overflow: auto; + } + + ${e} :where([type="checkbox"], [type="radio"]) { + box-sizing: border-box; + padding: 0; + } + + ${e} input[type="number"]::-webkit-inner-spin-button, + ${e} input[type="number"]::-webkit-outer-spin-button { + -webkit-appearance: none !important; + } + + ${e} input[type="number"] { + -moz-appearance: textfield; + } + + ${e} input[type="search"] { + -webkit-appearance: textfield; + outline-offset: -2px; + } + + ${e} input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none !important; + } + + ${e} ::-webkit-file-upload-button { + -webkit-appearance: button; + font: inherit; + } + + ${e} details { + display: block; + } + + ${e} summary { + display: list-item; + } + + template { + display: none; + } + + [hidden] { + display: none !important; + } + + ${e} :where( + blockquote, + dl, + dd, + h1, + h2, + h3, + h4, + h5, + h6, + hr, + figure, + p, + pre + ) { + margin: 0; + } + + ${e} button { + background: transparent; + padding: 0; + } + + ${e} fieldset { + margin: 0; + padding: 0; + } + + ${e} :where(ol, ul) { + margin: 0; + padding: 0; + } + + ${e} textarea { + resize: vertical; + } + + ${e} :where(button, [role="button"]) { + cursor: pointer; + } + + ${e} button::-moz-focus-inner { + border: 0 !important; + } + + ${e} table { + border-collapse: collapse; + } + + ${e} :where(h1, h2, h3, h4, h5, h6) { + font-size: inherit; + font-weight: inherit; + } + + ${e} :where(button, input, optgroup, select, textarea) { + padding: 0; + line-height: inherit; + color: inherit; + } + + ${e} :where(img, svg, video, canvas, audio, iframe, embed, object) { + display: block; + } + + ${e} :where(img, video) { + max-width: 100%; + height: auto; + } + + [data-js-focus-visible] + :focus:not([data-focus-visible-added]):not( + [data-focus-visible-disabled] + ) { + outline: none; + box-shadow: none; + } + + ${e} select::-ms-expand { + display: none; + } + + ${E} + `}),g={light:"chakra-ui-light",dark:"chakra-ui-dark"};function Q(e={}){const{preventTransition:o=!0}=e,n={setDataset:r=>{const t=o?n.preventTransition():void 0;document.documentElement.dataset.theme=r,document.documentElement.style.colorScheme=r,t==null||t()},setClassName(r){document.body.classList.add(r?g.dark:g.light),document.body.classList.remove(r?g.light:g.dark)},query(){return window.matchMedia("(prefers-color-scheme: dark)")},getSystemTheme(r){var t;return((t=n.query().matches)!=null?t:r==="dark")?"dark":"light"},addListener(r){const t=n.query(),i=a=>{r(a.matches?"dark":"light")};return typeof t.addListener=="function"?t.addListener(i):t.addEventListener("change",i),()=>{typeof t.removeListener=="function"?t.removeListener(i):t.removeEventListener("change",i)}},preventTransition(){const r=document.createElement("style");return r.appendChild(document.createTextNode("*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(r),()=>{window.getComputedStyle(document.body),requestAnimationFrame(()=>{requestAnimationFrame(()=>{document.head.removeChild(r)})})}}};return n}var X="chakra-ui-color-mode";function L(e){return{ssr:!1,type:"localStorage",get(o){if(!(globalThis!=null&&globalThis.document))return o;let n;try{n=localStorage.getItem(e)||o}catch{}return n||o},set(o){try{localStorage.setItem(e,o)}catch{}}}}var ee=L(X),M=()=>{};function S(e,o){return e.type==="cookie"&&e.ssr?e.get(o):o}function O(e){const{value:o,children:n,options:{useSystemColorMode:r,initialColorMode:t,disableTransitionOnChange:i}={},colorModeManager:a=ee}=e,d=t==="dark"?"dark":"light",[u,p]=l.useState(()=>S(a,d)),[y,b]=l.useState(()=>S(a)),{getSystemTheme:w,setClassName:k,setDataset:x,addListener:$}=l.useMemo(()=>Q({preventTransition:i}),[i]),v=t==="system"&&!u?y:u,c=l.useCallback(h=>{const f=h==="system"?w():h;p(f),k(f==="dark"),x(f),a.set(f)},[a,w,k,x]);I(()=>{t==="system"&&b(w())},[]),l.useEffect(()=>{const h=a.get();if(h){c(h);return}if(t==="system"){c("system");return}c(d)},[a,d,t,c]);const C=l.useCallback(()=>{c(v==="dark"?"light":"dark")},[v,c]);l.useEffect(()=>{if(r)return $(c)},[r,$,c]);const A=l.useMemo(()=>({colorMode:o??v,toggleColorMode:o?M:C,setColorMode:o?M:c,forced:o!==void 0}),[v,C,c,o]);return s.jsx(R.Provider,{value:A,children:n})}O.displayName="ColorModeProvider";var te=["borders","breakpoints","colors","components","config","direction","fonts","fontSizes","fontWeights","letterSpacings","lineHeights","radii","shadows","sizes","space","styles","transition","zIndices"];function re(e){return V(e)?te.every(o=>Object.prototype.hasOwnProperty.call(e,o)):!1}function m(e){return typeof e=="function"}function oe(...e){return o=>e.reduce((n,r)=>r(n),o)}var ne=e=>function(...n){let r=[...n],t=n[n.length-1];return re(t)&&r.length>1?r=r.slice(0,r.length-1):t=e,oe(...r.map(i=>a=>m(i)?i(a):ae(a,i)))(t)},ie=ne(j);function ae(...e){return z({},...e,_)}function _(e,o,n,r){if((m(e)||m(o))&&Object.prototype.hasOwnProperty.call(r,n))return(...t)=>{const i=m(e)?e(...t):e,a=m(o)?o(...t):o;return z({},i,a,_)}}var q=l.createContext({getDocument(){return document},getWindow(){return window}});q.displayName="EnvironmentContext";function N(e){const{children:o,environment:n,disabled:r}=e,t=l.useRef(null),i=l.useMemo(()=>n||{getDocument:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument)!=null?u:document},getWindow:()=>{var d,u;return(u=(d=t.current)==null?void 0:d.ownerDocument.defaultView)!=null?u:window}},[n]),a=!r||!n;return s.jsxs(q.Provider,{value:i,children:[o,a&&s.jsx("span",{id:"__chakra_env",hidden:!0,ref:t})]})}N.displayName="EnvironmentProvider";var se=e=>{const{children:o,colorModeManager:n,portalZIndex:r,resetScope:t,resetCSS:i=!0,theme:a={},environment:d,cssVarsRoot:u,disableEnvironment:p,disableGlobalStyle:y}=e,b=s.jsx(N,{environment:d,disabled:p,children:o});return s.jsx(D,{theme:a,cssVarsRoot:u,children:s.jsxs(O,{colorModeManager:n,options:a.config,children:[i?s.jsx(J,{scope:t}):s.jsx(B,{}),!y&&s.jsx(F,{}),r?s.jsx(G,{zIndex:r,children:b}):b]})})},le=e=>function({children:n,theme:r=e,toastOptions:t,...i}){return s.jsxs(se,{theme:r,...i,children:[s.jsx(W,{value:t==null?void 0:t.defaultOptions,children:n}),s.jsx(K,{...t})]})},de=le(j);const ue=()=>l.useMemo(()=>({colorScheme:"dark",fontFamily:"'Inter Variable', sans-serif",components:{ScrollArea:{defaultProps:{scrollbarSize:10},styles:{scrollbar:{"&:hover":{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}},thumb:{backgroundColor:"var(--invokeai-colors-baseAlpha-300)"}}}}}),[]),ce=L("@@invokeai-color-mode");function he({children:e}){const{i18n:o}=H(),n=o.dir(),r=l.useMemo(()=>ie({...U,direction:n}),[n]);l.useEffect(()=>{document.body.dir=n},[n]);const t=ue();return s.jsx(Z,{theme:t,children:s.jsx(de,{theme:r,colorModeManager:ce,toastOptions:Y,children:e})})}const ve=l.memo(he);export{ve as default}; diff --git a/invokeai/frontend/web/dist/assets/index-54a1ea80.js b/invokeai/frontend/web/dist/assets/index-54a1ea80.js new file mode 100644 index 0000000000..323dd14964 --- /dev/null +++ b/invokeai/frontend/web/dist/assets/index-54a1ea80.js @@ -0,0 +1,156 @@ +var jH=Object.defineProperty;var VH=(e,t,n)=>t in e?jH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var F2=(e,t,n)=>(VH(e,typeof t!="symbol"?t+"":t,n),n),B2=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)};var te=(e,t,n)=>(B2(e,t,"read from private field"),n?n.call(e):t.get(e)),Ut=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},Ii=(e,t,n,r)=>(B2(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);var Xf=(e,t,n,r)=>({set _(i){Ii(e,t,i,n)},get _(){return te(e,t,r)}}),Go=(e,t,n)=>(B2(e,t,"access private method"),n);function ZR(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Ve=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Nl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function UH(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var JR={exports:{}},fb={},eO={exports:{}},We={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Qg=Symbol.for("react.element"),GH=Symbol.for("react.portal"),HH=Symbol.for("react.fragment"),qH=Symbol.for("react.strict_mode"),WH=Symbol.for("react.profiler"),KH=Symbol.for("react.provider"),XH=Symbol.for("react.context"),QH=Symbol.for("react.forward_ref"),YH=Symbol.for("react.suspense"),ZH=Symbol.for("react.memo"),JH=Symbol.for("react.lazy"),BT=Symbol.iterator;function eq(e){return e===null||typeof e!="object"?null:(e=BT&&e[BT]||e["@@iterator"],typeof e=="function"?e:null)}var tO={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},nO=Object.assign,rO={};function Ef(e,t,n){this.props=e,this.context=t,this.refs=rO,this.updater=n||tO}Ef.prototype.isReactComponent={};Ef.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};Ef.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function iO(){}iO.prototype=Ef.prototype;function z3(e,t,n){this.props=e,this.context=t,this.refs=rO,this.updater=n||tO}var j3=z3.prototype=new iO;j3.constructor=z3;nO(j3,Ef.prototype);j3.isPureReactComponent=!0;var zT=Array.isArray,oO=Object.prototype.hasOwnProperty,V3={current:null},aO={key:!0,ref:!0,__self:!0,__source:!0};function sO(e,t,n){var r,i={},o=null,a=null;if(t!=null)for(r in t.ref!==void 0&&(a=t.ref),t.key!==void 0&&(o=""+t.key),t)oO.call(t,r)&&!aO.hasOwnProperty(r)&&(i[r]=t[r]);var s=arguments.length-2;if(s===1)i.children=n;else if(1>>1,V=O[z];if(0>>1;zi(Z,$))Ji(j,Z)?(O[z]=j,O[J]=$,z=J):(O[z]=Z,O[Q]=$,z=Q);else if(Ji(j,$))O[z]=j,O[J]=$,z=J;else break e}}return R}function i(O,R){var $=O.sortIndex-R.sortIndex;return $!==0?$:O.id-R.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var a=Date,s=a.now();e.unstable_now=function(){return a.now()-s}}var l=[],u=[],c=1,d=null,f=3,h=!1,p=!1,m=!1,_=typeof setTimeout=="function"?setTimeout:null,v=typeof clearTimeout=="function"?clearTimeout:null,y=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function g(O){for(var R=n(u);R!==null;){if(R.callback===null)r(u);else if(R.startTime<=O)r(u),R.sortIndex=R.expirationTime,t(l,R);else break;R=n(u)}}function b(O){if(m=!1,g(O),!p)if(n(l)!==null)p=!0,N(S);else{var R=n(u);R!==null&&L(b,R.startTime-O)}}function S(O,R){p=!1,m&&(m=!1,v(C),C=-1),h=!0;var $=f;try{for(g(R),d=n(l);d!==null&&(!(d.expirationTime>R)||O&&!k());){var z=d.callback;if(typeof z=="function"){d.callback=null,f=d.priorityLevel;var V=z(d.expirationTime<=R);R=e.unstable_now(),typeof V=="function"?d.callback=V:d===n(l)&&r(l),g(R)}else r(l);d=n(l)}if(d!==null)var H=!0;else{var Q=n(u);Q!==null&&L(b,Q.startTime-R),H=!1}return H}finally{d=null,f=$,h=!1}}var x=!1,w=null,C=-1,T=5,A=-1;function k(){return!(e.unstable_now()-AO||125z?(O.sortIndex=$,t(u,O),n(l)===null&&O===n(u)&&(m?(v(C),C=-1):m=!0,L(b,$-z))):(O.sortIndex=V,t(l,O),p||h||(p=!0,N(S))),O},e.unstable_shouldYield=k,e.unstable_wrapCallback=function(O){var R=f;return function(){var $=f;f=R;try{return O.apply(this,arguments)}finally{f=$}}}})(dO);cO.exports=dO;var dq=cO.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var fO=I,bi=dq;function re(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ww=Object.prototype.hasOwnProperty,fq=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,UT={},GT={};function hq(e){return Ww.call(GT,e)?!0:Ww.call(UT,e)?!1:fq.test(e)?GT[e]=!0:(UT[e]=!0,!1)}function pq(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function gq(e,t,n,r){if(t===null||typeof t>"u"||pq(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function Fr(e,t,n,r,i,o,a){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=a}var or={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){or[e]=new Fr(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];or[t]=new Fr(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){or[e]=new Fr(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){or[e]=new Fr(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){or[e]=new Fr(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){or[e]=new Fr(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){or[e]=new Fr(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){or[e]=new Fr(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){or[e]=new Fr(e,5,!1,e.toLowerCase(),null,!1,!1)});var G3=/[\-:]([a-z])/g;function H3(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(G3,H3);or[t]=new Fr(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(G3,H3);or[t]=new Fr(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(G3,H3);or[t]=new Fr(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){or[e]=new Fr(e,1,!1,e.toLowerCase(),null,!1,!1)});or.xlinkHref=new Fr("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){or[e]=new Fr(e,1,!1,e.toLowerCase(),null,!0,!0)});function q3(e,t,n,r){var i=or.hasOwnProperty(t)?or[t]:null;(i!==null?i.type!==0:r||!(2s||i[a]!==o[s]){var l=` +`+i[a].replace(" at new "," at ");return e.displayName&&l.includes("")&&(l=l.replace("",e.displayName)),l}while(1<=a&&0<=s);break}}}finally{V2=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?Ih(e):""}function mq(e){switch(e.tag){case 5:return Ih(e.type);case 16:return Ih("Lazy");case 13:return Ih("Suspense");case 19:return Ih("SuspenseList");case 0:case 2:case 15:return e=U2(e.type,!1),e;case 11:return e=U2(e.type.render,!1),e;case 1:return e=U2(e.type,!0),e;default:return""}}function Yw(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case qc:return"Fragment";case Hc:return"Portal";case Kw:return"Profiler";case W3:return"StrictMode";case Xw:return"Suspense";case Qw:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case gO:return(e.displayName||"Context")+".Consumer";case pO:return(e._context.displayName||"Context")+".Provider";case K3:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X3:return t=e.displayName||null,t!==null?t:Yw(e.type)||"Memo";case Vs:t=e._payload,e=e._init;try{return Yw(e(t))}catch{}}return null}function yq(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Yw(t);case 8:return t===W3?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function bl(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function yO(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function vq(e){var t=yO(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(a){r=""+a,o.call(this,a)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(a){r=""+a},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Qm(e){e._valueTracker||(e._valueTracker=vq(e))}function vO(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=yO(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function hv(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Zw(e,t){var n=t.checked;return en({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function qT(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=bl(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function bO(e,t){t=t.checked,t!=null&&q3(e,"checked",t,!1)}function Jw(e,t){bO(e,t);var n=bl(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?eC(e,t.type,n):t.hasOwnProperty("defaultValue")&&eC(e,t.type,bl(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function WT(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function eC(e,t,n){(t!=="number"||hv(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var Mh=Array.isArray;function md(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=Ym.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function wp(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Kh={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},bq=["Webkit","ms","Moz","O"];Object.keys(Kh).forEach(function(e){bq.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Kh[t]=Kh[e]})});function wO(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||Kh.hasOwnProperty(e)&&Kh[e]?(""+t).trim():t+"px"}function CO(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=wO(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var _q=en({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function rC(e,t){if(t){if(_q[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(re(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(re(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(re(61))}if(t.style!=null&&typeof t.style!="object")throw Error(re(62))}}function iC(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var oC=null;function Q3(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var aC=null,yd=null,vd=null;function QT(e){if(e=Jg(e)){if(typeof aC!="function")throw Error(re(280));var t=e.stateNode;t&&(t=yb(t),aC(e.stateNode,e.type,t))}}function EO(e){yd?vd?vd.push(e):vd=[e]:yd=e}function AO(){if(yd){var e=yd,t=vd;if(vd=yd=null,QT(e),t)for(e=0;e>>=0,e===0?32:31-(Mq(e)/Rq|0)|0}var Zm=64,Jm=4194304;function Rh(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function yv(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,a=n&268435455;if(a!==0){var s=a&~i;s!==0?r=Rh(s):(o&=a,o!==0&&(r=Rh(o)))}else a=n&~i,a!==0?r=Rh(a):o!==0&&(r=Rh(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Yg(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-To(t),e[t]=n}function Dq(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=Qh),oP=String.fromCharCode(32),aP=!1;function qO(e,t){switch(e){case"keyup":return cW.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function WO(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Wc=!1;function fW(e,t){switch(e){case"compositionend":return WO(t);case"keypress":return t.which!==32?null:(aP=!0,oP);case"textInput":return e=t.data,e===oP&&aP?null:e;default:return null}}function hW(e,t){if(Wc)return e==="compositionend"||!i4&&qO(e,t)?(e=GO(),wy=t4=tl=null,Wc=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=cP(n)}}function YO(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?YO(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ZO(){for(var e=window,t=hv();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=hv(e.document)}return t}function o4(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function xW(e){var t=ZO(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&YO(n.ownerDocument.documentElement,n)){if(r!==null&&o4(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=dP(n,o);var a=dP(n,r);i&&a&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==a.node||e.focusOffset!==a.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(a.node,a.offset)):(t.setEnd(a.node,a.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Kc=null,fC=null,Zh=null,hC=!1;function fP(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;hC||Kc==null||Kc!==hv(r)||(r=Kc,"selectionStart"in r&&o4(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Zh&&kp(Zh,r)||(Zh=r,r=_v(fC,"onSelect"),0Yc||(e.current=bC[Yc],bC[Yc]=null,Yc--)}function Pt(e,t){Yc++,bC[Yc]=e.current,e.current=t}var _l={},br=Ll(_l),Zr=Ll(!1),Vu=_l;function Yd(e,t){var n=e.type.contextTypes;if(!n)return _l;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jr(e){return e=e.childContextTypes,e!=null}function xv(){Bt(Zr),Bt(br)}function bP(e,t,n){if(br.current!==_l)throw Error(re(168));Pt(br,t),Pt(Zr,n)}function s7(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(re(108,yq(e)||"Unknown",i));return en({},n,r)}function wv(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||_l,Vu=br.current,Pt(br,e),Pt(Zr,Zr.current),!0}function _P(e,t,n){var r=e.stateNode;if(!r)throw Error(re(169));n?(e=s7(e,t,Vu),r.__reactInternalMemoizedMergedChildContext=e,Bt(Zr),Bt(br),Pt(br,e)):Bt(Zr),Pt(Zr,n)}var Va=null,vb=!1,rx=!1;function l7(e){Va===null?Va=[e]:Va.push(e)}function $W(e){vb=!0,l7(e)}function Fl(){if(!rx&&Va!==null){rx=!0;var e=0,t=gt;try{var n=Va;for(gt=1;e>=a,i-=a,Qa=1<<32-To(t)+i|n<C?(T=w,w=null):T=w.sibling;var A=f(v,w,g[C],b);if(A===null){w===null&&(w=T);break}e&&w&&A.alternate===null&&t(v,w),y=o(A,y,C),x===null?S=A:x.sibling=A,x=A,w=T}if(C===g.length)return n(v,w),Ht&&uu(v,C),S;if(w===null){for(;CC?(T=w,w=null):T=w.sibling;var k=f(v,w,A.value,b);if(k===null){w===null&&(w=T);break}e&&w&&k.alternate===null&&t(v,w),y=o(k,y,C),x===null?S=k:x.sibling=k,x=k,w=T}if(A.done)return n(v,w),Ht&&uu(v,C),S;if(w===null){for(;!A.done;C++,A=g.next())A=d(v,A.value,b),A!==null&&(y=o(A,y,C),x===null?S=A:x.sibling=A,x=A);return Ht&&uu(v,C),S}for(w=r(v,w);!A.done;C++,A=g.next())A=h(w,v,C,A.value,b),A!==null&&(e&&A.alternate!==null&&w.delete(A.key===null?C:A.key),y=o(A,y,C),x===null?S=A:x.sibling=A,x=A);return e&&w.forEach(function(D){return t(v,D)}),Ht&&uu(v,C),S}function _(v,y,g,b){if(typeof g=="object"&&g!==null&&g.type===qc&&g.key===null&&(g=g.props.children),typeof g=="object"&&g!==null){switch(g.$$typeof){case Xm:e:{for(var S=g.key,x=y;x!==null;){if(x.key===S){if(S=g.type,S===qc){if(x.tag===7){n(v,x.sibling),y=i(x,g.props.children),y.return=v,v=y;break e}}else if(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===Vs&&TP(S)===x.type){n(v,x.sibling),y=i(x,g.props),y.ref=th(v,x,g),y.return=v,v=y;break e}n(v,x);break}else t(v,x);x=x.sibling}g.type===qc?(y=Ru(g.props.children,v.mode,b,g.key),y.return=v,v=y):(b=My(g.type,g.key,g.props,null,v.mode,b),b.ref=th(v,y,g),b.return=v,v=b)}return a(v);case Hc:e:{for(x=g.key;y!==null;){if(y.key===x)if(y.tag===4&&y.stateNode.containerInfo===g.containerInfo&&y.stateNode.implementation===g.implementation){n(v,y.sibling),y=i(y,g.children||[]),y.return=v,v=y;break e}else{n(v,y);break}else t(v,y);y=y.sibling}y=dx(g,v.mode,b),y.return=v,v=y}return a(v);case Vs:return x=g._init,_(v,y,x(g._payload),b)}if(Mh(g))return p(v,y,g,b);if(Qf(g))return m(v,y,g,b);a0(v,g)}return typeof g=="string"&&g!==""||typeof g=="number"?(g=""+g,y!==null&&y.tag===6?(n(v,y.sibling),y=i(y,g),y.return=v,v=y):(n(v,y),y=cx(g,v.mode,b),y.return=v,v=y),a(v)):n(v,y)}return _}var Jd=m7(!0),y7=m7(!1),em={},fa=Ll(em),Op=Ll(em),$p=Ll(em);function wu(e){if(e===em)throw Error(re(174));return e}function p4(e,t){switch(Pt($p,t),Pt(Op,e),Pt(fa,em),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:nC(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=nC(t,e)}Bt(fa),Pt(fa,t)}function ef(){Bt(fa),Bt(Op),Bt($p)}function v7(e){wu($p.current);var t=wu(fa.current),n=nC(t,e.type);t!==n&&(Pt(Op,e),Pt(fa,n))}function g4(e){Op.current===e&&(Bt(fa),Bt(Op))}var Yt=Ll(0);function kv(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ix=[];function m4(){for(var e=0;en?n:4,e(!0);var r=ox.transition;ox.transition={};try{e(!1),t()}finally{gt=n,ox.transition=r}}function $7(){return Wi().memoizedState}function FW(e,t,n){var r=fl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},N7(e))D7(t,n);else if(n=f7(e,t,n,r),n!==null){var i=Or();Po(n,e,r,i),L7(n,t,r)}}function BW(e,t,n){var r=fl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(N7(e))D7(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var a=t.lastRenderedState,s=o(a,n);if(i.hasEagerState=!0,i.eagerState=s,Oo(s,a)){var l=t.interleaved;l===null?(i.next=i,f4(t)):(i.next=l.next,l.next=i),t.interleaved=i;return}}catch{}finally{}n=f7(e,t,i,r),n!==null&&(i=Or(),Po(n,e,r,i),L7(n,t,r))}}function N7(e){var t=e.alternate;return e===Jt||t!==null&&t===Jt}function D7(e,t){Jh=Iv=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function L7(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Z3(e,n)}}var Mv={readContext:qi,useCallback:ur,useContext:ur,useEffect:ur,useImperativeHandle:ur,useInsertionEffect:ur,useLayoutEffect:ur,useMemo:ur,useReducer:ur,useRef:ur,useState:ur,useDebugValue:ur,useDeferredValue:ur,useTransition:ur,useMutableSource:ur,useSyncExternalStore:ur,useId:ur,unstable_isNewReconciler:!1},zW={readContext:qi,useCallback:function(e,t){return Ko().memoizedState=[e,t===void 0?null:t],e},useContext:qi,useEffect:kP,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ty(4194308,4,k7.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ty(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ty(4,2,e,t)},useMemo:function(e,t){var n=Ko();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=Ko();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=FW.bind(null,Jt,e),[r.memoizedState,e]},useRef:function(e){var t=Ko();return e={current:e},t.memoizedState=e},useState:PP,useDebugValue:S4,useDeferredValue:function(e){return Ko().memoizedState=e},useTransition:function(){var e=PP(!1),t=e[0];return e=LW.bind(null,e[1]),Ko().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Jt,i=Ko();if(Ht){if(n===void 0)throw Error(re(407));n=n()}else{if(n=t(),Vn===null)throw Error(re(349));Gu&30||S7(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,kP(w7.bind(null,r,o,e),[e]),r.flags|=2048,Lp(9,x7.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=Ko(),t=Vn.identifierPrefix;if(Ht){var n=Ya,r=Qa;n=(r&~(1<<32-To(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Np++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=a.createElement(n,{is:r.is}):(e=a.createElement(n),n==="select"&&(a=e,r.multiple?a.multiple=!0:r.size&&(a.size=r.size))):e=a.createElementNS(e,n),e[ra]=t,e[Rp]=r,q7(e,t,!1,!1),t.stateNode=e;e:{switch(a=iC(n,r),n){case"dialog":Rt("cancel",e),Rt("close",e),i=r;break;case"iframe":case"object":case"embed":Rt("load",e),i=r;break;case"video":case"audio":for(i=0;inf&&(t.flags|=128,r=!0,nh(o,!1),t.lanes=4194304)}else{if(!r)if(e=kv(a),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),nh(o,!0),o.tail===null&&o.tailMode==="hidden"&&!a.alternate&&!Ht)return cr(t),null}else 2*pn()-o.renderingStartTime>nf&&n!==1073741824&&(t.flags|=128,r=!0,nh(o,!1),t.lanes=4194304);o.isBackwards?(a.sibling=t.child,t.child=a):(n=o.last,n!==null?n.sibling=a:t.child=a,o.last=a)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=pn(),t.sibling=null,n=Yt.current,Pt(Yt,r?n&1|2:n&1),t):(cr(t),null);case 22:case 23:return T4(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?ci&1073741824&&(cr(t),t.subtreeFlags&6&&(t.flags|=8192)):cr(t),null;case 24:return null;case 25:return null}throw Error(re(156,t.tag))}function KW(e,t){switch(s4(t),t.tag){case 1:return Jr(t.type)&&xv(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return ef(),Bt(Zr),Bt(br),m4(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return g4(t),null;case 13:if(Bt(Yt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(re(340));Zd()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Bt(Yt),null;case 4:return ef(),null;case 10:return d4(t.type._context),null;case 22:case 23:return T4(),null;case 24:return null;default:return null}}var l0=!1,mr=!1,XW=typeof WeakSet=="function"?WeakSet:Set,_e=null;function td(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){an(e,t,r)}else n.current=null}function MC(e,t,n){try{n()}catch(r){an(e,t,r)}}var FP=!1;function QW(e,t){if(pC=vv,e=ZO(),o4(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var a=0,s=-1,l=-1,u=0,c=0,d=e,f=null;t:for(;;){for(var h;d!==n||i!==0&&d.nodeType!==3||(s=a+i),d!==o||r!==0&&d.nodeType!==3||(l=a+r),d.nodeType===3&&(a+=d.nodeValue.length),(h=d.firstChild)!==null;)f=d,d=h;for(;;){if(d===e)break t;if(f===n&&++u===i&&(s=a),f===o&&++c===r&&(l=a),(h=d.nextSibling)!==null)break;d=f,f=d.parentNode}d=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(gC={focusedElem:e,selectionRange:n},vv=!1,_e=t;_e!==null;)if(t=_e,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,_e=e;else for(;_e!==null;){t=_e;try{var p=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var m=p.memoizedProps,_=p.memoizedState,v=t.stateNode,y=v.getSnapshotBeforeUpdate(t.elementType===t.type?m:go(t.type,m),_);v.__reactInternalSnapshotBeforeUpdate=y}break;case 3:var g=t.stateNode.containerInfo;g.nodeType===1?g.textContent="":g.nodeType===9&&g.documentElement&&g.removeChild(g.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(re(163))}}catch(b){an(t,t.return,b)}if(e=t.sibling,e!==null){e.return=t.return,_e=e;break}_e=t.return}return p=FP,FP=!1,p}function ep(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&MC(t,n,o)}i=i.next}while(i!==r)}}function Sb(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function RC(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function X7(e){var t=e.alternate;t!==null&&(e.alternate=null,X7(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ra],delete t[Rp],delete t[vC],delete t[RW],delete t[OW])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Q7(e){return e.tag===5||e.tag===3||e.tag===4}function BP(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Q7(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function OC(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Sv));else if(r!==4&&(e=e.child,e!==null))for(OC(e,t,n),e=e.sibling;e!==null;)OC(e,t,n),e=e.sibling}function $C(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for($C(e,t,n),e=e.sibling;e!==null;)$C(e,t,n),e=e.sibling}var Zn=null,yo=!1;function Rs(e,t,n){for(n=n.child;n!==null;)Y7(e,t,n),n=n.sibling}function Y7(e,t,n){if(da&&typeof da.onCommitFiberUnmount=="function")try{da.onCommitFiberUnmount(hb,n)}catch{}switch(n.tag){case 5:mr||td(n,t);case 6:var r=Zn,i=yo;Zn=null,Rs(e,t,n),Zn=r,yo=i,Zn!==null&&(yo?(e=Zn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Zn.removeChild(n.stateNode));break;case 18:Zn!==null&&(yo?(e=Zn,n=n.stateNode,e.nodeType===8?nx(e.parentNode,n):e.nodeType===1&&nx(e,n),Tp(e)):nx(Zn,n.stateNode));break;case 4:r=Zn,i=yo,Zn=n.stateNode.containerInfo,yo=!0,Rs(e,t,n),Zn=r,yo=i;break;case 0:case 11:case 14:case 15:if(!mr&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,a=o.destroy;o=o.tag,a!==void 0&&(o&2||o&4)&&MC(n,t,a),i=i.next}while(i!==r)}Rs(e,t,n);break;case 1:if(!mr&&(td(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(s){an(n,t,s)}Rs(e,t,n);break;case 21:Rs(e,t,n);break;case 22:n.mode&1?(mr=(r=mr)||n.memoizedState!==null,Rs(e,t,n),mr=r):Rs(e,t,n);break;default:Rs(e,t,n)}}function zP(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new XW),t.forEach(function(r){var i=oK.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function co(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=a),r&=~o}if(r=i,r=pn()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*ZW(r/1960))-r,10e?16:e,nl===null)var r=!1;else{if(e=nl,nl=null,$v=0,rt&6)throw Error(re(331));var i=rt;for(rt|=4,_e=e.current;_e!==null;){var o=_e,a=o.child;if(_e.flags&16){var s=o.deletions;if(s!==null){for(var l=0;lpn()-E4?Mu(e,0):C4|=n),ei(e,t)}function o$(e,t){t===0&&(e.mode&1?(t=Jm,Jm<<=1,!(Jm&130023424)&&(Jm=4194304)):t=1);var n=Or();e=cs(e,t),e!==null&&(Yg(e,t,n),ei(e,n))}function iK(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),o$(e,n)}function oK(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(re(314))}r!==null&&r.delete(t),o$(e,n)}var a$;a$=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Zr.current)Xr=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Xr=!1,qW(e,t,n);Xr=!!(e.flags&131072)}else Xr=!1,Ht&&t.flags&1048576&&u7(t,Ev,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Py(e,t),e=t.pendingProps;var i=Yd(t,br.current);_d(t,n),i=v4(null,t,r,e,i,n);var o=b4();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jr(r)?(o=!0,wv(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,h4(t),i.updater=bb,t.stateNode=i,i._reactInternals=t,CC(t,r,e,n),t=TC(null,t,r,!0,o,n)):(t.tag=0,Ht&&o&&a4(t),Mr(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Py(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=sK(r),e=go(r,e),i){case 0:t=AC(null,t,r,e,n);break e;case 1:t=NP(null,t,r,e,n);break e;case 11:t=OP(null,t,r,e,n);break e;case 14:t=$P(null,t,r,go(r.type,e),n);break e}throw Error(re(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),AC(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),NP(e,t,r,i,n);case 3:e:{if(U7(t),e===null)throw Error(re(387));r=t.pendingProps,o=t.memoizedState,i=o.element,h7(e,t),Pv(t,r,null,n);var a=t.memoizedState;if(r=a.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:a.cache,pendingSuspenseBoundaries:a.pendingSuspenseBoundaries,transitions:a.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=tf(Error(re(423)),t),t=DP(e,t,r,n,i);break e}else if(r!==i){i=tf(Error(re(424)),t),t=DP(e,t,r,n,i);break e}else for(gi=ul(t.stateNode.containerInfo.firstChild),mi=t,Ht=!0,bo=null,n=y7(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Zd(),r===i){t=ds(e,t,n);break e}Mr(e,t,r,n)}t=t.child}return t;case 5:return v7(t),e===null&&SC(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,a=i.children,mC(r,i)?a=null:o!==null&&mC(r,o)&&(t.flags|=32),V7(e,t),Mr(e,t,a,n),t.child;case 6:return e===null&&SC(t),null;case 13:return G7(e,t,n);case 4:return p4(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Jd(t,null,r,n):Mr(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),OP(e,t,r,i,n);case 7:return Mr(e,t,t.pendingProps,n),t.child;case 8:return Mr(e,t,t.pendingProps.children,n),t.child;case 12:return Mr(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,a=i.value,Pt(Av,r._currentValue),r._currentValue=a,o!==null)if(Oo(o.value,a)){if(o.children===i.children&&!Zr.current){t=ds(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var s=o.dependencies;if(s!==null){a=o.child;for(var l=s.firstContext;l!==null;){if(l.context===r){if(o.tag===1){l=ts(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),xC(o.return,n,t),s.lanes|=n;break}l=l.next}}else if(o.tag===10)a=o.type===t.type?null:o.child;else if(o.tag===18){if(a=o.return,a===null)throw Error(re(341));a.lanes|=n,s=a.alternate,s!==null&&(s.lanes|=n),xC(a,n,t),a=o.sibling}else a=o.child;if(a!==null)a.return=o;else for(a=o;a!==null;){if(a===t){a=null;break}if(o=a.sibling,o!==null){o.return=a.return,a=o;break}a=a.return}o=a}Mr(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,_d(t,n),i=qi(i),r=r(i),t.flags|=1,Mr(e,t,r,n),t.child;case 14:return r=t.type,i=go(r,t.pendingProps),i=go(r.type,i),$P(e,t,r,i,n);case 15:return z7(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:go(r,i),Py(e,t),t.tag=1,Jr(r)?(e=!0,wv(t)):e=!1,_d(t,n),g7(t,r,i),CC(t,r,i,n),TC(null,t,r,!0,e,n);case 19:return H7(e,t,n);case 22:return j7(e,t,n)}throw Error(re(156,t.tag))};function s$(e,t){return OO(e,t)}function aK(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ui(e,t,n,r){return new aK(e,t,n,r)}function k4(e){return e=e.prototype,!(!e||!e.isReactComponent)}function sK(e){if(typeof e=="function")return k4(e)?1:0;if(e!=null){if(e=e.$$typeof,e===K3)return 11;if(e===X3)return 14}return 2}function hl(e,t){var n=e.alternate;return n===null?(n=Ui(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function My(e,t,n,r,i,o){var a=2;if(r=e,typeof e=="function")k4(e)&&(a=1);else if(typeof e=="string")a=5;else e:switch(e){case qc:return Ru(n.children,i,o,t);case W3:a=8,i|=8;break;case Kw:return e=Ui(12,n,t,i|2),e.elementType=Kw,e.lanes=o,e;case Xw:return e=Ui(13,n,t,i),e.elementType=Xw,e.lanes=o,e;case Qw:return e=Ui(19,n,t,i),e.elementType=Qw,e.lanes=o,e;case mO:return wb(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case pO:a=10;break e;case gO:a=9;break e;case K3:a=11;break e;case X3:a=14;break e;case Vs:a=16,r=null;break e}throw Error(re(130,e==null?e:typeof e,""))}return t=Ui(a,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function Ru(e,t,n,r){return e=Ui(7,e,r,t),e.lanes=n,e}function wb(e,t,n,r){return e=Ui(22,e,r,t),e.elementType=mO,e.lanes=n,e.stateNode={isHidden:!1},e}function cx(e,t,n){return e=Ui(6,e,null,t),e.lanes=n,e}function dx(e,t,n){return t=Ui(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function lK(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=H2(0),this.expirationTimes=H2(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=H2(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function I4(e,t,n,r,i,o,a,s,l){return e=new lK(e,t,n,s,l),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Ui(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},h4(o),e}function uK(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(d$)}catch(e){console.error(e)}}d$(),uO.exports=wi;var hi=uO.exports;const ODe=Nl(hi);var KP=hi;qw.createRoot=KP.createRoot,qw.hydrateRoot=KP.hydrateRoot;const pK="modulepreload",gK=function(e,t){return new URL(e,t).href},XP={},f$=function(t,n,r){if(!n||n.length===0)return t();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=gK(o,r),o in XP)return;XP[o]=!0;const a=o.endsWith(".css"),s=a?'[rel="stylesheet"]':"";if(!!r)for(let c=i.length-1;c>=0;c--){const d=i[c];if(d.href===o&&(!a||d.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${s}`))return;const u=document.createElement("link");if(u.rel=a?"stylesheet":pK,a||(u.as="script",u.crossOrigin=""),u.href=o,document.head.appendChild(u),a)return new Promise((c,d)=>{u.addEventListener("load",c),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>t()).catch(o=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o})};function jn(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r3?t.i-4:t.i:Array.isArray(e)?1:Pb(e)?2:kb(e)?3:0}function pl(e,t){return Sl(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function Ry(e,t){return Sl(e)===2?e.get(t):e[t]}function h$(e,t,n){var r=Sl(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function p$(e,t){return e===t?e!==0||1/e==1/t:e!=e&&t!=t}function Pb(e){return SK&&e instanceof Map}function kb(e){return xK&&e instanceof Set}function Dn(e){return e.o||e.t}function N4(e){if(Array.isArray(e))return Array.prototype.slice.call(e);var t=m$(e);delete t[De];for(var n=wd(t),r=0;r1&&(e.set=e.add=e.clear=e.delete=mK),Object.freeze(e),t&&fs(e,function(n,r){return tm(r,!0)},!0)),e}function mK(){jn(2)}function D4(e){return e==null||typeof e!="object"||Object.isFrozen(e)}function ha(e){var t=zC[e];return t||jn(18,e),t}function L4(e,t){zC[e]||(zC[e]=t)}function Bp(){return jp}function fx(e,t){t&&(ha("Patches"),e.u=[],e.s=[],e.v=t)}function Lv(e){BC(e),e.p.forEach(yK),e.p=null}function BC(e){e===jp&&(jp=e.l)}function QP(e){return jp={p:[],l:jp,h:e,m:!0,_:0}}function yK(e){var t=e[De];t.i===0||t.i===1?t.j():t.g=!0}function hx(e,t){t._=t.p.length;var n=t.p[0],r=e!==void 0&&e!==n;return t.h.O||ha("ES5").S(t,e,r),r?(n[De].P&&(Lv(t),jn(4)),ti(e)&&(e=Fv(t,e),t.l||Bv(t,e)),t.u&&ha("Patches").M(n[De].t,e,t.u,t.s)):e=Fv(t,n,[]),Lv(t),t.u&&t.v(t.u,t.s),e!==Mb?e:void 0}function Fv(e,t,n){if(D4(t))return t;var r=t[De];if(!r)return fs(t,function(s,l){return YP(e,r,t,s,l,n)},!0),t;if(r.A!==e)return t;if(!r.P)return Bv(e,r.t,!0),r.t;if(!r.I){r.I=!0,r.A._--;var i=r.i===4||r.i===5?r.o=N4(r.k):r.o,o=i,a=!1;r.i===3&&(o=new Set(i),i.clear(),a=!0),fs(o,function(s,l){return YP(e,r,i,s,l,n,a)}),Bv(e,i,!1),n&&e.u&&ha("Patches").N(r,n,e.u,e.s)}return r.o}function YP(e,t,n,r,i,o,a){if(Nr(i)){var s=Fv(e,i,o&&t&&t.i!==3&&!pl(t.R,r)?o.concat(r):void 0);if(h$(n,r,s),!Nr(s))return;e.m=!1}else a&&n.add(i);if(ti(i)&&!D4(i)){if(!e.h.D&&e._<1)return;Fv(e,i),t&&t.A.l||Bv(e,i)}}function Bv(e,t,n){n===void 0&&(n=!1),!e.l&&e.h.D&&e.m&&tm(t,n)}function px(e,t){var n=e[De];return(n?Dn(n):e)[t]}function ZP(e,t){if(t in e)for(var n=Object.getPrototypeOf(e);n;){var r=Object.getOwnPropertyDescriptor(n,t);if(r)return r;n=Object.getPrototypeOf(n)}}function Wr(e){e.P||(e.P=!0,e.l&&Wr(e.l))}function gx(e){e.o||(e.o=N4(e.t))}function zp(e,t,n){var r=Pb(t)?ha("MapSet").F(t,n):kb(t)?ha("MapSet").T(t,n):e.O?function(i,o){var a=Array.isArray(i),s={i:a?1:0,A:o?o.A:Bp(),P:!1,I:!1,R:{},l:o,t:i,k:null,o:null,j:null,C:!1},l=s,u=Vp;a&&(l=[s],u=$h);var c=Proxy.revocable(l,u),d=c.revoke,f=c.proxy;return s.k=f,s.j=d,f}(t,n):ha("ES5").J(t,n);return(n?n.A:Bp()).p.push(r),r}function Ib(e){return Nr(e)||jn(22,e),function t(n){if(!ti(n))return n;var r,i=n[De],o=Sl(n);if(i){if(!i.P&&(i.i<4||!ha("ES5").K(i)))return i.t;i.I=!0,r=JP(n,o),i.I=!1}else r=JP(n,o);return fs(r,function(a,s){i&&Ry(i.t,a)===s||h$(r,a,t(s))}),o===3?new Set(r):r}(e)}function JP(e,t){switch(t){case 2:return new Map(e);case 3:return Array.from(e)}return N4(e)}function F4(){function e(o,a){var s=i[o];return s?s.enumerable=a:i[o]=s={configurable:!0,enumerable:a,get:function(){var l=this[De];return Vp.get(l,o)},set:function(l){var u=this[De];Vp.set(u,o,l)}},s}function t(o){for(var a=o.length-1;a>=0;a--){var s=o[a][De];if(!s.P)switch(s.i){case 5:r(s)&&Wr(s);break;case 4:n(s)&&Wr(s)}}}function n(o){for(var a=o.t,s=o.k,l=wd(s),u=l.length-1;u>=0;u--){var c=l[u];if(c!==De){var d=a[c];if(d===void 0&&!pl(a,c))return!0;var f=s[c],h=f&&f[De];if(h?h.t!==d:!p$(f,d))return!0}}var p=!!a[De];return l.length!==wd(a).length+(p?0:1)}function r(o){var a=o.k;if(a.length!==o.t.length)return!0;var s=Object.getOwnPropertyDescriptor(a,a.length-1);if(s&&!s.get)return!0;for(var l=0;l1?v-1:0),g=1;g1?c-1:0),f=1;f=0;i--){var o=r[i];if(o.path.length===0&&o.op==="replace"){n=o.value;break}}i>-1&&(r=r.slice(i+1));var a=ha("Patches").$;return Nr(n)?a(n,r):this.produce(n,function(s){return a(s,r)})},e}(),_i=new y$,v$=_i.produce,j4=_i.produceWithPatches.bind(_i),CK=_i.setAutoFreeze.bind(_i),EK=_i.setUseProxies.bind(_i),jC=_i.applyPatches.bind(_i),AK=_i.createDraft.bind(_i),TK=_i.finishDraft.bind(_i);const Bl=v$,$De=Object.freeze(Object.defineProperty({__proto__:null,Immer:y$,applyPatches:jC,castDraft:bK,castImmutable:_K,createDraft:AK,current:Ib,default:Bl,enableAllPlugins:vK,enableES5:F4,enableMapSet:g$,enablePatches:B4,finishDraft:TK,freeze:tm,immerable:xd,isDraft:Nr,isDraftable:ti,nothing:Mb,original:$4,produce:v$,produceWithPatches:j4,setAutoFreeze:CK,setUseProxies:EK},Symbol.toStringTag,{value:"Module"}));function Up(e){"@babel/helpers - typeof";return Up=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Up(e)}function PK(e,t){if(Up(e)!=="object"||e===null)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Up(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function kK(e){var t=PK(e,"string");return Up(t)==="symbol"?t:String(t)}function IK(e,t,n){return t=kK(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function nk(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function rk(e){for(var t=1;t"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Jn(1));return n(nm)(e,t)}if(typeof e!="function")throw new Error(Jn(2));var i=e,o=t,a=[],s=a,l=!1;function u(){s===a&&(s=a.slice())}function c(){if(l)throw new Error(Jn(3));return o}function d(m){if(typeof m!="function")throw new Error(Jn(4));if(l)throw new Error(Jn(5));var _=!0;return u(),s.push(m),function(){if(_){if(l)throw new Error(Jn(6));_=!1,u();var y=s.indexOf(m);s.splice(y,1),a=null}}}function f(m){if(!MK(m))throw new Error(Jn(7));if(typeof m.type>"u")throw new Error(Jn(8));if(l)throw new Error(Jn(9));try{l=!0,o=i(o,m)}finally{l=!1}for(var _=a=s,v=0;v<_.length;v++){var y=_[v];y()}return m}function h(m){if(typeof m!="function")throw new Error(Jn(10));i=m,f({type:rf.REPLACE})}function p(){var m,_=d;return m={subscribe:function(y){if(typeof y!="object"||y===null)throw new Error(Jn(11));function g(){y.next&&y.next(c())}g();var b=_(g);return{unsubscribe:b}}},m[ik]=function(){return this},m}return f({type:rf.INIT}),r={dispatch:f,subscribe:d,getState:c,replaceReducer:h},r[ik]=p,r}var b$=nm;function RK(e){Object.keys(e).forEach(function(t){var n=e[t],r=n(void 0,{type:rf.INIT});if(typeof r>"u")throw new Error(Jn(12));if(typeof n(void 0,{type:rf.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(Jn(13))})}function Pf(e){for(var t=Object.keys(e),n={},r=0;r"u")throw u&&u.type,new Error(Jn(14));d[h]=_,c=c||_!==m}return c=c||o.length!==Object.keys(l).length,c?d:l}}function ok(e,t){return function(){return t(e.apply(this,arguments))}}function _$(e,t){if(typeof e=="function")return ok(e,t);if(typeof e!="object"||e===null)throw new Error(Jn(16));var n={};for(var r in e){var i=e[r];typeof i=="function"&&(n[r]=ok(i,t))}return n}function of(){for(var e=arguments.length,t=new Array(e),n=0;n-1){var u=n[l];return l>0&&(n.splice(l,1),n.unshift(u)),u.value}return zv}function i(s,l){r(s)===zv&&(n.unshift({key:s,value:l}),n.length>e&&n.pop())}function o(){return n}function a(){n=[]}return{get:r,put:i,getEntries:o,clear:a}}var S$=function(t,n){return t===n};function DK(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;for(var i=n.length,o=0;o1?t-1:0),r=1;r0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]",value:e};if(typeof e!="object"||e===null||o!=null&&o.has(e))return!1;for(var s=r!=null?r(e):Object.entries(e),l=i.length>0,u=function(_,v){var y=t?t+"."+_:_;if(l){var g=i.some(function(b){return b instanceof RegExp?b.test(y):y===b});if(g)return"continue"}if(!n(v))return{value:{keyPath:y,value:v}};if(typeof v=="object"&&(a=k$(v,y,n,r,i,o),a))return{value:a}},c=0,d=s;c-1}function ZK(e){return""+e}function $$(e){var t={},n=[],r,i={addCase:function(o,a){var s=typeof o=="string"?o:o.type;if(s in t)throw new Error("addCase cannot be called with two reducers for the same action type");return t[s]=a,i},addMatcher:function(o,a){return n.push({matcher:o,reducer:a}),i},addDefaultCase:function(o){return r=o,i}};return e(i),[t,n,r]}function JK(e){return typeof e=="function"}function N$(e,t,n,r){n===void 0&&(n=[]);var i=typeof t=="function"?$$(t):[t,n,r],o=i[0],a=i[1],s=i[2],l;if(JK(e))l=function(){return VC(e())};else{var u=VC(e);l=function(){return u}}function c(d,f){d===void 0&&(d=l());var h=xl([o[f.type]],a.filter(function(p){var m=p.matcher;return m(f)}).map(function(p){var m=p.reducer;return m}));return h.filter(function(p){return!!p}).length===0&&(h=[s]),h.reduce(function(p,m){if(m)if(Nr(p)){var _=p,v=m(_,f);return v===void 0?p:v}else{if(ti(p))return Bl(p,function(y){return m(y,f)});var v=m(p,f);if(v===void 0){if(p===null)return p;throw Error("A case reducer on a non-draftable value must not return undefined")}return v}return p},d)}return c.getInitialState=l,c}function eX(e,t){return e+"/"+t}function qt(e){var t=e.name;if(!t)throw new Error("`name` is a required option for createSlice");typeof process<"u";var n=typeof e.initialState=="function"?e.initialState:VC(e.initialState),r=e.reducers||{},i=Object.keys(r),o={},a={},s={};i.forEach(function(c){var d=r[c],f=eX(t,c),h,p;"reducer"in d?(h=d.reducer,p=d.prepare):h=d,o[c]=h,a[f]=h,s[c]=p?ve(f,p):ve(f)});function l(){var c=typeof e.extraReducers=="function"?$$(e.extraReducers):[e.extraReducers],d=c[0],f=d===void 0?{}:d,h=c[1],p=h===void 0?[]:h,m=c[2],_=m===void 0?void 0:m,v=Qr(Qr({},f),a);return N$(n,function(y){for(var g in v)y.addCase(g,v[g]);for(var b=0,S=p;b0;if(y){var g=p.filter(function(b){return u(_,b,m)}).length>0;g&&(m.ids=Object.keys(m.entities))}}function f(p,m){return h([p],m)}function h(p,m){var _=D$(p,e,m),v=_[0],y=_[1];d(y,m),n(v,m)}return{removeAll:iX(l),addOne:fn(t),addMany:fn(n),setOne:fn(r),setMany:fn(i),setAll:fn(o),updateOne:fn(c),updateMany:fn(d),upsertOne:fn(f),upsertMany:fn(h),removeOne:fn(a),removeMany:fn(s)}}function oX(e,t){var n=L$(e),r=n.removeOne,i=n.removeMany,o=n.removeAll;function a(y,g){return s([y],g)}function s(y,g){y=Ou(y);var b=y.filter(function(S){return!(rp(S,e)in g.entities)});b.length!==0&&_(b,g)}function l(y,g){return u([y],g)}function u(y,g){y=Ou(y),y.length!==0&&_(y,g)}function c(y,g){y=Ou(y),g.entities={},g.ids=[],s(y,g)}function d(y,g){return f([y],g)}function f(y,g){for(var b=!1,S=0,x=y;S-1;return n&&r}function om(e){return typeof e[0]=="function"&&"pending"in e[0]&&"fulfilled"in e[0]&&"rejected"in e[0]}function $b(){for(var e=[],t=0;t0)for(var g=h.getState(),b=Array.from(n.values()),S=0,x=b;SMath.floor(e/t)*t,fi=(e,t)=>Math.round(e/t)*t;var wX=typeof global=="object"&&global&&global.Object===Object&&global;const tN=wX;var CX=typeof self=="object"&&self&&self.Object===Object&&self,EX=tN||CX||Function("return this")();const Aa=EX;var AX=Aa.Symbol;const Ki=AX;var nN=Object.prototype,TX=nN.hasOwnProperty,PX=nN.toString,ih=Ki?Ki.toStringTag:void 0;function kX(e){var t=TX.call(e,ih),n=e[ih];try{e[ih]=void 0;var r=!0}catch{}var i=PX.call(e);return r&&(t?e[ih]=n:delete e[ih]),i}var IX=Object.prototype,MX=IX.toString;function RX(e){return MX.call(e)}var OX="[object Null]",$X="[object Undefined]",hk=Ki?Ki.toStringTag:void 0;function Bo(e){return e==null?e===void 0?$X:OX:hk&&hk in Object(e)?kX(e):RX(e)}function ni(e){return e!=null&&typeof e=="object"}var NX="[object Symbol]";function Nb(e){return typeof e=="symbol"||ni(e)&&Bo(e)==NX}function rN(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n0){if(++t>=pQ)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function vQ(e){return function(){return e}}var bQ=function(){try{var e=ac(Object,"defineProperty");return e({},"",{}),e}catch{}}();const qv=bQ;var _Q=qv?function(e,t){return qv(e,"toString",{configurable:!0,enumerable:!1,value:vQ(t),writable:!0})}:Db;const SQ=_Q;var xQ=yQ(SQ);const sN=xQ;function lN(e,t){for(var n=-1,r=e==null?0:e.length;++n-1}var PQ=9007199254740991,kQ=/^(?:0|[1-9]\d*)$/;function W4(e,t){var n=typeof e;return t=t??PQ,!!t&&(n=="number"||n!="symbol"&&kQ.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=RQ}function If(e){return e!=null&&K4(e.length)&&!q4(e)}function Fb(e,t,n){if(!ri(n))return!1;var r=typeof t;return(r=="number"?If(n)&&W4(t,n.length):r=="string"&&t in n)?um(n[t],e):!1}function fN(e){return dN(function(t,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&typeof o=="function"?(i--,o):void 0,a&&Fb(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=Object(t);++r-1}function WY(e,t){var n=this.__data__,r=zb(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}function _s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0&&n(s)?t>1?bN(s,t-1,n,r,i):eE(i,s):r||(i[i.length]=s)}return i}function cZ(e){var t=e==null?0:e.length;return t?bN(e,1):[]}function dZ(e){return sN(cN(e,void 0,cZ),e+"")}var fZ=yN(Object.getPrototypeOf,Object);const tE=fZ;var hZ="[object Object]",pZ=Function.prototype,gZ=Object.prototype,_N=pZ.toString,mZ=gZ.hasOwnProperty,yZ=_N.call(Object);function SN(e){if(!ni(e)||Bo(e)!=hZ)return!1;var t=tE(e);if(t===null)return!0;var n=mZ.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&_N.call(n)==yZ}function xN(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:xN(e,t,n)}var vZ="\\ud800-\\udfff",bZ="\\u0300-\\u036f",_Z="\\ufe20-\\ufe2f",SZ="\\u20d0-\\u20ff",xZ=bZ+_Z+SZ,wZ="\\ufe0e\\ufe0f",CZ="\\u200d",EZ=RegExp("["+CZ+vZ+xZ+wZ+"]");function Ub(e){return EZ.test(e)}function AZ(e){return e.split("")}var CN="\\ud800-\\udfff",TZ="\\u0300-\\u036f",PZ="\\ufe20-\\ufe2f",kZ="\\u20d0-\\u20ff",IZ=TZ+PZ+kZ,MZ="\\ufe0e\\ufe0f",RZ="["+CN+"]",qC="["+IZ+"]",WC="\\ud83c[\\udffb-\\udfff]",OZ="(?:"+qC+"|"+WC+")",EN="[^"+CN+"]",AN="(?:\\ud83c[\\udde6-\\uddff]){2}",TN="[\\ud800-\\udbff][\\udc00-\\udfff]",$Z="\\u200d",PN=OZ+"?",kN="["+MZ+"]?",NZ="(?:"+$Z+"(?:"+[EN,AN,TN].join("|")+")"+kN+PN+")*",DZ=kN+PN+NZ,LZ="(?:"+[EN+qC+"?",qC,AN,TN,RZ].join("|")+")",FZ=RegExp(WC+"(?="+WC+")|"+LZ+DZ,"g");function BZ(e){return e.match(FZ)||[]}function IN(e){return Ub(e)?BZ(e):AZ(e)}function zZ(e){return function(t){t=sf(t);var n=Ub(t)?IN(t):void 0,r=n?n[0]:t.charAt(0),i=n?wN(n,1).join(""):t.slice(1);return r[e]()+i}}var jZ=zZ("toUpperCase");const MN=jZ;function RN(e,t,n,r){var i=-1,o=e==null?0:e.length;for(r&&o&&(n=e[++i]);++i=t?e:t)),e}function rl(e,t,n){return n===void 0&&(n=t,t=void 0),n!==void 0&&(n=$y(n),n=n===n?n:0),t!==void 0&&(t=$y(t),t=t===t?t:0),MJ($y(e),t,n)}function RJ(){this.__data__=new _s,this.size=0}function OJ(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function $J(e){return this.__data__.get(e)}function NJ(e){return this.__data__.has(e)}var DJ=200;function LJ(e,t){var n=this.__data__;if(n instanceof _s){var r=n.__data__;if(!Wp||r.lengths))return!1;var u=o.get(e),c=o.get(t);if(u&&c)return u==t&&c==e;var d=-1,f=!0,h=n&vte?new Kp:void 0;for(o.set(e,t),o.set(t,e);++d1),o}),kf(e,YN(e),n),r&&(n=op(n,Nne|Dne|Lne,$ne));for(var i=t.length;i--;)One(n,t[i]);return n});const Mf=Fne;var Bne=uD("length");const zne=Bne;var fD="\\ud800-\\udfff",jne="\\u0300-\\u036f",Vne="\\ufe20-\\ufe2f",Une="\\u20d0-\\u20ff",Gne=jne+Vne+Une,Hne="\\ufe0e\\ufe0f",qne="["+fD+"]",JC="["+Gne+"]",e5="\\ud83c[\\udffb-\\udfff]",Wne="(?:"+JC+"|"+e5+")",hD="[^"+fD+"]",pD="(?:\\ud83c[\\udde6-\\uddff]){2}",gD="[\\ud800-\\udbff][\\udc00-\\udfff]",Kne="\\u200d",mD=Wne+"?",yD="["+Hne+"]?",Xne="(?:"+Kne+"(?:"+[hD,pD,gD].join("|")+")"+yD+mD+")*",Qne=yD+mD+Xne,Yne="(?:"+[hD+JC+"?",JC,pD,gD,qne].join("|")+")",Kk=RegExp(e5+"(?="+e5+")|"+Yne+Qne,"g");function Zne(e){for(var t=Kk.lastIndex=0;Kk.test(e);)++t;return t}function vD(e){return Ub(e)?Zne(e):zne(e)}var Jne=Math.floor,ere=Math.random;function tre(e,t){return e+Jne(ere()*(t-e+1))}var nre=parseFloat,rre=Math.min,ire=Math.random;function ore(e,t,n){if(n&&typeof n!="boolean"&&Fb(e,t,n)&&(t=n=void 0),n===void 0&&(typeof t=="boolean"?(n=t,t=void 0):typeof e=="boolean"&&(n=e,e=void 0)),e===void 0&&t===void 0?(e=0,t=1):(e=Td(e),t===void 0?(t=e,e=0):t=Td(t)),e>t){var r=e;e=t,t=r}if(n||e%1||t%1){var i=ire();return rre(e+i*(t-e+nre("1e-"+((i+"").length-1))),t)}return tre(e,t)}var are=Math.ceil,sre=Math.max;function lre(e,t,n,r){for(var i=-1,o=sre(are((t-e)/(n||1)),0),a=Array(o);o--;)a[r?o:++i]=e,e+=n;return a}function ure(e){return function(t,n,r){return r&&typeof r!="number"&&Fb(t,n,r)&&(n=r=void 0),t=Td(t),n===void 0?(n=t,t=0):n=Td(n),r=r===void 0?t=o)return e;var s=n-vD(r);if(s<1)return r;var l=a?wN(a,0,s).join(""):e.slice(0,s);if(i===void 0)return l+r;if(a&&(s+=l.length-s),Ine(i)){if(e.slice(s).search(i)){var u,c=l;for(i.global||(i=RegExp(i.source,sf(bre.exec(i))+"g")),i.lastIndex=0;u=i.exec(c);)var d=u.index;l=l.slice(0,d===void 0?s:d)}}else if(e.indexOf(Hv(i),s)!=s){var f=l.lastIndexOf(i);f>-1&&(l=l.slice(0,f))}return l+r}var _re=1/0,Sre=Pd&&1/iE(new Pd([,-0]))[1]==_re?function(e){return new Pd(e)}:hQ;const xre=Sre;var wre=200;function bD(e,t,n){var r=-1,i=TQ,o=e.length,a=!0,s=[],l=s;if(n)a=!1,i=pne;else if(o>=wre){var u=t?null:xre(e);if(u)return iE(u);a=!1,i=iD,l=new Kp}else l=t?[]:s;e:for(;++r{kd(e,t.payload)}}}),{configChanged:Ere}=SD.actions,Are=SD.reducer,xD=ve("socket/socketConnected"),uE=ve("socket/appSocketConnected"),wD=ve("socket/socketDisconnected"),CD=ve("socket/appSocketDisconnected"),Tre=ve("socket/socketSubscribedSession"),Pre=ve("socket/appSocketSubscribedSession"),kre=ve("socket/socketUnsubscribedSession"),Ire=ve("socket/appSocketUnsubscribedSession"),ED=ve("socket/socketInvocationStarted"),cE=ve("socket/appSocketInvocationStarted"),dE=ve("socket/socketInvocationComplete"),fE=ve("socket/appSocketInvocationComplete"),AD=ve("socket/socketInvocationError"),Xb=ve("socket/appSocketInvocationError"),TD=ve("socket/socketGraphExecutionStateComplete"),PD=ve("socket/appSocketGraphExecutionStateComplete"),kD=ve("socket/socketGeneratorProgress"),hE=ve("socket/appSocketGeneratorProgress"),ID=ve("socket/socketModelLoadStarted"),MD=ve("socket/appSocketModelLoadStarted"),RD=ve("socket/socketModelLoadCompleted"),OD=ve("socket/appSocketModelLoadCompleted"),$D=ve("socket/socketSessionRetrievalError"),ND=ve("socket/appSocketSessionRetrievalError"),DD=ve("socket/socketInvocationRetrievalError"),LD=ve("socket/appSocketInvocationRetrievalError"),FD=ve("socket/socketQueueItemStatusChanged"),Qb=ve("socket/appSocketQueueItemStatusChanged");let p0;const Mre=new Uint8Array(16);function Rre(){if(!p0&&(p0=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!p0))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return p0(Mre)}const Yn=[];for(let e=0;e<256;++e)Yn.push((e+256).toString(16).slice(1));function Ore(e,t=0){return(Yn[e[t+0]]+Yn[e[t+1]]+Yn[e[t+2]]+Yn[e[t+3]]+"-"+Yn[e[t+4]]+Yn[e[t+5]]+"-"+Yn[e[t+6]]+Yn[e[t+7]]+"-"+Yn[e[t+8]]+Yn[e[t+9]]+"-"+Yn[e[t+10]]+Yn[e[t+11]]+Yn[e[t+12]]+Yn[e[t+13]]+Yn[e[t+14]]+Yn[e[t+15]]).toLowerCase()}const $re=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Qk={randomUUID:$re};function ap(e,t,n){if(Qk.randomUUID&&!t&&!e)return Qk.randomUUID();e=e||{};const r=e.random||(e.rng||Rre)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Ore(r)}const Nre={type:"logger",log(e){this.output("log",e)},warn(e){this.output("warn",e)},error(e){this.output("error",e)},output(e,t){console&&console[e]&&console[e].apply(console,t)}};class Kv{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.init(t,n)}init(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.prefix=n.prefix||"i18next:",this.logger=t||Nre,this.options=n,this.debug=n.debug}log(){for(var t=arguments.length,n=new Array(t),r=0;r{this.observers[r]=this.observers[r]||[],this.observers[r].push(n)}),this}off(t,n){if(this.observers[t]){if(!n){delete this.observers[t];return}this.observers[t]=this.observers[t].filter(r=>r!==n)}}emit(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{a(...r)}),this.observers["*"]&&[].concat(this.observers["*"]).forEach(a=>{a.apply(a,[t,...r])})}}function oh(){let e,t;const n=new Promise((r,i)=>{e=r,t=i});return n.resolve=e,n.reject=t,n}function Yk(e){return e==null?"":""+e}function Dre(e,t,n){e.forEach(r=>{t[r]&&(n[r]=t[r])})}function pE(e,t,n){function r(a){return a&&a.indexOf("###")>-1?a.replace(/###/g,"."):a}function i(){return!e||typeof e=="string"}const o=typeof t!="string"?[].concat(t):t.split(".");for(;o.length>1;){if(i())return{};const a=r(o.shift());!e[a]&&n&&(e[a]=new n),Object.prototype.hasOwnProperty.call(e,a)?e=e[a]:e={}}return i()?{}:{obj:e,k:r(o.shift())}}function Zk(e,t,n){const{obj:r,k:i}=pE(e,t,Object);r[i]=n}function Lre(e,t,n,r){const{obj:i,k:o}=pE(e,t,Object);i[o]=i[o]||[],r&&(i[o]=i[o].concat(n)),r||i[o].push(n)}function Xv(e,t){const{obj:n,k:r}=pE(e,t);if(n)return n[r]}function Fre(e,t,n){const r=Xv(e,n);return r!==void 0?r:Xv(t,n)}function BD(e,t,n){for(const r in t)r!=="__proto__"&&r!=="constructor"&&(r in e?typeof e[r]=="string"||e[r]instanceof String||typeof t[r]=="string"||t[r]instanceof String?n&&(e[r]=t[r]):BD(e[r],t[r],n):e[r]=t[r]);return e}function Cc(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}var Bre={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};function zre(e){return typeof e=="string"?e.replace(/[&<>"'\/]/g,t=>Bre[t]):e}const jre=[" ",",","?","!",";"];function Vre(e,t,n){t=t||"",n=n||"";const r=jre.filter(a=>t.indexOf(a)<0&&n.indexOf(a)<0);if(r.length===0)return!0;const i=new RegExp(`(${r.map(a=>a==="?"?"\\?":a).join("|")})`);let o=!i.test(e);if(!o){const a=e.indexOf(n);a>0&&!i.test(e.substring(0,a))&&(o=!0)}return o}function Qv(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:".";if(!e)return;if(e[t])return e[t];const r=t.split(n);let i=e;for(let o=0;oo+a;)a++,s=r.slice(o,o+a).join(n),l=i[s];if(l===void 0)return;if(l===null)return null;if(t.endsWith(s)){if(typeof l=="string")return l;if(s&&typeof l[s]=="string")return l[s]}const u=r.slice(o+a).join(n);return u?Qv(l,u,n):void 0}i=i[r[o]]}return i}function Yv(e){return e&&e.indexOf("_")>0?e.replace("_","-"):e}class Jk extends Yb{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{ns:["translation"],defaultNS:"translation"};super(),this.data=t||{},this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.options.ignoreJSONStructure===void 0&&(this.options.ignoreJSONStructure=!0)}addNamespaces(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)}removeNamespaces(t){const n=this.options.ns.indexOf(t);n>-1&&this.options.ns.splice(n,1)}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};const o=i.keySeparator!==void 0?i.keySeparator:this.options.keySeparator,a=i.ignoreJSONStructure!==void 0?i.ignoreJSONStructure:this.options.ignoreJSONStructure;let s=[t,n];r&&typeof r!="string"&&(s=s.concat(r)),r&&typeof r=="string"&&(s=s.concat(o?r.split(o):r)),t.indexOf(".")>-1&&(s=t.split("."));const l=Xv(this.data,s);return l||!a||typeof r!="string"?l:Qv(this.data&&this.data[t]&&this.data[t][n],r,o)}addResource(t,n,r,i){let o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{silent:!1};const a=o.keySeparator!==void 0?o.keySeparator:this.options.keySeparator;let s=[t,n];r&&(s=s.concat(a?r.split(a):r)),t.indexOf(".")>-1&&(s=t.split("."),i=n,n=s[1]),this.addNamespaces(n),Zk(this.data,s,i),o.silent||this.emit("added",t,n,r,i)}addResources(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{silent:!1};for(const o in r)(typeof r[o]=="string"||Object.prototype.toString.apply(r[o])==="[object Array]")&&this.addResource(t,n,o,r[o],{silent:!0});i.silent||this.emit("added",t,n,r)}addResourceBundle(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{silent:!1},s=[t,n];t.indexOf(".")>-1&&(s=t.split("."),i=r,r=n,n=s[1]),this.addNamespaces(n);let l=Xv(this.data,s)||{};i?BD(l,r,o):l={...l,...r},Zk(this.data,s,l),a.silent||this.emit("added",t,n,r)}removeResourceBundle(t,n){this.hasResourceBundle(t,n)&&delete this.data[t][n],this.removeNamespaces(n),this.emit("removed",t,n)}hasResourceBundle(t,n){return this.getResource(t,n)!==void 0}getResourceBundle(t,n){return n||(n=this.options.defaultNS),this.options.compatibilityAPI==="v1"?{...this.getResource(t,n)}:this.getResource(t,n)}getDataByLanguage(t){return this.data[t]}hasLanguageSomeTranslations(t){const n=this.getDataByLanguage(t);return!!(n&&Object.keys(n)||[]).find(i=>n[i]&&Object.keys(n[i]).length>0)}toJSON(){return this.data}}var zD={processors:{},addPostProcessor(e){this.processors[e.name]=e},handle(e,t,n,r,i){return e.forEach(o=>{this.processors[o]&&(t=this.processors[o].process(t,n,r,i))}),t}};const e6={};class Zv extends Yb{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};super(),Dre(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat","utils"],t,this),this.options=n,this.options.keySeparator===void 0&&(this.options.keySeparator="."),this.logger=sa.create("translator")}changeLanguage(t){t&&(this.language=t)}exists(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}};if(t==null)return!1;const r=this.resolve(t,n);return r&&r.res!==void 0}extractFromKey(t,n){let r=n.nsSeparator!==void 0?n.nsSeparator:this.options.nsSeparator;r===void 0&&(r=":");const i=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator;let o=n.ns||this.options.defaultNS||[];const a=r&&t.indexOf(r)>-1,s=!this.options.userDefinedKeySeparator&&!n.keySeparator&&!this.options.userDefinedNsSeparator&&!n.nsSeparator&&!Vre(t,r,i);if(a&&!s){const l=t.match(this.interpolator.nestingRegexp);if(l&&l.length>0)return{key:t,namespaces:o};const u=t.split(r);(r!==i||r===i&&this.options.ns.indexOf(u[0])>-1)&&(o=u.shift()),t=u.join(i)}return typeof o=="string"&&(o=[o]),{key:t,namespaces:o}}translate(t,n,r){if(typeof n!="object"&&this.options.overloadTranslationOptionHandler&&(n=this.options.overloadTranslationOptionHandler(arguments)),typeof n=="object"&&(n={...n}),n||(n={}),t==null)return"";Array.isArray(t)||(t=[String(t)]);const i=n.returnDetails!==void 0?n.returnDetails:this.options.returnDetails,o=n.keySeparator!==void 0?n.keySeparator:this.options.keySeparator,{key:a,namespaces:s}=this.extractFromKey(t[t.length-1],n),l=s[s.length-1],u=n.lng||this.language,c=n.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&u.toLowerCase()==="cimode"){if(c){const b=n.nsSeparator||this.options.nsSeparator;return i?{res:`${l}${b}${a}`,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:`${l}${b}${a}`}return i?{res:a,usedKey:a,exactUsedKey:a,usedLng:u,usedNS:l}:a}const d=this.resolve(t,n);let f=d&&d.res;const h=d&&d.usedKey||a,p=d&&d.exactUsedKey||a,m=Object.prototype.toString.apply(f),_=["[object Number]","[object Function]","[object RegExp]"],v=n.joinArrays!==void 0?n.joinArrays:this.options.joinArrays,y=!this.i18nFormat||this.i18nFormat.handleAsObject;if(y&&f&&(typeof f!="string"&&typeof f!="boolean"&&typeof f!="number")&&_.indexOf(m)<0&&!(typeof v=="string"&&m==="[object Array]")){if(!n.returnObjects&&!this.options.returnObjects){this.options.returnedObjectHandler||this.logger.warn("accessing an object - but returnObjects options is not enabled!");const b=this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,{...n,ns:s}):`key '${a} (${this.language})' returned an object instead of string.`;return i?(d.res=b,d):b}if(o){const b=m==="[object Array]",S=b?[]:{},x=b?p:h;for(const w in f)if(Object.prototype.hasOwnProperty.call(f,w)){const C=`${x}${o}${w}`;S[w]=this.translate(C,{...n,joinArrays:!1,ns:s}),S[w]===C&&(S[w]=f[w])}f=S}}else if(y&&typeof v=="string"&&m==="[object Array]")f=f.join(v),f&&(f=this.extendTranslation(f,t,n,r));else{let b=!1,S=!1;const x=n.count!==void 0&&typeof n.count!="string",w=Zv.hasDefaultValue(n),C=x?this.pluralResolver.getSuffix(u,n.count,n):"",T=n.ordinal&&x?this.pluralResolver.getSuffix(u,n.count,{ordinal:!1}):"",A=n[`defaultValue${C}`]||n[`defaultValue${T}`]||n.defaultValue;!this.isValidLookup(f)&&w&&(b=!0,f=A),this.isValidLookup(f)||(S=!0,f=a);const D=(n.missingKeyNoValueFallbackToKey||this.options.missingKeyNoValueFallbackToKey)&&S?void 0:f,M=w&&A!==f&&this.options.updateMissing;if(S||b||M){if(this.logger.log(M?"updateKey":"missingKey",u,l,a,M?A:f),o){const L=this.resolve(a,{...n,keySeparator:!1});L&&L.res&&this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.")}let E=[];const P=this.languageUtils.getFallbackCodes(this.options.fallbackLng,n.lng||this.language);if(this.options.saveMissingTo==="fallback"&&P&&P[0])for(let L=0;L{const $=w&&R!==f?R:D;this.options.missingKeyHandler?this.options.missingKeyHandler(L,l,O,$,M,n):this.backendConnector&&this.backendConnector.saveMissing&&this.backendConnector.saveMissing(L,l,O,$,M,n),this.emit("missingKey",L,l,O,f)};this.options.saveMissing&&(this.options.saveMissingPlurals&&x?E.forEach(L=>{this.pluralResolver.getSuffixes(L,n).forEach(O=>{N([L],a+O,n[`defaultValue${O}`]||A)})}):N(E,a,A))}f=this.extendTranslation(f,t,n,d,r),S&&f===a&&this.options.appendNamespaceToMissingKey&&(f=`${l}:${a}`),(S||b)&&this.options.parseMissingKeyHandler&&(this.options.compatibilityAPI!=="v1"?f=this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey?`${l}:${a}`:a,b?f:void 0):f=this.options.parseMissingKeyHandler(f))}return i?(d.res=f,d):f}extendTranslation(t,n,r,i,o){var a=this;if(this.i18nFormat&&this.i18nFormat.parse)t=this.i18nFormat.parse(t,{...this.options.interpolation.defaultVariables,...r},i.usedLng,i.usedNS,i.usedKey,{resolved:i});else if(!r.skipInterpolation){r.interpolation&&this.interpolator.init({...r,interpolation:{...this.options.interpolation,...r.interpolation}});const u=typeof t=="string"&&(r&&r.interpolation&&r.interpolation.skipOnVariables!==void 0?r.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables);let c;if(u){const f=t.match(this.interpolator.nestingRegexp);c=f&&f.length}let d=r.replace&&typeof r.replace!="string"?r.replace:r;if(this.options.interpolation.defaultVariables&&(d={...this.options.interpolation.defaultVariables,...d}),t=this.interpolator.interpolate(t,d,r.lng||this.language,r),u){const f=t.match(this.interpolator.nestingRegexp),h=f&&f.length;c1&&arguments[1]!==void 0?arguments[1]:{},r,i,o,a,s;return typeof t=="string"&&(t=[t]),t.forEach(l=>{if(this.isValidLookup(r))return;const u=this.extractFromKey(l,n),c=u.key;i=c;let d=u.namespaces;this.options.fallbackNS&&(d=d.concat(this.options.fallbackNS));const f=n.count!==void 0&&typeof n.count!="string",h=f&&!n.ordinal&&n.count===0&&this.pluralResolver.shouldUseIntlApi(),p=n.context!==void 0&&(typeof n.context=="string"||typeof n.context=="number")&&n.context!=="",m=n.lngs?n.lngs:this.languageUtils.toResolveHierarchy(n.lng||this.language,n.fallbackLng);d.forEach(_=>{this.isValidLookup(r)||(s=_,!e6[`${m[0]}-${_}`]&&this.utils&&this.utils.hasLoadedNamespace&&!this.utils.hasLoadedNamespace(s)&&(e6[`${m[0]}-${_}`]=!0,this.logger.warn(`key "${i}" for languages "${m.join(", ")}" won't get resolved as namespace "${s}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")),m.forEach(v=>{if(this.isValidLookup(r))return;a=v;const y=[c];if(this.i18nFormat&&this.i18nFormat.addLookupKeys)this.i18nFormat.addLookupKeys(y,c,v,_,n);else{let b;f&&(b=this.pluralResolver.getSuffix(v,n.count,n));const S=`${this.options.pluralSeparator}zero`,x=`${this.options.pluralSeparator}ordinal${this.options.pluralSeparator}`;if(f&&(y.push(c+b),n.ordinal&&b.indexOf(x)===0&&y.push(c+b.replace(x,this.options.pluralSeparator)),h&&y.push(c+S)),p){const w=`${c}${this.options.contextSeparator}${n.context}`;y.push(w),f&&(y.push(w+b),n.ordinal&&b.indexOf(x)===0&&y.push(w+b.replace(x,this.options.pluralSeparator)),h&&y.push(w+S))}}let g;for(;g=y.pop();)this.isValidLookup(r)||(o=g,r=this.getResource(v,_,g,n))}))})}),{res:r,usedKey:i,exactUsedKey:o,usedLng:a,usedNS:s}}isValidLookup(t){return t!==void 0&&!(!this.options.returnNull&&t===null)&&!(!this.options.returnEmptyString&&t==="")}getResource(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,n,r,i):this.resourceStore.getResource(t,n,r,i)}static hasDefaultValue(t){const n="defaultValue";for(const r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&n===r.substring(0,n.length)&&t[r]!==void 0)return!0;return!1}}function xx(e){return e.charAt(0).toUpperCase()+e.slice(1)}class t6{constructor(t){this.options=t,this.supportedLngs=this.options.supportedLngs||!1,this.logger=sa.create("languageUtils")}getScriptPartFromCode(t){if(t=Yv(t),!t||t.indexOf("-")<0)return null;const n=t.split("-");return n.length===2||(n.pop(),n[n.length-1].toLowerCase()==="x")?null:this.formatLanguageCode(n.join("-"))}getLanguagePartFromCode(t){if(t=Yv(t),!t||t.indexOf("-")<0)return t;const n=t.split("-");return this.formatLanguageCode(n[0])}formatLanguageCode(t){if(typeof t=="string"&&t.indexOf("-")>-1){const n=["hans","hant","latn","cyrl","cans","mong","arab"];let r=t.split("-");return this.options.lowerCaseLng?r=r.map(i=>i.toLowerCase()):r.length===2?(r[0]=r[0].toLowerCase(),r[1]=r[1].toUpperCase(),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=xx(r[1].toLowerCase()))):r.length===3&&(r[0]=r[0].toLowerCase(),r[1].length===2&&(r[1]=r[1].toUpperCase()),r[0]!=="sgn"&&r[2].length===2&&(r[2]=r[2].toUpperCase()),n.indexOf(r[1].toLowerCase())>-1&&(r[1]=xx(r[1].toLowerCase())),n.indexOf(r[2].toLowerCase())>-1&&(r[2]=xx(r[2].toLowerCase()))),r.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t}isSupportedCode(t){return(this.options.load==="languageOnly"||this.options.nonExplicitSupportedLngs)&&(t=this.getLanguagePartFromCode(t)),!this.supportedLngs||!this.supportedLngs.length||this.supportedLngs.indexOf(t)>-1}getBestMatchFromCodes(t){if(!t)return null;let n;return t.forEach(r=>{if(n)return;const i=this.formatLanguageCode(r);(!this.options.supportedLngs||this.isSupportedCode(i))&&(n=i)}),!n&&this.options.supportedLngs&&t.forEach(r=>{if(n)return;const i=this.getLanguagePartFromCode(r);if(this.isSupportedCode(i))return n=i;n=this.options.supportedLngs.find(o=>{if(o===i)return o;if(!(o.indexOf("-")<0&&i.indexOf("-")<0)&&o.indexOf(i)===0)return o})}),n||(n=this.getFallbackCodes(this.options.fallbackLng)[0]),n}getFallbackCodes(t,n){if(!t)return[];if(typeof t=="function"&&(t=t(n)),typeof t=="string"&&(t=[t]),Object.prototype.toString.apply(t)==="[object Array]")return t;if(!n)return t.default||[];let r=t[n];return r||(r=t[this.getScriptPartFromCode(n)]),r||(r=t[this.formatLanguageCode(n)]),r||(r=t[this.getLanguagePartFromCode(n)]),r||(r=t.default),r||[]}toResolveHierarchy(t,n){const r=this.getFallbackCodes(n||this.options.fallbackLng||[],t),i=[],o=a=>{a&&(this.isSupportedCode(a)?i.push(a):this.logger.warn(`rejecting language code not found in supportedLngs: ${a}`))};return typeof t=="string"&&(t.indexOf("-")>-1||t.indexOf("_")>-1)?(this.options.load!=="languageOnly"&&o(this.formatLanguageCode(t)),this.options.load!=="languageOnly"&&this.options.load!=="currentOnly"&&o(this.getScriptPartFromCode(t)),this.options.load!=="currentOnly"&&o(this.getLanguagePartFromCode(t))):typeof t=="string"&&o(this.formatLanguageCode(t)),r.forEach(a=>{i.indexOf(a)<0&&o(this.formatLanguageCode(a))}),i}}let Ure=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","tl","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","hi","hu","hy","ia","it","kk","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","ht","id","ja","jbo","ka","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","cnr","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21},{lngs:["he","iw"],nr:[1,2,20,21],fc:22}],Gre={1:function(e){return+(e>1)},2:function(e){return+(e!=1)},3:function(e){return 0},4:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},5:function(e){return e==0?0:e==1?1:e==2?2:e%100>=3&&e%100<=10?3:e%100>=11?4:5},6:function(e){return e==1?0:e>=2&&e<=4?1:2},7:function(e){return e==1?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},8:function(e){return e==1?0:e==2?1:e!=8&&e!=11?2:3},9:function(e){return+(e>=2)},10:function(e){return e==1?0:e==2?1:e<7?2:e<11?3:4},11:function(e){return e==1||e==11?0:e==2||e==12?1:e>2&&e<20?2:3},12:function(e){return+(e%10!=1||e%100==11)},13:function(e){return+(e!==0)},14:function(e){return e==1?0:e==2?1:e==3?2:3},15:function(e){return e%10==1&&e%100!=11?0:e%10>=2&&(e%100<10||e%100>=20)?1:2},16:function(e){return e%10==1&&e%100!=11?0:e!==0?1:2},17:function(e){return e==1||e%10==1&&e%100!=11?0:1},18:function(e){return e==0?0:e==1?1:2},19:function(e){return e==1?0:e==0||e%100>1&&e%100<11?1:e%100>10&&e%100<20?2:3},20:function(e){return e==1?0:e==0||e%100>0&&e%100<20?1:2},21:function(e){return e%100==1?1:e%100==2?2:e%100==3||e%100==4?3:0},22:function(e){return e==1?0:e==2?1:(e<0||e>10)&&e%10==0?2:3}};const Hre=["v1","v2","v3"],qre=["v4"],n6={zero:0,one:1,two:2,few:3,many:4,other:5};function Wre(){const e={};return Ure.forEach(t=>{t.lngs.forEach(n=>{e[n]={numbers:t.nr,plurals:Gre[t.fc]}})}),e}class Kre{constructor(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};this.languageUtils=t,this.options=n,this.logger=sa.create("pluralResolver"),(!this.options.compatibilityJSON||qre.includes(this.options.compatibilityJSON))&&(typeof Intl>"u"||!Intl.PluralRules)&&(this.options.compatibilityJSON="v3",this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")),this.rules=Wre()}addRule(t,n){this.rules[t]=n}getRule(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.shouldUseIntlApi())try{return new Intl.PluralRules(Yv(t),{type:n.ordinal?"ordinal":"cardinal"})}catch{return}return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]}needsPlural(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return this.shouldUseIntlApi()?r&&r.resolvedOptions().pluralCategories.length>1:r&&r.numbers.length>1}getPluralFormsOfKey(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return this.getSuffixes(t,r).map(i=>`${n}${i}`)}getSuffixes(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=this.getRule(t,n);return r?this.shouldUseIntlApi()?r.resolvedOptions().pluralCategories.sort((i,o)=>n6[i]-n6[o]).map(i=>`${this.options.prepend}${n.ordinal?`ordinal${this.options.prepend}`:""}${i}`):r.numbers.map(i=>this.getSuffix(t,i,n)):[]}getSuffix(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=this.getRule(t,r);return i?this.shouldUseIntlApi()?`${this.options.prepend}${r.ordinal?`ordinal${this.options.prepend}`:""}${i.select(n)}`:this.getSuffixRetroCompatible(i,n):(this.logger.warn(`no plural rule found for: ${t}`),"")}getSuffixRetroCompatible(t,n){const r=t.noAbs?t.plurals(n):t.plurals(Math.abs(n));let i=t.numbers[r];this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1&&(i===2?i="plural":i===1&&(i=""));const o=()=>this.options.prepend&&i.toString()?this.options.prepend+i.toString():i.toString();return this.options.compatibilityJSON==="v1"?i===1?"":typeof i=="number"?`_plural_${i.toString()}`:o():this.options.compatibilityJSON==="v2"||this.options.simplifyPluralSuffix&&t.numbers.length===2&&t.numbers[0]===1?o():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}shouldUseIntlApi(){return!Hre.includes(this.options.compatibilityJSON)}}function r6(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:".",i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0,o=Fre(e,t,n);return!o&&i&&typeof n=="string"&&(o=Qv(e,n,r),o===void 0&&(o=Qv(t,n,r))),o}class Xre{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=sa.create("interpolator"),this.options=t,this.format=t.interpolation&&t.interpolation.format||(n=>n),this.init(t)}init(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};t.interpolation||(t.interpolation={escapeValue:!0});const n=t.interpolation;this.escape=n.escape!==void 0?n.escape:zre,this.escapeValue=n.escapeValue!==void 0?n.escapeValue:!0,this.useRawValueToEscape=n.useRawValueToEscape!==void 0?n.useRawValueToEscape:!1,this.prefix=n.prefix?Cc(n.prefix):n.prefixEscaped||"{{",this.suffix=n.suffix?Cc(n.suffix):n.suffixEscaped||"}}",this.formatSeparator=n.formatSeparator?n.formatSeparator:n.formatSeparator||",",this.unescapePrefix=n.unescapeSuffix?"":n.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":n.unescapeSuffix||"",this.nestingPrefix=n.nestingPrefix?Cc(n.nestingPrefix):n.nestingPrefixEscaped||Cc("$t("),this.nestingSuffix=n.nestingSuffix?Cc(n.nestingSuffix):n.nestingSuffixEscaped||Cc(")"),this.nestingOptionsSeparator=n.nestingOptionsSeparator?n.nestingOptionsSeparator:n.nestingOptionsSeparator||",",this.maxReplaces=n.maxReplaces?n.maxReplaces:1e3,this.alwaysFormat=n.alwaysFormat!==void 0?n.alwaysFormat:!1,this.resetRegExp()}reset(){this.options&&this.init(this.options)}resetRegExp(){const t=`${this.prefix}(.+?)${this.suffix}`;this.regexp=new RegExp(t,"g");const n=`${this.prefix}${this.unescapePrefix}(.+?)${this.unescapeSuffix}${this.suffix}`;this.regexpUnescape=new RegExp(n,"g");const r=`${this.nestingPrefix}(.+?)${this.nestingSuffix}`;this.nestingRegexp=new RegExp(r,"g")}interpolate(t,n,r,i){let o,a,s;const l=this.options&&this.options.interpolation&&this.options.interpolation.defaultVariables||{};function u(p){return p.replace(/\$/g,"$$$$")}const c=p=>{if(p.indexOf(this.formatSeparator)<0){const y=r6(n,l,p,this.options.keySeparator,this.options.ignoreJSONStructure);return this.alwaysFormat?this.format(y,void 0,r,{...i,...n,interpolationkey:p}):y}const m=p.split(this.formatSeparator),_=m.shift().trim(),v=m.join(this.formatSeparator).trim();return this.format(r6(n,l,_,this.options.keySeparator,this.options.ignoreJSONStructure),v,r,{...i,...n,interpolationkey:_})};this.resetRegExp();const d=i&&i.missingInterpolationHandler||this.options.missingInterpolationHandler,f=i&&i.interpolation&&i.interpolation.skipOnVariables!==void 0?i.interpolation.skipOnVariables:this.options.interpolation.skipOnVariables;return[{regex:this.regexpUnescape,safeValue:p=>u(p)},{regex:this.regexp,safeValue:p=>this.escapeValue?u(this.escape(p)):u(p)}].forEach(p=>{for(s=0;o=p.regex.exec(t);){const m=o[1].trim();if(a=c(m),a===void 0)if(typeof d=="function"){const v=d(t,o,i);a=typeof v=="string"?v:""}else if(i&&Object.prototype.hasOwnProperty.call(i,m))a="";else if(f){a=o[0];continue}else this.logger.warn(`missed to pass in variable ${m} for interpolating ${t}`),a="";else typeof a!="string"&&!this.useRawValueToEscape&&(a=Yk(a));const _=p.safeValue(a);if(t=t.replace(o[0],_),f?(p.regex.lastIndex+=a.length,p.regex.lastIndex-=o[0].length):p.regex.lastIndex=0,s++,s>=this.maxReplaces)break}}),t}nest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i,o,a;function s(l,u){const c=this.nestingOptionsSeparator;if(l.indexOf(c)<0)return l;const d=l.split(new RegExp(`${c}[ ]*{`));let f=`{${d[1]}`;l=d[0],f=this.interpolate(f,a);const h=f.match(/'/g),p=f.match(/"/g);(h&&h.length%2===0&&!p||p.length%2!==0)&&(f=f.replace(/'/g,'"'));try{a=JSON.parse(f),u&&(a={...u,...a})}catch(m){return this.logger.warn(`failed parsing options string in nesting for key ${l}`,m),`${l}${c}${f}`}return delete a.defaultValue,l}for(;i=this.nestingRegexp.exec(t);){let l=[];a={...r},a=a.replace&&typeof a.replace!="string"?a.replace:a,a.applyPostProcessor=!1,delete a.defaultValue;let u=!1;if(i[0].indexOf(this.formatSeparator)!==-1&&!/{.*}/.test(i[1])){const c=i[1].split(this.formatSeparator).map(d=>d.trim());i[1]=c.shift(),l=c,u=!0}if(o=n(s.call(this,i[1].trim(),a),a),o&&i[0]===t&&typeof o!="string")return o;typeof o!="string"&&(o=Yk(o)),o||(this.logger.warn(`missed to resolve ${i[1]} for nesting ${t}`),o=""),u&&(o=l.reduce((c,d)=>this.format(c,d,r.lng,{...r,interpolationkey:i[1].trim()}),o.trim())),t=t.replace(i[0],o),this.regexp.lastIndex=0}return t}}function Qre(e){let t=e.toLowerCase().trim();const n={};if(e.indexOf("(")>-1){const r=e.split("(");t=r[0].toLowerCase().trim();const i=r[1].substring(0,r[1].length-1);t==="currency"&&i.indexOf(":")<0?n.currency||(n.currency=i.trim()):t==="relativetime"&&i.indexOf(":")<0?n.range||(n.range=i.trim()):i.split(";").forEach(a=>{if(!a)return;const[s,...l]=a.split(":"),u=l.join(":").trim().replace(/^'+|'+$/g,"");n[s.trim()]||(n[s.trim()]=u),u==="false"&&(n[s.trim()]=!1),u==="true"&&(n[s.trim()]=!0),isNaN(u)||(n[s.trim()]=parseInt(u,10))})}return{formatName:t,formatOptions:n}}function Ec(e){const t={};return function(r,i,o){const a=i+JSON.stringify(o);let s=t[a];return s||(s=e(Yv(i),o),t[a]=s),s(r)}}class Yre{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.logger=sa.create("formatter"),this.options=t,this.formats={number:Ec((n,r)=>{const i=new Intl.NumberFormat(n,{...r});return o=>i.format(o)}),currency:Ec((n,r)=>{const i=new Intl.NumberFormat(n,{...r,style:"currency"});return o=>i.format(o)}),datetime:Ec((n,r)=>{const i=new Intl.DateTimeFormat(n,{...r});return o=>i.format(o)}),relativetime:Ec((n,r)=>{const i=new Intl.RelativeTimeFormat(n,{...r});return o=>i.format(o,r.range||"day")}),list:Ec((n,r)=>{const i=new Intl.ListFormat(n,{...r});return o=>i.format(o)})},this.init(t)}init(t){const r=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:{interpolation:{}}).interpolation;this.formatSeparator=r.formatSeparator?r.formatSeparator:r.formatSeparator||","}add(t,n){this.formats[t.toLowerCase().trim()]=n}addCached(t,n){this.formats[t.toLowerCase().trim()]=Ec(n)}format(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};return n.split(this.formatSeparator).reduce((s,l)=>{const{formatName:u,formatOptions:c}=Qre(l);if(this.formats[u]){let d=s;try{const f=i&&i.formatParams&&i.formatParams[i.interpolationkey]||{},h=f.locale||f.lng||i.locale||i.lng||r;d=this.formats[u](s,h,{...c,...i,...f})}catch(f){this.logger.warn(f)}return d}else this.logger.warn(`there was no format function for ${u}`);return s},t)}}function Zre(e,t){e.pending[t]!==void 0&&(delete e.pending[t],e.pendingCount--)}class Jre extends Yb{constructor(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{};super(),this.backend=t,this.store=n,this.services=r,this.languageUtils=r.languageUtils,this.options=i,this.logger=sa.create("backendConnector"),this.waitingReads=[],this.maxParallelReads=i.maxParallelReads||10,this.readingCalls=0,this.maxRetries=i.maxRetries>=0?i.maxRetries:5,this.retryTimeout=i.retryTimeout>=1?i.retryTimeout:350,this.state={},this.queue=[],this.backend&&this.backend.init&&this.backend.init(r,i.backend,i)}queueLoad(t,n,r,i){const o={},a={},s={},l={};return t.forEach(u=>{let c=!0;n.forEach(d=>{const f=`${u}|${d}`;!r.reload&&this.store.hasResourceBundle(u,d)?this.state[f]=2:this.state[f]<0||(this.state[f]===1?a[f]===void 0&&(a[f]=!0):(this.state[f]=1,c=!1,a[f]===void 0&&(a[f]=!0),o[f]===void 0&&(o[f]=!0),l[d]===void 0&&(l[d]=!0)))}),c||(s[u]=!0)}),(Object.keys(o).length||Object.keys(a).length)&&this.queue.push({pending:a,pendingCount:Object.keys(a).length,loaded:{},errors:[],callback:i}),{toLoad:Object.keys(o),pending:Object.keys(a),toLoadLanguages:Object.keys(s),toLoadNamespaces:Object.keys(l)}}loaded(t,n,r){const i=t.split("|"),o=i[0],a=i[1];n&&this.emit("failedLoading",o,a,n),r&&this.store.addResourceBundle(o,a,r),this.state[t]=n?-1:2;const s={};this.queue.forEach(l=>{Lre(l.loaded,[o],a),Zre(l,t),n&&l.errors.push(n),l.pendingCount===0&&!l.done&&(Object.keys(l.loaded).forEach(u=>{s[u]||(s[u]={});const c=l.loaded[u];c.length&&c.forEach(d=>{s[u][d]===void 0&&(s[u][d]=!0)})}),l.done=!0,l.errors.length?l.callback(l.errors):l.callback())}),this.emit("loaded",s),this.queue=this.queue.filter(l=>!l.done)}read(t,n,r){let i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:this.retryTimeout,a=arguments.length>5?arguments[5]:void 0;if(!t.length)return a(null,{});if(this.readingCalls>=this.maxParallelReads){this.waitingReads.push({lng:t,ns:n,fcName:r,tried:i,wait:o,callback:a});return}this.readingCalls++;const s=(u,c)=>{if(this.readingCalls--,this.waitingReads.length>0){const d=this.waitingReads.shift();this.read(d.lng,d.ns,d.fcName,d.tried,d.wait,d.callback)}if(u&&c&&i{this.read.call(this,t,n,r,i+1,o*2,a)},o);return}a(u,c)},l=this.backend[r].bind(this.backend);if(l.length===2){try{const u=l(t,n);u&&typeof u.then=="function"?u.then(c=>s(null,c)).catch(s):s(null,u)}catch(u){s(u)}return}return l(t,n,s)}prepareLoading(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),i&&i();typeof t=="string"&&(t=this.languageUtils.toResolveHierarchy(t)),typeof n=="string"&&(n=[n]);const o=this.queueLoad(t,n,r,i);if(!o.toLoad.length)return o.pending.length||i(),null;o.toLoad.forEach(a=>{this.loadOne(a)})}load(t,n,r){this.prepareLoading(t,n,{},r)}reload(t,n,r){this.prepareLoading(t,n,{reload:!0},r)}loadOne(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";const r=t.split("|"),i=r[0],o=r[1];this.read(i,o,"read",void 0,void 0,(a,s)=>{a&&this.logger.warn(`${n}loading namespace ${o} for language ${i} failed`,a),!a&&s&&this.logger.log(`${n}loaded namespace ${o} for language ${i}`,s),this.loaded(t,a,s)})}saveMissing(t,n,r,i,o){let a=arguments.length>5&&arguments[5]!==void 0?arguments[5]:{},s=arguments.length>6&&arguments[6]!==void 0?arguments[6]:()=>{};if(this.services.utils&&this.services.utils.hasLoadedNamespace&&!this.services.utils.hasLoadedNamespace(n)){this.logger.warn(`did not save key "${r}" as the namespace "${n}" was not yet loaded`,"This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!");return}if(!(r==null||r==="")){if(this.backend&&this.backend.create){const l={...a,isUpdate:o},u=this.backend.create.bind(this.backend);if(u.length<6)try{let c;u.length===5?c=u(t,n,r,i,l):c=u(t,n,r,i),c&&typeof c.then=="function"?c.then(d=>s(null,d)).catch(s):s(null,c)}catch(c){s(c)}else u(t,n,r,i,s,l)}!t||!t[0]||this.store.addResource(t[0],n,r,i)}}}function i6(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,supportedLngs:!1,nonExplicitSupportedLngs:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",partialBundledLanguages:!1,saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,postProcessPassResolved:!1,returnNull:!1,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:!1,parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){let n={};if(typeof t[1]=="object"&&(n=t[1]),typeof t[1]=="string"&&(n.defaultValue=t[1]),typeof t[2]=="string"&&(n.tDescription=t[2]),typeof t[2]=="object"||typeof t[3]=="object"){const r=t[3]||t[2];Object.keys(r).forEach(i=>{n[i]=r[i]})}return n},interpolation:{escapeValue:!0,format:(e,t,n,r)=>e,prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",nestingOptionsSeparator:",",maxReplaces:1e3,skipOnVariables:!0}}}function o6(e){return typeof e.ns=="string"&&(e.ns=[e.ns]),typeof e.fallbackLng=="string"&&(e.fallbackLng=[e.fallbackLng]),typeof e.fallbackNS=="string"&&(e.fallbackNS=[e.fallbackNS]),e.supportedLngs&&e.supportedLngs.indexOf("cimode")<0&&(e.supportedLngs=e.supportedLngs.concat(["cimode"])),e}function g0(){}function eie(e){Object.getOwnPropertyNames(Object.getPrototypeOf(e)).forEach(n=>{typeof e[n]=="function"&&(e[n]=e[n].bind(e))})}class Xp extends Yb{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;if(super(),this.options=o6(t),this.services={},this.logger=sa,this.modules={external:[]},eie(this),n&&!this.isInitialized&&!t.isClone){if(!this.options.initImmediate)return this.init(t,n),this;setTimeout(()=>{this.init(t,n)},0)}}init(){var t=this;let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;typeof n=="function"&&(r=n,n={}),!n.defaultNS&&n.defaultNS!==!1&&n.ns&&(typeof n.ns=="string"?n.defaultNS=n.ns:n.ns.indexOf("translation")<0&&(n.defaultNS=n.ns[0]));const i=i6();this.options={...i,...this.options,...o6(n)},this.options.compatibilityAPI!=="v1"&&(this.options.interpolation={...i.interpolation,...this.options.interpolation}),n.keySeparator!==void 0&&(this.options.userDefinedKeySeparator=n.keySeparator),n.nsSeparator!==void 0&&(this.options.userDefinedNsSeparator=n.nsSeparator);function o(c){return c?typeof c=="function"?new c:c:null}if(!this.options.isClone){this.modules.logger?sa.init(o(this.modules.logger),this.options):sa.init(null,this.options);let c;this.modules.formatter?c=this.modules.formatter:typeof Intl<"u"&&(c=Yre);const d=new t6(this.options);this.store=new Jk(this.options.resources,this.options);const f=this.services;f.logger=sa,f.resourceStore=this.store,f.languageUtils=d,f.pluralResolver=new Kre(d,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),c&&(!this.options.interpolation.format||this.options.interpolation.format===i.interpolation.format)&&(f.formatter=o(c),f.formatter.init(f,this.options),this.options.interpolation.format=f.formatter.format.bind(f.formatter)),f.interpolator=new Xre(this.options),f.utils={hasLoadedNamespace:this.hasLoadedNamespace.bind(this)},f.backendConnector=new Jre(o(this.modules.backend),f.resourceStore,f,this.options),f.backendConnector.on("*",function(h){for(var p=arguments.length,m=new Array(p>1?p-1:0),_=1;_1?p-1:0),_=1;_{h.init&&h.init(this)})}if(this.format=this.options.interpolation.format,r||(r=g0),this.options.fallbackLng&&!this.services.languageDetector&&!this.options.lng){const c=this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);c.length>0&&c[0]!=="dev"&&(this.options.lng=c[0])}!this.services.languageDetector&&!this.options.lng&&this.logger.warn("init: no languageDetector is used and no lng is defined"),["getResource","hasResourceBundle","getResourceBundle","getDataByLanguage"].forEach(c=>{this[c]=function(){return t.store[c](...arguments)}}),["addResource","addResources","addResourceBundle","removeResourceBundle"].forEach(c=>{this[c]=function(){return t.store[c](...arguments),t}});const l=oh(),u=()=>{const c=(d,f)=>{this.isInitialized&&!this.initializedStoreOnce&&this.logger.warn("init: i18next is already initialized. You should call init just once!"),this.isInitialized=!0,this.options.isClone||this.logger.log("initialized",this.options),this.emit("initialized",this.options),l.resolve(f),r(d,f)};if(this.languages&&this.options.compatibilityAPI!=="v1"&&!this.isInitialized)return c(null,this.t.bind(this));this.changeLanguage(this.options.lng,c)};return this.options.resources||!this.options.initImmediate?u():setTimeout(u,0),l}loadResources(t){let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g0;const i=typeof t=="string"?t:this.language;if(typeof t=="function"&&(r=t),!this.options.resources||this.options.partialBundledLanguages){if(i&&i.toLowerCase()==="cimode")return r();const o=[],a=s=>{if(!s)return;this.services.languageUtils.toResolveHierarchy(s).forEach(u=>{o.indexOf(u)<0&&o.push(u)})};i?a(i):this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(l=>a(l)),this.options.preload&&this.options.preload.forEach(s=>a(s)),this.services.backendConnector.load(o,this.options.ns,s=>{!s&&!this.resolvedLanguage&&this.language&&this.setResolvedLanguage(this.language),r(s)})}else r(null)}reloadResources(t,n,r){const i=oh();return t||(t=this.languages),n||(n=this.options.ns),r||(r=g0),this.services.backendConnector.reload(t,n,o=>{i.resolve(),r(o)}),i}use(t){if(!t)throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");if(!t.type)throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");return t.type==="backend"&&(this.modules.backend=t),(t.type==="logger"||t.log&&t.warn&&t.error)&&(this.modules.logger=t),t.type==="languageDetector"&&(this.modules.languageDetector=t),t.type==="i18nFormat"&&(this.modules.i18nFormat=t),t.type==="postProcessor"&&zD.addPostProcessor(t),t.type==="formatter"&&(this.modules.formatter=t),t.type==="3rdParty"&&this.modules.external.push(t),this}setResolvedLanguage(t){if(!(!t||!this.languages)&&!(["cimode","dev"].indexOf(t)>-1))for(let n=0;n-1)&&this.store.hasLanguageSomeTranslations(r)){this.resolvedLanguage=r;break}}}changeLanguage(t,n){var r=this;this.isLanguageChangingTo=t;const i=oh();this.emit("languageChanging",t);const o=l=>{this.language=l,this.languages=this.services.languageUtils.toResolveHierarchy(l),this.resolvedLanguage=void 0,this.setResolvedLanguage(l)},a=(l,u)=>{u?(o(u),this.translator.changeLanguage(u),this.isLanguageChangingTo=void 0,this.emit("languageChanged",u),this.logger.log("languageChanged",u)):this.isLanguageChangingTo=void 0,i.resolve(function(){return r.t(...arguments)}),n&&n(l,function(){return r.t(...arguments)})},s=l=>{!t&&!l&&this.services.languageDetector&&(l=[]);const u=typeof l=="string"?l:this.services.languageUtils.getBestMatchFromCodes(l);u&&(this.language||o(u),this.translator.language||this.translator.changeLanguage(u),this.services.languageDetector&&this.services.languageDetector.cacheUserLanguage&&this.services.languageDetector.cacheUserLanguage(u)),this.loadResources(u,c=>{a(c,u)})};return!t&&this.services.languageDetector&&!this.services.languageDetector.async?s(this.services.languageDetector.detect()):!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect.length===0?this.services.languageDetector.detect().then(s):this.services.languageDetector.detect(s):s(t),i}getFixedT(t,n,r){var i=this;const o=function(a,s){let l;if(typeof s!="object"){for(var u=arguments.length,c=new Array(u>2?u-2:0),d=2;d`${l.keyPrefix}${f}${p}`):h=l.keyPrefix?`${l.keyPrefix}${f}${a}`:a,i.t(h,l)};return typeof t=="string"?o.lng=t:o.lngs=t,o.ns=n,o.keyPrefix=r,o}t(){return this.translator&&this.translator.translate(...arguments)}exists(){return this.translator&&this.translator.exists(...arguments)}setDefaultNamespace(t){this.options.defaultNS=t}hasLoadedNamespace(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!this.isInitialized)return this.logger.warn("hasLoadedNamespace: i18next was not initialized",this.languages),!1;if(!this.languages||!this.languages.length)return this.logger.warn("hasLoadedNamespace: i18n.languages were undefined or empty",this.languages),!1;const r=n.lng||this.resolvedLanguage||this.languages[0],i=this.options?this.options.fallbackLng:!1,o=this.languages[this.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=this.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};if(n.precheck){const s=n.precheck(this,a);if(s!==void 0)return s}return!!(this.hasResourceBundle(r,t)||!this.services.backendConnector.backend||this.options.resources&&!this.options.partialBundledLanguages||a(r,t)&&(!i||a(o,t)))}loadNamespaces(t,n){const r=oh();return this.options.ns?(typeof t=="string"&&(t=[t]),t.forEach(i=>{this.options.ns.indexOf(i)<0&&this.options.ns.push(i)}),this.loadResources(i=>{r.resolve(),n&&n(i)}),r):(n&&n(),Promise.resolve())}loadLanguages(t,n){const r=oh();typeof t=="string"&&(t=[t]);const i=this.options.preload||[],o=t.filter(a=>i.indexOf(a)<0);return o.length?(this.options.preload=i.concat(o),this.loadResources(a=>{r.resolve(),n&&n(a)}),r):(n&&n(),Promise.resolve())}dir(t){if(t||(t=this.resolvedLanguage||(this.languages&&this.languages.length>0?this.languages[0]:this.language)),!t)return"rtl";const n=["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ug","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam","ckb"],r=this.services&&this.services.languageUtils||new t6(i6());return n.indexOf(r.getLanguagePartFromCode(t))>-1||t.toLowerCase().indexOf("-arab")>1?"rtl":"ltr"}static createInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1?arguments[1]:void 0;return new Xp(t,n)}cloneInstance(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g0;const r=t.forkResourceStore;r&&delete t.forkResourceStore;const i={...this.options,...t,isClone:!0},o=new Xp(i);return(t.debug!==void 0||t.prefix!==void 0)&&(o.logger=o.logger.clone(t)),["store","services","language"].forEach(s=>{o[s]=this[s]}),o.services={...this.services},o.services.utils={hasLoadedNamespace:o.hasLoadedNamespace.bind(o)},r&&(o.store=new Jk(this.store.data,i),o.services.resourceStore=o.store),o.translator=new Zv(o.services,i),o.translator.on("*",function(s){for(var l=arguments.length,u=new Array(l>1?l-1:0),c=1;c{switch(t){case"controlnet":return kd(et(tie),{id:e,...n});case"t2i_adapter":return kd(et(nie),{id:e,...n});case"ip_adapter":return kd(et(rie),{id:e,...n});default:throw new Error(`Unknown control adapter type: ${t}`)}},gE=ve("controlAdapters/imageProcessed"),Zb=e=>e.type==="controlnet",jD=e=>e.type==="ip_adapter",mE=e=>e.type==="t2i_adapter",di=e=>Zb(e)||mE(e),Xt=Qi(),{selectById:Tr,selectAll:Xi,selectEntities:LDe,selectIds:FDe,selectTotal:BDe}=Xt.getSelectors(),r5=Xt.getInitialState({pendingControlImages:[]}),VD=e=>Xi(e).filter(Zb),iie=e=>Xi(e).filter(Zb).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),oie=e=>Xi(e).filter(jD),aie=e=>Xi(e).filter(jD).filter(t=>t.isEnabled&&t.model&&!!t.controlImage),UD=e=>Xi(e).filter(mE),sie=e=>Xi(e).filter(mE).filter(t=>t.isEnabled&&t.model&&(!!t.processedControlImage||t.processorType==="none"&&!!t.controlImage)),lie=(e,t)=>{const n=VD(e).filter(r=>r.id!==t).map(r=>({id:r.id,changes:{isEnabled:!1}}));Xt.updateMany(e,n)},uie=(e,t)=>{const n=UD(e).filter(r=>r.id!==t).map(r=>({id:r.id,changes:{isEnabled:!1}}));Xt.updateMany(e,n)},ah=(e,t,n)=>{t==="controlnet"&&uie(e,n),t==="t2i_adapter"&&lie(e,n)},GD=qt({name:"controlAdapters",initialState:r5,reducers:{controlAdapterAdded:{reducer:(e,t)=>{const{id:n,type:r,overrides:i}=t.payload;Xt.addOne(e,a6(n,r,i)),ah(e,r,n)},prepare:({type:e,overrides:t})=>({payload:{id:ap(),type:e,overrides:t}})},controlAdapterRecalled:(e,t)=>{Xt.addOne(e,t.payload);const{type:n,id:r}=t.payload;ah(e,n,r)},controlAdapterDuplicated:{reducer:(e,t)=>{const{id:n,newId:r}=t.payload,i=Tr(e,n);if(!i)return;const o=kd(et(i),{id:r,isEnabled:!0});Xt.addOne(e,o);const{type:a}=o;ah(e,a,r)},prepare:e=>({payload:{id:e,newId:ap()}})},controlAdapterAddedFromImage:{reducer:(e,t)=>{const{id:n,type:r,controlImage:i}=t.payload;Xt.addOne(e,a6(n,r,{controlImage:i})),ah(e,r,n)},prepare:e=>({payload:{...e,id:ap()}})},controlAdapterRemoved:(e,t)=>{Xt.removeOne(e,t.payload.id)},controlAdapterIsEnabledChanged:(e,t)=>{const{id:n,isEnabled:r}=t.payload;if(Xt.updateOne(e,{id:n,changes:{isEnabled:r}}),r){const i=Tr(e,n);i&&ah(e,i.type,n)}},controlAdapterImageChanged:(e,t)=>{const{id:n,controlImage:r}=t.payload,i=Tr(e,n);i&&(Xt.updateOne(e,{id:n,changes:{controlImage:r,processedControlImage:null}}),r!==null&&di(i)&&i.processorType!=="none"&&e.pendingControlImages.push(n))},controlAdapterProcessedImageChanged:(e,t)=>{const{id:n,processedControlImage:r}=t.payload,i=Tr(e,n);i&&di(i)&&(Xt.updateOne(e,{id:n,changes:{processedControlImage:r}}),e.pendingControlImages=e.pendingControlImages.filter(o=>o!==n))},controlAdapterModelCleared:(e,t)=>{Xt.updateOne(e,{id:t.payload.id,changes:{model:null}})},controlAdapterModelChanged:(e,t)=>{const{id:n,model:r}=t.payload,i=Tr(e,n);if(!i)return;if(!di(i)){Xt.updateOne(e,{id:n,changes:{model:r}});return}const o={id:n,changes:{model:r}};if(o.changes.processedControlImage=null,i.shouldAutoConfig){let a;for(const s in m0)if(r.model_name.includes(s)){a=m0[s];break}a?(o.changes.processorType=a,o.changes.processorNode=mu[a].default):(o.changes.processorType="none",o.changes.processorNode=mu.none.default)}Xt.updateOne(e,o)},controlAdapterWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload;Xt.updateOne(e,{id:n,changes:{weight:r}})},controlAdapterBeginStepPctChanged:(e,t)=>{const{id:n,beginStepPct:r}=t.payload;Xt.updateOne(e,{id:n,changes:{beginStepPct:r}})},controlAdapterEndStepPctChanged:(e,t)=>{const{id:n,endStepPct:r}=t.payload;Xt.updateOne(e,{id:n,changes:{endStepPct:r}})},controlAdapterControlModeChanged:(e,t)=>{const{id:n,controlMode:r}=t.payload,i=Tr(e,n);!i||!Zb(i)||Xt.updateOne(e,{id:n,changes:{controlMode:r}})},controlAdapterResizeModeChanged:(e,t)=>{const{id:n,resizeMode:r}=t.payload,i=Tr(e,n);!i||!di(i)||Xt.updateOne(e,{id:n,changes:{resizeMode:r}})},controlAdapterProcessorParamsChanged:(e,t)=>{const{id:n,params:r}=t.payload,i=Tr(e,n);if(!i||!di(i)||!i.processorNode)return;const o=kd(et(i.processorNode),r);Xt.updateOne(e,{id:n,changes:{shouldAutoConfig:!1,processorNode:o}})},controlAdapterProcessortTypeChanged:(e,t)=>{const{id:n,processorType:r}=t.payload,i=Tr(e,n);if(!i||!di(i))return;const o=et(mu[r].default);Xt.updateOne(e,{id:n,changes:{processorType:r,processedControlImage:null,processorNode:o,shouldAutoConfig:!1}})},controlAdapterAutoConfigToggled:(e,t)=>{var o;const{id:n}=t.payload,r=Tr(e,n);if(!r||!di(r))return;const i={id:n,changes:{shouldAutoConfig:!r.shouldAutoConfig}};if(i.changes.shouldAutoConfig){let a;for(const s in m0)if((o=r.model)!=null&&o.model_name.includes(s)){a=m0[s];break}a?(i.changes.processorType=a,i.changes.processorNode=mu[a].default):(i.changes.processorType="none",i.changes.processorNode=mu.none.default)}Xt.updateOne(e,i)},controlAdaptersReset:()=>et(r5),pendingControlImagesCleared:e=>{e.pendingControlImages=[]}},extraReducers:e=>{e.addCase(gE,(t,n)=>{const r=Tr(t,n.payload.id);r&&r.controlImage!==null&&(t.pendingControlImages=Cre(t.pendingControlImages.concat(n.payload.id)))}),e.addCase(Xb,t=>{t.pendingControlImages=[]})}}),{controlAdapterAdded:yE,controlAdapterRecalled:vE,controlAdapterDuplicated:zDe,controlAdapterAddedFromImage:bE,controlAdapterRemoved:jDe,controlAdapterImageChanged:jl,controlAdapterProcessedImageChanged:_E,controlAdapterIsEnabledChanged:hm,controlAdapterModelChanged:s6,controlAdapterWeightChanged:VDe,controlAdapterBeginStepPctChanged:UDe,controlAdapterEndStepPctChanged:GDe,controlAdapterControlModeChanged:HDe,controlAdapterResizeModeChanged:qDe,controlAdapterProcessorParamsChanged:cie,controlAdapterProcessortTypeChanged:die,controlAdaptersReset:fie,controlAdapterAutoConfigToggled:l6,pendingControlImagesCleared:hie,controlAdapterModelCleared:wx}=GD.actions,pie=GD.reducer,gie=Br(yE,bE,vE),WDe={any:"Any","sd-1":"Stable Diffusion 1.x","sd-2":"Stable Diffusion 2.x",sdxl:"Stable Diffusion XL","sdxl-refiner":"Stable Diffusion XL Refiner"},KDe={any:"Any","sd-1":"SD1","sd-2":"SD2",sdxl:"SDXL","sdxl-refiner":"SDXLR"},mie={any:{maxClip:0,markers:[]},"sd-1":{maxClip:12,markers:[0,1,2,3,4,8,12]},"sd-2":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},sdxl:{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]},"sdxl-refiner":{maxClip:24,markers:[0,1,2,3,5,10,15,20,24]}},XDe={lycoris:"LyCORIS",diffusers:"Diffusers"},yie=0,sp=4294967295;var at;(function(e){e.assertEqual=i=>i;function t(i){}e.assertIs=t;function n(i){throw new Error}e.assertNever=n,e.arrayToEnum=i=>{const o={};for(const a of i)o[a]=a;return o},e.getValidEnumValues=i=>{const o=e.objectKeys(i).filter(s=>typeof i[i[s]]!="number"),a={};for(const s of o)a[s]=i[s];return e.objectValues(a)},e.objectValues=i=>e.objectKeys(i).map(function(o){return i[o]}),e.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const o=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&o.push(a);return o},e.find=(i,o)=>{for(const a of i)if(o(a))return a},e.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&isFinite(i)&&Math.floor(i)===i;function r(i,o=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(o)}e.joinValues=r,e.jsonStringifyReplacer=(i,o)=>typeof o=="bigint"?o.toString():o})(at||(at={}));var i5;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(i5||(i5={}));const he=at.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qs=e=>{switch(typeof e){case"undefined":return he.undefined;case"string":return he.string;case"number":return isNaN(e)?he.nan:he.number;case"boolean":return he.boolean;case"function":return he.function;case"bigint":return he.bigint;case"symbol":return he.symbol;case"object":return Array.isArray(e)?he.array:e===null?he.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?he.promise:typeof Map<"u"&&e instanceof Map?he.map:typeof Set<"u"&&e instanceof Set?he.set:typeof Date<"u"&&e instanceof Date?he.date:he.object;default:return he.unknown}},ie=at.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),vie=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:");class Io extends Error{constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){const n=t||function(o){return o.message},r={_errors:[]},i=o=>{for(const a of o.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(n(a));else{let s=r,l=0;for(;ln.message){const n={},r=[];for(const i of this.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}Io.create=e=>new Io(e);const Qp=(e,t)=>{let n;switch(e.code){case ie.invalid_type:e.received===he.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case ie.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,at.jsonStringifyReplacer)}`;break;case ie.unrecognized_keys:n=`Unrecognized key(s) in object: ${at.joinValues(e.keys,", ")}`;break;case ie.invalid_union:n="Invalid input";break;case ie.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${at.joinValues(e.options)}`;break;case ie.invalid_enum_value:n=`Invalid enum value. Expected ${at.joinValues(e.options)}, received '${e.received}'`;break;case ie.invalid_arguments:n="Invalid function arguments";break;case ie.invalid_return_type:n="Invalid function return type";break;case ie.invalid_date:n="Invalid date";break;case ie.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:at.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case ie.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case ie.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case ie.custom:n="Invalid input";break;case ie.invalid_intersection_types:n="Intersection results could not be merged";break;case ie.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case ie.not_finite:n="Number must be finite";break;default:n=t.defaultError,at.assertNever(e)}return{message:n}};let HD=Qp;function bie(e){HD=e}function Jv(){return HD}const e1=e=>{const{data:t,path:n,errorMaps:r,issueData:i}=e,o=[...n,...i.path||[]],a={...i,path:o};let s="";const l=r.filter(u=>!!u).slice().reverse();for(const u of l)s=u(a,{data:t,defaultError:s}).message;return{...i,path:o,message:i.message||s}},_ie=[];function me(e,t){const n=e1({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Jv(),Qp].filter(r=>!!r)});e.common.issues.push(n)}class _r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const i of n){if(i.status==="aborted")return Ne;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const i of n)r.push({key:await i.key,value:await i.value});return _r.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const i of n){const{key:o,value:a}=i;if(o.status==="aborted"||a.status==="aborted")return Ne;o.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[o.value]=a.value)}return{status:t.value,value:r}}}const Ne=Object.freeze({status:"aborted"}),qD=e=>({status:"dirty",value:e}),Dr=e=>({status:"valid",value:e}),o5=e=>e.status==="aborted",a5=e=>e.status==="dirty",Yp=e=>e.status==="valid",t1=e=>typeof Promise<"u"&&e instanceof Promise;var ke;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(ke||(ke={}));class Sa{constructor(t,n,r,i){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const u6=(e,t)=>{if(Yp(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new Io(e.common.issues);return this._error=n,this._error}}};function Le(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,s)=>a.code!=="invalid_type"?{message:s.defaultError}:typeof s.data>"u"?{message:r??s.defaultError}:{message:n??s.defaultError},description:i}}class Fe{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Qs(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Qs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new _r,ctx:{common:t.parent.common,data:t.data,parsedType:Qs(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(t1(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){var r;const i={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qs(t)},o=this._parseSync({data:t,path:i.path,parent:i});return u6(i,o)}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Qs(t)},i=this._parse({data:t,path:r.path,parent:r}),o=await(t1(i)?i:Promise.resolve(i));return u6(r,o)}refine(t,n){const r=i=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(i):n;return this._refinement((i,o)=>{const a=t(i),s=()=>o.addIssue({code:ie.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(s(),!1)):a?!0:(s(),!1)})}refinement(t,n){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof n=="function"?n(r,i):n),!1))}_refinement(t){return new No({schema:this,typeName:Me.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return ns.create(this,this._def)}nullable(){return Qu.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mo.create(this,this._def)}promise(){return cf.create(this,this._def)}or(t){return tg.create([this,t],this._def)}and(t){return ng.create(this,t,this._def)}transform(t){return new No({...Le(this._def),schema:this,typeName:Me.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new sg({...Le(this._def),innerType:this,defaultValue:n,typeName:Me.ZodDefault})}brand(){return new KD({typeName:Me.ZodBranded,type:this,...Le(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new o1({...Le(this._def),innerType:this,catchValue:n,typeName:Me.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return pm.create(this,t)}readonly(){return s1.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Sie=/^c[^\s-]{8,}$/i,xie=/^[a-z][a-z0-9]*$/,wie=/[0-9A-HJKMNP-TV-Z]{26}/,Cie=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Eie=/^([A-Z0-9_+-]+\.?)*[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Aie=/^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u,Tie=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,Pie=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,kie=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Iie(e,t){return!!((t==="v4"||!t)&&Tie.test(e)||(t==="v6"||!t)&&Pie.test(e))}class Eo extends Fe{constructor(){super(...arguments),this._regex=(t,n,r)=>this.refinement(i=>t.test(i),{validation:n,code:ie.invalid_string,...ke.errToObj(r)}),this.nonempty=t=>this.min(1,ke.errToObj(t)),this.trim=()=>new Eo({...this._def,checks:[...this._def.checks,{kind:"trim"}]}),this.toLowerCase=()=>new Eo({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]}),this.toUpperCase=()=>new Eo({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==he.string){const o=this._getOrReturnCtx(t);return me(o,{code:ie.invalid_type,expected:he.string,received:o.parsedType}),Ne}const r=new _r;let i;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(i=this._getOrReturnCtx(t,i),me(i,{code:ie.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){const a=t.data.length>o.value,s=t.data.length"u"?null:t==null?void 0:t.precision,offset:(n=t==null?void 0:t.offset)!==null&&n!==void 0?n:!1,...ke.errToObj(t==null?void 0:t.message)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ke.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...ke.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ke.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ke.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ke.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ke.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ke.errToObj(n)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new Eo({checks:[],typeName:Me.ZodString,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Le(e)})};function Mie(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=n>r?n:r,o=parseInt(e.toFixed(i).replace(".","")),a=parseInt(t.toFixed(i).replace(".",""));return o%a/Math.pow(10,i)}class Cl extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==he.number){const o=this._getOrReturnCtx(t);return me(o,{code:ie.invalid_type,expected:he.number,received:o.parsedType}),Ne}let r;const i=new _r;for(const o of this._def.checks)o.kind==="int"?at.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),me(r,{code:ie.invalid_type,expected:"integer",received:"float",message:o.message}),i.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),me(r,{code:ie.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),i.dirty()):o.kind==="multipleOf"?Mie(t.data,o.value)!==0&&(r=this._getOrReturnCtx(t,r),me(r,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),me(r,{code:ie.not_finite,message:o.message}),i.dirty()):at.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ke.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ke.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ke.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ke.toString(n))}setLimit(t,n,r,i){return new Cl({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(t){return new Cl({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ke.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ke.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ke.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ke.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ke.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ke.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ke.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ke.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ke.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&at.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.valuenew Cl({checks:[],typeName:Me.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class El extends Fe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==he.bigint){const o=this._getOrReturnCtx(t);return me(o,{code:ie.invalid_type,expected:he.bigint,received:o.parsedType}),Ne}let r;const i=new _r;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(r=this._getOrReturnCtx(t,r),me(r,{code:ie.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),i.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),me(r,{code:ie.not_multiple_of,multipleOf:o.value,message:o.message}),i.dirty()):at.assertNever(o);return{status:i.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ke.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ke.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ke.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ke.toString(n))}setLimit(t,n,r,i){return new El({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ke.toString(i)}]})}_addCheck(t){return new El({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ke.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ke.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ke.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ke.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ke.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value{var t;return new El({checks:[],typeName:Me.ZodBigInt,coerce:(t=e==null?void 0:e.coerce)!==null&&t!==void 0?t:!1,...Le(e)})};class Zp extends Fe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==he.boolean){const r=this._getOrReturnCtx(t);return me(r,{code:ie.invalid_type,expected:he.boolean,received:r.parsedType}),Ne}return Dr(t.data)}}Zp.create=e=>new Zp({typeName:Me.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Le(e)});class Ku extends Fe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==he.date){const o=this._getOrReturnCtx(t);return me(o,{code:ie.invalid_type,expected:he.date,received:o.parsedType}),Ne}if(isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return me(o,{code:ie.invalid_date}),Ne}const r=new _r;let i;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(i=this._getOrReturnCtx(t,i),me(i,{code:ie.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):at.assertNever(o);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ku({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ke.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ke.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Ku({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:Me.ZodDate,...Le(e)});class n1 extends Fe{_parse(t){if(this._getType(t)!==he.symbol){const r=this._getOrReturnCtx(t);return me(r,{code:ie.invalid_type,expected:he.symbol,received:r.parsedType}),Ne}return Dr(t.data)}}n1.create=e=>new n1({typeName:Me.ZodSymbol,...Le(e)});class Jp extends Fe{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return me(r,{code:ie.invalid_type,expected:he.undefined,received:r.parsedType}),Ne}return Dr(t.data)}}Jp.create=e=>new Jp({typeName:Me.ZodUndefined,...Le(e)});class eg extends Fe{_parse(t){if(this._getType(t)!==he.null){const r=this._getOrReturnCtx(t);return me(r,{code:ie.invalid_type,expected:he.null,received:r.parsedType}),Ne}return Dr(t.data)}}eg.create=e=>new eg({typeName:Me.ZodNull,...Le(e)});class uf extends Fe{constructor(){super(...arguments),this._any=!0}_parse(t){return Dr(t.data)}}uf.create=e=>new uf({typeName:Me.ZodAny,...Le(e)});class $u extends Fe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Dr(t.data)}}$u.create=e=>new $u({typeName:Me.ZodUnknown,...Le(e)});class ps extends Fe{_parse(t){const n=this._getOrReturnCtx(t);return me(n,{code:ie.invalid_type,expected:he.never,received:n.parsedType}),Ne}}ps.create=e=>new ps({typeName:Me.ZodNever,...Le(e)});class r1 extends Fe{_parse(t){if(this._getType(t)!==he.undefined){const r=this._getOrReturnCtx(t);return me(r,{code:ie.invalid_type,expected:he.void,received:r.parsedType}),Ne}return Dr(t.data)}}r1.create=e=>new r1({typeName:Me.ZodVoid,...Le(e)});class Mo extends Fe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),i=this._def;if(n.parsedType!==he.array)return me(n,{code:ie.invalid_type,expected:he.array,received:n.parsedType}),Ne;if(i.exactLength!==null){const a=n.data.length>i.exactLength.value,s=n.data.lengthi.maxLength.value&&(me(n,{code:ie.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((a,s)=>i.type._parseAsync(new Sa(n,a,n.path,s)))).then(a=>_r.mergeArray(r,a));const o=[...n.data].map((a,s)=>i.type._parseSync(new Sa(n,a,n.path,s)));return _r.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new Mo({...this._def,minLength:{value:t,message:ke.toString(n)}})}max(t,n){return new Mo({...this._def,maxLength:{value:t,message:ke.toString(n)}})}length(t,n){return new Mo({...this._def,exactLength:{value:t,message:ke.toString(n)}})}nonempty(t){return this.min(1,t)}}Mo.create=(e,t)=>new Mo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Me.ZodArray,...Le(t)});function zc(e){if(e instanceof Qt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=ns.create(zc(r))}return new Qt({...e._def,shape:()=>t})}else return e instanceof Mo?new Mo({...e._def,type:zc(e.element)}):e instanceof ns?ns.create(zc(e.unwrap())):e instanceof Qu?Qu.create(zc(e.unwrap())):e instanceof xa?xa.create(e.items.map(t=>zc(t))):e}class Qt extends Fe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=at.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(t){if(this._getType(t)!==he.object){const u=this._getOrReturnCtx(t);return me(u,{code:ie.invalid_type,expected:he.object,received:u.parsedType}),Ne}const{status:r,ctx:i}=this._processInputParams(t),{shape:o,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof ps&&this._def.unknownKeys==="strip"))for(const u in i.data)a.includes(u)||s.push(u);const l=[];for(const u of a){const c=o[u],d=i.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Sa(i,d,i.path,u)),alwaysSet:u in i.data})}if(this._def.catchall instanceof ps){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of s)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(u==="strict")s.length>0&&(me(i,{code:ie.unrecognized_keys,keys:s}),r.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of s){const d=i.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Sa(i,d,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const u=[];for(const c of l){const d=await c.key;u.push({key:d,value:await c.value,alwaysSet:c.alwaysSet})}return u}).then(u=>_r.mergeObjectSync(r,u)):_r.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ke.errToObj,new Qt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{var i,o,a,s;const l=(a=(o=(i=this._def).errorMap)===null||o===void 0?void 0:o.call(i,n,r).message)!==null&&a!==void 0?a:r.defaultError;return n.code==="unrecognized_keys"?{message:(s=ke.errToObj(t).message)!==null&&s!==void 0?s:l}:{message:l}}}:{}})}strip(){return new Qt({...this._def,unknownKeys:"strip"})}passthrough(){return new Qt({...this._def,unknownKeys:"passthrough"})}extend(t){return new Qt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Qt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:Me.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Qt({...this._def,catchall:t})}pick(t){const n={};return at.objectKeys(t).forEach(r=>{t[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new Qt({...this._def,shape:()=>n})}omit(t){const n={};return at.objectKeys(this.shape).forEach(r=>{t[r]||(n[r]=this.shape[r])}),new Qt({...this._def,shape:()=>n})}deepPartial(){return zc(this)}partial(t){const n={};return at.objectKeys(this.shape).forEach(r=>{const i=this.shape[r];t&&!t[r]?n[r]=i:n[r]=i.optional()}),new Qt({...this._def,shape:()=>n})}required(t){const n={};return at.objectKeys(this.shape).forEach(r=>{if(t&&!t[r])n[r]=this.shape[r];else{let o=this.shape[r];for(;o instanceof ns;)o=o._def.innerType;n[r]=o}}),new Qt({...this._def,shape:()=>n})}keyof(){return WD(at.objectKeys(this.shape))}}Qt.create=(e,t)=>new Qt({shape:()=>e,unknownKeys:"strip",catchall:ps.create(),typeName:Me.ZodObject,...Le(t)});Qt.strictCreate=(e,t)=>new Qt({shape:()=>e,unknownKeys:"strict",catchall:ps.create(),typeName:Me.ZodObject,...Le(t)});Qt.lazycreate=(e,t)=>new Qt({shape:e,unknownKeys:"strip",catchall:ps.create(),typeName:Me.ZodObject,...Le(t)});class tg extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function i(o){for(const s of o)if(s.result.status==="valid")return s.result;for(const s of o)if(s.result.status==="dirty")return n.common.issues.push(...s.ctx.common.issues),s.result;const a=o.map(s=>new Io(s.ctx.common.issues));return me(n,{code:ie.invalid_union,unionErrors:a}),Ne}if(n.common.async)return Promise.all(r.map(async o=>{const a={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:a}),ctx:a}})).then(i);{let o;const a=[];for(const l of r){const u={...n,common:{...n.common,issues:[]},parent:null},c=l._parseSync({data:n.data,path:n.path,parent:u});if(c.status==="valid")return c;c.status==="dirty"&&!o&&(o={result:c,ctx:u}),u.common.issues.length&&a.push(u.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const s=a.map(l=>new Io(l));return me(n,{code:ie.invalid_union,unionErrors:s}),Ne}}get options(){return this._def.options}}tg.create=(e,t)=>new tg({options:e,typeName:Me.ZodUnion,...Le(t)});const Dy=e=>e instanceof ig?Dy(e.schema):e instanceof No?Dy(e.innerType()):e instanceof og?[e.value]:e instanceof Al?e.options:e instanceof ag?Object.keys(e.enum):e instanceof sg?Dy(e._def.innerType):e instanceof Jp?[void 0]:e instanceof eg?[null]:null;class Jb extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.object)return me(n,{code:ie.invalid_type,expected:he.object,received:n.parsedType}),Ne;const r=this.discriminator,i=n.data[r],o=this.optionsMap.get(i);return o?n.common.async?o._parseAsync({data:n.data,path:n.path,parent:n}):o._parseSync({data:n.data,path:n.path,parent:n}):(me(n,{code:ie.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Ne)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const i=new Map;for(const o of n){const a=Dy(o.shape[t]);if(!a)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const s of a){if(i.has(s))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(s)}`);i.set(s,o)}}return new Jb({typeName:Me.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...Le(r)})}}function s5(e,t){const n=Qs(e),r=Qs(t);if(e===t)return{valid:!0,data:e};if(n===he.object&&r===he.object){const i=at.objectKeys(t),o=at.objectKeys(e).filter(s=>i.indexOf(s)!==-1),a={...e,...t};for(const s of o){const l=s5(e[s],t[s]);if(!l.valid)return{valid:!1};a[s]=l.data}return{valid:!0,data:a}}else if(n===he.array&&r===he.array){if(e.length!==t.length)return{valid:!1};const i=[];for(let o=0;o{if(o5(o)||o5(a))return Ne;const s=s5(o.value,a.value);return s.valid?((a5(o)||a5(a))&&n.dirty(),{status:n.value,value:s.data}):(me(r,{code:ie.invalid_intersection_types}),Ne)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([o,a])=>i(o,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ng.create=(e,t,n)=>new ng({left:e,right:t,typeName:Me.ZodIntersection,...Le(n)});class xa extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.array)return me(r,{code:ie.invalid_type,expected:he.array,received:r.parsedType}),Ne;if(r.data.lengththis._def.items.length&&(me(r,{code:ie.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...r.data].map((a,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new Sa(r,a,r.path,s)):null}).filter(a=>!!a);return r.common.async?Promise.all(o).then(a=>_r.mergeArray(n,a)):_r.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new xa({...this._def,rest:t})}}xa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new xa({items:e,typeName:Me.ZodTuple,rest:null,...Le(t)})};class rg extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.object)return me(r,{code:ie.invalid_type,expected:he.object,received:r.parsedType}),Ne;const i=[],o=this._def.keyType,a=this._def.valueType;for(const s in r.data)i.push({key:o._parse(new Sa(r,s,r.path,s)),value:a._parse(new Sa(r,r.data[s],r.path,s))});return r.common.async?_r.mergeObjectAsync(n,i):_r.mergeObjectSync(n,i)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof Fe?new rg({keyType:t,valueType:n,typeName:Me.ZodRecord,...Le(r)}):new rg({keyType:Eo.create(),valueType:t,typeName:Me.ZodRecord,...Le(n)})}}class i1 extends Fe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.map)return me(r,{code:ie.invalid_type,expected:he.map,received:r.parsedType}),Ne;const i=this._def.keyType,o=this._def.valueType,a=[...r.data.entries()].map(([s,l],u)=>({key:i._parse(new Sa(r,s,r.path,[u,"key"])),value:o._parse(new Sa(r,l,r.path,[u,"value"]))}));if(r.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of a){const u=await l.key,c=await l.value;if(u.status==="aborted"||c.status==="aborted")return Ne;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}})}else{const s=new Map;for(const l of a){const u=l.key,c=l.value;if(u.status==="aborted"||c.status==="aborted")return Ne;(u.status==="dirty"||c.status==="dirty")&&n.dirty(),s.set(u.value,c.value)}return{status:n.value,value:s}}}}i1.create=(e,t,n)=>new i1({valueType:t,keyType:e,typeName:Me.ZodMap,...Le(n)});class Xu extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==he.set)return me(r,{code:ie.invalid_type,expected:he.set,received:r.parsedType}),Ne;const i=this._def;i.minSize!==null&&r.data.sizei.maxSize.value&&(me(r,{code:ie.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),n.dirty());const o=this._def.valueType;function a(l){const u=new Set;for(const c of l){if(c.status==="aborted")return Ne;c.status==="dirty"&&n.dirty(),u.add(c.value)}return{status:n.value,value:u}}const s=[...r.data.values()].map((l,u)=>o._parse(new Sa(r,l,r.path,u)));return r.common.async?Promise.all(s).then(l=>a(l)):a(s)}min(t,n){return new Xu({...this._def,minSize:{value:t,message:ke.toString(n)}})}max(t,n){return new Xu({...this._def,maxSize:{value:t,message:ke.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}Xu.create=(e,t)=>new Xu({valueType:e,minSize:null,maxSize:null,typeName:Me.ZodSet,...Le(t)});class Id extends Fe{constructor(){super(...arguments),this.validate=this.implement}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.function)return me(n,{code:ie.invalid_type,expected:he.function,received:n.parsedType}),Ne;function r(s,l){return e1({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Jv(),Qp].filter(u=>!!u),issueData:{code:ie.invalid_arguments,argumentsError:l}})}function i(s,l){return e1({data:s,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Jv(),Qp].filter(u=>!!u),issueData:{code:ie.invalid_return_type,returnTypeError:l}})}const o={errorMap:n.common.contextualErrorMap},a=n.data;if(this._def.returns instanceof cf){const s=this;return Dr(async function(...l){const u=new Io([]),c=await s._def.args.parseAsync(l,o).catch(h=>{throw u.addIssue(r(l,h)),u}),d=await Reflect.apply(a,this,c);return await s._def.returns._def.type.parseAsync(d,o).catch(h=>{throw u.addIssue(i(d,h)),u})})}else{const s=this;return Dr(function(...l){const u=s._def.args.safeParse(l,o);if(!u.success)throw new Io([r(l,u.error)]);const c=Reflect.apply(a,this,u.data),d=s._def.returns.safeParse(c,o);if(!d.success)throw new Io([i(c,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new Id({...this._def,args:xa.create(t).rest($u.create())})}returns(t){return new Id({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,n,r){return new Id({args:t||xa.create([]).rest($u.create()),returns:n||$u.create(),typeName:Me.ZodFunction,...Le(r)})}}class ig extends Fe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}ig.create=(e,t)=>new ig({getter:e,typeName:Me.ZodLazy,...Le(t)});class og extends Fe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return me(n,{received:n.data,code:ie.invalid_literal,expected:this._def.value}),Ne}return{status:"valid",value:t.data}}get value(){return this._def.value}}og.create=(e,t)=>new og({value:e,typeName:Me.ZodLiteral,...Le(t)});function WD(e,t){return new Al({values:e,typeName:Me.ZodEnum,...Le(t)})}class Al extends Fe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return me(n,{expected:at.joinValues(r),received:n.parsedType,code:ie.invalid_type}),Ne}if(this._def.values.indexOf(t.data)===-1){const n=this._getOrReturnCtx(t),r=this._def.values;return me(n,{received:n.data,code:ie.invalid_enum_value,options:r}),Ne}return Dr(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t){return Al.create(t)}exclude(t){return Al.create(this.options.filter(n=>!t.includes(n)))}}Al.create=WD;class ag extends Fe{_parse(t){const n=at.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==he.string&&r.parsedType!==he.number){const i=at.objectValues(n);return me(r,{expected:at.joinValues(i),received:r.parsedType,code:ie.invalid_type}),Ne}if(n.indexOf(t.data)===-1){const i=at.objectValues(n);return me(r,{received:r.data,code:ie.invalid_enum_value,options:i}),Ne}return Dr(t.data)}get enum(){return this._def.values}}ag.create=(e,t)=>new ag({values:e,typeName:Me.ZodNativeEnum,...Le(t)});class cf extends Fe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==he.promise&&n.common.async===!1)return me(n,{code:ie.invalid_type,expected:he.promise,received:n.parsedType}),Ne;const r=n.parsedType===he.promise?n.data:Promise.resolve(n.data);return Dr(r.then(i=>this._def.type.parseAsync(i,{path:n.path,errorMap:n.common.contextualErrorMap})))}}cf.create=(e,t)=>new cf({type:e,typeName:Me.ZodPromise,...Le(t)});class No extends Fe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Me.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,o={addIssue:a=>{me(r,a),a.fatal?n.abort():n.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),i.type==="preprocess"){const a=i.transform(r.data,o);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(a).then(s=>this._def.schema._parseAsync({data:s,path:r.path,parent:r})):this._def.schema._parseSync({data:a,path:r.path,parent:r})}if(i.type==="refinement"){const a=s=>{const l=i.refinement(s,o);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(r.common.async===!1){const s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Ne:(s.status==="dirty"&&n.dirty(),a(s.value),{status:n.value,value:s.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>s.status==="aborted"?Ne:(s.status==="dirty"&&n.dirty(),a(s.value).then(()=>({status:n.value,value:s.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Yp(a))return a;const s=i.transform(a.value,o);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:s}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Yp(a)?Promise.resolve(i.transform(a.value,o)).then(s=>({status:n.value,value:s})):a);at.assertNever(i)}}No.create=(e,t,n)=>new No({schema:e,typeName:Me.ZodEffects,effect:t,...Le(n)});No.createWithPreprocess=(e,t,n)=>new No({schema:t,effect:{type:"preprocess",transform:e},typeName:Me.ZodEffects,...Le(n)});class ns extends Fe{_parse(t){return this._getType(t)===he.undefined?Dr(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}ns.create=(e,t)=>new ns({innerType:e,typeName:Me.ZodOptional,...Le(t)});class Qu extends Fe{_parse(t){return this._getType(t)===he.null?Dr(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Qu.create=(e,t)=>new Qu({innerType:e,typeName:Me.ZodNullable,...Le(t)});class sg extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===he.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}sg.create=(e,t)=>new sg({innerType:e,typeName:Me.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Le(t)});class o1 extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return t1(i)?i.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Io(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new Io(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}o1.create=(e,t)=>new o1({innerType:e,typeName:Me.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Le(t)});class a1 extends Fe{_parse(t){if(this._getType(t)!==he.nan){const r=this._getOrReturnCtx(t);return me(r,{code:ie.invalid_type,expected:he.nan,received:r.parsedType}),Ne}return{status:"valid",value:t.data}}}a1.create=e=>new a1({typeName:Me.ZodNaN,...Le(e)});const Rie=Symbol("zod_brand");class KD extends Fe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class pm extends Fe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Ne:o.status==="dirty"?(n.dirty(),qD(o.value)):this._def.out._parseAsync({data:o.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Ne:i.status==="dirty"?(n.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,n){return new pm({in:t,out:n,typeName:Me.ZodPipeline})}}class s1 extends Fe{_parse(t){const n=this._def.innerType._parse(t);return Yp(n)&&(n.value=Object.freeze(n.value)),n}}s1.create=(e,t)=>new s1({innerType:e,typeName:Me.ZodReadonly,...Le(t)});const XD=(e,t={},n)=>e?uf.create().superRefine((r,i)=>{var o,a;if(!e(r)){const s=typeof t=="function"?t(r):typeof t=="string"?{message:t}:t,l=(a=(o=s.fatal)!==null&&o!==void 0?o:n)!==null&&a!==void 0?a:!0,u=typeof s=="string"?{message:s}:s;i.addIssue({code:"custom",...u,fatal:l})}}):uf.create(),Oie={object:Qt.lazycreate};var Me;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(Me||(Me={}));const $ie=(e,t={message:`Input not instance of ${e.name}`})=>XD(n=>n instanceof e,t),QD=Eo.create,YD=Cl.create,Nie=a1.create,Die=El.create,ZD=Zp.create,Lie=Ku.create,Fie=n1.create,Bie=Jp.create,zie=eg.create,jie=uf.create,Vie=$u.create,Uie=ps.create,Gie=r1.create,Hie=Mo.create,qie=Qt.create,Wie=Qt.strictCreate,Kie=tg.create,Xie=Jb.create,Qie=ng.create,Yie=xa.create,Zie=rg.create,Jie=i1.create,eoe=Xu.create,toe=Id.create,noe=ig.create,roe=og.create,ioe=Al.create,ooe=ag.create,aoe=cf.create,c6=No.create,soe=ns.create,loe=Qu.create,uoe=No.createWithPreprocess,coe=pm.create,doe=()=>QD().optional(),foe=()=>YD().optional(),hoe=()=>ZD().optional(),poe={string:e=>Eo.create({...e,coerce:!0}),number:e=>Cl.create({...e,coerce:!0}),boolean:e=>Zp.create({...e,coerce:!0}),bigint:e=>El.create({...e,coerce:!0}),date:e=>Ku.create({...e,coerce:!0})},goe=Ne;var F=Object.freeze({__proto__:null,defaultErrorMap:Qp,setErrorMap:bie,getErrorMap:Jv,makeIssue:e1,EMPTY_PATH:_ie,addIssueToContext:me,ParseStatus:_r,INVALID:Ne,DIRTY:qD,OK:Dr,isAborted:o5,isDirty:a5,isValid:Yp,isAsync:t1,get util(){return at},get objectUtil(){return i5},ZodParsedType:he,getParsedType:Qs,ZodType:Fe,ZodString:Eo,ZodNumber:Cl,ZodBigInt:El,ZodBoolean:Zp,ZodDate:Ku,ZodSymbol:n1,ZodUndefined:Jp,ZodNull:eg,ZodAny:uf,ZodUnknown:$u,ZodNever:ps,ZodVoid:r1,ZodArray:Mo,ZodObject:Qt,ZodUnion:tg,ZodDiscriminatedUnion:Jb,ZodIntersection:ng,ZodTuple:xa,ZodRecord:rg,ZodMap:i1,ZodSet:Xu,ZodFunction:Id,ZodLazy:ig,ZodLiteral:og,ZodEnum:Al,ZodNativeEnum:ag,ZodPromise:cf,ZodEffects:No,ZodTransformer:No,ZodOptional:ns,ZodNullable:Qu,ZodDefault:sg,ZodCatch:o1,ZodNaN:a1,BRAND:Rie,ZodBranded:KD,ZodPipeline:pm,ZodReadonly:s1,custom:XD,Schema:Fe,ZodSchema:Fe,late:Oie,get ZodFirstPartyTypeKind(){return Me},coerce:poe,any:jie,array:Hie,bigint:Die,boolean:ZD,date:Lie,discriminatedUnion:Xie,effect:c6,enum:ioe,function:toe,instanceof:$ie,intersection:Qie,lazy:noe,literal:roe,map:Jie,nan:Nie,nativeEnum:ooe,never:Uie,null:zie,nullable:loe,number:YD,object:qie,oboolean:hoe,onumber:foe,optional:soe,ostring:doe,pipeline:coe,preprocess:uoe,promise:aoe,record:Zie,set:eoe,strictObject:Wie,string:QD,symbol:Fie,transformer:c6,tuple:Yie,undefined:Bie,union:Kie,unknown:Vie,void:Gie,NEVER:goe,ZodIssueCode:ie,quotelessJson:vie,ZodError:Io});const moe=F.string(),QDe=e=>moe.safeParse(e).success,yoe=F.string(),YDe=e=>yoe.safeParse(e).success,voe=F.string(),ZDe=e=>voe.safeParse(e).success,boe=F.string(),JDe=e=>boe.safeParse(e).success,_oe=F.number().int().min(1),eLe=e=>_oe.safeParse(e).success,Soe=F.number().min(1),tLe=e=>Soe.safeParse(e).success,JD=F.enum(["euler","deis","ddim","ddpm","dpmpp_2s","dpmpp_2m","dpmpp_2m_sde","dpmpp_sde","heun","kdpm_2","lms","pndm","unipc","euler_k","dpmpp_2s_k","dpmpp_2m_k","dpmpp_2m_sde_k","dpmpp_sde_k","heun_k","lms_k","euler_a","kdpm_2_a"]),nLe=e=>JD.safeParse(e).success,rLe={euler:"Euler",deis:"DEIS",ddim:"DDIM",ddpm:"DDPM",dpmpp_sde:"DPM++ SDE",dpmpp_2s:"DPM++ 2S",dpmpp_2m:"DPM++ 2M",dpmpp_2m_sde:"DPM++ 2M SDE",heun:"Heun",kdpm_2:"KDPM 2",lms:"LMS",pndm:"PNDM",unipc:"UniPC",euler_k:"Euler Karras",dpmpp_sde_k:"DPM++ SDE Karras",dpmpp_2s_k:"DPM++ 2S Karras",dpmpp_2m_k:"DPM++ 2M Karras",dpmpp_2m_sde_k:"DPM++ 2M SDE Karras",heun_k:"Heun Karras",lms_k:"LMS Karras",euler_a:"Euler Ancestral",kdpm_2_a:"KDPM 2 Ancestral"},xoe=F.number().int().min(0).max(sp),iLe=e=>xoe.safeParse(e).success,eL=F.number().multipleOf(8).min(64),oLe=e=>eL.safeParse(e).success,tL=F.number().multipleOf(8).min(64),aLe=e=>tL.safeParse(e).success;F.tuple([eL,tL]);const Vl=F.enum(["any","sd-1","sd-2","sdxl","sdxl-refiner"]),e_=F.object({model_name:F.string().min(1),base_model:Vl,model_type:F.literal("main")}),sLe=e=>e_.safeParse(e).success,SE=F.object({model_name:F.string().min(1),base_model:F.literal("sdxl-refiner"),model_type:F.literal("main")}),lLe=e=>SE.safeParse(e).success,nL=F.object({model_name:F.string().min(1),base_model:Vl,model_type:F.literal("onnx")}),gm=F.union([e_,nL]),woe=F.object({model_name:F.string().min(1),base_model:Vl}),Coe=F.object({model_name:F.string().min(1),base_model:Vl}),uLe=e=>Coe.safeParse(e).success,Eoe=F.object({model_name:F.string().min(1),base_model:Vl}),cLe=e=>Eoe.safeParse(e).success,Aoe=F.object({model_name:F.string().min(1),base_model:Vl}),Toe=F.object({model_name:F.string().min(1),base_model:Vl}),dLe=e=>Toe.safeParse(e).success,fLe=e=>Aoe.safeParse(e).success,Poe=F.number().min(0).max(1),hLe=e=>Poe.safeParse(e).success;F.enum(["fp16","fp32"]);const koe=F.number().min(1).max(10),pLe=e=>koe.safeParse(e).success,Ioe=F.number().min(1).max(10),gLe=e=>Ioe.safeParse(e).success,Moe=F.number().min(0).max(1),mLe=e=>Moe.safeParse(e).success;F.enum(["box","gaussian"]);F.enum(["unmasked","mask","edge"]);const xE={hrfHeight:64,hrfWidth:64,hrfStrength:.75,hrfEnabled:!1,cfgScale:7.5,height:512,img2imgStrength:.75,infillMethod:"patchmatch",iterations:1,perlin:0,positivePrompt:"",negativePrompt:"",scheduler:"euler",maskBlur:16,maskBlurMethod:"box",canvasCoherenceMode:"unmasked",canvasCoherenceSteps:20,canvasCoherenceStrength:.3,seed:0,seedWeights:"",shouldFitToWidthHeight:!0,shouldGenerateVariations:!1,shouldRandomizeSeed:!0,steps:50,threshold:0,infillTileSize:32,infillPatchmatchDownscaleSize:1,variationAmount:.1,width:512,shouldUseSymmetry:!1,horizontalSymmetrySteps:0,verticalSymmetrySteps:0,model:null,vae:null,vaePrecision:"fp32",seamlessXAxis:!1,seamlessYAxis:!1,clipSkip:0,shouldUseCpuNoise:!0,shouldShowAdvancedOptions:!1,aspectRatio:null,shouldLockAspectRatio:!1},Roe=xE,rL=qt({name:"generation",initialState:Roe,reducers:{setPositivePrompt:(e,t)=>{e.positivePrompt=t.payload},setNegativePrompt:(e,t)=>{e.negativePrompt=t.payload},setIterations:(e,t)=>{e.iterations=t.payload},setSteps:(e,t)=>{e.steps=t.payload},clampSymmetrySteps:e=>{e.horizontalSymmetrySteps=rl(e.horizontalSymmetrySteps,0,e.steps),e.verticalSymmetrySteps=rl(e.verticalSymmetrySteps,0,e.steps)},setCfgScale:(e,t)=>{e.cfgScale=t.payload},setThreshold:(e,t)=>{e.threshold=t.payload},setPerlin:(e,t)=>{e.perlin=t.payload},setHeight:(e,t)=>{e.height=t.payload},setWidth:(e,t)=>{e.width=t.payload},toggleSize:e=>{const[t,n]=[e.width,e.height];e.width=n,e.height=t},setScheduler:(e,t)=>{e.scheduler=t.payload},setSeed:(e,t)=>{e.seed=t.payload,e.shouldRandomizeSeed=!1},setImg2imgStrength:(e,t)=>{e.img2imgStrength=t.payload},setSeamlessXAxis:(e,t)=>{e.seamlessXAxis=t.payload},setSeamlessYAxis:(e,t)=>{e.seamlessYAxis=t.payload},setShouldFitToWidthHeight:(e,t)=>{e.shouldFitToWidthHeight=t.payload},resetSeed:e=>{e.seed=-1},setShouldGenerateVariations:(e,t)=>{e.shouldGenerateVariations=t.payload},setVariationAmount:(e,t)=>{e.variationAmount=t.payload},setSeedWeights:(e,t)=>{e.seedWeights=t.payload,e.shouldGenerateVariations=!0,e.variationAmount=0},resetParametersState:e=>({...e,...xE}),setShouldRandomizeSeed:(e,t)=>{e.shouldRandomizeSeed=t.payload},clearInitialImage:e=>{e.initialImage=void 0},setMaskBlur:(e,t)=>{e.maskBlur=t.payload},setMaskBlurMethod:(e,t)=>{e.maskBlurMethod=t.payload},setCanvasCoherenceMode:(e,t)=>{e.canvasCoherenceMode=t.payload},setCanvasCoherenceSteps:(e,t)=>{e.canvasCoherenceSteps=t.payload},setCanvasCoherenceStrength:(e,t)=>{e.canvasCoherenceStrength=t.payload},setInfillMethod:(e,t)=>{e.infillMethod=t.payload},setInfillTileSize:(e,t)=>{e.infillTileSize=t.payload},setInfillPatchmatchDownscaleSize:(e,t)=>{e.infillPatchmatchDownscaleSize=t.payload},setShouldUseSymmetry:(e,t)=>{e.shouldUseSymmetry=t.payload},setHorizontalSymmetrySteps:(e,t)=>{e.horizontalSymmetrySteps=t.payload},setVerticalSymmetrySteps:(e,t)=>{e.verticalSymmetrySteps=t.payload},initialImageChanged:(e,t)=>{const{image_name:n,width:r,height:i}=t.payload;e.initialImage={imageName:n,width:r,height:i}},modelChanged:(e,t)=>{if(e.model=t.payload,e.model===null)return;const{maxClip:n}=mie[e.model.base_model];e.clipSkip=rl(e.clipSkip,0,n)},vaeSelected:(e,t)=>{e.vae=t.payload},vaePrecisionChanged:(e,t)=>{e.vaePrecision=t.payload},setClipSkip:(e,t)=>{e.clipSkip=t.payload},setHrfHeight:(e,t)=>{e.hrfHeight=t.payload},setHrfWidth:(e,t)=>{e.hrfWidth=t.payload},setHrfStrength:(e,t)=>{e.hrfStrength=t.payload},setHrfEnabled:(e,t)=>{e.hrfEnabled=t.payload},shouldUseCpuNoiseChanged:(e,t)=>{e.shouldUseCpuNoise=t.payload},setAspectRatio:(e,t)=>{const n=t.payload;e.aspectRatio=n,n&&(e.height=fi(e.width/n,8))},setShouldLockAspectRatio:(e,t)=>{e.shouldLockAspectRatio=t.payload}},extraReducers:e=>{e.addCase(Ere,(t,n)=>{var i;const r=(i=n.payload.sd)==null?void 0:i.defaultModel;if(r&&!t.model){const[o,a,s]=r.split("/"),l=e_.safeParse({model_name:s,base_model:o,model_type:a});l.success&&(t.model=l.data)}}),e.addMatcher(gie,(t,n)=>{n.payload.type==="t2i_adapter"&&(t.width=fi(t.width,64),t.height=fi(t.height,64))})}}),{clampSymmetrySteps:yLe,clearInitialImage:wE,resetParametersState:vLe,resetSeed:bLe,setCfgScale:_Le,setWidth:d6,setHeight:f6,toggleSize:SLe,setImg2imgStrength:xLe,setInfillMethod:Ooe,setIterations:wLe,setPerlin:CLe,setPositivePrompt:$oe,setNegativePrompt:ELe,setScheduler:ALe,setMaskBlur:TLe,setMaskBlurMethod:PLe,setCanvasCoherenceMode:kLe,setCanvasCoherenceSteps:ILe,setCanvasCoherenceStrength:MLe,setSeed:RLe,setSeedWeights:OLe,setShouldFitToWidthHeight:$Le,setShouldGenerateVariations:NLe,setShouldRandomizeSeed:DLe,setSteps:LLe,setThreshold:FLe,setInfillTileSize:BLe,setInfillPatchmatchDownscaleSize:zLe,setVariationAmount:jLe,setShouldUseSymmetry:VLe,setHorizontalSymmetrySteps:ULe,setVerticalSymmetrySteps:GLe,initialImageChanged:t_,modelChanged:il,vaeSelected:iL,setSeamlessXAxis:HLe,setSeamlessYAxis:qLe,setClipSkip:WLe,setHrfHeight:KLe,setHrfWidth:XLe,setHrfStrength:QLe,setHrfEnabled:YLe,shouldUseCpuNoiseChanged:ZLe,setAspectRatio:Noe,setShouldLockAspectRatio:JLe,vaePrecisionChanged:eFe}=rL.actions,Doe=rL.reducer,y0=(e,t,n,r,i,o,a)=>{const s=Math.floor(e/2-(n+i/2)*a),l=Math.floor(t/2-(r+o/2)*a);return{x:s,y:l}},v0=(e,t,n,r,i=.95)=>{const o=e*i/n,a=t*i/r,s=Math.min(1,Math.min(o,a));return s||1},tFe=.999,nFe=.1,rFe=20,b0=.95,iFe=30,oFe=10,Loe=e=>({x:Math.floor(e.x),y:Math.floor(e.y)}),Ac=e=>{const{width:t,height:n}=e,r={width:t,height:n},i=512*512,o=t/n;let a=t*n,s=448;for(;a1?(r.width=s,r.height=fi(s/o,64)):o<1&&(r.height=s,r.width=fi(s*o,64)),a=r.width*r.height;return r},Foe=e=>({width:fi(e.width,64),height:fi(e.height,64)}),aFe=[{label:"Base",value:"base"},{label:"Mask",value:"mask"}],sFe=[{label:"None",value:"none"},{label:"Auto",value:"auto"},{label:"Manual",value:"manual"}],oL=e=>e.kind==="line"&&e.layer==="mask",lFe=e=>e.kind==="line"&&e.layer==="base",Boe=e=>e.kind==="image"&&e.layer==="base",uFe=e=>e.kind==="fillRect"&&e.layer==="base",cFe=e=>e.kind==="eraseRect"&&e.layer==="base",zoe=e=>e.kind==="line";let Er=[],Ta=(e,t)=>{let n=[],r={get(){return r.lc||r.listen(()=>{})(),r.value},l:t||0,lc:0,listen(i,o){return r.lc=n.push(i,o||r.l)/2,()=>{let a=n.indexOf(i);~a&&(n.splice(a,2),r.lc--,r.lc||r.off())}},notify(i){let o=!Er.length;for(let a=0;a(e.events=e.events||{},e.events[n+S0]||(e.events[n+S0]=r(i=>{e.events[n].reduceRight((o,a)=>(a(o),o),{shared:{},...i})})),e.events[n]=e.events[n]||[],e.events[n].push(t),()=>{let i=e.events[n],o=i.indexOf(t);i.splice(o,1),i.length||(delete e.events[n],e.events[n+S0](),delete e.events[n+S0])}),Uoe=1e3,Goe=(e,t)=>Voe(e,r=>{let i=t(r);i&&e.events[_0].push(i)},joe,r=>{let i=e.listen;e.listen=(...a)=>(!e.lc&&!e.active&&(e.active=!0,r()),i(...a));let o=e.off;return e.events[_0]=[],e.off=()=>{o(),setTimeout(()=>{if(e.active&&!e.lc){e.active=!1;for(let a of e.events[_0])a();e.events[_0]=[]}},Uoe)},()=>{e.listen=i,e.off=o}}),Hoe=(e,t)=>{Array.isArray(e)||(e=[e]);let n,r=()=>{let o=e.map(a=>a.get());(n===void 0||o.some((a,s)=>a!==n[s]))&&(n=o,i.set(t(...o)))},i=Ta(void 0,Math.max(...e.map(o=>o.l))+1);return Goe(i,()=>{let o=e.map(a=>a.listen(r,i.l));return r(),()=>{for(let a of o)a()}}),i};const aL="default",Nn=Ta(aL),qoe={listCursor:void 0,listPriority:void 0,selectedQueueItem:void 0,resumeProcessorOnEnqueue:!0},Woe=qoe,sL=qt({name:"queue",initialState:Woe,reducers:{listCursorChanged:(e,t)=>{e.listCursor=t.payload},listPriorityChanged:(e,t)=>{e.listPriority=t.payload},listParamsReset:e=>{e.listCursor=void 0,e.listPriority=void 0},queueItemSelectionToggled:(e,t)=>{e.selectedQueueItem===t.payload?e.selectedQueueItem=void 0:e.selectedQueueItem=t.payload},resumeProcessorOnEnqueueChanged:(e,t)=>{e.resumeProcessorOnEnqueue=t.payload}}}),{listCursorChanged:dFe,listPriorityChanged:fFe,listParamsReset:Koe,queueItemSelectionToggled:hFe,resumeProcessorOnEnqueueChanged:pFe}=sL.actions,Xoe=sL.reducer,lL="%[a-f0-9]{2}",h6=new RegExp("("+lL+")|([^%]+?)","gi"),p6=new RegExp("("+lL+")+","gi");function l5(e,t){try{return[decodeURIComponent(e.join(""))]}catch{}if(e.length===1)return e;t=t||1;const n=e.slice(0,t),r=e.slice(t);return Array.prototype.concat.call([],l5(n),l5(r))}function Qoe(e){try{return decodeURIComponent(e)}catch{let t=e.match(h6)||[];for(let n=1;ne==null,tae=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`),u5=Symbol("encodeFragmentIdentifier");function nae(e){switch(e.arrayFormat){case"index":return t=>(n,r)=>{const i=n.length;return r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[bn(t,e),"[",i,"]"].join("")]:[...n,[bn(t,e),"[",bn(i,e),"]=",bn(r,e)].join("")]};case"bracket":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[bn(t,e),"[]"].join("")]:[...n,[bn(t,e),"[]=",bn(r,e)].join("")];case"colon-list-separator":return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,[bn(t,e),":list="].join("")]:[...n,[bn(t,e),":list=",bn(r,e)].join("")];case"comma":case"separator":case"bracket-separator":{const t=e.arrayFormat==="bracket-separator"?"[]=":"=";return n=>(r,i)=>i===void 0||e.skipNull&&i===null||e.skipEmptyString&&i===""?r:(i=i===null?"":i,r.length===0?[[bn(n,e),t,bn(i,e)].join("")]:[[r,bn(i,e)].join(e.arrayFormatSeparator)])}default:return t=>(n,r)=>r===void 0||e.skipNull&&r===null||e.skipEmptyString&&r===""?n:r===null?[...n,bn(t,e)]:[...n,[bn(t,e),"=",bn(r,e)].join("")]}}function rae(e){let t;switch(e.arrayFormat){case"index":return(n,r,i)=>{if(t=/\[(\d*)]$/.exec(n),n=n.replace(/\[\d*]$/,""),!t){i[n]=r;return}i[n]===void 0&&(i[n]={}),i[n][t[1]]=r};case"bracket":return(n,r,i)=>{if(t=/(\[])$/.exec(n),n=n.replace(/\[]$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"colon-list-separator":return(n,r,i)=>{if(t=/(:list)$/.exec(n),n=n.replace(/:list$/,""),!t){i[n]=r;return}if(i[n]===void 0){i[n]=[r];return}i[n]=[...i[n],r]};case"comma":case"separator":return(n,r,i)=>{const o=typeof r=="string"&&r.includes(e.arrayFormatSeparator),a=typeof r=="string"&&!o&&Ua(r,e).includes(e.arrayFormatSeparator);r=a?Ua(r,e):r;const s=o||a?r.split(e.arrayFormatSeparator).map(l=>Ua(l,e)):r===null?r:Ua(r,e);i[n]=s};case"bracket-separator":return(n,r,i)=>{const o=/(\[])$/.test(n);if(n=n.replace(/\[]$/,""),!o){i[n]=r&&Ua(r,e);return}const a=r===null?[]:r.split(e.arrayFormatSeparator).map(s=>Ua(s,e));if(i[n]===void 0){i[n]=a;return}i[n]=[...i[n],...a]};default:return(n,r,i)=>{if(i[n]===void 0){i[n]=r;return}i[n]=[...[i[n]].flat(),r]}}}function cL(e){if(typeof e!="string"||e.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function bn(e,t){return t.encode?t.strict?tae(e):encodeURIComponent(e):e}function Ua(e,t){return t.decode?Zoe(e):e}function dL(e){return Array.isArray(e)?e.sort():typeof e=="object"?dL(Object.keys(e)).sort((t,n)=>Number(t)-Number(n)).map(t=>e[t]):e}function fL(e){const t=e.indexOf("#");return t!==-1&&(e=e.slice(0,t)),e}function iae(e){let t="";const n=e.indexOf("#");return n!==-1&&(t=e.slice(n)),t}function g6(e,t){return t.parseNumbers&&!Number.isNaN(Number(e))&&typeof e=="string"&&e.trim()!==""?e=Number(e):t.parseBooleans&&e!==null&&(e.toLowerCase()==="true"||e.toLowerCase()==="false")&&(e=e.toLowerCase()==="true"),e}function CE(e){e=fL(e);const t=e.indexOf("?");return t===-1?"":e.slice(t+1)}function EE(e,t){t={decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1,...t},cL(t.arrayFormatSeparator);const n=rae(t),r=Object.create(null);if(typeof e!="string"||(e=e.trim().replace(/^[?#&]/,""),!e))return r;for(const i of e.split("&")){if(i==="")continue;const o=t.decode?i.replace(/\+/g," "):i;let[a,s]=uL(o,"=");a===void 0&&(a=o),s=s===void 0?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:Ua(s,t),n(Ua(a,t),s,r)}for(const[i,o]of Object.entries(r))if(typeof o=="object"&&o!==null)for(const[a,s]of Object.entries(o))o[a]=g6(s,t);else r[i]=g6(o,t);return t.sort===!1?r:(t.sort===!0?Object.keys(r).sort():Object.keys(r).sort(t.sort)).reduce((i,o)=>{const a=r[o];return a&&typeof a=="object"&&!Array.isArray(a)?i[o]=dL(a):i[o]=a,i},Object.create(null))}function hL(e,t){if(!e)return"";t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t},cL(t.arrayFormatSeparator);const n=a=>t.skipNull&&eae(e[a])||t.skipEmptyString&&e[a]==="",r=nae(t),i={};for(const[a,s]of Object.entries(e))n(a)||(i[a]=s);const o=Object.keys(i);return t.sort!==!1&&o.sort(t.sort),o.map(a=>{const s=e[a];return s===void 0?"":s===null?bn(a,t):Array.isArray(s)?s.length===0&&t.arrayFormat==="bracket-separator"?bn(a,t)+"[]":s.reduce(r(a),[]).join("&"):bn(a,t)+"="+bn(s,t)}).filter(a=>a.length>0).join("&")}function pL(e,t){var i;t={decode:!0,...t};let[n,r]=uL(e,"#");return n===void 0&&(n=e),{url:((i=n==null?void 0:n.split("?"))==null?void 0:i[0])??"",query:EE(CE(e),t),...t&&t.parseFragmentIdentifier&&r?{fragmentIdentifier:Ua(r,t)}:{}}}function gL(e,t){t={encode:!0,strict:!0,[u5]:!0,...t};const n=fL(e.url).split("?")[0]||"",r=CE(e.url),i={...EE(r,{sort:!1}),...e.query};let o=hL(i,t);o&&(o=`?${o}`);let a=iae(e.url);if(e.fragmentIdentifier){const s=new URL(n);s.hash=e.fragmentIdentifier,a=t[u5]?s.hash:`#${e.fragmentIdentifier}`}return`${n}${o}${a}`}function mL(e,t,n){n={parseFragmentIdentifier:!0,[u5]:!1,...n};const{url:r,query:i,fragmentIdentifier:o}=pL(e,n);return gL({url:r,query:Joe(i,t),fragmentIdentifier:o},n)}function oae(e,t,n){const r=Array.isArray(t)?i=>!t.includes(i):(i,o)=>!t(i,o);return mL(e,r,n)}const lp=Object.freeze(Object.defineProperty({__proto__:null,exclude:oae,extract:CE,parse:EE,parseUrl:pL,pick:mL,stringify:hL,stringifyUrl:gL},Symbol.toStringTag,{value:"Module"}));var l1=globalThis&&globalThis.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]"u"||navigator.onLine===void 0?!0:navigator.onLine}function gae(){return typeof document>"u"?!0:document.visibilityState!=="hidden"}var b6=$o;function bL(e,t){if(e===t||!(b6(e)&&b6(t)||Array.isArray(e)&&Array.isArray(t)))return t;for(var n=Object.keys(t),r=Object.keys(e),i=n.length===r.length,o=Array.isArray(t)?[]:{},a=0,s=n;a=200&&e.status<=299},yae=function(e){return/ion\/(vnd\.api\+)?json/.test(e.get("content-type")||"")};function S6(e){if(!$o(e))return e;for(var t=hn({},e),n=0,r=Object.entries(t);n"u"&&s===_6&&console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."),function(g,b){return d1(t,null,function(){var S,x,w,C,T,A,k,D,M,E,P,N,L,O,R,$,z,V,H,Q,Z,J,j,X,ee,ne,fe,ce,Be,$e,we,Ke,be,zt,Hn,rn;return l1(this,function(It){switch(It.label){case 0:return S=b.signal,x=b.getState,w=b.extra,C=b.endpoint,T=b.forced,A=b.type,D=typeof g=="string"?{url:g}:g,M=D.url,E=D.headers,P=E===void 0?new Headers(v.headers):E,N=D.params,L=N===void 0?void 0:N,O=D.responseHandler,R=O===void 0?m??"json":O,$=D.validateStatus,z=$===void 0?_??mae:$,V=D.timeout,H=V===void 0?p:V,Q=y6(D,["url","headers","params","responseHandler","validateStatus","timeout"]),Z=hn(la(hn({},v),{signal:S}),Q),P=new Headers(S6(P)),J=Z,[4,o(P,{getState:x,extra:w,endpoint:C,forced:T,type:A})];case 1:J.headers=It.sent()||P,j=function(St){return typeof St=="object"&&($o(St)||Array.isArray(St)||typeof St.toJSON=="function")},!Z.headers.has("content-type")&&j(Z.body)&&Z.headers.set("content-type",f),j(Z.body)&&c(Z.headers)&&(Z.body=JSON.stringify(Z.body,h)),L&&(X=~M.indexOf("?")?"&":"?",ee=l?l(L):new URLSearchParams(S6(L)),M+=X+ee),M=hae(r,M),ne=new Request(M,Z),fe=ne.clone(),k={request:fe},Be=!1,$e=H&&setTimeout(function(){Be=!0,b.abort()},H),It.label=2;case 2:return It.trys.push([2,4,5,6]),[4,s(ne)];case 3:return ce=It.sent(),[3,6];case 4:return we=It.sent(),[2,{error:{status:Be?"TIMEOUT_ERROR":"FETCH_ERROR",error:String(we)},meta:k}];case 5:return $e&&clearTimeout($e),[7];case 6:Ke=ce.clone(),k.response=Ke,zt="",It.label=7;case 7:return It.trys.push([7,9,,10]),[4,Promise.all([y(ce,R).then(function(St){return be=St},function(St){return Hn=St}),Ke.text().then(function(St){return zt=St},function(){})])];case 8:if(It.sent(),Hn)throw Hn;return[3,10];case 9:return rn=It.sent(),[2,{error:{status:"PARSING_ERROR",originalStatus:ce.status,data:zt,error:String(rn)},meta:k}];case 10:return[2,z(ce,be)?{data:be,meta:k}:{error:{status:ce.status,data:be},meta:k}]}})})};function y(g,b){return d1(this,null,function(){var S;return l1(this,function(x){switch(x.label){case 0:return typeof b=="function"?[2,b(g)]:(b==="content-type"&&(b=c(g.headers)?"json":"text"),b!=="json"?[3,2]:[4,g.text()]);case 1:return S=x.sent(),[2,S.length?JSON.parse(S):null];case 2:return[2,g.text()]}})})}}var x6=function(){function e(t,n){n===void 0&&(n=void 0),this.value=t,this.meta=n}return e}(),AE=ve("__rtkq/focused"),_L=ve("__rtkq/unfocused"),TE=ve("__rtkq/online"),SL=ve("__rtkq/offline"),wa;(function(e){e.query="query",e.mutation="mutation"})(wa||(wa={}));function xL(e){return e.type===wa.query}function bae(e){return e.type===wa.mutation}function wL(e,t,n,r,i,o){return _ae(e)?e(t,n,r,i).map(c5).map(o):Array.isArray(e)?e.map(c5).map(o):[]}function _ae(e){return typeof e=="function"}function c5(e){return typeof e=="string"?{type:e}:e}function Cx(e){return e!=null}var lg=Symbol("forceQueryFn"),d5=function(e){return typeof e[lg]=="function"};function Sae(e){var t=e.serializeQueryArgs,n=e.queryThunk,r=e.mutationThunk,i=e.api,o=e.context,a=new Map,s=new Map,l=i.internalActions,u=l.unsubscribeQueryResult,c=l.removeMutationResult,d=l.updateSubscriptionOptions;return{buildInitiateQuery:y,buildInitiateMutation:g,getRunningQueryThunk:p,getRunningMutationThunk:m,getRunningQueriesThunk:_,getRunningMutationsThunk:v,getRunningOperationPromises:h,removalWarning:f};function f(){throw new Error(`This method had to be removed due to a conceptual bug in RTK. + Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details. + See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR.`)}function h(){typeof process<"u";var b=function(S){return Array.from(S.values()).flatMap(function(x){return x?Object.values(x):[]})};return u1(u1([],b(a)),b(s)).filter(Cx)}function p(b,S){return function(x){var w,C=o.endpointDefinitions[b],T=t({queryArgs:S,endpointDefinition:C,endpointName:b});return(w=a.get(x))==null?void 0:w[T]}}function m(b,S){return function(x){var w;return(w=s.get(x))==null?void 0:w[S]}}function _(){return function(b){return Object.values(a.get(b)||{}).filter(Cx)}}function v(){return function(b){return Object.values(s.get(b)||{}).filter(Cx)}}function y(b,S){var x=function(w,C){var T=C===void 0?{}:C,A=T.subscribe,k=A===void 0?!0:A,D=T.forceRefetch,M=T.subscriptionOptions,E=lg,P=T[E];return function(N,L){var O,R,$=t({queryArgs:w,endpointDefinition:S,endpointName:b}),z=n((O={type:"query",subscribe:k,forceRefetch:D,subscriptionOptions:M,endpointName:b,originalArgs:w,queryCacheKey:$},O[lg]=P,O)),V=i.endpoints[b].select(w),H=N(z),Q=V(L()),Z=H.requestId,J=H.abort,j=Q.requestId!==Z,X=(R=a.get(N))==null?void 0:R[$],ee=function(){return V(L())},ne=Object.assign(P?H.then(ee):j&&!X?Promise.resolve(Q):Promise.all([X,H]).then(ee),{arg:w,requestId:Z,subscriptionOptions:M,queryCacheKey:$,abort:J,unwrap:function(){return d1(this,null,function(){var ce;return l1(this,function(Be){switch(Be.label){case 0:return[4,ne];case 1:if(ce=Be.sent(),ce.isError)throw ce.error;return[2,ce.data]}})})},refetch:function(){return N(x(w,{subscribe:!1,forceRefetch:!0}))},unsubscribe:function(){k&&N(u({queryCacheKey:$,requestId:Z}))},updateSubscriptionOptions:function(ce){ne.subscriptionOptions=ce,N(d({endpointName:b,requestId:Z,queryCacheKey:$,options:ce}))}});if(!X&&!j&&!P){var fe=a.get(N)||{};fe[$]=ne,a.set(N,fe),ne.then(function(){delete fe[$],Object.keys(fe).length||a.delete(N)})}return ne}};return x}function g(b){return function(S,x){var w=x===void 0?{}:x,C=w.track,T=C===void 0?!0:C,A=w.fixedCacheKey;return function(k,D){var M=r({type:"mutation",endpointName:b,originalArgs:S,track:T,fixedCacheKey:A}),E=k(M),P=E.requestId,N=E.abort,L=E.unwrap,O=E.unwrap().then(function(V){return{data:V}}).catch(function(V){return{error:V}}),R=function(){k(c({requestId:P,fixedCacheKey:A}))},$=Object.assign(O,{arg:E.arg,requestId:P,abort:N,unwrap:L,unsubscribe:R,reset:R}),z=s.get(k)||{};return s.set(k,z),z[P]=$,$.then(function(){delete z[P],Object.keys(z).length||s.delete(k)}),A&&(z[A]=$,$.then(function(){z[A]===$&&(delete z[A],Object.keys(z).length||s.delete(k))})),$}}}}function w6(e){return e}function xae(e){var t=this,n=e.reducerPath,r=e.baseQuery,i=e.context.endpointDefinitions,o=e.serializeQueryArgs,a=e.api,s=function(g,b,S){return function(x){var w=i[g];x(a.internalActions.queryResultPatched({queryCacheKey:o({queryArgs:b,endpointDefinition:w,endpointName:g}),patches:S}))}},l=function(g,b,S){return function(x,w){var C,T,A=a.endpoints[g].select(b)(w()),k={patches:[],inversePatches:[],undo:function(){return x(a.util.patchQueryData(g,b,k.inversePatches))}};if(A.status===Gt.uninitialized)return k;if("data"in A)if(ti(A.data)){var D=j4(A.data,S),M=D[1],E=D[2];(C=k.patches).push.apply(C,M),(T=k.inversePatches).push.apply(T,E)}else{var P=S(A.data);k.patches.push({op:"replace",path:[],value:P}),k.inversePatches.push({op:"replace",path:[],value:A.data})}return x(a.util.patchQueryData(g,b,k.patches)),k}},u=function(g,b,S){return function(x){var w;return x(a.endpoints[g].initiate(b,(w={subscribe:!1,forceRefetch:!0},w[lg]=function(){return{data:S}},w)))}},c=function(g,b){return d1(t,[g,b],function(S,x){var w,C,T,A,k,D,M,E,P,N,L,O,R,$,z,V,H,Q,Z=x.signal,J=x.abort,j=x.rejectWithValue,X=x.fulfillWithValue,ee=x.dispatch,ne=x.getState,fe=x.extra;return l1(this,function(ce){switch(ce.label){case 0:w=i[S.endpointName],ce.label=1;case 1:return ce.trys.push([1,8,,13]),C=w6,T=void 0,A={signal:Z,abort:J,dispatch:ee,getState:ne,extra:fe,endpoint:S.endpointName,type:S.type,forced:S.type==="query"?d(S,ne()):void 0},k=S.type==="query"?S[lg]:void 0,k?(T=k(),[3,6]):[3,2];case 2:return w.query?[4,r(w.query(S.originalArgs),A,w.extraOptions)]:[3,4];case 3:return T=ce.sent(),w.transformResponse&&(C=w.transformResponse),[3,6];case 4:return[4,w.queryFn(S.originalArgs,A,w.extraOptions,function(Be){return r(Be,A,w.extraOptions)})];case 5:T=ce.sent(),ce.label=6;case 6:if(typeof process<"u",T.error)throw new x6(T.error,T.meta);return L=X,[4,C(T.data,T.meta,S.originalArgs)];case 7:return[2,L.apply(void 0,[ce.sent(),(H={fulfilledTimeStamp:Date.now(),baseQueryMeta:T.meta},H[Cu]=!0,H)])];case 8:if(O=ce.sent(),R=O,!(R instanceof x6))return[3,12];$=w6,w.query&&w.transformErrorResponse&&($=w.transformErrorResponse),ce.label=9;case 9:return ce.trys.push([9,11,,12]),z=j,[4,$(R.value,R.meta,S.originalArgs)];case 10:return[2,z.apply(void 0,[ce.sent(),(Q={baseQueryMeta:R.meta},Q[Cu]=!0,Q)])];case 11:return V=ce.sent(),R=V,[3,12];case 12:throw typeof process<"u",console.error(R),R;case 13:return[2]}})})};function d(g,b){var S,x,w,C,T=(x=(S=b[n])==null?void 0:S.queries)==null?void 0:x[g.queryCacheKey],A=(w=b[n])==null?void 0:w.config.refetchOnMountOrArgChange,k=T==null?void 0:T.fulfilledTimeStamp,D=(C=g.forceRefetch)!=null?C:g.subscribe&&A;return D?D===!0||(Number(new Date)-Number(k))/1e3>=D:!1}var f=Vv(n+"/executeQuery",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Cu]=!0,g},condition:function(g,b){var S=b.getState,x,w,C,T=S(),A=(w=(x=T[n])==null?void 0:x.queries)==null?void 0:w[g.queryCacheKey],k=A==null?void 0:A.fulfilledTimeStamp,D=g.originalArgs,M=A==null?void 0:A.originalArgs,E=i[g.endpointName];return d5(g)?!0:(A==null?void 0:A.status)==="pending"?!1:d(g,T)||xL(E)&&((C=E==null?void 0:E.forceRefetch)!=null&&C.call(E,{currentArg:D,previousArg:M,endpointState:A,state:T}))?!0:!k},dispatchConditionRejection:!0}),h=Vv(n+"/executeMutation",c,{getPendingMeta:function(){var g;return g={startedTimeStamp:Date.now()},g[Cu]=!0,g}}),p=function(g){return"force"in g},m=function(g){return"ifOlderThan"in g},_=function(g,b,S){return function(x,w){var C=p(S)&&S.force,T=m(S)&&S.ifOlderThan,A=function(E){return E===void 0&&(E=!0),a.endpoints[g].initiate(b,{forceRefetch:E})},k=a.endpoints[g].select(b)(w());if(C)x(A());else if(T){var D=k==null?void 0:k.fulfilledTimeStamp;if(!D){x(A());return}var M=(Number(new Date)-Number(new Date(D)))/1e3>=T;M&&x(A())}else x(A(!1))}};function v(g){return function(b){var S,x;return((x=(S=b==null?void 0:b.meta)==null?void 0:S.arg)==null?void 0:x.endpointName)===g}}function y(g,b){return{matchPending:Cd($b(g),v(b)),matchFulfilled:Cd(zl(g),v(b)),matchRejected:Cd(af(g),v(b))}}return{queryThunk:f,mutationThunk:h,prefetch:_,updateQueryData:l,upsertQueryData:u,patchQueryData:s,buildMatchThunkActions:y}}function CL(e,t,n,r){return wL(n[e.meta.arg.endpointName][t],zl(e)?e.payload:void 0,am(e)?e.payload:void 0,e.meta.arg.originalArgs,"baseQueryMeta"in e.meta?e.meta.baseQueryMeta:void 0,r)}function x0(e,t,n){var r=e[t];r&&n(r)}function ug(e){var t;return(t="arg"in e?e.arg.fixedCacheKey:e.fixedCacheKey)!=null?t:e.requestId}function C6(e,t,n){var r=e[ug(t)];r&&n(r)}var sh={};function wae(e){var t=e.reducerPath,n=e.queryThunk,r=e.mutationThunk,i=e.context,o=i.endpointDefinitions,a=i.apiUid,s=i.extractRehydrationInfo,l=i.hasRehydrationInfo,u=e.assertTagType,c=e.config,d=ve(t+"/resetApiState"),f=qt({name:t+"/queries",initialState:sh,reducers:{removeQueryResult:{reducer:function(S,x){var w=x.payload.queryCacheKey;delete S[w]},prepare:Oy()},queryResultPatched:function(S,x){var w=x.payload,C=w.queryCacheKey,T=w.patches;x0(S,C,function(A){A.data=jC(A.data,T.concat())})}},extraReducers:function(S){S.addCase(n.pending,function(x,w){var C=w.meta,T=w.meta.arg,A,k,D=d5(T);(T.subscribe||D)&&((k=x[A=T.queryCacheKey])!=null||(x[A]={status:Gt.uninitialized,endpointName:T.endpointName})),x0(x,T.queryCacheKey,function(M){M.status=Gt.pending,M.requestId=D&&M.requestId?M.requestId:C.requestId,T.originalArgs!==void 0&&(M.originalArgs=T.originalArgs),M.startedTimeStamp=C.startedTimeStamp})}).addCase(n.fulfilled,function(x,w){var C=w.meta,T=w.payload;x0(x,C.arg.queryCacheKey,function(A){var k;if(!(A.requestId!==C.requestId&&!d5(C.arg))){var D=o[C.arg.endpointName].merge;if(A.status=Gt.fulfilled,D)if(A.data!==void 0){var M=C.fulfilledTimeStamp,E=C.arg,P=C.baseQueryMeta,N=C.requestId,L=Bl(A.data,function(O){return D(O,T,{arg:E.originalArgs,baseQueryMeta:P,fulfilledTimeStamp:M,requestId:N})});A.data=L}else A.data=T;else A.data=(k=o[C.arg.endpointName].structuralSharing)==null||k?bL(Nr(A.data)?$4(A.data):A.data,T):T;delete A.error,A.fulfilledTimeStamp=C.fulfilledTimeStamp}})}).addCase(n.rejected,function(x,w){var C=w.meta,T=C.condition,A=C.arg,k=C.requestId,D=w.error,M=w.payload;x0(x,A.queryCacheKey,function(E){if(!T){if(E.requestId!==k)return;E.status=Gt.rejected,E.error=M??D}})}).addMatcher(l,function(x,w){for(var C=s(w).queries,T=0,A=Object.entries(C);T"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?qae:Hae;TL.useSyncExternalStore=df.useSyncExternalStore!==void 0?df.useSyncExternalStore:Wae;AL.exports=TL;var Kae=AL.exports,PL={exports:{}},kL={};/** + * @license React + * use-sync-external-store-shim/with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var n_=I,Xae=Kae;function Qae(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Yae=typeof Object.is=="function"?Object.is:Qae,Zae=Xae.useSyncExternalStore,Jae=n_.useRef,ese=n_.useEffect,tse=n_.useMemo,nse=n_.useDebugValue;kL.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Jae(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=tse(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&a.hasValue){var p=a.value;if(i(p,h))return d=p}return d=h}if(p=d,Yae(c,h))return p;var m=r(h);return i!==void 0&&i(p,m)?p:(c=h,d=m)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=Zae(e,o[0],o[1]);return ese(function(){a.hasValue=!0,a.value=s},[s]),nse(s),s};PL.exports=kL;var IL=PL.exports;const rse=Nl(IL);function ise(e){e()}let ML=ise;const ose=e=>ML=e,ase=()=>ML,M6=Symbol.for("react-redux-context"),R6=typeof globalThis<"u"?globalThis:{};function sse(){var e;if(!I.createContext)return{};const t=(e=R6[M6])!=null?e:R6[M6]=new Map;let n=t.get(I.createContext);return n||(n=I.createContext(null),t.set(I.createContext,n)),n}const Tl=sse();function PE(e=Tl){return function(){return I.useContext(e)}}const RL=PE(),lse=()=>{throw new Error("uSES not initialized!")};let OL=lse;const use=e=>{OL=e},cse=(e,t)=>e===t;function dse(e=Tl){const t=e===Tl?RL:PE(e);return function(r,i={}){const{equalityFn:o=cse,stabilityCheck:a=void 0,noopCheck:s=void 0}=typeof i=="function"?{equalityFn:i}:i,{store:l,subscription:u,getServerState:c,stabilityCheck:d,noopCheck:f}=t();I.useRef(!0);const h=I.useCallback({[r.name](m){return r(m)}}[r.name],[r,d,a]),p=OL(u.addNestedSub,l.getState,c||l.getState,h,o);return I.useDebugValue(p),p}}const $L=dse();function f1(){return f1=Object.assign?Object.assign.bind():function(e){for(var t=1;t{let r=t;for(;r;)r.callback(),r=r.next})},get(){let r=[],i=t;for(;i;)r.push(i),i=i.next;return r},subscribe(r){let i=!0,o=n={callback:r,next:null,prev:n};return o.prev?o.prev.next=o:t=o,function(){!i||t===null||(i=!1,o.next?o.next.prev=o.prev:n=o.prev,o.prev?o.prev.next=o.next:t=o.next)}}}}const O6={notify(){},get:()=>[]};function wse(e,t){let n,r=O6;function i(d){return l(),r.subscribe(d)}function o(){r.notify()}function a(){c.onStateChange&&c.onStateChange()}function s(){return!!n}function l(){n||(n=t?t.addNestedSub(a):e.subscribe(a),r=xse())}function u(){n&&(n(),n=void 0,r.clear(),r=O6)}const c={addNestedSub:i,notifyNestedSubs:o,handleChangeWrapper:a,isSubscribed:s,trySubscribe:l,tryUnsubscribe:u,getListeners:()=>r};return c}const Cse=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Ese=Cse?I.useLayoutEffect:I.useEffect;function $6(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function h1(e,t){if($6(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let i=0;i{const u=wse(e);return{store:e,subscription:u,getServerState:r?()=>r:void 0,stabilityCheck:i,noopCheck:o}},[e,r,i,o]),s=I.useMemo(()=>e.getState(),[e]);Ese(()=>{const{subscription:u}=a;return u.onStateChange=u.notifyNestedSubs,u.trySubscribe(),s!==e.getState()&&u.notifyNestedSubs(),()=>{u.tryUnsubscribe(),u.onStateChange=void 0}},[a,s]);const l=t||Tl;return I.createElement(l.Provider,{value:a},n)}function zL(e=Tl){const t=e===Tl?RL:PE(e);return function(){const{store:r}=t();return r}}const jL=zL();function Tse(e=Tl){const t=e===Tl?jL:zL(e);return function(){return t().dispatch}}const VL=Tse();use(IL.useSyncExternalStoreWithSelector);ose(hi.unstable_batchedUpdates);var Pse=globalThis&&globalThis.__spreadArray||function(e,t){for(var n=0,r=t.length,i=e.length;nqse({headers:{...e?{Authorization:`Bearer ${e}`}:{},...n?{"project-id":n}:{}},baseUrl:`${t??""}`}));const Yse=["AppVersion","AppConfig","Board","BoardImagesTotal","BoardAssetsTotal","Image","ImageNameList","ImageList","ImageMetadata","ImageMetadataFromFile","IntermediatesCount","SessionQueueItem","SessionQueueStatus","SessionProcessorStatus","CurrentSessionQueueItem","NextSessionQueueItem","BatchStatus","InvocationCacheStatus","Model","T2IAdapterModel","MainModel","OnnxModel","VaeModel","IPAdapterModel","TextualInversionModel","ControlNetModel","LoRAModel","SDXLRefinerModel","Workflow"],kr="LIST",Zse=async(e,t,n)=>{const r=dg.get(),i=cg.get(),o=g1.get();return vae({baseUrl:`${r??""}/api/v1`,prepareHeaders:s=>(i&&s.set("Authorization",`Bearer ${i}`),o&&s.set("project-id",o),s)})(e,t,n)},Do=Use({baseQuery:Zse,reducerPath:"api",tagTypes:Yse,endpoints:()=>({})}),Jse=e=>{const t=e?lp.stringify(e,{arrayFormat:"none"}):void 0;return t?`queue/${Nn.get()}/list?${t}`:`queue/${Nn.get()}/list`},yu=Qi({selectId:e=>e.item_id,sortComparer:(e,t)=>e.priority>t.priority?-1:e.priorityt.item_id?1:0}),ln=Do.injectEndpoints({endpoints:e=>({enqueueBatch:e.mutation({query:t=>({url:`queue/${Nn.get()}/enqueue_batch`,body:t,method:"POST"}),invalidatesTags:["SessionQueueStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,A0(r)}catch{}}}),resumeProcessor:e.mutation({query:()=>({url:`queue/${Nn.get()}/processor/resume`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pauseProcessor:e.mutation({query:()=>({url:`queue/${Nn.get()}/processor/pause`,method:"PUT"}),invalidatesTags:["CurrentSessionQueueItem","SessionQueueStatus"]}),pruneQueue:e.mutation({query:()=>({url:`queue/${Nn.get()}/prune`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","BatchStatus"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,A0(r)}catch{}}}),clearQueue:e.mutation({query:()=>({url:`queue/${Nn.get()}/clear`,method:"PUT"}),invalidatesTags:["SessionQueueStatus","SessionProcessorStatus","BatchStatus","CurrentSessionQueueItem","NextSessionQueueItem"],onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,A0(r)}catch{}}}),getCurrentQueueItem:e.query({query:()=>({url:`queue/${Nn.get()}/current`,method:"GET"}),providesTags:t=>{const n=["CurrentSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getNextQueueItem:e.query({query:()=>({url:`queue/${Nn.get()}/next`,method:"GET"}),providesTags:t=>{const n=["NextSessionQueueItem"];return t&&n.push({type:"SessionQueueItem",id:t.item_id}),n}}),getQueueStatus:e.query({query:()=>({url:`queue/${Nn.get()}/status`,method:"GET"}),providesTags:["SessionQueueStatus"]}),getBatchStatus:e.query({query:({batch_id:t})=>({url:`queue/${Nn.get()}/b/${t}/status`,method:"GET"}),providesTags:t=>t?[{type:"BatchStatus",id:t.batch_id}]:[]}),getQueueItem:e.query({query:t=>({url:`queue/${Nn.get()}/i/${t}`,method:"GET"}),providesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id}]:[]}),cancelQueueItem:e.mutation({query:t=>({url:`queue/${Nn.get()}/i/${t}/cancel`,method:"PUT"}),onQueryStarted:async(t,{dispatch:n,queryFulfilled:r})=>{try{const{data:i}=await r;n(ln.util.updateQueryData("listQueueItems",void 0,o=>{yu.updateOne(o,{id:t,changes:{status:i.status,completed_at:i.completed_at,updated_at:i.updated_at}})}))}catch{}},invalidatesTags:t=>t?[{type:"SessionQueueItem",id:t.item_id},{type:"BatchStatus",id:t.batch_id}]:[]}),cancelByBatchIds:e.mutation({query:t=>({url:`queue/${Nn.get()}/cancel_by_batch_ids`,method:"PUT",body:t}),onQueryStarted:async(t,n)=>{const{dispatch:r,queryFulfilled:i}=n;try{await i,A0(r)}catch{}},invalidatesTags:["SessionQueueStatus","BatchStatus"]}),listQueueItems:e.query({query:t=>({url:Jse(t),method:"GET"}),serializeQueryArgs:()=>`queue/${Nn.get()}/list`,transformResponse:t=>yu.addMany(yu.getInitialState({has_more:t.has_more}),t.items),merge:(t,n)=>{yu.addMany(t,yu.getSelectors().selectAll(n)),t.has_more=n.has_more},forceRefetch:({currentArg:t,previousArg:n})=>t!==n,keepUnusedDataFor:60*5})})}),{useCancelByBatchIdsMutation:gFe,useEnqueueBatchMutation:mFe,usePauseProcessorMutation:yFe,useResumeProcessorMutation:vFe,useClearQueueMutation:bFe,usePruneQueueMutation:_Fe,useGetCurrentQueueItemQuery:SFe,useGetQueueStatusQuery:xFe,useGetQueueItemQuery:wFe,useGetNextQueueItemQuery:CFe,useListQueueItemsQuery:EFe,useCancelQueueItemMutation:AFe,useGetBatchStatusQuery:TFe}=ln,A0=e=>{e(ln.util.updateQueryData("listQueueItems",void 0,t=>{yu.removeAll(t),t.has_more=!1})),e(Koe()),e(ln.endpoints.listQueueItems.initiate(void 0))},Nh={objects:[],stagingArea:{images:[],selectedImageIndex:-1}},UL={boundingBoxCoordinates:{x:0,y:0},boundingBoxDimensions:{width:512,height:512},boundingBoxPreviewFill:{r:0,g:0,b:0,a:.5},boundingBoxScaleMethod:"none",brushColor:{r:90,g:90,b:255,a:1},brushSize:50,colorPickerColor:{r:90,g:90,b:255,a:1},cursorPosition:null,futureLayerStates:[],isDrawing:!1,isMaskEnabled:!0,isMouseOverBoundingBox:!1,isMoveBoundingBoxKeyHeld:!1,isMoveStageKeyHeld:!1,isMovingBoundingBox:!1,isMovingStage:!1,isTransformingBoundingBox:!1,layer:"base",layerState:Nh,maskColor:{r:255,g:90,b:90,a:1},maxHistory:128,minimumStageScale:1,pastLayerStates:[],scaledBoundingBoxDimensions:{width:512,height:512},shouldAntialias:!0,shouldAutoSave:!1,shouldCropToBoundingBoxOnSave:!1,shouldDarkenOutsideBoundingBox:!1,shouldLockBoundingBox:!1,shouldPreserveMaskedArea:!1,shouldRestrictStrokesToBox:!0,shouldShowBoundingBox:!0,shouldShowBrush:!0,shouldShowBrushPreview:!1,shouldShowCanvasDebugInfo:!1,shouldShowCheckboardTransparency:!1,shouldShowGrid:!0,shouldShowIntermediates:!0,shouldShowStagingImage:!0,shouldShowStagingOutline:!0,shouldSnapToGrid:!0,stageCoordinates:{x:0,y:0},stageDimensions:{width:0,height:0},stageScale:1,tool:"brush",batchIds:[]},GL=qt({name:"canvas",initialState:UL,reducers:{setTool:(e,t)=>{const n=t.payload;e.tool=t.payload,n!=="move"&&(e.isTransformingBoundingBox=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1)},setLayer:(e,t)=>{e.layer=t.payload},toggleTool:e=>{const t=e.tool;t!=="move"&&(e.tool=t==="brush"?"eraser":"brush")},setMaskColor:(e,t)=>{e.maskColor=t.payload},setBrushColor:(e,t)=>{e.brushColor=t.payload},setBrushSize:(e,t)=>{e.brushSize=t.payload},clearMask:e=>{e.pastLayerStates.push(et(e.layerState)),e.layerState.objects=e.layerState.objects.filter(t=>!oL(t)),e.futureLayerStates=[],e.shouldPreserveMaskedArea=!1},toggleShouldInvertMask:e=>{e.shouldPreserveMaskedArea=!e.shouldPreserveMaskedArea},toggleShouldShowMask:e=>{e.isMaskEnabled=!e.isMaskEnabled},setShouldPreserveMaskedArea:(e,t)=>{e.shouldPreserveMaskedArea=t.payload},setIsMaskEnabled:(e,t)=>{e.isMaskEnabled=t.payload,e.layer=t.payload?"mask":"base"},setShouldShowCheckboardTransparency:(e,t)=>{e.shouldShowCheckboardTransparency=t.payload},setShouldShowBrushPreview:(e,t)=>{e.shouldShowBrushPreview=t.payload},setShouldShowBrush:(e,t)=>{e.shouldShowBrush=t.payload},setCursorPosition:(e,t)=>{e.cursorPosition=t.payload},setInitialCanvasImage:(e,t)=>{const n=t.payload,{width:r,height:i}=n,{stageDimensions:o}=e,a={width:f0(rl(r,64,512),64),height:f0(rl(i,64,512),64)},s={x:fi(r/2-a.width/2,64),y:fi(i/2-a.height/2,64)};if(e.boundingBoxScaleMethod==="auto"){const c=Ac(a);e.scaledBoundingBoxDimensions=c}e.boundingBoxDimensions=a,e.boundingBoxCoordinates=s,e.pastLayerStates.push(et(e.layerState)),e.layerState={...et(Nh),objects:[{kind:"image",layer:"base",x:0,y:0,width:r,height:i,imageName:n.image_name}]},e.futureLayerStates=[],e.batchIds=[];const l=v0(o.width,o.height,r,i,b0),u=y0(o.width,o.height,0,0,r,i,l);e.stageScale=l,e.stageCoordinates=u},setBoundingBoxDimensions:(e,t)=>{const n=Foe(t.payload);if(e.boundingBoxDimensions=n,e.boundingBoxScaleMethod==="auto"){const r=Ac(n);e.scaledBoundingBoxDimensions=r}},flipBoundingBoxAxes:e=>{const[t,n]=[e.boundingBoxDimensions.width,e.boundingBoxDimensions.height],[r,i]=[e.scaledBoundingBoxDimensions.width,e.scaledBoundingBoxDimensions.height];e.boundingBoxDimensions={width:n,height:t},e.scaledBoundingBoxDimensions={width:i,height:r}},setBoundingBoxCoordinates:(e,t)=>{e.boundingBoxCoordinates=Loe(t.payload)},setStageCoordinates:(e,t)=>{e.stageCoordinates=t.payload},setBoundingBoxPreviewFill:(e,t)=>{e.boundingBoxPreviewFill=t.payload},setStageScale:(e,t)=>{e.stageScale=t.payload},setShouldDarkenOutsideBoundingBox:(e,t)=>{e.shouldDarkenOutsideBoundingBox=t.payload},setIsDrawing:(e,t)=>{e.isDrawing=t.payload},clearCanvasHistory:e=>{e.pastLayerStates=[],e.futureLayerStates=[]},setShouldLockBoundingBox:(e,t)=>{e.shouldLockBoundingBox=t.payload},toggleShouldLockBoundingBox:e=>{e.shouldLockBoundingBox=!e.shouldLockBoundingBox},setShouldShowBoundingBox:(e,t)=>{e.shouldShowBoundingBox=t.payload},setIsTransformingBoundingBox:(e,t)=>{e.isTransformingBoundingBox=t.payload},setIsMovingBoundingBox:(e,t)=>{e.isMovingBoundingBox=t.payload},setIsMouseOverBoundingBox:(e,t)=>{e.isMouseOverBoundingBox=t.payload},setIsMoveBoundingBoxKeyHeld:(e,t)=>{e.isMoveBoundingBoxKeyHeld=t.payload},setIsMoveStageKeyHeld:(e,t)=>{e.isMoveStageKeyHeld=t.payload},canvasBatchIdAdded:(e,t)=>{e.batchIds.push(t.payload)},canvasBatchIdsReset:e=>{e.batchIds=[]},stagingAreaInitialized:(e,t)=>{const{boundingBox:n}=t.payload;e.layerState.stagingArea={boundingBox:n,images:[],selectedImageIndex:-1}},addImageToStagingArea:(e,t)=>{const n=t.payload;!n||!e.layerState.stagingArea.boundingBox||(e.pastLayerStates.push(et(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea.images.push({kind:"image",layer:"base",...e.layerState.stagingArea.boundingBox,imageName:n.image_name}),e.layerState.stagingArea.selectedImageIndex=e.layerState.stagingArea.images.length-1,e.futureLayerStates=[])},discardStagedImages:e=>{e.pastLayerStates.push(et(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.stagingArea=et(et(Nh)).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},addFillRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n,brushColor:r}=e;e.pastLayerStates.push(et(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"fillRect",layer:"base",...t,...n,color:r}),e.futureLayerStates=[]},addEraseRect:e=>{const{boundingBoxCoordinates:t,boundingBoxDimensions:n}=e;e.pastLayerStates.push(et(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState.objects.push({kind:"eraseRect",layer:"base",...t,...n}),e.futureLayerStates=[]},addLine:(e,t)=>{const{tool:n,layer:r,brushColor:i,brushSize:o,shouldRestrictStrokesToBox:a}=e;if(n==="move"||n==="colorPicker")return;const s=o/2,l=r==="base"&&n==="brush"?{color:i}:{};e.pastLayerStates.push(et(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const u={kind:"line",layer:r,tool:n,strokeWidth:s,points:t.payload,...l};a&&(u.clip={...e.boundingBoxCoordinates,...e.boundingBoxDimensions}),e.layerState.objects.push(u),e.futureLayerStates=[]},addPointToCurrentLine:(e,t)=>{const n=e.layerState.objects.findLast(zoe);n&&n.points.push(...t.payload)},undo:e=>{const t=e.pastLayerStates.pop();t&&(e.futureLayerStates.unshift(et(e.layerState)),e.futureLayerStates.length>e.maxHistory&&e.futureLayerStates.pop(),e.layerState=t)},redo:e=>{const t=e.futureLayerStates.shift();t&&(e.pastLayerStates.push(et(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift(),e.layerState=t)},setShouldShowGrid:(e,t)=>{e.shouldShowGrid=t.payload},setIsMovingStage:(e,t)=>{e.isMovingStage=t.payload},setShouldSnapToGrid:(e,t)=>{e.shouldSnapToGrid=t.payload},setShouldAutoSave:(e,t)=>{e.shouldAutoSave=t.payload},setShouldShowIntermediates:(e,t)=>{e.shouldShowIntermediates=t.payload},resetCanvas:e=>{e.pastLayerStates.push(et(e.layerState)),e.layerState=et(Nh),e.futureLayerStates=[],e.batchIds=[]},canvasResized:(e,t)=>{const{width:n,height:r}=t.payload,i={width:Math.floor(n),height:Math.floor(r)};if(e.stageDimensions=i,!e.layerState.objects.find(Boe)){const o=v0(i.width,i.height,512,512,b0),a=y0(i.width,i.height,0,0,512,512,o),s={width:512,height:512};if(e.stageScale=o,e.stageCoordinates=a,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=s,e.boundingBoxScaleMethod==="auto"){const l=Ac(s);e.scaledBoundingBoxDimensions=l}}},resetCanvasView:(e,t)=>{const{contentRect:n,shouldScaleTo1:r}=t.payload,{stageDimensions:{width:i,height:o}}=e,{x:a,y:s,width:l,height:u}=n;if(l!==0&&u!==0){const c=r?1:v0(i,o,l,u,b0),d=y0(i,o,a,s,l,u,c);e.stageScale=c,e.stageCoordinates=d}else{const c=v0(i,o,512,512,b0),d=y0(i,o,0,0,512,512,c),f={width:512,height:512};if(e.stageScale=c,e.stageCoordinates=d,e.boundingBoxCoordinates={x:0,y:0},e.boundingBoxDimensions=f,e.boundingBoxScaleMethod==="auto"){const h=Ac(f);e.scaledBoundingBoxDimensions=h}}},nextStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex+1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t>n?0:t},prevStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const t=e.layerState.stagingArea.selectedImageIndex-1,n=e.layerState.stagingArea.images.length-1;e.layerState.stagingArea.selectedImageIndex=t<0?n:t},commitStagingAreaImage:e=>{if(!e.layerState.stagingArea.images.length)return;const{images:t,selectedImageIndex:n}=e.layerState.stagingArea;e.pastLayerStates.push(et(e.layerState)),e.pastLayerStates.length>e.maxHistory&&e.pastLayerStates.shift();const r=t[n];r&&e.layerState.objects.push({...r}),e.layerState.stagingArea=et(Nh).stagingArea,e.futureLayerStates=[],e.shouldShowStagingOutline=!0,e.shouldShowStagingImage=!0,e.batchIds=[]},fitBoundingBoxToStage:e=>{const{boundingBoxDimensions:t,boundingBoxCoordinates:n,stageDimensions:r,stageScale:i}=e,o=r.width/i,a=r.height/i;if(n.x<0||n.x+t.width>o||n.y<0||n.y+t.height>a){const s={width:f0(rl(o,64,512),64),height:f0(rl(a,64,512),64)},l={x:fi(o/2-s.width/2,64),y:fi(a/2-s.height/2,64)};if(e.boundingBoxDimensions=s,e.boundingBoxCoordinates=l,e.boundingBoxScaleMethod==="auto"){const u=Ac(s);e.scaledBoundingBoxDimensions=u}}},setBoundingBoxScaleMethod:(e,t)=>{if(e.boundingBoxScaleMethod=t.payload,t.payload==="auto"){const n=Ac(e.boundingBoxDimensions);e.scaledBoundingBoxDimensions=n}},setScaledBoundingBoxDimensions:(e,t)=>{e.scaledBoundingBoxDimensions=t.payload},setShouldShowStagingImage:(e,t)=>{e.shouldShowStagingImage=t.payload},setShouldShowStagingOutline:(e,t)=>{e.shouldShowStagingOutline=t.payload},setShouldShowCanvasDebugInfo:(e,t)=>{e.shouldShowCanvasDebugInfo=t.payload},setShouldRestrictStrokesToBox:(e,t)=>{e.shouldRestrictStrokesToBox=t.payload},setShouldAntialias:(e,t)=>{e.shouldAntialias=t.payload},setShouldCropToBoundingBoxOnSave:(e,t)=>{e.shouldCropToBoundingBoxOnSave=t.payload},setColorPickerColor:(e,t)=>{e.colorPickerColor=t.payload},commitColorPickerColor:e=>{e.brushColor={...e.colorPickerColor,a:e.brushColor.a},e.tool="brush"},setMergedCanvas:(e,t)=>{e.pastLayerStates.push(et(e.layerState)),e.futureLayerStates=[],e.layerState.objects=[t.payload]},resetCanvasInteractionState:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMoveBoundingBoxKeyHeld=!1,e.isMoveStageKeyHeld=!1,e.isMovingBoundingBox=!1,e.isMovingStage=!1,e.isTransformingBoundingBox=!1},mouseLeftCanvas:e=>{e.cursorPosition=null,e.isDrawing=!1,e.isMouseOverBoundingBox=!1,e.isMovingBoundingBox=!1,e.isTransformingBoundingBox=!1}},extraReducers:e=>{e.addCase(Qb,(t,n)=>{const r=n.payload.data.batch_status;t.batchIds.includes(r.batch_id)&&r.in_progress===0&&r.pending===0&&(t.batchIds=t.batchIds.filter(i=>i!==r.batch_id))}),e.addCase(Noe,(t,n)=>{const r=n.payload;r&&(t.boundingBoxDimensions.height=fi(t.boundingBoxDimensions.width/r,64),t.scaledBoundingBoxDimensions.height=fi(t.scaledBoundingBoxDimensions.width/r,64))}),e.addMatcher(ln.endpoints.clearQueue.matchFulfilled,t=>{t.batchIds=[]}),e.addMatcher(ln.endpoints.cancelByBatchIds.matchFulfilled,(t,n)=>{t.batchIds=t.batchIds.filter(r=>!n.meta.arg.originalArgs.batch_ids.includes(r))})}}),{addEraseRect:PFe,addFillRect:kFe,addImageToStagingArea:ele,addLine:IFe,addPointToCurrentLine:MFe,clearCanvasHistory:RFe,clearMask:OFe,commitColorPickerColor:$Fe,commitStagingAreaImage:tle,discardStagedImages:nle,fitBoundingBoxToStage:NFe,mouseLeftCanvas:DFe,nextStagingAreaImage:LFe,prevStagingAreaImage:FFe,redo:BFe,resetCanvas:$E,resetCanvasInteractionState:zFe,resetCanvasView:jFe,setBoundingBoxCoordinates:VFe,setBoundingBoxDimensions:F6,setBoundingBoxPreviewFill:UFe,setBoundingBoxScaleMethod:GFe,flipBoundingBoxAxes:HFe,setBrushColor:qFe,setBrushSize:WFe,setColorPickerColor:KFe,setCursorPosition:XFe,setInitialCanvasImage:HL,setIsDrawing:QFe,setIsMaskEnabled:YFe,setIsMouseOverBoundingBox:ZFe,setIsMoveBoundingBoxKeyHeld:JFe,setIsMoveStageKeyHeld:eBe,setIsMovingBoundingBox:tBe,setIsMovingStage:nBe,setIsTransformingBoundingBox:rBe,setLayer:iBe,setMaskColor:oBe,setMergedCanvas:rle,setShouldAutoSave:aBe,setShouldCropToBoundingBoxOnSave:sBe,setShouldDarkenOutsideBoundingBox:lBe,setShouldLockBoundingBox:uBe,setShouldPreserveMaskedArea:cBe,setShouldShowBoundingBox:dBe,setShouldShowBrush:fBe,setShouldShowBrushPreview:hBe,setShouldShowCanvasDebugInfo:pBe,setShouldShowCheckboardTransparency:gBe,setShouldShowGrid:mBe,setShouldShowIntermediates:yBe,setShouldShowStagingImage:vBe,setShouldShowStagingOutline:bBe,setShouldSnapToGrid:_Be,setStageCoordinates:SBe,setStageScale:xBe,setTool:wBe,toggleShouldLockBoundingBox:CBe,toggleTool:EBe,undo:ABe,setScaledBoundingBoxDimensions:TBe,setShouldRestrictStrokesToBox:PBe,stagingAreaInitialized:ile,setShouldAntialias:kBe,canvasResized:IBe,canvasBatchIdAdded:ole,canvasBatchIdsReset:ale}=GL.actions,sle=GL.reducer,lle={isModalOpen:!1,imagesToChange:[]},qL=qt({name:"changeBoardModal",initialState:lle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToChangeSelected:(e,t)=>{e.imagesToChange=t.payload},changeBoardReset:e=>{e.imagesToChange=[],e.isModalOpen=!1}}}),{isModalOpenChanged:MBe,imagesToChangeSelected:RBe,changeBoardReset:OBe}=qL.actions,ule=qL.reducer,cle={imagesToDelete:[],isModalOpen:!1},WL=qt({name:"deleteImageModal",initialState:cle,reducers:{isModalOpenChanged:(e,t)=>{e.isModalOpen=t.payload},imagesToDeleteSelected:(e,t)=>{e.imagesToDelete=t.payload},imageDeletionCanceled:e=>{e.imagesToDelete=[],e.isModalOpen=!1}}}),{isModalOpenChanged:NE,imagesToDeleteSelected:dle,imageDeletionCanceled:$Be}=WL.actions,fle=WL.reducer,DE={maxPrompts:100,combinatorial:!0,prompts:[],parsingError:void 0,isError:!1,isLoading:!1,seedBehaviour:"PER_ITERATION"},hle=DE,KL=qt({name:"dynamicPrompts",initialState:hle,reducers:{maxPromptsChanged:(e,t)=>{e.maxPrompts=t.payload},maxPromptsReset:e=>{e.maxPrompts=DE.maxPrompts},combinatorialToggled:e=>{e.combinatorial=!e.combinatorial},promptsChanged:(e,t)=>{e.prompts=t.payload},parsingErrorChanged:(e,t)=>{e.parsingError=t.payload},isErrorChanged:(e,t)=>{e.isError=t.payload},isLoadingChanged:(e,t)=>{e.isLoading=t.payload},seedBehaviourChanged:(e,t)=>{e.seedBehaviour=t.payload}}}),{maxPromptsChanged:ple,maxPromptsReset:gle,combinatorialToggled:mle,promptsChanged:yle,parsingErrorChanged:vle,isErrorChanged:B6,isLoadingChanged:kx,seedBehaviourChanged:NBe}=KL.actions,ble=KL.reducer,Ln=["general"],Pr=["control","mask","user","other"],_le=100,T0=20,Sle=(e,t)=>{const n=new Date(e),r=new Date(t);return n>r?1:n{if(!e)return!1;const n=fg.selectAll(e);if(n.length<=1)return!0;const r=[],i=[];for(let o=0;o=s}else{const o=i[i.length-1];if(!o)return!1;const a=new Date(t.created_at),s=new Date(o.created_at);return a>=s}},Mi=e=>Ln.includes(e.image_category)?Ln:Pr,$t=Qi({selectId:e=>e.image_name,sortComparer:(e,t)=>e.starred&&!t.starred?-1:!e.starred&&t.starred?1:Sle(t.created_at,e.created_at)}),fg=$t.getSelectors(),Li=e=>`images/?${lp.stringify(e,{arrayFormat:"none"})}`,Qe=Do.injectEndpoints({endpoints:e=>({listBoards:e.query({query:t=>({url:"boards/",params:t}),providesTags:t=>{const n=[{type:"Board",id:kr}];return t&&n.push(...t.items.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllBoards:e.query({query:()=>({url:"boards/",params:{all:!0}}),providesTags:t=>{const n=[{type:"Board",id:kr}];return t&&n.push(...t.map(({board_id:r})=>({type:"Board",id:r}))),n}}),listAllImageNamesForBoard:e.query({query:t=>({url:`boards/${t}/image_names`}),providesTags:(t,n,r)=>[{type:"ImageNameList",id:r}],keepUnusedDataFor:0}),getBoardImagesTotal:e.query({query:t=>({url:Li({board_id:t??"none",categories:Ln,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardImagesTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),getBoardAssetsTotal:e.query({query:t=>({url:Li({board_id:t??"none",categories:Pr,is_intermediate:!1,limit:0,offset:0}),method:"GET"}),providesTags:(t,n,r)=>[{type:"BoardAssetsTotal",id:r??"none"}],transformResponse:t=>({total:t.total})}),createBoard:e.mutation({query:t=>({url:"boards/",method:"POST",params:{board_name:t}}),invalidatesTags:[{type:"Board",id:kr}]}),updateBoard:e.mutation({query:({board_id:t,changes:n})=>({url:`boards/${t}`,method:"PATCH",body:n}),invalidatesTags:(t,n,r)=>[{type:"Board",id:r.board_id}]})})}),{useListBoardsQuery:DBe,useListAllBoardsQuery:LBe,useGetBoardImagesTotalQuery:FBe,useGetBoardAssetsTotalQuery:BBe,useCreateBoardMutation:zBe,useUpdateBoardMutation:jBe,useListAllImageNamesForBoardQuery:VBe}=Qe;var XL={},w_={},C_={};Object.defineProperty(C_,"__esModule",{value:!0});C_.createLogMethods=void 0;var xle=function(){return{debug:console.debug.bind(console),error:console.error.bind(console),fatal:console.error.bind(console),info:console.info.bind(console),trace:console.debug.bind(console),warn:console.warn.bind(console)}};C_.createLogMethods=xle;var LE={},E_={};Object.defineProperty(E_,"__esModule",{value:!0});E_.boolean=void 0;const wle=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1"].includes(e.trim().toLowerCase());case"[object Number]":return e.valueOf()===1;case"[object Boolean]":return e.valueOf();default:return!1}};E_.boolean=wle;var A_={};Object.defineProperty(A_,"__esModule",{value:!0});A_.isBooleanable=void 0;const Cle=function(e){switch(Object.prototype.toString.call(e)){case"[object String]":return["true","t","yes","y","on","1","false","f","no","n","off","0"].includes(e.trim().toLowerCase());case"[object Number]":return[0,1].includes(e.valueOf());case"[object Boolean]":return!0;default:return!1}};A_.isBooleanable=Cle;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isBooleanable=e.boolean=void 0;const t=E_;Object.defineProperty(e,"boolean",{enumerable:!0,get:function(){return t.boolean}});const n=A_;Object.defineProperty(e,"isBooleanable",{enumerable:!0,get:function(){return n.isBooleanable}})})(LE);var z6=Object.prototype.toString,QL=function(t){var n=z6.call(t),r=n==="[object Arguments]";return r||(r=n!=="[object Array]"&&t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&z6.call(t.callee)==="[object Function]"),r},Ix,j6;function Ele(){if(j6)return Ix;j6=1;var e;if(!Object.keys){var t=Object.prototype.hasOwnProperty,n=Object.prototype.toString,r=QL,i=Object.prototype.propertyIsEnumerable,o=!i.call({toString:null},"toString"),a=i.call(function(){},"prototype"),s=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(f){var h=f.constructor;return h&&h.prototype===f},u={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},c=function(){if(typeof window>"u")return!1;for(var f in window)try{if(!u["$"+f]&&t.call(window,f)&&window[f]!==null&&typeof window[f]=="object")try{l(window[f])}catch{return!0}}catch{return!0}return!1}(),d=function(f){if(typeof window>"u"||!c)return l(f);try{return l(f)}catch{return!1}};e=function(h){var p=h!==null&&typeof h=="object",m=n.call(h)==="[object Function]",_=r(h),v=p&&n.call(h)==="[object String]",y=[];if(!p&&!m&&!_)throw new TypeError("Object.keys called on a non-object");var g=a&&m;if(v&&h.length>0&&!t.call(h,0))for(var b=0;b0)for(var S=0;S"u"||!Fn?qe:Fn(Uint8Array),Du={"%AggregateError%":typeof AggregateError>"u"?qe:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?qe:ArrayBuffer,"%ArrayIteratorPrototype%":Tc&&Fn?Fn([][Symbol.iterator]()):qe,"%AsyncFromSyncIteratorPrototype%":qe,"%AsyncFunction%":jc,"%AsyncGenerator%":jc,"%AsyncGeneratorFunction%":jc,"%AsyncIteratorPrototype%":jc,"%Atomics%":typeof Atomics>"u"?qe:Atomics,"%BigInt%":typeof BigInt>"u"?qe:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?qe:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?qe:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?qe:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?qe:Float32Array,"%Float64Array%":typeof Float64Array>"u"?qe:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?qe:FinalizationRegistry,"%Function%":ZL,"%GeneratorFunction%":jc,"%Int8Array%":typeof Int8Array>"u"?qe:Int8Array,"%Int16Array%":typeof Int16Array>"u"?qe:Int16Array,"%Int32Array%":typeof Int32Array>"u"?qe:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":Tc&&Fn?Fn(Fn([][Symbol.iterator]())):qe,"%JSON%":typeof JSON=="object"?JSON:qe,"%Map%":typeof Map>"u"?qe:Map,"%MapIteratorPrototype%":typeof Map>"u"||!Tc||!Fn?qe:Fn(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?qe:Promise,"%Proxy%":typeof Proxy>"u"?qe:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?qe:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?qe:Set,"%SetIteratorPrototype%":typeof Set>"u"||!Tc||!Fn?qe:Fn(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?qe:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":Tc&&Fn?Fn(""[Symbol.iterator]()):qe,"%Symbol%":Tc?Symbol:qe,"%SyntaxError%":ff,"%ThrowTypeError%":jle,"%TypedArray%":Ule,"%TypeError%":Md,"%Uint8Array%":typeof Uint8Array>"u"?qe:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?qe:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?qe:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?qe:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?qe:WeakMap,"%WeakRef%":typeof WeakRef>"u"?qe:WeakRef,"%WeakSet%":typeof WeakSet>"u"?qe:WeakSet};if(Fn)try{null.error}catch(e){var Gle=Fn(Fn(e));Du["%Error.prototype%"]=Gle}var Hle=function e(t){var n;if(t==="%AsyncFunction%")n=Rx("async function () {}");else if(t==="%GeneratorFunction%")n=Rx("function* () {}");else if(t==="%AsyncGeneratorFunction%")n=Rx("async function* () {}");else if(t==="%AsyncGenerator%"){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if(t==="%AsyncIteratorPrototype%"){var i=e("%AsyncGenerator%");i&&Fn&&(n=Fn(i.prototype))}return Du[t]=n,n},q6={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},mm=YL,m1=zle,qle=mm.call(Function.call,Array.prototype.concat),Wle=mm.call(Function.apply,Array.prototype.splice),W6=mm.call(Function.call,String.prototype.replace),y1=mm.call(Function.call,String.prototype.slice),Kle=mm.call(Function.call,RegExp.prototype.exec),Xle=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Qle=/\\(\\)?/g,Yle=function(t){var n=y1(t,0,1),r=y1(t,-1);if(n==="%"&&r!=="%")throw new ff("invalid intrinsic syntax, expected closing `%`");if(r==="%"&&n!=="%")throw new ff("invalid intrinsic syntax, expected opening `%`");var i=[];return W6(t,Xle,function(o,a,s,l){i[i.length]=s?W6(l,Qle,"$1"):a||o}),i},Zle=function(t,n){var r=t,i;if(m1(q6,r)&&(i=q6[r],r="%"+i[0]+"%"),m1(Du,r)){var o=Du[r];if(o===jc&&(o=Hle(r)),typeof o>"u"&&!n)throw new Md("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:i,name:r,value:o}}throw new ff("intrinsic "+t+" does not exist!")},Jle=function(t,n){if(typeof t!="string"||t.length===0)throw new Md("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof n!="boolean")throw new Md('"allowMissing" argument must be a boolean');if(Kle(/^%?[^%]*%?$/,t)===null)throw new ff("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var r=Yle(t),i=r.length>0?r[0]:"",o=Zle("%"+i+"%",n),a=o.name,s=o.value,l=!1,u=o.alias;u&&(i=u[0],Wle(r,qle([0,1],u)));for(var c=1,d=!0;c=r.length){var m=Nu(s,f);d=!!m,d&&"get"in m&&!("originalValue"in m.get)?s=m.get:s=s[f]}else d=m1(s,f),s=s[f];d&&!l&&(Du[a]=s)}}return s},eue=Jle,f5=eue("%Object.defineProperty%",!0),h5=function(){if(f5)try{return f5({},"a",{value:1}),!0}catch{return!1}return!1};h5.hasArrayLengthDefineBug=function(){if(!h5())return null;try{return f5([],"length",{value:1}).length!==1}catch{return!0}};var tue=h5,nue=Ple,rue=typeof Symbol=="function"&&typeof Symbol("foo")=="symbol",iue=Object.prototype.toString,oue=Array.prototype.concat,JL=Object.defineProperty,aue=function(e){return typeof e=="function"&&iue.call(e)==="[object Function]"},sue=tue(),eF=JL&&sue,lue=function(e,t,n,r){if(t in e){if(r===!0){if(e[t]===n)return}else if(!aue(r)||!r())return}eF?JL(e,t,{configurable:!0,enumerable:!1,value:n,writable:!0}):e[t]=n},tF=function(e,t){var n=arguments.length>2?arguments[2]:{},r=nue(t);rue&&(r=oue.call(r,Object.getOwnPropertySymbols(t)));for(var i=0;i":return t>e;case":<":return t=":return t>=e;case":<=":return t<=e;default:throw new Error("Unimplemented comparison operator: ".concat(n))}};I_.testComparisonRange=kue;var M_={};Object.defineProperty(M_,"__esModule",{value:!0});M_.testRange=void 0;var Iue=function(e,t){return typeof e=="number"?!(et.max||e===t.max&&!t.maxInclusive):!1};M_.testRange=Iue;(function(e){var t=Ve&&Ve.__assign||function(){return t=Object.assign||function(c){for(var d,f=1,h=arguments.length;f0?{path:l.path,query:new RegExp("("+l.keywords.map(function(u){return(0,Oue.escapeRegexString)(u.trim())}).join("|")+")")}:{path:l.path}})};R_.highlight=Nue;var O_={},lF={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.nearley=n()})(Ve,function(){function t(u,c,d){return this.id=++t.highestId,this.name=u,this.symbols=c,this.postprocess=d,this}t.highestId=0,t.prototype.toString=function(u){var c=typeof u>"u"?this.symbols.map(l).join(" "):this.symbols.slice(0,u).map(l).join(" ")+" ● "+this.symbols.slice(u).map(l).join(" ");return this.name+" → "+c};function n(u,c,d,f){this.rule=u,this.dot=c,this.reference=d,this.data=[],this.wantedBy=f,this.isComplete=this.dot===u.symbols.length}n.prototype.toString=function(){return"{"+this.rule.toString(this.dot)+"}, from: "+(this.reference||0)},n.prototype.nextState=function(u){var c=new n(this.rule,this.dot+1,this.reference,this.wantedBy);return c.left=this,c.right=u,c.isComplete&&(c.data=c.build(),c.right=void 0),c},n.prototype.build=function(){var u=[],c=this;do u.push(c.right.data),c=c.left;while(c.left);return u.reverse(),u},n.prototype.finish=function(){this.rule.postprocess&&(this.data=this.rule.postprocess(this.data,this.reference,a.fail))};function r(u,c){this.grammar=u,this.index=c,this.states=[],this.wants={},this.scannable=[],this.completed={}}r.prototype.process=function(u){for(var c=this.states,d=this.wants,f=this.completed,h=0;h0&&c.push(" ^ "+f+" more lines identical to this"),f=0,c.push(" "+m)),d=m}},a.prototype.getSymbolDisplay=function(u){return s(u)},a.prototype.buildFirstStateStack=function(u,c){if(c.indexOf(u)!==-1)return null;if(u.wantedBy.length===0)return[u];var d=u.wantedBy[0],f=[u].concat(c),h=this.buildFirstStateStack(d,f);return h===null?null:[u].concat(h)},a.prototype.save=function(){var u=this.table[this.current];return u.lexerState=this.lexerState,u},a.prototype.restore=function(u){var c=u.index;this.current=c,this.table[c]=u,this.table.splice(c+1),this.lexerState=u.lexerState,this.results=this.finish()},a.prototype.rewind=function(u){if(!this.options.keepHistory)throw new Error("set option `keepHistory` to enable rewinding");this.restore(this.table[u])},a.prototype.finish=function(){var u=[],c=this.grammar.start,d=this.table[this.table.length-1];return d.states.forEach(function(f){f.rule.name===c&&f.dot===f.rule.symbols.length&&f.reference===0&&f.data!==a.fail&&u.push(f)}),u.map(function(f){return f.data})};function s(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return"character matching "+u;if(u.type)return u.type+" token";if(u.test)return"token matching "+String(u.test);throw new Error("Unknown symbol type: "+u)}}function l(u){var c=typeof u;if(c==="string")return u;if(c==="object"){if(u.literal)return JSON.stringify(u.literal);if(u instanceof RegExp)return u.toString();if(u.type)return"%"+u.type;if(u.test)return"<"+String(u.test)+">";throw new Error("Unknown symbol type: "+u)}}return{Parser:a,Grammar:i,Rule:t}})})(lF);var Due=lF.exports,Yu={},uF={},Ul={};Ul.__esModule=void 0;Ul.__esModule=!0;var Lue=typeof Object.setPrototypeOf=="function",Fue=typeof Object.getPrototypeOf=="function",Bue=typeof Object.defineProperty=="function",zue=typeof Object.create=="function",jue=typeof Object.prototype.hasOwnProperty=="function",Vue=function(t,n){Lue?Object.setPrototypeOf(t,n):t.__proto__=n};Ul.setPrototypeOf=Vue;var Uue=function(t){return Fue?Object.getPrototypeOf(t):t.__proto__||t.prototype};Ul.getPrototypeOf=Uue;var K6=!1,Gue=function e(t,n,r){if(Bue&&!K6)try{Object.defineProperty(t,n,r)}catch{K6=!0,e(t,n,r)}else t[n]=r.value};Ul.defineProperty=Gue;var cF=function(t,n){return jue?t.hasOwnProperty(t,n):t[n]===void 0};Ul.hasOwnProperty=cF;var Hue=function(t,n){if(zue)return Object.create(t,n);var r=function(){};r.prototype=t;var i=new r;if(typeof n>"u")return i;if(typeof n=="null")throw new Error("PropertyDescriptors must not be null.");if(typeof n=="object")for(var o in n)cF(n,o)&&(i[o]=n[o].value);return i};Ul.objectCreate=Hue;(function(e){e.__esModule=void 0,e.__esModule=!0;var t=Ul,n=t.setPrototypeOf,r=t.getPrototypeOf,i=t.defineProperty,o=t.objectCreate,a=new Error().toString()==="[object Error]",s="";function l(u){var c=this.constructor,d=c.name||function(){var _=c.toString().match(/^function\s*([^\s(]+)/);return _===null?s||"Error":_[1]}(),f=d==="Error",h=f?s:d,p=Error.apply(this,arguments);if(n(p,r(this)),!(p instanceof c)||!(p instanceof l)){var p=this;Error.apply(this,arguments),i(p,"message",{configurable:!0,enumerable:!1,value:u,writable:!0})}if(i(p,"name",{configurable:!0,enumerable:!1,value:h,writable:!0}),Error.captureStackTrace&&Error.captureStackTrace(p,f?l:c),p.stack===void 0){var m=new Error(u);m.name=p.name,p.stack=m.stack}return a&&i(p,"toString",{configurable:!0,enumerable:!1,value:function(){return(this.name||"Error")+(typeof this.message>"u"?"":": "+this.message)},writable:!0}),p}s=l.name||"ExtendableError",l.prototype=o(Error.prototype,{constructor:{value:Error,enumerable:!1,writable:!0,configurable:!0}}),e.ExtendableError=l,e.default=e.ExtendableError})(uF);var dF=Ve&&Ve.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Yu,"__esModule",{value:!0});Yu.SyntaxError=Yu.LiqeError=void 0;var que=uF,fF=function(e){dF(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t}(que.ExtendableError);Yu.LiqeError=fF;var Wue=function(e){dF(t,e);function t(n,r,i,o){var a=e.call(this,n)||this;return a.message=n,a.offset=r,a.line=i,a.column=o,a}return t}(fF);Yu.SyntaxError=Wue;var zE={},v1=Ve&&Ve.__assign||function(){return v1=Object.assign||function(e){for(var t,n=1,r=arguments.length;n"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$2"]},{name:"comparison_operator$subexpression$1$string$3",symbols:[{literal:":"},{literal:"<"}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$3"]},{name:"comparison_operator$subexpression$1$string$4",symbols:[{literal:":"},{literal:">"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$4"]},{name:"comparison_operator$subexpression$1$string$5",symbols:[{literal:":"},{literal:"<"},{literal:"="}],postprocess:function(e){return e.join("")}},{name:"comparison_operator$subexpression$1",symbols:["comparison_operator$subexpression$1$string$5"]},{name:"comparison_operator",symbols:["comparison_operator$subexpression$1"],postprocess:function(e,t){return{location:{start:t,end:t+e[0][0].length},type:"ComparisonOperator",operator:e[0][0]}}},{name:"regex",symbols:["regex_body","regex_flags"],postprocess:function(e){return e.join("")}},{name:"regex_body$ebnf$1",symbols:[]},{name:"regex_body$ebnf$1",symbols:["regex_body$ebnf$1","regex_body_char"],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_body",symbols:[{literal:"/"},"regex_body$ebnf$1",{literal:"/"}],postprocess:function(e){return"/"+e[1].join("")+"/"}},{name:"regex_body_char",symbols:[/[^\\]/],postprocess:$a},{name:"regex_body_char",symbols:[{literal:"\\"},/[^\\]/],postprocess:function(e){return"\\"+e[1]}},{name:"regex_flags",symbols:[]},{name:"regex_flags$ebnf$1",symbols:[/[gmiyusd]/]},{name:"regex_flags$ebnf$1",symbols:["regex_flags$ebnf$1",/[gmiyusd]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"regex_flags",symbols:["regex_flags$ebnf$1"],postprocess:function(e){return e[0].join("")}},{name:"unquoted_value$ebnf$1",symbols:[]},{name:"unquoted_value$ebnf$1",symbols:["unquoted_value$ebnf$1",/[a-zA-Z\.\-_*@#$]/],postprocess:function(e){return e[0].concat([e[1]])}},{name:"unquoted_value",symbols:[/[a-zA-Z_*@#$]/,"unquoted_value$ebnf$1"],postprocess:function(e){return e[0]+e[1].join("")}}],ParserStart:"main"};zE.default=Kue;var hF={},$_={},bm={};Object.defineProperty(bm,"__esModule",{value:!0});bm.isSafePath=void 0;var Xue=/^(\.(?:[_a-zA-Z][a-zA-Z\d_]*|\0|[1-9]\d*))+$/u,Que=function(e){return Xue.test(e)};bm.isSafePath=Que;Object.defineProperty($_,"__esModule",{value:!0});$_.createGetValueFunctionBody=void 0;var Yue=bm,Zue=function(e){if(!(0,Yue.isSafePath)(e))throw new Error("Unsafe path.");var t="return subject"+e;return t.replace(/(\.(\d+))/g,".[$2]").replace(/\./g,"?.")};$_.createGetValueFunctionBody=Zue;(function(e){var t=Ve&&Ve.__assign||function(){return t=Object.assign||function(o){for(var a,s=1,l=arguments.length;s\d+) col (?\d+)/,ice=function(e){if(e.trim()==="")return{location:{end:0,start:0},type:"EmptyExpression"};var t=new gF.default.Parser(nce),n;try{n=t.feed(e).results}catch(o){if(typeof(o==null?void 0:o.message)=="string"&&typeof(o==null?void 0:o.offset)=="number"){var r=o.message.match(rce);throw r?new Jue.SyntaxError("Syntax error at line ".concat(r.groups.line," column ").concat(r.groups.column),o.offset,Number(r.groups.line),Number(r.groups.column)):o}throw o}if(n.length===0)throw new Error("Found no parsings.");if(n.length>1)throw new Error("Ambiguous results.");var i=(0,tce.hydrateAst)(n[0]);return i};O_.parse=ice;var N_={};Object.defineProperty(N_,"__esModule",{value:!0});N_.test=void 0;var oce=ym,ace=function(e,t){return(0,oce.filter)(e,[t]).length===1};N_.test=ace;var mF={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=void 0;var t=function(o,a){return a==="double"?'"'.concat(o,'"'):a==="single"?"'".concat(o,"'"):o},n=function(o){if(o.type==="LiteralExpression")return o.quoted&&typeof o.value=="string"?t(o.value,o.quotes):String(o.value);if(o.type==="RegexExpression")return String(o.value);if(o.type==="RangeExpression"){var a=o.range,s=a.min,l=a.max,u=a.minInclusive,c=a.maxInclusive;return"".concat(u?"[":"{").concat(s," TO ").concat(l).concat(c?"]":"}")}if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")},r=function(o){if(o.type!=="Tag")throw new Error("Expected a tag expression.");var a=o.field,s=o.expression,l=o.operator;if(a.type==="ImplicitField")return n(s);var u=a.quoted?t(a.name,a.quotes):a.name,c=" ".repeat(s.location.start-l.location.end);return u+l.operator+c+n(s)},i=function(o){if(o.type==="ParenthesizedExpression"){if(!("location"in o.expression))throw new Error("Expected location in expression.");if(!o.location.end)throw new Error("Expected location end.");var a=" ".repeat(o.expression.location.start-(o.location.start+1)),s=" ".repeat(o.location.end-o.expression.location.end-1);return"(".concat(a).concat((0,e.serialize)(o.expression)).concat(s,")")}if(o.type==="Tag")return r(o);if(o.type==="LogicalExpression"){var l="";return o.operator.type==="BooleanOperator"?(l+=" ".repeat(o.operator.location.start-o.left.location.end),l+=o.operator.operator,l+=" ".repeat(o.right.location.start-o.operator.location.end)):l=" ".repeat(o.right.location.start-o.left.location.end),"".concat((0,e.serialize)(o.left)).concat(l).concat((0,e.serialize)(o.right))}if(o.type==="UnaryOperator")return(o.operator==="NOT"?"NOT ":o.operator)+(0,e.serialize)(o.operand);if(o.type==="EmptyExpression")return"";throw new Error("Unexpected AST type.")};e.serialize=i})(mF);var D_={};Object.defineProperty(D_,"__esModule",{value:!0});D_.isSafeUnquotedExpression=void 0;var sce=function(e){return/^[#$*@A-Z_a-z][#$*.@A-Z_a-z-]*$/.test(e)};D_.isSafeUnquotedExpression=sce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.isSafeUnquotedExpression=e.serialize=e.SyntaxError=e.LiqeError=e.test=e.parse=e.highlight=e.filter=void 0;var t=ym;Object.defineProperty(e,"filter",{enumerable:!0,get:function(){return t.filter}});var n=R_;Object.defineProperty(e,"highlight",{enumerable:!0,get:function(){return n.highlight}});var r=O_;Object.defineProperty(e,"parse",{enumerable:!0,get:function(){return r.parse}});var i=N_;Object.defineProperty(e,"test",{enumerable:!0,get:function(){return i.test}});var o=Yu;Object.defineProperty(e,"LiqeError",{enumerable:!0,get:function(){return o.LiqeError}}),Object.defineProperty(e,"SyntaxError",{enumerable:!0,get:function(){return o.SyntaxError}});var a=mF;Object.defineProperty(e,"serialize",{enumerable:!0,get:function(){return a.serialize}});var s=D_;Object.defineProperty(e,"isSafeUnquotedExpression",{enumerable:!0,get:function(){return s.isSafeUnquotedExpression}})})(sF);var _m={},yF={},Zu={};Object.defineProperty(Zu,"__esModule",{value:!0});Zu.ROARR_LOG_FORMAT_VERSION=Zu.ROARR_VERSION=void 0;Zu.ROARR_VERSION="5.0.0";Zu.ROARR_LOG_FORMAT_VERSION="2.0.0";var Sm={};Object.defineProperty(Sm,"__esModule",{value:!0});Sm.logLevels=void 0;Sm.logLevels={debug:20,error:50,fatal:60,info:30,trace:10,warn:40};var vF={},L_={};Object.defineProperty(L_,"__esModule",{value:!0});L_.hasOwnProperty=void 0;const lce=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);L_.hasOwnProperty=lce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hasOwnProperty=void 0;var t=L_;Object.defineProperty(e,"hasOwnProperty",{enumerable:!0,get:function(){return t.hasOwnProperty}})})(vF);var bF={},F_={},B_={};Object.defineProperty(B_,"__esModule",{value:!0});B_.tokenize=void 0;const uce=/(?:%(?([+0-]|-\+))?(?\d+)?(?\d+\$)?(?\.\d+)?(?[%BCESb-iosux]))|(\\%)/g,cce=e=>{let t;const n=[];let r=0,i=0,o=null;for(;(t=uce.exec(e))!==null;){t.index>i&&(o={literal:e.slice(i,t.index),type:"literal"},n.push(o));const a=t[0];i=t.index+a.length,a==="\\%"||a==="%%"?o&&o.type==="literal"?o.literal+="%":(o={literal:"%",type:"literal"},n.push(o)):t.groups&&(o={conversion:t.groups.conversion,flag:t.groups.flag||null,placeholder:a,position:t.groups.position?Number.parseInt(t.groups.position,10)-1:r++,precision:t.groups.precision?Number.parseInt(t.groups.precision.slice(1),10):null,type:"placeholder",width:t.groups.width?Number.parseInt(t.groups.width,10):null},n.push(o))}return i<=e.length-1&&(o&&o.type==="literal"?o.literal+=e.slice(i):n.push({literal:e.slice(i),type:"literal"})),n};B_.tokenize=cce;Object.defineProperty(F_,"__esModule",{value:!0});F_.createPrintf=void 0;const X6=LE,dce=B_,fce=(e,t)=>t.placeholder,hce=e=>{var t;const n=(o,a,s)=>s==="-"?o.padEnd(a," "):s==="-+"?((Number(o)>=0?"+":"")+o).padEnd(a," "):s==="+"?((Number(o)>=0?"+":"")+o).padStart(a," "):s==="0"?o.padStart(a,"0"):o.padStart(a," "),r=(t=e==null?void 0:e.formatUnboundExpression)!==null&&t!==void 0?t:fce,i={};return(o,...a)=>{let s=i[o];s||(s=i[o]=dce.tokenize(o));let l="";for(const u of s)if(u.type==="literal")l+=u.literal;else{let c=a[u.position];if(c===void 0)l+=r(o,u,a);else if(u.conversion==="b")l+=X6.boolean(c)?"true":"false";else if(u.conversion==="B")l+=X6.boolean(c)?"TRUE":"FALSE";else if(u.conversion==="c")l+=c;else if(u.conversion==="C")l+=String(c).toUpperCase();else if(u.conversion==="i"||u.conversion==="d")c=String(Math.trunc(c)),u.width!==null&&(c=n(c,u.width,u.flag)),l+=c;else if(u.conversion==="e")l+=Number(c).toExponential();else if(u.conversion==="E")l+=Number(c).toExponential().toUpperCase();else if(u.conversion==="f")u.precision!==null&&(c=Number(c).toFixed(u.precision)),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="o")l+=(Number.parseInt(String(c),10)>>>0).toString(8);else if(u.conversion==="s")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else if(u.conversion==="S")u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=String(c).toUpperCase();else if(u.conversion==="u")l+=Number.parseInt(String(c),10)>>>0;else if(u.conversion==="x")c=(Number.parseInt(String(c),10)>>>0).toString(16),u.width!==null&&(c=n(String(c),u.width,u.flag)),l+=c;else throw new Error("Unknown format specifier.")}return l}};F_.createPrintf=hce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.printf=e.createPrintf=void 0;const t=F_;Object.defineProperty(e,"createPrintf",{enumerable:!0,get:function(){return t.createPrintf}}),e.printf=t.createPrintf()})(bF);var p5={exports:{}};(function(e,t){const{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,t.stringify=r,t.configure=_,e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]|[\ud800-\udbff](?![\udc00-\udfff])|(?:[^\ud800-\udbff]|^)[\udc00-\udfff]/;function o(v){return v.length<5e3&&!i.test(v)?`"${v}"`:JSON.stringify(v)}function a(v){if(v.length>200)return v.sort();for(let y=1;yg;)v[b]=v[b-1],b--;v[b]=g}return v}const s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function l(v){return s.call(v)!==void 0&&v.length!==0}function u(v,y,g){v.length= 1`)}return g===void 0?1/0:g}function h(v){return v===1?"1 item":`${v} items`}function p(v){const y=new Set;for(const g of v)(typeof g=="string"||typeof g=="number")&&y.add(String(g));return y}function m(v){if(n.call(v,"strict")){const y=v.strict;if(typeof y!="boolean")throw new TypeError('The "strict" argument must be of type boolean');if(y)return g=>{let b=`Object can not safely be stringified. Received type ${typeof g}`;throw typeof g!="function"&&(b+=` (${g.toString()})`),new Error(b)}}}function _(v){v={...v};const y=m(v);y&&(v.bigint===void 0&&(v.bigint=!1),"circularValue"in v||(v.circularValue=Error));const g=c(v),b=d(v,"bigint"),S=d(v,"deterministic"),x=f(v,"maximumDepth"),w=f(v,"maximumBreadth");function C(M,E,P,N,L,O){let R=E[M];switch(typeof R=="object"&&R!==null&&typeof R.toJSON=="function"&&(R=R.toJSON(M)),R=N.call(E,M,R),typeof R){case"string":return o(R);case"object":{if(R===null)return"null";if(P.indexOf(R)!==-1)return g;let $="",z=",";const V=O;if(Array.isArray(R)){if(R.length===0)return"[]";if(xw){const fe=R.length-w-1;$+=`${z}"... ${h(fe)} not stringified"`}return L!==""&&($+=` +${V}`),P.pop(),`[${$}]`}let H=Object.keys(R);const Q=H.length;if(Q===0)return"{}";if(xw){const X=Q-w;$+=`${J}"...":${Z}"${h(X)} not stringified"`,J=z}return L!==""&&J.length>1&&($=` +${O}${$} +${V}`),P.pop(),`{${$}}`}case"number":return isFinite(R)?String(R):y?y(R):"null";case"boolean":return R===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(R);default:return y?y(R):void 0}}function T(M,E,P,N,L,O){switch(typeof E=="object"&&E!==null&&typeof E.toJSON=="function"&&(E=E.toJSON(M)),typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(P.indexOf(E)!==-1)return g;const R=O;let $="",z=",";if(Array.isArray(E)){if(E.length===0)return"[]";if(xw){const j=E.length-w-1;$+=`${z}"... ${h(j)} not stringified"`}return L!==""&&($+=` +${R}`),P.pop(),`[${$}]`}P.push(E);let V="";L!==""&&(O+=L,z=`, +${O}`,V=" ");let H="";for(const Q of N){const Z=T(Q,E[Q],P,N,L,O);Z!==void 0&&($+=`${H}${o(Q)}:${V}${Z}`,H=z)}return L!==""&&H.length>1&&($=` +${O}${$} +${R}`),P.pop(),`{${$}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(E);default:return y?y(E):void 0}}function A(M,E,P,N,L){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(M),typeof E!="object")return A(M,E,P,N,L);if(E===null)return"null"}if(P.indexOf(E)!==-1)return g;const O=L;if(Array.isArray(E)){if(E.length===0)return"[]";if(xw){const ne=E.length-w-1;Z+=`${J}"... ${h(ne)} not stringified"`}return Z+=` +${O}`,P.pop(),`[${Z}]`}let R=Object.keys(E);const $=R.length;if($===0)return"{}";if(xw){const Z=$-w;V+=`${H}"...": "${h(Z)} not stringified"`,H=z}return H!==""&&(V=` +${L}${V} +${O}`),P.pop(),`{${V}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(E);default:return y?y(E):void 0}}function k(M,E,P){switch(typeof E){case"string":return o(E);case"object":{if(E===null)return"null";if(typeof E.toJSON=="function"){if(E=E.toJSON(M),typeof E!="object")return k(M,E,P);if(E===null)return"null"}if(P.indexOf(E)!==-1)return g;let N="";if(Array.isArray(E)){if(E.length===0)return"[]";if(xw){const Q=E.length-w-1;N+=`,"... ${h(Q)} not stringified"`}return P.pop(),`[${N}]`}let L=Object.keys(E);const O=L.length;if(O===0)return"{}";if(xw){const z=O-w;N+=`${R}"...":"${h(z)} not stringified"`}return P.pop(),`{${N}}`}case"number":return isFinite(E)?String(E):y?y(E):"null";case"boolean":return E===!0?"true":"false";case"undefined":return;case"bigint":if(b)return String(E);default:return y?y(E):void 0}}function D(M,E,P){if(arguments.length>1){let N="";if(typeof P=="number"?N=" ".repeat(Math.min(P,10)):typeof P=="string"&&(N=P.slice(0,10)),E!=null){if(typeof E=="function")return C("",{"":M},[],E,N,"");if(Array.isArray(E))return T("",M,[],p(E),N,"")}if(N.length!==0)return A("",M,[],N,"")}return k("",M,[])}return D}})(p5,p5.exports);var pce=p5.exports;(function(e){var t=Ve&&Ve.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(e,"__esModule",{value:!0}),e.createLogger=void 0;const n=Zu,r=Sm,i=vF,o=bF,a=t(FE),s=t(pce);let l=!1;const u=(0,a.default)(),c=()=>u.ROARR,d=()=>({messageContext:{},transforms:[]}),f=()=>{const g=c().asyncLocalStorage;if(!g)throw new Error("AsyncLocalContext is unavailable.");const b=g.getStore();return b||d()},h=()=>!!c().asyncLocalStorage,p=()=>{if(h()){const g=f();return(0,i.hasOwnProperty)(g,"sequenceRoot")&&(0,i.hasOwnProperty)(g,"sequence")&&typeof g.sequence=="number"?String(g.sequenceRoot)+"."+String(g.sequence++):String(c().sequence++)}return String(c().sequence++)},m=(g,b)=>(S,x,w,C,T,A,k,D,M,E)=>{g.child({logLevel:b})(S,x,w,C,T,A,k,D,M,E)},_=1e3,v=(g,b)=>(S,x,w,C,T,A,k,D,M,E)=>{const P=(0,s.default)({a:S,b:x,c:w,d:C,e:T,f:A,g:k,h:D,i:M,j:E,logLevel:b});if(!P)throw new Error("Expected key to be a string");const N=c().onceLog;N.has(P)||(N.add(P),N.size>_&&N.clear(),g.child({logLevel:b})(S,x,w,C,T,A,k,D,M,E))},y=(g,b={},S=[])=>{const x=(w,C,T,A,k,D,M,E,P,N)=>{const L=Date.now(),O=p();let R;h()?R=f():R=d();let $,z;if(typeof w=="string"?$={...R.messageContext,...b}:$={...R.messageContext,...b,...w},typeof w=="string"&&C===void 0)z=w;else if(typeof w=="string"){if(!w.includes("%"))throw new Error("When a string parameter is followed by other arguments, then it is assumed that you are attempting to format a message using printf syntax. You either forgot to add printf bindings or if you meant to add context to the log message, pass them in an object as the first parameter.");z=(0,o.printf)(w,C,T,A,k,D,M,E,P,N)}else{let H=C;if(typeof C!="string")if(C===void 0)H="";else throw new TypeError("Message must be a string. Received "+typeof C+".");z=(0,o.printf)(H,T,A,k,D,M,E,P,N)}let V={context:$,message:z,sequence:O,time:L,version:n.ROARR_LOG_FORMAT_VERSION};for(const H of[...R.transforms,...S])if(V=H(V),typeof V!="object"||V===null)throw new Error("Message transform function must return a message object.");g(V)};return x.child=w=>{let C;return h()?C=f():C=d(),typeof w=="function"?(0,e.createLogger)(g,{...C.messageContext,...b,...w},[w,...S]):(0,e.createLogger)(g,{...C.messageContext,...b,...w},S)},x.getContext=()=>{let w;return h()?w=f():w=d(),{...w.messageContext,...b}},x.adopt=async(w,C)=>{if(!h())return l===!1&&(l=!0,g({context:{logLevel:r.logLevels.warn,package:"roarr"},message:"async_hooks are unavailable; Roarr.adopt will not function as expected",sequence:p(),time:Date.now(),version:n.ROARR_LOG_FORMAT_VERSION})),w();const T=f();let A;(0,i.hasOwnProperty)(T,"sequenceRoot")&&(0,i.hasOwnProperty)(T,"sequence")&&typeof T.sequence=="number"?A=T.sequenceRoot+"."+String(T.sequence++):A=String(c().sequence++);let k={...T.messageContext};const D=[...T.transforms];typeof C=="function"?D.push(C):k={...k,...C};const M=c().asyncLocalStorage;if(!M)throw new Error("Async local context unavailable.");return M.run({messageContext:k,sequence:0,sequenceRoot:A,transforms:D},()=>w())},x.debug=m(x,r.logLevels.debug),x.debugOnce=v(x,r.logLevels.debug),x.error=m(x,r.logLevels.error),x.errorOnce=v(x,r.logLevels.error),x.fatal=m(x,r.logLevels.fatal),x.fatalOnce=v(x,r.logLevels.fatal),x.info=m(x,r.logLevels.info),x.infoOnce=v(x,r.logLevels.info),x.trace=m(x,r.logLevels.trace),x.traceOnce=v(x,r.logLevels.trace),x.warn=m(x,r.logLevels.warn),x.warnOnce=v(x,r.logLevels.warn),x};e.createLogger=y})(yF);var z_={},gce=function(t,n){for(var r=t.split("."),i=n.split("."),o=0;o<3;o++){var a=Number(r[o]),s=Number(i[o]);if(a>s)return 1;if(s>a)return-1;if(!isNaN(a)&&isNaN(s))return 1;if(isNaN(a)&&!isNaN(s))return-1}return 0},mce=Ve&&Ve.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(z_,"__esModule",{value:!0});z_.createRoarrInitialGlobalStateBrowser=void 0;const Q6=Zu,Y6=mce(gce),yce=e=>{const t=(e.versions||[]).concat();return t.length>1&&t.sort(Y6.default),t.includes(Q6.ROARR_VERSION)||t.push(Q6.ROARR_VERSION),t.sort(Y6.default),{sequence:0,...e,versions:t}};z_.createRoarrInitialGlobalStateBrowser=yce;var j_={};Object.defineProperty(j_,"__esModule",{value:!0});j_.getLogLevelName=void 0;const vce=e=>e<=10?"trace":e<=20?"debug":e<=30?"info":e<=40?"warn":e<=50?"error":"fatal";j_.getLogLevelName=vce;(function(e){var t=Ve&&Ve.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.getLogLevelName=e.logLevels=e.Roarr=e.ROARR=void 0;const n=yF,r=z_,o=(0,t(FE).default)(),a=(0,r.createRoarrInitialGlobalStateBrowser)(o.ROARR||{});e.ROARR=a,o.ROARR=a;const s=d=>JSON.stringify(d),l=(0,n.createLogger)(d=>{var f;a.write&&a.write(((f=a.serializeMessage)!==null&&f!==void 0?f:s)(d))});e.Roarr=l;var u=Sm;Object.defineProperty(e,"logLevels",{enumerable:!0,get:function(){return u.logLevels}});var c=j_;Object.defineProperty(e,"getLogLevelName",{enumerable:!0,get:function(){return c.getLogLevelName}})})(_m);var bce=Ve&&Ve.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i0?h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message," %O"),m,_,v,d):h("%c ".concat(f," %c").concat(c?" [".concat(String(c),"]:"):"","%c ").concat(s.message),m,_,v)}}};w_.createLogWriter=Pce;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createLogWriter=void 0;var t=w_;Object.defineProperty(e,"createLogWriter",{enumerable:!0,get:function(){return t.createLogWriter}})})(XL);_m.ROARR.write=XL.createLogWriter();const SF={};_m.Roarr.child(SF);const V_=Ta(_m.Roarr.child(SF)),le=e=>V_.get().child({namespace:e}),UBe=["trace","debug","info","warn","error","fatal"],GBe={trace:10,debug:20,info:30,warn:40,error:50,fatal:60},xF=Ta(),wF=F.enum(["Any","BoardField","boolean","BooleanCollection","BooleanPolymorphic","ClipField","Collection","CollectionItem","ColorCollection","ColorField","ColorPolymorphic","ConditioningCollection","ConditioningField","ConditioningPolymorphic","ControlCollection","ControlField","ControlNetModelField","ControlPolymorphic","DenoiseMaskField","enum","float","FloatCollection","FloatPolymorphic","ImageCollection","ImageField","ImagePolymorphic","integer","IntegerCollection","IntegerPolymorphic","IPAdapterCollection","IPAdapterField","IPAdapterModelField","IPAdapterPolymorphic","LatentsCollection","LatentsField","LatentsPolymorphic","LoRAModelField","MainModelField","MetadataField","MetadataCollection","MetadataItemField","MetadataItemCollection","MetadataItemPolymorphic","ONNXModelField","Scheduler","SDXLMainModelField","SDXLRefinerModelField","string","StringCollection","StringPolymorphic","T2IAdapterCollection","T2IAdapterField","T2IAdapterModelField","T2IAdapterPolymorphic","UNetField","VaeField","VaeModelField"]),kce=F.enum(["WorkflowField","IsIntermediate","MetadataField"]),J6=e=>wF.safeParse(e).success||kce.safeParse(e).success;F.enum(["connection","direct","any"]);const CF=F.object({id:F.string().trim().min(1),name:F.string().trim().min(1),type:wF}),Ice=CF.extend({fieldKind:F.literal("output")}),Ae=CF.extend({fieldKind:F.literal("input"),label:F.string()}),xs=F.object({model_name:F.string().trim().min(1),base_model:Vl}),Rf=F.object({image_name:F.string().trim().min(1)}),Mce=F.object({board_id:F.string().trim().min(1)}),b1=F.object({latents_name:F.string().trim().min(1),seed:F.number().int().optional()}),_1=F.object({conditioning_name:F.string().trim().min(1)}),Rce=F.object({mask_name:F.string().trim().min(1),masked_latents_name:F.string().trim().min(1).optional()}),Oce=Ae.extend({type:F.literal("integer"),value:F.number().int().optional()}),$ce=Ae.extend({type:F.literal("IntegerCollection"),value:F.array(F.number().int()).optional()}),Nce=Ae.extend({type:F.literal("IntegerPolymorphic"),value:F.number().int().optional()}),Dce=Ae.extend({type:F.literal("float"),value:F.number().optional()}),Lce=Ae.extend({type:F.literal("FloatCollection"),value:F.array(F.number()).optional()}),Fce=Ae.extend({type:F.literal("FloatPolymorphic"),value:F.number().optional()}),Bce=Ae.extend({type:F.literal("string"),value:F.string().optional()}),zce=Ae.extend({type:F.literal("StringCollection"),value:F.array(F.string()).optional()}),jce=Ae.extend({type:F.literal("StringPolymorphic"),value:F.string().optional()}),Vce=Ae.extend({type:F.literal("boolean"),value:F.boolean().optional()}),Uce=Ae.extend({type:F.literal("BooleanCollection"),value:F.array(F.boolean()).optional()}),Gce=Ae.extend({type:F.literal("BooleanPolymorphic"),value:F.boolean().optional()}),Hce=Ae.extend({type:F.literal("enum"),value:F.string().optional()}),qce=Ae.extend({type:F.literal("LatentsField"),value:b1.optional()}),Wce=Ae.extend({type:F.literal("LatentsCollection"),value:F.array(b1).optional()}),Kce=Ae.extend({type:F.literal("LatentsPolymorphic"),value:F.union([b1,F.array(b1)]).optional()}),Xce=Ae.extend({type:F.literal("DenoiseMaskField"),value:Rce.optional()}),Qce=Ae.extend({type:F.literal("ConditioningField"),value:_1.optional()}),Yce=Ae.extend({type:F.literal("ConditioningCollection"),value:F.array(_1).optional()}),Zce=Ae.extend({type:F.literal("ConditioningPolymorphic"),value:F.union([_1,F.array(_1)]).optional()}),Jce=xs,hg=F.object({image:Rf,control_model:Jce,control_weight:F.union([F.number(),F.array(F.number())]).optional(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional(),control_mode:F.enum(["balanced","more_prompt","more_control","unbalanced"]).optional(),resize_mode:F.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),ede=Ae.extend({type:F.literal("ControlField"),value:hg.optional()}),tde=Ae.extend({type:F.literal("ControlPolymorphic"),value:F.union([hg,F.array(hg)]).optional()}),nde=Ae.extend({type:F.literal("ControlCollection"),value:F.array(hg).optional()}),rde=xs,pg=F.object({image:Rf,ip_adapter_model:rde,weight:F.number(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional()}),ide=Ae.extend({type:F.literal("IPAdapterField"),value:pg.optional()}),ode=Ae.extend({type:F.literal("IPAdapterPolymorphic"),value:F.union([pg,F.array(pg)]).optional()}),ade=Ae.extend({type:F.literal("IPAdapterCollection"),value:F.array(pg).optional()}),sde=xs,gg=F.object({image:Rf,t2i_adapter_model:sde,weight:F.union([F.number(),F.array(F.number())]).optional(),begin_step_percent:F.number().optional(),end_step_percent:F.number().optional(),resize_mode:F.enum(["just_resize","crop_resize","fill_resize","just_resize_simple"]).optional()}),lde=Ae.extend({type:F.literal("T2IAdapterField"),value:gg.optional()}),ude=Ae.extend({type:F.literal("T2IAdapterPolymorphic"),value:F.union([gg,F.array(gg)]).optional()}),cde=Ae.extend({type:F.literal("T2IAdapterCollection"),value:F.array(gg).optional()}),dde=F.enum(["onnx","main","vae","lora","controlnet","embedding"]),fde=F.enum(["unet","text_encoder","text_encoder_2","tokenizer","tokenizer_2","vae","vae_decoder","vae_encoder","scheduler","safety_checker"]),hf=xs.extend({model_type:dde,submodel:fde.optional()}),EF=hf.extend({weight:F.number().optional()}),hde=F.object({unet:hf,scheduler:hf,loras:F.array(EF)}),pde=Ae.extend({type:F.literal("UNetField"),value:hde.optional()}),gde=F.object({tokenizer:hf,text_encoder:hf,skipped_layers:F.number(),loras:F.array(EF)}),mde=Ae.extend({type:F.literal("ClipField"),value:gde.optional()}),yde=F.object({vae:hf}),vde=Ae.extend({type:F.literal("VaeField"),value:yde.optional()}),bde=Ae.extend({type:F.literal("ImageField"),value:Rf.optional()}),_de=Ae.extend({type:F.literal("BoardField"),value:Mce.optional()}),Sde=Ae.extend({type:F.literal("ImagePolymorphic"),value:Rf.optional()}),xde=Ae.extend({type:F.literal("ImageCollection"),value:F.array(Rf).optional()}),wde=Ae.extend({type:F.literal("MainModelField"),value:gm.optional()}),Cde=Ae.extend({type:F.literal("SDXLMainModelField"),value:gm.optional()}),Ede=Ae.extend({type:F.literal("SDXLRefinerModelField"),value:gm.optional()}),AF=xs,Ade=Ae.extend({type:F.literal("VaeModelField"),value:AF.optional()}),TF=xs,Tde=Ae.extend({type:F.literal("LoRAModelField"),value:TF.optional()}),Pde=xs,kde=Ae.extend({type:F.literal("ControlNetModelField"),value:Pde.optional()}),Ide=xs,Mde=Ae.extend({type:F.literal("IPAdapterModelField"),value:Ide.optional()}),Rde=xs,Ode=Ae.extend({type:F.literal("T2IAdapterModelField"),value:Rde.optional()}),$de=Ae.extend({type:F.literal("Collection"),value:F.array(F.any()).optional()}),Nde=Ae.extend({type:F.literal("CollectionItem"),value:F.any().optional()}),S1=F.object({label:F.string(),value:F.any()}),Dde=Ae.extend({type:F.literal("MetadataItemField"),value:S1.optional()}),Lde=Ae.extend({type:F.literal("MetadataItemCollection"),value:F.array(S1).optional()}),Fde=Ae.extend({type:F.literal("MetadataItemPolymorphic"),value:F.union([S1,F.array(S1)]).optional()}),PF=F.record(F.any()),Bde=Ae.extend({type:F.literal("MetadataField"),value:PF.optional()}),zde=Ae.extend({type:F.literal("MetadataCollection"),value:F.array(PF).optional()}),x1=F.object({r:F.number().int().min(0).max(255),g:F.number().int().min(0).max(255),b:F.number().int().min(0).max(255),a:F.number().int().min(0).max(255)}),jde=Ae.extend({type:F.literal("ColorField"),value:x1.optional()}),Vde=Ae.extend({type:F.literal("ColorCollection"),value:F.array(x1).optional()}),Ude=Ae.extend({type:F.literal("ColorPolymorphic"),value:F.union([x1,F.array(x1)]).optional()}),Gde=Ae.extend({type:F.literal("Scheduler"),value:JD.optional()}),Hde=Ae.extend({type:F.literal("Any"),value:F.any().optional()}),qde=F.discriminatedUnion("type",[Hde,_de,Uce,Vce,Gce,mde,$de,Nde,jde,Vde,Ude,Qce,Yce,Zce,ede,kde,nde,tde,Xce,Hce,Lce,Dce,Fce,xde,Sde,bde,$ce,Nce,Oce,ide,Mde,ade,ode,qce,Wce,Kce,Tde,wde,Gde,Cde,Ede,zce,jce,Bce,lde,Ode,cde,ude,pde,vde,Ade,Dde,Lde,Fde,Bde,zde]),HBe=e=>!!(e&&e.fieldKind==="input"),qBe=e=>!!(e&&e.fieldKind==="input"),P0=e=>!!(e&&!("$ref"in e)),e8=e=>!!(e&&!("$ref"in e)&&e.type==="array"),k0=e=>!!(e&&!("$ref"in e)&&e.type!=="array"),nu=e=>!!(e&&"$ref"in e),Wde=e=>"class"in e&&e.class==="invocation",Kde=e=>"class"in e&&e.class==="output",t8=e=>!("$ref"in e),kF=F.object({lora:TF.deepPartial(),weight:F.number()}),Xde=hg.deepPartial(),Qde=pg.deepPartial(),Yde=gg.deepPartial(),Zde=F.object({app_version:F.string().nullish().catch(null),generation_mode:F.string().nullish().catch(null),created_by:F.string().nullish().catch(null),positive_prompt:F.string().nullish().catch(null),negative_prompt:F.string().nullish().catch(null),width:F.number().int().nullish().catch(null),height:F.number().int().nullish().catch(null),seed:F.number().int().nullish().catch(null),rand_device:F.string().nullish().catch(null),cfg_scale:F.number().nullish().catch(null),steps:F.number().int().nullish().catch(null),scheduler:F.string().nullish().catch(null),clip_skip:F.number().int().nullish().catch(null),model:F.union([e_.deepPartial(),nL.deepPartial()]).nullish().catch(null),controlnets:F.array(Xde).nullish().catch(null),ipAdapters:F.array(Qde).nullish().catch(null),t2iAdapters:F.array(Yde).nullish().catch(null),loras:F.array(kF).nullish().catch(null),vae:AF.nullish().catch(null),strength:F.number().nullish().catch(null),init_image:F.string().nullish().catch(null),positive_style_prompt:F.string().nullish().catch(null),negative_style_prompt:F.string().nullish().catch(null),refiner_model:SE.deepPartial().nullish().catch(null),refiner_cfg_scale:F.number().nullish().catch(null),refiner_steps:F.number().int().nullish().catch(null),refiner_scheduler:F.string().nullish().catch(null),refiner_positive_aesthetic_score:F.number().nullish().catch(null),refiner_negative_aesthetic_score:F.number().nullish().catch(null),refiner_start:F.number().nullish().catch(null)}).passthrough(),jE=F.string().refine(e=>{const[t,n,r]=e.split(".");return t!==void 0&&Number.isInteger(Number(t))&&n!==void 0&&Number.isInteger(Number(n))&&r!==void 0&&Number.isInteger(Number(r))});jE.transform(e=>{const[t,n,r]=e.split(".");return{major:Number(t),minor:Number(n),patch:Number(r)}});const n8=F.object({id:F.string().trim().min(1),type:F.string().trim().min(1),inputs:F.record(qde),outputs:F.record(Ice),label:F.string(),isOpen:F.boolean(),notes:F.string(),embedWorkflow:F.boolean(),isIntermediate:F.boolean(),useCache:F.boolean().optional(),version:jE.optional()}),Jde=F.preprocess(e=>{var t;try{const n=n8.parse(e);if(!_ne(n,"useCache")){const r=(t=xF.get())==null?void 0:t.getState().nodes.nodeTemplates,i=r==null?void 0:r[n.type];let o=!0;i&&(o=i.useCache),Object.assign(n,{useCache:o})}return n}catch{return e}},n8.extend({useCache:F.boolean()})),efe=F.object({id:F.string().trim().min(1),type:F.literal("notes"),label:F.string(),isOpen:F.boolean(),notes:F.string()}),IF=F.object({x:F.number(),y:F.number()}).default({x:0,y:0}),w1=F.number().gt(0).nullish(),MF=F.object({id:F.string().trim().min(1),type:F.literal("invocation"),data:Jde,width:w1,height:w1,position:IF}),g5=e=>MF.safeParse(e).success,tfe=F.object({id:F.string().trim().min(1),type:F.literal("notes"),data:efe,width:w1,height:w1,position:IF}),RF=F.discriminatedUnion("type",[MF,tfe]),nfe=F.object({source:F.string().trim().min(1),sourceHandle:F.string().trim().min(1),target:F.string().trim().min(1),targetHandle:F.string().trim().min(1),id:F.string().trim().min(1),type:F.literal("default")}),rfe=F.object({source:F.string().trim().min(1),target:F.string().trim().min(1),id:F.string().trim().min(1),type:F.literal("collapsed")}),OF=F.union([nfe,rfe]),ife=F.object({nodeId:F.string().trim().min(1),fieldName:F.string().trim().min(1)}),ofe="1.0.0",afe=F.object({name:F.string().default(""),author:F.string().default(""),description:F.string().default(""),version:F.string().default(""),contact:F.string().default(""),tags:F.string().default(""),notes:F.string().default(""),nodes:F.array(RF).default([]),edges:F.array(OF).default([]),exposedFields:F.array(ife).default([]),meta:F.object({version:jE}).default({version:ofe})});afe.transform(e=>{const{nodes:t,edges:n}=e,r=[],i=t.filter(g5),o=sE(i,"id");return n.forEach((a,s)=>{const l=o[a.source],u=o[a.target],c=[];if(l?a.type==="default"&&!(a.sourceHandle in l.data.outputs)&&c.push(`${oe.t("nodes.outputField")}"${a.source}.${a.sourceHandle}" ${oe.t("nodes.doesNotExist")}`):c.push(`${oe.t("nodes.outputNode")} ${a.source} ${oe.t("nodes.doesNotExist")}`),u?a.type==="default"&&!(a.targetHandle in u.data.inputs)&&c.push(`${oe.t("nodes.inputField")} "${a.target}.${a.targetHandle}" ${oe.t("nodes.doesNotExist")}`):c.push(`${oe.t("nodes.inputNode")} ${a.target} ${oe.t("nodes.doesNotExist")}`),c.length){delete n[s];const d=a.type==="default"?a.sourceHandle:a.source,f=a.type==="default"?a.targetHandle:a.target;r.push({message:`${oe.t("nodes.edge")} "${d} -> ${f}" ${oe.t("nodes.skipped")}`,issues:c,data:a})}}),{workflow:e,warnings:r}});const En=e=>!!(e&&e.type==="invocation"),WBe=e=>!!(e&&!["notes","current_image"].includes(e.type)),r8=e=>!!(e&&e.type==="notes");var vu=(e=>(e[e.PENDING=0]="PENDING",e[e.IN_PROGRESS=1]="IN_PROGRESS",e[e.COMPLETED=2]="COMPLETED",e[e.FAILED=3]="FAILED",e))(vu||{});const ue=Do.injectEndpoints({endpoints:e=>({listImages:e.query({query:t=>({url:Li(t),method:"GET"}),providesTags:(t,n,{board_id:r,categories:i})=>[{type:"ImageList",id:Li({board_id:r,categories:i})}],serializeQueryArgs:({queryArgs:t})=>{const{board_id:n,categories:r}=t;return Li({board_id:n,categories:r})},transformResponse(t){const{items:n}=t;return $t.addMany($t.getInitialState(),n)},merge:(t,n)=>{$t.addMany(t,fg.selectAll(n))},forceRefetch({currentArg:t,previousArg:n}){return(t==null?void 0:t.offset)!==(n==null?void 0:n.offset)},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;fg.selectAll(i).forEach(o=>{n(ue.util.upsertQueryData("getImageDTO",o.image_name,o))})}catch{}},keepUnusedDataFor:86400}),getIntermediatesCount:e.query({query:()=>({url:"images/intermediates"}),providesTags:["IntermediatesCount"]}),clearIntermediates:e.mutation({query:()=>({url:"images/intermediates",method:"DELETE"}),invalidatesTags:["IntermediatesCount"]}),getImageDTO:e.query({query:t=>({url:`images/i/${t}`}),providesTags:(t,n,r)=>[{type:"Image",id:r}],keepUnusedDataFor:86400}),getImageMetadata:e.query({query:t=>({url:`images/i/${t}/metadata`}),providesTags:(t,n,r)=>[{type:"ImageMetadata",id:r}],transformResponse:t=>{if(t){const n=Zde.safeParse(t);if(n.success)return n.data;le("images").warn("Problem parsing metadata")}},keepUnusedDataFor:86400}),deleteImage:e.mutation({query:({image_name:t})=>({url:`images/i/${t}`,method:"DELETE"}),async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){const{image_name:i,board_id:o}=t,a=Pr.includes(t.image_category),s={board_id:o??"none",categories:Mi(t)},l=[];l.push(n(ue.util.updateQueryData("listImages",s,u=>{$t.removeOne(u,i)}))),l.push(n(Qe.util.updateQueryData(a?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));try{await r}catch{l.forEach(u=>{u.undo()})}}}),deleteImages:e.mutation({query:({imageDTOs:t})=>({url:"images/delete",method:"POST",body:{image_names:t.map(r=>r.image_name)}}),async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,o=sE(t,"image_name");i.deleted_images.forEach(a=>{const s=o[a];if(s){const l={board_id:s.board_id??"none",categories:Mi(s)};n(ue.util.updateQueryData("listImages",l,c=>{$t.removeOne(c,a)}));const u=Pr.includes(s.image_category);n(Qe.util.updateQueryData(u?"getBoardAssetsTotal":"getBoardImagesTotal",s.board_id??"none",c=>{c.total=Math.max(c.total-1,0)}))}})}catch{}}}),changeImageIsIntermediate:e.mutation({query:({imageDTO:t,is_intermediate:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{is_intermediate:n}}),async onQueryStarted({imageDTO:t,is_intermediate:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[];a.push(r(ue.util.updateQueryData("getImageDTO",t.image_name,u=>{Object.assign(u,{is_intermediate:n})})));const s=Mi(t),l=Pr.includes(t.image_category);if(n)a.push(r(ue.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:s},u=>{$t.removeOne(u,t.image_name)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",u=>{u.total=Math.max(u.total-1,0)})));else{a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",p=>{p.total+=1})));const u={board_id:t.board_id??"none",categories:s},c=ue.endpoints.listImages.select(u)(o()),{data:d}=Ln.includes(t.image_category)?Qe.endpoints.getBoardImagesTotal.select(t.board_id??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=tu(c.data,t);(f||h)&&a.push(r(ue.util.updateQueryData("listImages",u,p=>{$t.upsertOne(p,t)})))}try{await i}catch{a.forEach(u=>u.undo())}}}),changeImageSessionId:e.mutation({query:({imageDTO:t,session_id:n})=>({url:`images/i/${t.image_name}`,method:"PATCH",body:{session_id:n}}),async onQueryStarted({imageDTO:t,session_id:n},{dispatch:r,queryFulfilled:i}){const o=[];o.push(r(ue.util.updateQueryData("getImageDTO",t.image_name,a=>{Object.assign(a,{session_id:n})})));try{await i}catch{o.forEach(a=>a.undo())}}}),starImages:e.mutation({query:({imageDTOs:t})=>({url:"images/star",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=Mi(r[0]),o=r[0].board_id??void 0;return[{type:"ImageList",id:Li({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=Mi(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(ue.util.updateQueryData("getImageDTO",c,_=>{_.starred=!0}));const d={board_id:l??"none",categories:s},f=ue.endpoints.listImages.select(d)(i()),{data:h}=Ln.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(l??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=T0?tu(f.data,u):!0;(p||m)&&n(ue.util.updateQueryData("listImages",d,_=>{$t.upsertOne(_,{...u,starred:!0})}))})}catch{}}}),unstarImages:e.mutation({query:({imageDTOs:t})=>({url:"images/unstar",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{if(r[0]){const i=Mi(r[0]),o=r[0].board_id??void 0;return[{type:"ImageList",id:Li({board_id:o,categories:i})},{type:"Board",id:o}]}return[]},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,a=t.filter(u=>o.updated_image_names.includes(u.image_name));if(!a[0])return;const s=Mi(a[0]),l=a[0].board_id;a.forEach(u=>{const{image_name:c}=u;n(ue.util.updateQueryData("getImageDTO",c,_=>{_.starred=!1}));const d={board_id:l??"none",categories:s},f=ue.endpoints.listImages.select(d)(i()),{data:h}=Ln.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(l??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=T0?tu(f.data,u):!0;(p||m)&&n(ue.util.updateQueryData("listImages",d,_=>{$t.upsertOne(_,{...u,starred:!1})}))})}catch{}}}),uploadImage:e.mutation({query:({file:t,image_category:n,is_intermediate:r,session_id:i,board_id:o,crop_visible:a})=>{const s=new FormData;return s.append("file",t),{url:"images/upload",method:"POST",body:s,params:{image_category:n,is_intermediate:r,session_id:i,board_id:o==="none"?void 0:o,crop_visible:a}}},async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r;if(i.is_intermediate)return;n(ue.util.upsertQueryData("getImageDTO",i.image_name,i));const o=Mi(i);n(ue.util.updateQueryData("listImages",{board_id:i.board_id??"none",categories:o},a=>{$t.addOne(a,i)})),n(Qe.util.updateQueryData("getBoardAssetsTotal",i.board_id??"none",a=>{a.total+=1}))}catch{}}}),deleteBoard:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE"}),invalidatesTags:()=>[{type:"Board",id:kr},{type:"ImageList",id:Li({board_id:"none",categories:Ln})},{type:"ImageList",id:Li({board_id:"none",categories:Pr})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_board_images:o}=i;o.forEach(l=>{n(ue.util.updateQueryData("getImageDTO",l,u=>{u.board_id=void 0}))}),n(Qe.util.updateQueryData("getBoardAssetsTotal",t,l=>{l.total=0})),n(Qe.util.updateQueryData("getBoardImagesTotal",t,l=>{l.total=0}));const a=[{categories:Ln},{categories:Pr}],s=o.map(l=>({id:l,changes:{board_id:void 0}}));a.forEach(l=>{n(ue.util.updateQueryData("listImages",l,u=>{$t.updateMany(u,s)}))})}catch{}}}),deleteBoardAndImages:e.mutation({query:t=>({url:`boards/${t}`,method:"DELETE",params:{include_images:!0}}),invalidatesTags:()=>[{type:"Board",id:kr},{type:"ImageList",id:Li({board_id:"none",categories:Ln})},{type:"ImageList",id:Li({board_id:"none",categories:Pr})}],async onQueryStarted(t,{dispatch:n,queryFulfilled:r}){try{const{data:i}=await r,{deleted_images:o}=i;[{categories:Ln},{categories:Pr}].forEach(s=>{n(ue.util.updateQueryData("listImages",s,l=>{$t.removeMany(l,o)}))}),n(Qe.util.updateQueryData("getBoardAssetsTotal",t,s=>{s.total=0})),n(Qe.util.updateQueryData("getBoardImagesTotal",t,s=>{s.total=0}))}catch{}}}),addImageToBoard:e.mutation({query:({board_id:t,imageDTO:n})=>{const{image_name:r}=n;return{url:"board_images/",method:"POST",body:{board_id:t,image_name:r}}},invalidatesTags:(t,n,{board_id:r})=>[{type:"Board",id:r}],async onQueryStarted({board_id:t,imageDTO:n},{dispatch:r,queryFulfilled:i,getState:o}){const a=[],s=Mi(n),l=Pr.includes(n.image_category);if(a.push(r(ue.util.updateQueryData("getImageDTO",n.image_name,u=>{u.board_id=t}))),!n.is_intermediate){a.push(r(ue.util.updateQueryData("listImages",{board_id:n.board_id??"none",categories:s},p=>{$t.removeOne(p,n.image_name)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",n.board_id??"none",p=>{p.total=Math.max(p.total-1,0)}))),a.push(r(Qe.util.updateQueryData(l?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",p=>{p.total+=1})));const u={board_id:t??"none",categories:s},c=ue.endpoints.listImages.select(u)(o()),{data:d}=Ln.includes(n.image_category)?Qe.endpoints.getBoardImagesTotal.select(n.board_id??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(n.board_id??"none")(o()),f=c.data&&c.data.ids.length>=((d==null?void 0:d.total)??0),h=tu(c.data,n);(f||h)&&a.push(r(ue.util.updateQueryData("listImages",u,p=>{$t.addOne(p,n)})))}try{await i}catch{a.forEach(u=>u.undo())}}}),removeImageFromBoard:e.mutation({query:({imageDTO:t})=>{const{image_name:n}=t;return{url:"board_images/",method:"DELETE",body:{image_name:n}}},invalidatesTags:(t,n,{imageDTO:r})=>{const{board_id:i}=r;return[{type:"Board",id:i??"none"}]},async onQueryStarted({imageDTO:t},{dispatch:n,queryFulfilled:r,getState:i}){const o=Mi(t),a=[],s=Pr.includes(t.image_category);a.push(n(ue.util.updateQueryData("getImageDTO",t.image_name,h=>{h.board_id=void 0}))),a.push(n(ue.util.updateQueryData("listImages",{board_id:t.board_id??"none",categories:o},h=>{$t.removeOne(h,t.image_name)}))),a.push(n(Qe.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal",t.board_id??"none",h=>{h.total=Math.max(h.total-1,0)}))),a.push(n(Qe.util.updateQueryData(s?"getBoardAssetsTotal":"getBoardImagesTotal","none",h=>{h.total+=1})));const l={board_id:"none",categories:o},u=ue.endpoints.listImages.select(l)(i()),{data:c}=Ln.includes(t.image_category)?Qe.endpoints.getBoardImagesTotal.select(t.board_id??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(t.board_id??"none")(i()),d=u.data&&u.data.ids.length>=((c==null?void 0:c.total)??0),f=tu(u.data,t);(d||f)&&a.push(n(ue.util.updateQueryData("listImages",l,h=>{$t.upsertOne(h,t)})));try{await r}catch{a.forEach(h=>h.undo())}}}),addImagesToBoard:e.mutation({query:({board_id:t,imageDTOs:n})=>({url:"board_images/batch",method:"POST",body:{image_names:n.map(r=>r.image_name),board_id:t}}),invalidatesTags:(t,n,{board_id:r})=>[{type:"Board",id:r??"none"}],async onQueryStarted({board_id:t,imageDTOs:n},{dispatch:r,queryFulfilled:i,getState:o}){try{const{data:a}=await i,{added_image_names:s}=a;s.forEach(l=>{r(ue.util.updateQueryData("getImageDTO",l,y=>{y.board_id=t==="none"?void 0:t}));const u=n.find(y=>y.image_name===l);if(!u)return;const c=Mi(u),d=u.board_id,f=Pr.includes(u.image_category);r(ue.util.updateQueryData("listImages",{board_id:d??"none",categories:c},y=>{$t.removeOne(y,u.image_name)})),r(Qe.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",d??"none",y=>{y.total=Math.max(y.total-1,0)})),r(Qe.util.updateQueryData(f?"getBoardAssetsTotal":"getBoardImagesTotal",t??"none",y=>{y.total+=1}));const h={board_id:t,categories:c},p=ue.endpoints.listImages.select(h)(o()),{data:m}=Ln.includes(u.image_category)?Qe.endpoints.getBoardImagesTotal.select(t??"none")(o()):Qe.endpoints.getBoardAssetsTotal.select(t??"none")(o()),_=p.data&&p.data.ids.length>=((m==null?void 0:m.total)??0),v=((m==null?void 0:m.total)??0)>=T0?tu(p.data,u):!0;(_||v)&&r(ue.util.updateQueryData("listImages",h,y=>{$t.upsertOne(y,{...u,board_id:t})}))})}catch{}}}),removeImagesFromBoard:e.mutation({query:({imageDTOs:t})=>({url:"board_images/batch/delete",method:"POST",body:{image_names:t.map(n=>n.image_name)}}),invalidatesTags:(t,n,{imageDTOs:r})=>{const i=[],o=[];return t==null||t.removed_image_names.forEach(a=>{var l;const s=(l=r.find(u=>u.image_name===a))==null?void 0:l.board_id;!s||i.includes(s)||o.push({type:"Board",id:s})}),o},async onQueryStarted({imageDTOs:t},{dispatch:n,queryFulfilled:r,getState:i}){try{const{data:o}=await r,{removed_image_names:a}=o;a.forEach(s=>{n(ue.util.updateQueryData("getImageDTO",s,_=>{_.board_id=void 0}));const l=t.find(_=>_.image_name===s);if(!l)return;const u=Mi(l),c=Pr.includes(l.image_category);n(ue.util.updateQueryData("listImages",{board_id:l.board_id??"none",categories:u},_=>{$t.removeOne(_,l.image_name)})),n(Qe.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal",l.board_id??"none",_=>{_.total=Math.max(_.total-1,0)})),n(Qe.util.updateQueryData(c?"getBoardAssetsTotal":"getBoardImagesTotal","none",_=>{_.total+=1}));const d={board_id:"none",categories:u},f=ue.endpoints.listImages.select(d)(i()),{data:h}=Ln.includes(l.image_category)?Qe.endpoints.getBoardImagesTotal.select(l.board_id??"none")(i()):Qe.endpoints.getBoardAssetsTotal.select(l.board_id??"none")(i()),p=f.data&&f.data.ids.length>=((h==null?void 0:h.total)??0),m=((h==null?void 0:h.total)??0)>=T0?tu(f.data,l):!0;(p||m)&&n(ue.util.updateQueryData("listImages",d,_=>{$t.upsertOne(_,{...l,board_id:"none"})}))})}catch{}}}),bulkDownloadImages:e.mutation({query:({image_names:t,board_id:n})=>({url:"images/download",method:"POST",body:{image_names:t,board_id:n}})})})}),{useGetIntermediatesCountQuery:KBe,useListImagesQuery:XBe,useLazyListImagesQuery:QBe,useGetImageDTOQuery:YBe,useGetImageMetadataQuery:ZBe,useDeleteImageMutation:JBe,useDeleteImagesMutation:eze,useUploadImageMutation:tze,useClearIntermediatesMutation:nze,useAddImagesToBoardMutation:rze,useRemoveImagesFromBoardMutation:ize,useAddImageToBoardMutation:oze,useRemoveImageFromBoardMutation:aze,useChangeImageIsIntermediateMutation:sze,useChangeImageSessionIdMutation:lze,useDeleteBoardAndImagesMutation:uze,useDeleteBoardMutation:cze,useStarImagesMutation:dze,useUnstarImagesMutation:fze,useBulkDownloadImagesMutation:hze}=ue,$F={selection:[],shouldAutoSwitch:!0,autoAssignBoardOnClick:!0,autoAddBoardId:"none",galleryImageMinimumWidth:96,selectedBoardId:"none",galleryView:"images",boardSearchText:""},NF=qt({name:"gallery",initialState:$F,reducers:{imageSelected:(e,t)=>{e.selection=t.payload?[t.payload]:[]},selectionChanged:(e,t)=>{e.selection=n5(t.payload,n=>n.image_name)},shouldAutoSwitchChanged:(e,t)=>{e.shouldAutoSwitch=t.payload},setGalleryImageMinimumWidth:(e,t)=>{e.galleryImageMinimumWidth=t.payload},autoAssignBoardOnClickChanged:(e,t)=>{e.autoAssignBoardOnClick=t.payload},boardIdSelected:(e,t)=>{e.selectedBoardId=t.payload.boardId,e.galleryView="images"},autoAddBoardIdChanged:(e,t)=>{if(!t.payload){e.autoAddBoardId="none";return}e.autoAddBoardId=t.payload},galleryViewChanged:(e,t)=>{e.galleryView=t.payload},boardSearchTextChanged:(e,t)=>{e.boardSearchText=t.payload}},extraReducers:e=>{e.addMatcher(lfe,(t,n)=>{const r=n.meta.arg.originalArgs;r===t.selectedBoardId&&(t.selectedBoardId="none",t.galleryView="images"),r===t.autoAddBoardId&&(t.autoAddBoardId="none")}),e.addMatcher(Qe.endpoints.listAllBoards.matchFulfilled,(t,n)=>{const r=n.payload;t.autoAddBoardId&&(r.map(i=>i.board_id).includes(t.autoAddBoardId)||(t.autoAddBoardId="none"))})}}),{imageSelected:pa,shouldAutoSwitchChanged:pze,autoAssignBoardOnClickChanged:gze,setGalleryImageMinimumWidth:mze,boardIdSelected:C1,autoAddBoardIdChanged:yze,galleryViewChanged:m5,selectionChanged:DF,boardSearchTextChanged:vze}=NF.actions,sfe=NF.reducer,lfe=Br(ue.endpoints.deleteBoard.matchFulfilled,ue.endpoints.deleteBoardAndImages.matchFulfilled),i8={weight:.75},ufe={loras:{}},LF=qt({name:"lora",initialState:ufe,reducers:{loraAdded:(e,t)=>{const{model_name:n,id:r,base_model:i}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,...i8}},loraRecalled:(e,t)=>{const{model_name:n,id:r,base_model:i,weight:o}=t.payload;e.loras[r]={id:r,model_name:n,base_model:i,weight:o}},loraRemoved:(e,t)=>{const n=t.payload;delete e.loras[n]},lorasCleared:e=>{e.loras={}},loraWeightChanged:(e,t)=>{const{id:n,weight:r}=t.payload,i=e.loras[n];i&&(i.weight=r)},loraWeightReset:(e,t)=>{const n=t.payload,r=e.loras[n];r&&(r.weight=i8.weight)}}}),{loraAdded:bze,loraRemoved:FF,loraWeightChanged:_ze,loraWeightReset:Sze,lorasCleared:xze,loraRecalled:wze}=LF.actions,cfe=LF.reducer;function Zi(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=u??typeof c!="object"?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>{n.clear()}};return t=e(r,i,s),s},dfe=e=>e?o8(e):o8,{useSyncExternalStoreWithSelector:ffe}=rse;function BF(e,t=e.getState,n){const r=ffe(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return I.useDebugValue(r),r}const a8=(e,t)=>{const n=dfe(e),r=(i,o=t)=>BF(n,i,o);return Object.assign(r,n),r},hfe=(e,t)=>e?a8(e,t):a8;function ii(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,i]of e)if(!Object.is(i,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let r=0;r{}};function U_(){for(var e=0,t=arguments.length,n={},r;e=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}zy.prototype=U_.prototype={constructor:zy,on:function(e,t){var n=this._,r=gfe(e+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),l8.hasOwnProperty(t)?{space:l8[t],local:e}:e}function yfe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===y5&&t.documentElement.namespaceURI===y5?t.createElement(e):t.createElementNS(n,e)}}function vfe(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function zF(e){var t=G_(e);return(t.local?vfe:yfe)(t)}function bfe(){}function VE(e){return e==null?bfe:function(){return this.querySelector(e)}}function _fe(e){typeof e!="function"&&(e=VE(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=g&&(g=y+1);!(S=_[g])&&++g=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function Hfe(e){e||(e=qfe);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,r=n.length,i=new Array(r),o=0;ot?1:e>=t?0:NaN}function Wfe(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Kfe(){return Array.from(this)}function Xfe(){for(var e=this._groups,t=0,n=e.length;t1?this.each((t==null?ahe:typeof t=="function"?lhe:she)(e,t,n??"")):pf(this.node(),e)}function pf(e,t){return e.style.getPropertyValue(t)||HF(e).getComputedStyle(e,null).getPropertyValue(t)}function che(e){return function(){delete this[e]}}function dhe(e,t){return function(){this[e]=t}}function fhe(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function hhe(e,t){return arguments.length>1?this.each((t==null?che:typeof t=="function"?fhe:dhe)(e,t)):this.node()[e]}function qF(e){return e.trim().split(/^|\s+/)}function UE(e){return e.classList||new WF(e)}function WF(e){this._node=e,this._names=qF(e.getAttribute("class")||"")}WF.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function KF(e,t){for(var n=UE(e),r=-1,i=t.length;++r=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function jhe(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n()=>e;function v5(e,{sourceEvent:t,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:u,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:c}})}v5.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Yhe(e){return!e.ctrlKey&&!e.button}function Zhe(){return this.parentNode}function Jhe(e,t){return t??{x:e.x,y:e.y}}function epe(){return navigator.maxTouchPoints||"ontouchstart"in this}function tpe(){var e=Yhe,t=Zhe,n=Jhe,r=epe,i={},o=U_("start","drag","end"),a=0,s,l,u,c,d=0;function f(b){b.on("mousedown.drag",h).filter(r).on("touchstart.drag",_).on("touchmove.drag",v,Qhe).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(b,S){if(!(c||!e.call(this,b,S))){var x=g(this,t.call(this,b,S),b,S,"mouse");x&&(_o(b.view).on("mousemove.drag",p,mg).on("mouseup.drag",m,mg),ZF(b.view),Nx(b),u=!1,s=b.clientX,l=b.clientY,x("start",b))}}function p(b){if(Rd(b),!u){var S=b.clientX-s,x=b.clientY-l;u=S*S+x*x>d}i.mouse("drag",b)}function m(b){_o(b.view).on("mousemove.drag mouseup.drag",null),JF(b.view,u),Rd(b),i.mouse("end",b)}function _(b,S){if(e.call(this,b,S)){var x=b.changedTouches,w=t.call(this,b,S),C=x.length,T,A;for(T=0;T>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?M0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?M0(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=rpe.exec(e))?new Yr(t[1],t[2],t[3],1):(t=ipe.exec(e))?new Yr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=ope.exec(e))?M0(t[1],t[2],t[3],t[4]):(t=ape.exec(e))?M0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=spe.exec(e))?g8(t[1],t[2]/100,t[3]/100,1):(t=lpe.exec(e))?g8(t[1],t[2]/100,t[3]/100,t[4]):u8.hasOwnProperty(e)?f8(u8[e]):e==="transparent"?new Yr(NaN,NaN,NaN,0):null}function f8(e){return new Yr(e>>16&255,e>>8&255,e&255,1)}function M0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Yr(e,t,n,r)}function dpe(e){return e instanceof wm||(e=bg(e)),e?(e=e.rgb(),new Yr(e.r,e.g,e.b,e.opacity)):new Yr}function b5(e,t,n,r){return arguments.length===1?dpe(e):new Yr(e,t,n,r??1)}function Yr(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}GE(Yr,b5,eB(wm,{brighter(e){return e=e==null?A1:Math.pow(A1,e),new Yr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?yg:Math.pow(yg,e),new Yr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Yr(Lu(this.r),Lu(this.g),Lu(this.b),T1(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:h8,formatHex:h8,formatHex8:fpe,formatRgb:p8,toString:p8}));function h8(){return`#${Au(this.r)}${Au(this.g)}${Au(this.b)}`}function fpe(){return`#${Au(this.r)}${Au(this.g)}${Au(this.b)}${Au((isNaN(this.opacity)?1:this.opacity)*255)}`}function p8(){const e=T1(this.opacity);return`${e===1?"rgb(":"rgba("}${Lu(this.r)}, ${Lu(this.g)}, ${Lu(this.b)}${e===1?")":`, ${e})`}`}function T1(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Lu(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Au(e){return e=Lu(e),(e<16?"0":"")+e.toString(16)}function g8(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new So(e,t,n,r)}function tB(e){if(e instanceof So)return new So(e.h,e.s,e.l,e.opacity);if(e instanceof wm||(e=bg(e)),!e)return new So;if(e instanceof So)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(n-r)/s+(n0&&l<1?0:a,new So(a,s,l,e.opacity)}function hpe(e,t,n,r){return arguments.length===1?tB(e):new So(e,t,n,r??1)}function So(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}GE(So,hpe,eB(wm,{brighter(e){return e=e==null?A1:Math.pow(A1,e),new So(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?yg:Math.pow(yg,e),new So(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Yr(Dx(e>=240?e-240:e+120,i,r),Dx(e,i,r),Dx(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new So(m8(this.h),R0(this.s),R0(this.l),T1(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=T1(this.opacity);return`${e===1?"hsl(":"hsla("}${m8(this.h)}, ${R0(this.s)*100}%, ${R0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function m8(e){return e=(e||0)%360,e<0?e+360:e}function R0(e){return Math.max(0,Math.min(1,e||0))}function Dx(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const nB=e=>()=>e;function ppe(e,t){return function(n){return e+n*t}}function gpe(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function mpe(e){return(e=+e)==1?rB:function(t,n){return n-t?gpe(t,n,e):nB(isNaN(t)?n:t)}}function rB(e,t){var n=t-e;return n?ppe(e,n):nB(isNaN(e)?t:e)}const y8=function e(t){var n=mpe(t);function r(i,o){var a=n((i=b5(i)).r,(o=b5(o)).r),s=n(i.g,o.g),l=n(i.b,o.b),u=rB(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=u(c),i+""}}return r.gamma=e,r}(1);function Gs(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var _5=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Lx=new RegExp(_5.source,"g");function ype(e){return function(){return e}}function vpe(e){return function(t){return e(t)+""}}function bpe(e,t){var n=_5.lastIndex=Lx.lastIndex=0,r,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(r=_5.exec(e))&&(i=Lx.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Gs(r,i)})),n=Lx.lastIndex;return n180?c+=360:c-u>180&&(u+=360),f.push({i:d.push(i(d)+"rotate(",null,r)-2,x:Gs(u,c)})):c&&d.push(i(d)+"rotate("+c+r)}function s(u,c,d,f){u!==c?f.push({i:d.push(i(d)+"skewX(",null,r)-2,x:Gs(u,c)}):c&&d.push(i(d)+"skewX("+c+r)}function l(u,c,d,f,h,p){if(u!==d||c!==f){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:Gs(u,d)},{i:m-2,x:Gs(c,f)})}else(d!==1||f!==1)&&h.push(i(h)+"scale("+d+","+f+")")}return function(u,c){var d=[],f=[];return u=e(u),c=e(c),o(u.translateX,u.translateY,c.translateX,c.translateY,d,f),a(u.rotate,c.rotate,d,f),s(u.skewX,c.skewX,d,f),l(u.scaleX,u.scaleY,c.scaleX,c.scaleY,d,f),u=c=null,function(h){for(var p=-1,m=f.length,_;++p=0&&e._call.call(void 0,t),e=e._next;--gf}function _8(){Ju=(k1=_g.now())+H_,gf=Dh=0;try{kpe()}finally{gf=0,Mpe(),Ju=0}}function Ipe(){var e=_g.now(),t=e-k1;t>aB&&(H_-=t,k1=e)}function Mpe(){for(var e,t=P1,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:P1=n);Lh=e,x5(r)}function x5(e){if(!gf){Dh&&(Dh=clearTimeout(Dh));var t=e-Ju;t>24?(e<1/0&&(Dh=setTimeout(_8,e-_g.now()-H_)),lh&&(lh=clearInterval(lh))):(lh||(k1=_g.now(),lh=setInterval(Ipe,aB)),gf=1,sB(_8))}}function S8(e,t,n){var r=new I1;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var Rpe=U_("start","end","cancel","interrupt"),Ope=[],uB=0,x8=1,w5=2,jy=3,w8=4,C5=5,Vy=6;function q_(e,t,n,r,i,o){var a=e.__transition;if(!a)e.__transition={};else if(n in a)return;$pe(e,n,{name:t,index:r,group:i,on:Rpe,tween:Ope,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:uB})}function qE(e,t){var n=zo(e,t);if(n.state>uB)throw new Error("too late; already scheduled");return n}function Pa(e,t){var n=zo(e,t);if(n.state>jy)throw new Error("too late; already running");return n}function zo(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function $pe(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=lB(o,0,n.time);function o(u){n.state=x8,n.timer.restart(a,n.delay,n.time),n.delay<=u&&a(u-n.delay)}function a(u){var c,d,f,h;if(n.state!==x8)return l();for(c in r)if(h=r[c],h.name===n.name){if(h.state===jy)return S8(a);h.state===w8?(h.state=Vy,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[c]):+cw5&&r.state=0&&(t=t.slice(0,n)),!t||t==="start"})}function cge(e,t,n){var r,i,o=uge(t)?qE:Pa;return function(){var a=o(this,e),s=a.on;s!==r&&(i=(r=s).copy()).on(t,n),a.on=i}}function dge(e,t){var n=this._id;return arguments.length<2?zo(this.node(),n).on.on(e):this.each(cge(n,e,t))}function fge(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function hge(){return this.on("end.remove",fge(this._id))}function pge(e){var t=this._name,n=this._id;typeof e!="function"&&(e=VE(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a()=>e;function Bge(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Za(e,t,n){this.k=e,this.x=t,this.y=n}Za.prototype={constructor:Za,scale:function(e){return e===1?this:new Za(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Za(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var gl=new Za(1,0,0);Za.prototype;function Fx(e){e.stopImmediatePropagation()}function uh(e){e.preventDefault(),e.stopImmediatePropagation()}function zge(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function jge(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function C8(){return this.__zoom||gl}function Vge(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Uge(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gge(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Hge(){var e=zge,t=jge,n=Gge,r=Vge,i=Uge,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,l=Tpe,u=U_("start","zoom","end"),c,d,f,h=500,p=150,m=0,_=10;function v(E){E.property("__zoom",C8).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",k).on("touchmove.zoom",D).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}v.transform=function(E,P,N,L){var O=E.selection?E.selection():E;O.property("__zoom",C8),E!==O?S(E,P,N,L):O.interrupt().each(function(){x(this,arguments).event(L).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},v.scaleBy=function(E,P,N,L){v.scaleTo(E,function(){var O=this.__zoom.k,R=typeof P=="function"?P.apply(this,arguments):P;return O*R},N,L)},v.scaleTo=function(E,P,N,L){v.transform(E,function(){var O=t.apply(this,arguments),R=this.__zoom,$=N==null?b(O):typeof N=="function"?N.apply(this,arguments):N,z=R.invert($),V=typeof P=="function"?P.apply(this,arguments):P;return n(g(y(R,V),$,z),O,a)},N,L)},v.translateBy=function(E,P,N,L){v.transform(E,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),a)},null,L)},v.translateTo=function(E,P,N,L,O){v.transform(E,function(){var R=t.apply(this,arguments),$=this.__zoom,z=L==null?b(R):typeof L=="function"?L.apply(this,arguments):L;return n(gl.translate(z[0],z[1]).scale($.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof N=="function"?-N.apply(this,arguments):-N),R,a)},L,O)};function y(E,P){return P=Math.max(o[0],Math.min(o[1],P)),P===E.k?E:new Za(P,E.x,E.y)}function g(E,P,N){var L=P[0]-N[0]*E.k,O=P[1]-N[1]*E.k;return L===E.x&&O===E.y?E:new Za(E.k,L,O)}function b(E){return[(+E[0][0]+ +E[1][0])/2,(+E[0][1]+ +E[1][1])/2]}function S(E,P,N,L){E.on("start.zoom",function(){x(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(L).end()}).tween("zoom",function(){var O=this,R=arguments,$=x(O,R).event(L),z=t.apply(O,R),V=N==null?b(z):typeof N=="function"?N.apply(O,R):N,H=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),Q=O.__zoom,Z=typeof P=="function"?P.apply(O,R):P,J=l(Q.invert(V).concat(H/Q.k),Z.invert(V).concat(H/Z.k));return function(j){if(j===1)j=Z;else{var X=J(j),ee=H/X[2];j=new Za(ee,V[0]-X[0]*ee,V[1]-X[1]*ee)}$.zoom(null,j)}})}function x(E,P,N){return!N&&E.__zooming||new w(E,P)}function w(E,P){this.that=E,this.args=P,this.active=0,this.sourceEvent=null,this.extent=t.apply(E,P),this.taps=0}w.prototype={event:function(E){return E&&(this.sourceEvent=E),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(E,P){return this.mouse&&E!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&E!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&E!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(E){var P=_o(this.that).datum();u.call(E,this.that,new Bge(E,{sourceEvent:this.sourceEvent,target:v,type:E,transform:this.that.__zoom,dispatch:u}),P)}};function C(E,...P){if(!e.apply(this,arguments))return;var N=x(this,P).event(E),L=this.__zoom,O=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),R=Yo(E);if(N.wheel)(N.mouse[0][0]!==R[0]||N.mouse[0][1]!==R[1])&&(N.mouse[1]=L.invert(N.mouse[0]=R)),clearTimeout(N.wheel);else{if(L.k===O)return;N.mouse=[R,L.invert(R)],Uy(this),N.start()}uh(E),N.wheel=setTimeout($,p),N.zoom("mouse",n(g(y(L,O),N.mouse[0],N.mouse[1]),N.extent,a));function $(){N.wheel=null,N.end()}}function T(E,...P){if(f||!e.apply(this,arguments))return;var N=E.currentTarget,L=x(this,P,!0).event(E),O=_o(E.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",H,!0),R=Yo(E,N),$=E.clientX,z=E.clientY;ZF(E.view),Fx(E),L.mouse=[R,this.__zoom.invert(R)],Uy(this),L.start();function V(Q){if(uh(Q),!L.moved){var Z=Q.clientX-$,J=Q.clientY-z;L.moved=Z*Z+J*J>m}L.event(Q).zoom("mouse",n(g(L.that.__zoom,L.mouse[0]=Yo(Q,N),L.mouse[1]),L.extent,a))}function H(Q){O.on("mousemove.zoom mouseup.zoom",null),JF(Q.view,L.moved),uh(Q),L.event(Q).end()}}function A(E,...P){if(e.apply(this,arguments)){var N=this.__zoom,L=Yo(E.changedTouches?E.changedTouches[0]:E,this),O=N.invert(L),R=N.k*(E.shiftKey?.5:2),$=n(g(y(N,R),L,O),t.apply(this,P),a);uh(E),s>0?_o(this).transition().duration(s).call(S,$,L,E):_o(this).call(v.transform,$,L,E)}}function k(E,...P){if(e.apply(this,arguments)){var N=E.touches,L=N.length,O=x(this,P,E.changedTouches.length===L).event(E),R,$,z,V;for(Fx(E),$=0;$"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},hB=ms.error001();function dn(e,t){const n=I.useContext(W_);if(n===null)throw new Error(hB);return BF(n,e,t)}const Gn=()=>{const e=I.useContext(W_);if(e===null)throw new Error(hB);return I.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},Wge=e=>e.userSelectionActive?"none":"all";function Kge({position:e,children:t,className:n,style:r,...i}){const o=dn(Wge),a=`${e}`.split("-");return q.jsx("div",{className:Zi(["react-flow__panel",n,...a]),style:{...r,pointerEvents:o},...i,children:t})}function Xge({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:q.jsx(Kge,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:q.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const Qge=({x:e,y:t,label:n,labelStyle:r={},labelShowBg:i=!0,labelBgStyle:o={},labelBgPadding:a=[2,4],labelBgBorderRadius:s=2,children:l,className:u,...c})=>{const d=I.useRef(null),[f,h]=I.useState({x:0,y:0,width:0,height:0}),p=Zi(["react-flow__edge-textwrapper",u]);return I.useEffect(()=>{if(d.current){const m=d.current.getBBox();h({x:m.x,y:m.y,width:m.width,height:m.height})}},[n]),typeof n>"u"||!n?null:q.jsxs("g",{transform:`translate(${e-f.width/2} ${t-f.height/2})`,className:p,visibility:f.width?"visible":"hidden",...c,children:[i&&q.jsx("rect",{width:f.width+2*a[0],x:-a[0],y:-a[1],height:f.height+2*a[1],className:"react-flow__edge-textbg",style:o,rx:s,ry:s}),q.jsx("text",{className:"react-flow__edge-text",y:f.height/2,dy:"0.3em",ref:d,style:r,children:n}),l]})};var Yge=I.memo(Qge);const KE=e=>({width:e.offsetWidth,height:e.offsetHeight}),mf=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),XE=(e={x:0,y:0},t)=>({x:mf(e.x,t[0][0],t[1][0]),y:mf(e.y,t[0][1],t[1][1])}),E8=(e,t,n)=>en?-mf(Math.abs(e-n),1,50)/50:0,pB=(e,t)=>{const n=E8(e.x,35,t.width-35)*20,r=E8(e.y,35,t.height-35)*20;return[n,r]},gB=e=>{var t;return((t=e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},mB=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Sg=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),yB=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),A8=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),Cze=(e,t)=>yB(mB(Sg(e),Sg(t))),E5=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},Zge=e=>Gi(e.width)&&Gi(e.height)&&Gi(e.x)&&Gi(e.y),Gi=e=>!isNaN(e)&&isFinite(e),Mn=Symbol.for("internals"),vB=["Enter"," ","Escape"],Jge=(e,t)=>{},eme=e=>"nativeEvent"in e;function A5(e){var i,o;const t=eme(e)?e.nativeEvent:e,n=((o=(i=t.composedPath)==null?void 0:i.call(t))==null?void 0:o[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(n==null?void 0:n.nodeName)||(n==null?void 0:n.hasAttribute("contenteditable"))||!!(n!=null&&n.closest(".nokey"))}const bB=e=>"clientX"in e,ml=(e,t)=>{var o,a;const n=bB(e),r=n?e.clientX:(o=e.touches)==null?void 0:o[0].clientX,i=n?e.clientY:(a=e.touches)==null?void 0:a[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:i-((t==null?void 0:t.top)??0)}},M1=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0},Cm=({id:e,path:t,labelX:n,labelY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h=20})=>q.jsxs(q.Fragment,{children:[q.jsx("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:d,markerStart:f}),h&&q.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Gi(n)&&Gi(r)?q.jsx(Yge,{x:n,y:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u}):null]});Cm.displayName="BaseEdge";function ch(e,t,n){return n===void 0?n:r=>{const i=t().edges.find(o=>o.id===e);i&&n(r,{...i})}}function _B({sourceX:e,sourceY:t,targetX:n,targetY:r}){const i=Math.abs(n-e)/2,o=n{const[_,v,y]=xB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o});return q.jsx(Cm,{path:_,labelX:v,labelY:y,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:m})});QE.displayName="SimpleBezierEdge";const P8={[Te.Left]:{x:-1,y:0},[Te.Right]:{x:1,y:0},[Te.Top]:{x:0,y:-1},[Te.Bottom]:{x:0,y:1}},tme=({source:e,sourcePosition:t=Te.Bottom,target:n})=>t===Te.Left||t===Te.Right?e.xMath.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function nme({source:e,sourcePosition:t=Te.Bottom,target:n,targetPosition:r=Te.Top,center:i,offset:o}){const a=P8[t],s=P8[r],l={x:e.x+a.x*o,y:e.y+a.y*o},u={x:n.x+s.x*o,y:n.y+s.y*o},c=tme({source:l,sourcePosition:t,target:u}),d=c.x!==0?"x":"y",f=c[d];let h=[],p,m;const _={x:0,y:0},v={x:0,y:0},[y,g,b,S]=_B({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*s[d]===-1){p=i.x||y,m=i.y||g;const w=[{x:p,y:l.y},{x:p,y:u.y}],C=[{x:l.x,y:m},{x:u.x,y:m}];a[d]===f?h=d==="x"?w:C:h=d==="x"?C:w}else{const w=[{x:l.x,y:u.y}],C=[{x:u.x,y:l.y}];if(d==="x"?h=a.x===f?C:w:h=a.y===f?w:C,t===r){const M=Math.abs(e[d]-n[d]);if(M<=o){const E=Math.min(o-1,o-M);a[d]===f?_[d]=(l[d]>e[d]?-1:1)*E:v[d]=(u[d]>n[d]?-1:1)*E}}if(t!==r){const M=d==="x"?"y":"x",E=a[d]===s[M],P=l[M]>u[M],N=l[M]=D?(p=(T.x+A.x)/2,m=h[0].y):(p=h[0].x,m=(T.y+A.y)/2)}return[[e,{x:l.x+_.x,y:l.y+_.y},...h,{x:u.x+v.x,y:u.y+v.y},n],p,m,b,S]}function rme(e,t,n,r){const i=Math.min(k8(e,t)/2,k8(t,n)/2,r),{x:o,y:a}=t;if(e.x===o&&o===n.x||e.y===a&&a===n.y)return`L${o} ${a}`;if(e.y===a){const u=e.x{let g="";return y>0&&y{const[v,y,g]=T5({sourceX:e,sourceY:t,sourcePosition:d,targetX:n,targetY:r,targetPosition:f,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset});return q.jsx(Cm,{path:v,labelX:y,labelY:g,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:h,markerStart:p,interactionWidth:_})});K_.displayName="SmoothStepEdge";const YE=I.memo(e=>{var t;return q.jsx(K_,{...e,pathOptions:I.useMemo(()=>{var n;return{borderRadius:0,offset:(n=e.pathOptions)==null?void 0:n.offset}},[(t=e.pathOptions)==null?void 0:t.offset])})});YE.displayName="StepEdge";function ime({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[i,o,a,s]=_B({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,i,o,a,s]}const ZE=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})=>{const[p,m,_]=ime({sourceX:e,sourceY:t,targetX:n,targetY:r});return q.jsx(Cm,{path:p,labelX:m,labelY:_,label:i,labelStyle:o,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:u,style:c,markerEnd:d,markerStart:f,interactionWidth:h})});ZE.displayName="StraightEdge";function N0(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function I8({pos:e,x1:t,y1:n,x2:r,y2:i,c:o}){switch(e){case Te.Left:return[t-N0(t-r,o),n];case Te.Right:return[t+N0(r-t,o),n];case Te.Top:return[t,n-N0(n-i,o)];case Te.Bottom:return[t,n+N0(i-n,o)]}}function wB({sourceX:e,sourceY:t,sourcePosition:n=Te.Bottom,targetX:r,targetY:i,targetPosition:o=Te.Top,curvature:a=.25}){const[s,l]=I8({pos:n,x1:e,y1:t,x2:r,y2:i,c:a}),[u,c]=I8({pos:o,x1:r,y1:i,x2:e,y2:t,c:a}),[d,f,h,p]=SB({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:u,targetControlY:c});return[`M${e},${t} C${s},${l} ${u},${c} ${r},${i}`,d,f,h,p]}const O1=I.memo(({sourceX:e,sourceY:t,targetX:n,targetY:r,sourcePosition:i=Te.Bottom,targetPosition:o=Te.Top,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,pathOptions:m,interactionWidth:_})=>{const[v,y,g]=wB({sourceX:e,sourceY:t,sourcePosition:i,targetX:n,targetY:r,targetPosition:o,curvature:m==null?void 0:m.curvature});return q.jsx(Cm,{path:v,labelX:y,labelY:g,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:u,labelBgPadding:c,labelBgBorderRadius:d,style:f,markerEnd:h,markerStart:p,interactionWidth:_})});O1.displayName="BezierEdge";const JE=I.createContext(null),ome=JE.Provider;JE.Consumer;const ame=()=>I.useContext(JE),sme=e=>"id"in e&&"source"in e&&"target"in e,CB=e=>"id"in e&&!("source"in e)&&!("target"in e),lme=(e,t,n)=>{if(!CB(e))return[];const r=n.filter(i=>i.source===e.id).map(i=>i.target);return t.filter(i=>r.includes(i.id))},ume=(e,t,n)=>{if(!CB(e))return[];const r=n.filter(i=>i.target===e.id).map(i=>i.source);return t.filter(i=>r.includes(i.id))},EB=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`reactflow__edge-${e}${t||""}-${n}${r||""}`,P5=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`,cme=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),Fh=(e,t)=>{if(!e.source||!e.target)return t;let n;return sme(e)?n={...e}:n={...e,id:EB(e)},cme(n,t)?t:t.concat(n)},dme=(e,t,n,r={shouldReplaceId:!0})=>{const{id:i,...o}=e;if(!t.source||!t.target||!n.find(l=>l.id===i))return n;const s={...o,id:r.shouldReplaceId?EB(t):i,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle};return n.filter(l=>l.id!==i).concat(s)},AB=({x:e,y:t},[n,r,i],o,[a,s])=>{const l={x:(e-n)/i,y:(t-r)/i};return o?{x:a*Math.round(l.x/a),y:s*Math.round(l.y/s)}:l},fme=({x:e,y:t},[n,r,i])=>({x:e*i+n,y:t*i+r}),$d=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const n=(e.width??0)*t[0],r=(e.height??0)*t[1],i={x:e.position.x-n,y:e.position.y-r};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-n,y:e.positionAbsolute.y-r}:i}},eA=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,i)=>{const{x:o,y:a}=$d(i,t).positionAbsolute;return mB(r,Sg({x:o,y:a,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return yB(n)},TB=(e,t,[n,r,i]=[0,0,1],o=!1,a=!1,s=[0,0])=>{const l={x:(t.x-n)/i,y:(t.y-r)/i,width:t.width/i,height:t.height/i},u=[];return e.forEach(c=>{const{width:d,height:f,selectable:h=!0,hidden:p=!1}=c;if(a&&!h||p)return!1;const{positionAbsolute:m}=$d(c,s),_={x:m.x,y:m.y,width:d||0,height:f||0},v=E5(l,_),y=typeof d>"u"||typeof f>"u"||d===null||f===null,g=o&&v>0,b=(d||0)*(f||0);(y||g||v>=b||c.dragging)&&u.push(c)}),u},tA=(e,t)=>{const n=e.map(r=>r.id);return t.filter(r=>n.includes(r.source)||n.includes(r.target))},PB=(e,t,n,r,i,o=.1)=>{const a=t/(e.width*(1+o)),s=n/(e.height*(1+o)),l=Math.min(a,s),u=mf(l,r,i),c=e.x+e.width/2,d=e.y+e.height/2,f=t/2-c*u,h=n/2-d*u;return[f,h,u]},fu=(e,t=0)=>e.transition().duration(t);function M8(e,t,n,r){return(t[n]||[]).reduce((i,o)=>{var a,s;return`${e.id}-${o.id}-${n}`!==r&&i.push({id:o.id||null,type:n,nodeId:e.id,x:(((a=e.positionAbsolute)==null?void 0:a.x)??0)+o.x+o.width/2,y:(((s=e.positionAbsolute)==null?void 0:s.y)??0)+o.y+o.height/2}),i},[])}function hme(e,t,n,r,i,o){const{x:a,y:s}=ml(e),u=t.elementsFromPoint(a,s).find(p=>p.classList.contains("react-flow__handle"));if(u){const p=u.getAttribute("data-nodeid");if(p){const m=nA(void 0,u),_=u.getAttribute("data-handleid"),v=o({nodeId:p,id:_,type:m});if(v)return{handle:{id:_,type:m,nodeId:p,x:n.x,y:n.y},validHandleResult:v}}}let c=[],d=1/0;if(i.forEach(p=>{const m=Math.sqrt((p.x-n.x)**2+(p.y-n.y)**2);if(m<=r){const _=o(p);m<=d&&(mp.isValid),h=c.some(({handle:p})=>p.type==="target");return c.find(({handle:p,validHandleResult:m})=>h?p.type==="target":f?m.isValid:!0)||c[0]}const pme={source:null,target:null,sourceHandle:null,targetHandle:null},kB=()=>({handleDomNode:null,isValid:!1,connection:pme,endHandle:null});function IB(e,t,n,r,i,o,a){const s=i==="target",l=a.querySelector(`.react-flow__handle[data-id="${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`),u={...kB(),handleDomNode:l};if(l){const c=nA(void 0,l),d=l.getAttribute("data-nodeid"),f=l.getAttribute("data-handleid"),h=l.classList.contains("connectable"),p=l.classList.contains("connectableend"),m={source:s?d:n,sourceHandle:s?f:r,target:s?n:d,targetHandle:s?r:f};u.connection=m,h&&p&&(t===ec.Strict?s&&c==="source"||!s&&c==="target":d!==n||f!==r)&&(u.endHandle={nodeId:d,handleId:f,type:c},u.isValid=o(m))}return u}function gme({nodes:e,nodeId:t,handleId:n,handleType:r}){return e.reduce((i,o)=>{if(o[Mn]){const{handleBounds:a}=o[Mn];let s=[],l=[];a&&(s=M8(o,a,"source",`${t}-${n}-${r}`),l=M8(o,a,"target",`${t}-${n}-${r}`)),i.push(...s,...l)}return i},[])}function nA(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Bx(e){e==null||e.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function mme(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}function MB({event:e,handleId:t,nodeId:n,onConnect:r,isTarget:i,getState:o,setState:a,isValidConnection:s,edgeUpdaterType:l,onEdgeUpdateEnd:u}){const c=gB(e.target),{connectionMode:d,domNode:f,autoPanOnConnect:h,connectionRadius:p,onConnectStart:m,panBy:_,getNodes:v,cancelConnection:y}=o();let g=0,b;const{x:S,y:x}=ml(e),w=c==null?void 0:c.elementFromPoint(S,x),C=nA(l,w),T=f==null?void 0:f.getBoundingClientRect();if(!T||!C)return;let A,k=ml(e,T),D=!1,M=null,E=!1,P=null;const N=gme({nodes:v(),nodeId:n,handleId:t,handleType:C}),L=()=>{if(!h)return;const[$,z]=pB(k,T);_({x:$,y:z}),g=requestAnimationFrame(L)};a({connectionPosition:k,connectionStatus:null,connectionNodeId:n,connectionHandleId:t,connectionHandleType:C,connectionStartHandle:{nodeId:n,handleId:t,type:C},connectionEndHandle:null}),m==null||m(e,{nodeId:n,handleId:t,handleType:C});function O($){const{transform:z}=o();k=ml($,T);const{handle:V,validHandleResult:H}=hme($,c,AB(k,z,!1,[1,1]),p,N,Q=>IB(Q,d,n,t,i?"target":"source",s,c));if(b=V,D||(L(),D=!0),P=H.handleDomNode,M=H.connection,E=H.isValid,a({connectionPosition:b&&E?fme({x:b.x,y:b.y},z):k,connectionStatus:mme(!!b,E),connectionEndHandle:H.endHandle}),!b&&!E&&!P)return Bx(A);M.source!==M.target&&P&&(Bx(A),A=P,P.classList.add("connecting","react-flow__handle-connecting"),P.classList.toggle("valid",E),P.classList.toggle("react-flow__handle-valid",E))}function R($){var z,V;(b||P)&&M&&E&&(r==null||r(M)),(V=(z=o()).onConnectEnd)==null||V.call(z,$),l&&(u==null||u($)),Bx(A),y(),cancelAnimationFrame(g),D=!1,E=!1,M=null,P=null,c.removeEventListener("mousemove",O),c.removeEventListener("mouseup",R),c.removeEventListener("touchmove",O),c.removeEventListener("touchend",R)}c.addEventListener("mousemove",O),c.addEventListener("mouseup",R),c.addEventListener("touchmove",O),c.addEventListener("touchend",R)}const R8=()=>!0,yme=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),vme=(e,t,n)=>r=>{const{connectionStartHandle:i,connectionEndHandle:o,connectionClickStartHandle:a}=r;return{connecting:(i==null?void 0:i.nodeId)===e&&(i==null?void 0:i.handleId)===t&&(i==null?void 0:i.type)===n||(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.handleId)===t&&(o==null?void 0:o.type)===n,clickConnecting:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.handleId)===t&&(a==null?void 0:a.type)===n}},RB=I.forwardRef(({type:e="source",position:t=Te.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:o=!0,id:a,onConnect:s,children:l,className:u,onMouseDown:c,onTouchStart:d,...f},h)=>{var T,A;const p=a||null,m=e==="target",_=Gn(),v=ame(),{connectOnClick:y,noPanClassName:g}=dn(yme,ii),{connecting:b,clickConnecting:S}=dn(vme(v,p,e),ii);v||(A=(T=_.getState()).onError)==null||A.call(T,"010",ms.error010());const x=k=>{const{defaultEdgeOptions:D,onConnect:M,hasDefaultEdges:E}=_.getState(),P={...D,...k};if(E){const{edges:N,setEdges:L}=_.getState();L(Fh(P,N))}M==null||M(P),s==null||s(P)},w=k=>{if(!v)return;const D=bB(k);i&&(D&&k.button===0||!D)&&MB({event:k,handleId:p,nodeId:v,onConnect:x,isTarget:m,getState:_.getState,setState:_.setState,isValidConnection:n||_.getState().isValidConnection||R8}),D?c==null||c(k):d==null||d(k)},C=k=>{const{onClickConnectStart:D,onClickConnectEnd:M,connectionClickStartHandle:E,connectionMode:P,isValidConnection:N}=_.getState();if(!v||!E&&!i)return;if(!E){D==null||D(k,{nodeId:v,handleId:p,handleType:e}),_.setState({connectionClickStartHandle:{nodeId:v,type:e,handleId:p}});return}const L=gB(k.target),O=n||N||R8,{connection:R,isValid:$}=IB({nodeId:v,id:p,type:e},P,E.nodeId,E.handleId||null,E.type,O,L);$&&x(R),M==null||M(k),_.setState({connectionClickStartHandle:null})};return q.jsx("div",{"data-handleid":p,"data-nodeid":v,"data-handlepos":t,"data-id":`${v}-${p}-${e}`,className:Zi(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",g,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:o,connecting:S,connectionindicator:r&&(i&&!b||o&&b)}]),onMouseDown:w,onTouchStart:w,onClick:y?C:void 0,ref:h,...f,children:l})});RB.displayName="Handle";var $1=I.memo(RB);const OB=({data:e,isConnectable:t,targetPosition:n=Te.Top,sourcePosition:r=Te.Bottom})=>q.jsxs(q.Fragment,{children:[q.jsx($1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,q.jsx($1,{type:"source",position:r,isConnectable:t})]});OB.displayName="DefaultNode";var k5=I.memo(OB);const $B=({data:e,isConnectable:t,sourcePosition:n=Te.Bottom})=>q.jsxs(q.Fragment,{children:[e==null?void 0:e.label,q.jsx($1,{type:"source",position:n,isConnectable:t})]});$B.displayName="InputNode";var NB=I.memo($B);const DB=({data:e,isConnectable:t,targetPosition:n=Te.Top})=>q.jsxs(q.Fragment,{children:[q.jsx($1,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]});DB.displayName="OutputNode";var LB=I.memo(DB);const rA=()=>null;rA.displayName="GroupNode";const bme=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected)}),D0=e=>e.id;function _me(e,t){return ii(e.selectedNodes.map(D0),t.selectedNodes.map(D0))&&ii(e.selectedEdges.map(D0),t.selectedEdges.map(D0))}const FB=I.memo(({onSelectionChange:e})=>{const t=Gn(),{selectedNodes:n,selectedEdges:r}=dn(bme,_me);return I.useEffect(()=>{var o,a;const i={nodes:n,edges:r};e==null||e(i),(a=(o=t.getState()).onSelectionChange)==null||a.call(o,i)},[n,r,e]),null});FB.displayName="SelectionListener";const Sme=e=>!!e.onSelectionChange;function xme({onSelectionChange:e}){const t=dn(Sme);return e||t?q.jsx(FB,{onSelectionChange:e}):null}const wme=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function Pc(e,t){I.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Ge(e,t,n){I.useEffect(()=>{typeof t<"u"&&n({[e]:t})},[t])}const Cme=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:i,onConnectStart:o,onConnectEnd:a,onClickConnectStart:s,onClickConnectEnd:l,nodesDraggable:u,nodesConnectable:c,nodesFocusable:d,edgesFocusable:f,edgesUpdatable:h,elevateNodesOnSelect:p,minZoom:m,maxZoom:_,nodeExtent:v,onNodesChange:y,onEdgesChange:g,elementsSelectable:b,connectionMode:S,snapGrid:x,snapToGrid:w,translateExtent:C,connectOnClick:T,defaultEdgeOptions:A,fitView:k,fitViewOptions:D,onNodesDelete:M,onEdgesDelete:E,onNodeDrag:P,onNodeDragStart:N,onNodeDragStop:L,onSelectionDrag:O,onSelectionDragStart:R,onSelectionDragStop:$,noPanClassName:z,nodeOrigin:V,rfId:H,autoPanOnConnect:Q,autoPanOnNodeDrag:Z,onError:J,connectionRadius:j,isValidConnection:X})=>{const{setNodes:ee,setEdges:ne,setDefaultNodesAndEdges:fe,setMinZoom:ce,setMaxZoom:Be,setTranslateExtent:$e,setNodeExtent:we,reset:Ke}=dn(wme,ii),be=Gn();return I.useEffect(()=>{const zt=r==null?void 0:r.map(Hn=>({...Hn,...A}));return fe(n,zt),()=>{Ke()}},[]),Ge("defaultEdgeOptions",A,be.setState),Ge("connectionMode",S,be.setState),Ge("onConnect",i,be.setState),Ge("onConnectStart",o,be.setState),Ge("onConnectEnd",a,be.setState),Ge("onClickConnectStart",s,be.setState),Ge("onClickConnectEnd",l,be.setState),Ge("nodesDraggable",u,be.setState),Ge("nodesConnectable",c,be.setState),Ge("nodesFocusable",d,be.setState),Ge("edgesFocusable",f,be.setState),Ge("edgesUpdatable",h,be.setState),Ge("elementsSelectable",b,be.setState),Ge("elevateNodesOnSelect",p,be.setState),Ge("snapToGrid",w,be.setState),Ge("snapGrid",x,be.setState),Ge("onNodesChange",y,be.setState),Ge("onEdgesChange",g,be.setState),Ge("connectOnClick",T,be.setState),Ge("fitViewOnInit",k,be.setState),Ge("fitViewOnInitOptions",D,be.setState),Ge("onNodesDelete",M,be.setState),Ge("onEdgesDelete",E,be.setState),Ge("onNodeDrag",P,be.setState),Ge("onNodeDragStart",N,be.setState),Ge("onNodeDragStop",L,be.setState),Ge("onSelectionDrag",O,be.setState),Ge("onSelectionDragStart",R,be.setState),Ge("onSelectionDragStop",$,be.setState),Ge("noPanClassName",z,be.setState),Ge("nodeOrigin",V,be.setState),Ge("rfId",H,be.setState),Ge("autoPanOnConnect",Q,be.setState),Ge("autoPanOnNodeDrag",Z,be.setState),Ge("onError",J,be.setState),Ge("connectionRadius",j,be.setState),Ge("isValidConnection",X,be.setState),Pc(e,ee),Pc(t,ne),Pc(m,ce),Pc(_,Be),Pc(C,$e),Pc(v,we),null},O8={display:"none"},Eme={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},BB="react-flow__node-desc",zB="react-flow__edge-desc",Ame="react-flow__aria-live",Tme=e=>e.ariaLiveMessage;function Pme({rfId:e}){const t=dn(Tme);return q.jsx("div",{id:`${Ame}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:Eme,children:t})}function kme({rfId:e,disableKeyboardA11y:t}){return q.jsxs(q.Fragment,{children:[q.jsxs("div",{id:`${BB}-${e}`,style:O8,children:["Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "]}),q.jsx("div",{id:`${zB}-${e}`,style:O8,children:"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."}),!t&&q.jsx(Pme,{rfId:e})]})}const Ime=typeof document<"u"?document:null;var xg=(e=null,t={target:Ime})=>{const[n,r]=I.useState(!1),i=I.useRef(!1),o=I.useRef(new Set([])),[a,s]=I.useMemo(()=>{if(e!==null){const u=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.split("+")),c=u.reduce((d,f)=>d.concat(...f),[]);return[u,c]}return[[],[]]},[e]);return I.useEffect(()=>{var l,u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,!i.current&&A5(h))return!1;const p=N8(h.code,s);o.current.add(h[p]),$8(a,o.current,!1)&&(h.preventDefault(),r(!0))},d=h=>{if(!i.current&&A5(h))return!1;const p=N8(h.code,s);$8(a,o.current,!0)?(r(!1),o.current.clear()):o.current.delete(h[p]),h.key==="Meta"&&o.current.clear(),i.current=!1},f=()=>{o.current.clear(),r(!1)};return(l=t==null?void 0:t.target)==null||l.addEventListener("keydown",c),(u=t==null?void 0:t.target)==null||u.addEventListener("keyup",d),window.addEventListener("blur",f),()=>{var h,p;(h=t==null?void 0:t.target)==null||h.removeEventListener("keydown",c),(p=t==null?void 0:t.target)==null||p.removeEventListener("keyup",d),window.removeEventListener("blur",f)}}},[e,r]),n};function $8(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(i=>t.has(i)))}function N8(e,t){return t.includes(e)?"code":"key"}function jB(e,t,n,r){var a,s;if(!e.parentNode)return n;const i=t.get(e.parentNode),o=$d(i,r);return jB(i,t,{x:(n.x??0)+o.x,y:(n.y??0)+o.y,z:(((a=i[Mn])==null?void 0:a.z)??0)>(n.z??0)?((s=i[Mn])==null?void 0:s.z)??0:n.z??0},r)}function VB(e,t,n){e.forEach(r=>{var i;if(r.parentNode&&!e.has(r.parentNode))throw new Error(`Parent node ${r.parentNode} not found`);if(r.parentNode||n!=null&&n[r.id]){const{x:o,y:a,z:s}=jB(r,e,{...r.position,z:((i=r[Mn])==null?void 0:i.z)??0},t);r.positionAbsolute={x:o,y:a},r[Mn].z=s,n!=null&&n[r.id]&&(r[Mn].isParent=!0)}})}function zx(e,t,n,r){const i=new Map,o={},a=r?1e3:0;return e.forEach(s=>{var d;const l=(Gi(s.zIndex)?s.zIndex:0)+(s.selected?a:0),u=t.get(s.id),c={width:u==null?void 0:u.width,height:u==null?void 0:u.height,...s,positionAbsolute:{x:s.position.x,y:s.position.y}};s.parentNode&&(c.parentNode=s.parentNode,o[s.parentNode]=!0),Object.defineProperty(c,Mn,{enumerable:!1,value:{handleBounds:(d=u==null?void 0:u[Mn])==null?void 0:d.handleBounds,z:l}}),i.set(s.id,c)}),VB(i,n,o),i}function UB(e,t={}){const{getNodes:n,width:r,height:i,minZoom:o,maxZoom:a,d3Zoom:s,d3Selection:l,fitViewOnInitDone:u,fitViewOnInit:c,nodeOrigin:d}=e(),f=t.initial&&!u&&c;if(s&&l&&(f||!t.initial)){const p=n().filter(_=>{var y;const v=t.includeHiddenNodes?_.width&&_.height:!_.hidden;return(y=t.nodes)!=null&&y.length?v&&t.nodes.some(g=>g.id===_.id):v}),m=p.every(_=>_.width&&_.height);if(p.length>0&&m){const _=eA(p,d),[v,y,g]=PB(_,r,i,t.minZoom??o,t.maxZoom??a,t.padding??.1),b=gl.translate(v,y).scale(g);return typeof t.duration=="number"&&t.duration>0?s.transform(fu(l,t.duration),b):s.transform(l,b),!0}}return!1}function Mme(e,t){return e.forEach(n=>{const r=t.get(n.id);r&&t.set(r.id,{...r,[Mn]:r[Mn],selected:n.selected})}),new Map(t)}function Rme(e,t){return t.map(n=>{const r=e.find(i=>i.id===n.id);return r&&(n.selected=r.selected),n})}function L0({changedNodes:e,changedEdges:t,get:n,set:r}){const{nodeInternals:i,edges:o,onNodesChange:a,onEdgesChange:s,hasDefaultNodes:l,hasDefaultEdges:u}=n();e!=null&&e.length&&(l&&r({nodeInternals:Mme(e,i)}),a==null||a(e)),t!=null&&t.length&&(u&&r({edges:Rme(t,o)}),s==null||s(t))}const kc=()=>{},Ome={zoomIn:kc,zoomOut:kc,zoomTo:kc,getZoom:()=>1,setViewport:kc,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:kc,fitBounds:kc,project:e=>e,viewportInitialized:!1},$me=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),Nme=()=>{const e=Gn(),{d3Zoom:t,d3Selection:n}=dn($me,ii);return I.useMemo(()=>n&&t?{zoomIn:i=>t.scaleBy(fu(n,i==null?void 0:i.duration),1.2),zoomOut:i=>t.scaleBy(fu(n,i==null?void 0:i.duration),1/1.2),zoomTo:(i,o)=>t.scaleTo(fu(n,o==null?void 0:o.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,o)=>{const[a,s,l]=e.getState().transform,u=gl.translate(i.x??a,i.y??s).scale(i.zoom??l);t.transform(fu(n,o==null?void 0:o.duration),u)},getViewport:()=>{const[i,o,a]=e.getState().transform;return{x:i,y:o,zoom:a}},fitView:i=>UB(e.getState,i),setCenter:(i,o,a)=>{const{width:s,height:l,maxZoom:u}=e.getState(),c=typeof(a==null?void 0:a.zoom)<"u"?a.zoom:u,d=s/2-i*c,f=l/2-o*c,h=gl.translate(d,f).scale(c);t.transform(fu(n,a==null?void 0:a.duration),h)},fitBounds:(i,o)=>{const{width:a,height:s,minZoom:l,maxZoom:u}=e.getState(),[c,d,f]=PB(i,a,s,l,u,(o==null?void 0:o.padding)??.1),h=gl.translate(c,d).scale(f);t.transform(fu(n,o==null?void 0:o.duration),h)},project:i=>{const{transform:o,snapToGrid:a,snapGrid:s}=e.getState();return AB(i,o,a,s)},viewportInitialized:!0}:Ome,[t,n])};function GB(){const e=Nme(),t=Gn(),n=I.useCallback(()=>t.getState().getNodes().map(m=>({...m})),[]),r=I.useCallback(m=>t.getState().nodeInternals.get(m),[]),i=I.useCallback(()=>{const{edges:m=[]}=t.getState();return m.map(_=>({..._}))},[]),o=I.useCallback(m=>{const{edges:_=[]}=t.getState();return _.find(v=>v.id===m)},[]),a=I.useCallback(m=>{const{getNodes:_,setNodes:v,hasDefaultNodes:y,onNodesChange:g}=t.getState(),b=_(),S=typeof m=="function"?m(b):m;if(y)v(S);else if(g){const x=S.length===0?b.map(w=>({type:"remove",id:w.id})):S.map(w=>({item:w,type:"reset"}));g(x)}},[]),s=I.useCallback(m=>{const{edges:_=[],setEdges:v,hasDefaultEdges:y,onEdgesChange:g}=t.getState(),b=typeof m=="function"?m(_):m;if(y)v(b);else if(g){const S=b.length===0?_.map(x=>({type:"remove",id:x.id})):b.map(x=>({item:x,type:"reset"}));g(S)}},[]),l=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{getNodes:v,setNodes:y,hasDefaultNodes:g,onNodesChange:b}=t.getState();if(g){const x=[...v(),..._];y(x)}else if(b){const S=_.map(x=>({item:x,type:"add"}));b(S)}},[]),u=I.useCallback(m=>{const _=Array.isArray(m)?m:[m],{edges:v=[],setEdges:y,hasDefaultEdges:g,onEdgesChange:b}=t.getState();if(g)y([...v,..._]);else if(b){const S=_.map(x=>({item:x,type:"add"}));b(S)}},[]),c=I.useCallback(()=>{const{getNodes:m,edges:_=[],transform:v}=t.getState(),[y,g,b]=v;return{nodes:m().map(S=>({...S})),edges:_.map(S=>({...S})),viewport:{x:y,y:g,zoom:b}}},[]),d=I.useCallback(({nodes:m,edges:_})=>{const{nodeInternals:v,getNodes:y,edges:g,hasDefaultNodes:b,hasDefaultEdges:S,onNodesDelete:x,onEdgesDelete:w,onNodesChange:C,onEdgesChange:T}=t.getState(),A=(m||[]).map(P=>P.id),k=(_||[]).map(P=>P.id),D=y().reduce((P,N)=>{const L=!A.includes(N.id)&&N.parentNode&&P.find(R=>R.id===N.parentNode);return(typeof N.deletable=="boolean"?N.deletable:!0)&&(A.includes(N.id)||L)&&P.push(N),P},[]),M=g.filter(P=>typeof P.deletable=="boolean"?P.deletable:!0),E=M.filter(P=>k.includes(P.id));if(D||E){const P=tA(D,M),N=[...E,...P],L=N.reduce((O,R)=>(O.includes(R.id)||O.push(R.id),O),[]);if((S||b)&&(S&&t.setState({edges:g.filter(O=>!L.includes(O.id))}),b&&(D.forEach(O=>{v.delete(O.id)}),t.setState({nodeInternals:new Map(v)}))),L.length>0&&(w==null||w(N),T&&T(L.map(O=>({id:O,type:"remove"})))),D.length>0&&(x==null||x(D),C)){const O=D.map(R=>({id:R.id,type:"remove"}));C(O)}}},[]),f=I.useCallback(m=>{const _=Zge(m),v=_?null:t.getState().nodeInternals.get(m.id);return[_?m:A8(v),v,_]},[]),h=I.useCallback((m,_=!0,v)=>{const[y,g,b]=f(m);return y?(v||t.getState().getNodes()).filter(S=>{if(!b&&(S.id===g.id||!S.positionAbsolute))return!1;const x=A8(S),w=E5(x,y);return _&&w>0||w>=m.width*m.height}):[]},[]),p=I.useCallback((m,_,v=!0)=>{const[y]=f(m);if(!y)return!1;const g=E5(y,_);return v&&g>0||g>=m.width*m.height},[]);return I.useMemo(()=>({...e,getNodes:n,getNode:r,getEdges:i,getEdge:o,setNodes:a,setEdges:s,addNodes:l,addEdges:u,toObject:c,deleteElements:d,getIntersectingNodes:h,isNodeIntersecting:p}),[e,n,r,i,o,a,s,l,u,c,d,h,p])}var Dme=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const n=Gn(),{deleteElements:r}=GB(),i=xg(e),o=xg(t);I.useEffect(()=>{if(i){const{edges:a,getNodes:s}=n.getState(),l=s().filter(c=>c.selected),u=a.filter(c=>c.selected);r({nodes:l,edges:u}),n.setState({nodesSelectionActive:!1})}},[i]),I.useEffect(()=>{n.setState({multiSelectionActive:o})},[o])};function Lme(e){const t=Gn();I.useEffect(()=>{let n;const r=()=>{var o,a;if(!e.current)return;const i=KE(e.current);(i.height===0||i.width===0)&&((a=(o=t.getState()).onError)==null||a.call(o,"004",ms.error004())),t.setState({width:i.width||500,height:i.height||500})};return r(),window.addEventListener("resize",r),e.current&&(n=new ResizeObserver(()=>r()),n.observe(e.current)),()=>{window.removeEventListener("resize",r),n&&e.current&&n.unobserve(e.current)}},[])}const iA={position:"absolute",width:"100%",height:"100%",top:0,left:0},Fme=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,F0=e=>({x:e.x,y:e.y,zoom:e.k}),Ic=(e,t)=>e.target.closest(`.${t}`),D8=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),L8=e=>{const t=e.ctrlKey&&M1()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},Bme=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),zme=({onMove:e,onMoveStart:t,onMoveEnd:n,onPaneContextMenu:r,zoomOnScroll:i=!0,zoomOnPinch:o=!0,panOnScroll:a=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=Tu.Free,zoomOnDoubleClick:u=!0,elementsSelectable:c,panOnDrag:d=!0,defaultViewport:f,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:_,preventScrolling:v=!0,children:y,noWheelClassName:g,noPanClassName:b})=>{const S=I.useRef(),x=Gn(),w=I.useRef(!1),C=I.useRef(!1),T=I.useRef(null),A=I.useRef({x:0,y:0,zoom:0}),{d3Zoom:k,d3Selection:D,d3ZoomHandler:M,userSelectionActive:E}=dn(Bme,ii),P=xg(_),N=I.useRef(0),L=I.useRef(!1),O=I.useRef();return Lme(T),I.useEffect(()=>{if(T.current){const R=T.current.getBoundingClientRect(),$=Hge().scaleExtent([p,m]).translateExtent(h),z=_o(T.current).call($),V=gl.translate(f.x,f.y).scale(mf(f.zoom,p,m)),H=[[0,0],[R.width,R.height]],Q=$.constrain()(V,H,h);$.transform(z,Q),$.wheelDelta(L8),x.setState({d3Zoom:$,d3Selection:z,d3ZoomHandler:z.on("wheel.zoom"),transform:[Q.x,Q.y,Q.k],domNode:T.current.closest(".react-flow")})}},[]),I.useEffect(()=>{D&&k&&(a&&!P&&!E?D.on("wheel.zoom",R=>{if(Ic(R,g))return!1;R.preventDefault(),R.stopImmediatePropagation();const $=D.property("__zoom").k||1,z=M1();if(R.ctrlKey&&o&&z){const ee=Yo(R),ne=L8(R),fe=$*Math.pow(2,ne);k.scaleTo(D,fe,ee,R);return}const V=R.deltaMode===1?20:1;let H=l===Tu.Vertical?0:R.deltaX*V,Q=l===Tu.Horizontal?0:R.deltaY*V;!z&&R.shiftKey&&l!==Tu.Vertical&&(H=R.deltaY*V,Q=0),k.translateBy(D,-(H/$)*s,-(Q/$)*s,{internal:!0});const Z=F0(D.property("__zoom")),{onViewportChangeStart:J,onViewportChange:j,onViewportChangeEnd:X}=x.getState();clearTimeout(O.current),L.current||(L.current=!0,t==null||t(R,Z),J==null||J(Z)),L.current&&(e==null||e(R,Z),j==null||j(Z),O.current=setTimeout(()=>{n==null||n(R,Z),X==null||X(Z),L.current=!1},150))},{passive:!1}):typeof M<"u"&&D.on("wheel.zoom",function(R,$){if(!v||Ic(R,g))return null;R.preventDefault(),M.call(this,R,$)},{passive:!1}))},[E,a,l,D,k,M,P,o,v,g,t,e,n]),I.useEffect(()=>{k&&k.on("start",R=>{var V,H;if(!R.sourceEvent||R.sourceEvent.internal)return null;N.current=(V=R.sourceEvent)==null?void 0:V.button;const{onViewportChangeStart:$}=x.getState(),z=F0(R.transform);w.current=!0,A.current=z,((H=R.sourceEvent)==null?void 0:H.type)==="mousedown"&&x.setState({paneDragging:!0}),$==null||$(z),t==null||t(R.sourceEvent,z)})},[k,t]),I.useEffect(()=>{k&&(E&&!w.current?k.on("zoom",null):E||k.on("zoom",R=>{var z;const{onViewportChange:$}=x.getState();if(x.setState({transform:[R.transform.x,R.transform.y,R.transform.k]}),C.current=!!(r&&D8(d,N.current??0)),(e||$)&&!((z=R.sourceEvent)!=null&&z.internal)){const V=F0(R.transform);$==null||$(V),e==null||e(R.sourceEvent,V)}}))},[E,k,e,d,r]),I.useEffect(()=>{k&&k.on("end",R=>{if(!R.sourceEvent||R.sourceEvent.internal)return null;const{onViewportChangeEnd:$}=x.getState();if(w.current=!1,x.setState({paneDragging:!1}),r&&D8(d,N.current??0)&&!C.current&&r(R.sourceEvent),C.current=!1,(n||$)&&Fme(A.current,R.transform)){const z=F0(R.transform);A.current=z,clearTimeout(S.current),S.current=setTimeout(()=>{$==null||$(z),n==null||n(R.sourceEvent,z)},a?150:0)}})},[k,a,d,n,r]),I.useEffect(()=>{k&&k.filter(R=>{const $=P||i,z=o&&R.ctrlKey;if(R.button===1&&R.type==="mousedown"&&(Ic(R,"react-flow__node")||Ic(R,"react-flow__edge")))return!0;if(!d&&!$&&!a&&!u&&!o||E||!u&&R.type==="dblclick"||Ic(R,g)&&R.type==="wheel"||Ic(R,b)&&R.type!=="wheel"||!o&&R.ctrlKey&&R.type==="wheel"||!$&&!a&&!z&&R.type==="wheel"||!d&&(R.type==="mousedown"||R.type==="touchstart")||Array.isArray(d)&&!d.includes(R.button)&&(R.type==="mousedown"||R.type==="touchstart"))return!1;const V=Array.isArray(d)&&d.includes(R.button)||!R.button||R.button<=1;return(!R.ctrlKey||R.type==="wheel")&&V})},[E,k,i,o,a,u,d,c,P]),q.jsx("div",{className:"react-flow__renderer",ref:T,style:iA,children:y})},jme=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Vme(){const{userSelectionActive:e,userSelectionRect:t}=dn(jme,ii);return e&&t?q.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function F8(e,t){const n=e.find(r=>r.id===t.parentNode);if(n){const r=t.position.x+t.width-n.width,i=t.position.y+t.height-n.height;if(r>0||i>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,r>0&&(n.style.width+=r),i>0&&(n.style.height+=i),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function HB(e,t){if(e.some(r=>r.type==="reset"))return e.filter(r=>r.type==="reset").map(r=>r.item);const n=e.filter(r=>r.type==="add").map(r=>r.item);return t.reduce((r,i)=>{const o=e.filter(s=>s.id===i.id);if(o.length===0)return r.push(i),r;const a={...i};for(const s of o)if(s)switch(s.type){case"select":{a.selected=s.selected;break}case"position":{typeof s.position<"u"&&(a.position=s.position),typeof s.positionAbsolute<"u"&&(a.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(a.dragging=s.dragging),a.expandParent&&F8(r,a);break}case"dimensions":{typeof s.dimensions<"u"&&(a.width=s.dimensions.width,a.height=s.dimensions.height),typeof s.updateStyle<"u"&&(a.style={...a.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(a.resizing=s.resizing),a.expandParent&&F8(r,a);break}case"remove":return r}return r.push(a),r},n)}function hu(e,t){return HB(e,t)}function ru(e,t){return HB(e,t)}const Hs=(e,t)=>({id:e,type:"select",selected:t});function rd(e,t){return e.reduce((n,r)=>{const i=t.includes(r.id);return!r.selected&&i?(r.selected=!0,n.push(Hs(r.id,!0))):r.selected&&!i&&(r.selected=!1,n.push(Hs(r.id,!1))),n},[])}const jx=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Ume=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),qB=I.memo(({isSelecting:e,selectionMode:t=Pl.Full,panOnDrag:n,onSelectionStart:r,onSelectionEnd:i,onPaneClick:o,onPaneContextMenu:a,onPaneScroll:s,onPaneMouseEnter:l,onPaneMouseMove:u,onPaneMouseLeave:c,children:d})=>{const f=I.useRef(null),h=Gn(),p=I.useRef(0),m=I.useRef(0),_=I.useRef(),{userSelectionActive:v,elementsSelectable:y,dragging:g}=dn(Ume,ii),b=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},S=M=>{o==null||o(M),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=M=>{if(Array.isArray(n)&&(n!=null&&n.includes(2))){M.preventDefault();return}a==null||a(M)},w=s?M=>s(M):void 0,C=M=>{const{resetSelectedElements:E,domNode:P}=h.getState();if(_.current=P==null?void 0:P.getBoundingClientRect(),!y||!e||M.button!==0||M.target!==f.current||!_.current)return;const{x:N,y:L}=ml(M,_.current);E(),h.setState({userSelectionRect:{width:0,height:0,startX:N,startY:L,x:N,y:L}}),r==null||r(M)},T=M=>{const{userSelectionRect:E,nodeInternals:P,edges:N,transform:L,onNodesChange:O,onEdgesChange:R,nodeOrigin:$,getNodes:z}=h.getState();if(!e||!_.current||!E)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const V=ml(M,_.current),H=E.startX??0,Q=E.startY??0,Z={...E,x:V.xne.id),ee=j.map(ne=>ne.id);if(p.current!==ee.length){p.current=ee.length;const ne=rd(J,ee);ne.length&&(O==null||O(ne))}if(m.current!==X.length){m.current=X.length;const ne=rd(N,X);ne.length&&(R==null||R(ne))}h.setState({userSelectionRect:Z})},A=M=>{if(M.button!==0)return;const{userSelectionRect:E}=h.getState();!v&&E&&M.target===f.current&&(S==null||S(M)),h.setState({nodesSelectionActive:p.current>0}),b(),i==null||i(M)},k=M=>{v&&(h.setState({nodesSelectionActive:p.current>0}),i==null||i(M)),b()},D=y&&(e||v);return q.jsxs("div",{className:Zi(["react-flow__pane",{dragging:g,selection:e}]),onClick:D?void 0:jx(S,f),onContextMenu:jx(x,f),onWheel:jx(w,f),onMouseEnter:D?void 0:l,onMouseDown:D?C:void 0,onMouseMove:D?T:u,onMouseUp:D?A:void 0,onMouseLeave:D?k:c,ref:f,style:iA,children:[d,q.jsx(Vme,{})]})});qB.displayName="Pane";function WB(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return n?n.selected?!0:WB(n,t):!1}function B8(e,t,n){let r=e;do{if(r!=null&&r.matches(t))return!0;if(r===n.current)return!1;r=r.parentElement}while(r);return!1}function Gme(e,t,n,r){return Array.from(e.values()).filter(i=>(i.selected||i.id===r)&&(!i.parentNode||!WB(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>{var o,a;return{id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:n.x-(((o=i.positionAbsolute)==null?void 0:o.x)??0),y:n.y-(((a=i.positionAbsolute)==null?void 0:a.y)??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode,width:i.width,height:i.height}})}function Hme(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function KB(e,t,n,r,i=[0,0],o){const a=Hme(e,e.extent||r);let s=a;if(e.extent==="parent")if(e.parentNode&&e.width&&e.height){const c=n.get(e.parentNode),{x:d,y:f}=$d(c,i).positionAbsolute;s=c&&Gi(d)&&Gi(f)&&Gi(c.width)&&Gi(c.height)?[[d+e.width*i[0],f+e.height*i[1]],[d+c.width-e.width+e.width*i[0],f+c.height-e.height+e.height*i[1]]]:s}else o==null||o("005",ms.error005()),s=a;else if(e.extent&&e.parentNode){const c=n.get(e.parentNode),{x:d,y:f}=$d(c,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+f],[e.extent[1][0]+d,e.extent[1][1]+f]]}let l={x:0,y:0};if(e.parentNode){const c=n.get(e.parentNode);l=$d(c,i).positionAbsolute}const u=s&&s!=="parent"?XE(t,s):t;return{position:{x:u.x-l.x,y:u.y-l.y},positionAbsolute:u}}function Vx({nodeId:e,dragItems:t,nodeInternals:n}){const r=t.map(i=>({...n.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?r.find(i=>i.id===e):r[0],r]}const z8=(e,t,n,r)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const o=Array.from(i),a=t.getBoundingClientRect(),s={x:a.width*r[0],y:a.height*r[1]};return o.map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),position:l.getAttribute("data-handlepos"),x:(u.left-a.left-s.x)/n,y:(u.top-a.top-s.y)/n,...KE(l)}})};function dh(e,t,n){return n===void 0?n:r=>{const i=t().nodeInternals.get(e);i&&n(r,{...i})}}function I5({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:i,unselectNodesAndEdges:o,multiSelectionActive:a,nodeInternals:s,onError:l}=t.getState(),u=s.get(e);if(!u){l==null||l("012",ms.error012(e));return}t.setState({nodesSelectionActive:!1}),u.selected?(n||u.selected&&a)&&(o({nodes:[u]}),requestAnimationFrame(()=>{var c;return(c=r==null?void 0:r.current)==null?void 0:c.blur()})):i([e])}function qme(){const e=Gn();return I.useCallback(({sourceEvent:n})=>{const{transform:r,snapGrid:i,snapToGrid:o}=e.getState(),a=n.touches?n.touches[0].clientX:n.clientX,s=n.touches?n.touches[0].clientY:n.clientY,l={x:(a-r[0])/r[2],y:(s-r[1])/r[2]};return{xSnapped:o?i[0]*Math.round(l.x/i[0]):l.x,ySnapped:o?i[1]*Math.round(l.y/i[1]):l.y,...l}},[])}function Ux(e){return(t,n,r)=>e==null?void 0:e(t,r)}function XB({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:i,isSelectable:o,selectNodesOnDrag:a}){const s=Gn(),[l,u]=I.useState(!1),c=I.useRef([]),d=I.useRef({x:null,y:null}),f=I.useRef(0),h=I.useRef(null),p=I.useRef({x:0,y:0}),m=I.useRef(null),_=I.useRef(!1),v=qme();return I.useEffect(()=>{if(e!=null&&e.current){const y=_o(e.current),g=({x:S,y:x})=>{const{nodeInternals:w,onNodeDrag:C,onSelectionDrag:T,updateNodePositions:A,nodeExtent:k,snapGrid:D,snapToGrid:M,nodeOrigin:E,onError:P}=s.getState();d.current={x:S,y:x};let N=!1,L={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&k){const R=eA(c.current,E);L=Sg(R)}if(c.current=c.current.map(R=>{const $={x:S-R.distance.x,y:x-R.distance.y};M&&($.x=D[0]*Math.round($.x/D[0]),$.y=D[1]*Math.round($.y/D[1]));const z=[[k[0][0],k[0][1]],[k[1][0],k[1][1]]];c.current.length>1&&k&&!R.extent&&(z[0][0]=R.positionAbsolute.x-L.x+k[0][0],z[1][0]=R.positionAbsolute.x+(R.width??0)-L.x2+k[1][0],z[0][1]=R.positionAbsolute.y-L.y+k[0][1],z[1][1]=R.positionAbsolute.y+(R.height??0)-L.y2+k[1][1]);const V=KB(R,$,w,z,E,P);return N=N||R.position.x!==V.position.x||R.position.y!==V.position.y,R.position=V.position,R.positionAbsolute=V.positionAbsolute,R}),!N)return;A(c.current,!0,!0),u(!0);const O=i?C:Ux(T);if(O&&m.current){const[R,$]=Vx({nodeId:i,dragItems:c.current,nodeInternals:w});O(m.current,R,$)}},b=()=>{if(!h.current)return;const[S,x]=pB(p.current,h.current);if(S!==0||x!==0){const{transform:w,panBy:C}=s.getState();d.current.x=(d.current.x??0)-S/w[2],d.current.y=(d.current.y??0)-x/w[2],C({x:S,y:x})&&g(d.current)}f.current=requestAnimationFrame(b)};if(t)y.on(".drag",null);else{const S=tpe().on("start",x=>{var N;const{nodeInternals:w,multiSelectionActive:C,domNode:T,nodesDraggable:A,unselectNodesAndEdges:k,onNodeDragStart:D,onSelectionDragStart:M}=s.getState(),E=i?D:Ux(M);!a&&!C&&i&&((N=w.get(i))!=null&&N.selected||k()),i&&o&&a&&I5({id:i,store:s,nodeRef:e});const P=v(x);if(d.current=P,c.current=Gme(w,A,P,i),E&&c.current){const[L,O]=Vx({nodeId:i,dragItems:c.current,nodeInternals:w});E(x.sourceEvent,L,O)}h.current=(T==null?void 0:T.getBoundingClientRect())||null,p.current=ml(x.sourceEvent,h.current)}).on("drag",x=>{const w=v(x),{autoPanOnNodeDrag:C}=s.getState();!_.current&&C&&(_.current=!0,b()),(d.current.x!==w.xSnapped||d.current.y!==w.ySnapped)&&c.current&&(m.current=x.sourceEvent,p.current=ml(x.sourceEvent,h.current),g(w))}).on("end",x=>{if(u(!1),_.current=!1,cancelAnimationFrame(f.current),c.current){const{updateNodePositions:w,nodeInternals:C,onNodeDragStop:T,onSelectionDragStop:A}=s.getState(),k=i?T:Ux(A);if(w(c.current,!1,!1),k){const[D,M]=Vx({nodeId:i,dragItems:c.current,nodeInternals:C});k(x.sourceEvent,D,M)}}}).filter(x=>{const w=x.target;return!x.button&&(!n||!B8(w,`.${n}`,e))&&(!r||B8(w,r,e))});return y.call(S),()=>{y.on(".drag",null)}}}},[e,t,n,r,o,s,i,a,v]),l}function QB(){const e=Gn();return I.useCallback(n=>{const{nodeInternals:r,nodeExtent:i,updateNodePositions:o,getNodes:a,snapToGrid:s,snapGrid:l,onError:u,nodesDraggable:c}=e.getState(),d=a().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),f=s?l[0]:5,h=s?l[1]:5,p=n.isShiftPressed?4:1,m=n.x*f*p,_=n.y*h*p,v=d.map(y=>{if(y.positionAbsolute){const g={x:y.positionAbsolute.x+m,y:y.positionAbsolute.y+_};s&&(g.x=l[0]*Math.round(g.x/l[0]),g.y=l[1]*Math.round(g.y/l[1]));const{positionAbsolute:b,position:S}=KB(y,g,r,i,void 0,u);y.position=S,y.positionAbsolute=b}return y});o(v,!0,!1)},[])}const Nd={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var fh=e=>{const t=({id:n,type:r,data:i,xPos:o,yPos:a,xPosOrigin:s,yPosOrigin:l,selected:u,onClick:c,onMouseEnter:d,onMouseMove:f,onMouseLeave:h,onContextMenu:p,onDoubleClick:m,style:_,className:v,isDraggable:y,isSelectable:g,isConnectable:b,isFocusable:S,selectNodesOnDrag:x,sourcePosition:w,targetPosition:C,hidden:T,resizeObserver:A,dragHandle:k,zIndex:D,isParent:M,noDragClassName:E,noPanClassName:P,initialized:N,disableKeyboardA11y:L,ariaLabel:O,rfId:R})=>{const $=Gn(),z=I.useRef(null),V=I.useRef(w),H=I.useRef(C),Q=I.useRef(r),Z=g||y||c||d||f||h,J=QB(),j=dh(n,$.getState,d),X=dh(n,$.getState,f),ee=dh(n,$.getState,h),ne=dh(n,$.getState,p),fe=dh(n,$.getState,m),ce=we=>{if(g&&(!x||!y)&&I5({id:n,store:$,nodeRef:z}),c){const Ke=$.getState().nodeInternals.get(n);Ke&&c(we,{...Ke})}},Be=we=>{if(!A5(we))if(vB.includes(we.key)&&g){const Ke=we.key==="Escape";I5({id:n,store:$,unselect:Ke,nodeRef:z})}else!L&&y&&u&&Object.prototype.hasOwnProperty.call(Nd,we.key)&&($.setState({ariaLiveMessage:`Moved selected node ${we.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~o}, y: ${~~a}`}),J({x:Nd[we.key].x,y:Nd[we.key].y,isShiftPressed:we.shiftKey}))};I.useEffect(()=>{if(z.current&&!T){const we=z.current;return A==null||A.observe(we),()=>A==null?void 0:A.unobserve(we)}},[T]),I.useEffect(()=>{const we=Q.current!==r,Ke=V.current!==w,be=H.current!==C;z.current&&(we||Ke||be)&&(we&&(Q.current=r),Ke&&(V.current=w),be&&(H.current=C),$.getState().updateNodeDimensions([{id:n,nodeElement:z.current,forceUpdate:!0}]))},[n,r,w,C]);const $e=XB({nodeRef:z,disabled:T||!y,noDragClassName:E,handleSelector:k,nodeId:n,isSelectable:g,selectNodesOnDrag:x});return T?null:q.jsx("div",{className:Zi(["react-flow__node",`react-flow__node-${r}`,{[P]:y},v,{selected:u,selectable:g,parent:M,dragging:$e}]),ref:z,style:{zIndex:D,transform:`translate(${s}px,${l}px)`,pointerEvents:Z?"all":"none",visibility:N?"visible":"hidden",..._},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:j,onMouseMove:X,onMouseLeave:ee,onContextMenu:ne,onClick:ce,onDoubleClick:fe,onKeyDown:S?Be:void 0,tabIndex:S?0:void 0,role:S?"button":void 0,"aria-describedby":L?void 0:`${BB}-${R}`,"aria-label":O,children:q.jsx(ome,{value:n,children:q.jsx(e,{id:n,data:i,type:r,xPos:o,yPos:a,selected:u,isConnectable:b,sourcePosition:w,targetPosition:C,dragging:$e,dragHandle:k,zIndex:D})})})};return t.displayName="NodeWrapper",I.memo(t)};const Wme=e=>{const t=e.getNodes().filter(n=>n.selected);return{...eA(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function Kme({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=Gn(),{width:i,height:o,x:a,y:s,transformString:l,userSelectionActive:u}=dn(Wme,ii),c=QB(),d=I.useRef(null);if(I.useEffect(()=>{var p;n||(p=d.current)==null||p.focus({preventScroll:!0})},[n]),XB({nodeRef:d}),u||!i||!o)return null;const f=e?p=>{const m=r.getState().getNodes().filter(_=>_.selected);e(p,m)}:void 0,h=p=>{Object.prototype.hasOwnProperty.call(Nd,p.key)&&c({x:Nd[p.key].x,y:Nd[p.key].y,isShiftPressed:p.shiftKey})};return q.jsx("div",{className:Zi(["react-flow__nodesselection","react-flow__container",t]),style:{transform:l},children:q.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:n?void 0:-1,onKeyDown:n?void 0:h,style:{width:i,height:o,top:s,left:a}})})}var Xme=I.memo(Kme);const Qme=e=>e.nodesSelectionActive,YB=({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,deleteKeyCode:s,onMove:l,onMoveStart:u,onMoveEnd:c,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:m,multiSelectionKeyCode:_,panActivationKeyCode:v,zoomActivationKeyCode:y,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:S,panOnScroll:x,panOnScrollSpeed:w,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:A,defaultViewport:k,translateExtent:D,minZoom:M,maxZoom:E,preventScrolling:P,onSelectionContextMenu:N,noWheelClassName:L,noPanClassName:O,disableKeyboardA11y:R})=>{const $=dn(Qme),z=xg(d),H=xg(v)||A,Q=z||f&&H!==!0;return Dme({deleteKeyCode:s,multiSelectionKeyCode:_}),q.jsx(zme,{onMove:l,onMoveStart:u,onMoveEnd:c,onPaneContextMenu:o,elementsSelectable:g,zoomOnScroll:b,zoomOnPinch:S,panOnScroll:x,panOnScrollSpeed:w,panOnScrollMode:C,zoomOnDoubleClick:T,panOnDrag:!z&&H,defaultViewport:k,translateExtent:D,minZoom:M,maxZoom:E,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:L,noPanClassName:O,children:q.jsxs(qB,{onSelectionStart:p,onSelectionEnd:m,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:i,onPaneContextMenu:o,onPaneScroll:a,panOnDrag:H,isSelecting:!!Q,selectionMode:h,children:[e,$&&q.jsx(Xme,{onSelectionContextMenu:N,noPanClassName:O,disableKeyboardA11y:R})]})})};YB.displayName="FlowRenderer";var Yme=I.memo(YB);function Zme(e){return dn(I.useCallback(n=>e?TB(n.nodeInternals,{x:0,y:0,width:n.width,height:n.height},n.transform,!0):n.getNodes(),[e]))}function Jme(e){const t={input:fh(e.input||NB),default:fh(e.default||k5),output:fh(e.output||LB),group:fh(e.group||rA)},n={},r=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,o)=>(i[o]=fh(e[o]||k5),i),n);return{...t,...r}}const e0e=({x:e,y:t,width:n,height:r,origin:i})=>!n||!r?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-n*i[0],y:t-r*i[1]},t0e=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),ZB=e=>{const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:i,updateNodeDimensions:o,onError:a}=dn(t0e,ii),s=Zme(e.onlyRenderVisibleElements),l=I.useRef(),u=I.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(d=>{const f=d.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));o(f)});return l.current=c,c},[]);return I.useEffect(()=>()=>{var c;(c=l==null?void 0:l.current)==null||c.disconnect()},[]),q.jsx("div",{className:"react-flow__nodes",style:iA,children:s.map(c=>{var S,x;let d=c.type||"default";e.nodeTypes[d]||(a==null||a("003",ms.error003(d)),d="default");const f=e.nodeTypes[d]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),p=!!(c.selectable||i&&typeof c.selectable>"u"),m=!!(c.connectable||n&&typeof c.connectable>"u"),_=!!(c.focusable||r&&typeof c.focusable>"u"),v=e.nodeExtent?XE(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=(v==null?void 0:v.x)??0,g=(v==null?void 0:v.y)??0,b=e0e({x:y,y:g,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return q.jsx(f,{id:c.id,className:c.className,style:c.style,type:d,data:c.data,sourcePosition:c.sourcePosition||Te.Bottom,targetPosition:c.targetPosition||Te.Top,hidden:c.hidden,xPos:y,yPos:g,xPosOrigin:b.x,yPosOrigin:b.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:p,isConnectable:m,isFocusable:_,resizeObserver:u,dragHandle:c.dragHandle,zIndex:((S=c[Mn])==null?void 0:S.z)??0,isParent:!!((x=c[Mn])!=null&&x.isParent),noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel},c.id)})})};ZB.displayName="NodeRenderer";var n0e=I.memo(ZB);const r0e=(e,t,n)=>n===Te.Left?e-t:n===Te.Right?e+t:e,i0e=(e,t,n)=>n===Te.Top?e-t:n===Te.Bottom?e+t:e,j8="react-flow__edgeupdater",V8=({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:i,onMouseEnter:o,onMouseOut:a,type:s})=>q.jsx("circle",{onMouseDown:i,onMouseEnter:o,onMouseOut:a,className:Zi([j8,`${j8}-${s}`]),cx:r0e(t,r,e),cy:i0e(n,r,e),r,stroke:"transparent",fill:"transparent"}),o0e=()=>!0;var Mc=e=>{const t=({id:n,className:r,type:i,data:o,onClick:a,onEdgeDoubleClick:s,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:_,source:v,target:y,sourceX:g,sourceY:b,targetX:S,targetY:x,sourcePosition:w,targetPosition:C,elementsSelectable:T,hidden:A,sourceHandleId:k,targetHandleId:D,onContextMenu:M,onMouseEnter:E,onMouseMove:P,onMouseLeave:N,edgeUpdaterRadius:L,onEdgeUpdate:O,onEdgeUpdateStart:R,onEdgeUpdateEnd:$,markerEnd:z,markerStart:V,rfId:H,ariaLabel:Q,isFocusable:Z,isUpdatable:J,pathOptions:j,interactionWidth:X})=>{const ee=I.useRef(null),[ne,fe]=I.useState(!1),[ce,Be]=I.useState(!1),$e=Gn(),we=I.useMemo(()=>`url(#${P5(V,H)})`,[V,H]),Ke=I.useMemo(()=>`url(#${P5(z,H)})`,[z,H]);if(A)return null;const be=on=>{const{edges:Mt,addSelectedEdges:si}=$e.getState();if(T&&($e.setState({nodesSelectionActive:!1}),si([n])),a){const Pi=Mt.find(lo=>lo.id===n);a(on,Pi)}},zt=ch(n,$e.getState,s),Hn=ch(n,$e.getState,M),rn=ch(n,$e.getState,E),It=ch(n,$e.getState,P),St=ch(n,$e.getState,N),vn=(on,Mt)=>{if(on.button!==0)return;const{edges:si,isValidConnection:Pi}=$e.getState(),lo=Mt?y:v,Ma=(Mt?D:k)||null,Wn=Mt?"target":"source",uo=Pi||o0e,Yl=Mt,Vo=si.find(xt=>xt.id===n);Be(!0),R==null||R(on,Vo,Wn);const Zl=xt=>{Be(!1),$==null||$(xt,Vo,Wn)};MB({event:on,handleId:Ma,nodeId:lo,onConnect:xt=>O==null?void 0:O(Vo,xt),isTarget:Yl,getState:$e.getState,setState:$e.setState,isValidConnection:uo,edgeUpdaterType:Wn,onEdgeUpdateEnd:Zl})},Vr=on=>vn(on,!0),so=on=>vn(on,!1),Ti=()=>fe(!0),sr=()=>fe(!1),qn=!T&&!a,Sr=on=>{var Mt;if(vB.includes(on.key)&&T){const{unselectNodesAndEdges:si,addSelectedEdges:Pi,edges:lo}=$e.getState();on.key==="Escape"?((Mt=ee.current)==null||Mt.blur(),si({edges:[lo.find(Wn=>Wn.id===n)]})):Pi([n])}};return q.jsxs("g",{className:Zi(["react-flow__edge",`react-flow__edge-${i}`,r,{selected:l,animated:u,inactive:qn,updating:ne}]),onClick:be,onDoubleClick:zt,onContextMenu:Hn,onMouseEnter:rn,onMouseMove:It,onMouseLeave:St,onKeyDown:Z?Sr:void 0,tabIndex:Z?0:void 0,role:Z?"button":"img","data-testid":`rf__edge-${n}`,"aria-label":Q===null?void 0:Q||`Edge from ${v} to ${y}`,"aria-describedby":Z?`${zB}-${H}`:void 0,ref:ee,children:[!ce&&q.jsx(e,{id:n,source:v,target:y,selected:l,animated:u,label:c,labelStyle:d,labelShowBg:f,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,data:o,style:_,sourceX:g,sourceY:b,targetX:S,targetY:x,sourcePosition:w,targetPosition:C,sourceHandleId:k,targetHandleId:D,markerStart:we,markerEnd:Ke,pathOptions:j,interactionWidth:X}),J&&q.jsxs(q.Fragment,{children:[(J==="source"||J===!0)&&q.jsx(V8,{position:w,centerX:g,centerY:b,radius:L,onMouseDown:Vr,onMouseEnter:Ti,onMouseOut:sr,type:"source"}),(J==="target"||J===!0)&&q.jsx(V8,{position:C,centerX:S,centerY:x,radius:L,onMouseDown:so,onMouseEnter:Ti,onMouseOut:sr,type:"target"})]})]})};return t.displayName="EdgeWrapper",I.memo(t)};function a0e(e){const t={default:Mc(e.default||O1),straight:Mc(e.bezier||ZE),step:Mc(e.step||YE),smoothstep:Mc(e.step||K_),simplebezier:Mc(e.simplebezier||QE)},n={},r=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,o)=>(i[o]=Mc(e[o]||O1),i),n);return{...t,...r}}function U8(e,t,n=null){const r=((n==null?void 0:n.x)||0)+t.x,i=((n==null?void 0:n.y)||0)+t.y,o=(n==null?void 0:n.width)||t.width,a=(n==null?void 0:n.height)||t.height;switch(e){case Te.Top:return{x:r+o/2,y:i};case Te.Right:return{x:r+o,y:i+a/2};case Te.Bottom:return{x:r+o/2,y:i+a};case Te.Left:return{x:r,y:i+a/2}}}function G8(e,t){return e?e.length===1||!t?e[0]:t&&e.find(n=>n.id===t)||null:null}const s0e=(e,t,n,r,i,o)=>{const a=U8(n,e,t),s=U8(o,r,i);return{sourceX:a.x,sourceY:a.y,targetX:s.x,targetY:s.y}};function l0e({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:r,targetWidth:i,targetHeight:o,width:a,height:s,transform:l}){const u={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+r,t.y+o)};u.x===u.x2&&(u.x2+=1),u.y===u.y2&&(u.y2+=1);const c=Sg({x:(0-l[0])/l[2],y:(0-l[1])/l[2],width:a/l[2],height:s/l[2]}),d=Math.max(0,Math.min(c.x2,u.x2)-Math.max(c.x,u.x)),f=Math.max(0,Math.min(c.y2,u.y2)-Math.max(c.y,u.y));return Math.ceil(d*f)>0}function H8(e){var r,i,o,a,s;const t=((r=e==null?void 0:e[Mn])==null?void 0:r.handleBounds)||null,n=t&&(e==null?void 0:e.width)&&(e==null?void 0:e.height)&&typeof((i=e==null?void 0:e.positionAbsolute)==null?void 0:i.x)<"u"&&typeof((o=e==null?void 0:e.positionAbsolute)==null?void 0:o.y)<"u";return[{x:((a=e==null?void 0:e.positionAbsolute)==null?void 0:a.x)||0,y:((s=e==null?void 0:e.positionAbsolute)==null?void 0:s.y)||0,width:(e==null?void 0:e.width)||0,height:(e==null?void 0:e.height)||0},t,!!n]}const u0e=[{level:0,isMaxLevel:!0,edges:[]}];function c0e(e,t,n=!1){let r=-1;const i=e.reduce((a,s)=>{var c,d;const l=Gi(s.zIndex);let u=l?s.zIndex:0;if(n){const f=t.get(s.target),h=t.get(s.source),p=s.selected||(f==null?void 0:f.selected)||(h==null?void 0:h.selected),m=Math.max(((c=h==null?void 0:h[Mn])==null?void 0:c.z)||0,((d=f==null?void 0:f[Mn])==null?void 0:d.z)||0,1e3);u=(l?s.zIndex:0)+(p?m:0)}return a[u]?a[u].push(s):a[u]=[s],r=u>r?u:r,a},{}),o=Object.entries(i).map(([a,s])=>{const l=+a;return{edges:s,level:l,isMaxLevel:l===r}});return o.length===0?u0e:o}function d0e(e,t,n){const r=dn(I.useCallback(i=>e?i.edges.filter(o=>{const a=t.get(o.source),s=t.get(o.target);return(a==null?void 0:a.width)&&(a==null?void 0:a.height)&&(s==null?void 0:s.width)&&(s==null?void 0:s.height)&&l0e({sourcePos:a.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:a.width,sourceHeight:a.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return c0e(r,t,n)}const f0e=({color:e="none",strokeWidth:t=1})=>q.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:"none",points:"-5,-4 0,0 -5,4"}),h0e=({color:e="none",strokeWidth:t=1})=>q.jsx("polyline",{stroke:e,strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:t,fill:e,points:"-5,-4 0,0 -5,4 -5,-4"}),q8={[R1.Arrow]:f0e,[R1.ArrowClosed]:h0e};function p0e(e){const t=Gn();return I.useMemo(()=>{var i,o;return Object.prototype.hasOwnProperty.call(q8,e)?q8[e]:((o=(i=t.getState()).onError)==null||o.call(i,"009",ms.error009(e)),null)},[e])}const g0e=({id:e,type:t,color:n,width:r=12.5,height:i=12.5,markerUnits:o="strokeWidth",strokeWidth:a,orient:s="auto-start-reverse"})=>{const l=p0e(t);return l?q.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:o,orient:s,refX:"0",refY:"0",children:q.jsx(l,{color:n,strokeWidth:a})}):null},m0e=({defaultColor:e,rfId:t})=>n=>{const r=[];return n.edges.reduce((i,o)=>([o.markerStart,o.markerEnd].forEach(a=>{if(a&&typeof a=="object"){const s=P5(a,t);r.includes(s)||(i.push({id:s,color:a.color||e,...a}),r.push(s))}}),i),[]).sort((i,o)=>i.id.localeCompare(o.id))},JB=({defaultColor:e,rfId:t})=>{const n=dn(I.useCallback(m0e({defaultColor:e,rfId:t}),[e,t]),(r,i)=>!(r.length!==i.length||r.some((o,a)=>o.id!==i[a].id)));return q.jsx("defs",{children:n.map(r=>q.jsx(g0e,{id:r.id,type:r.type,color:r.color,width:r.width,height:r.height,markerUnits:r.markerUnits,strokeWidth:r.strokeWidth,orient:r.orient},r.id))})};JB.displayName="MarkerDefinitions";var y0e=I.memo(JB);const v0e=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),ez=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:n,rfId:r,edgeTypes:i,noPanClassName:o,onEdgeUpdate:a,onEdgeContextMenu:s,onEdgeMouseEnter:l,onEdgeMouseMove:u,onEdgeMouseLeave:c,onEdgeClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,children:_})=>{const{edgesFocusable:v,edgesUpdatable:y,elementsSelectable:g,width:b,height:S,connectionMode:x,nodeInternals:w,onError:C}=dn(v0e,ii),T=d0e(t,w,n);return b?q.jsxs(q.Fragment,{children:[T.map(({level:A,edges:k,isMaxLevel:D})=>q.jsxs("svg",{style:{zIndex:A},width:b,height:S,className:"react-flow__edges react-flow__container",children:[D&&q.jsx(y0e,{defaultColor:e,rfId:r}),q.jsx("g",{children:k.map(M=>{const[E,P,N]=H8(w.get(M.source)),[L,O,R]=H8(w.get(M.target));if(!N||!R)return null;let $=M.type||"default";i[$]||(C==null||C("011",ms.error011($)),$="default");const z=i[$]||i.default,V=x===ec.Strict?O.target:(O.target??[]).concat(O.source??[]),H=G8(P.source,M.sourceHandle),Q=G8(V,M.targetHandle),Z=(H==null?void 0:H.position)||Te.Bottom,J=(Q==null?void 0:Q.position)||Te.Top,j=!!(M.focusable||v&&typeof M.focusable>"u"),X=typeof a<"u"&&(M.updatable||y&&typeof M.updatable>"u");if(!H||!Q)return C==null||C("008",ms.error008(H,M)),null;const{sourceX:ee,sourceY:ne,targetX:fe,targetY:ce}=s0e(E,H,Z,L,Q,J);return q.jsx(z,{id:M.id,className:Zi([M.className,o]),type:$,data:M.data,selected:!!M.selected,animated:!!M.animated,hidden:!!M.hidden,label:M.label,labelStyle:M.labelStyle,labelShowBg:M.labelShowBg,labelBgStyle:M.labelBgStyle,labelBgPadding:M.labelBgPadding,labelBgBorderRadius:M.labelBgBorderRadius,style:M.style,source:M.source,target:M.target,sourceHandleId:M.sourceHandle,targetHandleId:M.targetHandle,markerEnd:M.markerEnd,markerStart:M.markerStart,sourceX:ee,sourceY:ne,targetX:fe,targetY:ce,sourcePosition:Z,targetPosition:J,elementsSelectable:g,onEdgeUpdate:a,onContextMenu:s,onMouseEnter:l,onMouseMove:u,onMouseLeave:c,onClick:d,edgeUpdaterRadius:f,onEdgeDoubleClick:h,onEdgeUpdateStart:p,onEdgeUpdateEnd:m,rfId:r,ariaLabel:M.ariaLabel,isFocusable:j,isUpdatable:X,pathOptions:"pathOptions"in M?M.pathOptions:void 0,interactionWidth:M.interactionWidth},M.id)})})]},A)),_]}):null};ez.displayName="EdgeRenderer";var b0e=I.memo(ez);const _0e=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function S0e({children:e}){const t=dn(_0e);return q.jsx("div",{className:"react-flow__viewport react-flow__container",style:{transform:t},children:e})}function x0e(e){const t=GB(),n=I.useRef(!1);I.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const w0e={[Te.Left]:Te.Right,[Te.Right]:Te.Left,[Te.Top]:Te.Bottom,[Te.Bottom]:Te.Top},tz=({nodeId:e,handleType:t,style:n,type:r=Ys.Bezier,CustomComponent:i,connectionStatus:o})=>{var x,w,C;const{fromNode:a,handleId:s,toX:l,toY:u,connectionMode:c}=dn(I.useCallback(T=>({fromNode:T.nodeInternals.get(e),handleId:T.connectionHandleId,toX:(T.connectionPosition.x-T.transform[0])/T.transform[2],toY:(T.connectionPosition.y-T.transform[1])/T.transform[2],connectionMode:T.connectionMode}),[e]),ii),d=(x=a==null?void 0:a[Mn])==null?void 0:x.handleBounds;let f=d==null?void 0:d[t];if(c===ec.Loose&&(f=f||(d==null?void 0:d[t==="source"?"target":"source"])),!a||!f)return null;const h=s?f.find(T=>T.id===s):f[0],p=h?h.x+h.width/2:(a.width??0)/2,m=h?h.y+h.height/2:a.height??0,_=(((w=a.positionAbsolute)==null?void 0:w.x)??0)+p,v=(((C=a.positionAbsolute)==null?void 0:C.y)??0)+m,y=h==null?void 0:h.position,g=y?w0e[y]:null;if(!y||!g)return null;if(i)return q.jsx(i,{connectionLineType:r,connectionLineStyle:n,fromNode:a,fromHandle:h,fromX:_,fromY:v,toX:l,toY:u,fromPosition:y,toPosition:g,connectionStatus:o});let b="";const S={sourceX:_,sourceY:v,sourcePosition:y,targetX:l,targetY:u,targetPosition:g};return r===Ys.Bezier?[b]=wB(S):r===Ys.Step?[b]=T5({...S,borderRadius:0}):r===Ys.SmoothStep?[b]=T5(S):r===Ys.SimpleBezier?[b]=xB(S):b=`M${_},${v} ${l},${u}`,q.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:n})};tz.displayName="ConnectionLine";const C0e=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function E0e({containerStyle:e,style:t,type:n,component:r}){const{nodeId:i,handleType:o,nodesConnectable:a,width:s,height:l,connectionStatus:u}=dn(C0e,ii);return!(i&&o&&s&&a)?null:q.jsx("svg",{style:e,width:s,height:l,className:"react-flow__edges react-flow__connectionline react-flow__container",children:q.jsx("g",{className:Zi(["react-flow__connection",u]),children:q.jsx(tz,{nodeId:i,handleType:o,style:t,type:n,CustomComponent:r,connectionStatus:u})})})}function W8(e,t){return I.useRef(null),Gn(),I.useMemo(()=>t(e),[e])}const nz=({nodeTypes:e,edgeTypes:t,onMove:n,onMoveStart:r,onMoveEnd:i,onInit:o,onNodeClick:a,onEdgeClick:s,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,onSelectionContextMenu:p,onSelectionStart:m,onSelectionEnd:_,connectionLineType:v,connectionLineStyle:y,connectionLineComponent:g,connectionLineContainerStyle:b,selectionKeyCode:S,selectionOnDrag:x,selectionMode:w,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:A,deleteKeyCode:k,onlyRenderVisibleElements:D,elementsSelectable:M,selectNodesOnDrag:E,defaultViewport:P,translateExtent:N,minZoom:L,maxZoom:O,preventScrolling:R,defaultMarkerColor:$,zoomOnScroll:z,zoomOnPinch:V,panOnScroll:H,panOnScrollSpeed:Q,panOnScrollMode:Z,zoomOnDoubleClick:J,panOnDrag:j,onPaneClick:X,onPaneMouseEnter:ee,onPaneMouseMove:ne,onPaneMouseLeave:fe,onPaneScroll:ce,onPaneContextMenu:Be,onEdgeUpdate:$e,onEdgeContextMenu:we,onEdgeMouseEnter:Ke,onEdgeMouseMove:be,onEdgeMouseLeave:zt,edgeUpdaterRadius:Hn,onEdgeUpdateStart:rn,onEdgeUpdateEnd:It,noDragClassName:St,noWheelClassName:vn,noPanClassName:Vr,elevateEdgesOnSelect:so,disableKeyboardA11y:Ti,nodeOrigin:sr,nodeExtent:qn,rfId:Sr})=>{const on=W8(e,Jme),Mt=W8(t,a0e);return x0e(o),q.jsx(Yme,{onPaneClick:X,onPaneMouseEnter:ee,onPaneMouseMove:ne,onPaneMouseLeave:fe,onPaneContextMenu:Be,onPaneScroll:ce,deleteKeyCode:k,selectionKeyCode:S,selectionOnDrag:x,selectionMode:w,onSelectionStart:m,onSelectionEnd:_,multiSelectionKeyCode:C,panActivationKeyCode:T,zoomActivationKeyCode:A,elementsSelectable:M,onMove:n,onMoveStart:r,onMoveEnd:i,zoomOnScroll:z,zoomOnPinch:V,zoomOnDoubleClick:J,panOnScroll:H,panOnScrollSpeed:Q,panOnScrollMode:Z,panOnDrag:j,defaultViewport:P,translateExtent:N,minZoom:L,maxZoom:O,onSelectionContextMenu:p,preventScrolling:R,noDragClassName:St,noWheelClassName:vn,noPanClassName:Vr,disableKeyboardA11y:Ti,children:q.jsxs(S0e,{children:[q.jsx(b0e,{edgeTypes:Mt,onEdgeClick:s,onEdgeDoubleClick:u,onEdgeUpdate:$e,onlyRenderVisibleElements:D,onEdgeContextMenu:we,onEdgeMouseEnter:Ke,onEdgeMouseMove:be,onEdgeMouseLeave:zt,onEdgeUpdateStart:rn,onEdgeUpdateEnd:It,edgeUpdaterRadius:Hn,defaultMarkerColor:$,noPanClassName:Vr,elevateEdgesOnSelect:!!so,disableKeyboardA11y:Ti,rfId:Sr,children:q.jsx(E0e,{style:y,type:v,component:g,containerStyle:b})}),q.jsx("div",{className:"react-flow__edgelabel-renderer"}),q.jsx(n0e,{nodeTypes:on,onNodeClick:a,onNodeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:d,onNodeMouseLeave:f,onNodeContextMenu:h,selectNodesOnDrag:E,onlyRenderVisibleElements:D,noPanClassName:Vr,noDragClassName:St,disableKeyboardA11y:Ti,nodeOrigin:sr,nodeExtent:qn,rfId:Sr})]})})};nz.displayName="GraphView";var A0e=I.memo(nz);const M5=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],$s={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:M5,nodeExtent:M5,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ec.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:Jge,isValidConnection:void 0},T0e=()=>hfe((e,t)=>({...$s,setNodes:n=>{const{nodeInternals:r,nodeOrigin:i,elevateNodesOnSelect:o}=t();e({nodeInternals:zx(n,r,i,o)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:n=>{const{defaultEdgeOptions:r={}}=t();e({edges:n.map(i=>({...r,...i}))})},setDefaultNodesAndEdges:(n,r)=>{const i=typeof n<"u",o=typeof r<"u",a=i?zx(n,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:a,edges:o?r:[],hasDefaultNodes:i,hasDefaultEdges:o})},updateNodeDimensions:n=>{const{onNodesChange:r,nodeInternals:i,fitViewOnInit:o,fitViewOnInitDone:a,fitViewOnInitOptions:s,domNode:l,nodeOrigin:u}=t(),c=l==null?void 0:l.querySelector(".react-flow__viewport");if(!c)return;const d=window.getComputedStyle(c),{m22:f}=new window.DOMMatrixReadOnly(d.transform),h=n.reduce((m,_)=>{const v=i.get(_.id);if(v){const y=KE(_.nodeElement);!!(y.width&&y.height&&(v.width!==y.width||v.height!==y.height||_.forceUpdate))&&(i.set(v.id,{...v,[Mn]:{...v[Mn],handleBounds:{source:z8(".source",_.nodeElement,f,u),target:z8(".target",_.nodeElement,f,u)}},...y}),m.push({id:v.id,type:"dimensions",dimensions:y}))}return m},[]);VB(i,u);const p=a||o&&!a&&UB(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:p}),(h==null?void 0:h.length)>0&&(r==null||r(h))},updateNodePositions:(n,r=!0,i=!1)=>{const{triggerNodeChanges:o}=t(),a=n.map(s=>{const l={id:s.id,type:"position",dragging:i};return r&&(l.positionAbsolute=s.positionAbsolute,l.position=s.position),l});o(a)},triggerNodeChanges:n=>{const{onNodesChange:r,nodeInternals:i,hasDefaultNodes:o,nodeOrigin:a,getNodes:s,elevateNodesOnSelect:l}=t();if(n!=null&&n.length){if(o){const u=hu(n,s()),c=zx(u,i,a,l);e({nodeInternals:c})}r==null||r(n)}},addSelectedNodes:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Hs(l,!0)):(a=rd(o(),n),s=rd(i,[])),L0({changedNodes:a,changedEdges:s,get:t,set:e})},addSelectedEdges:n=>{const{multiSelectionActive:r,edges:i,getNodes:o}=t();let a,s=null;r?a=n.map(l=>Hs(l,!0)):(a=rd(i,n),s=rd(o(),[])),L0({changedNodes:s,changedEdges:a,get:t,set:e})},unselectNodesAndEdges:({nodes:n,edges:r}={})=>{const{edges:i,getNodes:o}=t(),a=n||o(),s=r||i,l=a.map(c=>(c.selected=!1,Hs(c.id,!1))),u=s.map(c=>Hs(c.id,!1));L0({changedNodes:l,changedEdges:u,get:t,set:e})},setMinZoom:n=>{const{d3Zoom:r,maxZoom:i}=t();r==null||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:n=>{const{d3Zoom:r,minZoom:i}=t();r==null||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:n=>{var r;(r=t().d3Zoom)==null||r.translateExtent(n),e({translateExtent:n})},resetSelectedElements:()=>{const{edges:n,getNodes:r}=t(),o=r().filter(s=>s.selected).map(s=>Hs(s.id,!1)),a=n.filter(s=>s.selected).map(s=>Hs(s.id,!1));L0({changedNodes:o,changedEdges:a,get:t,set:e})},setNodeExtent:n=>{const{nodeInternals:r}=t();r.forEach(i=>{i.positionAbsolute=XE(i.position,n)}),e({nodeExtent:n,nodeInternals:new Map(r)})},panBy:n=>{const{transform:r,width:i,height:o,d3Zoom:a,d3Selection:s,translateExtent:l}=t();if(!a||!s||!n.x&&!n.y)return!1;const u=gl.translate(r[0]+n.x,r[1]+n.y).scale(r[2]),c=[[0,0],[i,o]],d=a==null?void 0:a.constrain()(u,c,l);return a.transform(s,d),r[0]!==d.x||r[1]!==d.y||r[2]!==d.k},cancelConnection:()=>e({connectionNodeId:$s.connectionNodeId,connectionHandleId:$s.connectionHandleId,connectionHandleType:$s.connectionHandleType,connectionStatus:$s.connectionStatus,connectionStartHandle:$s.connectionStartHandle,connectionEndHandle:$s.connectionEndHandle}),reset:()=>e({...$s})}),Object.is),rz=({children:e})=>{const t=I.useRef(null);return t.current||(t.current=T0e()),q.jsx(qge,{value:t.current,children:e})};rz.displayName="ReactFlowProvider";const iz=({children:e})=>I.useContext(W_)?q.jsx(q.Fragment,{children:e}):q.jsx(rz,{children:e});iz.displayName="ReactFlowWrapper";const P0e={input:NB,default:k5,output:LB,group:rA},k0e={default:O1,straight:ZE,step:YE,smoothstep:K_,simplebezier:QE},I0e=[0,0],M0e=[15,15],R0e={x:0,y:0,zoom:1},O0e={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},$0e=I.forwardRef(({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:i,nodeTypes:o=P0e,edgeTypes:a=k0e,onNodeClick:s,onEdgeClick:l,onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:v,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:x,onNodeDragStart:w,onNodeDrag:C,onNodeDragStop:T,onNodesDelete:A,onEdgesDelete:k,onSelectionChange:D,onSelectionDragStart:M,onSelectionDrag:E,onSelectionDragStop:P,onSelectionContextMenu:N,onSelectionStart:L,onSelectionEnd:O,connectionMode:R=ec.Strict,connectionLineType:$=Ys.Bezier,connectionLineStyle:z,connectionLineComponent:V,connectionLineContainerStyle:H,deleteKeyCode:Q="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:J=!1,selectionMode:j=Pl.Full,panActivationKeyCode:X="Space",multiSelectionKeyCode:ee=M1()?"Meta":"Control",zoomActivationKeyCode:ne=M1()?"Meta":"Control",snapToGrid:fe=!1,snapGrid:ce=M0e,onlyRenderVisibleElements:Be=!1,selectNodesOnDrag:$e=!0,nodesDraggable:we,nodesConnectable:Ke,nodesFocusable:be,nodeOrigin:zt=I0e,edgesFocusable:Hn,edgesUpdatable:rn,elementsSelectable:It,defaultViewport:St=R0e,minZoom:vn=.5,maxZoom:Vr=2,translateExtent:so=M5,preventScrolling:Ti=!0,nodeExtent:sr,defaultMarkerColor:qn="#b1b1b7",zoomOnScroll:Sr=!0,zoomOnPinch:on=!0,panOnScroll:Mt=!1,panOnScrollSpeed:si=.5,panOnScrollMode:Pi=Tu.Free,zoomOnDoubleClick:lo=!0,panOnDrag:Ma=!0,onPaneClick:Wn,onPaneMouseEnter:uo,onPaneMouseMove:Yl,onPaneMouseLeave:Vo,onPaneScroll:Zl,onPaneContextMenu:Kt,children:xt,onEdgeUpdate:Kn,onEdgeContextMenu:$n,onEdgeDoubleClick:lr,onEdgeMouseEnter:xr,onEdgeMouseMove:Ur,onEdgeMouseLeave:Uo,onEdgeUpdateStart:wr,onEdgeUpdateEnd:Xn,edgeUpdaterRadius:Ra=10,onNodesChange:ks,onEdgesChange:Is,noDragClassName:vc="nodrag",noWheelClassName:Oa="nowheel",noPanClassName:Cr="nopan",fitView:Jl=!1,fitViewOptions:b2,connectOnClick:_2=!0,attributionPosition:S2,proOptions:x2,defaultEdgeOptions:Ms,elevateNodesOnSelect:w2=!0,elevateEdgesOnSelect:C2=!1,disableKeyboardA11y:Hm=!1,autoPanOnConnect:E2=!0,autoPanOnNodeDrag:A2=!0,connectionRadius:T2=20,isValidConnection:qf,onError:P2,style:bc,id:_c,...k2},Sc)=>{const xc=_c||"1";return q.jsx("div",{...k2,style:{...bc,...O0e},ref:Sc,className:Zi(["react-flow",i]),"data-testid":"rf__wrapper",id:_c,children:q.jsxs(iz,{children:[q.jsx(A0e,{onInit:u,onMove:c,onMoveStart:d,onMoveEnd:f,onNodeClick:s,onEdgeClick:l,onNodeMouseEnter:y,onNodeMouseMove:g,onNodeMouseLeave:b,onNodeContextMenu:S,onNodeDoubleClick:x,nodeTypes:o,edgeTypes:a,connectionLineType:$,connectionLineStyle:z,connectionLineComponent:V,connectionLineContainerStyle:H,selectionKeyCode:Z,selectionOnDrag:J,selectionMode:j,deleteKeyCode:Q,multiSelectionKeyCode:ee,panActivationKeyCode:X,zoomActivationKeyCode:ne,onlyRenderVisibleElements:Be,selectNodesOnDrag:$e,defaultViewport:St,translateExtent:so,minZoom:vn,maxZoom:Vr,preventScrolling:Ti,zoomOnScroll:Sr,zoomOnPinch:on,zoomOnDoubleClick:lo,panOnScroll:Mt,panOnScrollSpeed:si,panOnScrollMode:Pi,panOnDrag:Ma,onPaneClick:Wn,onPaneMouseEnter:uo,onPaneMouseMove:Yl,onPaneMouseLeave:Vo,onPaneScroll:Zl,onPaneContextMenu:Kt,onSelectionContextMenu:N,onSelectionStart:L,onSelectionEnd:O,onEdgeUpdate:Kn,onEdgeContextMenu:$n,onEdgeDoubleClick:lr,onEdgeMouseEnter:xr,onEdgeMouseMove:Ur,onEdgeMouseLeave:Uo,onEdgeUpdateStart:wr,onEdgeUpdateEnd:Xn,edgeUpdaterRadius:Ra,defaultMarkerColor:qn,noDragClassName:vc,noWheelClassName:Oa,noPanClassName:Cr,elevateEdgesOnSelect:C2,rfId:xc,disableKeyboardA11y:Hm,nodeOrigin:zt,nodeExtent:sr}),q.jsx(Cme,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:p,onConnectEnd:m,onClickConnectStart:_,onClickConnectEnd:v,nodesDraggable:we,nodesConnectable:Ke,nodesFocusable:be,edgesFocusable:Hn,edgesUpdatable:rn,elementsSelectable:It,elevateNodesOnSelect:w2,minZoom:vn,maxZoom:Vr,nodeExtent:sr,onNodesChange:ks,onEdgesChange:Is,snapToGrid:fe,snapGrid:ce,connectionMode:R,translateExtent:so,connectOnClick:_2,defaultEdgeOptions:Ms,fitView:Jl,fitViewOptions:b2,onNodesDelete:A,onEdgesDelete:k,onNodeDragStart:w,onNodeDrag:C,onNodeDragStop:T,onSelectionDrag:E,onSelectionDragStart:M,onSelectionDragStop:P,noPanClassName:Cr,nodeOrigin:zt,rfId:xc,autoPanOnConnect:E2,autoPanOnNodeDrag:A2,onError:P2,connectionRadius:T2,isValidConnection:qf}),q.jsx(xme,{onSelectionChange:D}),xt,q.jsx(Xge,{proOptions:x2,position:S2}),q.jsx(kme,{rfId:xc,disableKeyboardA11y:Hm})]})})});$0e.displayName="ReactFlow";const N0e=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function Eze({children:e}){const t=dn(N0e);return t?hi.createPortal(e,t):null}function Aze(){const e=Gn();return I.useCallback(t=>{const{domNode:n,updateNodeDimensions:r}=e.getState(),o=(Array.isArray(t)?t:[t]).reduce((a,s)=>{const l=n==null?void 0:n.querySelector(`.react-flow__node[data-id="${s}"]`);return l&&a.push({id:s,nodeElement:l,forceUpdate:!0}),a},[]);requestAnimationFrame(()=>r(o))},[])}function D0e(){const e=[];return function(t,n){if(typeof n!="object"||n===null)return n;for(;e.length>0&&e.at(-1)!==this;)e.pop();return e.includes(n)?"[Circular]":(e.push(n),n)}}const wg=Vv("nodes/receivedOpenAPISchema",async(e,{rejectWithValue:t})=>{try{const n=[window.location.origin,"openapi.json"].join("/"),i=await(await fetch(n)).json();return JSON.parse(JSON.stringify(i,D0e()))}catch(n){return t({error:n})}}),Tze=500,Pze=320,L0e="node-drag-handle",kze=["ImageField","ImageCollection"],Ize={input:"inputs",output:"outputs"},B0=["Collection","IntegerCollection","BooleanCollection","FloatCollection","StringCollection","ImageCollection","LatentsCollection","ConditioningCollection","ControlCollection","ColorCollection","T2IAdapterCollection","IPAdapterCollection","MetadataItemCollection","MetadataCollection"],Bh=["IntegerPolymorphic","BooleanPolymorphic","FloatPolymorphic","StringPolymorphic","ImagePolymorphic","LatentsPolymorphic","ConditioningPolymorphic","ControlPolymorphic","ColorPolymorphic","T2IAdapterPolymorphic","IPAdapterPolymorphic","MetadataItemPolymorphic"],Mze=["IPAdapterModelField","ControlNetModelField","LoRAModelField","MainModelField","ONNXModelField","SDXLMainModelField","SDXLRefinerModelField","VaeModelField","UNetField","VaeField","ClipField","T2IAdapterModelField","IPAdapterModelField"],oA={integer:"IntegerCollection",boolean:"BooleanCollection",number:"FloatCollection",float:"FloatCollection",string:"StringCollection",ImageField:"ImageCollection",LatentsField:"LatentsCollection",ConditioningField:"ConditioningCollection",ControlField:"ControlCollection",ColorField:"ColorCollection",T2IAdapterField:"T2IAdapterCollection",IPAdapterField:"IPAdapterCollection",MetadataItemField:"MetadataItemCollection",MetadataField:"MetadataCollection"},F0e=e=>!!(e&&e in oA),oz={integer:"IntegerPolymorphic",boolean:"BooleanPolymorphic",number:"FloatPolymorphic",float:"FloatPolymorphic",string:"StringPolymorphic",ImageField:"ImagePolymorphic",LatentsField:"LatentsPolymorphic",ConditioningField:"ConditioningPolymorphic",ControlField:"ControlPolymorphic",ColorField:"ColorPolymorphic",T2IAdapterField:"T2IAdapterPolymorphic",IPAdapterField:"IPAdapterPolymorphic",MetadataItemField:"MetadataItemPolymorphic"},B0e={IntegerPolymorphic:"integer",BooleanPolymorphic:"boolean",FloatPolymorphic:"float",StringPolymorphic:"string",ImagePolymorphic:"ImageField",LatentsPolymorphic:"LatentsField",ConditioningPolymorphic:"ConditioningField",ControlPolymorphic:"ControlField",ColorPolymorphic:"ColorField",T2IAdapterPolymorphic:"T2IAdapterField",IPAdapterPolymorphic:"IPAdapterField",MetadataItemPolymorphic:"MetadataItemField"},Rze=["string","StringPolymorphic","boolean","BooleanPolymorphic","integer","float","FloatPolymorphic","IntegerPolymorphic","enum","ImageField","ImagePolymorphic","MainModelField","SDXLRefinerModelField","VaeModelField","LoRAModelField","ControlNetModelField","ColorField","SDXLMainModelField","Scheduler","IPAdapterModelField","BoardField","T2IAdapterModelField"],z0e=e=>!!(e&&e in oz),Oze={Any:{color:"gray.500",description:"Any field type is accepted.",title:"Any"},MetadataField:{color:"gray.500",description:"A metadata dict.",title:"Metadata Dict"},MetadataCollection:{color:"gray.500",description:"A collection of metadata dicts.",title:"Metadata Dict Collection"},MetadataItemField:{color:"gray.500",description:"A metadata item.",title:"Metadata Item"},MetadataItemCollection:{color:"gray.500",description:"Any field type is accepted.",title:"Metadata Item Collection"},MetadataItemPolymorphic:{color:"gray.500",description:"MetadataItem or MetadataItemCollection field types are accepted.",title:"Metadata Item Polymorphic"},boolean:{color:"green.500",description:K("nodes.booleanDescription"),title:K("nodes.boolean")},BooleanCollection:{color:"green.500",description:K("nodes.booleanCollectionDescription"),title:K("nodes.booleanCollection")},BooleanPolymorphic:{color:"green.500",description:K("nodes.booleanPolymorphicDescription"),title:K("nodes.booleanPolymorphic")},ClipField:{color:"green.500",description:K("nodes.clipFieldDescription"),title:K("nodes.clipField")},Collection:{color:"base.500",description:K("nodes.collectionDescription"),title:K("nodes.collection")},CollectionItem:{color:"base.500",description:K("nodes.collectionItemDescription"),title:K("nodes.collectionItem")},ColorCollection:{color:"pink.300",description:K("nodes.colorCollectionDescription"),title:K("nodes.colorCollection")},ColorField:{color:"pink.300",description:K("nodes.colorFieldDescription"),title:K("nodes.colorField")},ColorPolymorphic:{color:"pink.300",description:K("nodes.colorPolymorphicDescription"),title:K("nodes.colorPolymorphic")},ConditioningCollection:{color:"cyan.500",description:K("nodes.conditioningCollectionDescription"),title:K("nodes.conditioningCollection")},ConditioningField:{color:"cyan.500",description:K("nodes.conditioningFieldDescription"),title:K("nodes.conditioningField")},ConditioningPolymorphic:{color:"cyan.500",description:K("nodes.conditioningPolymorphicDescription"),title:K("nodes.conditioningPolymorphic")},ControlCollection:{color:"teal.500",description:K("nodes.controlCollectionDescription"),title:K("nodes.controlCollection")},ControlField:{color:"teal.500",description:K("nodes.controlFieldDescription"),title:K("nodes.controlField")},ControlNetModelField:{color:"teal.500",description:"TODO",title:"ControlNet"},ControlPolymorphic:{color:"teal.500",description:"Control info passed between nodes.",title:"Control Polymorphic"},DenoiseMaskField:{color:"blue.300",description:K("nodes.denoiseMaskFieldDescription"),title:K("nodes.denoiseMaskField")},enum:{color:"blue.500",description:K("nodes.enumDescription"),title:K("nodes.enum")},float:{color:"orange.500",description:K("nodes.floatDescription"),title:K("nodes.float")},FloatCollection:{color:"orange.500",description:K("nodes.floatCollectionDescription"),title:K("nodes.floatCollection")},FloatPolymorphic:{color:"orange.500",description:K("nodes.floatPolymorphicDescription"),title:K("nodes.floatPolymorphic")},ImageCollection:{color:"purple.500",description:K("nodes.imageCollectionDescription"),title:K("nodes.imageCollection")},ImageField:{color:"purple.500",description:K("nodes.imageFieldDescription"),title:K("nodes.imageField")},BoardField:{color:"purple.500",description:K("nodes.imageFieldDescription"),title:K("nodes.imageField")},ImagePolymorphic:{color:"purple.500",description:K("nodes.imagePolymorphicDescription"),title:K("nodes.imagePolymorphic")},integer:{color:"red.500",description:K("nodes.integerDescription"),title:K("nodes.integer")},IntegerCollection:{color:"red.500",description:K("nodes.integerCollectionDescription"),title:K("nodes.integerCollection")},IntegerPolymorphic:{color:"red.500",description:K("nodes.integerPolymorphicDescription"),title:K("nodes.integerPolymorphic")},IPAdapterCollection:{color:"teal.500",description:K("nodes.ipAdapterCollectionDescription"),title:K("nodes.ipAdapterCollection")},IPAdapterField:{color:"teal.500",description:K("nodes.ipAdapterDescription"),title:K("nodes.ipAdapter")},IPAdapterModelField:{color:"teal.500",description:K("nodes.ipAdapterModelDescription"),title:K("nodes.ipAdapterModel")},IPAdapterPolymorphic:{color:"teal.500",description:K("nodes.ipAdapterPolymorphicDescription"),title:K("nodes.ipAdapterPolymorphic")},LatentsCollection:{color:"pink.500",description:K("nodes.latentsCollectionDescription"),title:K("nodes.latentsCollection")},LatentsField:{color:"pink.500",description:K("nodes.latentsFieldDescription"),title:K("nodes.latentsField")},LatentsPolymorphic:{color:"pink.500",description:K("nodes.latentsPolymorphicDescription"),title:K("nodes.latentsPolymorphic")},LoRAModelField:{color:"teal.500",description:K("nodes.loRAModelFieldDescription"),title:K("nodes.loRAModelField")},MainModelField:{color:"teal.500",description:K("nodes.mainModelFieldDescription"),title:K("nodes.mainModelField")},ONNXModelField:{color:"teal.500",description:K("nodes.oNNXModelFieldDescription"),title:K("nodes.oNNXModelField")},Scheduler:{color:"base.500",description:K("nodes.schedulerDescription"),title:K("nodes.scheduler")},SDXLMainModelField:{color:"teal.500",description:K("nodes.sDXLMainModelFieldDescription"),title:K("nodes.sDXLMainModelField")},SDXLRefinerModelField:{color:"teal.500",description:K("nodes.sDXLRefinerModelFieldDescription"),title:K("nodes.sDXLRefinerModelField")},string:{color:"yellow.500",description:K("nodes.stringDescription"),title:K("nodes.string")},StringCollection:{color:"yellow.500",description:K("nodes.stringCollectionDescription"),title:K("nodes.stringCollection")},StringPolymorphic:{color:"yellow.500",description:K("nodes.stringPolymorphicDescription"),title:K("nodes.stringPolymorphic")},T2IAdapterCollection:{color:"teal.500",description:K("nodes.t2iAdapterCollectionDescription"),title:K("nodes.t2iAdapterCollection")},T2IAdapterField:{color:"teal.500",description:K("nodes.t2iAdapterFieldDescription"),title:K("nodes.t2iAdapterField")},T2IAdapterModelField:{color:"teal.500",description:"TODO",title:"T2I-Adapter"},T2IAdapterPolymorphic:{color:"teal.500",description:"T2I-Adapter info passed between nodes.",title:"T2I-Adapter Polymorphic"},UNetField:{color:"red.500",description:K("nodes.uNetFieldDescription"),title:K("nodes.uNetField")},VaeField:{color:"blue.500",description:K("nodes.vaeFieldDescription"),title:K("nodes.vaeField")},VaeModelField:{color:"teal.500",description:K("nodes.vaeModelFieldDescription"),title:K("nodes.vaeModelField")}},K8=(e,t,n)=>{let r=t,i=n;for(;e.find(o=>o.position.x===r&&o.position.y===i);)r=r+50,i=i+50;return{x:r,y:i}},j0e=(e,t)=>{if(e==="Collection"&&t==="Collection")return!1;if(e===t)return!0;const n=e==="CollectionItem"&&!B0.includes(t),r=t==="CollectionItem"&&!B0.includes(e)&&!Bh.includes(e),i=Bh.includes(t)&&(()=>{if(!Bh.includes(t))return!1;const c=B0e[t],d=oA[c];return e===c||e===d})(),o=e==="Collection"&&(B0.includes(t)||Bh.includes(t)),a=t==="Collection"&&B0.includes(e);return n||r||i||o||a||e==="integer"&&t==="float"||(e==="integer"||e==="float")&&t==="string"||t==="Any"};var V0e="\0",iu="\0",X8="",Hr,Iu,ui,qg,Hd,qd,Fi,Jo,Js,ea,el,Ga,Ha,Wd,Kd,qa,mo,Wg,R5,QR;let U0e=(QR=class{constructor(t){Ut(this,Wg);Ut(this,Hr,!0);Ut(this,Iu,!1);Ut(this,ui,!1);Ut(this,qg,void 0);Ut(this,Hd,()=>{});Ut(this,qd,()=>{});Ut(this,Fi,{});Ut(this,Jo,{});Ut(this,Js,{});Ut(this,ea,{});Ut(this,el,{});Ut(this,Ga,{});Ut(this,Ha,{});Ut(this,Wd,0);Ut(this,Kd,0);Ut(this,qa,void 0);Ut(this,mo,void 0);t&&(Ii(this,Hr,t.hasOwnProperty("directed")?t.directed:!0),Ii(this,Iu,t.hasOwnProperty("multigraph")?t.multigraph:!1),Ii(this,ui,t.hasOwnProperty("compound")?t.compound:!1)),te(this,ui)&&(Ii(this,qa,{}),Ii(this,mo,{}),te(this,mo)[iu]={})}isDirected(){return te(this,Hr)}isMultigraph(){return te(this,Iu)}isCompound(){return te(this,ui)}setGraph(t){return Ii(this,qg,t),this}graph(){return te(this,qg)}setDefaultNodeLabel(t){return Ii(this,Hd,t),typeof t!="function"&&Ii(this,Hd,()=>t),this}nodeCount(){return te(this,Wd)}nodes(){return Object.keys(te(this,Fi))}sources(){var t=this;return this.nodes().filter(n=>Object.keys(te(t,Jo)[n]).length===0)}sinks(){var t=this;return this.nodes().filter(n=>Object.keys(te(t,ea)[n]).length===0)}setNodes(t,n){var r=arguments,i=this;return t.forEach(function(o){r.length>1?i.setNode(o,n):i.setNode(o)}),this}setNode(t,n){return te(this,Fi).hasOwnProperty(t)?(arguments.length>1&&(te(this,Fi)[t]=n),this):(te(this,Fi)[t]=arguments.length>1?n:te(this,Hd).call(this,t),te(this,ui)&&(te(this,qa)[t]=iu,te(this,mo)[t]={},te(this,mo)[iu][t]=!0),te(this,Jo)[t]={},te(this,Js)[t]={},te(this,ea)[t]={},te(this,el)[t]={},++Xf(this,Wd)._,this)}node(t){return te(this,Fi)[t]}hasNode(t){return te(this,Fi).hasOwnProperty(t)}removeNode(t){var n=this;if(te(this,Fi).hasOwnProperty(t)){var r=i=>n.removeEdge(te(n,Ga)[i]);delete te(this,Fi)[t],te(this,ui)&&(Go(this,Wg,R5).call(this,t),delete te(this,qa)[t],this.children(t).forEach(function(i){n.setParent(i)}),delete te(this,mo)[t]),Object.keys(te(this,Jo)[t]).forEach(r),delete te(this,Jo)[t],delete te(this,Js)[t],Object.keys(te(this,ea)[t]).forEach(r),delete te(this,ea)[t],delete te(this,el)[t],--Xf(this,Wd)._}return this}setParent(t,n){if(!te(this,ui))throw new Error("Cannot set parent in a non-compound graph");if(n===void 0)n=iu;else{n+="";for(var r=n;r!==void 0;r=this.parent(r))if(r===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),Go(this,Wg,R5).call(this,t),te(this,qa)[t]=n,te(this,mo)[n][t]=!0,this}parent(t){if(te(this,ui)){var n=te(this,qa)[t];if(n!==iu)return n}}children(t=iu){if(te(this,ui)){var n=te(this,mo)[t];if(n)return Object.keys(n)}else{if(t===iu)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var n=te(this,Js)[t];if(n)return Object.keys(n)}successors(t){var n=te(this,el)[t];if(n)return Object.keys(n)}neighbors(t){var n=this.predecessors(t);if(n){const i=new Set(n);for(var r of this.successors(t))i.add(r);return Array.from(i.values())}}isLeaf(t){var n;return this.isDirected()?n=this.successors(t):n=this.neighbors(t),n.length===0}filterNodes(t){var n=new this.constructor({directed:te(this,Hr),multigraph:te(this,Iu),compound:te(this,ui)});n.setGraph(this.graph());var r=this;Object.entries(te(this,Fi)).forEach(function([a,s]){t(a)&&n.setNode(a,s)}),Object.values(te(this,Ga)).forEach(function(a){n.hasNode(a.v)&&n.hasNode(a.w)&&n.setEdge(a,r.edge(a))});var i={};function o(a){var s=r.parent(a);return s===void 0||n.hasNode(s)?(i[a]=s,s):s in i?i[s]:o(s)}return te(this,ui)&&n.nodes().forEach(a=>n.setParent(a,o(a))),n}setDefaultEdgeLabel(t){return Ii(this,qd,t),typeof t!="function"&&Ii(this,qd,()=>t),this}edgeCount(){return te(this,Kd)}edges(){return Object.values(te(this,Ga))}setPath(t,n){var r=this,i=arguments;return t.reduce(function(o,a){return i.length>1?r.setEdge(o,a,n):r.setEdge(o,a),a}),this}setEdge(){var t,n,r,i,o=!1,a=arguments[0];typeof a=="object"&&a!==null&&"v"in a?(t=a.v,n=a.w,r=a.name,arguments.length===2&&(i=arguments[1],o=!0)):(t=a,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],o=!0)),t=""+t,n=""+n,r!==void 0&&(r=""+r);var s=zh(te(this,Hr),t,n,r);if(te(this,Ha).hasOwnProperty(s))return o&&(te(this,Ha)[s]=i),this;if(r!==void 0&&!te(this,Iu))throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(n),te(this,Ha)[s]=o?i:te(this,qd).call(this,t,n,r);var l=G0e(te(this,Hr),t,n,r);return t=l.v,n=l.w,Object.freeze(l),te(this,Ga)[s]=l,Q8(te(this,Js)[n],t),Q8(te(this,el)[t],n),te(this,Jo)[n][s]=l,te(this,ea)[t][s]=l,Xf(this,Kd)._++,this}edge(t,n,r){var i=arguments.length===1?Gx(te(this,Hr),arguments[0]):zh(te(this,Hr),t,n,r);return te(this,Ha)[i]}edgeAsObj(){const t=this.edge(...arguments);return typeof t!="object"?{label:t}:t}hasEdge(t,n,r){var i=arguments.length===1?Gx(te(this,Hr),arguments[0]):zh(te(this,Hr),t,n,r);return te(this,Ha).hasOwnProperty(i)}removeEdge(t,n,r){var i=arguments.length===1?Gx(te(this,Hr),arguments[0]):zh(te(this,Hr),t,n,r),o=te(this,Ga)[i];return o&&(t=o.v,n=o.w,delete te(this,Ha)[i],delete te(this,Ga)[i],Y8(te(this,Js)[n],t),Y8(te(this,el)[t],n),delete te(this,Jo)[n][i],delete te(this,ea)[t][i],Xf(this,Kd)._--),this}inEdges(t,n){var r=te(this,Jo)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.v===n):i}}outEdges(t,n){var r=te(this,ea)[t];if(r){var i=Object.values(r);return n?i.filter(o=>o.w===n):i}}nodeEdges(t,n){var r=this.inEdges(t,n);if(r)return r.concat(this.outEdges(t,n))}},Hr=new WeakMap,Iu=new WeakMap,ui=new WeakMap,qg=new WeakMap,Hd=new WeakMap,qd=new WeakMap,Fi=new WeakMap,Jo=new WeakMap,Js=new WeakMap,ea=new WeakMap,el=new WeakMap,Ga=new WeakMap,Ha=new WeakMap,Wd=new WeakMap,Kd=new WeakMap,qa=new WeakMap,mo=new WeakMap,Wg=new WeakSet,R5=function(t){delete te(this,mo)[te(this,qa)[t]][t]},QR);function Q8(e,t){e[t]?e[t]++:e[t]=1}function Y8(e,t){--e[t]||delete e[t]}function zh(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}return i+X8+o+X8+(r===void 0?V0e:r)}function G0e(e,t,n,r){var i=""+t,o=""+n;if(!e&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};return r&&(s.name=r),s}function Gx(e,t){return zh(e,t.v,t.w,t.name)}var aA=U0e,H0e="2.1.13",q0e={Graph:aA,version:H0e},W0e=aA,K0e={write:X0e,read:Z0e};function X0e(e){var t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Q0e(e),edges:Y0e(e)};return e.graph()!==void 0&&(t.value=structuredClone(e.graph())),t}function Q0e(e){return e.nodes().map(function(t){var n=e.node(t),r=e.parent(t),i={v:t};return n!==void 0&&(i.value=n),r!==void 0&&(i.parent=r),i})}function Y0e(e){return e.edges().map(function(t){var n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function Z0e(e){var t=new W0e(e.options).setGraph(e.value);return e.nodes.forEach(function(n){t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(function(n){t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var J0e=eye;function eye(e){var t={},n=[],r;function i(o){t.hasOwnProperty(o)||(t[o]=!0,r.push(o),e.successors(o).forEach(i),e.predecessors(o).forEach(i))}return e.nodes().forEach(function(o){r=[],i(o),r.length&&n.push(r)}),n}var fr,Wa,Kg,O5,Xg,$5,Xd,Gy,YR;let tye=(YR=class{constructor(){Ut(this,Kg);Ut(this,Xg);Ut(this,Xd);Ut(this,fr,[]);Ut(this,Wa,{})}size(){return te(this,fr).length}keys(){return te(this,fr).map(function(t){return t.key})}has(t){return te(this,Wa).hasOwnProperty(t)}priority(t){var n=te(this,Wa)[t];if(n!==void 0)return te(this,fr)[n].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return te(this,fr)[0].key}add(t,n){var r=te(this,Wa);if(t=String(t),!r.hasOwnProperty(t)){var i=te(this,fr),o=i.length;return r[t]=o,i.push({key:t,priority:n}),Go(this,Xg,$5).call(this,o),!0}return!1}removeMin(){Go(this,Xd,Gy).call(this,0,te(this,fr).length-1);var t=te(this,fr).pop();return delete te(this,Wa)[t.key],Go(this,Kg,O5).call(this,0),t.key}decrease(t,n){var r=te(this,Wa)[t];if(n>te(this,fr)[r].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+te(this,fr)[r].priority+" New: "+n);te(this,fr)[r].priority=n,Go(this,Xg,$5).call(this,r)}},fr=new WeakMap,Wa=new WeakMap,Kg=new WeakSet,O5=function(t){var n=te(this,fr),r=2*t,i=r+1,o=t;r>1,!(n[i].priority1;function iye(e,t,n,r){return oye(e,String(t),n||rye,r||function(i){return e.outEdges(i)})}function oye(e,t,n,r){var i={},o=new nye,a,s,l=function(u){var c=u.v!==a?u.v:u.w,d=i[c],f=n(u),h=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h0&&(a=o.removeMin(),s=i[a],s.distance!==Number.POSITIVE_INFINITY);)r(a).forEach(l);return i}var aye=sz,sye=lye;function lye(e,t,n){return e.nodes().reduce(function(r,i){return r[i]=aye(e,i,t,n),r},{})}var lz=uye;function uye(e){var t=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(c){r.hasOwnProperty(c)?r[c].onStack&&(s.lowlink=Math.min(s.lowlink,r[c].index)):(o(c),s.lowlink=Math.min(s.lowlink,r[c].lowlink))}),s.lowlink===s.index){var l=[],u;do u=n.pop(),r[u].onStack=!1,l.push(u);while(a!==u);i.push(l)}}return e.nodes().forEach(function(a){r.hasOwnProperty(a)||o(a)}),i}var cye=lz,dye=fye;function fye(e){return cye(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var hye=gye,pye=()=>1;function gye(e,t,n){return mye(e,t||pye,n||function(r){return e.outEdges(r)})}function mye(e,t,n){var r={},i=e.nodes();return i.forEach(function(o){r[o]={},r[o][o]={distance:0},i.forEach(function(a){o!==a&&(r[o][a]={distance:Number.POSITIVE_INFINITY})}),n(o).forEach(function(a){var s=a.v===o?a.w:a.v,l=t(a);r[o][s]={distance:l,predecessor:o}})}),i.forEach(function(o){var a=r[o];i.forEach(function(s){var l=r[s];i.forEach(function(u){var c=l[o],d=a[u],f=l[u],h=c.distance+d.distance;he.successors(s):s=>e.neighbors(s),i=n==="post"?_ye:Sye,o=[],a={};return t.forEach(s=>{if(!e.hasNode(s))throw new Error("Graph does not have node: "+s);i(s,r,a,o)}),o}function _ye(e,t,n,r){for(var i=[[e,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):n.hasOwnProperty(o[0])||(n[o[0]]=!0,i.push([o[0],!0]),fz(t(o[0]),a=>i.push([a,!1])))}}function Sye(e,t,n,r){for(var i=[e];i.length>0;){var o=i.pop();n.hasOwnProperty(o)||(n[o]=!0,r.push(o),fz(t(o),a=>i.push(a)))}}function fz(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}var xye=dz,wye=Cye;function Cye(e,t){return xye(e,t,"post")}var Eye=dz,Aye=Tye;function Tye(e,t){return Eye(e,t,"pre")}var Pye=aA,kye=az,Iye=Mye;function Mye(e,t){var n=new Pye,r={},i=new kye,o;function a(l){var u=l.v===o?l.w:l.v,c=i.priority(u);if(c!==void 0){var d=t(l);d0;){if(o=i.removeMin(),r.hasOwnProperty(o))n.setEdge(o,r[o]);else{if(s)throw new Error("Input graph is not connected: "+e);s=!0}e.nodeEdges(o).forEach(a)}return n}var Rye={components:J0e,dijkstra:sz,dijkstraAll:sye,findCycles:dye,floydWarshall:hye,isAcyclic:yye,postorder:wye,preorder:Aye,prim:Iye,tarjan:lz,topsort:cz},J8=q0e,Oye={Graph:J8.Graph,json:K0e,alg:Rye,version:J8.version};const eI=Nl(Oye),tI=(e,t,n,r)=>{const i=new eI.Graph;return n.forEach(o=>{i.setNode(o.id)}),r.forEach(o=>{i.setEdge(o.source,o.target)}),i.setEdge(e,t),eI.alg.isAcyclic(i)},nI=(e,t,n,r,i)=>{let o=!0;return t==="source"?e.find(a=>a.target===r.id&&a.targetHandle===i.name)&&(o=!1):e.find(a=>a.source===r.id&&a.sourceHandle===i.name)&&(o=!1),j0e(n,i.type)||(o=!1),o},rI=(e,t,n,r,i,o,a)=>{if(e.id===r)return null;const s=o=="source"?e.data.inputs:e.data.outputs;if(s[i]){const l=s[i],u=o=="source"?r:e.id,c=o=="source"?e.id:r,d=o=="source"?i:l.name,f=o=="source"?l.name:i,h=tI(u,c,t,n),p=nI(n,o,a,e,l);if(h&&p)return{source:u,sourceHandle:d,target:c,targetHandle:f}}for(const l in s){const u=s[l],c=o=="source"?r:e.id,d=o=="source"?e.id:r,f=o=="source"?i:u.name,h=o=="source"?u.name:i,p=tI(c,d,t,n),m=nI(n,o,a,e,u);if(p&&m)return{source:c,sourceHandle:f,target:d,targetHandle:h}}return null},$ye="1.0.0",Hx={status:vu.PENDING,error:null,progress:null,progressImage:null,outputs:[]},D5={meta:{version:$ye},name:"",author:"",description:"",notes:"",tags:"",contact:"",version:"",exposedFields:[]},hz={nodes:[],edges:[],nodeTemplates:{},isReady:!1,connectionStartParams:null,currentConnectionFieldType:null,connectionMade:!1,modifyingEdge:!1,addNewNodePosition:null,shouldShowFieldTypeLegend:!1,shouldShowMinimapPanel:!0,shouldValidateGraph:!0,shouldAnimateEdges:!0,shouldSnapToGrid:!1,shouldColorEdges:!0,isAddNodePopoverOpen:!1,nodeOpacity:1,selectedNodes:[],selectedEdges:[],workflow:D5,nodeExecutionStates:{},viewport:{x:0,y:0,zoom:1},mouseOverField:null,mouseOverNode:null,nodesToCopy:[],edgesToCopy:[],selectionMode:Pl.Partial},Ar=(e,t)=>{var l,u;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(c=>c.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!En(a))return;const s=(u=a.data)==null?void 0:u.inputs[r];s&&o>-1&&(s.value=i)},pz=qt({name:"nodes",initialState:hz,reducers:{nodesChanged:(e,t)=>{e.nodes=hu(t.payload,e.nodes)},nodeAdded:(e,t)=>{var i,o;const n=t.payload,r=K8(e.nodes,((i=e.addNewNodePosition)==null?void 0:i.x)??n.position.x,((o=e.addNewNodePosition)==null?void 0:o.y)??n.position.y);if(n.position=r,n.selected=!0,e.nodes=hu(e.nodes.map(a=>({id:a.id,type:"select",selected:!1})),e.nodes),e.edges=ru(e.edges.map(a=>({id:a.id,type:"select",selected:!1})),e.edges),e.nodes.push(n),!!En(n)){if(e.nodeExecutionStates[n.id]={nodeId:n.id,...Hx},e.connectionStartParams){const{nodeId:a,handleId:s,handleType:l}=e.connectionStartParams;if(a&&s&&l&&e.currentConnectionFieldType){const u=rI(n,e.nodes,e.edges,a,s,l,e.currentConnectionFieldType);u&&(e.edges=Fh({...u,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}},edgeChangeStarted:e=>{e.modifyingEdge=!0},edgesChanged:(e,t)=>{e.edges=ru(t.payload,e.edges)},edgeAdded:(e,t)=>{e.edges=Fh(t.payload,e.edges)},edgeUpdated:(e,t)=>{const{oldEdge:n,newConnection:r}=t.payload;e.edges=dme(n,r,e.edges)},connectionStarted:(e,t)=>{var l;e.connectionStartParams=t.payload,e.connectionMade=e.modifyingEdge;const{nodeId:n,handleId:r,handleType:i}=t.payload;if(!n||!r)return;const o=e.nodes.findIndex(u=>u.id===n),a=(l=e.nodes)==null?void 0:l[o];if(!En(a))return;const s=i==="source"?a.data.outputs[r]:a.data.inputs[r];e.currentConnectionFieldType=(s==null?void 0:s.type)??null},connectionMade:(e,t)=>{e.currentConnectionFieldType&&(e.edges=Fh({...t.payload,type:"default"},e.edges),e.connectionMade=!0)},connectionEnded:(e,t)=>{var n;if(e.connectionMade)e.connectionStartParams=null,e.currentConnectionFieldType=null;else if(e.mouseOverNode){const r=e.nodes.findIndex(o=>o.id===e.mouseOverNode),i=(n=e.nodes)==null?void 0:n[r];if(i&&e.connectionStartParams){const{nodeId:o,handleId:a,handleType:s}=e.connectionStartParams;if(o&&a&&s&&e.currentConnectionFieldType){const l=rI(i,e.nodes,e.edges,o,a,s,e.currentConnectionFieldType);l&&(e.edges=Fh({...l,type:"default"},e.edges))}}e.connectionStartParams=null,e.currentConnectionFieldType=null}else e.addNewNodePosition=t.payload.cursorPosition,e.isAddNodePopoverOpen=!0;e.modifyingEdge=!1},workflowExposedFieldAdded:(e,t)=>{e.workflow.exposedFields=n5(e.workflow.exposedFields.concat(t.payload),n=>`${n.nodeId}-${n.fieldName}`)},workflowExposedFieldRemoved:(e,t)=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(n=>!aE(n,t.payload))},fieldLabelChanged:(e,t)=>{const{nodeId:n,fieldName:r,label:i}=t.payload,o=e.nodes.find(s=>s.id===n);if(!En(o))return;const a=o.data.inputs[r];a&&(a.label=i)},nodeEmbedWorkflowChanged:(e,t)=>{var a;const{nodeId:n,embedWorkflow:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];En(o)&&(o.data.embedWorkflow=r)},nodeUseCacheChanged:(e,t)=>{var a;const{nodeId:n,useCache:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];En(o)&&(o.data.useCache=r)},nodeIsIntermediateChanged:(e,t)=>{var a;const{nodeId:n,isIntermediate:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];En(o)&&(o.data.isIntermediate=r)},nodeIsOpenChanged:(e,t)=>{var s;const{nodeId:n,isOpen:r}=t.payload,i=e.nodes.findIndex(l=>l.id===n),o=(s=e.nodes)==null?void 0:s[i];if(!En(o)&&!r8(o)||(o.data.isOpen=r,!En(o)))return;const a=tA([o],e.edges);if(r)a.forEach(l=>{delete l.hidden}),a.forEach(l=>{l.type==="collapsed"&&(e.edges=e.edges.filter(u=>u.id!==l.id))});else{const l=ume(o,e.nodes,e.edges).filter(d=>En(d)&&d.data.isOpen===!1),u=lme(o,e.nodes,e.edges).filter(d=>En(d)&&d.data.isOpen===!1),c=[];a.forEach(d=>{var f,h;if(d.target===n&&l.find(p=>p.id===d.source)){d.hidden=!0;const p=c.find(m=>m.source===d.source&&m.target===d.target);p?p.data={count:(((f=p.data)==null?void 0:f.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}if(d.source===n&&u.find(p=>p.id===d.target)){const p=c.find(m=>m.source===d.source&&m.target===d.target);d.hidden=!0,p?p.data={count:(((h=p.data)==null?void 0:h.count)??0)+1}:c.push({id:`${d.source}-${d.target}-collapsed`,source:d.source,target:d.target,type:"collapsed",data:{count:1},updatable:!1})}}),c.length&&(e.edges=ru(c.map(d=>({type:"add",item:d})),e.edges))}},edgeDeleted:(e,t)=>{e.edges=e.edges.filter(n=>n.id!==t.payload)},edgesDeleted:(e,t)=>{const r=t.payload.filter(i=>i.type==="collapsed");if(r.length){const i=[];r.forEach(o=>{e.edges.forEach(a=>{a.source===o.source&&a.target===o.target&&i.push({id:a.id,type:"remove"})})}),e.edges=ru(i,e.edges)}},nodesDeleted:(e,t)=>{t.payload.forEach(n=>{e.workflow.exposedFields=e.workflow.exposedFields.filter(r=>r.nodeId!==n.id),En(n)&&delete e.nodeExecutionStates[n.id]})},nodeLabelChanged:(e,t)=>{var a;const{nodeId:n,label:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];En(o)&&(o.data.label=r)},nodeNotesChanged:(e,t)=>{var a;const{nodeId:n,notes:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];En(o)&&(o.data.notes=r)},nodeExclusivelySelected:(e,t)=>{const n=t.payload;e.nodes=hu(e.nodes.map(r=>({id:r.id,type:"select",selected:r.id===n})),e.nodes)},selectedNodesChanged:(e,t)=>{e.selectedNodes=t.payload},selectedEdgesChanged:(e,t)=>{e.selectedEdges=t.payload},fieldStringValueChanged:(e,t)=>{Ar(e,t)},fieldNumberValueChanged:(e,t)=>{Ar(e,t)},fieldBooleanValueChanged:(e,t)=>{Ar(e,t)},fieldBoardValueChanged:(e,t)=>{Ar(e,t)},fieldImageValueChanged:(e,t)=>{Ar(e,t)},fieldColorValueChanged:(e,t)=>{Ar(e,t)},fieldMainModelValueChanged:(e,t)=>{Ar(e,t)},fieldRefinerModelValueChanged:(e,t)=>{Ar(e,t)},fieldVaeModelValueChanged:(e,t)=>{Ar(e,t)},fieldLoRAModelValueChanged:(e,t)=>{Ar(e,t)},fieldControlNetModelValueChanged:(e,t)=>{Ar(e,t)},fieldIPAdapterModelValueChanged:(e,t)=>{Ar(e,t)},fieldT2IAdapterModelValueChanged:(e,t)=>{Ar(e,t)},fieldEnumModelValueChanged:(e,t)=>{Ar(e,t)},fieldSchedulerValueChanged:(e,t)=>{Ar(e,t)},imageCollectionFieldValueChanged:(e,t)=>{var u,c;const{nodeId:n,fieldName:r,value:i}=t.payload,o=e.nodes.findIndex(d=>d.id===n);if(o===-1)return;const a=(u=e.nodes)==null?void 0:u[o];if(!En(a))return;const s=(c=a.data)==null?void 0:c.inputs[r];if(!s)return;const l=et(s.value);if(!l){s.value=i;return}s.value=n5(l.concat(i),"image_name")},notesNodeValueChanged:(e,t)=>{var a;const{nodeId:n,value:r}=t.payload,i=e.nodes.findIndex(s=>s.id===n),o=(a=e.nodes)==null?void 0:a[i];r8(o)&&(o.data.notes=r)},shouldShowFieldTypeLegendChanged:(e,t)=>{e.shouldShowFieldTypeLegend=t.payload},shouldShowMinimapPanelChanged:(e,t)=>{e.shouldShowMinimapPanel=t.payload},nodeTemplatesBuilt:(e,t)=>{e.nodeTemplates=t.payload,e.isReady=!0},nodeEditorReset:e=>{e.nodes=[],e.edges=[],e.workflow=et(D5)},shouldValidateGraphChanged:(e,t)=>{e.shouldValidateGraph=t.payload},shouldAnimateEdgesChanged:(e,t)=>{e.shouldAnimateEdges=t.payload},shouldSnapToGridChanged:(e,t)=>{e.shouldSnapToGrid=t.payload},shouldColorEdgesChanged:(e,t)=>{e.shouldColorEdges=t.payload},nodeOpacityChanged:(e,t)=>{e.nodeOpacity=t.payload},workflowNameChanged:(e,t)=>{e.workflow.name=t.payload},workflowDescriptionChanged:(e,t)=>{e.workflow.description=t.payload},workflowTagsChanged:(e,t)=>{e.workflow.tags=t.payload},workflowAuthorChanged:(e,t)=>{e.workflow.author=t.payload},workflowNotesChanged:(e,t)=>{e.workflow.notes=t.payload},workflowVersionChanged:(e,t)=>{e.workflow.version=t.payload},workflowContactChanged:(e,t)=>{e.workflow.contact=t.payload},workflowLoaded:(e,t)=>{const{nodes:n,edges:r,...i}=t.payload;e.workflow=i,e.nodes=hu(n.map(o=>({item:{...o,dragHandle:`.${L0e}`},type:"add"})),[]),e.edges=ru(r.map(o=>({item:o,type:"add"})),[]),e.nodeExecutionStates=n.reduce((o,a)=>(o[a.id]={nodeId:a.id,...Hx},o),{})},workflowReset:e=>{e.workflow=et(D5)},viewportChanged:(e,t)=>{e.viewport=t.payload},mouseOverFieldChanged:(e,t)=>{e.mouseOverField=t.payload},mouseOverNodeChanged:(e,t)=>{e.mouseOverNode=t.payload},selectedAll:e=>{e.nodes=hu(e.nodes.map(t=>({id:t.id,type:"select",selected:!0})),e.nodes),e.edges=ru(e.edges.map(t=>({id:t.id,type:"select",selected:!0})),e.edges)},selectionCopied:e=>{if(e.nodesToCopy=e.nodes.filter(t=>t.selected).map(et),e.edgesToCopy=e.edges.filter(t=>t.selected).map(et),e.nodesToCopy.length>0){const t={x:0,y:0};e.nodesToCopy.forEach(n=>{const r=.15*(n.width??0),i=.5*(n.height??0);t.x+=n.position.x+r,t.y+=n.position.y+i}),t.x/=e.nodesToCopy.length,t.y/=e.nodesToCopy.length,e.nodesToCopy.forEach(n=>{n.position.x-=t.x,n.position.y-=t.y})}},selectionPasted:(e,t)=>{const{cursorPosition:n}=t.payload,r=e.nodesToCopy.map(et),i=r.map(c=>c.data.id),o=e.edgesToCopy.filter(c=>i.includes(c.source)&&i.includes(c.target)).map(et);o.forEach(c=>c.selected=!0),r.forEach(c=>{const d=ap();o.forEach(h=>{h.source===c.data.id&&(h.source=d,h.id=h.id.replace(c.data.id,d)),h.target===c.data.id&&(h.target=d,h.id=h.id.replace(c.data.id,d))}),c.selected=!0,c.id=d,c.data.id=d;const f=K8(e.nodes,c.position.x+((n==null?void 0:n.x)??0),c.position.y+((n==null?void 0:n.y)??0));c.position=f});const a=r.map(c=>({item:c,type:"add"})),s=e.nodes.map(c=>({id:c.data.id,type:"select",selected:!1})),l=o.map(c=>({item:c,type:"add"})),u=e.edges.map(c=>({id:c.id,type:"select",selected:!1}));e.nodes=hu(a.concat(s),e.nodes),e.edges=ru(l.concat(u),e.edges),r.forEach(c=>{e.nodeExecutionStates[c.id]={nodeId:c.id,...Hx}})},addNodePopoverOpened:e=>{e.addNewNodePosition=null,e.isAddNodePopoverOpen=!0},addNodePopoverClosed:e=>{e.isAddNodePopoverOpen=!1,e.connectionStartParams=null,e.currentConnectionFieldType=null},addNodePopoverToggled:e=>{e.isAddNodePopoverOpen=!e.isAddNodePopoverOpen},selectionModeChanged:(e,t)=>{e.selectionMode=t.payload?Pl.Full:Pl.Partial}},extraReducers:e=>{e.addCase(wg.pending,t=>{t.isReady=!1}),e.addCase(cE,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=vu.IN_PROGRESS)}),e.addCase(fE,(t,n)=>{const{source_node_id:r,result:i}=n.payload.data,o=t.nodeExecutionStates[r];o&&(o.status=vu.COMPLETED,o.progress!==null&&(o.progress=1),o.outputs.push(i))}),e.addCase(Xb,(t,n)=>{const{source_node_id:r}=n.payload.data,i=t.nodeExecutionStates[r];i&&(i.status=vu.FAILED,i.error=n.payload.data.error,i.progress=null,i.progressImage=null)}),e.addCase(hE,(t,n)=>{const{source_node_id:r,step:i,total_steps:o,progress_image:a}=n.payload.data,s=t.nodeExecutionStates[r];s&&(s.status=vu.IN_PROGRESS,s.progress=(i+1)/o,s.progressImage=a??null)}),e.addCase(Qb,(t,n)=>{["in_progress"].includes(n.payload.data.queue_item.status)&&hs(t.nodeExecutionStates,r=>{r.status=vu.PENDING,r.error=null,r.progress=null,r.progressImage=null,r.outputs=[]})})}}),{addNodePopoverClosed:Dze,addNodePopoverOpened:Lze,addNodePopoverToggled:Fze,connectionEnded:Bze,connectionMade:zze,connectionStarted:jze,edgeDeleted:Vze,edgeChangeStarted:Uze,edgesChanged:Gze,edgesDeleted:Hze,edgeUpdated:qze,fieldBoardValueChanged:Wze,fieldBooleanValueChanged:Kze,fieldColorValueChanged:Xze,fieldControlNetModelValueChanged:Qze,fieldEnumModelValueChanged:Yze,fieldImageValueChanged:X_,fieldIPAdapterModelValueChanged:Zze,fieldT2IAdapterModelValueChanged:Jze,fieldLabelChanged:eje,fieldLoRAModelValueChanged:tje,fieldMainModelValueChanged:nje,fieldNumberValueChanged:rje,fieldRefinerModelValueChanged:ije,fieldSchedulerValueChanged:oje,fieldStringValueChanged:aje,fieldVaeModelValueChanged:sje,imageCollectionFieldValueChanged:lje,mouseOverFieldChanged:uje,mouseOverNodeChanged:cje,nodeAdded:dje,nodeEditorReset:Nye,nodeEmbedWorkflowChanged:fje,nodeExclusivelySelected:hje,nodeIsIntermediateChanged:pje,nodeIsOpenChanged:gje,nodeLabelChanged:mje,nodeNotesChanged:yje,nodeOpacityChanged:vje,nodesChanged:bje,nodesDeleted:_je,nodeTemplatesBuilt:gz,nodeUseCacheChanged:Sje,notesNodeValueChanged:xje,selectedAll:wje,selectedEdgesChanged:Cje,selectedNodesChanged:Eje,selectionCopied:Aje,selectionModeChanged:Tje,selectionPasted:Pje,shouldAnimateEdgesChanged:kje,shouldColorEdgesChanged:Ije,shouldShowFieldTypeLegendChanged:Mje,shouldShowMinimapPanelChanged:Rje,shouldSnapToGridChanged:Oje,shouldValidateGraphChanged:$je,viewportChanged:Nje,workflowAuthorChanged:Dje,workflowContactChanged:Lje,workflowDescriptionChanged:Fje,workflowExposedFieldAdded:Dye,workflowExposedFieldRemoved:Bje,workflowLoaded:Lye,workflowNameChanged:zje,workflowNotesChanged:jje,workflowTagsChanged:Vje,workflowVersionChanged:Uje,edgeAdded:Gje}=pz.actions,Fye=pz.reducer,mz={esrganModelName:"RealESRGAN_x4plus.pth"},yz=qt({name:"postprocessing",initialState:mz,reducers:{esrganModelNameChanged:(e,t)=>{e.esrganModelName=t.payload}}}),{esrganModelNameChanged:Hje}=yz.actions,Bye=yz.reducer,vz={positiveStylePrompt:"",negativeStylePrompt:"",shouldConcatSDXLStylePrompt:!0,shouldUseSDXLRefiner:!1,sdxlImg2ImgDenoisingStrength:.7,refinerModel:null,refinerSteps:20,refinerCFGScale:7.5,refinerScheduler:"euler",refinerPositiveAestheticScore:6,refinerNegativeAestheticScore:2.5,refinerStart:.8},bz=qt({name:"sdxl",initialState:vz,reducers:{setPositiveStylePromptSDXL:(e,t)=>{e.positiveStylePrompt=t.payload},setNegativeStylePromptSDXL:(e,t)=>{e.negativeStylePrompt=t.payload},setShouldConcatSDXLStylePrompt:(e,t)=>{e.shouldConcatSDXLStylePrompt=t.payload},setShouldUseSDXLRefiner:(e,t)=>{e.shouldUseSDXLRefiner=t.payload},setSDXLImg2ImgDenoisingStrength:(e,t)=>{e.sdxlImg2ImgDenoisingStrength=t.payload},refinerModelChanged:(e,t)=>{e.refinerModel=t.payload},setRefinerSteps:(e,t)=>{e.refinerSteps=t.payload},setRefinerCFGScale:(e,t)=>{e.refinerCFGScale=t.payload},setRefinerScheduler:(e,t)=>{e.refinerScheduler=t.payload},setRefinerPositiveAestheticScore:(e,t)=>{e.refinerPositiveAestheticScore=t.payload},setRefinerNegativeAestheticScore:(e,t)=>{e.refinerNegativeAestheticScore=t.payload},setRefinerStart:(e,t)=>{e.refinerStart=t.payload}}}),{setPositiveStylePromptSDXL:qje,setNegativeStylePromptSDXL:Wje,setShouldConcatSDXLStylePrompt:Kje,setShouldUseSDXLRefiner:zye,setSDXLImg2ImgDenoisingStrength:Xje,refinerModelChanged:iI,setRefinerSteps:Qje,setRefinerCFGScale:Yje,setRefinerScheduler:Zje,setRefinerPositiveAestheticScore:Jje,setRefinerNegativeAestheticScore:eVe,setRefinerStart:tVe}=bz.actions,jye=bz.reducer,Vye=(e,t,n)=>t===0?0:n===2?Math.floor((e+1+1)/2)/Math.floor((t+1)/2):(e+1+1)/(t+1),tc=e=>typeof e=="string"?{title:e,status:"info",isClosable:!0,duration:2500}:{status:"info",isClosable:!0,duration:2500,...e},_z={isInitialized:!1,isConnected:!1,shouldConfirmOnDelete:!0,enableImageDebugging:!1,toastQueue:[],denoiseProgress:null,shouldAntialiasProgressImage:!1,consoleLogLevel:"debug",shouldLogToConsole:!0,language:"en",shouldUseNSFWChecker:!1,shouldUseWatermarker:!1,shouldEnableInformationalPopovers:!1,status:"DISCONNECTED"},Sz=qt({name:"system",initialState:_z,reducers:{setShouldConfirmOnDelete:(e,t)=>{e.shouldConfirmOnDelete=t.payload},setEnableImageDebugging:(e,t)=>{e.enableImageDebugging=t.payload},addToast:(e,t)=>{e.toastQueue.push(t.payload)},clearToastQueue:e=>{e.toastQueue=[]},consoleLogLevelChanged:(e,t)=>{e.consoleLogLevel=t.payload},shouldLogToConsoleChanged:(e,t)=>{e.shouldLogToConsole=t.payload},shouldAntialiasProgressImageChanged:(e,t)=>{e.shouldAntialiasProgressImage=t.payload},languageChanged:(e,t)=>{e.language=t.payload},shouldUseNSFWCheckerChanged(e,t){e.shouldUseNSFWChecker=t.payload},shouldUseWatermarkerChanged(e,t){e.shouldUseWatermarker=t.payload},setShouldEnableInformationalPopovers(e,t){e.shouldEnableInformationalPopovers=t.payload},isInitializedChanged(e,t){e.isInitialized=t.payload}},extraReducers(e){e.addCase(uE,t=>{t.isConnected=!0,t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(CD,t=>{t.isConnected=!1,t.denoiseProgress=null,t.status="DISCONNECTED"}),e.addCase(cE,t=>{t.denoiseProgress=null,t.status="PROCESSING"}),e.addCase(hE,(t,n)=>{const{step:r,total_steps:i,order:o,progress_image:a,graph_execution_state_id:s,queue_batch_id:l}=n.payload.data;t.denoiseProgress={step:r,total_steps:i,order:o,percentage:Vye(r,i,o),progress_image:a,session_id:s,batch_id:l},t.status="PROCESSING"}),e.addCase(fE,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(PD,t=>{t.denoiseProgress=null,t.status="CONNECTED"}),e.addCase(MD,t=>{t.status="LOADING_MODEL"}),e.addCase(OD,t=>{t.status="CONNECTED"}),e.addCase(Qb,(t,n)=>{["completed","canceled","failed"].includes(n.payload.data.queue_item.status)&&(t.status="CONNECTED",t.denoiseProgress=null)}),e.addMatcher(Wye,(t,n)=>{t.toastQueue.push(tc({title:K("toast.serverError"),status:"error",description:lE(n.payload.data.error_type)}))})}}),{setShouldConfirmOnDelete:nVe,setEnableImageDebugging:rVe,addToast:nt,clearToastQueue:iVe,consoleLogLevelChanged:oVe,shouldLogToConsoleChanged:aVe,shouldAntialiasProgressImageChanged:sVe,languageChanged:lVe,shouldUseNSFWCheckerChanged:Uye,shouldUseWatermarkerChanged:Gye,setShouldEnableInformationalPopovers:uVe,isInitializedChanged:Hye}=Sz.actions,qye=Sz.reducer,Wye=Br(Xb,ND,LD),Kye={searchFolder:null,advancedAddScanModel:null},xz=qt({name:"modelmanager",initialState:Kye,reducers:{setSearchFolder:(e,t)=>{e.searchFolder=t.payload},setAdvancedAddScanModel:(e,t)=>{e.advancedAddScanModel=t.payload}}}),{setSearchFolder:cVe,setAdvancedAddScanModel:dVe}=xz.actions,Xye=xz.reducer,wz={shift:!1,ctrl:!1,meta:!1},Cz=qt({name:"hotkeys",initialState:wz,reducers:{shiftKeyPressed:(e,t)=>{e.shift=t.payload},ctrlKeyPressed:(e,t)=>{e.ctrl=t.payload},metaKeyPressed:(e,t)=>{e.meta=t.payload}}}),{shiftKeyPressed:fVe,ctrlKeyPressed:hVe,metaKeyPressed:pVe}=Cz.actions,Qye=Cz.reducer,Ez={activeTab:"txt2img",shouldShowImageDetails:!1,shouldUseCanvasBetaLayout:!1,shouldShowExistingModelsInSearch:!1,shouldUseSliders:!1,shouldHidePreview:!1,shouldShowProgressInViewer:!0,shouldShowEmbeddingPicker:!1,shouldAutoChangeDimensions:!1,favoriteSchedulers:[],globalContextMenuCloseTrigger:0,panels:{}},Az=qt({name:"ui",initialState:Ez,reducers:{setActiveTab:(e,t)=>{e.activeTab=t.payload},setShouldShowImageDetails:(e,t)=>{e.shouldShowImageDetails=t.payload},setShouldUseCanvasBetaLayout:(e,t)=>{e.shouldUseCanvasBetaLayout=t.payload},setShouldHidePreview:(e,t)=>{e.shouldHidePreview=t.payload},setShouldShowExistingModelsInSearch:(e,t)=>{e.shouldShowExistingModelsInSearch=t.payload},setShouldUseSliders:(e,t)=>{e.shouldUseSliders=t.payload},setShouldShowProgressInViewer:(e,t)=>{e.shouldShowProgressInViewer=t.payload},favoriteSchedulersChanged:(e,t)=>{e.favoriteSchedulers=t.payload},toggleEmbeddingPicker:e=>{e.shouldShowEmbeddingPicker=!e.shouldShowEmbeddingPicker},setShouldAutoChangeDimensions:(e,t)=>{e.shouldAutoChangeDimensions=t.payload},contextMenusClosed:e=>{e.globalContextMenuCloseTrigger+=1},panelsChanged:(e,t)=>{e.panels[t.payload.name]=t.payload.value}},extraReducers(e){e.addCase(t_,t=>{t.activeTab="img2img"})}}),{setActiveTab:Tz,setShouldShowImageDetails:gVe,setShouldUseCanvasBetaLayout:mVe,setShouldShowExistingModelsInSearch:yVe,setShouldUseSliders:vVe,setShouldHidePreview:bVe,setShouldShowProgressInViewer:_Ve,favoriteSchedulersChanged:SVe,toggleEmbeddingPicker:xVe,setShouldAutoChangeDimensions:wVe,contextMenusClosed:CVe,panelsChanged:EVe}=Az.actions,Yye=Az.reducer,Zye=UH(OK);Pz=L5=void 0;var Jye=Zye,eve=function(){var t=[],n=[],r=void 0,i=function(u){return r=u,function(c){return function(d){return Jye.compose.apply(void 0,n)(c)(d)}}},o=function(){for(var u,c,d=arguments.length,f=Array(d),h=0;h=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(u){throw u},f:i}}throw new TypeError(`Invalid attempt to iterate non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var o=!0,a=!1,s;return{s:function(){n=n.call(e)},n:function(){var u=n.next();return o=u.done,u},e:function(u){a=!0,s=u},f:function(){try{!o&&n.return!=null&&n.return()}finally{if(a)throw s}}}}function Iz(e,t){if(e){if(typeof e=="string")return aI(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return aI(e,t)}}function aI(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:{},n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0,i=r.prefix,o=r.driver,a=r.persistWholeStore,s=r.serialize;try{var l=a?pve:gve;yield l(t,n,{prefix:i,driver:o,serialize:s})}catch(u){console.warn("redux-remember: persist error",u)}});return function(){return e.apply(this,arguments)}}();function cI(e,t,n,r,i,o,a){try{var s=e[o](a),l=s.value}catch(u){n(u);return}s.done?t(l):Promise.resolve(l).then(r,i)}function dI(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(l){cI(o,r,i,a,s,"next",l)}function s(l){cI(o,r,i,a,s,"throw",l)}a(void 0)})}}var yve=function(){var e=dI(function*(t,n,r){var i=r.prefix,o=r.driver,a=r.serialize,s=r.unserialize,l=r.persistThrottle,u=r.persistDebounce,c=r.persistWholeStore;yield uve(t,n,{prefix:i,driver:o,unserialize:s,persistWholeStore:c});var d={},f=function(){var h=dI(function*(){var p=kz(t.getState(),n);yield mve(p,d,{prefix:i,driver:o,serialize:a,persistWholeStore:c}),lA(p,d)||t.dispatch({type:ive,payload:p}),d=p});return function(){return h.apply(this,arguments)}}();u&&u>0?t.subscribe(ave(f,u)):t.subscribe(ove(f,l))});return function(n,r,i){return e.apply(this,arguments)}}();const vve=yve;function Cg(e){"@babel/helpers - typeof";return Cg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Cg(e)}function fI(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Kx(e){for(var t=1;t0&&arguments[0]!==void 0?arguments[0]:n.state,i=arguments.length>1?arguments[1]:void 0;i.type&&(i.type==="@@INIT"||i.type.startsWith("@@redux/INIT"))&&(n.state=Kx({},r));var o=typeof t=="function"?t:Pf(t);switch(i.type){case F5:{var a=Kx(Kx({},n.state),i.payload||{});return n.state=o(a,{type:F5,payload:a}),n.state}default:return o(r,i)}}},wve=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=r.prefix,o=i===void 0?"@@remember-":i,a=r.serialize,s=a===void 0?function(_,v){return JSON.stringify(_)}:a,l=r.unserialize,u=l===void 0?function(_,v){return JSON.parse(_)}:l,c=r.persistThrottle,d=c===void 0?100:c,f=r.persistDebounce,h=r.persistWholeStore,p=h===void 0?!1:h;if(!t)throw Error("redux-remember error: driver required");if(!Array.isArray(n))throw Error("redux-remember error: rememberedKeys needs to be an array");var m=function(v){return function(y,g,b){var S=v(y,g,b);return vve(S,n,{driver:t,prefix:o,serialize:s,unserialize:u,persistThrottle:d,persistDebounce:f,persistWholeStore:p}),S}};return m};const AVe=["chakra-ui-color-mode","i18nextLng","ROARR_FILTER","ROARR_LOG"],Cve="@@invokeai-",Eve=["cursorPosition"],Ave=["pendingControlImages"],Tve=["prompts"],Pve=["selection","selectedBoardId","galleryView"],kve=["nodeTemplates","connectionStartParams","currentConnectionFieldType","selectedNodes","selectedEdges","isReady","nodesToCopy","edgesToCopy","connectionMade","modifyingEdge","addNewNodePosition"],Ive=[],Mve=[],Rve=["isInitialized","isConnected","denoiseProgress","status"],Ove=["shouldShowImageDetails","globalContextMenuCloseTrigger","panels"],$ve={canvas:Eve,gallery:Pve,generation:Ive,nodes:kve,postprocessing:Mve,system:Rve,ui:Ove,controlNet:Ave,dynamicPrompts:Tve},Nve=(e,t)=>{const n=Mf(e,$ve[t]??[]);return JSON.stringify(n)},Dve={canvas:UL,gallery:$F,generation:xE,nodes:hz,postprocessing:mz,system:_z,config:_D,ui:Ez,hotkeys:wz,controlAdapters:r5,dynamicPrompts:DE,sdxl:vz},Lve=(e,t)=>hne(JSON.parse(e),Dve[t]),Fve=ve("nodes/textToImageGraphBuilt"),Bve=ve("nodes/imageToImageGraphBuilt"),Rz=ve("nodes/canvasGraphBuilt"),zve=ve("nodes/nodesGraphBuilt"),jve=Br(Fve,Bve,Rz,zve),Vve=ve("nodes/workflowLoadRequested"),Uve=e=>{if(jve(e)&&e.payload.nodes){const t={};return{...e,payload:{...e.payload,nodes:t}}}return wg.fulfilled.match(e)?{...e,payload:""}:gz.match(e)?{...e,payload:""}:e},Gve=["canvas/setCursorPosition","canvas/setStageCoordinates","canvas/setStageScale","canvas/setIsDrawing","canvas/setBoundingBoxCoordinates","canvas/setBoundingBoxDimensions","canvas/setIsDrawing","canvas/addPointToCurrentLine","socket/socketGeneratorProgress","socket/appSocketGeneratorProgress","@@REMEMBER_PERSISTED"],Hve=e=>e,qve=Br(tle,nle),Wve=()=>{pe({matcher:qve,effect:async(e,{dispatch:t,getState:n})=>{const r=le("canvas"),i=n(),{batchIds:o}=i.canvas;try{const a=t(ln.endpoints.cancelByBatchIds.initiate({batch_ids:o},{fixedCacheKey:"cancelByBatchIds"})),{canceled:s}=await a.unwrap();a.reset(),s>0&&(r.debug(`Canceled ${s} canvas batches`),t(nt({title:K("queue.cancelBatchSucceeded"),status:"success"}))),t(ale())}catch{r.error("Failed to cancel canvas batches"),t(nt({title:K("queue.cancelBatchFailed"),status:"error"}))}}})};ve("app/appStarted");const Kve=()=>{pe({matcher:ue.endpoints.listImages.matchFulfilled,effect:async(e,{dispatch:t,unsubscribe:n,cancelActiveListeners:r})=>{if(e.meta.arg.queryCacheKey!==Li({board_id:"none",categories:Ln}))return;r(),n();const i=e.payload;if(i.ids.length>0){const o=$t.getSelectors().selectAll(i)[0];t(pa(o??null))}}})},Xve=()=>{pe({matcher:ln.endpoints.enqueueBatch.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{data:r}=ln.endpoints.getQueueStatus.select()(n());!r||r.processor.is_started||t(ln.endpoints.resumeProcessor.initiate(void 0,{fixedCacheKey:"resumeProcessor"}))}})},Oz=Do.injectEndpoints({endpoints:e=>({getAppVersion:e.query({query:()=>({url:"app/version",method:"GET"}),providesTags:["AppVersion"],keepUnusedDataFor:864e5}),getAppConfig:e.query({query:()=>({url:"app/config",method:"GET"}),providesTags:["AppConfig"],keepUnusedDataFor:864e5}),getInvocationCacheStatus:e.query({query:()=>({url:"app/invocation_cache/status",method:"GET"}),providesTags:["InvocationCacheStatus"]}),clearInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache",method:"DELETE"}),invalidatesTags:["InvocationCacheStatus"]}),enableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/enable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]}),disableInvocationCache:e.mutation({query:()=>({url:"app/invocation_cache/disable",method:"PUT"}),invalidatesTags:["InvocationCacheStatus"]})})}),{useGetAppVersionQuery:TVe,useGetAppConfigQuery:PVe,useClearInvocationCacheMutation:kVe,useDisableInvocationCacheMutation:IVe,useEnableInvocationCacheMutation:MVe,useGetInvocationCacheStatusQuery:RVe}=Oz,Qve=()=>{pe({matcher:Oz.endpoints.getAppConfig.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const{infill_methods:r=[],nsfw_methods:i=[],watermarking_methods:o=[]}=e.payload,a=t().generation.infillMethod;r.includes(a)||n(Ooe(r[0])),i.includes("nsfw_checker")||n(Uye(!1)),o.includes("invisible_watermark")||n(Gye(!1))}})},Yve=ve("app/appStarted"),Zve=()=>{pe({actionCreator:Yve,effect:async(e,{unsubscribe:t,cancelActiveListeners:n})=>{n(),t()}})},Y_={memoizeOptions:{resultEqualityCheck:aE}},$z=(e,t)=>{var d;const{generation:n,canvas:r,nodes:i,controlAdapters:o}=e,a=((d=n.initialImage)==null?void 0:d.imageName)===t,s=r.layerState.objects.some(f=>f.kind==="image"&&f.imageName===t),l=i.nodes.filter(En).some(f=>Bc(f.data.inputs,h=>{var p;return h.type==="ImageField"&&((p=h.value)==null?void 0:p.image_name)===t})),u=Xi(o).some(f=>f.controlImage===t||di(f)&&f.processedControlImage===t);return{isInitialImage:a,isCanvasImage:s,isNodesImage:l,isControlImage:u}},Jve=ir([e=>e],e=>{const{imagesToDelete:t}=e.deleteImageModal;return t.length?t.map(r=>$z(e,r.image_name)):[]},Y_),e1e=()=>{pe({matcher:ue.endpoints.deleteBoardAndImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{deleted_images:r}=e.payload;let i=!1,o=!1,a=!1,s=!1;const l=n();r.forEach(u=>{const c=$z(l,u);c.isInitialImage&&!i&&(t(wE()),i=!0),c.isCanvasImage&&!o&&(t($E()),o=!0),c.isNodesImage&&!a&&(t(Nye()),a=!0),c.isControlImage&&!s&&(t(fie()),s=!0)})}})},t1e=()=>{pe({matcher:Br(C1,m5),effect:async(e,{getState:t,dispatch:n,condition:r,cancelActiveListeners:i})=>{i();const o=t(),a=C1.match(e)?e.payload.boardId:o.gallery.selectedBoardId,l=(m5.match(e)?e.payload:o.gallery.galleryView)==="images"?Ln:Pr,u={board_id:a??"none",categories:l};if(await r(()=>ue.endpoints.listImages.select(u)(t()).isSuccess,5e3)){const{data:d}=ue.endpoints.listImages.select(u)(t());if(d){const f=fg.selectAll(d)[0],h=fg.selectById(d,e.payload.selectedImageName);n(pa(h||f||null))}else n(pa(null))}else n(pa(null))}})},n1e=ve("canvas/canvasSavedToGallery"),r1e=ve("canvas/canvasMaskSavedToGallery"),i1e=ve("canvas/canvasCopiedToClipboard"),o1e=ve("canvas/canvasDownloadedAsImage"),a1e=ve("canvas/canvasMerged"),s1e=ve("canvas/stagingAreaImageSaved"),l1e=ve("canvas/canvasMaskToControlAdapter"),u1e=ve("canvas/canvasImageToControlAdapter");let Nz=null,Dz=null;const OVe=e=>{Nz=e},Z_=()=>Nz,$Ve=e=>{Dz=e},c1e=()=>Dz,d1e=async e=>new Promise((t,n)=>{e.toBlob(r=>{if(r){t(r);return}n("Unable to create Blob")})}),D1=async(e,t)=>await d1e(e.toCanvas(t)),J_=async(e,t=!1)=>{const n=Z_();if(!n)throw new Error("Problem getting base layer blob");const{shouldCropToBoundingBoxOnSave:r,boundingBoxCoordinates:i,boundingBoxDimensions:o}=e.canvas,a=n.clone();a.scale({x:1,y:1});const s=a.getAbsolutePosition(),l=r||t?{x:i.x+s.x,y:i.y+s.y,width:o.width,height:o.height}:a.getClientRect();return D1(a,l)},f1e=(e,t="image/png")=>{navigator.clipboard.write([new ClipboardItem({[t]:e})])},h1e=()=>{pe({actionCreator:i1e,effect:async(e,{dispatch:t,getState:n})=>{const r=V_.get().child({namespace:"canvasCopiedToClipboardListener"}),i=n();try{const o=J_(i);f1e(o)}catch(o){r.error(String(o)),t(nt({title:K("toast.problemCopyingCanvas"),description:K("toast.problemCopyingCanvasDesc"),status:"error"}));return}t(nt({title:K("toast.canvasCopiedClipboard"),status:"success"}))}})},p1e=(e,t)=>{const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),r.remove()},g1e=()=>{pe({actionCreator:o1e,effect:async(e,{dispatch:t,getState:n})=>{const r=V_.get().child({namespace:"canvasSavedToGalleryListener"}),i=n();let o;try{o=await J_(i)}catch(a){r.error(String(a)),t(nt({title:K("toast.problemDownloadingCanvas"),description:K("toast.problemDownloadingCanvasDesc"),status:"error"}));return}p1e(o,"canvas.png"),t(nt({title:K("toast.canvasDownloaded"),status:"success"}))}})},m1e=()=>{pe({actionCreator:u1e,effect:async(e,{dispatch:t,getState:n})=>{const r=le("canvas"),i=n(),{id:o}=e.payload;let a;try{a=await J_(i,!0)}catch(c){r.error(String(c)),t(nt({title:K("toast.problemSavingCanvas"),description:K("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery,l=await t(ue.endpoints.uploadImage.initiate({file:new File([a],"savedCanvas.png",{type:"image/png"}),image_category:"control",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.canvasSentControlnetAssets")}}})).unwrap(),{image_name:u}=l;t(jl({id:o,controlImage:u}))}})};var uA={exports:{}},eS={},Lz={},Ue={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e._registerNode=e.Konva=e.glob=void 0;var t=Math.PI/180;function n(){return typeof window<"u"&&({}.toString.call(window)==="[object Window]"||{}.toString.call(window)==="[object global]")}e.glob=typeof Ve<"u"?Ve:typeof window<"u"?window:typeof WorkerGlobalScope<"u"?self:{},e.Konva={_global:e.glob,version:"9.2.0",isBrowser:n(),isUnminified:/param/.test((function(i){}).toString()),dblClickWindow:400,getAngle(i){return e.Konva.angleDeg?i*t:i},enableTrace:!1,pointerEventsEnabled:!0,autoDrawEnabled:!0,hitOnDragEnabled:!1,capturePointerEventsEnabled:!1,_mouseListenClick:!1,_touchListenClick:!1,_pointerListenClick:!1,_mouseInDblClickWindow:!1,_touchInDblClickWindow:!1,_pointerInDblClickWindow:!1,_mouseDblClickPointerId:null,_touchDblClickPointerId:null,_pointerDblClickPointerId:null,pixelRatio:typeof window<"u"&&window.devicePixelRatio||1,dragDistance:3,angleDeg:!0,showWarnings:!0,dragButtons:[0,1],isDragging(){return e.Konva.DD.isDragging},isDragReady(){return!!e.Konva.DD.node},releaseCanvasOnDestroy:!0,document:e.glob.document,_injectGlobal(i){e.glob.Konva=i}};const r=i=>{e.Konva[i.prototype.getClassName()]=i};e._registerNode=r,e.Konva._injectGlobal(e.Konva)})(Ue);var tn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Util=e.Transform=void 0;const t=Ue;class n{constructor(b=[1,0,0,1,0,0]){this.dirty=!1,this.m=b&&b.slice()||[1,0,0,1,0,0]}reset(){this.m[0]=1,this.m[1]=0,this.m[2]=0,this.m[3]=1,this.m[4]=0,this.m[5]=0}copy(){return new n(this.m)}copyInto(b){b.m[0]=this.m[0],b.m[1]=this.m[1],b.m[2]=this.m[2],b.m[3]=this.m[3],b.m[4]=this.m[4],b.m[5]=this.m[5]}point(b){var S=this.m;return{x:S[0]*b.x+S[2]*b.y+S[4],y:S[1]*b.x+S[3]*b.y+S[5]}}translate(b,S){return this.m[4]+=this.m[0]*b+this.m[2]*S,this.m[5]+=this.m[1]*b+this.m[3]*S,this}scale(b,S){return this.m[0]*=b,this.m[1]*=b,this.m[2]*=S,this.m[3]*=S,this}rotate(b){var S=Math.cos(b),x=Math.sin(b),w=this.m[0]*S+this.m[2]*x,C=this.m[1]*S+this.m[3]*x,T=this.m[0]*-x+this.m[2]*S,A=this.m[1]*-x+this.m[3]*S;return this.m[0]=w,this.m[1]=C,this.m[2]=T,this.m[3]=A,this}getTranslation(){return{x:this.m[4],y:this.m[5]}}skew(b,S){var x=this.m[0]+this.m[2]*S,w=this.m[1]+this.m[3]*S,C=this.m[2]+this.m[0]*b,T=this.m[3]+this.m[1]*b;return this.m[0]=x,this.m[1]=w,this.m[2]=C,this.m[3]=T,this}multiply(b){var S=this.m[0]*b.m[0]+this.m[2]*b.m[1],x=this.m[1]*b.m[0]+this.m[3]*b.m[1],w=this.m[0]*b.m[2]+this.m[2]*b.m[3],C=this.m[1]*b.m[2]+this.m[3]*b.m[3],T=this.m[0]*b.m[4]+this.m[2]*b.m[5]+this.m[4],A=this.m[1]*b.m[4]+this.m[3]*b.m[5]+this.m[5];return this.m[0]=S,this.m[1]=x,this.m[2]=w,this.m[3]=C,this.m[4]=T,this.m[5]=A,this}invert(){var b=1/(this.m[0]*this.m[3]-this.m[1]*this.m[2]),S=this.m[3]*b,x=-this.m[1]*b,w=-this.m[2]*b,C=this.m[0]*b,T=b*(this.m[2]*this.m[5]-this.m[3]*this.m[4]),A=b*(this.m[1]*this.m[4]-this.m[0]*this.m[5]);return this.m[0]=S,this.m[1]=x,this.m[2]=w,this.m[3]=C,this.m[4]=T,this.m[5]=A,this}getMatrix(){return this.m}decompose(){var b=this.m[0],S=this.m[1],x=this.m[2],w=this.m[3],C=this.m[4],T=this.m[5],A=b*w-S*x;let k={x:C,y:T,rotation:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(b!=0||S!=0){var D=Math.sqrt(b*b+S*S);k.rotation=S>0?Math.acos(b/D):-Math.acos(b/D),k.scaleX=D,k.scaleY=A/D,k.skewX=(b*x+S*w)/A,k.skewY=0}else if(x!=0||w!=0){var M=Math.sqrt(x*x+w*w);k.rotation=Math.PI/2-(w>0?Math.acos(-x/M):-Math.acos(x/M)),k.scaleX=A/M,k.scaleY=M,k.skewX=0,k.skewY=(b*x+S*w)/A}return k.rotation=e.Util._getRotation(k.rotation),k}}e.Transform=n;var r="[object Array]",i="[object Number]",o="[object String]",a="[object Boolean]",s=Math.PI/180,l=180/Math.PI,u="#",c="",d="0",f="Konva warning: ",h="Konva error: ",p="rgb(",m={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,132,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,255,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,203],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[119,128,144],slategrey:[119,128,144],snow:[255,255,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],transparent:[255,255,255,0],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,5]},_=/rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/,v=[];const y=typeof requestAnimationFrame<"u"&&requestAnimationFrame||function(g){setTimeout(g,60)};e.Util={_isElement(g){return!!(g&&g.nodeType==1)},_isFunction(g){return!!(g&&g.constructor&&g.call&&g.apply)},_isPlainObject(g){return!!g&&g.constructor===Object},_isArray(g){return Object.prototype.toString.call(g)===r},_isNumber(g){return Object.prototype.toString.call(g)===i&&!isNaN(g)&&isFinite(g)},_isString(g){return Object.prototype.toString.call(g)===o},_isBoolean(g){return Object.prototype.toString.call(g)===a},isObject(g){return g instanceof Object},isValidSelector(g){if(typeof g!="string")return!1;var b=g[0];return b==="#"||b==="."||b===b.toUpperCase()},_sign(g){return g===0||g>0?1:-1},requestAnimFrame(g){v.push(g),v.length===1&&y(function(){const b=v;v=[],b.forEach(function(S){S()})})},createCanvasElement(){var g=document.createElement("canvas");try{g.style=g.style||{}}catch{}return g},createImageElement(){return document.createElement("img")},_isInDocument(g){for(;g=g.parentNode;)if(g==document)return!0;return!1},_urlToImage(g,b){var S=e.Util.createImageElement();S.onload=function(){b(S)},S.src=g},_rgbToHex(g,b,S){return((1<<24)+(g<<16)+(b<<8)+S).toString(16).slice(1)},_hexToRgb(g){g=g.replace(u,c);var b=parseInt(g,16);return{r:b>>16&255,g:b>>8&255,b:b&255}},getRandomColor(){for(var g=(Math.random()*16777215<<0).toString(16);g.length<6;)g=d+g;return u+g},getRGB(g){var b;return g in m?(b=m[g],{r:b[0],g:b[1],b:b[2]}):g[0]===u?this._hexToRgb(g.substring(1)):g.substr(0,4)===p?(b=_.exec(g.replace(/ /g,"")),{r:parseInt(b[1],10),g:parseInt(b[2],10),b:parseInt(b[3],10)}):{r:0,g:0,b:0}},colorToRGBA(g){return g=g||"black",e.Util._namedColorToRBA(g)||e.Util._hex3ColorToRGBA(g)||e.Util._hex4ColorToRGBA(g)||e.Util._hex6ColorToRGBA(g)||e.Util._hex8ColorToRGBA(g)||e.Util._rgbColorToRGBA(g)||e.Util._rgbaColorToRGBA(g)||e.Util._hslColorToRGBA(g)},_namedColorToRBA(g){var b=m[g.toLowerCase()];return b?{r:b[0],g:b[1],b:b[2],a:1}:null},_rgbColorToRGBA(g){if(g.indexOf("rgb(")===0){g=g.match(/rgb\(([^)]+)\)/)[1];var b=g.split(/ *, */).map(Number);return{r:b[0],g:b[1],b:b[2],a:1}}},_rgbaColorToRGBA(g){if(g.indexOf("rgba(")===0){g=g.match(/rgba\(([^)]+)\)/)[1];var b=g.split(/ *, */).map((S,x)=>S.slice(-1)==="%"?x===3?parseInt(S)/100:parseInt(S)/100*255:Number(S));return{r:b[0],g:b[1],b:b[2],a:b[3]}}},_hex8ColorToRGBA(g){if(g[0]==="#"&&g.length===9)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:parseInt(g.slice(7,9),16)/255}},_hex6ColorToRGBA(g){if(g[0]==="#"&&g.length===7)return{r:parseInt(g.slice(1,3),16),g:parseInt(g.slice(3,5),16),b:parseInt(g.slice(5,7),16),a:1}},_hex4ColorToRGBA(g){if(g[0]==="#"&&g.length===5)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:parseInt(g[4]+g[4],16)/255}},_hex3ColorToRGBA(g){if(g[0]==="#"&&g.length===4)return{r:parseInt(g[1]+g[1],16),g:parseInt(g[2]+g[2],16),b:parseInt(g[3]+g[3],16),a:1}},_hslColorToRGBA(g){if(/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.test(g)){const[b,...S]=/hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(g),x=Number(S[0])/360,w=Number(S[1])/100,C=Number(S[2])/100;let T,A,k;if(w===0)return k=C*255,{r:Math.round(k),g:Math.round(k),b:Math.round(k),a:1};C<.5?T=C*(1+w):T=C+w-C*w;const D=2*C-T,M=[0,0,0];for(let E=0;E<3;E++)A=x+1/3*-(E-1),A<0&&A++,A>1&&A--,6*A<1?k=D+(T-D)*6*A:2*A<1?k=T:3*A<2?k=D+(T-D)*(2/3-A)*6:k=D,M[E]=k*255;return{r:Math.round(M[0]),g:Math.round(M[1]),b:Math.round(M[2]),a:1}}},haveIntersection(g,b){return!(b.x>g.x+g.width||b.x+b.widthg.y+g.height||b.y+b.height1?(T=S,A=x,k=(S-w)*(S-w)+(x-C)*(x-C)):(T=g+M*(S-g),A=b+M*(x-b),k=(T-w)*(T-w)+(A-C)*(A-C))}return[T,A,k]},_getProjectionToLine(g,b,S){var x=e.Util.cloneObject(g),w=Number.MAX_VALUE;return b.forEach(function(C,T){if(!(!S&&T===b.length-1)){var A=b[(T+1)%b.length],k=e.Util._getProjectionToSegment(C.x,C.y,A.x,A.y,g.x,g.y),D=k[0],M=k[1],E=k[2];Eb.length){var T=b;b=g,g=T}for(x=0;x{b.width=0,b.height=0})},drawRoundedRectPath(g,b,S,x){let w=0,C=0,T=0,A=0;typeof x=="number"?w=C=T=A=Math.min(x,b/2,S/2):(w=Math.min(x[0]||0,b/2,S/2),C=Math.min(x[1]||0,b/2,S/2),A=Math.min(x[2]||0,b/2,S/2),T=Math.min(x[3]||0,b/2,S/2)),g.moveTo(w,0),g.lineTo(b-C,0),g.arc(b-C,C,C,Math.PI*3/2,0,!1),g.lineTo(b,S-A),g.arc(b-A,S-A,A,0,Math.PI/2,!1),g.lineTo(T,S),g.arc(T,S-T,T,Math.PI/2,Math.PI,!1),g.lineTo(0,w),g.arc(w,w,w,Math.PI,Math.PI*3/2,!1)}}})(tn);var Wt={},ze={},Ce={};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.getComponentValidator=Ce.getBooleanValidator=Ce.getNumberArrayValidator=Ce.getFunctionValidator=Ce.getStringOrGradientValidator=Ce.getStringValidator=Ce.getNumberOrAutoValidator=Ce.getNumberOrArrayOfNumbersValidator=Ce.getNumberValidator=Ce.alphaComponent=Ce.RGBComponent=void 0;const ws=Ue,cn=tn;function Cs(e){return cn.Util._isString(e)?'"'+e+'"':Object.prototype.toString.call(e)==="[object Number]"||cn.Util._isBoolean(e)?e:Object.prototype.toString.call(e)}function y1e(e){return e>255?255:e<0?0:Math.round(e)}Ce.RGBComponent=y1e;function v1e(e){return e>1?1:e<1e-4?1e-4:e}Ce.alphaComponent=v1e;function b1e(){if(ws.Konva.isUnminified)return function(e,t){return cn.Util._isNumber(e)||cn.Util.warn(Cs(e)+' is a not valid value for "'+t+'" attribute. The value should be a number.'),e}}Ce.getNumberValidator=b1e;function _1e(e){if(ws.Konva.isUnminified)return function(t,n){let r=cn.Util._isNumber(t),i=cn.Util._isArray(t)&&t.length==e;return!r&&!i&&cn.Util.warn(Cs(t)+' is a not valid value for "'+n+'" attribute. The value should be a number or Array('+e+")"),t}}Ce.getNumberOrArrayOfNumbersValidator=_1e;function S1e(){if(ws.Konva.isUnminified)return function(e,t){var n=cn.Util._isNumber(e),r=e==="auto";return n||r||cn.Util.warn(Cs(e)+' is a not valid value for "'+t+'" attribute. The value should be a number or "auto".'),e}}Ce.getNumberOrAutoValidator=S1e;function x1e(){if(ws.Konva.isUnminified)return function(e,t){return cn.Util._isString(e)||cn.Util.warn(Cs(e)+' is a not valid value for "'+t+'" attribute. The value should be a string.'),e}}Ce.getStringValidator=x1e;function w1e(){if(ws.Konva.isUnminified)return function(e,t){const n=cn.Util._isString(e),r=Object.prototype.toString.call(e)==="[object CanvasGradient]"||e&&e.addColorStop;return n||r||cn.Util.warn(Cs(e)+' is a not valid value for "'+t+'" attribute. The value should be a string or a native gradient.'),e}}Ce.getStringOrGradientValidator=w1e;function C1e(){if(ws.Konva.isUnminified)return function(e,t){return cn.Util._isFunction(e)||cn.Util.warn(Cs(e)+' is a not valid value for "'+t+'" attribute. The value should be a function.'),e}}Ce.getFunctionValidator=C1e;function E1e(){if(ws.Konva.isUnminified)return function(e,t){const n=Int8Array?Object.getPrototypeOf(Int8Array):null;return n&&e instanceof n||(cn.Util._isArray(e)?e.forEach(function(r){cn.Util._isNumber(r)||cn.Util.warn('"'+t+'" attribute has non numeric element '+r+". Make sure that all elements are numbers.")}):cn.Util.warn(Cs(e)+' is a not valid value for "'+t+'" attribute. The value should be a array of numbers.')),e}}Ce.getNumberArrayValidator=E1e;function A1e(){if(ws.Konva.isUnminified)return function(e,t){var n=e===!0||e===!1;return n||cn.Util.warn(Cs(e)+' is a not valid value for "'+t+'" attribute. The value should be a boolean.'),e}}Ce.getBooleanValidator=A1e;function T1e(e){if(ws.Konva.isUnminified)return function(t,n){return t==null||cn.Util.isObject(t)||cn.Util.warn(Cs(t)+' is a not valid value for "'+n+'" attribute. The value should be an object with properties '+e),t}}Ce.getComponentValidator=T1e;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Factory=void 0;const t=tn,n=Ce;var r="get",i="set";e.Factory={addGetterSetter(o,a,s,l,u){e.Factory.addGetter(o,a,s),e.Factory.addSetter(o,a,l,u),e.Factory.addOverloadedGetterSetter(o,a)},addGetter(o,a,s){var l=r+t.Util._capitalize(a);o.prototype[l]=o.prototype[l]||function(){var u=this.attrs[a];return u===void 0?s:u}},addSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]||e.Factory.overWriteSetter(o,a,s,l)},overWriteSetter(o,a,s,l){var u=i+t.Util._capitalize(a);o.prototype[u]=function(c){return s&&c!==void 0&&c!==null&&(c=s.call(this,c,a)),this._setAttr(a,c),l&&l.call(this),this}},addComponentsGetterSetter(o,a,s,l,u){var c=s.length,d=t.Util._capitalize,f=r+d(a),h=i+d(a),p,m;o.prototype[f]=function(){var v={};for(p=0;p{this._setAttr(a+d(b),void 0)}),this._fireChangeEvent(a,y,v),u&&u.call(this),this},e.Factory.addOverloadedGetterSetter(o,a)},addOverloadedGetterSetter(o,a){var s=t.Util._capitalize(a),l=i+s,u=r+s;o.prototype[a]=function(){return arguments.length?(this[l](arguments[0]),this):this[u]()}},addDeprecatedGetterSetter(o,a,s,l){t.Util.error("Adding deprecated "+a);var u=r+t.Util._capitalize(a),c=a+" property is deprecated and will be removed soon. Look at Konva change log for more information.";o.prototype[u]=function(){t.Util.error(c);var d=this.attrs[a];return d===void 0?s:d},e.Factory.addSetter(o,a,l,function(){t.Util.error(c)}),e.Factory.addOverloadedGetterSetter(o,a)},backCompat(o,a){t.Util.each(a,function(s,l){var u=o.prototype[l],c=r+t.Util._capitalize(s),d=i+t.Util._capitalize(s);function f(){u.apply(this,arguments),t.Util.error('"'+s+'" method is deprecated and will be removed soon. Use ""'+l+'" instead.')}o.prototype[s]=f,o.prototype[c]=f,o.prototype[d]=f})},afterSetFilter(){this._filterUpToDate=!1}}})(ze);var Ro={},rs={};Object.defineProperty(rs,"__esModule",{value:!0});rs.HitContext=rs.SceneContext=rs.Context=void 0;const Fz=tn,P1e=Ue;function k1e(e){var t=[],n=e.length,r=Fz.Util,i,o;for(i=0;itypeof c=="number"?Math.floor(c):c)),o+=I1e+u.join(hI)+M1e)):(o+=s.property,t||(o+=D1e+s.val)),o+=$1e;return o}clearTrace(){this.traceArr=[]}_trace(t){var n=this.traceArr,r;n.push(t),r=n.length,r>=F1e&&n.shift()}reset(){var t=this.getCanvas().getPixelRatio();this.setTransform(1*t,0,0,1*t,0,0)}getCanvas(){return this.canvas}clear(t){var n=this.getCanvas();t?this.clearRect(t.x||0,t.y||0,t.width||0,t.height||0):this.clearRect(0,0,n.getWidth()/n.pixelRatio,n.getHeight()/n.pixelRatio)}_applyLineCap(t){const n=t.attrs.lineCap;n&&this.setAttr("lineCap",n)}_applyOpacity(t){var n=t.getAbsoluteOpacity();n!==1&&this.setAttr("globalAlpha",n)}_applyLineJoin(t){const n=t.attrs.lineJoin;n&&this.setAttr("lineJoin",n)}setAttr(t,n){this._context[t]=n}arc(t,n,r,i,o,a){this._context.arc(t,n,r,i,o,a)}arcTo(t,n,r,i,o){this._context.arcTo(t,n,r,i,o)}beginPath(){this._context.beginPath()}bezierCurveTo(t,n,r,i,o,a){this._context.bezierCurveTo(t,n,r,i,o,a)}clearRect(t,n,r,i){this._context.clearRect(t,n,r,i)}clip(...t){this._context.clip.apply(this._context,t)}closePath(){this._context.closePath()}createImageData(t,n){var r=arguments;if(r.length===2)return this._context.createImageData(t,n);if(r.length===1)return this._context.createImageData(t)}createLinearGradient(t,n,r,i){return this._context.createLinearGradient(t,n,r,i)}createPattern(t,n){return this._context.createPattern(t,n)}createRadialGradient(t,n,r,i,o,a){return this._context.createRadialGradient(t,n,r,i,o,a)}drawImage(t,n,r,i,o,a,s,l,u){var c=arguments,d=this._context;c.length===3?d.drawImage(t,n,r):c.length===5?d.drawImage(t,n,r,i,o):c.length===9&&d.drawImage(t,n,r,i,o,a,s,l,u)}ellipse(t,n,r,i,o,a,s,l){this._context.ellipse(t,n,r,i,o,a,s,l)}isPointInPath(t,n,r,i){return r?this._context.isPointInPath(r,t,n,i):this._context.isPointInPath(t,n,i)}fill(...t){this._context.fill.apply(this._context,t)}fillRect(t,n,r,i){this._context.fillRect(t,n,r,i)}strokeRect(t,n,r,i){this._context.strokeRect(t,n,r,i)}fillText(t,n,r,i){i?this._context.fillText(t,n,r,i):this._context.fillText(t,n,r)}measureText(t){return this._context.measureText(t)}getImageData(t,n,r,i){return this._context.getImageData(t,n,r,i)}lineTo(t,n){this._context.lineTo(t,n)}moveTo(t,n){this._context.moveTo(t,n)}rect(t,n,r,i){this._context.rect(t,n,r,i)}putImageData(t,n,r){this._context.putImageData(t,n,r)}quadraticCurveTo(t,n,r,i){this._context.quadraticCurveTo(t,n,r,i)}restore(){this._context.restore()}rotate(t){this._context.rotate(t)}save(){this._context.save()}scale(t,n){this._context.scale(t,n)}setLineDash(t){this._context.setLineDash?this._context.setLineDash(t):"mozDash"in this._context?this._context.mozDash=t:"webkitLineDash"in this._context&&(this._context.webkitLineDash=t)}getLineDash(){return this._context.getLineDash()}setTransform(t,n,r,i,o,a){this._context.setTransform(t,n,r,i,o,a)}stroke(t){t?this._context.stroke(t):this._context.stroke()}strokeText(t,n,r,i){this._context.strokeText(t,n,r,i)}transform(t,n,r,i,o,a){this._context.transform(t,n,r,i,o,a)}translate(t,n){this._context.translate(t,n)}_enableTrace(){var t=this,n=pI.length,r=this.setAttr,i,o,a=function(s){var l=t[s],u;t[s]=function(){return o=k1e(Array.prototype.slice.call(arguments,0)),u=l.apply(t,arguments),t._trace({method:s,args:o}),u}};for(i=0;i{i.dragStatus==="dragging"&&(r=!0)}),r},justDragged:!1,get node(){var r;return e.DD._dragElements.forEach(i=>{r=i.node}),r},_dragElements:new Map,_drag(r){const i=[];e.DD._dragElements.forEach((o,a)=>{const{node:s}=o,l=s.getStage();l.setPointersPositions(r),o.pointerId===void 0&&(o.pointerId=n.Util._getFirstPointerId(r));const u=l._changedPointerPositions.find(f=>f.id===o.pointerId);if(u){if(o.dragStatus!=="dragging"){var c=s.dragDistance(),d=Math.max(Math.abs(u.x-o.startPointerPos.x),Math.abs(u.y-o.startPointerPos.y));if(d{o.fire("dragmove",{type:"dragmove",target:o,evt:r},!0)})},_endDragBefore(r){const i=[];e.DD._dragElements.forEach(o=>{const{node:a}=o,s=a.getStage();if(r&&s.setPointersPositions(r),!s._changedPointerPositions.find(c=>c.id===o.pointerId))return;(o.dragStatus==="dragging"||o.dragStatus==="stopped")&&(e.DD.justDragged=!0,t.Konva._mouseListenClick=!1,t.Konva._touchListenClick=!1,t.Konva._pointerListenClick=!1,o.dragStatus="stopped");const u=o.node.getLayer()||o.node instanceof t.Konva.Stage&&o.node;u&&i.indexOf(u)===-1&&i.push(u)}),i.forEach(o=>{o.draw()})},_endDragAfter(r){e.DD._dragElements.forEach((i,o)=>{i.dragStatus==="stopped"&&i.node.fire("dragend",{type:"dragend",target:i.node,evt:r},!0),i.dragStatus!=="dragging"&&e.DD._dragElements.delete(o)})}},t.Konva.isBrowser&&(window.addEventListener("mouseup",e.DD._endDragBefore,!0),window.addEventListener("touchend",e.DD._endDragBefore,!0),window.addEventListener("mousemove",e.DD._drag),window.addEventListener("touchmove",e.DD._drag),window.addEventListener("mouseup",e.DD._endDragAfter,!1),window.addEventListener("touchend",e.DD._endDragAfter,!1))})(rS);Object.defineProperty(Wt,"__esModule",{value:!0});Wt.Node=void 0;const He=tn,Em=ze,j0=Ro,ou=Ue,Ri=rS,mn=Ce;var Hy="absoluteOpacity",V0="allEventListeners",za="absoluteTransform",gI="absoluteScale",au="canvas",q1e="Change",W1e="children",K1e="konva",z5="listening",mI="mouseenter",yI="mouseleave",vI="set",bI="Shape",qy=" ",_I="stage",zs="transform",X1e="Stage",j5="visible",Q1e=["xChange.konva","yChange.konva","scaleXChange.konva","scaleYChange.konva","skewXChange.konva","skewYChange.konva","rotationChange.konva","offsetXChange.konva","offsetYChange.konva","transformsEnabledChange.konva"].join(qy);let Y1e=1;class Oe{constructor(t){this._id=Y1e++,this.eventListeners={},this.attrs={},this.index=0,this._allEventListeners=null,this.parent=null,this._cache=new Map,this._attachedDepsListeners=new Map,this._lastPos=null,this._batchingTransformChange=!1,this._needClearTransformCache=!1,this._filterUpToDate=!1,this._isUnderCache=!1,this._dragEventId=null,this._shouldFireChangeEvents=!1,this.setAttrs(t),this._shouldFireChangeEvents=!0}hasChildren(){return!1}_clearCache(t){(t===zs||t===za)&&this._cache.get(t)?this._cache.get(t).dirty=!0:t?this._cache.delete(t):this._cache.clear()}_getCache(t,n){var r=this._cache.get(t),i=t===zs||t===za,o=r===void 0||i&&r.dirty===!0;return o&&(r=n.call(this),this._cache.set(t,r)),r}_calculate(t,n,r){if(!this._attachedDepsListeners.get(t)){const i=n.map(o=>o+"Change.konva").join(qy);this.on(i,()=>{this._clearCache(t)}),this._attachedDepsListeners.set(t,!0)}return this._getCache(t,r)}_getCanvasCache(){return this._cache.get(au)}_clearSelfAndDescendantCache(t){this._clearCache(t),t===za&&this.fire("absoluteTransformChange")}clearCache(){if(this._cache.has(au)){const{scene:t,filter:n,hit:r}=this._cache.get(au);He.Util.releaseCanvas(t,n,r),this._cache.delete(au)}return this._clearSelfAndDescendantCache(),this._requestDraw(),this}cache(t){var n=t||{},r={};(n.x===void 0||n.y===void 0||n.width===void 0||n.height===void 0)&&(r=this.getClientRect({skipTransform:!0,relativeTo:this.getParent()}));var i=Math.ceil(n.width||r.width),o=Math.ceil(n.height||r.height),a=n.pixelRatio,s=n.x===void 0?Math.floor(r.x):n.x,l=n.y===void 0?Math.floor(r.y):n.y,u=n.offset||0,c=n.drawBorder||!1,d=n.hitCanvasPixelRatio||1;if(!i||!o){He.Util.error("Can not cache the node. Width or height of the node equals 0. Caching is skipped.");return}i+=u*2+1,o+=u*2+1,s-=u,l-=u;var f=new j0.SceneCanvas({pixelRatio:a,width:i,height:o}),h=new j0.SceneCanvas({pixelRatio:a,width:0,height:0,willReadFrequently:!0}),p=new j0.HitCanvas({pixelRatio:d,width:i,height:o}),m=f.getContext(),_=p.getContext();return p.isCache=!0,f.isCache=!0,this._cache.delete(au),this._filterUpToDate=!1,n.imageSmoothingEnabled===!1&&(f.getContext()._context.imageSmoothingEnabled=!1,h.getContext()._context.imageSmoothingEnabled=!1),m.save(),_.save(),m.translate(-s,-l),_.translate(-s,-l),this._isUnderCache=!0,this._clearSelfAndDescendantCache(Hy),this._clearSelfAndDescendantCache(gI),this.drawScene(f,this),this.drawHit(p,this),this._isUnderCache=!1,m.restore(),_.restore(),c&&(m.save(),m.beginPath(),m.rect(0,0,i,o),m.closePath(),m.setAttr("strokeStyle","red"),m.setAttr("lineWidth",5),m.stroke(),m.restore()),this._cache.set(au,{scene:f,filter:h,hit:p,x:s,y:l}),this._requestDraw(),this}isCached(){return this._cache.has(au)}getClientRect(t){throw new Error('abstract "getClientRect" method call')}_transformedRect(t,n){var r=[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height}],i,o,a,s,l=this.getAbsoluteTransform(n);return r.forEach(function(u){var c=l.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),{x:i,y:o,width:a-i,height:s-o}}_drawCachedSceneCanvas(t){t.save(),t._applyOpacity(this),t._applyGlobalCompositeOperation(this);const n=this._getCanvasCache();t.translate(n.x,n.y);var r=this._getCachedSceneCanvas(),i=r.pixelRatio;t.drawImage(r._canvas,0,0,r.width/i,r.height/i),t.restore()}_drawCachedHitCanvas(t){var n=this._getCanvasCache(),r=n.hit;t.save(),t.translate(n.x,n.y),t.drawImage(r._canvas,0,0,r.width/r.pixelRatio,r.height/r.pixelRatio),t.restore()}_getCachedSceneCanvas(){var t=this.filters(),n=this._getCanvasCache(),r=n.scene,i=n.filter,o=i.getContext(),a,s,l,u;if(t){if(!this._filterUpToDate){var c=r.pixelRatio;i.setSize(r.width/r.pixelRatio,r.height/r.pixelRatio);try{for(a=t.length,o.clear(),o.drawImage(r._canvas,0,0,r.getWidth()/c,r.getHeight()/c),s=o.getImageData(0,0,i.getWidth(),i.getHeight()),l=0;l{var n,r;if(!t)return this;for(n in t)n!==W1e&&(r=vI+He.Util._capitalize(n),He.Util._isFunction(this[r])?this[r](t[n]):this._setAttr(n,t[n]))}),this}isListening(){return this._getCache(z5,this._isListening)}_isListening(t){if(!this.listening())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isListening(t):!0}isVisible(){return this._getCache(j5,this._isVisible)}_isVisible(t){if(!this.visible())return!1;const r=this.getParent();return r&&r!==t&&this!==t?r._isVisible(t):!0}shouldDrawHit(t,n=!1){if(t)return this._isVisible(t)&&this._isListening(t);var r=this.getLayer(),i=!1;Ri.DD._dragElements.forEach(a=>{a.dragStatus==="dragging"&&(a.node.nodeType==="Stage"||a.node.getLayer()===r)&&(i=!0)});var o=!n&&!ou.Konva.hitOnDragEnabled&&i;return this.isListening()&&this.isVisible()&&!o}show(){return this.visible(!0),this}hide(){return this.visible(!1),this}getZIndex(){return this.index||0}getAbsoluteZIndex(){var t=this.getDepth(),n=this,r=0,i,o,a,s;function l(u){for(i=[],o=u.length,a=0;a0&&i[0].getDepth()<=t&&l(i)}return n.nodeType!==X1e&&l(n.getStage().getChildren()),r}getDepth(){for(var t=0,n=this.parent;n;)t++,n=n.parent;return t}_batchTransformChanges(t){this._batchingTransformChange=!0,t(),this._batchingTransformChange=!1,this._needClearTransformCache&&(this._clearCache(zs),this._clearSelfAndDescendantCache(za)),this._needClearTransformCache=!1}setPosition(t){return this._batchTransformChanges(()=>{this.x(t.x),this.y(t.y)}),this}getPosition(){return{x:this.x(),y:this.y()}}getRelativePointerPosition(){if(!this.getStage())return null;var t=this.getStage().getPointerPosition();if(!t)return null;var n=this.getAbsoluteTransform().copy();return n.invert(),n.point(t)}getAbsolutePosition(t){let n=!1,r=this.parent;for(;r;){if(r.isCached()){n=!0;break}r=r.parent}n&&!t&&(t=!0);var i=this.getAbsoluteTransform(t).getMatrix(),o=new He.Transform,a=this.offset();return o.m=i.slice(),o.translate(a.x,a.y),o.getTranslation()}setAbsolutePosition(t){var n=this._clearTransform();this.attrs.x=n.x,this.attrs.y=n.y,delete n.x,delete n.y,this._clearCache(zs);var r=this._getAbsoluteTransform().copy();return r.invert(),r.translate(t.x,t.y),t={x:this.attrs.x+r.getTranslation().x,y:this.attrs.y+r.getTranslation().y},this._setTransform(n),this.setPosition({x:t.x,y:t.y}),this._clearCache(zs),this._clearSelfAndDescendantCache(za),this}_setTransform(t){var n;for(n in t)this.attrs[n]=t[n]}_clearTransform(){var t={x:this.x(),y:this.y(),rotation:this.rotation(),scaleX:this.scaleX(),scaleY:this.scaleY(),offsetX:this.offsetX(),offsetY:this.offsetY(),skewX:this.skewX(),skewY:this.skewY()};return this.attrs.x=0,this.attrs.y=0,this.attrs.rotation=0,this.attrs.scaleX=1,this.attrs.scaleY=1,this.attrs.offsetX=0,this.attrs.offsetY=0,this.attrs.skewX=0,this.attrs.skewY=0,t}move(t){var n=t.x,r=t.y,i=this.x(),o=this.y();return n!==void 0&&(i+=n),r!==void 0&&(o+=r),this.setPosition({x:i,y:o}),this}_eachAncestorReverse(t,n){var r=[],i=this.getParent(),o,a;if(!(n&&n._id===this._id)){for(r.unshift(this);i&&(!n||i._id!==n._id);)r.unshift(i),i=i.parent;for(o=r.length,a=0;a0?(this.parent.children.splice(t,1),this.parent.children.splice(t-1,0,this),this.parent._setChildrenIndices(),!0):!1}moveToBottom(){if(!this.parent)return He.Util.warn("Node has no parent. moveToBottom function is ignored."),!1;var t=this.index;return t>0?(this.parent.children.splice(t,1),this.parent.children.unshift(this),this.parent._setChildrenIndices(),!0):!1}setZIndex(t){if(!this.parent)return He.Util.warn("Node has no parent. zIndex parameter is ignored."),this;(t<0||t>=this.parent.children.length)&&He.Util.warn("Unexpected value "+t+" for zIndex property. zIndex is just index of a node in children of its parent. Expected value is from 0 to "+(this.parent.children.length-1)+".");var n=this.index;return this.parent.children.splice(n,1),this.parent.children.splice(t,0,this),this.parent._setChildrenIndices(),this}getAbsoluteOpacity(){return this._getCache(Hy,this._getAbsoluteOpacity)}_getAbsoluteOpacity(){var t=this.opacity(),n=this.getParent();return n&&!n._isUnderCache&&(t*=n.getAbsoluteOpacity()),t}moveTo(t){return this.getParent()!==t&&(this._remove(),t.add(this)),this}toObject(){var t={},n=this.getAttrs(),r,i,o,a,s;t.attrs={};for(r in n)i=n[r],s=He.Util.isObject(i)&&!He.Util._isPlainObject(i)&&!He.Util._isArray(i),!s&&(o=typeof this[r]=="function"&&this[r],delete n[r],a=o?o.call(this):null,n[r]=i,a!==i&&(t.attrs[r]=i));return t.className=this.getClassName(),He.Util._prepareToStringify(t)}toJSON(){return JSON.stringify(this.toObject())}getParent(){return this.parent}findAncestors(t,n,r){var i=[];n&&this._isMatch(t)&&i.push(this);for(var o=this.parent;o;){if(o===r)return i;o._isMatch(t)&&i.push(o),o=o.parent}return i}isAncestorOf(t){return!1}findAncestor(t,n,r){return this.findAncestors(t,n,r)[0]}_isMatch(t){if(!t)return!1;if(typeof t=="function")return t(this);var n=t.replace(/ /g,"").split(","),r=n.length,i,o;for(i=0;i{try{const i=t==null?void 0:t.callback;i&&delete t.callback,He.Util._urlToImage(this.toDataURL(t),function(o){n(o),i==null||i(o)})}catch(i){r(i)}})}toBlob(t){return new Promise((n,r)=>{try{const i=t==null?void 0:t.callback;i&&delete t.callback,this.toCanvas(t).toBlob(o=>{n(o),i==null||i(o)})}catch(i){r(i)}})}setSize(t){return this.width(t.width),this.height(t.height),this}getSize(){return{width:this.width(),height:this.height()}}getClassName(){return this.className||this.nodeType}getType(){return this.nodeType}getDragDistance(){return this.attrs.dragDistance!==void 0?this.attrs.dragDistance:this.parent?this.parent.getDragDistance():ou.Konva.dragDistance}_off(t,n,r){var i=this.eventListeners[t],o,a,s;for(o=0;o=0;if(r&&!this.isDragging()){var i=!1;Ri.DD._dragElements.forEach(o=>{this.isAncestorOf(o.node)&&(i=!0)}),i||this._createDragElement(t)}})}_dragChange(){if(this.attrs.draggable)this._listenDrag();else{this._dragCleanup();var t=this.getStage();if(!t)return;const n=Ri.DD._dragElements.get(this._id),r=n&&n.dragStatus==="dragging",i=n&&n.dragStatus==="ready";r?this.stopDrag():i&&Ri.DD._dragElements.delete(this._id)}}_dragCleanup(){this.off("mousedown.konva"),this.off("touchstart.konva")}isClientRectOnScreen(t={x:0,y:0}){const n=this.getStage();if(!n)return!1;const r={x:-t.x,y:-t.y,width:n.width()+2*t.x,height:n.height()+2*t.y};return He.Util.haveIntersection(r,this.getClientRect())}static create(t,n){return He.Util._isString(t)&&(t=JSON.parse(t)),this._createNode(t,n)}static _createNode(t,n){var r=Oe.prototype.getClassName.call(t),i=t.children,o,a,s;n&&(t.attrs.container=n),ou.Konva[r]||(He.Util.warn('Can not find a node with class name "'+r+'". Fallback to "Shape".'),r="Shape");const l=ou.Konva[r];if(o=new l(t.attrs),i)for(a=i.length,s=0;s0}removeChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.remove()}),this.children=[],this._requestDraw(),this}destroyChildren(){return this.getChildren().forEach(t=>{t.parent=null,t.index=0,t.destroy()}),this.children=[],this._requestDraw(),this}add(...t){if(t.length===0)return this;if(t.length>1){for(var n=0;n0?n[0]:void 0}_generalFind(t,n){var r=[];return this._descendants(i=>{const o=i._isMatch(t);return o&&r.push(i),!!(o&&n)}),r}_descendants(t){let n=!1;const r=this.getChildren();for(const i of r){if(n=t(i),n)return!0;if(i.hasChildren()&&(n=i._descendants(t),n))return!0}return!1}toObject(){var t=Xx.Node.prototype.toObject.call(this);return t.children=[],this.getChildren().forEach(n=>{t.children.push(n.toObject())}),t}isAncestorOf(t){for(var n=t.getParent();n;){if(n._id===this._id)return!0;n=n.getParent()}return!1}clone(t){var n=Xx.Node.prototype.clone.call(this,t);return this.getChildren().forEach(function(r){n.add(r.clone())}),n}getAllIntersections(t){var n=[];return this.find("Shape").forEach(function(r){r.isVisible()&&r.intersects(t)&&n.push(r)}),n}_clearSelfAndDescendantCache(t){var n;super._clearSelfAndDescendantCache(t),!this.isCached()&&((n=this.children)===null||n===void 0||n.forEach(function(r){r._clearSelfAndDescendantCache(t)}))}_setChildrenIndices(){var t;(t=this.children)===null||t===void 0||t.forEach(function(n,r){n.index=r}),this._requestDraw()}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas(),o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.scene,l=i&&i.isCache;if(!this.isVisible()&&!l)return this;if(s){o.save();var u=this.getAbsoluteTransform(n).getMatrix();o.transform(u[0],u[1],u[2],u[3],u[4],u[5]),this._drawCachedSceneCanvas(o),o.restore()}else this._drawChildren("drawScene",i,n);return this}drawHit(t,n){if(!this.shouldDrawHit(n))return this;var r=this.getLayer(),i=t||r&&r.hitCanvas,o=i&&i.getContext(),a=this._getCanvasCache(),s=a&&a.hit;if(s){o.save();var l=this.getAbsoluteTransform(n).getMatrix();o.transform(l[0],l[1],l[2],l[3],l[4],l[5]),this._drawCachedHitCanvas(o),o.restore()}else this._drawChildren("drawHit",i,n);return this}_drawChildren(t,n,r){var i,o=n&&n.getContext(),a=this.clipWidth(),s=this.clipHeight(),l=this.clipFunc(),u=a&&s||l;const c=r===this;if(u){o.save();var d=this.getAbsoluteTransform(r),f=d.getMatrix();o.transform(f[0],f[1],f[2],f[3],f[4],f[5]),o.beginPath();let _;if(l)_=l.call(this,o,this);else{var h=this.clipX(),p=this.clipY();o.rect(h,p,a,s)}o.clip.apply(o,_),f=d.copy().invert().getMatrix(),o.transform(f[0],f[1],f[2],f[3],f[4],f[5])}var m=!c&&this.globalCompositeOperation()!=="source-over"&&t==="drawScene";m&&(o.save(),o._applyGlobalCompositeOperation(this)),(i=this.children)===null||i===void 0||i.forEach(function(_){_[t](n,r)}),m&&o.restore(),u&&o.restore()}getClientRect(t){var n;t=t||{};var r=t.skipTransform,i=t.relativeTo,o,a,s,l,u={x:1/0,y:1/0,width:0,height:0},c=this;(n=this.children)===null||n===void 0||n.forEach(function(m){if(m.visible()){var _=m.getClientRect({relativeTo:c,skipShadow:t.skipShadow,skipStroke:t.skipStroke});_.width===0&&_.height===0||(o===void 0?(o=_.x,a=_.y,s=_.x+_.width,l=_.y+_.height):(o=Math.min(o,_.x),a=Math.min(a,_.y),s=Math.max(s,_.x+_.width),l=Math.max(l,_.y+_.height)))}});for(var d=this.find("Shape"),f=!1,h=0;hJ.indexOf("pointer")>=0?"pointer":J.indexOf("touch")>=0?"touch":"mouse",V=J=>{const j=z(J);if(j==="pointer")return i.Konva.pointerEventsEnabled&&$.pointer;if(j==="touch")return $.touch;if(j==="mouse")return $.mouse};function H(J={}){return(J.clipFunc||J.clipWidth||J.clipHeight)&&t.Util.warn("Stage does not support clipping. Please use clip for Layers or Groups."),J}const Q="Pointer position is missing and not registered by the stage. Looks like it is outside of the stage container. You can set it manually from event: stage.setPointersPositions(event);";e.stages=[];class Z extends r.Container{constructor(j){super(H(j)),this._pointerPositions=[],this._changedPointerPositions=[],this._buildDOM(),this._bindContentEvents(),e.stages.push(this),this.on("widthChange.konva heightChange.konva",this._resizeDOM),this.on("visibleChange.konva",this._checkVisibility),this.on("clipWidthChange.konva clipHeightChange.konva clipFuncChange.konva",()=>{H(this.attrs)}),this._checkVisibility()}_validateAdd(j){const X=j.getType()==="Layer",ee=j.getType()==="FastLayer";X||ee||t.Util.throw("You may only add layers to the stage.")}_checkVisibility(){if(!this.content)return;const j=this.visible()?"":"none";this.content.style.display=j}setContainer(j){if(typeof j===c){if(j.charAt(0)==="."){var X=j.slice(1);j=document.getElementsByClassName(X)[0]}else{var ee;j.charAt(0)!=="#"?ee=j:ee=j.slice(1),j=document.getElementById(ee)}if(!j)throw"Can not find container in document with id "+ee}return this._setAttr("container",j),this.content&&(this.content.parentElement&&this.content.parentElement.removeChild(this.content),j.appendChild(this.content)),this}shouldDrawHit(){return!0}clear(){var j=this.children,X=j.length,ee;for(ee=0;ee-1&&e.stages.splice(X,1),t.Util.releaseCanvas(this.bufferCanvas._canvas,this.bufferHitCanvas._canvas),this}getPointerPosition(){const j=this._pointerPositions[0]||this._changedPointerPositions[0];return j?{x:j.x,y:j.y}:(t.Util.warn(Q),null)}_getPointerById(j){return this._pointerPositions.find(X=>X.id===j)}getPointersPositions(){return this._pointerPositions}getStage(){return this}getContent(){return this.content}_toKonvaCanvas(j){j=j||{},j.x=j.x||0,j.y=j.y||0,j.width=j.width||this.width(),j.height=j.height||this.height();var X=new o.SceneCanvas({width:j.width,height:j.height,pixelRatio:j.pixelRatio||1}),ee=X.getContext()._context,ne=this.children;return(j.x||j.y)&&ee.translate(-1*j.x,-1*j.y),ne.forEach(function(fe){if(fe.isVisible()){var ce=fe._toKonvaCanvas(j);ee.drawImage(ce._canvas,j.x,j.y,ce.getWidth()/ce.getPixelRatio(),ce.getHeight()/ce.getPixelRatio())}}),X}getIntersection(j){if(!j)return null;var X=this.children,ee=X.length,ne=ee-1,fe;for(fe=ne;fe>=0;fe--){const ce=X[fe].getIntersection(j);if(ce)return ce}return null}_resizeDOM(){var j=this.width(),X=this.height();this.content&&(this.content.style.width=j+d,this.content.style.height=X+d),this.bufferCanvas.setSize(j,X),this.bufferHitCanvas.setSize(j,X),this.children.forEach(ee=>{ee.setSize({width:j,height:X}),ee.draw()})}add(j,...X){if(arguments.length>1){for(var ee=0;eeO&&t.Util.warn("The stage has "+ne+" layers. Recommended maximum number of layers is 3-5. Adding more layers into the stage may drop the performance. Rethink your tree structure, you can use Konva.Group."),j.setSize({width:this.width(),height:this.height()}),j.draw(),i.Konva.isBrowser&&this.content.appendChild(j.canvas._canvas),this}getParent(){return null}getLayer(){return null}hasPointerCapture(j){return l.hasPointerCapture(j,this)}setPointerCapture(j){l.setPointerCapture(j,this)}releaseCapture(j){l.releaseCapture(j,this)}getLayers(){return this.children}_bindContentEvents(){i.Konva.isBrowser&&R.forEach(([j,X])=>{this.content.addEventListener(j,ee=>{this[X](ee)},{passive:!1})})}_pointerenter(j){this.setPointersPositions(j);const X=V(j.type);this._fire(X.pointerenter,{evt:j,target:this,currentTarget:this})}_pointerover(j){this.setPointersPositions(j);const X=V(j.type);this._fire(X.pointerover,{evt:j,target:this,currentTarget:this})}_getTargetShape(j){let X=this[j+"targetShape"];return X&&!X.getStage()&&(X=null),X}_pointerleave(j){const X=V(j.type),ee=z(j.type);if(X){this.setPointersPositions(j);var ne=this._getTargetShape(ee),fe=!a.DD.isDragging||i.Konva.hitOnDragEnabled;ne&&fe?(ne._fireAndBubble(X.pointerout,{evt:j}),ne._fireAndBubble(X.pointerleave,{evt:j}),this._fire(X.pointerleave,{evt:j,target:this,currentTarget:this}),this[ee+"targetShape"]=null):fe&&(this._fire(X.pointerleave,{evt:j,target:this,currentTarget:this}),this._fire(X.pointerout,{evt:j,target:this,currentTarget:this})),this.pointerPos=void 0,this._pointerPositions=[]}}_pointerdown(j){const X=V(j.type),ee=z(j.type);if(X){this.setPointersPositions(j);var ne=!1;this._changedPointerPositions.forEach(fe=>{var ce=this.getIntersection(fe);if(a.DD.justDragged=!1,i.Konva["_"+ee+"ListenClick"]=!0,!(ce&&ce.isListening()))return;i.Konva.capturePointerEventsEnabled&&ce.setPointerCapture(fe.id),this[ee+"ClickStartShape"]=ce,ce._fireAndBubble(X.pointerdown,{evt:j,pointerId:fe.id}),ne=!0;const $e=j.type.indexOf("touch")>=0;ce.preventDefault()&&j.cancelable&&$e&&j.preventDefault()}),ne||this._fire(X.pointerdown,{evt:j,target:this,currentTarget:this,pointerId:this._pointerPositions[0].id})}}_pointermove(j){const X=V(j.type),ee=z(j.type);if(!X)return;a.DD.isDragging&&a.DD.node.preventDefault()&&j.cancelable&&j.preventDefault(),this.setPointersPositions(j);var ne=!a.DD.isDragging||i.Konva.hitOnDragEnabled;if(!ne)return;var fe={};let ce=!1;var Be=this._getTargetShape(ee);this._changedPointerPositions.forEach($e=>{const we=l.getCapturedShape($e.id)||this.getIntersection($e),Ke=$e.id,be={evt:j,pointerId:Ke};var zt=Be!==we;if(zt&&Be&&(Be._fireAndBubble(X.pointerout,Object.assign({},be),we),Be._fireAndBubble(X.pointerleave,Object.assign({},be),we)),we){if(fe[we._id])return;fe[we._id]=!0}we&&we.isListening()?(ce=!0,zt&&(we._fireAndBubble(X.pointerover,Object.assign({},be),Be),we._fireAndBubble(X.pointerenter,Object.assign({},be),Be),this[ee+"targetShape"]=we),we._fireAndBubble(X.pointermove,Object.assign({},be))):Be&&(this._fire(X.pointerover,{evt:j,target:this,currentTarget:this,pointerId:Ke}),this[ee+"targetShape"]=null)}),ce||this._fire(X.pointermove,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id})}_pointerup(j){const X=V(j.type),ee=z(j.type);if(!X)return;this.setPointersPositions(j);const ne=this[ee+"ClickStartShape"],fe=this[ee+"ClickEndShape"];var ce={};let Be=!1;this._changedPointerPositions.forEach($e=>{const we=l.getCapturedShape($e.id)||this.getIntersection($e);if(we){if(we.releaseCapture($e.id),ce[we._id])return;ce[we._id]=!0}const Ke=$e.id,be={evt:j,pointerId:Ke};let zt=!1;i.Konva["_"+ee+"InDblClickWindow"]?(zt=!0,clearTimeout(this[ee+"DblTimeout"])):a.DD.justDragged||(i.Konva["_"+ee+"InDblClickWindow"]=!0,clearTimeout(this[ee+"DblTimeout"])),this[ee+"DblTimeout"]=setTimeout(function(){i.Konva["_"+ee+"InDblClickWindow"]=!1},i.Konva.dblClickWindow),we&&we.isListening()?(Be=!0,this[ee+"ClickEndShape"]=we,we._fireAndBubble(X.pointerup,Object.assign({},be)),i.Konva["_"+ee+"ListenClick"]&&ne&&ne===we&&(we._fireAndBubble(X.pointerclick,Object.assign({},be)),zt&&fe&&fe===we&&we._fireAndBubble(X.pointerdblclick,Object.assign({},be)))):(this[ee+"ClickEndShape"]=null,i.Konva["_"+ee+"ListenClick"]&&this._fire(X.pointerclick,{evt:j,target:this,currentTarget:this,pointerId:Ke}),zt&&this._fire(X.pointerdblclick,{evt:j,target:this,currentTarget:this,pointerId:Ke}))}),Be||this._fire(X.pointerup,{evt:j,target:this,currentTarget:this,pointerId:this._changedPointerPositions[0].id}),i.Konva["_"+ee+"ListenClick"]=!1,j.cancelable&&ee!=="touch"&&j.preventDefault()}_contextmenu(j){this.setPointersPositions(j);var X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(D,{evt:j}):this._fire(D,{evt:j,target:this,currentTarget:this})}_wheel(j){this.setPointersPositions(j);var X=this.getIntersection(this.getPointerPosition());X&&X.isListening()?X._fireAndBubble(L,{evt:j}):this._fire(L,{evt:j,target:this,currentTarget:this})}_pointercancel(j){this.setPointersPositions(j);const X=l.getCapturedShape(j.pointerId)||this.getIntersection(this.getPointerPosition());X&&X._fireAndBubble(S,l.createEvent(j)),l.releaseCapture(j.pointerId)}_lostpointercapture(j){l.releaseCapture(j.pointerId)}setPointersPositions(j){var X=this._getContentPosition(),ee=null,ne=null;j=j||window.event,j.touches!==void 0?(this._pointerPositions=[],this._changedPointerPositions=[],Array.prototype.forEach.call(j.touches,fe=>{this._pointerPositions.push({id:fe.identifier,x:(fe.clientX-X.left)/X.scaleX,y:(fe.clientY-X.top)/X.scaleY})}),Array.prototype.forEach.call(j.changedTouches||j.touches,fe=>{this._changedPointerPositions.push({id:fe.identifier,x:(fe.clientX-X.left)/X.scaleX,y:(fe.clientY-X.top)/X.scaleY})})):(ee=(j.clientX-X.left)/X.scaleX,ne=(j.clientY-X.top)/X.scaleY,this.pointerPos={x:ee,y:ne},this._pointerPositions=[{x:ee,y:ne,id:t.Util._getFirstPointerId(j)}],this._changedPointerPositions=[{x:ee,y:ne,id:t.Util._getFirstPointerId(j)}])}_setPointerPosition(j){t.Util.warn('Method _setPointerPosition is deprecated. Use "stage.setPointersPositions(event)" instead.'),this.setPointersPositions(j)}_getContentPosition(){if(!this.content||!this.content.getBoundingClientRect)return{top:0,left:0,scaleX:1,scaleY:1};var j=this.content.getBoundingClientRect();return{top:j.top,left:j.left,scaleX:j.width/this.content.clientWidth||1,scaleY:j.height/this.content.clientHeight||1}}_buildDOM(){if(this.bufferCanvas=new o.SceneCanvas({width:this.width(),height:this.height()}),this.bufferHitCanvas=new o.HitCanvas({pixelRatio:1,width:this.width(),height:this.height()}),!!i.Konva.isBrowser){var j=this.container();if(!j)throw"Stage has no container. A container is required.";j.innerHTML="",this.content=document.createElement("div"),this.content.style.position="relative",this.content.style.userSelect="none",this.content.className="konvajs-content",this.content.setAttribute("role","presentation"),j.appendChild(this.content),this._resizeDOM()}}cache(){return t.Util.warn("Cache function is not allowed for stage. You may use cache only for layers, groups and shapes."),this}clearCache(){return this}batchDraw(){return this.getChildren().forEach(function(j){j.batchDraw()}),this}}e.Stage=Z,Z.prototype.nodeType=u,(0,s._registerNode)(Z),n.Factory.addGetterSetter(Z,"container")})(jz);var Am={},Rn={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.Shape=e.shapes=void 0;const t=Ue,n=tn,r=ze,i=Wt,o=Ce,a=Ue,s=pi;var l="hasShadow",u="shadowRGBA",c="patternImage",d="linearGradient",f="radialGradient";let h;function p(){return h||(h=n.Util.createCanvasElement().getContext("2d"),h)}e.shapes={};function m(T){const A=this.attrs.fillRule;A?T.fill(A):T.fill()}function _(T){T.stroke()}function v(T){T.fill()}function y(T){T.stroke()}function g(){this._clearCache(l)}function b(){this._clearCache(u)}function S(){this._clearCache(c)}function x(){this._clearCache(d)}function w(){this._clearCache(f)}class C extends i.Node{constructor(A){super(A);let k;for(;k=n.Util.getRandomColor(),!(k&&!(k in e.shapes)););this.colorKey=k,e.shapes[k]=this}getContext(){return n.Util.warn("shape.getContext() method is deprecated. Please do not use it."),this.getLayer().getContext()}getCanvas(){return n.Util.warn("shape.getCanvas() method is deprecated. Please do not use it."),this.getLayer().getCanvas()}getSceneFunc(){return this.attrs.sceneFunc||this._sceneFunc}getHitFunc(){return this.attrs.hitFunc||this._hitFunc}hasShadow(){return this._getCache(l,this._hasShadow)}_hasShadow(){return this.shadowEnabled()&&this.shadowOpacity()!==0&&!!(this.shadowColor()||this.shadowBlur()||this.shadowOffsetX()||this.shadowOffsetY())}_getFillPattern(){return this._getCache(c,this.__getFillPattern)}__getFillPattern(){if(this.fillPatternImage()){var A=p();const k=A.createPattern(this.fillPatternImage(),this.fillPatternRepeat()||"repeat");if(k&&k.setTransform){const D=new n.Transform;D.translate(this.fillPatternX(),this.fillPatternY()),D.rotate(t.Konva.getAngle(this.fillPatternRotation())),D.scale(this.fillPatternScaleX(),this.fillPatternScaleY()),D.translate(-1*this.fillPatternOffsetX(),-1*this.fillPatternOffsetY());const M=D.getMatrix(),E=typeof DOMMatrix>"u"?{a:M[0],b:M[1],c:M[2],d:M[3],e:M[4],f:M[5]}:new DOMMatrix(M);k.setTransform(E)}return k}}_getLinearGradient(){return this._getCache(d,this.__getLinearGradient)}__getLinearGradient(){var A=this.fillLinearGradientColorStops();if(A){for(var k=p(),D=this.fillLinearGradientStartPoint(),M=this.fillLinearGradientEndPoint(),E=k.createLinearGradient(D.x,D.y,M.x,M.y),P=0;Pthis.fillEnabled()&&!!(this.fill()||this.fillPatternImage()||this.fillLinearGradientColorStops()||this.fillRadialGradientColorStops()))}hasStroke(){return this._calculate("hasStroke",["strokeEnabled","strokeWidth","stroke","strokeLinearGradientColorStops"],()=>this.strokeEnabled()&&this.strokeWidth()&&!!(this.stroke()||this.strokeLinearGradientColorStops()))}hasHitStroke(){const A=this.hitStrokeWidth();return A==="auto"?this.hasStroke():this.strokeEnabled()&&!!A}intersects(A){var k=this.getStage(),D=k.bufferHitCanvas,M;return D.getContext().clear(),this.drawHit(D,null,!0),M=D.context.getImageData(Math.round(A.x),Math.round(A.y),1,1).data,M[3]>0}destroy(){return i.Node.prototype.destroy.call(this),delete e.shapes[this.colorKey],delete this.colorKey,this}_useBufferCanvas(A){var k;if(!this.getStage()||!((k=this.attrs.perfectDrawEnabled)!==null&&k!==void 0?k:!0))return!1;const M=A||this.hasFill(),E=this.hasStroke(),P=this.getAbsoluteOpacity()!==1;if(M&&E&&P)return!0;const N=this.hasShadow(),L=this.shadowForStrokeEnabled();return!!(M&&E&&N&&L)}setStrokeHitEnabled(A){n.Util.warn("strokeHitEnabled property is deprecated. Please use hitStrokeWidth instead."),A?this.hitStrokeWidth("auto"):this.hitStrokeWidth(0)}getStrokeHitEnabled(){return this.hitStrokeWidth()!==0}getSelfRect(){var A=this.size();return{x:this._centroid?-A.width/2:0,y:this._centroid?-A.height/2:0,width:A.width,height:A.height}}getClientRect(A={}){const k=A.skipTransform,D=A.relativeTo,M=this.getSelfRect(),P=!A.skipStroke&&this.hasStroke()&&this.strokeWidth()||0,N=M.width+P,L=M.height+P,O=!A.skipShadow&&this.hasShadow(),R=O?this.shadowOffsetX():0,$=O?this.shadowOffsetY():0,z=N+Math.abs(R),V=L+Math.abs($),H=O&&this.shadowBlur()||0,Q=z+H*2,Z=V+H*2,J={width:Q,height:Z,x:-(P/2+H)+Math.min(R,0)+M.x,y:-(P/2+H)+Math.min($,0)+M.y};return k?J:this._transformedRect(J,D)}drawScene(A,k){var D=this.getLayer(),M=A||D.getCanvas(),E=M.getContext(),P=this._getCanvasCache(),N=this.getSceneFunc(),L=this.hasShadow(),O,R,$,z=M.isCache,V=k===this;if(!this.isVisible()&&!V)return this;if(P){E.save();var H=this.getAbsoluteTransform(k).getMatrix();return E.transform(H[0],H[1],H[2],H[3],H[4],H[5]),this._drawCachedSceneCanvas(E),E.restore(),this}if(!N)return this;if(E.save(),this._useBufferCanvas()&&!z){O=this.getStage(),R=O.bufferCanvas,$=R.getContext(),$.clear(),$.save(),$._applyLineJoin(this);var Q=this.getAbsoluteTransform(k).getMatrix();$.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),N.call(this,$,this),$.restore();var Z=R.pixelRatio;L&&E._applyShadow(this),E._applyOpacity(this),E._applyGlobalCompositeOperation(this),E.drawImage(R._canvas,0,0,R.width/Z,R.height/Z)}else{if(E._applyLineJoin(this),!V){var Q=this.getAbsoluteTransform(k).getMatrix();E.transform(Q[0],Q[1],Q[2],Q[3],Q[4],Q[5]),E._applyOpacity(this),E._applyGlobalCompositeOperation(this)}L&&E._applyShadow(this),N.call(this,E,this)}return E.restore(),this}drawHit(A,k,D=!1){if(!this.shouldDrawHit(k,D))return this;var M=this.getLayer(),E=A||M.hitCanvas,P=E&&E.getContext(),N=this.hitFunc()||this.sceneFunc(),L=this._getCanvasCache(),O=L&&L.hit;if(this.colorKey||n.Util.warn("Looks like your canvas has a destroyed shape in it. Do not reuse shape after you destroyed it. If you want to reuse shape you should call remove() instead of destroy()"),O){P.save();var R=this.getAbsoluteTransform(k).getMatrix();return P.transform(R[0],R[1],R[2],R[3],R[4],R[5]),this._drawCachedHitCanvas(P),P.restore(),this}if(!N)return this;if(P.save(),P._applyLineJoin(this),!(this===k)){var z=this.getAbsoluteTransform(k).getMatrix();P.transform(z[0],z[1],z[2],z[3],z[4],z[5])}return N.call(this,P,this),P.restore(),this}drawHitFromCache(A=0){var k=this._getCanvasCache(),D=this._getCachedSceneCanvas(),M=k.hit,E=M.getContext(),P=M.getWidth(),N=M.getHeight(),L,O,R,$,z,V;E.clear(),E.drawImage(D._canvas,0,0,P,N);try{for(L=E.getImageData(0,0,P,N),O=L.data,R=O.length,$=n.Util._hexToRgb(this.colorKey),z=0;zA?(O[z]=$.r,O[z+1]=$.g,O[z+2]=$.b,O[z+3]=255):O[z+3]=0;E.putImageData(L,0,0)}catch(H){n.Util.error("Unable to draw hit graph from cached scene canvas. "+H.message)}return this}hasPointerCapture(A){return s.hasPointerCapture(A,this)}setPointerCapture(A){s.setPointerCapture(A,this)}releaseCapture(A){s.releaseCapture(A,this)}}e.Shape=C,C.prototype._fillFunc=m,C.prototype._strokeFunc=_,C.prototype._fillFuncHit=v,C.prototype._strokeFuncHit=y,C.prototype._centroid=!1,C.prototype.nodeType="Shape",(0,a._registerNode)(C),C.prototype.eventListeners={},C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowBlurChange.konva shadowOffsetChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",g),C.prototype.on.call(C.prototype,"shadowColorChange.konva shadowOpacityChange.konva shadowEnabledChange.konva",b),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillPatternImageChange.konva fillPatternRepeatChange.konva fillPatternScaleXChange.konva fillPatternScaleYChange.konva fillPatternOffsetXChange.konva fillPatternOffsetYChange.konva fillPatternXChange.konva fillPatternYChange.konva fillPatternRotationChange.konva",S),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillLinearGradientColorStopsChange.konva fillLinearGradientStartPointXChange.konva fillLinearGradientStartPointYChange.konva fillLinearGradientEndPointXChange.konva fillLinearGradientEndPointYChange.konva",x),C.prototype.on.call(C.prototype,"fillPriorityChange.konva fillRadialGradientColorStopsChange.konva fillRadialGradientStartPointXChange.konva fillRadialGradientStartPointYChange.konva fillRadialGradientEndPointXChange.konva fillRadialGradientEndPointYChange.konva fillRadialGradientStartRadiusChange.konva fillRadialGradientEndRadiusChange.konva",w),r.Factory.addGetterSetter(C,"stroke",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"strokeWidth",2,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillAfterStrokeEnabled",!1),r.Factory.addGetterSetter(C,"hitStrokeWidth","auto",(0,o.getNumberOrAutoValidator)()),r.Factory.addGetterSetter(C,"strokeHitEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"perfectDrawEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"shadowForStrokeEnabled",!0,(0,o.getBooleanValidator)()),r.Factory.addGetterSetter(C,"lineJoin"),r.Factory.addGetterSetter(C,"lineCap"),r.Factory.addGetterSetter(C,"sceneFunc"),r.Factory.addGetterSetter(C,"hitFunc"),r.Factory.addGetterSetter(C,"dash"),r.Factory.addGetterSetter(C,"dashOffset",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowColor",void 0,(0,o.getStringValidator)()),r.Factory.addGetterSetter(C,"shadowBlur",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOpacity",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"shadowOffset",["x","y"]),r.Factory.addGetterSetter(C,"shadowOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"shadowOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternImage"),r.Factory.addGetterSetter(C,"fill",void 0,(0,o.getStringOrGradientValidator)()),r.Factory.addGetterSetter(C,"fillPatternX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternY",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillLinearGradientColorStops"),r.Factory.addGetterSetter(C,"strokeLinearGradientColorStops"),r.Factory.addGetterSetter(C,"fillRadialGradientStartRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndRadius",0),r.Factory.addGetterSetter(C,"fillRadialGradientColorStops"),r.Factory.addGetterSetter(C,"fillPatternRepeat","repeat"),r.Factory.addGetterSetter(C,"fillEnabled",!0),r.Factory.addGetterSetter(C,"strokeEnabled",!0),r.Factory.addGetterSetter(C,"shadowEnabled",!0),r.Factory.addGetterSetter(C,"dashEnabled",!0),r.Factory.addGetterSetter(C,"strokeScaleEnabled",!0),r.Factory.addGetterSetter(C,"fillPriority","color"),r.Factory.addComponentsGetterSetter(C,"fillPatternOffset",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternOffsetX",0,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternOffsetY",0,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillPatternScale",["x","y"]),r.Factory.addGetterSetter(C,"fillPatternScaleX",1,(0,o.getNumberValidator)()),r.Factory.addGetterSetter(C,"fillPatternScaleY",1,(0,o.getNumberValidator)()),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientStartPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientStartPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillLinearGradientEndPoint",["x","y"]),r.Factory.addComponentsGetterSetter(C,"strokeLinearGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillLinearGradientEndPointY",0),r.Factory.addGetterSetter(C,"strokeLinearGradientEndPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientStartPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientStartPointY",0),r.Factory.addComponentsGetterSetter(C,"fillRadialGradientEndPoint",["x","y"]),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointX",0),r.Factory.addGetterSetter(C,"fillRadialGradientEndPointY",0),r.Factory.addGetterSetter(C,"fillPatternRotation",0),r.Factory.addGetterSetter(C,"fillRule",void 0,(0,o.getStringValidator)()),r.Factory.backCompat(C,{dashArray:"dash",getDashArray:"getDash",setDashArray:"getDash",drawFunc:"sceneFunc",getDrawFunc:"getSceneFunc",setDrawFunc:"setSceneFunc",drawHitFunc:"hitFunc",getDrawHitFunc:"getHitFunc",setDrawHitFunc:"setHitFunc"})})(Rn);Object.defineProperty(Am,"__esModule",{value:!0});Am.Layer=void 0;const Da=tn,Qx=sc,Rc=Wt,dA=ze,SI=Ro,nbe=Ce,rbe=Rn,ibe=Ue;var obe="#",abe="beforeDraw",sbe="draw",Gz=[{x:0,y:0},{x:-1,y:-1},{x:1,y:-1},{x:1,y:1},{x:-1,y:1}],lbe=Gz.length;class $f extends Qx.Container{constructor(t){super(t),this.canvas=new SI.SceneCanvas,this.hitCanvas=new SI.HitCanvas({pixelRatio:1}),this._waitingForDraw=!1,this.on("visibleChange.konva",this._checkVisibility),this._checkVisibility(),this.on("imageSmoothingEnabledChange.konva",this._setSmoothEnabled),this._setSmoothEnabled()}createPNGStream(){return this.canvas._canvas.createPNGStream()}getCanvas(){return this.canvas}getNativeCanvasElement(){return this.canvas._canvas}getHitCanvas(){return this.hitCanvas}getContext(){return this.getCanvas().getContext()}clear(t){return this.getContext().clear(t),this.getHitCanvas().getContext().clear(t),this}setZIndex(t){super.setZIndex(t);var n=this.getStage();return n&&n.content&&(n.content.removeChild(this.getNativeCanvasElement()),t{this.draw(),this._waitingForDraw=!1})),this}getIntersection(t){if(!this.isListening()||!this.isVisible())return null;for(var n=1,r=!1;;){for(let i=0;i0)return{antialiased:!0};return{}}drawScene(t,n){var r=this.getLayer(),i=t||r&&r.getCanvas();return this._fire(abe,{node:this}),this.clearBeforeDraw()&&i.getContext().clear(),Qx.Container.prototype.drawScene.call(this,i,n),this._fire(sbe,{node:this}),this}drawHit(t,n){var r=this.getLayer(),i=t||r&&r.hitCanvas;return r&&r.clearBeforeDraw()&&r.getHitCanvas().getContext().clear(),Qx.Container.prototype.drawHit.call(this,i,n),this}enableHitGraph(){return this.hitGraphEnabled(!0),this}disableHitGraph(){return this.hitGraphEnabled(!1),this}setHitGraphEnabled(t){Da.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening(t)}getHitGraphEnabled(t){return Da.Util.warn("hitGraphEnabled method is deprecated. Please use layer.listening() instead."),this.listening()}toggleHitCanvas(){if(!(!this.parent||!this.parent.content)){var t=this.parent,n=!!this.hitCanvas._canvas.parentNode;n?t.content.removeChild(this.hitCanvas._canvas):t.content.appendChild(this.hitCanvas._canvas)}}destroy(){return Da.Util.releaseCanvas(this.getNativeCanvasElement(),this.getHitCanvas()._canvas),super.destroy()}}Am.Layer=$f;$f.prototype.nodeType="Layer";(0,ibe._registerNode)($f);dA.Factory.addGetterSetter($f,"imageSmoothingEnabled",!0);dA.Factory.addGetterSetter($f,"clearBeforeDraw",!0);dA.Factory.addGetterSetter($f,"hitGraphEnabled",!0,(0,nbe.getBooleanValidator)());var oS={};Object.defineProperty(oS,"__esModule",{value:!0});oS.FastLayer=void 0;const ube=tn,cbe=Am,dbe=Ue;class fA extends cbe.Layer{constructor(t){super(t),this.listening(!1),ube.Util.warn('Konva.Fast layer is deprecated. Please use "new Konva.Layer({ listening: false })" instead.')}}oS.FastLayer=fA;fA.prototype.nodeType="FastLayer";(0,dbe._registerNode)(fA);var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0});Nf.Group=void 0;const fbe=tn,hbe=sc,pbe=Ue;class hA extends hbe.Container{_validateAdd(t){var n=t.getType();n!=="Group"&&n!=="Shape"&&fbe.Util.throw("You may only add groups and shapes to groups.")}}Nf.Group=hA;hA.prototype.nodeType="Group";(0,pbe._registerNode)(hA);var Df={};Object.defineProperty(Df,"__esModule",{value:!0});Df.Animation=void 0;const Yx=Ue,xI=tn;var Zx=function(){return Yx.glob.performance&&Yx.glob.performance.now?function(){return Yx.glob.performance.now()}:function(){return new Date().getTime()}}();class ia{constructor(t,n){this.id=ia.animIdCounter++,this.frame={time:0,timeDiff:0,lastTime:Zx(),frameRate:0},this.func=t,this.setLayers(n)}setLayers(t){var n=[];return t?t.length>0?n=t:n=[t]:n=[],this.layers=n,this}getLayers(){return this.layers}addLayer(t){var n=this.layers,r=n.length,i;for(i=0;ithis.duration?this.yoyo?(this._time=this.duration,this.reverse()):this.finish():p<0?this.yoyo?(this._time=0,this.play()):this.reset():(this._time=p,this.update())}getTime(){return this._time}setPosition(p){this.prevPos=this._pos,this.propFunc(p),this._pos=p}getPosition(p){return p===void 0&&(p=this._time),this.func(p,this.begin,this._change,this.duration)}play(){this.state=s,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onPlay")}reverse(){this.state=l,this._time=this.duration-this._time,this._startTime=this.getTimer()-this._time,this.onEnterFrame(),this.fire("onReverse")}seek(p){this.pause(),this._time=p,this.update(),this.fire("onSeek")}reset(){this.pause(),this._time=0,this.update(),this.fire("onReset")}finish(){this.pause(),this._time=this.duration,this.update(),this.fire("onFinish")}update(){this.setPosition(this.getPosition(this._time)),this.fire("onUpdate")}onEnterFrame(){var p=this.getTimer()-this._startTime;this.state===s?this.setTime(p):this.state===l&&this.setTime(this.duration-p)}pause(){this.state=a,this.fire("onPause")}getTimer(){return new Date().getTime()}}class f{constructor(p){var m=this,_=p.node,v=_._id,y,g=p.easing||e.Easings.Linear,b=!!p.yoyo,S;typeof p.duration>"u"?y=.3:p.duration===0?y=.001:y=p.duration,this.node=_,this._id=u++;var x=_.getLayer()||(_ instanceof i.Konva.Stage?_.getLayers():null);x||t.Util.error("Tween constructor have `node` that is not in a layer. Please add node into layer first."),this.anim=new n.Animation(function(){m.tween.onEnterFrame()},x),this.tween=new d(S,function(w){m._tweenFunc(w)},g,0,1,y*1e3,b),this._addListeners(),f.attrs[v]||(f.attrs[v]={}),f.attrs[v][this._id]||(f.attrs[v][this._id]={}),f.tweens[v]||(f.tweens[v]={});for(S in p)o[S]===void 0&&this._addAttr(S,p[S]);this.reset(),this.onFinish=p.onFinish,this.onReset=p.onReset,this.onUpdate=p.onUpdate}_addAttr(p,m){var _=this.node,v=_._id,y,g,b,S,x,w,C,T;if(b=f.tweens[v][p],b&&delete f.attrs[v][b][p],y=_.getAttr(p),t.Util._isArray(m))if(g=[],x=Math.max(m.length,y.length),p==="points"&&m.length!==y.length&&(m.length>y.length?(C=y,y=t.Util._prepareArrayForTween(y,m,_.closed())):(w=m,m=t.Util._prepareArrayForTween(m,y,_.closed()))),p.indexOf("fill")===0)for(S=0;S{this.anim.start()},this.tween.onReverse=()=>{this.anim.start()},this.tween.onPause=()=>{this.anim.stop()},this.tween.onFinish=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueEnd&&p.setAttr("points",m.points.trueEnd),this.onFinish&&this.onFinish.call(this)},this.tween.onReset=()=>{var p=this.node,m=f.attrs[p._id][this._id];m.points&&m.points.trueStart&&p.points(m.points.trueStart),this.onReset&&this.onReset()},this.tween.onUpdate=()=>{this.onUpdate&&this.onUpdate.call(this)}}play(){return this.tween.play(),this}reverse(){return this.tween.reverse(),this}reset(){return this.tween.reset(),this}seek(p){return this.tween.seek(p*1e3),this}pause(){return this.tween.pause(),this}finish(){return this.tween.finish(),this}destroy(){var p=this.node._id,m=this._id,_=f.tweens[p],v;this.pause();for(v in _)delete f.tweens[p][v];delete f.attrs[p][m]}}e.Tween=f,f.attrs={},f.tweens={},r.Node.prototype.to=function(h){var p=h.onFinish;h.node=this,h.onFinish=function(){this.destroy(),p&&p()};var m=new f(h);m.play()},e.Easings={BackEaseIn(h,p,m,_){var v=1.70158;return m*(h/=_)*h*((v+1)*h-v)+p},BackEaseOut(h,p,m,_){var v=1.70158;return m*((h=h/_-1)*h*((v+1)*h+v)+1)+p},BackEaseInOut(h,p,m,_){var v=1.70158;return(h/=_/2)<1?m/2*(h*h*(((v*=1.525)+1)*h-v))+p:m/2*((h-=2)*h*(((v*=1.525)+1)*h+v)+2)+p},ElasticEaseIn(h,p,m,_,v,y){var g=0;return h===0?p:(h/=_)===1?p+m:(y||(y=_*.3),!v||v0?t:n),c=a*n,d=s*(s>0?t:n),f=l*(l>0?n:t);return{x:u,y:r?-1*f:d,width:c-u,height:f-d}}}aS.Arc=Es;Es.prototype._centroid=!0;Es.prototype.className="Arc";Es.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,mbe._registerNode)(Es);sS.Factory.addGetterSetter(Es,"innerRadius",0,(0,lS.getNumberValidator)());sS.Factory.addGetterSetter(Es,"outerRadius",0,(0,lS.getNumberValidator)());sS.Factory.addGetterSetter(Es,"angle",0,(0,lS.getNumberValidator)());sS.Factory.addGetterSetter(Es,"clockwise",!1,(0,lS.getBooleanValidator)());var uS={},Tm={};Object.defineProperty(Tm,"__esModule",{value:!0});Tm.Line=void 0;const cS=ze,ybe=Rn,qz=Ce,vbe=Ue;function V5(e,t,n,r,i,o,a){var s=Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2)),l=Math.sqrt(Math.pow(i-n,2)+Math.pow(o-r,2)),u=a*s/(s+l),c=a*l/(s+l),d=n-u*(i-e),f=r-u*(o-t),h=n+c*(i-e),p=r+c*(o-t);return[d,f,h,p]}function CI(e,t){var n=e.length,r=[],i,o;for(i=2;i4){for(s=this.getTensionPoints(),l=s.length,u=o?0:4,o||t.quadraticCurveTo(s[0],s[1],s[2],s[3]);u{let u,c,d;u=l/2,c=0;for(let h=0;h<20;h++)d=u*e.tValues[20][h]+u,c+=e.cValues[20][h]*r(a,s,d);return u*c};e.getCubicArcLength=t;const n=(a,s,l)=>{l===void 0&&(l=1);const u=a[0]-2*a[1]+a[2],c=s[0]-2*s[1]+s[2],d=2*a[1]-2*a[0],f=2*s[1]-2*s[0],h=4*(u*u+c*c),p=4*(u*d+c*f),m=d*d+f*f;if(h===0)return l*Math.sqrt(Math.pow(a[2]-a[0],2)+Math.pow(s[2]-s[0],2));const _=p/(2*h),v=m/h,y=l+_,g=v-_*_,b=y*y+g>0?Math.sqrt(y*y+g):0,S=_*_+g>0?Math.sqrt(_*_+g):0,x=_+Math.sqrt(_*_+g)!==0?g*Math.log(Math.abs((y+b)/(_+S))):0;return Math.sqrt(h)/2*(y*b-_*S+x)};e.getQuadraticArcLength=n;function r(a,s,l){const u=i(1,l,a),c=i(1,l,s),d=u*u+c*c;return Math.sqrt(d)}const i=(a,s,l)=>{const u=l.length-1;let c,d;if(u===0)return 0;if(a===0){d=0;for(let f=0;f<=u;f++)d+=e.binomialCoefficients[u][f]*Math.pow(1-s,u-f)*Math.pow(s,f)*l[f];return d}else{c=new Array(u);for(let f=0;f{let u=1,c=a/s,d=(a-l(c))/s,f=0;for(;u>.001;){const h=l(c+d),p=Math.abs(a-h)/s;if(p500)break}return c};e.t2length=o})(Wz);Object.defineProperty(Lf,"__esModule",{value:!0});Lf.Path=void 0;const bbe=ze,_be=Rn,Sbe=Ue,Oc=Wz;class An extends _be.Shape{constructor(t){super(t),this.dataArray=[],this.pathLength=0,this._readDataAttribute(),this.on("dataChange.konva",function(){this._readDataAttribute()})}_readDataAttribute(){this.dataArray=An.parsePathData(this.data()),this.pathLength=An.getPathLength(this.dataArray)}_sceneFunc(t){var n=this.dataArray;t.beginPath();for(var r=!1,i=0;ic?u:c,_=u>c?1:u/c,v=u>c?c/u:1;t.translate(s,l),t.rotate(h),t.scale(_,v),t.arc(0,0,m,d,d+f,1-p),t.scale(1/_,1/v),t.rotate(-h),t.translate(-s,-l);break;case"z":r=!0,t.closePath();break}}!r&&!this.hasFill()?t.strokeShape(this):t.fillStrokeShape(this)}getSelfRect(){var t=[];this.dataArray.forEach(function(u){if(u.command==="A"){var c=u.points[4],d=u.points[5],f=u.points[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;p-=h){const m=An.getPointOnEllipticalArc(u.points[0],u.points[1],u.points[2],u.points[3],p,0);t.push(m.x,m.y)}else for(let p=c+h;pn[i].pathLength;)t-=n[i].pathLength,++i;if(i===o)return r=n[i-1].points.slice(-2),{x:r[0],y:r[1]};if(t<.01)return r=n[i].points.slice(0,2),{x:r[0],y:r[1]};var a=n[i],s=a.points;switch(a.command){case"L":return An.getPointOnLine(t,a.start.x,a.start.y,s[0],s[1]);case"C":return An.getPointOnCubicBezier((0,Oc.t2length)(t,An.getPathLength(n),m=>(0,Oc.getCubicArcLength)([a.start.x,s[0],s[2],s[4]],[a.start.y,s[1],s[3],s[5]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3],s[4],s[5]);case"Q":return An.getPointOnQuadraticBezier((0,Oc.t2length)(t,An.getPathLength(n),m=>(0,Oc.getQuadraticArcLength)([a.start.x,s[0],s[2]],[a.start.y,s[1],s[3]],m)),a.start.x,a.start.y,s[0],s[1],s[2],s[3]);case"A":var l=s[0],u=s[1],c=s[2],d=s[3],f=s[4],h=s[5],p=s[6];return f+=h*t/a.pathLength,An.getPointOnEllipticalArc(l,u,c,d,f,p)}return null}static getPointOnLine(t,n,r,i,o,a,s){a===void 0&&(a=n),s===void 0&&(s=r);var l=(o-r)/(i-n+1e-8),u=Math.sqrt(t*t/(1+l*l));i0&&!isNaN(p[0]);){var y=null,g=[],b=l,S=u,x,w,C,T,A,k,D,M,E,P;switch(h){case"l":l+=p.shift(),u+=p.shift(),y="L",g.push(l,u);break;case"L":l=p.shift(),u=p.shift(),g.push(l,u);break;case"m":var N=p.shift(),L=p.shift();if(l+=N,u+=L,y="M",a.length>2&&a[a.length-1].command==="z"){for(var O=a.length-2;O>=0;O--)if(a[O].command==="M"){l=a[O].points[0]+N,u=a[O].points[1]+L;break}}g.push(l,u),h="l";break;case"M":l=p.shift(),u=p.shift(),y="M",g.push(l,u),h="L";break;case"h":l+=p.shift(),y="L",g.push(l,u);break;case"H":l=p.shift(),y="L",g.push(l,u);break;case"v":u+=p.shift(),y="L",g.push(l,u);break;case"V":u=p.shift(),y="L",g.push(l,u);break;case"C":g.push(p.shift(),p.shift(),p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"c":g.push(l+p.shift(),u+p.shift(),l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",g.push(l,u);break;case"S":w=l,C=u,x=a[a.length-1],x.command==="C"&&(w=l+(l-x.points[2]),C=u+(u-x.points[3])),g.push(w,C,p.shift(),p.shift()),l=p.shift(),u=p.shift(),y="C",g.push(l,u);break;case"s":w=l,C=u,x=a[a.length-1],x.command==="C"&&(w=l+(l-x.points[2]),C=u+(u-x.points[3])),g.push(w,C,l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="C",g.push(l,u);break;case"Q":g.push(p.shift(),p.shift()),l=p.shift(),u=p.shift(),g.push(l,u);break;case"q":g.push(l+p.shift(),u+p.shift()),l+=p.shift(),u+=p.shift(),y="Q",g.push(l,u);break;case"T":w=l,C=u,x=a[a.length-1],x.command==="Q"&&(w=l+(l-x.points[0]),C=u+(u-x.points[1])),l=p.shift(),u=p.shift(),y="Q",g.push(w,C,l,u);break;case"t":w=l,C=u,x=a[a.length-1],x.command==="Q"&&(w=l+(l-x.points[0]),C=u+(u-x.points[1])),l+=p.shift(),u+=p.shift(),y="Q",g.push(w,C,l,u);break;case"A":T=p.shift(),A=p.shift(),k=p.shift(),D=p.shift(),M=p.shift(),E=l,P=u,l=p.shift(),u=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(E,P,l,u,D,M,T,A,k);break;case"a":T=p.shift(),A=p.shift(),k=p.shift(),D=p.shift(),M=p.shift(),E=l,P=u,l+=p.shift(),u+=p.shift(),y="A",g=this.convertEndpointToCenterParameterization(E,P,l,u,D,M,T,A,k);break}a.push({command:y||h,points:g,start:{x:b,y:S},pathLength:this.calcLength(b,S,y||h,g)})}(h==="z"||h==="Z")&&a.push({command:"z",points:[],start:void 0,pathLength:0})}return a}static calcLength(t,n,r,i){var o,a,s,l,u=An;switch(r){case"L":return u.getLineLength(t,n,i[0],i[1]);case"C":return(0,Oc.getCubicArcLength)([t,i[0],i[2],i[4]],[n,i[1],i[3],i[5]],1);case"Q":return(0,Oc.getQuadraticArcLength)([t,i[0],i[2]],[n,i[1],i[3]],1);case"A":o=0;var c=i[4],d=i[5],f=i[4]+d,h=Math.PI/180;if(Math.abs(c-f)f;l-=h)s=u.getPointOnEllipticalArc(i[0],i[1],i[2],i[3],l,0),o+=u.getLineLength(a.x,a.y,s.x,s.y),a=s;else for(l=c+h;l1&&(s*=Math.sqrt(h),l*=Math.sqrt(h));var p=Math.sqrt((s*s*(l*l)-s*s*(f*f)-l*l*(d*d))/(s*s*(f*f)+l*l*(d*d)));o===a&&(p*=-1),isNaN(p)&&(p=0);var m=p*s*f/l,_=p*-l*d/s,v=(t+r)/2+Math.cos(c)*m-Math.sin(c)*_,y=(n+i)/2+Math.sin(c)*m+Math.cos(c)*_,g=function(A){return Math.sqrt(A[0]*A[0]+A[1]*A[1])},b=function(A,k){return(A[0]*k[0]+A[1]*k[1])/(g(A)*g(k))},S=function(A,k){return(A[0]*k[1]=1&&(T=0),a===0&&T>0&&(T=T-2*Math.PI),a===1&&T<0&&(T=T+2*Math.PI),[v,y,s,l,x,T,c,a]}}Lf.Path=An;An.prototype.className="Path";An.prototype._attrsAffectingSize=["data"];(0,Sbe._registerNode)(An);bbe.Factory.addGetterSetter(An,"data");Object.defineProperty(uS,"__esModule",{value:!0});uS.Arrow=void 0;const dS=ze,xbe=Tm,Kz=Ce,wbe=Ue,EI=Lf;class uc extends xbe.Line{_sceneFunc(t){super._sceneFunc(t);var n=Math.PI*2,r=this.points(),i=r,o=this.tension()!==0&&r.length>4;o&&(i=this.getTensionPoints());var a=this.pointerLength(),s=r.length,l,u;if(o){const f=[i[i.length-4],i[i.length-3],i[i.length-2],i[i.length-1],r[s-2],r[s-1]],h=EI.Path.calcLength(i[i.length-4],i[i.length-3],"C",f),p=EI.Path.getPointOnQuadraticBezier(Math.min(1,1-a/h),f[0],f[1],f[2],f[3],f[4],f[5]);l=r[s-2]-p.x,u=r[s-1]-p.y}else l=r[s-2]-r[s-4],u=r[s-1]-r[s-3];var c=(Math.atan2(u,l)+n)%n,d=this.pointerWidth();this.pointerAtEnding()&&(t.save(),t.beginPath(),t.translate(r[s-2],r[s-1]),t.rotate(c),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t)),this.pointerAtBeginning()&&(t.save(),t.beginPath(),t.translate(r[0],r[1]),o?(l=(i[0]+i[2])/2-r[0],u=(i[1]+i[3])/2-r[1]):(l=r[2]-r[0],u=r[3]-r[1]),t.rotate((Math.atan2(-u,-l)+n)%n),t.moveTo(0,0),t.lineTo(-a,d/2),t.lineTo(-a,-d/2),t.closePath(),t.restore(),this.__fillStroke(t))}__fillStroke(t){var n=this.dashEnabled();n&&(this.attrs.dashEnabled=!1,t.setLineDash([])),t.fillStrokeShape(this),n&&(this.attrs.dashEnabled=!0)}getSelfRect(){const t=super.getSelfRect(),n=this.pointerWidth()/2;return{x:t.x-n,y:t.y-n,width:t.width+n*2,height:t.height+n*2}}}uS.Arrow=uc;uc.prototype.className="Arrow";(0,wbe._registerNode)(uc);dS.Factory.addGetterSetter(uc,"pointerLength",10,(0,Kz.getNumberValidator)());dS.Factory.addGetterSetter(uc,"pointerWidth",10,(0,Kz.getNumberValidator)());dS.Factory.addGetterSetter(uc,"pointerAtBeginning",!1);dS.Factory.addGetterSetter(uc,"pointerAtEnding",!0);var fS={};Object.defineProperty(fS,"__esModule",{value:!0});fS.Circle=void 0;const Cbe=ze,Ebe=Rn,Abe=Ce,Tbe=Ue;let Ff=class extends Ebe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.attrs.radius||0,0,Math.PI*2,!1),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius()!==t/2&&this.radius(t/2)}setHeight(t){this.radius()!==t/2&&this.radius(t/2)}};fS.Circle=Ff;Ff.prototype._centroid=!0;Ff.prototype.className="Circle";Ff.prototype._attrsAffectingSize=["radius"];(0,Tbe._registerNode)(Ff);Cbe.Factory.addGetterSetter(Ff,"radius",0,(0,Abe.getNumberValidator)());var hS={};Object.defineProperty(hS,"__esModule",{value:!0});hS.Ellipse=void 0;const pA=ze,Pbe=Rn,Xz=Ce,kbe=Ue;class Hl extends Pbe.Shape{_sceneFunc(t){var n=this.radiusX(),r=this.radiusY();t.beginPath(),t.save(),n!==r&&t.scale(1,r/n),t.arc(0,0,n,0,Math.PI*2,!1),t.restore(),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radiusX()*2}getHeight(){return this.radiusY()*2}setWidth(t){this.radiusX(t/2)}setHeight(t){this.radiusY(t/2)}}hS.Ellipse=Hl;Hl.prototype.className="Ellipse";Hl.prototype._centroid=!0;Hl.prototype._attrsAffectingSize=["radiusX","radiusY"];(0,kbe._registerNode)(Hl);pA.Factory.addComponentsGetterSetter(Hl,"radius",["x","y"]);pA.Factory.addGetterSetter(Hl,"radiusX",0,(0,Xz.getNumberValidator)());pA.Factory.addGetterSetter(Hl,"radiusY",0,(0,Xz.getNumberValidator)());var pS={};Object.defineProperty(pS,"__esModule",{value:!0});pS.Image=void 0;const Jx=tn,cc=ze,Ibe=Rn,Mbe=Ue,Pm=Ce;let ka=class Qz extends Ibe.Shape{constructor(t){super(t),this.on("imageChange.konva",()=>{this._setImageLoad()}),this._setImageLoad()}_setImageLoad(){const t=this.image();t&&t.complete||t&&t.readyState===4||t&&t.addEventListener&&t.addEventListener("load",()=>{this._requestDraw()})}_useBufferCanvas(){return super._useBufferCanvas(!0)}_sceneFunc(t){const n=this.getWidth(),r=this.getHeight(),i=this.cornerRadius(),o=this.attrs.image;let a;if(o){const s=this.attrs.cropWidth,l=this.attrs.cropHeight;s&&l?a=[o,this.cropX(),this.cropY(),s,l,0,0,n,r]:a=[o,0,0,n,r]}(this.hasFill()||this.hasStroke()||i)&&(t.beginPath(),i?Jx.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)),o&&(i&&t.clip(),t.drawImage.apply(t,a))}_hitFunc(t){var n=this.width(),r=this.height(),i=this.cornerRadius();t.beginPath(),i?Jx.Util.drawRoundedRectPath(t,n,r,i):t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}getWidth(){var t,n;return(t=this.attrs.width)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.width}getHeight(){var t,n;return(t=this.attrs.height)!==null&&t!==void 0?t:(n=this.image())===null||n===void 0?void 0:n.height}static fromURL(t,n,r=null){var i=Jx.Util.createImageElement();i.onload=function(){var o=new Qz({image:i});n(o)},i.onerror=r,i.crossOrigin="Anonymous",i.src=t}};pS.Image=ka;ka.prototype.className="Image";(0,Mbe._registerNode)(ka);cc.Factory.addGetterSetter(ka,"cornerRadius",0,(0,Pm.getNumberOrArrayOfNumbersValidator)(4));cc.Factory.addGetterSetter(ka,"image");cc.Factory.addComponentsGetterSetter(ka,"crop",["x","y","width","height"]);cc.Factory.addGetterSetter(ka,"cropX",0,(0,Pm.getNumberValidator)());cc.Factory.addGetterSetter(ka,"cropY",0,(0,Pm.getNumberValidator)());cc.Factory.addGetterSetter(ka,"cropWidth",0,(0,Pm.getNumberValidator)());cc.Factory.addGetterSetter(ka,"cropHeight",0,(0,Pm.getNumberValidator)());var yf={};Object.defineProperty(yf,"__esModule",{value:!0});yf.Tag=yf.Label=void 0;const gS=ze,Rbe=Rn,Obe=Nf,gA=Ce,Yz=Ue;var Zz=["fontFamily","fontSize","fontStyle","padding","lineHeight","text","width","height","pointerDirection","pointerWidth","pointerHeight"],$be="Change.konva",Nbe="none",U5="up",G5="right",H5="down",q5="left",Dbe=Zz.length;class mA extends Obe.Group{constructor(t){super(t),this.on("add.konva",function(n){this._addListeners(n.child),this._sync()})}getText(){return this.find("Text")[0]}getTag(){return this.find("Tag")[0]}_addListeners(t){var n=this,r,i=function(){n._sync()};for(r=0;r{n=Math.min(n,a.x),r=Math.max(r,a.x),i=Math.min(i,a.y),o=Math.max(o,a.y)}),{x:n,y:i,width:r-n,height:o-i}}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}yS.RegularPolygon=fc;fc.prototype.className="RegularPolygon";fc.prototype._centroid=!0;fc.prototype._attrsAffectingSize=["radius"];(0,Ube._registerNode)(fc);Jz.Factory.addGetterSetter(fc,"radius",0,(0,ej.getNumberValidator)());Jz.Factory.addGetterSetter(fc,"sides",0,(0,ej.getNumberValidator)());var vS={};Object.defineProperty(vS,"__esModule",{value:!0});vS.Ring=void 0;const tj=ze,Gbe=Rn,nj=Ce,Hbe=Ue;var AI=Math.PI*2;class hc extends Gbe.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.innerRadius(),0,AI,!1),t.moveTo(this.outerRadius(),0),t.arc(0,0,this.outerRadius(),AI,0,!0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.outerRadius()*2}getHeight(){return this.outerRadius()*2}setWidth(t){this.outerRadius(t/2)}setHeight(t){this.outerRadius(t/2)}}vS.Ring=hc;hc.prototype.className="Ring";hc.prototype._centroid=!0;hc.prototype._attrsAffectingSize=["innerRadius","outerRadius"];(0,Hbe._registerNode)(hc);tj.Factory.addGetterSetter(hc,"innerRadius",0,(0,nj.getNumberValidator)());tj.Factory.addGetterSetter(hc,"outerRadius",0,(0,nj.getNumberValidator)());var bS={};Object.defineProperty(bS,"__esModule",{value:!0});bS.Sprite=void 0;const pc=ze,qbe=Rn,Wbe=Df,rj=Ce,Kbe=Ue;class Ia extends qbe.Shape{constructor(t){super(t),this._updated=!0,this.anim=new Wbe.Animation(()=>{var n=this._updated;return this._updated=!1,n}),this.on("animationChange.konva",function(){this.frameIndex(0)}),this.on("frameIndexChange.konva",function(){this._updated=!0}),this.on("frameRateChange.konva",function(){this.anim.isRunning()&&(clearInterval(this.interval),this._setInterval())})}_sceneFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+0],l=o[i+1],u=o[i+2],c=o[i+3],d=this.image();if((this.hasFill()||this.hasStroke())&&(t.beginPath(),t.rect(0,0,u,c),t.closePath(),t.fillStrokeShape(this)),d)if(a){var f=a[n],h=r*2;t.drawImage(d,s,l,u,c,f[h+0],f[h+1],u,c)}else t.drawImage(d,s,l,u,c,0,0,u,c)}_hitFunc(t){var n=this.animation(),r=this.frameIndex(),i=r*4,o=this.animations()[n],a=this.frameOffsets(),s=o[i+2],l=o[i+3];if(t.beginPath(),a){var u=a[n],c=r*2;t.rect(u[c+0],u[c+1],s,l)}else t.rect(0,0,s,l);t.closePath(),t.fillShape(this)}_useBufferCanvas(){return super._useBufferCanvas(!0)}_setInterval(){var t=this;this.interval=setInterval(function(){t._updateIndex()},1e3/this.frameRate())}start(){if(!this.isRunning()){var t=this.getLayer();this.anim.setLayers(t),this._setInterval(),this.anim.start()}}stop(){this.anim.stop(),clearInterval(this.interval)}isRunning(){return this.anim.isRunning()}_updateIndex(){var t=this.frameIndex(),n=this.animation(),r=this.animations(),i=r[n],o=i.length/4;t{t=t.trim();const n=t.indexOf(" ")>=0,r=t.indexOf('"')>=0||t.indexOf("'")>=0;return n&&!r&&(t=`"${t}"`),t}).join(", ")}var G0;function tw(){return G0||(G0=W5.Util.createCanvasElement().getContext(t_e),G0)}function f_e(e){e.fillText(this._partialText,this._partialTextX,this._partialTextY)}function h_e(e){e.setAttr("miterLimit",2),e.strokeText(this._partialText,this._partialTextX,this._partialTextY)}function p_e(e){return e=e||{},!e.fillLinearGradientColorStops&&!e.fillRadialGradientColorStops&&!e.fillPatternImage&&(e.fill=e.fill||"black"),e}let yn=class extends Ybe.Shape{constructor(t){super(p_e(t)),this._partialTextX=0,this._partialTextY=0;for(var n=0;n1&&(v+=a)}}}_hitFunc(t){var n=this.getWidth(),r=this.getHeight();t.beginPath(),t.rect(0,0,n,r),t.closePath(),t.fillStrokeShape(this)}setText(t){var n=W5.Util._isString(t)?t:t==null?"":t+"";return this._setAttr(n_e,n),this}getWidth(){var t=this.attrs.width===$c||this.attrs.width===void 0;return t?this.getTextWidth()+this.padding()*2:this.attrs.width}getHeight(){var t=this.attrs.height===$c||this.attrs.height===void 0;return t?this.fontSize()*this.textArr.length*this.lineHeight()+this.padding()*2:this.attrs.height}getTextWidth(){return this.textWidth}getTextHeight(){return W5.Util.warn("text.getTextHeight() method is deprecated. Use text.height() - for full height and text.fontSize() - for one line height."),this.textHeight}measureSize(t){var n=tw(),r=this.fontSize(),i;return n.save(),n.font=this._getContextFont(),i=n.measureText(t),n.restore(),{width:i.width,height:r}}_getContextFont(){return this.fontStyle()+U0+this.fontVariant()+U0+(this.fontSize()+a_e)+d_e(this.fontFamily())}_addTextLine(t){this.align()===hh&&(t=t.trim());var r=this._getTextWidth(t);return this.textArr.push({text:t,width:r,lastInParagraph:!1})}_getTextWidth(t){var n=this.letterSpacing(),r=t.length;return tw().measureText(t).width+(r?n*(r-1):0)}_setTextData(){var t=this.text().split(` +`),n=+this.fontSize(),r=0,i=this.lineHeight()*n,o=this.attrs.width,a=this.attrs.height,s=o!==$c&&o!==void 0,l=a!==$c&&a!==void 0,u=this.padding(),c=o-u*2,d=a-u*2,f=0,h=this.wrap(),p=h!==kI,m=h!==u_e&&p,_=this.ellipsis();this.textArr=[],tw().font=this._getContextFont();for(var v=_?this._getTextWidth(ew):0,y=0,g=t.length;yc)for(;b.length>0;){for(var x=0,w=b.length,C="",T=0;x>>1,k=b.slice(0,A+1),D=this._getTextWidth(k)+v;D<=c?(x=A+1,C=k,T=D):w=A}if(C){if(m){var M,E=b[C.length],P=E===U0||E===TI;P&&T<=c?M=C.length:M=Math.max(C.lastIndexOf(U0),C.lastIndexOf(TI))+1,M>0&&(x=M,C=C.slice(0,x),T=this._getTextWidth(C))}C=C.trimRight(),this._addTextLine(C),r=Math.max(r,T),f+=i;var N=this._shouldHandleEllipsis(f);if(N){this._tryToAddEllipsisToLastLine();break}if(b=b.slice(x),b=b.trimLeft(),b.length>0&&(S=this._getTextWidth(b),S<=c)){this._addTextLine(b),f+=i,r=Math.max(r,S);break}}else break}else this._addTextLine(b),f+=i,r=Math.max(r,S),this._shouldHandleEllipsis(f)&&yd)break}this.textHeight=n,this.textWidth=r}_shouldHandleEllipsis(t){var n=+this.fontSize(),r=this.lineHeight()*n,i=this.attrs.height,o=i!==$c&&i!==void 0,a=this.padding(),s=i-a*2,l=this.wrap(),u=l!==kI;return!u||o&&t+r>s}_tryToAddEllipsisToLastLine(){var t=this.attrs.width,n=t!==$c&&t!==void 0,r=this.padding(),i=t-r*2,o=this.ellipsis(),a=this.textArr[this.textArr.length-1];if(!(!a||!o)){if(n){var s=this._getTextWidth(a.text+ew)n?null:ph.Path.getPointAtLengthOfDataArray(t,this.dataArray)}_readDataAttribute(){this.dataArray=ph.Path.parsePathData(this.attrs.data),this.pathLength=this._getTextPathLength()}_sceneFunc(t){t.setAttr("font",this._getContextFont()),t.setAttr("textBaseline",this.textBaseline()),t.setAttr("textAlign","left"),t.save();var n=this.textDecoration(),r=this.fill(),i=this.fontSize(),o=this.glyphInfo;n==="underline"&&t.beginPath();for(var a=0;a=1){var r=n[0].p0;t.moveTo(r.x,r.y)}for(var i=0;ie+`.${fj}`).join(" "),RI="nodesRect",x_e=["widthChange","heightChange","scaleXChange","scaleYChange","skewXChange","skewYChange","rotationChange","offsetXChange","offsetYChange","transformsEnabledChange","strokeWidthChange"],w_e={"top-left":-45,"top-center":0,"top-right":45,"middle-right":-90,"middle-left":90,"bottom-left":-135,"bottom-center":180,"bottom-right":135};const C_e="ontouchstart"in po.Konva._global;function E_e(e,t){if(e==="rotater")return"crosshair";t+=vt.Util.degToRad(w_e[e]||0);var n=(vt.Util.radToDeg(t)%360+360)%360;return vt.Util._inRange(n,315+22.5,360)||vt.Util._inRange(n,0,22.5)?"ns-resize":vt.Util._inRange(n,45-22.5,45+22.5)?"nesw-resize":vt.Util._inRange(n,90-22.5,90+22.5)?"ew-resize":vt.Util._inRange(n,135-22.5,135+22.5)?"nwse-resize":vt.Util._inRange(n,180-22.5,180+22.5)?"ns-resize":vt.Util._inRange(n,225-22.5,225+22.5)?"nesw-resize":vt.Util._inRange(n,270-22.5,270+22.5)?"ew-resize":vt.Util._inRange(n,315-22.5,315+22.5)?"nwse-resize":(vt.Util.error("Transformer has unknown angle for cursor detection: "+n),"pointer")}var F1=["top-left","top-center","top-right","middle-right","middle-left","bottom-left","bottom-center","bottom-right"],OI=1e8;function A_e(e){return{x:e.x+e.width/2*Math.cos(e.rotation)+e.height/2*Math.sin(-e.rotation),y:e.y+e.height/2*Math.cos(e.rotation)+e.width/2*Math.sin(e.rotation)}}function hj(e,t,n){const r=n.x+(e.x-n.x)*Math.cos(t)-(e.y-n.y)*Math.sin(t),i=n.y+(e.x-n.x)*Math.sin(t)+(e.y-n.y)*Math.cos(t);return Object.assign(Object.assign({},e),{rotation:e.rotation+t,x:r,y:i})}function T_e(e,t){const n=A_e(e);return hj(e,t,n)}function P_e(e,t,n){let r=t;for(let i=0;ii.isAncestorOf(this)?(vt.Util.error("Konva.Transformer cannot be an a child of the node you are trying to attach"),!1):!0);this._nodes=t=n,t.length===1&&this.useSingleNodeRotation()?this.rotation(t[0].getAbsoluteRotation()):this.rotation(0),this._nodes.forEach(i=>{const o=()=>{this.nodes().length===1&&this.useSingleNodeRotation()&&this.rotation(this.nodes()[0].getAbsoluteRotation()),this._resetTransformCache(),!this._transforming&&!this.isDragging()&&this.update()},a=i._attrsAffectingSize.map(s=>s+"Change."+this._getEventNamespace()).join(" ");i.on(a,o),i.on(x_e.map(s=>s+`.${this._getEventNamespace()}`).join(" "),o),i.on(`absoluteTransformChange.${this._getEventNamespace()}`,o),this._proxyDrag(i)}),this._resetTransformCache();var r=!!this.findOne(".top-left");return r&&this.update(),this}_proxyDrag(t){let n;t.on(`dragstart.${this._getEventNamespace()}`,r=>{n=t.getAbsolutePosition(),!this.isDragging()&&t!==this.findOne(".back")&&this.startDrag(r,!1)}),t.on(`dragmove.${this._getEventNamespace()}`,r=>{if(!n)return;const i=t.getAbsolutePosition(),o=i.x-n.x,a=i.y-n.y;this.nodes().forEach(s=>{if(s===t||s.isDragging())return;const l=s.getAbsolutePosition();s.setAbsolutePosition({x:l.x+o,y:l.y+a}),s.startDrag(r)}),n=null})}getNodes(){return this._nodes||[]}getActiveAnchor(){return this._movingAnchorName}detach(){this._nodes&&this._nodes.forEach(t=>{t.off("."+this._getEventNamespace())}),this._nodes=[],this._resetTransformCache()}_resetTransformCache(){this._clearCache(RI),this._clearCache("transform"),this._clearSelfAndDescendantCache("absoluteTransform")}_getNodeRect(){return this._getCache(RI,this.__getNodeRect)}__getNodeShape(t,n=this.rotation(),r){var i=t.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()}),o=t.getAbsoluteScale(r),a=t.getAbsolutePosition(r),s=i.x*o.x-t.offsetX()*o.x,l=i.y*o.y-t.offsetY()*o.y;const u=(po.Konva.getAngle(t.getAbsoluteRotation())+Math.PI*2)%(Math.PI*2),c={x:a.x+s*Math.cos(u)+l*Math.sin(-u),y:a.y+l*Math.cos(u)+s*Math.sin(u),width:i.width*o.x,height:i.height*o.y,rotation:u};return hj(c,-po.Konva.getAngle(n),{x:0,y:0})}__getNodeRect(){var t=this.getNode();if(!t)return{x:-OI,y:-OI,width:0,height:0,rotation:0};const n=[];this.nodes().map(u=>{const c=u.getClientRect({skipTransform:!0,skipShadow:!0,skipStroke:this.ignoreStroke()});var d=[{x:c.x,y:c.y},{x:c.x+c.width,y:c.y},{x:c.x+c.width,y:c.y+c.height},{x:c.x,y:c.y+c.height}],f=u.getAbsoluteTransform();d.forEach(function(h){var p=f.point(h);n.push(p)})});const r=new vt.Transform;r.rotate(-po.Konva.getAngle(this.rotation()));var i,o,a,s;n.forEach(function(u){var c=r.point(u);i===void 0&&(i=a=c.x,o=s=c.y),i=Math.min(i,c.x),o=Math.min(o,c.y),a=Math.max(a,c.x),s=Math.max(s,c.y)}),r.invert();const l=r.point({x:i,y:o});return{x:l.x,y:l.y,width:a-i,height:s-o,rotation:po.Konva.getAngle(this.rotation())}}getX(){return this._getNodeRect().x}getY(){return this._getNodeRect().y}getWidth(){return this._getNodeRect().width}getHeight(){return this._getNodeRect().height}_createElements(){this._createBack(),F1.forEach((function(t){this._createAnchor(t)}).bind(this)),this._createAnchor("rotater")}_createAnchor(t){var n=new b_e.Rect({stroke:"rgb(0, 161, 255)",fill:"white",strokeWidth:1,name:t+" _anchor",dragDistance:0,draggable:!0,hitStrokeWidth:C_e?10:"auto"}),r=this;n.on("mousedown touchstart",function(i){r._handleMouseDown(i)}),n.on("dragstart",i=>{n.stopDrag(),i.cancelBubble=!0}),n.on("dragend",i=>{i.cancelBubble=!0}),n.on("mouseenter",()=>{var i=po.Konva.getAngle(this.rotation()),o=E_e(t,i);n.getStage().content&&(n.getStage().content.style.cursor=o),this._cursorChange=!0}),n.on("mouseout",()=>{n.getStage().content&&(n.getStage().content.style.cursor=""),this._cursorChange=!1}),this.add(n)}_createBack(){var t=new v_e.Shape({name:"back",width:0,height:0,draggable:!0,sceneFunc(n){var r=this.getParent(),i=r.padding();n.beginPath(),n.rect(-i,-i,this.width()+i*2,this.height()+i*2),n.moveTo(this.width()/2,-i),r.rotateEnabled()&&n.lineTo(this.width()/2,-r.rotateAnchorOffset()*vt.Util._sign(this.height())-i),n.fillStrokeShape(this)},hitFunc:(n,r)=>{if(this.shouldOverdrawWholeArea()){var i=this.padding();n.beginPath(),n.rect(-i,-i,r.width()+i*2,r.height()+i*2),n.fillStrokeShape(r)}}});this.add(t),this._proxyDrag(t),t.on("dragstart",n=>{n.cancelBubble=!0}),t.on("dragmove",n=>{n.cancelBubble=!0}),t.on("dragend",n=>{n.cancelBubble=!0}),this.on("dragmove",n=>{this.update()})}_handleMouseDown(t){this._movingAnchorName=t.target.name().split(" ")[0];var n=this._getNodeRect(),r=n.width,i=n.height,o=Math.sqrt(Math.pow(r,2)+Math.pow(i,2));this.sin=Math.abs(i/o),this.cos=Math.abs(r/o),typeof window<"u"&&(window.addEventListener("mousemove",this._handleMouseMove),window.addEventListener("touchmove",this._handleMouseMove),window.addEventListener("mouseup",this._handleMouseUp,!0),window.addEventListener("touchend",this._handleMouseUp,!0)),this._transforming=!0;var a=t.target.getAbsolutePosition(),s=t.target.getStage().getPointerPosition();this._anchorDragOffset={x:s.x-a.x,y:s.y-a.y},this._fire("transformstart",{evt:t.evt,target:this.getNode()}),this._nodes.forEach(l=>{l._fire("transformstart",{evt:t.evt,target:l})})}_handleMouseMove(t){var n,r,i,o=this.findOne("."+this._movingAnchorName),a=o.getStage();a.setPointersPositions(t);const s=a.getPointerPosition();let l={x:s.x-this._anchorDragOffset.x,y:s.y-this._anchorDragOffset.y};const u=o.getAbsolutePosition();this.anchorDragBoundFunc()&&(l=this.anchorDragBoundFunc()(u,l,t)),o.setAbsolutePosition(l);const c=o.getAbsolutePosition();if(!(u.x===c.x&&u.y===c.y)){if(this._movingAnchorName==="rotater"){var d=this._getNodeRect();n=o.x()-d.width/2,r=-o.y()+d.height/2;let M=Math.atan2(-r,n)+Math.PI/2;d.height<0&&(M-=Math.PI);var f=po.Konva.getAngle(this.rotation());const E=f+M,P=po.Konva.getAngle(this.rotationSnapTolerance()),L=P_e(this.rotationSnaps(),E,P)-d.rotation,O=T_e(d,L);this._fitNodesInto(O,t);return}var h=this.shiftBehavior(),p;h==="inverted"?p=this.keepRatio()&&!t.shiftKey:h==="none"?p=this.keepRatio():p=this.keepRatio()||t.shiftKey;var g=this.centeredScaling()||t.altKey;if(this._movingAnchorName==="top-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-right").x(),y:this.findOne(".bottom-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-left").x()>m.x?-1:1,v=this.findOne(".top-left").y()>m.y?-1:1;n=i*this.cos*_,r=i*this.sin*v,this.findOne(".top-left").x(m.x-n),this.findOne(".top-left").y(m.y-r)}}else if(this._movingAnchorName==="top-center")this.findOne(".top-left").y(o.y());else if(this._movingAnchorName==="top-right"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".bottom-left").x(),y:this.findOne(".bottom-left").y()};i=Math.sqrt(Math.pow(o.x()-m.x,2)+Math.pow(m.y-o.y(),2));var _=this.findOne(".top-right").x()m.y?-1:1;n=i*this.cos*_,r=i*this.sin*v,this.findOne(".top-right").x(m.x+n),this.findOne(".top-right").y(m.y-r)}var y=o.position();this.findOne(".top-left").y(y.y),this.findOne(".bottom-right").x(y.x)}else if(this._movingAnchorName==="middle-left")this.findOne(".top-left").x(o.x());else if(this._movingAnchorName==="middle-right")this.findOne(".bottom-right").x(o.x());else if(this._movingAnchorName==="bottom-left"){if(p){var m=g?{x:this.width()/2,y:this.height()/2}:{x:this.findOne(".top-right").x(),y:this.findOne(".top-right").y()};i=Math.sqrt(Math.pow(m.x-o.x(),2)+Math.pow(o.y()-m.y,2));var _=m.x{r._fire("transformend",{evt:t,target:r})}),this._movingAnchorName=null}}_fitNodesInto(t,n){var r=this._getNodeRect();const i=1;if(vt.Util._inRange(t.width,-this.padding()*2-i,i)){this.update();return}if(vt.Util._inRange(t.height,-this.padding()*2-i,i)){this.update();return}const o=this.flipEnabled();var a=new vt.Transform;if(a.rotate(po.Konva.getAngle(this.rotation())),this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("left")>=0){const d=a.point({x:-this.padding()*2,y:0});if(t.x+=d.x,t.y+=d.y,t.width+=this.padding()*2,this._movingAnchorName=this._movingAnchorName.replace("left","right"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,!o){this.update();return}}else if(this._movingAnchorName&&t.width<0&&this._movingAnchorName.indexOf("right")>=0){const d=a.point({x:this.padding()*2,y:0});if(this._movingAnchorName=this._movingAnchorName.replace("right","left"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.width+=this.padding()*2,!o){this.update();return}}if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("top")>=0){const d=a.point({x:0,y:-this.padding()*2});if(t.x+=d.x,t.y+=d.y,this._movingAnchorName=this._movingAnchorName.replace("top","bottom"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}else if(this._movingAnchorName&&t.height<0&&this._movingAnchorName.indexOf("bottom")>=0){const d=a.point({x:0,y:this.padding()*2});if(this._movingAnchorName=this._movingAnchorName.replace("bottom","top"),this._anchorDragOffset.x-=d.x,this._anchorDragOffset.y-=d.y,t.height+=this.padding()*2,!o){this.update();return}}if(this.boundBoxFunc()){const d=this.boundBoxFunc()(r,t);d?t=d:vt.Util.warn("boundBoxFunc returned falsy. You should return new bound rect from it!")}const s=1e7,l=new vt.Transform;l.translate(r.x,r.y),l.rotate(r.rotation),l.scale(r.width/s,r.height/s);const u=new vt.Transform;u.translate(t.x,t.y),u.rotate(t.rotation),u.scale(t.width/s,t.height/s);const c=u.multiply(l.invert());this._nodes.forEach(d=>{var f;const h=d.getParent().getAbsoluteTransform(),p=d.getTransform().copy();p.translate(d.offsetX(),d.offsetY());const m=new vt.Transform;m.multiply(h.copy().invert()).multiply(c).multiply(h).multiply(p);const _=m.decompose();d.setAttrs(_),this._fire("transform",{evt:n,target:d}),d._fire("transform",{evt:n,target:d}),(f=d.getLayer())===null||f===void 0||f.batchDraw()}),this.rotation(vt.Util._getRotation(t.rotation)),this._resetTransformCache(),this.update(),this.getLayer().batchDraw()}forceUpdate(){this._resetTransformCache(),this.update()}_batchChangeChild(t,n){this.findOne(t).setAttrs(n)}update(){var t,n=this._getNodeRect();this.rotation(vt.Util._getRotation(n.rotation));var r=n.width,i=n.height,o=this.enabledAnchors(),a=this.resizeEnabled(),s=this.padding(),l=this.anchorSize();const u=this.find("._anchor");u.forEach(d=>{d.setAttrs({width:l,height:l,offsetX:l/2,offsetY:l/2,stroke:this.anchorStroke(),strokeWidth:this.anchorStrokeWidth(),fill:this.anchorFill(),cornerRadius:this.anchorCornerRadius()})}),this._batchChangeChild(".top-left",{x:0,y:0,offsetX:l/2+s,offsetY:l/2+s,visible:a&&o.indexOf("top-left")>=0}),this._batchChangeChild(".top-center",{x:r/2,y:0,offsetY:l/2+s,visible:a&&o.indexOf("top-center")>=0}),this._batchChangeChild(".top-right",{x:r,y:0,offsetX:l/2-s,offsetY:l/2+s,visible:a&&o.indexOf("top-right")>=0}),this._batchChangeChild(".middle-left",{x:0,y:i/2,offsetX:l/2+s,visible:a&&o.indexOf("middle-left")>=0}),this._batchChangeChild(".middle-right",{x:r,y:i/2,offsetX:l/2-s,visible:a&&o.indexOf("middle-right")>=0}),this._batchChangeChild(".bottom-left",{x:0,y:i,offsetX:l/2+s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-left")>=0}),this._batchChangeChild(".bottom-center",{x:r/2,y:i,offsetY:l/2-s,visible:a&&o.indexOf("bottom-center")>=0}),this._batchChangeChild(".bottom-right",{x:r,y:i,offsetX:l/2-s,offsetY:l/2-s,visible:a&&o.indexOf("bottom-right")>=0}),this._batchChangeChild(".rotater",{x:r/2,y:-this.rotateAnchorOffset()*vt.Util._sign(i)-s,visible:this.rotateEnabled()}),this._batchChangeChild(".back",{width:r,height:i,visible:this.borderEnabled(),stroke:this.borderStroke(),strokeWidth:this.borderStrokeWidth(),dash:this.borderDash(),x:0,y:0});const c=this.anchorStyleFunc();c&&u.forEach(d=>{c(d)}),(t=this.getLayer())===null||t===void 0||t.batchDraw()}isTransforming(){return this._transforming}stopTransform(){if(this._transforming){this._removeEvents();var t=this.findOne("."+this._movingAnchorName);t&&t.stopDrag()}}destroy(){return this.getStage()&&this._cursorChange&&this.getStage().content&&(this.getStage().content.style.cursor=""),MI.Group.prototype.destroy.call(this),this.detach(),this._removeEvents(),this}toObject(){return II.Node.prototype.toObject.call(this)}clone(t){var n=II.Node.prototype.clone.call(this,t);return n}getClientRect(){return this.nodes().length>0?super.getClientRect():{x:0,y:0,width:0,height:0}}}xS.Transformer=lt;function k_e(e){return e instanceof Array||vt.Util.warn("enabledAnchors value should be an array"),e instanceof Array&&e.forEach(function(t){F1.indexOf(t)===-1&&vt.Util.warn("Unknown anchor name: "+t+". Available names are: "+F1.join(", "))}),e||[]}lt.prototype.className="Transformer";(0,__e._registerNode)(lt);yt.Factory.addGetterSetter(lt,"enabledAnchors",F1,k_e);yt.Factory.addGetterSetter(lt,"flipEnabled",!0,(0,Kl.getBooleanValidator)());yt.Factory.addGetterSetter(lt,"resizeEnabled",!0);yt.Factory.addGetterSetter(lt,"anchorSize",10,(0,Kl.getNumberValidator)());yt.Factory.addGetterSetter(lt,"rotateEnabled",!0);yt.Factory.addGetterSetter(lt,"rotationSnaps",[]);yt.Factory.addGetterSetter(lt,"rotateAnchorOffset",50,(0,Kl.getNumberValidator)());yt.Factory.addGetterSetter(lt,"rotationSnapTolerance",5,(0,Kl.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderEnabled",!0);yt.Factory.addGetterSetter(lt,"anchorStroke","rgb(0, 161, 255)");yt.Factory.addGetterSetter(lt,"anchorStrokeWidth",1,(0,Kl.getNumberValidator)());yt.Factory.addGetterSetter(lt,"anchorFill","white");yt.Factory.addGetterSetter(lt,"anchorCornerRadius",0,(0,Kl.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderStroke","rgb(0, 161, 255)");yt.Factory.addGetterSetter(lt,"borderStrokeWidth",1,(0,Kl.getNumberValidator)());yt.Factory.addGetterSetter(lt,"borderDash");yt.Factory.addGetterSetter(lt,"keepRatio",!0);yt.Factory.addGetterSetter(lt,"shiftBehavior","default");yt.Factory.addGetterSetter(lt,"centeredScaling",!1);yt.Factory.addGetterSetter(lt,"ignoreStroke",!1);yt.Factory.addGetterSetter(lt,"padding",0,(0,Kl.getNumberValidator)());yt.Factory.addGetterSetter(lt,"node");yt.Factory.addGetterSetter(lt,"nodes");yt.Factory.addGetterSetter(lt,"boundBoxFunc");yt.Factory.addGetterSetter(lt,"anchorDragBoundFunc");yt.Factory.addGetterSetter(lt,"anchorStyleFunc");yt.Factory.addGetterSetter(lt,"shouldOverdrawWholeArea",!1);yt.Factory.addGetterSetter(lt,"useSingleNodeRotation",!0);yt.Factory.backCompat(lt,{lineEnabled:"borderEnabled",rotateHandlerOffset:"rotateAnchorOffset",enabledHandlers:"enabledAnchors"});var wS={};Object.defineProperty(wS,"__esModule",{value:!0});wS.Wedge=void 0;const CS=ze,I_e=Rn,M_e=Ue,pj=Ce,R_e=Ue;class As extends I_e.Shape{_sceneFunc(t){t.beginPath(),t.arc(0,0,this.radius(),0,M_e.Konva.getAngle(this.angle()),this.clockwise()),t.lineTo(0,0),t.closePath(),t.fillStrokeShape(this)}getWidth(){return this.radius()*2}getHeight(){return this.radius()*2}setWidth(t){this.radius(t/2)}setHeight(t){this.radius(t/2)}}wS.Wedge=As;As.prototype.className="Wedge";As.prototype._centroid=!0;As.prototype._attrsAffectingSize=["radius"];(0,R_e._registerNode)(As);CS.Factory.addGetterSetter(As,"radius",0,(0,pj.getNumberValidator)());CS.Factory.addGetterSetter(As,"angle",0,(0,pj.getNumberValidator)());CS.Factory.addGetterSetter(As,"clockwise",!1);CS.Factory.backCompat(As,{angleDeg:"angle",getAngleDeg:"getAngle",setAngleDeg:"setAngle"});var ES={};Object.defineProperty(ES,"__esModule",{value:!0});ES.Blur=void 0;const $I=ze,O_e=Wt,$_e=Ce;function NI(){this.r=0,this.g=0,this.b=0,this.a=0,this.next=null}var N_e=[512,512,456,512,328,456,335,512,405,328,271,456,388,335,292,512,454,405,364,328,298,271,496,456,420,388,360,335,312,292,273,512,482,454,428,405,383,364,345,328,312,298,284,271,259,496,475,456,437,420,404,388,374,360,347,335,323,312,302,292,282,273,265,512,497,482,468,454,441,428,417,405,394,383,373,364,354,345,337,328,320,312,305,298,291,284,278,271,265,259,507,496,485,475,465,456,446,437,428,420,412,404,396,388,381,374,367,360,354,347,341,335,329,323,318,312,307,302,297,292,287,282,278,273,269,265,261,512,505,497,489,482,475,468,461,454,447,441,435,428,422,417,411,405,399,394,389,383,378,373,368,364,359,354,350,345,341,337,332,328,324,320,316,312,309,305,301,298,294,291,287,284,281,278,274,271,268,265,262,259,257,507,501,496,491,485,480,475,470,465,460,456,451,446,442,437,433,428,424,420,416,412,408,404,400,396,392,388,385,381,377,374,370,367,363,360,357,354,350,347,344,341,338,335,332,329,326,323,320,318,315,312,310,307,304,302,299,297,294,292,289,287,285,282,280,278,275,273,271,269,267,265,263,261,259],D_e=[9,11,12,13,13,14,14,15,15,15,15,16,16,16,16,17,17,17,17,17,17,17,18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24];function L_e(e,t){var n=e.data,r=e.width,i=e.height,o,a,s,l,u,c,d,f,h,p,m,_,v,y,g,b,S,x,w,C,T,A,k,D,M=t+t+1,E=r-1,P=i-1,N=t+1,L=N*(N+1)/2,O=new NI,R=null,$=O,z=null,V=null,H=N_e[t],Q=D_e[t];for(s=1;s>Q,k!==0?(k=255/k,n[c]=(f*H>>Q)*k,n[c+1]=(h*H>>Q)*k,n[c+2]=(p*H>>Q)*k):n[c]=n[c+1]=n[c+2]=0,f-=_,h-=v,p-=y,m-=g,_-=z.r,v-=z.g,y-=z.b,g-=z.a,l=d+((l=o+t+1)>Q,k>0?(k=255/k,n[l]=(f*H>>Q)*k,n[l+1]=(h*H>>Q)*k,n[l+2]=(p*H>>Q)*k):n[l]=n[l+1]=n[l+2]=0,f-=_,h-=v,p-=y,m-=g,_-=z.r,v-=z.g,y-=z.b,g-=z.a,l=o+((l=a+N)0&&L_e(t,n)};ES.Blur=F_e;$I.Factory.addGetterSetter(O_e.Node,"blurRadius",0,(0,$_e.getNumberValidator)(),$I.Factory.afterSetFilter);var AS={};Object.defineProperty(AS,"__esModule",{value:!0});AS.Brighten=void 0;const DI=ze,B_e=Wt,z_e=Ce,j_e=function(e){var t=this.brightness()*255,n=e.data,r=n.length,i;for(i=0;i255?255:i,o=o<0?0:o>255?255:o,a=a<0?0:a>255?255:a,n[s]=i,n[s+1]=o,n[s+2]=a};TS.Contrast=G_e;LI.Factory.addGetterSetter(V_e.Node,"contrast",0,(0,U_e.getNumberValidator)(),LI.Factory.afterSetFilter);var PS={};Object.defineProperty(PS,"__esModule",{value:!0});PS.Emboss=void 0;const kl=ze,kS=Wt,H_e=tn,gj=Ce,q_e=function(e){var t=this.embossStrength()*10,n=this.embossWhiteLevel()*255,r=this.embossDirection(),i=this.embossBlend(),o=0,a=0,s=e.data,l=e.width,u=e.height,c=l*4,d=u;switch(r){case"top-left":o=-1,a=-1;break;case"top":o=-1,a=0;break;case"top-right":o=-1,a=1;break;case"right":o=0,a=1;break;case"bottom-right":o=1,a=1;break;case"bottom":o=1,a=0;break;case"bottom-left":o=1,a=-1;break;case"left":o=0,a=-1;break;default:H_e.Util.error("Unknown emboss direction: "+r)}do{var f=(d-1)*c,h=o;d+h<1&&(h=0),d+h>u&&(h=0);var p=(d-1+h)*l*4,m=l;do{var _=f+(m-1)*4,v=a;m+v<1&&(v=0),m+v>l&&(v=0);var y=p+(m-1+v)*4,g=s[_]-s[y],b=s[_+1]-s[y+1],S=s[_+2]-s[y+2],x=g,w=x>0?x:-x,C=b>0?b:-b,T=S>0?S:-S;if(C>w&&(x=b),T>w&&(x=S),x*=t,i){var A=s[_]+x,k=s[_+1]+x,D=s[_+2]+x;s[_]=A>255?255:A<0?0:A,s[_+1]=k>255?255:k<0?0:k,s[_+2]=D>255?255:D<0?0:D}else{var M=n-x;M<0?M=0:M>255&&(M=255),s[_]=s[_+1]=s[_+2]=M}}while(--m)}while(--d)};PS.Emboss=q_e;kl.Factory.addGetterSetter(kS.Node,"embossStrength",.5,(0,gj.getNumberValidator)(),kl.Factory.afterSetFilter);kl.Factory.addGetterSetter(kS.Node,"embossWhiteLevel",.5,(0,gj.getNumberValidator)(),kl.Factory.afterSetFilter);kl.Factory.addGetterSetter(kS.Node,"embossDirection","top-left",null,kl.Factory.afterSetFilter);kl.Factory.addGetterSetter(kS.Node,"embossBlend",!1,null,kl.Factory.afterSetFilter);var IS={};Object.defineProperty(IS,"__esModule",{value:!0});IS.Enhance=void 0;const FI=ze,W_e=Wt,K_e=Ce;function iw(e,t,n,r,i){var o=n-t,a=i-r,s;return o===0?r+a/2:a===0?r:(s=(e-t)/o,s=a*s+r,s)}const X_e=function(e){var t=e.data,n=t.length,r=t[0],i=r,o,a=t[1],s=a,l,u=t[2],c=u,d,f,h=this.enhance();if(h!==0){for(f=0;fi&&(i=o),l=t[f+1],ls&&(s=l),d=t[f+2],dc&&(c=d);i===r&&(i=255,r=0),s===a&&(s=255,a=0),c===u&&(c=255,u=0);var p,m,_,v,y,g,b,S,x;for(h>0?(m=i+h*(255-i),_=r-h*(r-0),y=s+h*(255-s),g=a-h*(a-0),S=c+h*(255-c),x=u-h*(u-0)):(p=(i+r)*.5,m=i+h*(i-p),_=r+h*(r-p),v=(s+a)*.5,y=s+h*(s-v),g=a+h*(a-v),b=(c+u)*.5,S=c+h*(c-b),x=u+h*(u-b)),f=0;fv?_:v;var y=a,g=o,b,S,x=360/g*Math.PI/180,w,C;for(S=0;Sg?y:g;var b=a,S=o,x,w,C=n.polarRotation||0,T,A;for(c=0;ct&&(b=g,S=0,x=-1),i=0;i=0&&h=0&&p=0&&h=0&&p=255*4?255:0}return a}function cSe(e,t,n){for(var r=[.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111,.1111111111111111],i=Math.round(Math.sqrt(r.length)),o=Math.floor(i/2),a=[],s=0;s=0&&h=0&&p=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,s+=b[a+0],l+=b[a+1],u+=b[a+2],c+=b[a+3],g+=1);for(s=s/g,l=l/g,u=u/g,c=c/g,i=h;i=n))for(o=m;o<_;o+=1)o>=r||(a=(n*o+i)*4,b[a+0]=s,b[a+1]=l,b[a+2]=u,b[a+3]=c)}};FS.Pixelate=vSe;VI.Factory.addGetterSetter(mSe.Node,"pixelSize",8,(0,ySe.getNumberValidator)(),VI.Factory.afterSetFilter);var BS={};Object.defineProperty(BS,"__esModule",{value:!0});BS.Posterize=void 0;const UI=ze,bSe=Wt,_Se=Ce,SSe=function(e){var t=Math.round(this.levels()*254)+1,n=e.data,r=n.length,i=255/t,o;for(o=0;o255?255:e<0?0:Math.round(e)});z1.Factory.addGetterSetter(wA.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});z1.Factory.addGetterSetter(wA.Node,"blue",0,xSe.RGBComponent,z1.Factory.afterSetFilter);var jS={};Object.defineProperty(jS,"__esModule",{value:!0});jS.RGBA=void 0;const Ag=ze,VS=Wt,CSe=Ce,ESe=function(e){var t=e.data,n=t.length,r=this.red(),i=this.green(),o=this.blue(),a=this.alpha(),s,l;for(s=0;s255?255:e<0?0:Math.round(e)});Ag.Factory.addGetterSetter(VS.Node,"green",0,function(e){return this._filterUpToDate=!1,e>255?255:e<0?0:Math.round(e)});Ag.Factory.addGetterSetter(VS.Node,"blue",0,CSe.RGBComponent,Ag.Factory.afterSetFilter);Ag.Factory.addGetterSetter(VS.Node,"alpha",1,function(e){return this._filterUpToDate=!1,e>1?1:e<0?0:e});var US={};Object.defineProperty(US,"__esModule",{value:!0});US.Sepia=void 0;const ASe=function(e){var t=e.data,n=t.length,r,i,o,a;for(r=0;r127&&(u=255-u),c>127&&(c=255-c),d>127&&(d=255-d),t[l]=u,t[l+1]=c,t[l+2]=d}while(--s)}while(--o)};GS.Solarize=TSe;var HS={};Object.defineProperty(HS,"__esModule",{value:!0});HS.Threshold=void 0;const GI=ze,PSe=Wt,kSe=Ce,ISe=function(e){var t=this.threshold()*255,n=e.data,r=n.length,i;for(i=0;i{const{width:r,height:i}=t,o=document.createElement("div"),a=new mh.Stage({container:o,width:r,height:i}),s=new mh.Layer,l=new mh.Layer;return s.add(new mh.Rect({...t,fill:n?"black":"white"})),e.forEach(u=>l.add(new mh.Line({points:u.points,stroke:n?"white":"black",strokeWidth:u.strokeWidth*2,tension:0,lineCap:"round",lineJoin:"round",shadowForStrokeEnabled:!1,globalCompositeOperation:u.tool==="brush"?"source-over":"destination-out"}))),a.add(s),a.add(l),o.remove(),a},m2e=async(e,t,n)=>new Promise((r,i)=>{const o=document.createElement("canvas");o.width=t,o.height=n;const a=o.getContext("2d"),s=new Image;if(!a){o.remove(),i("Unable to get context");return}s.onload=function(){a.drawImage(s,0,0),o.remove(),r(a.getImageData(0,0,t,n))},s.src=e}),WI=async(e,t)=>{const n=e.toDataURL(t);return await m2e(n,t.width,t.height)},CA=async(e,t,n,r,i)=>{const o=le("canvas"),a=Z_(),s=c1e();if(!a||!s){o.error("Unable to find canvas / stage");return}const l={...t,...n},u=a.clone();u.scale({x:1,y:1});const c=u.getAbsolutePosition(),d={x:l.x+c.x,y:l.y+c.y,width:l.width,height:l.height},f=await D1(u,d),h=await WI(u,d),p=await g2e(r?e.objects.filter(oL):[],l,i),m=await D1(p,l),_=await WI(p,l);return{baseBlob:f,baseImageData:h,maskBlob:m,maskImageData:_}},y2e=()=>{pe({actionCreator:r1e,effect:async(e,{dispatch:t,getState:n})=>{const r=le("canvas"),i=n(),o=await CA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!o)return;const{maskBlob:a}=o;if(!a){r.error("Problem getting mask layer blob"),t(nt({title:K("toast.problemSavingMask"),description:K("toast.problemSavingMaskDesc"),status:"error"}));return}const{autoAddBoardId:s}=i.gallery;t(ue.endpoints.uploadImage.initiate({file:new File([a],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:s==="none"?void 0:s,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.maskSavedAssets")}}}))}})},v2e=()=>{pe({actionCreator:l1e,effect:async(e,{dispatch:t,getState:n})=>{const r=le("canvas"),i=n(),{id:o}=e.payload,a=await CA(i.canvas.layerState,i.canvas.boundingBoxCoordinates,i.canvas.boundingBoxDimensions,i.canvas.isMaskEnabled,i.canvas.shouldPreserveMaskedArea);if(!a)return;const{maskBlob:s}=a;if(!s){r.error("Problem getting mask layer blob"),t(nt({title:K("toast.problemImportingMask"),description:K("toast.problemImportingMaskDesc"),status:"error"}));return}const{autoAddBoardId:l}=i.gallery,u=await t(ue.endpoints.uploadImage.initiate({file:new File([s],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!1,board_id:l==="none"?void 0:l,crop_visible:!1,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.maskSentControlnetAssets")}}})).unwrap(),{image_name:c}=u;t(jl({id:o,controlImage:c}))}})},b2e=async()=>{const e=Z_();if(!e)return;const t=e.clone();return t.scale({x:1,y:1}),D1(t,t.getClientRect())},_2e=()=>{pe({actionCreator:a1e,effect:async(e,{dispatch:t})=>{const n=V_.get().child({namespace:"canvasCopiedToClipboardListener"}),r=await b2e();if(!r){n.error("Problem getting base layer blob"),t(nt({title:K("toast.problemMergingCanvas"),description:K("toast.problemMergingCanvasDesc"),status:"error"}));return}const i=Z_();if(!i){n.error("Problem getting canvas base layer"),t(nt({title:K("toast.problemMergingCanvas"),description:K("toast.problemMergingCanvasDesc"),status:"error"}));return}const o=i.getClientRect({relativeTo:i.getParent()??void 0}),a=await t(ue.endpoints.uploadImage.initiate({file:new File([r],"mergedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!0,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.canvasMerged")}}})).unwrap(),{image_name:s}=a;t(rle({kind:"image",layer:"base",imageName:s,...o}))}})},S2e=()=>{pe({actionCreator:n1e,effect:async(e,{dispatch:t,getState:n})=>{const r=le("canvas"),i=n();let o;try{o=await J_(i)}catch(s){r.error(String(s)),t(nt({title:K("toast.problemSavingCanvas"),description:K("toast.problemSavingCanvasDesc"),status:"error"}));return}const{autoAddBoardId:a}=i.gallery;t(ue.endpoints.uploadImage.initiate({file:new File([o],"savedCanvas.png",{type:"image/png"}),image_category:"general",is_intermediate:!1,board_id:a==="none"?void 0:a,crop_visible:!0,postUploadAction:{type:"TOAST",toastOptions:{title:K("toast.canvasSavedGallery")}}}))}})},x2e=(e,t,n)=>{if(!(cie.match(e)||s6.match(e)||jl.match(e)||die.match(e)||l6.match(e)))return!1;const{id:i}=e.payload,o=Tr(n.controlAdapters,i),a=Tr(t.controlAdapters,i);if(!o||!di(o)||!a||!di(a)||l6.match(e)&&o.shouldAutoConfig===!0)return!1;const{controlImage:s,processorType:l,shouldAutoConfig:u}=a;return s6.match(e)&&!u?!1:l!=="none"&&!!s},w2e=()=>{pe({predicate:x2e,effect:async(e,{dispatch:t,cancelActiveListeners:n,delay:r})=>{const i=le("session"),{id:o}=e.payload;n(),i.trace("ControlNet auto-process triggered"),await r(300),t(gE({id:o}))}})},ft=e=>{try{return JSON.parse(JSON.stringify(e))}catch{return"Error parsing object"}},Se="positive_conditioning",xe="negative_conditioning",se="denoise_latents",Vc="denoise_latents_hrf",Ee="latents_to_image",id="latents_to_image_hrf",Ao="save_image",Fu="nsfw_checker",od="invisible_watermark",ye="noise",yh="noise_hrf",Ts="main_model_loader",qS="onnx_model_loader",ho="vae_loader",vj="lora_loader",st="clip_skip",Dt="image_to_latents",oa="resize_image",Nc="rescale_latents",Dd="img2img_resize",de="canvas_output",Ft="inpaint_image",nr="inpaint_image_resize_up",yr="inpaint_image_resize_down",it="inpaint_infill",ol="inpaint_infill_resize_down",Lt="inpaint_create_mask",Re="canvas_coherence_denoise_latents",tt="canvas_coherence_noise",Il="canvas_coherence_noise_increment",sn="canvas_coherence_mask_edge",Ze="canvas_coherence_inpaint_create_mask",Ld="tomask",pr="mask_blur",er="mask_combine",Tt="mask_resize_up",vr="mask_resize_down",vh="control_net_collect",q0="ip_adapter_collect",bh="t2i_adapter_collect",xo="core_metadata",ow="esrgan",gr="sdxl_model_loader",ae="sdxl_denoise_latents",su="sdxl_refiner_model_loader",W0="sdxl_refiner_positive_conditioning",K0="sdxl_refiner_negative_conditioning",qo="sdxl_refiner_denoise_latents",Ni="refiner_inpaint_create_mask",kn="seamless",wo="refiner_seamless",bj="text_to_image_graph",K5="image_to_image_graph",_j="canvas_text_to_image_graph",X5="canvas_image_to_image_graph",WS="canvas_inpaint_graph",KS="canvas_outpaint_graph",EA="sdxl_text_to_image_graph",j1="sxdl_image_to_image_graph",XS="sdxl_canvas_text_to_image_graph",Tg="sdxl_canvas_image_to_image_graph",Ml="sdxl_canvas_inpaint_graph",Rl="sdxl_canvas_outpaint_graph",Sj=e=>(e==null?void 0:e.type)==="image_output",C2e=()=>{pe({actionCreator:gE,effect:async(e,{dispatch:t,getState:n,take:r})=>{var l;const i=le("session"),{id:o}=e.payload,a=Tr(n().controlAdapters,o);if(!(a!=null&&a.controlImage)||!di(a)){i.error("Unable to process ControlNet image");return}if(a.processorType==="none"||a.processorNode.type==="none")return;const s={prepend:!0,batch:{graph:{nodes:{[a.processorNode.id]:{...a.processorNode,is_intermediate:!0,image:{image_name:a.controlImage}},[Ao]:{id:Ao,type:"save_image",is_intermediate:!0,use_cache:!1}},edges:[{source:{node_id:a.processorNode.id,field:"image"},destination:{node_id:Ao,field:"image"}}]},runs:1}};try{const u=t(ln.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})),c=await u.unwrap();u.reset(),i.debug({enqueueResult:ft(c)},K("queue.graphQueued"));const[d]=await r(f=>dE.match(f)&&f.payload.data.queue_batch_id===c.batch.batch_id&&f.payload.data.source_node_id===Ao);if(Sj(d.payload.data.result)){const{image_name:f}=d.payload.data.result.image,[{payload:h}]=await r(m=>ue.endpoints.getImageDTO.matchFulfilled(m)&&m.payload.image_name===f),p=h;i.debug({controlNetId:e.payload,processedControlImage:p},"ControlNet image processed"),t(_E({id:o,processedControlImage:p.image_name}))}}catch(u){if(i.error({enqueueBatchArg:ft(s)},K("queue.graphFailedToQueue")),u instanceof Object&&"data"in u&&"status"in u&&u.status===403){const c=((l=u.data)==null?void 0:l.detail)||"Unknown Error";t(nt({title:K("queue.graphFailedToQueue"),status:"error",description:c,duration:15e3})),t(hie()),t(jl({id:o,controlImage:null}));return}t(nt({title:K("queue.graphFailedToQueue"),status:"error"}))}}})},AA=ve("app/enqueueRequested");ve("app/batchEnqueued");const E2e=e=>{const t=window.open("");t&&e.forEach(n=>{const r=new Image;r.src=n.base64,t.document.write(n.caption),t.document.write("
"),t.document.write(r.outerHTML),t.document.write("

")})},KI=e=>new Promise((t,n)=>{const r=new FileReader;r.onload=i=>t(r.result),r.onerror=i=>n(r.error),r.onabort=i=>n(new Error("Read aborted")),r.readAsDataURL(e)}),A2e=e=>{let t=!0,n=!1;const r=e.length;let i=3;for(i;i{const t=e.length;let n=0;for(n;n{const{isPartiallyTransparent:n,isFullyTransparent:r}=A2e(e.data),i=T2e(t.data);return n?r?"txt2img":"outpaint":i?"inpaint":"img2img"},Ps=(e,t)=>{e.nodes[xo]={id:xo,type:"core_metadata",...t},e.edges.push({source:{node_id:xo,field:"metadata"},destination:{node_id:Ao,field:"metadata"}})},Lo=(e,t)=>{const n=e.nodes[xo];n&&Object.assign(n,t)},_h=(e,t)=>{const n=e.nodes[xo];n&&delete n[t]},Sh=e=>!!e.nodes[xo],Ji=(e,t,n)=>{const r=iie(e.controlAdapters).filter(o=>{var a,s;return((a=o.model)==null?void 0:a.base_model)===((s=e.generation.model)==null?void 0:s.base_model)}),i=[];if(r.length){const o={id:vh,type:"collect",is_intermediate:!0};t.nodes[vh]=o,t.edges.push({source:{node_id:vh,field:"collection"},destination:{node_id:n,field:"control"}}),Re in t.nodes&&t.edges.push({source:{node_id:vh,field:"collection"},destination:{node_id:Re,field:"control"}}),r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,controlMode:f,resizeMode:h,model:p,processorType:m,weight:_}=a,v={id:`control_net_${s}`,type:"controlnet",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,control_mode:f,resize_mode:h,control_model:p,control_weight:_};if(u&&m!=="none")v.image={image_name:u};else if(l)v.image={image_name:l};else return;t.nodes[v.id]=v,i.push(Mf(v,["id","type","is_intermediate"])),t.edges.push({source:{node_id:v.id,field:"control"},destination:{node_id:vh,field:"item"}})}),Lo(t,{controlnets:i})}},eo=(e,t,n)=>{const r=aie(e.controlAdapters).filter(i=>{var o,a;return((o=i.model)==null?void 0:o.base_model)===((a=e.generation.model)==null?void 0:a.base_model)});if(r.length){const i={id:q0,type:"collect",is_intermediate:!0};t.nodes[q0]=i,t.edges.push({source:{node_id:q0,field:"collection"},destination:{node_id:n,field:"ip_adapter"}}),Re in t.nodes&&t.edges.push({source:{node_id:q0,field:"collection"},destination:{node_id:Re,field:"ip_adapter"}});const o=[];r.forEach(a=>{if(!a.model)return;const{id:s,weight:l,model:u,beginStepPct:c,endStepPct:d}=a,f={id:`ip_adapter_${s}`,type:"ip_adapter",is_intermediate:!0,weight:l,ip_adapter_model:u,begin_step_percent:c,end_step_percent:d};if(a.controlImage)f.image={image_name:a.controlImage};else return;t.nodes[f.id]=f,o.push(Mf(f,["id","type","is_intermediate"])),t.edges.push({source:{node_id:f.id,field:"ip_adapter"},destination:{node_id:i.id,field:"item"}})}),Lo(t,{ipAdapters:o})}},Bf=(e,t,n,r=Ts)=>{const{loras:i}=e.lora,o=Kb(i);if(o===0)return;t.edges=t.edges.filter(u=>!(u.source.node_id===r&&["unet"].includes(u.source.field))),t.edges=t.edges.filter(u=>!(u.source.node_id===st&&["clip"].includes(u.source.field)));let a="",s=0;const l=[];hs(i,u=>{const{model_name:c,base_model:d,weight:f}=u,h=`${vj}_${c.replace(".","_")}`,p={type:"lora_loader",id:h,is_intermediate:!0,lora:{model_name:c,base_model:d},weight:f};l.push({lora:{model_name:c,base_model:d},weight:f}),t.nodes[h]=p,s===0?(t.edges.push({source:{node_id:r,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:st,field:"clip"},destination:{node_id:h,field:"clip"}})):(t.edges.push({source:{node_id:a,field:"unet"},destination:{node_id:h,field:"unet"}}),t.edges.push({source:{node_id:a,field:"clip"},destination:{node_id:h,field:"clip"}})),s===o-1&&(t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[WS,KS].includes(t.id)&&t.edges.push({source:{node_id:h,field:"unet"},destination:{node_id:Re,field:"unet"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:Se,field:"clip"}}),t.edges.push({source:{node_id:h,field:"clip"},destination:{node_id:xe,field:"clip"}})),a=h,s+=1}),Lo(t,{loras:l})},to=(e,t,n=Ee)=>{const r=t.nodes[n];if(!r)return;r.is_intermediate=!0,r.use_cache=!0;const i={id:Fu,type:"img_nsfw",is_intermediate:!0};t.nodes[Fu]=i,t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:Fu,field:"image"}})},k2e=["txt2img","img2img","unifiedCanvas","nodes","modelManager","queue"],TA=ir(e=>e,({ui:e})=>oE(e.activeTab)?e.activeTab:"txt2img"),BVe=ir(e=>e,({ui:e,config:t})=>{const r=k2e.filter(i=>!t.disabledTabs.includes(i)).indexOf(e.activeTab);return r===-1?0:r}),zVe=ir(e=>e.ui,e=>e,{memoizeOptions:{equalityCheck:aE}}),no=(e,t)=>{const r=TA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,{autoAddBoardId:i}=e.gallery,o={id:Ao,type:"save_image",is_intermediate:r,use_cache:!1,board:i==="none"?void 0:{board_id:i}};t.nodes[Ao]=o;const a={node_id:Ao,field:"image"};od in t.nodes?t.edges.push({source:{node_id:od,field:"image"},destination:a}):Fu in t.nodes?t.edges.push({source:{node_id:Fu,field:"image"},destination:a}):de in t.nodes?t.edges.push({source:{node_id:de,field:"image"},destination:a}):id in t.nodes?t.edges.push({source:{node_id:id,field:"image"},destination:a}):Ee in t.nodes&&t.edges.push({source:{node_id:Ee,field:"image"},destination:a})},ro=(e,t,n)=>{const{seamlessXAxis:r,seamlessYAxis:i}=e.generation;t.nodes[kn]={id:kn,type:"seamless",seamless_x:r,seamless_y:i},r&&Lo(t,{seamless_x:r}),i&&Lo(t,{seamless_y:i});let o=se;(t.id===EA||t.id===j1||t.id===XS||t.id===Tg||t.id===Ml||t.id===Rl)&&(o=ae),t.edges=t.edges.filter(a=>!(a.source.node_id===n&&["unet"].includes(a.source.field))&&!(a.source.node_id===n&&["vae"].includes(a.source.field))),t.edges.push({source:{node_id:n,field:"unet"},destination:{node_id:kn,field:"unet"}},{source:{node_id:n,field:"vae"},destination:{node_id:kn,field:"vae"}},{source:{node_id:kn,field:"unet"},destination:{node_id:o,field:"unet"}}),(t.id==WS||t.id===KS||t.id===Ml||t.id===Rl)&&t.edges.push({source:{node_id:kn,field:"unet"},destination:{node_id:Re,field:"unet"}})},io=(e,t,n)=>{const r=sie(e.controlAdapters).filter(i=>{var o,a;return((o=i.model)==null?void 0:o.base_model)===((a=e.generation.model)==null?void 0:a.base_model)});if(r.length){const i={id:bh,type:"collect",is_intermediate:!0};t.nodes[bh]=i,t.edges.push({source:{node_id:bh,field:"collection"},destination:{node_id:n,field:"t2i_adapter"}}),Re in t.nodes&&t.edges.push({source:{node_id:bh,field:"collection"},destination:{node_id:Re,field:"t2i_adapter"}});const o=[];r.forEach(a=>{if(!a.model)return;const{id:s,controlImage:l,processedControlImage:u,beginStepPct:c,endStepPct:d,resizeMode:f,model:h,processorType:p,weight:m}=a,_={id:`t2i_adapter_${s}`,type:"t2i_adapter",is_intermediate:!0,begin_step_percent:c,end_step_percent:d,resize_mode:f,t2i_adapter_model:h,weight:m};if(u&&p!=="none")_.image={image_name:u};else if(l)_.image={image_name:l};else return;t.nodes[_.id]=_,o.push(Mf(_,["id","type","is_intermediate"])),t.edges.push({source:{node_id:_.id,field:"t2i_adapter"},destination:{node_id:bh,field:"item"}})}),Lo(t,{t2iAdapters:o})}},oo=(e,t,n=Ts)=>{const{vae:r,canvasCoherenceMode:i}=e.generation,{boundingBoxScaleMethod:o}=e.canvas,{shouldUseSDXLRefiner:a}=e.sdxl,s=["auto","manual"].includes(o),l=!r;l||(t.nodes[ho]={type:"vae_loader",id:ho,is_intermediate:!0,vae_model:r});const u=n==qS;(t.id===bj||t.id===K5||t.id===EA||t.id===j1)&&t.edges.push({source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Ee,field:"vae"}}),(t.id===_j||t.id===X5||t.id===XS||t.id==Tg)&&t.edges.push({source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:s?Ee:de,field:"vae"}}),(t.id===K5||t.id===j1||t.id===X5||t.id===Tg)&&t.edges.push({source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Dt,field:"vae"}}),(t.id===WS||t.id===KS||t.id===Ml||t.id===Rl)&&(t.edges.push({source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Ft,field:"vae"}},{source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Lt,field:"vae"}},{source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Ee,field:"vae"}}),i!=="unmasked"&&t.edges.push({source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Ze,field:"vae"}})),a&&(t.id===Ml||t.id===Rl)&&t.edges.push({source:{node_id:l?n:ho,field:l&&u?"vae_decoder":"vae"},destination:{node_id:Ni,field:"vae"}}),r&&Lo(t,{vae:r})},ao=(e,t,n=Ee)=>{const i=TA(e)==="unifiedCanvas"?!e.canvas.shouldAutoSave:!1,o=t.nodes[n],a=t.nodes[Fu];if(!o)return;const s={id:od,type:"img_watermark",is_intermediate:i};t.nodes[od]=s,o.is_intermediate=!0,o.use_cache=!0,a?(a.is_intermediate=!0,t.edges.push({source:{node_id:Fu,field:"image"},destination:{node_id:od,field:"image"}})):t.edges.push({source:{node_id:n,field:"image"},destination:{node_id:od,field:"image"}})},I2e=(e,t)=>{const n=le("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,img2imgStrength:c,vaePrecision:d,clipSkip:f,shouldUseCpuNoise:h,seamlessXAxis:p,seamlessYAxis:m}=e.generation,{width:_,height:v}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:y,boundingBoxScaleMethod:g}=e.canvas,b=d==="fp32",S=!0,x=["auto","manual"].includes(g);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let w=Ts;const C=h,T={id:X5,nodes:{[w]:{type:"main_model_loader",id:w,is_intermediate:S,model:o},[st]:{type:"clip_skip",id:st,is_intermediate:S,skipped_layers:f},[Se]:{type:"compel",id:Se,is_intermediate:S,prompt:r},[xe]:{type:"compel",id:xe,is_intermediate:S,prompt:i},[ye]:{type:"noise",id:ye,is_intermediate:S,use_cpu:C,seed:l,width:x?y.width:_,height:x?y.height:v},[Dt]:{type:"i2l",id:Dt,is_intermediate:S},[se]:{type:"denoise_latents",id:se,is_intermediate:S,cfg_scale:a,scheduler:s,steps:u,denoising_start:1-c,denoising_end:1},[de]:{type:"l2i",id:de,is_intermediate:S}},edges:[{source:{node_id:w,field:"unet"},destination:{node_id:se,field:"unet"}},{source:{node_id:w,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:se,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:se,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:se,field:"noise"}},{source:{node_id:Dt,field:"latents"},destination:{node_id:se,field:"latents"}}]};return x?(T.nodes[Dd]={id:Dd,type:"img_resize",is_intermediate:S,image:t,width:y.width,height:y.height},T.nodes[Ee]={id:Ee,type:"l2i",is_intermediate:S,fp32:b},T.nodes[de]={id:de,type:"img_resize",is_intermediate:S,width:_,height:v},T.edges.push({source:{node_id:Dd,field:"image"},destination:{node_id:Dt,field:"image"}},{source:{node_id:se,field:"latents"},destination:{node_id:Ee,field:"latents"}},{source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}})):(T.nodes[de]={type:"l2i",id:de,is_intermediate:S,fp32:b},T.nodes[Dt].image=t,T.edges.push({source:{node_id:se,field:"latents"},destination:{node_id:de,field:"latents"}})),Ps(T,{generation_mode:"img2img",cfg_scale:a,width:x?y.width:_,height:x?y.height:v,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:C?"cpu":"cuda",scheduler:s,clip_skip:f,strength:c,init_image:t.image_name}),(p||m)&&(ro(e,T,w),w=kn),Bf(e,T,se),oo(e,T,w),Ji(e,T,se),eo(e,T,se),io(e,T,se),e.system.shouldUseNSFWChecker&&to(e,T,de),e.system.shouldUseWatermarker&&ao(e,T,de),no(e,T),T},M2e=(e,t,n)=>{const r=le("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,maskBlurMethod:m,canvasCoherenceMode:_,canvasCoherenceSteps:v,canvasCoherenceStrength:y,clipSkip:g,seamlessXAxis:b,seamlessYAxis:S}=e.generation;if(!a)throw r.error("No Image found in state"),new Error("No Image found in state");const{width:x,height:w}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:C,boundingBoxScaleMethod:T}=e.canvas,A=!0,k=f==="fp32",D=["auto","manual"].includes(T);let M=Ts;const E=h,P={id:WS,nodes:{[M]:{type:"main_model_loader",id:M,is_intermediate:A,model:a},[st]:{type:"clip_skip",id:st,is_intermediate:A,skipped_layers:g},[Se]:{type:"compel",id:Se,is_intermediate:A,prompt:i},[xe]:{type:"compel",id:xe,is_intermediate:A,prompt:o},[pr]:{type:"img_blur",id:pr,is_intermediate:A,radius:p,blur_type:m},[Ft]:{type:"i2l",id:Ft,is_intermediate:A,fp32:k},[ye]:{type:"noise",id:ye,use_cpu:E,seed:d,is_intermediate:A},[Lt]:{type:"create_denoise_mask",id:Lt,is_intermediate:A,fp32:k},[se]:{type:"denoise_latents",id:se,is_intermediate:A,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[tt]:{type:"noise",id:tt,use_cpu:E,seed:d+1,is_intermediate:A},[Il]:{type:"add",id:Il,b:1,is_intermediate:A},[Re]:{type:"denoise_latents",id:Re,is_intermediate:A,steps:v,cfg_scale:s,scheduler:l,denoising_start:1-y,denoising_end:1},[Ee]:{type:"l2i",id:Ee,is_intermediate:A,fp32:k},[de]:{type:"color_correct",id:de,is_intermediate:A,reference:t}},edges:[{source:{node_id:M,field:"unet"},destination:{node_id:se,field:"unet"}},{source:{node_id:M,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:se,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:se,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:se,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:se,field:"latents"}},{source:{node_id:pr,field:"image"},destination:{node_id:Lt,field:"mask"}},{source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:se,field:"denoise_mask"}},{source:{node_id:M,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:se,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:Re,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};if(D){const N=C.width,L=C.height;P.nodes[nr]={type:"img_resize",id:nr,is_intermediate:A,width:N,height:L,image:t},P.nodes[Tt]={type:"img_resize",id:Tt,is_intermediate:A,width:N,height:L,image:n},P.nodes[yr]={type:"img_resize",id:yr,is_intermediate:A,width:x,height:w},P.nodes[vr]={type:"img_resize",id:vr,is_intermediate:A,width:x,height:w},P.nodes[ye].width=N,P.nodes[ye].height=L,P.nodes[tt].width=N,P.nodes[tt].height=L,P.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:Ft,field:"image"}},{source:{node_id:Tt,field:"image"},destination:{node_id:pr,field:"image"}},{source:{node_id:nr,field:"image"},destination:{node_id:Lt,field:"image"}},{source:{node_id:Ee,field:"image"},destination:{node_id:yr,field:"image"}},{source:{node_id:yr,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:pr,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:de,field:"mask"}})}else P.nodes[ye].width=x,P.nodes[ye].height=w,P.nodes[tt].width=x,P.nodes[tt].height=w,P.nodes[Ft]={...P.nodes[Ft],image:t},P.nodes[pr]={...P.nodes[pr],image:n},P.nodes[Lt]={...P.nodes[Lt],image:t},P.edges.push({source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:pr,field:"image"},destination:{node_id:de,field:"mask"}});return _!=="unmasked"&&(P.nodes[Ze]={type:"create_denoise_mask",id:Ze,is_intermediate:A,fp32:k},D?P.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:Ze,field:"image"}}):P.nodes[Ze]={...P.nodes[Ze],image:t},_==="mask"&&(D?P.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:Ze,field:"mask"}}):P.nodes[Ze]={...P.nodes[Ze],mask:n}),_==="edge"&&(P.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:A,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},D?P.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:sn,field:"image"}}):P.nodes[sn]={...P.nodes[sn],image:n},P.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Ze,field:"mask"}})),P.edges.push({source:{node_id:Ze,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(b||S)&&(ro(e,P,M),M=kn),oo(e,P,M),Bf(e,P,se,M),Ji(e,P,se),eo(e,P,se),io(e,P,se),e.system.shouldUseNSFWChecker&&to(e,P,de),e.system.shouldUseWatermarker&&ao(e,P,de),no(e,P),P},R2e=(e,t,n)=>{const r=le("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,img2imgStrength:c,seed:d,vaePrecision:f,shouldUseCpuNoise:h,maskBlur:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:v,infillTileSize:y,infillPatchmatchDownscaleSize:g,infillMethod:b,clipSkip:S,seamlessXAxis:x,seamlessYAxis:w}=e.generation;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:C,height:T}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:A,boundingBoxScaleMethod:k}=e.canvas,D=f==="fp32",M=!0,E=["auto","manual"].includes(k);let P=Ts;const N=h,L={id:KS,nodes:{[P]:{type:"main_model_loader",id:P,is_intermediate:M,model:a},[st]:{type:"clip_skip",id:st,is_intermediate:M,skipped_layers:S},[Se]:{type:"compel",id:Se,is_intermediate:M,prompt:i},[xe]:{type:"compel",id:xe,is_intermediate:M,prompt:o},[Ld]:{type:"tomask",id:Ld,is_intermediate:M,image:t},[er]:{type:"mask_combine",id:er,is_intermediate:M,mask2:n},[Ft]:{type:"i2l",id:Ft,is_intermediate:M,fp32:D},[ye]:{type:"noise",id:ye,use_cpu:N,seed:d,is_intermediate:M},[Lt]:{type:"create_denoise_mask",id:Lt,is_intermediate:M,fp32:D},[se]:{type:"denoise_latents",id:se,is_intermediate:M,steps:u,cfg_scale:s,scheduler:l,denoising_start:1-c,denoising_end:1},[tt]:{type:"noise",id:tt,use_cpu:N,seed:d+1,is_intermediate:M},[Il]:{type:"add",id:Il,b:1,is_intermediate:M},[Re]:{type:"denoise_latents",id:Re,is_intermediate:M,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[Ee]:{type:"l2i",id:Ee,is_intermediate:M,fp32:D},[de]:{type:"color_correct",id:de,is_intermediate:M}},edges:[{source:{node_id:P,field:"unet"},destination:{node_id:se,field:"unet"}},{source:{node_id:P,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:it,field:"image"},destination:{node_id:Ft,field:"image"}},{source:{node_id:Ld,field:"image"},destination:{node_id:er,field:"mask1"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:se,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:se,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:se,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:se,field:"latents"}},{source:{node_id:E?Tt:er,field:"image"},destination:{node_id:Lt,field:"mask"}},{source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:se,field:"denoise_mask"}},{source:{node_id:P,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:se,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:it,field:"image"},destination:{node_id:Lt,field:"image"}},{source:{node_id:Re,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};if(b==="patchmatch"&&(L.nodes[it]={type:"infill_patchmatch",id:it,is_intermediate:M,downscale:g}),b==="lama"&&(L.nodes[it]={type:"infill_lama",id:it,is_intermediate:M}),b==="cv2"&&(L.nodes[it]={type:"infill_cv2",id:it,is_intermediate:M}),b==="tile"&&(L.nodes[it]={type:"infill_tile",id:it,is_intermediate:M,tile_size:y}),E){const O=A.width,R=A.height;L.nodes[nr]={type:"img_resize",id:nr,is_intermediate:M,width:O,height:R,image:t},L.nodes[Tt]={type:"img_resize",id:Tt,is_intermediate:M,width:O,height:R},L.nodes[yr]={type:"img_resize",id:yr,is_intermediate:M,width:C,height:T},L.nodes[ol]={type:"img_resize",id:ol,is_intermediate:M,width:C,height:T},L.nodes[vr]={type:"img_resize",id:vr,is_intermediate:M,width:C,height:T},L.nodes[ye].width=O,L.nodes[ye].height=R,L.nodes[tt].width=O,L.nodes[tt].height=R,L.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:it,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:Tt,field:"image"}},{source:{node_id:Ee,field:"image"},destination:{node_id:yr,field:"image"}},{source:{node_id:Tt,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:it,field:"image"},destination:{node_id:ol,field:"image"}},{source:{node_id:ol,field:"image"},destination:{node_id:de,field:"reference"}},{source:{node_id:yr,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:de,field:"mask"}})}else L.nodes[it]={...L.nodes[it],image:t},L.nodes[ye].width=C,L.nodes[ye].height=T,L.nodes[tt].width=C,L.nodes[tt].height=T,L.nodes[Ft]={...L.nodes[Ft],image:t},L.edges.push({source:{node_id:it,field:"image"},destination:{node_id:de,field:"reference"}},{source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:de,field:"mask"}});return m!=="unmasked"&&(L.nodes[Ze]={type:"create_denoise_mask",id:Ze,is_intermediate:M,fp32:D},L.edges.push({source:{node_id:it,field:"image"},destination:{node_id:Ze,field:"image"}}),m==="mask"&&(E?L.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:Ze,field:"mask"}}):L.edges.push({source:{node_id:er,field:"image"},destination:{node_id:Ze,field:"mask"}})),m==="edge"&&(L.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:M,edge_blur:p,edge_size:p*2,low_threshold:100,high_threshold:200},E?L.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:sn,field:"image"}}):L.edges.push({source:{node_id:er,field:"image"},destination:{node_id:sn,field:"image"}}),L.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Ze,field:"mask"}})),L.edges.push({source:{node_id:Ze,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(x||w)&&(ro(e,L,P),P=kn),oo(e,L,P),Bf(e,L,se,P),Ji(e,L,se),eo(e,L,se),io(e,L,se),e.system.shouldUseNSFWChecker&&to(e,L,de),e.system.shouldUseWatermarker&&ao(e,L,de),no(e,L),L},zf=(e,t,n,r=gr)=>{const{loras:i}=e.lora,o=Kb(i);if(o===0)return;const a=[],s=r;let l=r;[kn,Ni].includes(r)&&(l=gr),t.edges=t.edges.filter(d=>!(d.source.node_id===s&&["unet"].includes(d.source.field))&&!(d.source.node_id===l&&["clip"].includes(d.source.field))&&!(d.source.node_id===l&&["clip2"].includes(d.source.field)));let u="",c=0;hs(i,d=>{const{model_name:f,base_model:h,weight:p}=d,m=`${vj}_${f.replace(".","_")}`,_={type:"sdxl_lora_loader",id:m,is_intermediate:!0,lora:{model_name:f,base_model:h},weight:p};a.push(kF.parse({lora:{model_name:f,base_model:h},weight:p})),t.nodes[m]=_,c===0?(t.edges.push({source:{node_id:s,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:l,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:l,field:"clip2"},destination:{node_id:m,field:"clip2"}})):(t.edges.push({source:{node_id:u,field:"unet"},destination:{node_id:m,field:"unet"}}),t.edges.push({source:{node_id:u,field:"clip"},destination:{node_id:m,field:"clip"}}),t.edges.push({source:{node_id:u,field:"clip2"},destination:{node_id:m,field:"clip2"}})),c===o-1&&(t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:n,field:"unet"}}),t.id&&[Ml,Rl].includes(t.id)&&t.edges.push({source:{node_id:m,field:"unet"},destination:{node_id:Re,field:"unet"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:Se,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip"},destination:{node_id:xe,field:"clip"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:Se,field:"clip2"}}),t.edges.push({source:{node_id:m,field:"clip2"},destination:{node_id:xe,field:"clip2"}})),u=m,c+=1}),Lo(t,{loras:a})},gc=(e,t)=>{const{positivePrompt:n,negativePrompt:r}=e.generation,{positiveStylePrompt:i,negativeStylePrompt:o,shouldConcatSDXLStylePrompt:a}=e.sdxl,s=a||t?[n,i].join(" "):i,l=a||t?[r,o].join(" "):o;return{joinedPositiveStylePrompt:s,joinedNegativeStylePrompt:l}},jf=(e,t,n,r,i,o)=>{const{refinerModel:a,refinerPositiveAestheticScore:s,refinerNegativeAestheticScore:l,refinerSteps:u,refinerScheduler:c,refinerCFGScale:d,refinerStart:f}=e.sdxl,{seamlessXAxis:h,seamlessYAxis:p,vaePrecision:m}=e.generation,{boundingBoxScaleMethod:_}=e.canvas,v=m==="fp32",y=["auto","manual"].includes(_);if(!a)return;Lo(t,{refiner_model:a,refiner_positive_aesthetic_score:s,refiner_negative_aesthetic_score:l,refiner_cfg_scale:d,refiner_scheduler:c,refiner_start:f,refiner_steps:u});const g=r||gr,{joinedPositiveStylePrompt:b,joinedNegativeStylePrompt:S}=gc(e,!0);t.edges=t.edges.filter(x=>!(x.source.node_id===n&&["latents"].includes(x.source.field))),t.edges=t.edges.filter(x=>!(x.source.node_id===g&&["vae"].includes(x.source.field))),t.nodes[su]={type:"sdxl_refiner_model_loader",id:su,model:a},t.nodes[W0]={type:"sdxl_refiner_compel_prompt",id:W0,style:b,aesthetic_score:s},t.nodes[K0]={type:"sdxl_refiner_compel_prompt",id:K0,style:S,aesthetic_score:l},t.nodes[qo]={type:"denoise_latents",id:qo,cfg_scale:d,steps:u,scheduler:c,denoising_start:f,denoising_end:1},h||p?(t.nodes[wo]={id:wo,type:"seamless",seamless_x:h,seamless_y:p},t.edges.push({source:{node_id:su,field:"unet"},destination:{node_id:wo,field:"unet"}},{source:{node_id:su,field:"vae"},destination:{node_id:wo,field:"vae"}},{source:{node_id:wo,field:"unet"},destination:{node_id:qo,field:"unet"}})):t.edges.push({source:{node_id:su,field:"unet"},destination:{node_id:qo,field:"unet"}}),t.edges.push({source:{node_id:su,field:"clip2"},destination:{node_id:W0,field:"clip2"}},{source:{node_id:su,field:"clip2"},destination:{node_id:K0,field:"clip2"}},{source:{node_id:W0,field:"conditioning"},destination:{node_id:qo,field:"positive_conditioning"}},{source:{node_id:K0,field:"conditioning"},destination:{node_id:qo,field:"negative_conditioning"}},{source:{node_id:n,field:"latents"},destination:{node_id:qo,field:"latents"}}),(t.id===Ml||t.id===Rl)&&(t.nodes[Ni]={type:"create_denoise_mask",id:Ni,is_intermediate:!0,fp32:v},y?t.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:Ni,field:"image"}}):t.nodes[Ni]={...t.nodes[Ni],image:i},t.id===Ml&&(y?t.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:Ni,field:"mask"}}):t.nodes[Ni]={...t.nodes[Ni],mask:o}),t.id===Rl&&t.edges.push({source:{node_id:y?Tt:er,field:"image"},destination:{node_id:Ni,field:"mask"}}),t.edges.push({source:{node_id:Ni,field:"denoise_mask"},destination:{node_id:qo,field:"denoise_mask"}})),t.id===XS||t.id===Tg?t.edges.push({source:{node_id:qo,field:"latents"},destination:{node_id:y?Ee:de,field:"latents"}}):t.edges.push({source:{node_id:qo,field:"latents"},destination:{node_id:Ee,field:"latents"}})},O2e=(e,t)=>{const n=le("nodes"),{positivePrompt:r,negativePrompt:i,model:o,cfgScale:a,scheduler:s,seed:l,steps:u,vaePrecision:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{shouldUseSDXLRefiner:p,refinerStart:m,sdxlImg2ImgDenoisingStrength:_}=e.sdxl,{width:v,height:y}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:g,boundingBoxScaleMethod:b}=e.canvas,S=c==="fp32",x=!0,w=["auto","manual"].includes(b);if(!o)throw n.error("No model found in state"),new Error("No model found in state");let C=gr;const T=d,{joinedPositiveStylePrompt:A,joinedNegativeStylePrompt:k}=gc(e),D={id:Tg,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:o},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:r,style:A},[xe]:{type:"sdxl_compel_prompt",id:xe,prompt:i,style:k},[ye]:{type:"noise",id:ye,is_intermediate:x,use_cpu:T,seed:l,width:w?g.width:v,height:w?g.height:y},[Dt]:{type:"i2l",id:Dt,is_intermediate:x,fp32:S},[ae]:{type:"denoise_latents",id:ae,is_intermediate:x,cfg_scale:a,scheduler:s,steps:u,denoising_start:p?Math.min(m,1-_):1-_,denoising_end:p?m:1}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:xe,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:Dt,field:"latents"},destination:{node_id:ae,field:"latents"}}]};return w?(D.nodes[Dd]={id:Dd,type:"img_resize",is_intermediate:x,image:t,width:g.width,height:g.height},D.nodes[Ee]={id:Ee,type:"l2i",is_intermediate:x,fp32:S},D.nodes[de]={id:de,type:"img_resize",is_intermediate:x,width:v,height:y},D.edges.push({source:{node_id:Dd,field:"image"},destination:{node_id:Dt,field:"image"}},{source:{node_id:ae,field:"latents"},destination:{node_id:Ee,field:"latents"}},{source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}})):(D.nodes[de]={type:"l2i",id:de,is_intermediate:x,fp32:S},D.nodes[Dt].image=t,D.edges.push({source:{node_id:ae,field:"latents"},destination:{node_id:de,field:"latents"}})),Ps(D,{generation_mode:"img2img",cfg_scale:a,width:w?g.width:v,height:w?g.height:y,positive_prompt:r,negative_prompt:i,model:o,seed:l,steps:u,rand_device:T?"cpu":"cuda",scheduler:s,strength:_,init_image:t.image_name}),(f||h)&&(ro(e,D,C),C=kn),p&&(jf(e,D,ae,C),(f||h)&&(C=wo)),oo(e,D,C),zf(e,D,ae,C),Ji(e,D,ae),eo(e,D,ae),io(e,D,ae),e.system.shouldUseNSFWChecker&&to(e,D,de),e.system.shouldUseWatermarker&&ao(e,D,de),no(e,D),D},$2e=(e,t,n)=>{const r=le("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,maskBlurMethod:p,canvasCoherenceMode:m,canvasCoherenceSteps:_,canvasCoherenceStrength:v,seamlessXAxis:y,seamlessYAxis:g}=e.generation,{sdxlImg2ImgDenoisingStrength:b,shouldUseSDXLRefiner:S,refinerStart:x}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:w,height:C}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:T,boundingBoxScaleMethod:A}=e.canvas,k=d==="fp32",D=!0,M=["auto","manual"].includes(A);let E=gr;const P=f,{joinedPositiveStylePrompt:N,joinedNegativeStylePrompt:L}=gc(e),O={id:Ml,nodes:{[E]:{type:"sdxl_model_loader",id:E,model:a},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:i,style:N},[xe]:{type:"sdxl_compel_prompt",id:xe,prompt:o,style:L},[pr]:{type:"img_blur",id:pr,is_intermediate:D,radius:h,blur_type:p},[Ft]:{type:"i2l",id:Ft,is_intermediate:D,fp32:k},[ye]:{type:"noise",id:ye,use_cpu:P,seed:c,is_intermediate:D},[Lt]:{type:"create_denoise_mask",id:Lt,is_intermediate:D,fp32:k},[ae]:{type:"denoise_latents",id:ae,is_intermediate:D,steps:u,cfg_scale:s,scheduler:l,denoising_start:S?Math.min(x,1-b):1-b,denoising_end:S?x:1},[tt]:{type:"noise",id:tt,use_cpu:P,seed:c+1,is_intermediate:D},[Il]:{type:"add",id:Il,b:1,is_intermediate:D},[Re]:{type:"denoise_latents",id:Re,is_intermediate:D,steps:_,cfg_scale:s,scheduler:l,denoising_start:1-v,denoising_end:1},[Ee]:{type:"l2i",id:Ee,is_intermediate:D,fp32:k},[de]:{type:"color_correct",id:de,is_intermediate:D,reference:t}},edges:[{source:{node_id:E,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:E,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:E,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:E,field:"clip2"},destination:{node_id:xe,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:ae,field:"latents"}},{source:{node_id:pr,field:"image"},destination:{node_id:Lt,field:"mask"}},{source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:ae,field:"denoise_mask"}},{source:{node_id:E,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:ae,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:Re,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};if(M){const R=T.width,$=T.height;O.nodes[nr]={type:"img_resize",id:nr,is_intermediate:D,width:R,height:$,image:t},O.nodes[Tt]={type:"img_resize",id:Tt,is_intermediate:D,width:R,height:$,image:n},O.nodes[yr]={type:"img_resize",id:yr,is_intermediate:D,width:w,height:C},O.nodes[vr]={type:"img_resize",id:vr,is_intermediate:D,width:w,height:C},O.nodes[ye].width=R,O.nodes[ye].height=$,O.nodes[tt].width=R,O.nodes[tt].height=$,O.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:Ft,field:"image"}},{source:{node_id:Tt,field:"image"},destination:{node_id:pr,field:"image"}},{source:{node_id:nr,field:"image"},destination:{node_id:Lt,field:"image"}},{source:{node_id:Ee,field:"image"},destination:{node_id:yr,field:"image"}},{source:{node_id:yr,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:pr,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:de,field:"mask"}})}else O.nodes[ye].width=w,O.nodes[ye].height=C,O.nodes[tt].width=w,O.nodes[tt].height=C,O.nodes[Ft]={...O.nodes[Ft],image:t},O.nodes[pr]={...O.nodes[pr],image:n},O.nodes[Lt]={...O.nodes[Lt],image:t},O.edges.push({source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:pr,field:"image"},destination:{node_id:de,field:"mask"}});return m!=="unmasked"&&(O.nodes[Ze]={type:"create_denoise_mask",id:Ze,is_intermediate:D,fp32:k},M?O.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:Ze,field:"image"}}):O.nodes[Ze]={...O.nodes[Ze],image:t},m==="mask"&&(M?O.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:Ze,field:"mask"}}):O.nodes[Ze]={...O.nodes[Ze],mask:n}),m==="edge"&&(O.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:D,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},M?O.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:sn,field:"image"}}):O.nodes[sn]={...O.nodes[sn],image:n},O.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Ze,field:"mask"}})),O.edges.push({source:{node_id:Ze,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(y||g)&&(ro(e,O,E),E=kn),S&&(jf(e,O,Re,E,t,n),(y||g)&&(E=wo)),oo(e,O,E),zf(e,O,ae,E),Ji(e,O,ae),eo(e,O,ae),io(e,O,ae),e.system.shouldUseNSFWChecker&&to(e,O,de),e.system.shouldUseWatermarker&&ao(e,O,de),no(e,O),O},N2e=(e,t,n)=>{const r=le("nodes"),{positivePrompt:i,negativePrompt:o,model:a,cfgScale:s,scheduler:l,steps:u,seed:c,vaePrecision:d,shouldUseCpuNoise:f,maskBlur:h,canvasCoherenceMode:p,canvasCoherenceSteps:m,canvasCoherenceStrength:_,infillTileSize:v,infillPatchmatchDownscaleSize:y,infillMethod:g,seamlessXAxis:b,seamlessYAxis:S}=e.generation,{sdxlImg2ImgDenoisingStrength:x,shouldUseSDXLRefiner:w,refinerStart:C}=e.sdxl;if(!a)throw r.error("No model found in state"),new Error("No model found in state");const{width:T,height:A}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:k,boundingBoxScaleMethod:D}=e.canvas,M=d==="fp32",E=!0,P=["auto","manual"].includes(D);let N=gr;const L=f,{joinedPositiveStylePrompt:O,joinedNegativeStylePrompt:R}=gc(e),$={id:Rl,nodes:{[gr]:{type:"sdxl_model_loader",id:gr,model:a},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:i,style:O},[xe]:{type:"sdxl_compel_prompt",id:xe,prompt:o,style:R},[Ld]:{type:"tomask",id:Ld,is_intermediate:E,image:t},[er]:{type:"mask_combine",id:er,is_intermediate:E,mask2:n},[Ft]:{type:"i2l",id:Ft,is_intermediate:E,fp32:M},[ye]:{type:"noise",id:ye,use_cpu:L,seed:c,is_intermediate:E},[Lt]:{type:"create_denoise_mask",id:Lt,is_intermediate:E,fp32:M},[ae]:{type:"denoise_latents",id:ae,is_intermediate:E,steps:u,cfg_scale:s,scheduler:l,denoising_start:w?Math.min(C,1-x):1-x,denoising_end:w?C:1},[tt]:{type:"noise",id:tt,use_cpu:L,seed:c+1,is_intermediate:E},[Il]:{type:"add",id:Il,b:1,is_intermediate:E},[Re]:{type:"denoise_latents",id:Re,is_intermediate:E,steps:m,cfg_scale:s,scheduler:l,denoising_start:1-_,denoising_end:1},[Ee]:{type:"l2i",id:Ee,is_intermediate:E,fp32:M},[de]:{type:"color_correct",id:de,is_intermediate:E}},edges:[{source:{node_id:gr,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:gr,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:gr,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:gr,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:gr,field:"clip2"},destination:{node_id:xe,field:"clip2"}},{source:{node_id:it,field:"image"},destination:{node_id:Ft,field:"image"}},{source:{node_id:Ld,field:"image"},destination:{node_id:er,field:"mask1"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:Ft,field:"latents"},destination:{node_id:ae,field:"latents"}},{source:{node_id:P?Tt:er,field:"image"},destination:{node_id:Lt,field:"mask"}},{source:{node_id:Lt,field:"denoise_mask"},destination:{node_id:ae,field:"denoise_mask"}},{source:{node_id:N,field:"unet"},destination:{node_id:Re,field:"unet"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:Re,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:Re,field:"negative_conditioning"}},{source:{node_id:tt,field:"noise"},destination:{node_id:Re,field:"noise"}},{source:{node_id:ae,field:"latents"},destination:{node_id:Re,field:"latents"}},{source:{node_id:it,field:"image"},destination:{node_id:Lt,field:"image"}},{source:{node_id:Re,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};if(g==="patchmatch"&&($.nodes[it]={type:"infill_patchmatch",id:it,is_intermediate:E,downscale:y}),g==="lama"&&($.nodes[it]={type:"infill_lama",id:it,is_intermediate:E}),g==="cv2"&&($.nodes[it]={type:"infill_cv2",id:it,is_intermediate:E}),g==="tile"&&($.nodes[it]={type:"infill_tile",id:it,is_intermediate:E,tile_size:v}),P){const z=k.width,V=k.height;$.nodes[nr]={type:"img_resize",id:nr,is_intermediate:E,width:z,height:V,image:t},$.nodes[Tt]={type:"img_resize",id:Tt,is_intermediate:E,width:z,height:V},$.nodes[yr]={type:"img_resize",id:yr,is_intermediate:E,width:T,height:A},$.nodes[ol]={type:"img_resize",id:ol,is_intermediate:E,width:T,height:A},$.nodes[vr]={type:"img_resize",id:vr,is_intermediate:E,width:T,height:A},$.nodes[ye].width=z,$.nodes[ye].height=V,$.nodes[tt].width=z,$.nodes[tt].height=V,$.edges.push({source:{node_id:nr,field:"image"},destination:{node_id:it,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:Tt,field:"image"}},{source:{node_id:Ee,field:"image"},destination:{node_id:yr,field:"image"}},{source:{node_id:Tt,field:"image"},destination:{node_id:vr,field:"image"}},{source:{node_id:it,field:"image"},destination:{node_id:ol,field:"image"}},{source:{node_id:ol,field:"image"},destination:{node_id:de,field:"reference"}},{source:{node_id:yr,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:vr,field:"image"},destination:{node_id:de,field:"mask"}})}else $.nodes[it]={...$.nodes[it],image:t},$.nodes[ye].width=T,$.nodes[ye].height=A,$.nodes[tt].width=T,$.nodes[tt].height=A,$.nodes[Ft]={...$.nodes[Ft],image:t},$.edges.push({source:{node_id:it,field:"image"},destination:{node_id:de,field:"reference"}},{source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}},{source:{node_id:er,field:"image"},destination:{node_id:de,field:"mask"}});return p!=="unmasked"&&($.nodes[Ze]={type:"create_denoise_mask",id:Ze,is_intermediate:E,fp32:M},$.edges.push({source:{node_id:it,field:"image"},destination:{node_id:Ze,field:"image"}}),p==="mask"&&(P?$.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:Ze,field:"mask"}}):$.edges.push({source:{node_id:er,field:"image"},destination:{node_id:Ze,field:"mask"}})),p==="edge"&&($.nodes[sn]={type:"mask_edge",id:sn,is_intermediate:E,edge_blur:h,edge_size:h*2,low_threshold:100,high_threshold:200},P?$.edges.push({source:{node_id:Tt,field:"image"},destination:{node_id:sn,field:"image"}}):$.edges.push({source:{node_id:er,field:"image"},destination:{node_id:sn,field:"image"}}),$.edges.push({source:{node_id:sn,field:"image"},destination:{node_id:Ze,field:"mask"}})),$.edges.push({source:{node_id:Ze,field:"denoise_mask"},destination:{node_id:Re,field:"denoise_mask"}})),(b||S)&&(ro(e,$,N),N=kn),w&&(jf(e,$,Re,N,t),(b||S)&&(N=wo)),oo(e,$,N),zf(e,$,ae,N),Ji(e,$,ae),eo(e,$,ae),io(e,$,ae),e.system.shouldUseNSFWChecker&&to(e,$,de),e.system.shouldUseWatermarker&&ao(e,$,de),no(e,$),$},D2e=e=>{const t=le("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,shouldUseCpuNoise:c,seamlessXAxis:d,seamlessYAxis:f}=e.generation,{width:h,height:p}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:m,boundingBoxScaleMethod:_}=e.canvas,v=u==="fp32",y=!0,g=["auto","manual"].includes(_),{shouldUseSDXLRefiner:b,refinerStart:S}=e.sdxl;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const x=c,w=i.model_type==="onnx";let C=w?qS:gr;const T=w?"onnx_model_loader":"sdxl_model_loader",A=w?{type:"t2l_onnx",id:ae,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:ae,is_intermediate:y,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:b?S:1},{joinedPositiveStylePrompt:k,joinedNegativeStylePrompt:D}=gc(e),M={id:XS,nodes:{[C]:{type:T,id:C,is_intermediate:y,model:i},[Se]:{type:w?"prompt_onnx":"sdxl_compel_prompt",id:Se,is_intermediate:y,prompt:n,style:k},[xe]:{type:w?"prompt_onnx":"sdxl_compel_prompt",id:xe,is_intermediate:y,prompt:r,style:D},[ye]:{type:"noise",id:ye,is_intermediate:y,seed:s,width:g?m.width:h,height:g?m.height:p,use_cpu:x},[A.id]:A},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:xe,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:ae,field:"noise"}}]};return g?(M.nodes[Ee]={id:Ee,type:w?"l2i_onnx":"l2i",is_intermediate:y,fp32:v},M.nodes[de]={id:de,type:"img_resize",is_intermediate:y,width:h,height:p},M.edges.push({source:{node_id:ae,field:"latents"},destination:{node_id:Ee,field:"latents"}},{source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}})):(M.nodes[de]={type:w?"l2i_onnx":"l2i",id:de,is_intermediate:y,fp32:v},M.edges.push({source:{node_id:ae,field:"latents"},destination:{node_id:de,field:"latents"}})),Ps(M,{generation_mode:"txt2img",cfg_scale:o,width:g?m.width:h,height:g?m.height:p,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:x?"cpu":"cuda",scheduler:a}),(d||f)&&(ro(e,M,C),C=kn),b&&(jf(e,M,ae,C),(d||f)&&(C=wo)),zf(e,M,ae,C),oo(e,M,C),Ji(e,M,ae),eo(e,M,ae),io(e,M,ae),e.system.shouldUseNSFWChecker&&to(e,M,de),e.system.shouldUseWatermarker&&ao(e,M,de),no(e,M),M},L2e=e=>{const t=le("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,vaePrecision:u,clipSkip:c,shouldUseCpuNoise:d,seamlessXAxis:f,seamlessYAxis:h}=e.generation,{width:p,height:m}=e.canvas.boundingBoxDimensions,{scaledBoundingBoxDimensions:_,boundingBoxScaleMethod:v}=e.canvas,y=u==="fp32",g=!0,b=["auto","manual"].includes(v);if(!i)throw t.error("No model found in state"),new Error("No model found in state");const S=d,x=i.model_type==="onnx";let w=x?qS:Ts;const C=x?"onnx_model_loader":"main_model_loader",T=x?{type:"t2l_onnx",id:se,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l}:{type:"denoise_latents",id:se,is_intermediate:g,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:1},A={id:_j,nodes:{[w]:{type:C,id:w,is_intermediate:g,model:i},[st]:{type:"clip_skip",id:st,is_intermediate:g,skipped_layers:c},[Se]:{type:x?"prompt_onnx":"compel",id:Se,is_intermediate:g,prompt:n},[xe]:{type:x?"prompt_onnx":"compel",id:xe,is_intermediate:g,prompt:r},[ye]:{type:"noise",id:ye,is_intermediate:g,seed:s,width:b?_.width:p,height:b?_.height:m,use_cpu:S},[T.id]:T},edges:[{source:{node_id:w,field:"unet"},destination:{node_id:se,field:"unet"}},{source:{node_id:w,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:se,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:se,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:se,field:"noise"}}]};return b?(A.nodes[Ee]={id:Ee,type:x?"l2i_onnx":"l2i",is_intermediate:g,fp32:y},A.nodes[de]={id:de,type:"img_resize",is_intermediate:g,width:p,height:m},A.edges.push({source:{node_id:se,field:"latents"},destination:{node_id:Ee,field:"latents"}},{source:{node_id:Ee,field:"image"},destination:{node_id:de,field:"image"}})):(A.nodes[de]={type:x?"l2i_onnx":"l2i",id:de,is_intermediate:g,fp32:y},A.edges.push({source:{node_id:se,field:"latents"},destination:{node_id:de,field:"latents"}})),Ps(A,{generation_mode:"txt2img",cfg_scale:o,width:b?_.width:p,height:b?_.height:m,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:S?"cpu":"cuda",scheduler:a,clip_skip:c}),(f||h)&&(ro(e,A,w),w=kn),oo(e,A,w),Bf(e,A,se,w),Ji(e,A,se),eo(e,A,se),io(e,A,se),e.system.shouldUseNSFWChecker&&to(e,A,de),e.system.shouldUseWatermarker&&ao(e,A,de),no(e,A),A},F2e=(e,t,n,r)=>{let i;if(t==="txt2img")e.generation.model&&e.generation.model.base_model==="sdxl"?i=D2e(e):i=L2e(e);else if(t==="img2img"){if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=O2e(e,n):i=I2e(e,n)}else if(t==="inpaint"){if(!n||!r)throw new Error("Missing canvas init and mask images");e.generation.model&&e.generation.model.base_model==="sdxl"?i=$2e(e,n,r):i=M2e(e,n,r)}else{if(!n)throw new Error("Missing canvas init image");e.generation.model&&e.generation.model.base_model==="sdxl"?i=N2e(e,n,r):i=R2e(e,n,r)}return i},aw=({count:e,start:t,min:n=yie,max:r=sp})=>{const i=t??ore(n,r),o=[];for(let a=i;a{const{iterations:r,model:i,shouldRandomizeSeed:o,seed:a}=e.generation,{shouldConcatSDXLStylePrompt:s,positiveStylePrompt:l}=e.sdxl,{prompts:u,seedBehaviour:c}=e.dynamicPrompts,d=[];if(u.length===1){const h=aw({count:r,start:o?void 0:a}),p=[];t.nodes[ye]&&p.push({node_path:ye,field_name:"seed",items:h}),Sh(t)&&(_h(t,"seed"),p.push({node_path:xo,field_name:"seed",items:h})),t.nodes[tt]&&p.push({node_path:tt,field_name:"seed",items:h.map(m=>(m+1)%sp)}),d.push(p)}else{const h=[],p=[];if(c==="PER_PROMPT"){const _=aw({count:u.length*r,start:o?void 0:a});t.nodes[ye]&&h.push({node_path:ye,field_name:"seed",items:_}),Sh(t)&&(_h(t,"seed"),h.push({node_path:xo,field_name:"seed",items:_})),t.nodes[tt]&&h.push({node_path:tt,field_name:"seed",items:_.map(v=>(v+1)%sp)})}else{const _=aw({count:r,start:o?void 0:a});t.nodes[ye]&&p.push({node_path:ye,field_name:"seed",items:_}),Sh(t)&&(_h(t,"seed"),p.push({node_path:xo,field_name:"seed",items:_})),t.nodes[tt]&&p.push({node_path:tt,field_name:"seed",items:_.map(v=>(v+1)%sp)}),d.push(p)}const m=c==="PER_PROMPT"?dre(r).flatMap(()=>u):u;if(t.nodes[Se]&&h.push({node_path:Se,field_name:"prompt",items:m}),Sh(t)&&(_h(t,"positive_prompt"),h.push({node_path:xo,field_name:"positive_prompt",items:m})),s&&(i==null?void 0:i.base_model)==="sdxl"){const _=m.map(v=>[v,l].join(" "));t.nodes[Se]&&h.push({node_path:Se,field_name:"style",items:_}),Sh(t)&&(_h(t,"positive_style_prompt"),h.push({node_path:xo,field_name:"positive_style_prompt",items:m}))}d.push(h)}return{prepend:n,batch:{graph:t,runs:1,data:d}}},B2e=()=>{pe({predicate:e=>AA.match(e)&&e.payload.tabName==="unifiedCanvas",effect:async(e,{getState:t,dispatch:n})=>{const r=le("queue"),{prepend:i}=e.payload,o=t(),{layerState:a,boundingBoxCoordinates:s,boundingBoxDimensions:l,isMaskEnabled:u,shouldPreserveMaskedArea:c}=o.canvas,d=await CA(a,s,l,u,c);if(!d){r.error("Unable to create canvas data");return}const{baseBlob:f,baseImageData:h,maskBlob:p,maskImageData:m}=d,_=P2e(h,m);if(o.system.enableImageDebugging){const S=await KI(f),x=await KI(p);E2e([{base64:x,caption:"mask b64"},{base64:S,caption:"image b64"}])}r.debug(`Generation mode: ${_}`);let v,y;["img2img","inpaint","outpaint"].includes(_)&&(v=await n(ue.endpoints.uploadImage.initiate({file:new File([f],"canvasInitImage.png",{type:"image/png"}),image_category:"general",is_intermediate:!0})).unwrap()),["inpaint","outpaint"].includes(_)&&(y=await n(ue.endpoints.uploadImage.initiate({file:new File([p],"canvasMaskImage.png",{type:"image/png"}),image_category:"mask",is_intermediate:!0})).unwrap());const g=F2e(o,_,v,y);r.debug({graph:ft(g)},"Canvas graph built"),n(Rz(g));const b=xj(o,g,i);try{const S=n(ln.endpoints.enqueueBatch.initiate(b,{fixedCacheKey:"enqueueBatch"})),x=await S.unwrap();S.reset();const w=x.batch.batch_id;o.canvas.layerState.stagingArea.boundingBox||n(ile({boundingBox:{...o.canvas.boundingBoxCoordinates,...o.canvas.boundingBoxDimensions}})),n(ole(w))}catch{}}})},z2e=e=>{const t=le("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,img2imgStrength:c,shouldFitToWidthHeight:d,width:f,height:h,clipSkip:p,shouldUseCpuNoise:m,vaePrecision:_,seamlessXAxis:v,seamlessYAxis:y}=e.generation;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const g=_==="fp32",b=!0;let S=Ts;const x=m,w={id:K5,nodes:{[S]:{type:"main_model_loader",id:S,model:i,is_intermediate:b},[st]:{type:"clip_skip",id:st,skipped_layers:p,is_intermediate:b},[Se]:{type:"compel",id:Se,prompt:n,is_intermediate:b},[xe]:{type:"compel",id:xe,prompt:r,is_intermediate:b},[ye]:{type:"noise",id:ye,use_cpu:x,seed:s,is_intermediate:b},[Ee]:{type:"l2i",id:Ee,fp32:g,is_intermediate:b},[se]:{type:"denoise_latents",id:se,cfg_scale:o,scheduler:a,steps:l,denoising_start:1-c,denoising_end:1,is_intermediate:b},[Dt]:{type:"i2l",id:Dt,fp32:g,is_intermediate:b}},edges:[{source:{node_id:S,field:"unet"},destination:{node_id:se,field:"unet"}},{source:{node_id:S,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:se,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:se,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:se,field:"noise"}},{source:{node_id:Dt,field:"latents"},destination:{node_id:se,field:"latents"}},{source:{node_id:se,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};if(d&&(u.width!==f||u.height!==h)){const C={id:oa,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:f,height:h};w.nodes[oa]=C,w.edges.push({source:{node_id:oa,field:"image"},destination:{node_id:Dt,field:"image"}}),w.edges.push({source:{node_id:oa,field:"width"},destination:{node_id:ye,field:"width"}}),w.edges.push({source:{node_id:oa,field:"height"},destination:{node_id:ye,field:"height"}})}else w.nodes[Dt].image={image_name:u.imageName},w.edges.push({source:{node_id:Dt,field:"width"},destination:{node_id:ye,field:"width"}}),w.edges.push({source:{node_id:Dt,field:"height"},destination:{node_id:ye,field:"height"}});return Ps(w,{generation_mode:"img2img",cfg_scale:o,height:h,width:f,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:x?"cpu":"cuda",scheduler:a,clip_skip:p,strength:c,init_image:u.imageName}),(v||y)&&(ro(e,w,S),S=kn),oo(e,w,S),Bf(e,w,se,S),Ji(e,w,se),eo(e,w,se),io(e,w,se),e.system.shouldUseNSFWChecker&&to(e,w),e.system.shouldUseWatermarker&&ao(e,w),no(e,w),w},j2e=e=>{const t=le("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,initialImage:u,shouldFitToWidthHeight:c,width:d,height:f,shouldUseCpuNoise:h,vaePrecision:p,seamlessXAxis:m,seamlessYAxis:_}=e.generation,{positiveStylePrompt:v,negativeStylePrompt:y,shouldUseSDXLRefiner:g,refinerStart:b,sdxlImg2ImgDenoisingStrength:S}=e.sdxl;if(!u)throw t.error("No initial image found in state"),new Error("No initial image found in state");if(!i)throw t.error("No model found in state"),new Error("No model found in state");const x=p==="fp32",w=!0;let C=gr;const T=h,{joinedPositiveStylePrompt:A,joinedNegativeStylePrompt:k}=gc(e),D={id:j1,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:w},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:n,style:A,is_intermediate:w},[xe]:{type:"sdxl_compel_prompt",id:xe,prompt:r,style:k,is_intermediate:w},[ye]:{type:"noise",id:ye,use_cpu:T,seed:s,is_intermediate:w},[Ee]:{type:"l2i",id:Ee,fp32:x,is_intermediate:w},[ae]:{type:"denoise_latents",id:ae,cfg_scale:o,scheduler:a,steps:l,denoising_start:g?Math.min(b,1-S):1-S,denoising_end:g?b:1,is_intermediate:w},[Dt]:{type:"i2l",id:Dt,fp32:x,is_intermediate:w}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:xe,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:Dt,field:"latents"},destination:{node_id:ae,field:"latents"}},{source:{node_id:ae,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};if(c&&(u.width!==d||u.height!==f)){const M={id:oa,type:"img_resize",image:{image_name:u.imageName},is_intermediate:!0,width:d,height:f};D.nodes[oa]=M,D.edges.push({source:{node_id:oa,field:"image"},destination:{node_id:Dt,field:"image"}}),D.edges.push({source:{node_id:oa,field:"width"},destination:{node_id:ye,field:"width"}}),D.edges.push({source:{node_id:oa,field:"height"},destination:{node_id:ye,field:"height"}})}else D.nodes[Dt].image={image_name:u.imageName},D.edges.push({source:{node_id:Dt,field:"width"},destination:{node_id:ye,field:"width"}}),D.edges.push({source:{node_id:Dt,field:"height"},destination:{node_id:ye,field:"height"}});return Ps(D,{generation_mode:"sdxl_img2img",cfg_scale:o,height:f,width:d,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:T?"cpu":"cuda",scheduler:a,strength:S,init_image:u.imageName,positive_style_prompt:v,negative_style_prompt:y}),(m||_)&&(ro(e,D,C),C=kn),g&&(jf(e,D,ae),(m||_)&&(C=wo)),oo(e,D,C),zf(e,D,ae,C),Ji(e,D,ae),eo(e,D,ae),io(e,D,ae),e.system.shouldUseNSFWChecker&&to(e,D),e.system.shouldUseWatermarker&&ao(e,D),no(e,D),D},V2e=e=>{const t=le("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,seed:s,steps:l,width:u,height:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p}=e.generation,{positiveStylePrompt:m,negativeStylePrompt:_,shouldUseSDXLRefiner:v,refinerStart:y}=e.sdxl,g=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const b=f==="fp32",S=!0,{joinedPositiveStylePrompt:x,joinedNegativeStylePrompt:w}=gc(e);let C=gr;const T={id:EA,nodes:{[C]:{type:"sdxl_model_loader",id:C,model:i,is_intermediate:S},[Se]:{type:"sdxl_compel_prompt",id:Se,prompt:n,style:x,is_intermediate:S},[xe]:{type:"sdxl_compel_prompt",id:xe,prompt:r,style:w,is_intermediate:S},[ye]:{type:"noise",id:ye,seed:s,width:u,height:c,use_cpu:g,is_intermediate:S},[ae]:{type:"denoise_latents",id:ae,cfg_scale:o,scheduler:a,steps:l,denoising_start:0,denoising_end:v?y:1,is_intermediate:S},[Ee]:{type:"l2i",id:Ee,fp32:b,is_intermediate:S}},edges:[{source:{node_id:C,field:"unet"},destination:{node_id:ae,field:"unet"}},{source:{node_id:C,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:Se,field:"clip2"}},{source:{node_id:C,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:C,field:"clip2"},destination:{node_id:xe,field:"clip2"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:ae,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:ae,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:ae,field:"noise"}},{source:{node_id:ae,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};return Ps(T,{generation_mode:"sdxl_txt2img",cfg_scale:o,height:c,width:u,positive_prompt:n,negative_prompt:r,model:i,seed:s,steps:l,rand_device:g?"cpu":"cuda",scheduler:a,positive_style_prompt:m,negative_style_prompt:_}),(h||p)&&(ro(e,T,C),C=kn),v&&(jf(e,T,ae),(h||p)&&(C=wo)),oo(e,T,C),zf(e,T,ae,C),Ji(e,T,ae),eo(e,T,ae),io(e,T,ae),e.system.shouldUseNSFWChecker&&to(e,T),e.system.shouldUseWatermarker&&ao(e,T),no(e,T),T};function U2e(e){const t=["vae","control","ip_adapter","metadata","unet","positive_conditioning","negative_conditioning"],n=[];e.edges.forEach(r=>{r.destination.node_id===se&&t.includes(r.destination.field)&&n.push({source:{node_id:r.source.node_id,field:r.source.field},destination:{node_id:Vc,field:r.destination.field}})}),e.edges=e.edges.concat(n)}const G2e=(e,t)=>{var m;if(!e.generation.hrfEnabled||e.config.disabledSDFeatures.includes("hrf")||((m=e.generation.model)==null?void 0:m.model_type)==="onnx")return;const n=le("txt2img"),{vae:r,hrfWidth:i,hrfHeight:o,hrfStrength:a}=e.generation,s=!r,l=t.nodes[se],u=t.nodes[ye],c=t.nodes[Ee];if(!l){n.error("originalDenoiseLatentsNode is undefined");return}if(!u){n.error("originalNoiseNode is undefined");return}if(!c){n.error("originalLatentsToImageNode is undefined");return}u&&(u.width=i,u.height=o);const d={type:"denoise_latents",id:Vc,is_intermediate:l==null?void 0:l.is_intermediate,cfg_scale:l==null?void 0:l.cfg_scale,scheduler:l==null?void 0:l.scheduler,steps:l==null?void 0:l.steps,denoising_start:1-a,denoising_end:1},f={type:"noise",id:yh,seed:u==null?void 0:u.seed,use_cpu:u==null?void 0:u.use_cpu,is_intermediate:u==null?void 0:u.is_intermediate},h={id:Nc,type:"lresize",width:e.generation.width,height:e.generation.height},p=c?{type:"l2i",id,fp32:c==null?void 0:c.fp32,is_intermediate:c==null?void 0:c.is_intermediate}:void 0;t.nodes[id]=p,t.nodes[Vc]=d,t.nodes[yh]=f,t.nodes[Nc]=h,t.edges.push({source:{node_id:se,field:"latents"},destination:{node_id:Nc,field:"latents"}},{source:{node_id:Nc,field:"height"},destination:{node_id:yh,field:"height"}},{source:{node_id:Nc,field:"width"},destination:{node_id:yh,field:"width"}},{source:{node_id:Nc,field:"latents"},destination:{node_id:Vc,field:"latents"}},{source:{node_id:yh,field:"noise"},destination:{node_id:Vc,field:"noise"}},{source:{node_id:Vc,field:"latents"},destination:{node_id:id,field:"latents"}},{source:{node_id:s?Ts:ho,field:"vae"},destination:{node_id:id,field:"vae"}}),Lo(t,{hrf_height:o,hrf_width:i,hrf_strength:a}),U2e(t)},H2e=e=>{const t=le("nodes"),{positivePrompt:n,negativePrompt:r,model:i,cfgScale:o,scheduler:a,steps:s,width:l,height:u,clipSkip:c,shouldUseCpuNoise:d,vaePrecision:f,seamlessXAxis:h,seamlessYAxis:p,seed:m}=e.generation,_=d;if(!i)throw t.error("No model found in state"),new Error("No model found in state");const v=f==="fp32",y=!0,g=i.model_type==="onnx";let b=g?qS:Ts;const S=g?"onnx_model_loader":"main_model_loader",x=g?{type:"t2l_onnx",id:se,is_intermediate:y,cfg_scale:o,scheduler:a,steps:s}:{type:"denoise_latents",id:se,is_intermediate:y,cfg_scale:o,scheduler:a,steps:s,denoising_start:0,denoising_end:1},w={id:bj,nodes:{[b]:{type:S,id:b,is_intermediate:y,model:i},[st]:{type:"clip_skip",id:st,skipped_layers:c,is_intermediate:y},[Se]:{type:g?"prompt_onnx":"compel",id:Se,prompt:n,is_intermediate:y},[xe]:{type:g?"prompt_onnx":"compel",id:xe,prompt:r,is_intermediate:y},[ye]:{type:"noise",id:ye,seed:m,width:l,height:u,use_cpu:_,is_intermediate:y},[x.id]:x,[Ee]:{type:g?"l2i_onnx":"l2i",id:Ee,fp32:v,is_intermediate:y}},edges:[{source:{node_id:b,field:"unet"},destination:{node_id:se,field:"unet"}},{source:{node_id:b,field:"clip"},destination:{node_id:st,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:Se,field:"clip"}},{source:{node_id:st,field:"clip"},destination:{node_id:xe,field:"clip"}},{source:{node_id:Se,field:"conditioning"},destination:{node_id:se,field:"positive_conditioning"}},{source:{node_id:xe,field:"conditioning"},destination:{node_id:se,field:"negative_conditioning"}},{source:{node_id:ye,field:"noise"},destination:{node_id:se,field:"noise"}},{source:{node_id:se,field:"latents"},destination:{node_id:Ee,field:"latents"}}]};return Ps(w,{generation_mode:"txt2img",cfg_scale:o,height:u,width:l,positive_prompt:n,negative_prompt:r,model:i,seed:m,steps:s,rand_device:_?"cpu":"cuda",scheduler:a,clip_skip:c}),(h||p)&&(ro(e,w,b),b=kn),oo(e,w,b),Bf(e,w,se,b),Ji(e,w,se),eo(e,w,se),io(e,w,se),e.generation.hrfEnabled&&!g&&G2e(e,w),e.system.shouldUseNSFWChecker&&to(e,w),e.system.shouldUseWatermarker&&ao(e,w),no(e,w),w},q2e=()=>{pe({predicate:e=>AA.match(e)&&(e.payload.tabName==="txt2img"||e.payload.tabName==="img2img"),effect:async(e,{getState:t,dispatch:n})=>{const r=t(),i=r.generation.model,{prepend:o}=e.payload;let a;i&&i.base_model==="sdxl"?e.payload.tabName==="txt2img"?a=V2e(r):a=j2e(r):e.payload.tabName==="txt2img"?a=H2e(r):a=z2e(r);const s=xj(r,a,o);n(ln.endpoints.enqueueBatch.initiate(s,{fixedCacheKey:"enqueueBatch"})).reset()}})},W2e=/[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*/u;function K2e(e){return e.length===1?e[0].toString():e.reduce((t,n)=>{if(typeof n=="number")return t+"["+n.toString()+"]";if(n.includes('"'))return t+'["'+X2e(n)+'"]';if(!W2e.test(n))return t+'["'+n+'"]';const r=t.length===0?"":".";return t+r+n},"")}function X2e(e){return e.replace(/"/g,'\\"')}function Q2e(e){return e.length!==0}const Y2e=99,wj="; ",Cj=", or ",PA="Validation error",Ej=": ";class Aj extends Error{constructor(n,r=[]){super(n);F2(this,"details");F2(this,"name");this.details=r,this.name="ZodValidationError"}toString(){return this.message}}function kA(e,t,n){if(e.code==="invalid_union")return e.unionErrors.reduce((r,i)=>{const o=i.issues.map(a=>kA(a,t,n)).join(t);return r.includes(o)||r.push(o),r},[]).join(n);if(Q2e(e.path)){if(e.path.length===1){const r=e.path[0];if(typeof r=="number")return`${e.message} at index ${r}`}return`${e.message} at "${K2e(e.path)}"`}return e.message}function Tj(e,t,n){return t!==null?e.length>0?[t,e].join(n):t:e.length>0?e:PA}function jVe(e,t={}){const{issueSeparator:n=wj,unionSeparator:r=Cj,prefixSeparator:i=Ej,prefix:o=PA}=t,a=kA(e,n,r),s=Tj(a,o,i);return new Aj(s,[e])}function XI(e,t={}){const{maxIssuesInMessage:n=Y2e,issueSeparator:r=wj,unionSeparator:i=Cj,prefixSeparator:o=Ej,prefix:a=PA}=t,s=e.errors.slice(0,n).map(u=>kA(u,r,i)).join(r),l=Tj(s,a,o);return new Aj(l,e.errors)}const Z2e=e=>{const{workflow:t,nodes:n,edges:r}=e,i={...t,nodes:[],edges:[]};return n.filter(o=>["invocation","notes"].includes(o.type??"__UNKNOWN_NODE_TYPE__")).forEach(o=>{const a=RF.safeParse(o);if(!a.success){const{message:s}=XI(a.error,{prefix:oe.t("nodes.unableToParseNode")});le("nodes").warn({node:ft(o)},s);return}i.nodes.push(a.data)}),r.forEach(o=>{const a=OF.safeParse(o);if(!a.success){const{message:s}=XI(a.error,{prefix:oe.t("nodes.unableToParseEdge")});le("nodes").warn({edge:ft(o)},s);return}i.edges.push(a.data)}),i},J2e=e=>{if(e.type==="ColorField"&&e.value){const t=et(e.value),{r:n,g:r,b:i,a:o}=e.value,a=Math.max(0,Math.min(o*255,255));return Object.assign(t,{r:n,g:r,b:i,a}),t}return e.value},exe=e=>{const{nodes:t,edges:n}=e,i=t.filter(En).reduce((l,u)=>{const{id:c,data:d}=u,{type:f,inputs:h,isIntermediate:p,embedWorkflow:m}=d,_=t5(h,(y,g,b)=>{const S=J2e(g);return y[b]=S,y},{});_.use_cache=u.data.useCache;const v={type:f,id:c,..._,is_intermediate:p};return m&&Object.assign(v,{workflow:Z2e(e)}),Object.assign(l,{[c]:v}),l},{}),a=n.filter(l=>l.type!=="collapsed").reduce((l,u)=>{const{source:c,target:d,sourceHandle:f,targetHandle:h}=u;return l.push({source:{node_id:c,field:f},destination:{node_id:d,field:h}}),l},[]);return a.forEach(l=>{const u=i[l.destination.node_id],c=l.destination.field;i[l.destination.node_id]=Mf(u,c)}),{id:ap(),nodes:i,edges:a}},txe=()=>{pe({predicate:e=>AA.match(e)&&e.payload.tabName==="nodes",effect:async(e,{getState:t,dispatch:n})=>{const r=t(),o={batch:{graph:exe(r.nodes),runs:r.generation.iterations},prepend:e.payload.prepend};n(ln.endpoints.enqueueBatch.initiate(o,{fixedCacheKey:"enqueueBatch"})).reset()}})},nxe=()=>{pe({matcher:ue.endpoints.addImageToBoard.matchFulfilled,effect:e=>{const t=le("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Image added to board")}})},rxe=()=>{pe({matcher:ue.endpoints.addImageToBoard.matchRejected,effect:e=>{const t=le("images"),{board_id:n,imageDTO:r}=e.meta.arg.originalArgs;t.debug({board_id:n,imageDTO:r},"Problem adding image to board")}})},IA=ve("deleteImageModal/imageDeletionConfirmed"),VVe=ir(e=>e,e=>e.gallery.selection[e.gallery.selection.length-1],Y_),Pj=ir([e=>e],e=>{const{selectedBoardId:t,galleryView:n}=e.gallery;return{board_id:t,categories:n==="images"?Ln:Pr,offset:0,limit:_le,is_intermediate:!1}},Y_),ixe=()=>{pe({actionCreator:IA,effect:async(e,{dispatch:t,getState:n,condition:r})=>{var f;const{imageDTOs:i,imagesUsage:o}=e.payload;if(i.length!==1||o.length!==1)return;const a=i[0],s=o[0];if(!a||!s)return;t(NE(!1));const l=n(),u=(f=l.gallery.selection[l.gallery.selection.length-1])==null?void 0:f.image_name;if(a&&(a==null?void 0:a.image_name)===u){const{image_name:h}=a,p=Pj(l),{data:m}=ue.endpoints.listImages.select(p)(l),_=m?$t.getSelectors().selectAll(m):[],v=_.findIndex(S=>S.image_name===h),y=_.filter(S=>S.image_name!==h),g=rl(v,0,y.length-1),b=y[g];t(pa(b||null))}s.isCanvasImage&&t($E()),i.forEach(h=>{var p;((p=n().generation.initialImage)==null?void 0:p.imageName)===h.image_name&&t(wE()),hs(Xi(n().controlAdapters),m=>{(m.controlImage===h.image_name||di(m)&&m.processedControlImage===h.image_name)&&(t(jl({id:m.id,controlImage:null})),t(_E({id:m.id,processedControlImage:null})))}),n().nodes.nodes.forEach(m=>{En(m)&&hs(m.data.inputs,_=>{var v;_.type==="ImageField"&&((v=_.value)==null?void 0:v.image_name)===h.image_name&&t(X_({nodeId:m.data.id,fieldName:_.name,value:void 0}))})})});const{requestId:c}=t(ue.endpoints.deleteImage.initiate(a));await r(h=>ue.endpoints.deleteImage.matchFulfilled(h)&&h.meta.requestId===c,3e4)&&t(Do.util.invalidateTags([{type:"Board",id:a.board_id??"none"}]))}})},oxe=()=>{pe({actionCreator:IA,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTOs:r,imagesUsage:i}=e.payload;if(!(r.length<=1||i.length<=1))try{await t(ue.endpoints.deleteImages.initiate({imageDTOs:r})).unwrap();const o=n(),a=Pj(o),{data:s}=ue.endpoints.listImages.select(a)(o),l=s?$t.getSelectors().selectAll(s)[0]:void 0;t(pa(l||null)),t(NE(!1)),i.some(u=>u.isCanvasImage)&&t($E()),r.forEach(u=>{var c;((c=n().generation.initialImage)==null?void 0:c.imageName)===u.image_name&&t(wE()),hs(Xi(n().controlAdapters),d=>{(d.controlImage===u.image_name||di(d)&&d.processedControlImage===u.image_name)&&(t(jl({id:d.id,controlImage:null})),t(_E({id:d.id,processedControlImage:null})))}),n().nodes.nodes.forEach(d=>{En(d)&&hs(d.data.inputs,f=>{var h;f.type==="ImageField"&&((h=f.value)==null?void 0:h.image_name)===u.image_name&&t(X_({nodeId:d.data.id,fieldName:f.name,value:void 0}))})})})}catch{}}})},axe=()=>{pe({matcher:ue.endpoints.deleteImage.matchPending,effect:()=>{}})},sxe=()=>{pe({matcher:ue.endpoints.deleteImage.matchFulfilled,effect:e=>{le("images").debug({imageDTO:e.meta.arg.originalArgs},"Image deleted")}})},lxe=()=>{pe({matcher:ue.endpoints.deleteImage.matchRejected,effect:e=>{le("images").debug({imageDTO:e.meta.arg.originalArgs},"Unable to delete image")}})},kj=ve("dnd/dndDropped"),uxe=()=>{pe({actionCreator:kj,effect:async(e,{dispatch:t})=>{const n=le("dnd"),{activeData:r,overData:i}=e.payload;if(r.payloadType==="IMAGE_DTO"?n.debug({activeData:r,overData:i},"Image dropped"):r.payloadType==="IMAGE_DTOS"?n.debug({activeData:r,overData:i},`Images (${r.payload.imageDTOs.length}) dropped`):r.payloadType==="NODE_FIELD"?n.debug({activeData:ft(r),overData:ft(i)},"Node field dropped"):n.debug({activeData:r,overData:i},"Unknown payload dropped"),i.actionType==="ADD_FIELD_TO_LINEAR"&&r.payloadType==="NODE_FIELD"){const{nodeId:o,field:a}=r.payload;t(Dye({nodeId:o,fieldName:a.name}))}if(i.actionType==="SET_CURRENT_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(pa(r.payload.imageDTO));return}if(i.actionType==="SET_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(t_(r.payload.imageDTO));return}if(i.actionType==="SET_CONTROL_ADAPTER_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{id:o}=i.context;t(jl({id:o,controlImage:r.payload.imageDTO.image_name})),t(hm({id:o,isEnabled:!0}));return}if(i.actionType==="SET_CANVAS_INITIAL_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){t(HL(r.payload.imageDTO));return}if(i.actionType==="SET_NODES_IMAGE"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{fieldName:o,nodeId:a}=i.context;t(X_({nodeId:a,fieldName:o,value:r.payload.imageDTO}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload,{boardId:a}=i.context;t(ue.endpoints.addImageToBoard.initiate({imageDTO:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTO"&&r.payload.imageDTO){const{imageDTO:o}=r.payload;t(ue.endpoints.removeImageFromBoard.initiate({imageDTO:o}));return}if(i.actionType==="ADD_TO_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload,{boardId:a}=i.context;t(ue.endpoints.addImagesToBoard.initiate({imageDTOs:o,board_id:a}));return}if(i.actionType==="REMOVE_FROM_BOARD"&&r.payloadType==="IMAGE_DTOS"&&r.payload.imageDTOs){const{imageDTOs:o}=r.payload;t(ue.endpoints.removeImagesFromBoard.initiate({imageDTOs:o}));return}}})},cxe=()=>{pe({matcher:ue.endpoints.removeImageFromBoard.matchFulfilled,effect:e=>{const t=le("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Image removed from board")}})},dxe=()=>{pe({matcher:ue.endpoints.removeImageFromBoard.matchRejected,effect:e=>{const t=le("images"),n=e.meta.arg.originalArgs;t.debug({imageDTO:n},"Problem removing image from board")}})},fxe=()=>{pe({actionCreator:dle,effect:async(e,{dispatch:t,getState:n})=>{const r=e.payload,i=n(),{shouldConfirmOnDelete:o}=i.system,a=Jve(n()),s=a.some(l=>l.isCanvasImage)||a.some(l=>l.isInitialImage)||a.some(l=>l.isControlImage)||a.some(l=>l.isNodesImage);if(o||s){t(NE(!0));return}t(IA({imageDTOs:r,imagesUsage:a}))}})},hxe=()=>{pe({matcher:ue.endpoints.uploadImage.matchFulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=le("images"),i=e.payload,o=n(),{autoAddBoardId:a}=o.gallery;r.debug({imageDTO:i},"Image uploaded");const{postUploadAction:s}=e.meta.arg.originalArgs;if(e.payload.is_intermediate&&!s)return;const l={title:K("toast.imageUploaded"),status:"success"};if((s==null?void 0:s.type)==="TOAST"){const{toastOptions:u}=s;if(!a||a==="none")t(nt({...l,...u}));else{t(ue.endpoints.addImageToBoard.initiate({board_id:a,imageDTO:i}));const{data:c}=Qe.endpoints.listAllBoards.select()(o),d=c==null?void 0:c.find(h=>h.board_id===a),f=d?`${K("toast.addedToBoard")} ${d.board_name}`:`${K("toast.addedToBoard")} ${a}`;t(nt({...l,description:f}))}return}if((s==null?void 0:s.type)==="SET_CANVAS_INITIAL_IMAGE"){t(HL(i)),t(nt({...l,description:K("toast.setCanvasInitialImage")}));return}if((s==null?void 0:s.type)==="SET_CONTROL_ADAPTER_IMAGE"){const{id:u}=s;t(hm({id:u,isEnabled:!0})),t(jl({id:u,controlImage:i.image_name})),t(nt({...l,description:K("toast.setControlImage")}));return}if((s==null?void 0:s.type)==="SET_INITIAL_IMAGE"){t(t_(i)),t(nt({...l,description:K("toast.setInitialImage")}));return}if((s==null?void 0:s.type)==="SET_NODES_IMAGE"){const{nodeId:u,fieldName:c}=s;t(X_({nodeId:u,fieldName:c,value:i})),t(nt({...l,description:`${K("toast.setNodeField")} ${c}`}));return}}})},pxe=()=>{pe({matcher:ue.endpoints.uploadImage.matchRejected,effect:(e,{dispatch:t})=>{const n=le("images"),r={arg:{...Mf(e.meta.arg.originalArgs,["file","postUploadAction"]),file:""}};n.error({...r},"Image upload failed"),t(nt({title:K("toast.imageUploadFailed"),description:e.error.message,status:"error"}))}})},gxe=()=>{pe({matcher:ue.endpoints.starImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!0}):a.push(s)}),t(DF(a))}})},mxe=()=>{pe({matcher:ue.endpoints.unstarImages.matchFulfilled,effect:async(e,{dispatch:t,getState:n})=>{const{updated_image_names:r}=e.payload,i=n(),{selection:o}=i.gallery,a=[];o.forEach(s=>{r.includes(s.image_name)?a.push({...s,starred:!1}):a.push(s)}),t(DF(a))}})},yxe=ve("generation/initialImageSelected"),vxe=ve("generation/modelSelected"),bxe=()=>{pe({actionCreator:yxe,effect:(e,{dispatch:t})=>{if(!e.payload){t(nt(tc({title:K("toast.imageNotLoadedDesc"),status:"error"})));return}t(t_(e.payload)),t(nt(tc(K("toast.sentToImageToImage"))))}})},_xe=()=>{pe({actionCreator:vxe,effect:(e,{getState:t,dispatch:n})=>{var l,u;const r=le("models"),i=t(),o=gm.safeParse(e.payload);if(!o.success){r.error({error:o.error.format()},"Failed to parse main model");return}const a=o.data,{base_model:s}=a;if(((l=i.generation.model)==null?void 0:l.base_model)!==s){let c=0;hs(i.lora.loras,(f,h)=>{f.base_model!==s&&(n(FF(h)),c+=1)});const{vae:d}=i.generation;d&&d.base_model!==s&&(n(iL(null)),c+=1),Xi(i.controlAdapters).forEach(f=>{var h;((h=f.model)==null?void 0:h.base_model)!==s&&(n(hm({id:f.id,isEnabled:!1})),c+=1)}),c>0&&n(nt(tc({title:K("toast.baseModelChangedCleared",{count:c}),status:"warning"})))}((u=i.generation.model)==null?void 0:u.base_model)!==a.base_model&&i.ui.shouldAutoChangeDimensions&&(["sdxl","sdxl-refiner"].includes(a.base_model)?(n(d6(1024)),n(f6(1024)),n(F6({width:1024,height:1024}))):(n(d6(512)),n(f6(512)),n(F6({width:512,height:512})))),n(il(a))}})},Pg=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),QI=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),YI=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),ZI=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),JI=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),e9=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),t9=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),Q5=Qi({sortComparer:(e,t)=>e.model_name.localeCompare(t.model_name)}),Sxe=({base_model:e,model_type:t,model_name:n})=>`${e}/${t}/${n}`,Ns=e=>{const t=[];return e.forEach(n=>{const r={...et(n),id:Sxe(n)};t.push(r)}),t},Xo=Do.injectEndpoints({endpoints:e=>({getOnnxModels:e.query({query:t=>{const n={model_type:"onnx",base_models:t};return`models/?${lp.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"OnnxModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"OnnxModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return QI.setAll(QI.getInitialState(),n)}}),getMainModels:e.query({query:t=>{const n={model_type:"main",base_models:t};return`models/?${lp.stringify(n,{arrayFormat:"none"})}`},providesTags:t=>{const n=[{type:"MainModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"MainModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return Pg.setAll(Pg.getInitialState(),n)}}),updateMainModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/main/${n}`,method:"PATCH",body:r}),invalidatesTags:["Model"]}),importMainModels:e.mutation({query:({body:t})=>({url:"models/import",method:"POST",body:t}),invalidatesTags:["Model"]}),addMainModels:e.mutation({query:({body:t})=>({url:"models/add",method:"POST",body:t}),invalidatesTags:["Model"]}),deleteMainModels:e.mutation({query:({base_model:t,model_name:n,model_type:r})=>({url:`models/${t}/${r}/${n}`,method:"DELETE"}),invalidatesTags:["Model"]}),convertMainModels:e.mutation({query:({base_model:t,model_name:n,convert_dest_directory:r})=>({url:`models/convert/${t}/main/${n}`,method:"PUT",params:{convert_dest_directory:r}}),invalidatesTags:["Model"]}),mergeMainModels:e.mutation({query:({base_model:t,body:n})=>({url:`models/merge/${t}`,method:"PUT",body:n}),invalidatesTags:["Model"]}),syncModels:e.mutation({query:()=>({url:"models/sync",method:"POST"}),invalidatesTags:["Model"]}),getLoRAModels:e.query({query:()=>({url:"models/",params:{model_type:"lora"}}),providesTags:t=>{const n=[{type:"LoRAModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"LoRAModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return YI.setAll(YI.getInitialState(),n)}}),updateLoRAModels:e.mutation({query:({base_model:t,model_name:n,body:r})=>({url:`models/${t}/lora/${n}`,method:"PATCH",body:r}),invalidatesTags:[{type:"LoRAModel",id:kr}]}),deleteLoRAModels:e.mutation({query:({base_model:t,model_name:n})=>({url:`models/${t}/lora/${n}`,method:"DELETE"}),invalidatesTags:[{type:"LoRAModel",id:kr}]}),getControlNetModels:e.query({query:()=>({url:"models/",params:{model_type:"controlnet"}}),providesTags:t=>{const n=[{type:"ControlNetModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"ControlNetModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return ZI.setAll(ZI.getInitialState(),n)}}),getIPAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"ip_adapter"}}),providesTags:t=>{const n=[{type:"IPAdapterModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"IPAdapterModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return JI.setAll(JI.getInitialState(),n)}}),getT2IAdapterModels:e.query({query:()=>({url:"models/",params:{model_type:"t2i_adapter"}}),providesTags:t=>{const n=[{type:"T2IAdapterModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"T2IAdapterModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return e9.setAll(e9.getInitialState(),n)}}),getVaeModels:e.query({query:()=>({url:"models/",params:{model_type:"vae"}}),providesTags:t=>{const n=[{type:"VaeModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"VaeModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return Q5.setAll(Q5.getInitialState(),n)}}),getTextualInversionModels:e.query({query:()=>({url:"models/",params:{model_type:"embedding"}}),providesTags:t=>{const n=[{type:"TextualInversionModel",id:kr},"Model"];return t&&n.push(...t.ids.map(r=>({type:"TextualInversionModel",id:r}))),n},transformResponse:t=>{const n=Ns(t.models);return t9.setAll(t9.getInitialState(),n)}}),getModelsInFolder:e.query({query:t=>({url:`/models/search?${lp.stringify(t,{})}`})}),getCheckpointConfigs:e.query({query:()=>({url:"/models/ckpt_confs"})})})}),{useGetMainModelsQuery:UVe,useGetOnnxModelsQuery:GVe,useGetControlNetModelsQuery:HVe,useGetIPAdapterModelsQuery:qVe,useGetT2IAdapterModelsQuery:WVe,useGetLoRAModelsQuery:KVe,useGetTextualInversionModelsQuery:XVe,useGetVaeModelsQuery:QVe,useUpdateMainModelsMutation:YVe,useDeleteMainModelsMutation:ZVe,useImportMainModelsMutation:JVe,useAddMainModelsMutation:eUe,useConvertMainModelsMutation:tUe,useMergeMainModelsMutation:nUe,useDeleteLoRAModelsMutation:rUe,useUpdateLoRAModelsMutation:iUe,useSyncModelsMutation:oUe,useGetModelsInFolderQuery:aUe,useGetCheckpointConfigsQuery:sUe}=Xo,xxe=()=>{pe({predicate:e=>Xo.endpoints.getMainModels.matchFulfilled(e)&&!e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=le("models");r.info({models:e.payload.entities},`Main models loaded (${e.payload.ids.length})`);const i=t().generation.model,o=Pg.getSelectors().selectAll(e.payload);if(o.length===0){n(il(null));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=gm.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse main model");return}n(il(s.data))}}),pe({predicate:e=>Xo.endpoints.getMainModels.matchFulfilled(e)&&e.meta.arg.originalArgs.includes("sdxl-refiner"),effect:async(e,{getState:t,dispatch:n})=>{const r=le("models");r.info({models:e.payload.entities},`SDXL Refiner models loaded (${e.payload.ids.length})`);const i=t().sdxl.refinerModel,o=Pg.getSelectors().selectAll(e.payload);if(o.length===0){n(iI(null)),n(zye(!1));return}if(i?o.some(l=>l.model_name===i.model_name&&l.base_model===i.base_model&&l.model_type===i.model_type):!1)return;const s=SE.safeParse(o[0]);if(!s.success){r.error({error:s.error.format()},"Failed to parse SDXL Refiner Model");return}n(iI(s.data))}}),pe({matcher:Xo.endpoints.getVaeModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{const r=le("models");r.info({models:e.payload.entities},`VAEs loaded (${e.payload.ids.length})`);const i=t().generation.vae;if(i===null||Bc(e.payload.entities,l=>(l==null?void 0:l.model_name)===(i==null?void 0:i.model_name)&&(l==null?void 0:l.base_model)===(i==null?void 0:i.base_model)))return;const a=Q5.getSelectors().selectAll(e.payload)[0];if(!a){n(il(null));return}const s=woe.safeParse(a);if(!s.success){r.error({error:s.error.format()},"Failed to parse VAE model");return}n(iL(s.data))}}),pe({matcher:Xo.endpoints.getLoRAModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{le("models").info({models:e.payload.entities},`LoRAs loaded (${e.payload.ids.length})`);const i=t().lora.loras;hs(i,(o,a)=>{Bc(e.payload.entities,l=>(l==null?void 0:l.model_name)===(o==null?void 0:o.model_name)&&(l==null?void 0:l.base_model)===(o==null?void 0:o.base_model))||n(FF(a))})}}),pe({matcher:Xo.endpoints.getControlNetModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{le("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),VD(t().controlAdapters).forEach(i=>{Bc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(wx({id:i.id}))})}}),pe({matcher:Xo.endpoints.getT2IAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{le("models").info({models:e.payload.entities},`ControlNet models loaded (${e.payload.ids.length})`),UD(t().controlAdapters).forEach(i=>{Bc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(wx({id:i.id}))})}}),pe({matcher:Xo.endpoints.getIPAdapterModels.matchFulfilled,effect:async(e,{getState:t,dispatch:n})=>{le("models").info({models:e.payload.entities},`IP Adapter models loaded (${e.payload.ids.length})`),oie(t().controlAdapters).forEach(i=>{Bc(e.payload.entities,a=>{var s,l;return(a==null?void 0:a.model_name)===((s=i==null?void 0:i.model)==null?void 0:s.model_name)&&(a==null?void 0:a.base_model)===((l=i==null?void 0:i.model)==null?void 0:l.base_model)})||n(wx({id:i.id}))})}}),pe({matcher:Xo.endpoints.getTextualInversionModels.matchFulfilled,effect:async e=>{le("models").info({models:e.payload.entities},`Embeddings loaded (${e.payload.ids.length})`)}})},wxe=Do.injectEndpoints({endpoints:e=>({dynamicPrompts:e.query({query:t=>({url:"utilities/dynamicprompts",body:t,method:"POST"}),keepUnusedDataFor:86400})})}),Cxe=Br($oe,mle,ple,gle,uE),Exe=()=>{pe({matcher:Cxe,effect:async(e,{dispatch:t,getState:n,cancelActiveListeners:r,delay:i})=>{r(),await i(1e3);const o=n();if(o.config.disabledFeatures.includes("dynamicPrompting"))return;const{positivePrompt:a}=o.generation,{maxPrompts:s}=o.dynamicPrompts;t(kx(!0));try{const l=t(wxe.endpoints.dynamicPrompts.initiate({prompt:a,max_prompts:s})),u=await l.unwrap();l.unsubscribe(),t(yle(u.prompts)),t(vle(u.error)),t(B6(!1)),t(kx(!1))}catch{t(B6(!0)),t(kx(!1))}}})},Ds=e=>e.$ref.split("/").slice(-1)[0],Axe=({schemaObject:e,baseField:t})=>{const n={...t,type:"integer",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},Txe=({schemaObject:e,baseField:t})=>{const n={...t,type:"IntegerPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},Pxe=({schemaObject:e,baseField:t})=>{const n=_a(e.item_default)&&Ene(e.item_default)?e.item_default:0;return{...t,type:"IntegerCollection",default:e.default??[],item_default:n}},kxe=({schemaObject:e,baseField:t})=>{const n={...t,type:"float",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},Ixe=({schemaObject:e,baseField:t})=>{const n={...t,type:"FloatPolymorphic",default:e.default??0};return e.multipleOf!==void 0&&(n.multipleOf=e.multipleOf),e.maximum!==void 0&&(n.maximum=e.maximum),e.exclusiveMaximum!==void 0&&_a(e.exclusiveMaximum)&&(n.exclusiveMaximum=e.exclusiveMaximum),e.minimum!==void 0&&(n.minimum=e.minimum),e.exclusiveMinimum!==void 0&&_a(e.exclusiveMinimum)&&(n.exclusiveMinimum=e.exclusiveMinimum),n},Mxe=({schemaObject:e,baseField:t})=>{const n=_a(e.item_default)?e.item_default:0;return{...t,type:"FloatCollection",default:e.default??[],item_default:n}},Rxe=({schemaObject:e,baseField:t})=>{const n={...t,type:"string",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},Oxe=({schemaObject:e,baseField:t})=>{const n={...t,type:"StringPolymorphic",default:e.default??""};return e.minLength!==void 0&&(n.minLength=e.minLength),e.maxLength!==void 0&&(n.maxLength=e.maxLength),e.pattern!==void 0&&(n.pattern=e.pattern),n},$xe=({schemaObject:e,baseField:t})=>{const n=oE(e.item_default)?e.item_default:"";return{...t,type:"StringCollection",default:e.default??[],item_default:n}},Nxe=({schemaObject:e,baseField:t})=>({...t,type:"boolean",default:e.default??!1}),Dxe=({schemaObject:e,baseField:t})=>({...t,type:"BooleanPolymorphic",default:e.default??!1}),Lxe=({schemaObject:e,baseField:t})=>{const n=e.item_default&&Cne(e.item_default)?e.item_default:!1;return{...t,type:"BooleanCollection",default:e.default??[],item_default:n}},Fxe=({schemaObject:e,baseField:t})=>({...t,type:"MainModelField",default:e.default??void 0}),Bxe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLMainModelField",default:e.default??void 0}),zxe=({schemaObject:e,baseField:t})=>({...t,type:"SDXLRefinerModelField",default:e.default??void 0}),jxe=({schemaObject:e,baseField:t})=>({...t,type:"VaeModelField",default:e.default??void 0}),Vxe=({schemaObject:e,baseField:t})=>({...t,type:"LoRAModelField",default:e.default??void 0}),Uxe=({schemaObject:e,baseField:t})=>({...t,type:"ControlNetModelField",default:e.default??void 0}),Gxe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterModelField",default:e.default??void 0}),Hxe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterModelField",default:e.default??void 0}),qxe=({schemaObject:e,baseField:t})=>({...t,type:"BoardField",default:e.default??void 0}),Wxe=({schemaObject:e,baseField:t})=>({...t,type:"ImageField",default:e.default??void 0}),Kxe=({schemaObject:e,baseField:t})=>({...t,type:"ImagePolymorphic",default:e.default??void 0}),Xxe=({schemaObject:e,baseField:t})=>({...t,type:"ImageCollection",default:e.default??[],item_default:e.item_default??void 0}),Qxe=({schemaObject:e,baseField:t})=>({...t,type:"DenoiseMaskField",default:e.default??void 0}),Yxe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsField",default:e.default??void 0}),Zxe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsPolymorphic",default:e.default??void 0}),Jxe=({schemaObject:e,baseField:t})=>({...t,type:"LatentsCollection",default:e.default??[],item_default:e.item_default??void 0}),ewe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningField",default:e.default??void 0}),twe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningPolymorphic",default:e.default??void 0}),nwe=({schemaObject:e,baseField:t})=>({...t,type:"ConditioningCollection",default:e.default??[],item_default:e.item_default??void 0}),rwe=({schemaObject:e,baseField:t})=>({...t,type:"UNetField",default:e.default??void 0}),iwe=({schemaObject:e,baseField:t})=>({...t,type:"ClipField",default:e.default??void 0}),owe=({schemaObject:e,baseField:t})=>({...t,type:"VaeField",default:e.default??void 0}),awe=({schemaObject:e,baseField:t})=>({...t,type:"ControlField",default:e.default??void 0}),swe=({schemaObject:e,baseField:t})=>({...t,type:"ControlPolymorphic",default:e.default??void 0}),lwe=({schemaObject:e,baseField:t})=>({...t,type:"ControlCollection",default:e.default??[],item_default:e.item_default??void 0}),uwe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterField",default:e.default??void 0}),cwe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterPolymorphic",default:e.default??void 0}),dwe=({schemaObject:e,baseField:t})=>({...t,type:"IPAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),fwe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterField",default:e.default??void 0}),hwe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterPolymorphic",default:e.default??void 0}),pwe=({schemaObject:e,baseField:t})=>({...t,type:"T2IAdapterCollection",default:e.default??[],item_default:e.item_default??void 0}),gwe=({schemaObject:e,baseField:t})=>{const n=e.enum??[];return{...t,type:"enum",options:n,ui_choice_labels:e.ui_choice_labels,default:e.default??n[0]}},mwe=({baseField:e})=>({...e,type:"Collection",default:[]}),ywe=({baseField:e})=>({...e,type:"CollectionItem",default:void 0}),vwe=({baseField:e})=>({...e,type:"Any",default:void 0}),bwe=({baseField:e})=>({...e,type:"MetadataItemField",default:void 0}),_we=({baseField:e})=>({...e,type:"MetadataItemCollection",default:void 0}),Swe=({baseField:e})=>({...e,type:"MetadataItemPolymorphic",default:void 0}),xwe=({baseField:e})=>({...e,type:"MetadataField",default:void 0}),wwe=({baseField:e})=>({...e,type:"MetadataCollection",default:void 0}),Cwe=({schemaObject:e,baseField:t})=>({...t,type:"ColorField",default:e.default??{r:127,g:127,b:127,a:255}}),Ewe=({schemaObject:e,baseField:t})=>({...t,type:"ColorPolymorphic",default:e.default??{r:127,g:127,b:127,a:255}}),Awe=({schemaObject:e,baseField:t})=>({...t,type:"ColorCollection",default:e.default??[]}),Twe=({schemaObject:e,baseField:t})=>({...t,type:"Scheduler",default:e.default??"euler"}),Y5=e=>{if(P0(e)){if(e.type){if(e.enum)return"enum";if(e.type){if(e.type==="number")return"float";if(e.type==="array"){const t=P0(e.items)?e.items.type:Ds(e.items);return Cn(t)?void 0:F0e(t)?oA[t]:void 0}else if(!Cn(e.type))return e.type}}else if(e.allOf){const t=e.allOf;if(t&&t[0]&&nu(t[0]))return Ds(t[0])}else if(e.anyOf){const t=e.anyOf.filter(i=>!(P0(i)&&i.type==="null"));if(t.length===1){if(nu(t[0]))return Ds(t[0]);if(P0(t[0]))return Y5(t[0])}let n,r;if(e8(t[0])){const i=t[0].items,o=t[1];nu(i)&&nu(o)?(n=Ds(i),r=Ds(o)):k0(i)&&k0(o)&&(n=i.type,r=o.type)}else if(e8(t[1])){const i=t[0],o=t[1].items;nu(i)&&nu(o)?(n=Ds(i),r=Ds(o)):k0(i)&&k0(o)&&(n=i.type,r=o.type)}if(n===r&&z0e(n))return oz[n]}}else if(nu(e))return Ds(e)},Ij={BoardField:qxe,Any:vwe,boolean:Nxe,BooleanCollection:Lxe,BooleanPolymorphic:Dxe,ClipField:iwe,Collection:mwe,CollectionItem:ywe,ColorCollection:Awe,ColorField:Cwe,ColorPolymorphic:Ewe,ConditioningCollection:nwe,ConditioningField:ewe,ConditioningPolymorphic:twe,ControlCollection:lwe,ControlField:awe,ControlNetModelField:Uxe,ControlPolymorphic:swe,DenoiseMaskField:Qxe,enum:gwe,float:kxe,FloatCollection:Mxe,FloatPolymorphic:Ixe,ImageCollection:Xxe,ImageField:Wxe,ImagePolymorphic:Kxe,integer:Axe,IntegerCollection:Pxe,IntegerPolymorphic:Txe,IPAdapterCollection:dwe,IPAdapterField:uwe,IPAdapterModelField:Gxe,IPAdapterPolymorphic:cwe,LatentsCollection:Jxe,LatentsField:Yxe,LatentsPolymorphic:Zxe,LoRAModelField:Vxe,MetadataItemField:bwe,MetadataItemCollection:_we,MetadataItemPolymorphic:Swe,MetadataField:xwe,MetadataCollection:wwe,MainModelField:Fxe,Scheduler:Twe,SDXLMainModelField:Bxe,SDXLRefinerModelField:zxe,string:Rxe,StringCollection:$xe,StringPolymorphic:Oxe,T2IAdapterCollection:pwe,T2IAdapterField:fwe,T2IAdapterModelField:Hxe,T2IAdapterPolymorphic:hwe,UNetField:rwe,VaeField:owe,VaeModelField:jxe},Pwe=e=>!!(e&&e in Ij),kwe=(e,t,n,r)=>{var p;const{input:i,ui_hidden:o,ui_component:a,ui_type:s,ui_order:l,ui_choice_labels:u,item_default:c}=t,d={input:Bh.includes(r)?"connection":i,ui_hidden:o,ui_component:a,ui_type:s,required:((p=e.required)==null?void 0:p.includes(n))??!1,ui_order:l,ui_choice_labels:u,item_default:c},f={name:n,title:t.title??(n?lE(n):""),description:t.description??"",fieldKind:"input",...d};if(!Pwe(r))return;const h=Ij[r];if(h)return h({schemaObject:t,baseField:f})},Iwe=["id","type","use_cache"],Mwe=["type"],Rwe=["IsIntermediate"],Owe=["graph"],$we=(e,t)=>!!(Iwe.includes(t)||e==="collect"&&t==="collection"||e==="iterate"&&t==="index"),Nwe=e=>!!Rwe.includes(e),Dwe=(e,t)=>!Mwe.includes(t),Lwe=e=>!Owe.includes(e.properties.type.default),Fwe=(e,t=void 0,n=void 0)=>{var o;return Object.values(((o=e.components)==null?void 0:o.schemas)??{}).filter(Wde).filter(Lwe).filter(a=>t?t.includes(a.properties.type.default):!0).filter(a=>n?!n.includes(a.properties.type.default):!0).reduce((a,s)=>{var S,x;const l=s.properties.type.default,u=s.title.replace("Invocation",""),c=s.tags??[],d=s.description??"",f=s.version;let h=!1;const p=t5(s.properties,(w,C,T)=>{if($we(l,T))return le("nodes").trace({node:l,fieldName:T,field:ft(C)},"Skipped reserved input field"),w;if(!t8(C))return le("nodes").warn({node:l,propertyName:T,property:ft(C)},"Unhandled input property"),w;const A=C.ui_type??Y5(C);if(!A)return le("nodes").warn({node:l,fieldName:T,fieldType:A,field:ft(C)},"Missing input field type"),w;if(A==="WorkflowField")return h=!0,w;if(Nwe(A))return le("nodes").trace({node:l,fieldName:T,fieldType:A,field:ft(C)},`Skipping reserved input field type: ${A}`),w;if(!J6(A))return le("nodes").warn({node:l,fieldName:T,fieldType:A,field:ft(C)},`Skipping unknown input field type: ${A}`),w;const k=kwe(s,C,T,A);return k?(w[T]=k,w):(le("nodes").warn({node:l,fieldName:T,fieldType:A,field:ft(C)},"Skipping input field with no template"),w)},{}),m=s.output.$ref.split("/").pop();if(!m)return le("nodes").warn({outputRefObject:ft(s.output)},"No output schema name found in ref object"),a;const _=(x=(S=e.components)==null?void 0:S.schemas)==null?void 0:x[m];if(!_)return le("nodes").warn({outputSchemaName:m},"Output schema not found"),a;if(!Kde(_))return le("nodes").error({outputSchema:ft(_)},"Invalid output schema"),a;const v=_.properties.type.default,y=t5(_.properties,(w,C,T)=>{if(!Dwe(l,T))return le("nodes").trace({type:l,propertyName:T,property:ft(C)},"Skipped reserved output field"),w;if(!t8(C))return le("nodes").warn({type:l,propertyName:T,property:ft(C)},"Unhandled output property"),w;const A=C.ui_type??Y5(C);return J6(A)?(w[T]={fieldKind:"output",name:T,title:C.title??(T?lE(T):""),description:C.description??"",type:A,ui_hidden:C.ui_hidden??!1,ui_type:C.ui_type,ui_order:C.ui_order},w):(le("nodes").warn({fieldName:T,fieldType:A,field:ft(C)},"Skipping unknown output field type"),w)},{}),g=s.properties.use_cache.default,b={title:u,type:l,version:f,tags:c,description:d,outputType:v,inputs:p,outputs:y,useCache:g,withWorkflow:h};return Object.assign(a,{[l]:b}),a},{})},Bwe=()=>{pe({actionCreator:wg.fulfilled,effect:(e,{dispatch:t,getState:n})=>{const r=le("system"),i=e.payload;r.debug({schemaJSON:i},"Received OpenAPI schema");const{nodesAllowlist:o,nodesDenylist:a}=n().config,s=Fwe(i,o,a);r.debug({nodeTemplates:ft(s)},`Built ${Kb(s)} node templates`),t(gz(s))}}),pe({actionCreator:wg.rejected,effect:e=>{le("system").error({error:ft(e.error)},"Problem retrieving OpenAPI Schema")}})},zwe=()=>{pe({actionCreator:xD,effect:(e,{dispatch:t,getState:n})=>{le("socketio").debug("Connected");const{nodes:i,config:o,system:a}=n(),{disabledTabs:s}=o;!Kb(i.nodeTemplates)&&!s.includes("nodes")&&t(wg()),a.isInitialized?t(Do.util.resetApiState()):t(Hye(!0)),t(uE(e.payload))}})},jwe=()=>{pe({actionCreator:wD,effect:(e,{dispatch:t})=>{le("socketio").debug("Disconnected"),t(CD(e.payload))}})},Vwe=()=>{pe({actionCreator:kD,effect:(e,{dispatch:t})=>{le("socketio").trace(e.payload,"Generator progress"),t(hE(e.payload))}})},Uwe=()=>{pe({actionCreator:TD,effect:(e,{dispatch:t})=>{le("socketio").debug(e.payload,"Session complete"),t(PD(e.payload))}})},Gwe=["load_image","image"],Hwe=()=>{pe({actionCreator:dE,effect:async(e,{dispatch:t,getState:n})=>{const r=le("socketio"),{data:i}=e.payload;r.debug({data:ft(i)},`Invocation complete (${e.payload.data.node.type})`);const{result:o,node:a,queue_batch_id:s}=i;if(Sj(o)&&!Gwe.includes(a.type)){const{image_name:l}=o.image,{canvas:u,gallery:c}=n(),d=await t(ue.endpoints.getImageDTO.initiate(l)).unwrap();if(u.batchIds.includes(s)&&[de].includes(i.source_node_id)&&t(ele(d)),!d.is_intermediate){t(ue.util.updateQueryData("listImages",{board_id:d.board_id??"none",categories:Ln},h=>{$t.addOne(h,d)})),t(Qe.util.updateQueryData("getBoardImagesTotal",d.board_id??"none",h=>{h.total+=1})),t(ue.util.invalidateTags([{type:"Board",id:d.board_id??"none"}]));const{shouldAutoSwitch:f}=c;f&&(c.galleryView!=="images"&&t(m5("images")),d.board_id&&d.board_id!==c.selectedBoardId&&t(C1({boardId:d.board_id,selectedImageName:d.image_name})),!d.board_id&&c.selectedBoardId!=="none"&&t(C1({boardId:"none",selectedImageName:d.image_name})),t(pa(d)))}}t(fE(e.payload))}})},qwe=()=>{pe({actionCreator:AD,effect:(e,{dispatch:t})=>{le("socketio").error(e.payload,`Invocation error (${e.payload.data.node.type})`),t(Xb(e.payload))}})},Wwe=()=>{pe({actionCreator:DD,effect:(e,{dispatch:t})=>{le("socketio").error(e.payload,`Invocation retrieval error (${e.payload.data.graph_execution_state_id})`),t(LD(e.payload))}})},Kwe=()=>{pe({actionCreator:ED,effect:(e,{dispatch:t})=>{le("socketio").debug(e.payload,`Invocation started (${e.payload.data.node.type})`),t(cE(e.payload))}})},Xwe=()=>{pe({actionCreator:ID,effect:(e,{dispatch:t})=>{const n=le("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load started: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(MD(e.payload))}}),pe({actionCreator:RD,effect:(e,{dispatch:t})=>{const n=le("socketio"),{base_model:r,model_name:i,model_type:o,submodel:a}=e.payload.data;let s=`Model load complete: ${r}/${o}/${i}`;a&&(s=s.concat(`/${a}`)),n.debug(e.payload,s),t(OD(e.payload))}})},Qwe=()=>{pe({actionCreator:FD,effect:async(e,{dispatch:t})=>{const n=le("socketio"),{queue_item:r,batch_status:i,queue_status:o}=e.payload.data;n.debug(e.payload,`Queue item ${r.item_id} status updated: ${r.status}`),t(ln.util.updateQueryData("listQueueItems",void 0,a=>{yu.updateOne(a,{id:r.item_id,changes:r})})),t(ln.util.updateQueryData("getQueueStatus",void 0,a=>{a&&Object.assign(a.queue,o)})),t(ln.util.updateQueryData("getBatchStatus",{batch_id:i.batch_id},()=>i)),t(ln.util.updateQueryData("getQueueItem",r.item_id,a=>{a&&Object.assign(a,r)})),t(ln.util.invalidateTags(["CurrentSessionQueueItem","NextSessionQueueItem","InvocationCacheStatus"])),t(Qb(e.payload))}})},Ywe=()=>{pe({actionCreator:$D,effect:(e,{dispatch:t})=>{le("socketio").error(e.payload,`Session retrieval error (${e.payload.data.graph_execution_state_id})`),t(ND(e.payload))}})},Zwe=()=>{pe({actionCreator:Tre,effect:(e,{dispatch:t})=>{le("socketio").debug(e.payload,"Subscribed"),t(Pre(e.payload))}})},Jwe=()=>{pe({actionCreator:kre,effect:(e,{dispatch:t})=>{le("socketio").debug(e.payload,"Unsubscribed"),t(Ire(e.payload))}})},eCe=()=>{pe({actionCreator:s1e,effect:async(e,{dispatch:t,getState:n})=>{const{imageDTO:r}=e.payload;try{const i=await t(ue.endpoints.changeImageIsIntermediate.initiate({imageDTO:r,is_intermediate:!1})).unwrap(),{autoAddBoardId:o}=n().gallery;o&&o!=="none"&&await t(ue.endpoints.addImageToBoard.initiate({imageDTO:i,board_id:o})),t(nt({title:K("toast.imageSaved"),status:"success"}))}catch(i){t(nt({title:K("toast.imageSavingFailed"),description:i==null?void 0:i.message,status:"error"}))}}})},lUe=["sd-1","sd-2","sdxl","sdxl-refiner"],tCe=["sd-1","sd-2","sdxl"],uUe=["sdxl"],cUe=["sd-1","sd-2"],dUe=["sdxl-refiner"],nCe=()=>{pe({actionCreator:Tz,effect:async(e,{getState:t,dispatch:n})=>{var i;if(e.payload==="unifiedCanvas"){const o=(i=t().generation.model)==null?void 0:i.base_model;if(o&&["sd-1","sd-2","sdxl"].includes(o))return;try{const a=n(Xo.endpoints.getMainModels.initiate(tCe)),s=await a.unwrap();if(a.unsubscribe(),!s.ids.length){n(il(null));return}const u=Pg.getSelectors().selectAll(s).filter(h=>["sd-1","sd-2","sxdl"].includes(h.base_model))[0];if(!u){n(il(null));return}const{base_model:c,model_name:d,model_type:f}=u;n(il({base_model:c,model_name:d,model_type:f}))}catch{n(il(null))}}}})},rCe=({image_name:e,esrganModelName:t,autoAddBoardId:n})=>{const r={id:ow,type:"esrgan",image:{image_name:e},model_name:t,is_intermediate:!0},i={id:Ao,type:"save_image",use_cache:!1,is_intermediate:!1,board:n==="none"?void 0:{board_id:n}},o={id:"adhoc-esrgan-graph",nodes:{[ow]:r,[Ao]:i},edges:[{source:{node_id:ow,field:"image"},destination:{node_id:Ao,field:"image"}}]};return Ps(o,{}),Lo(o,{esrgan_model:t}),o},iCe=()=>VL(),Mj=$L;function oCe(){if(console&&console.warn){for(var e=arguments.length,t=new Array(e),n=0;n()=>{if(e.isInitialized)t();else{const n=()=>{setTimeout(()=>{e.off("initialized",n)},0),t()};e.on("initialized",n)}};function r9(e,t,n){e.loadNamespaces(t,Rj(e,n))}function i9(e,t,n,r){typeof n=="string"&&(n=[n]),n.forEach(i=>{e.options.ns.indexOf(i)<0&&e.options.ns.push(i)}),e.loadLanguages(t,Rj(e,r))}function aCe(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=t.languages[0],i=t.options?t.options.fallbackLng:!1,o=t.languages[t.languages.length-1];if(r.toLowerCase()==="cimode")return!0;const a=(s,l)=>{const u=t.services.backendConnector.state[`${s}|${l}`];return u===-1||u===2};return n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&t.services.backendConnector.backend&&t.isLanguageChangingTo&&!a(t.isLanguageChangingTo,e)?!1:!!(t.hasResourceBundle(r,e)||!t.services.backendConnector.backend||t.options.resources&&!t.options.partialBundledLanguages||a(r,e)&&(!i||a(o,e)))}function sCe(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return!t.languages||!t.languages.length?(Z5("i18n.languages were undefined or empty",t.languages),!0):t.options.ignoreJSONStructure!==void 0?t.hasLoadedNamespace(e,{lng:n.lng,precheck:(i,o)=>{if(n.bindI18n&&n.bindI18n.indexOf("languageChanging")>-1&&i.services.backendConnector.backend&&i.isLanguageChangingTo&&!o(i.isLanguageChangingTo,e))return!1}}):aCe(e,t,n)}const lCe=/&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34|nbsp|#160|copy|#169|reg|#174|hellip|#8230|#x2F|#47);/g,uCe={"&":"&","&":"&","<":"<","<":"<",">":">",">":">","'":"'","'":"'",""":'"',""":'"'," ":" "," ":" ","©":"©","©":"©","®":"®","®":"®","…":"…","…":"…","/":"/","/":"/"},cCe=e=>uCe[e],dCe=e=>e.replace(lCe,cCe);let J5={bindI18n:"languageChanged",bindI18nStore:"",transEmptyNodeValue:"",transSupportBasicHtmlNodes:!0,transWrapTextNodes:"",transKeepBasicHtmlNodesFor:["br","strong","i","p"],useSuspense:!0,unescape:dCe};function fCe(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};J5={...J5,...e}}function hCe(){return J5}let Oj;function pCe(e){Oj=e}function gCe(){return Oj}const mCe={type:"3rdParty",init(e){fCe(e.options.react),pCe(e)}},yCe=I.createContext();class vCe{constructor(){this.usedNamespaces={}}addUsedNamespaces(t){t.forEach(n=>{this.usedNamespaces[n]||(this.usedNamespaces[n]=!0)})}getUsedNamespaces(){return Object.keys(this.usedNamespaces)}}const bCe=(e,t)=>{const n=I.useRef();return I.useEffect(()=>{n.current=t?n.current:e},[e,t]),n.current};function _Ce(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{i18n:n}=t,{i18n:r,defaultNS:i}=I.useContext(yCe)||{},o=n||r||gCe();if(o&&!o.reportNamespaces&&(o.reportNamespaces=new vCe),!o){Z5("You will need to pass in an i18next instance by using initReactI18next");const g=(S,x)=>typeof x=="string"?x:x&&typeof x=="object"&&typeof x.defaultValue=="string"?x.defaultValue:Array.isArray(S)?S[S.length-1]:S,b=[g,{},!1];return b.t=g,b.i18n={},b.ready=!1,b}o.options.react&&o.options.react.wait!==void 0&&Z5("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");const a={...hCe(),...o.options.react,...t},{useSuspense:s,keyPrefix:l}=a;let u=e||i||o.options&&o.options.defaultNS;u=typeof u=="string"?[u]:u||["translation"],o.reportNamespaces.addUsedNamespaces&&o.reportNamespaces.addUsedNamespaces(u);const c=(o.isInitialized||o.initializedStoreOnce)&&u.every(g=>sCe(g,o,a));function d(){return o.getFixedT(t.lng||null,a.nsMode==="fallback"?u:u[0],l)}const[f,h]=I.useState(d);let p=u.join();t.lng&&(p=`${t.lng}${p}`);const m=bCe(p),_=I.useRef(!0);I.useEffect(()=>{const{bindI18n:g,bindI18nStore:b}=a;_.current=!0,!c&&!s&&(t.lng?i9(o,t.lng,u,()=>{_.current&&h(d)}):r9(o,u,()=>{_.current&&h(d)})),c&&m&&m!==p&&_.current&&h(d);function S(){_.current&&h(d)}return g&&o&&o.on(g,S),b&&o&&o.store.on(b,S),()=>{_.current=!1,g&&o&&g.split(" ").forEach(x=>o.off(x,S)),b&&o&&b.split(" ").forEach(x=>o.store.off(x,S))}},[o,p]);const v=I.useRef(!0);I.useEffect(()=>{_.current&&!v.current&&h(d),v.current=!1},[o,l]);const y=[f,o,c];if(y.t=f,y.i18n=o,y.ready=c,c||!c&&!s)return y;throw new Promise(g=>{t.lng?i9(o,t.lng,u,()=>g()):r9(o,u,()=>g())})}const SCe=(e,t)=>{if(!e||!t)return;const{width:n,height:r}=e,i=r*4*n*4,o=r*2*n*2;return{x4:i,x2:o}},xCe=(e,t)=>{if(!e||!t)return{x4:!0,x2:!0};const n={x4:!1,x2:!1};return e.x4<=t&&(n.x4=!0),e.x2<=t&&(n.x2=!0),n},wCe=(e,t)=>{if(!(!e||!t)&&!(e.x4&&e.x2)){if(!e.x2&&!e.x4)return"parameters.isAllowedToUpscale.tooLarge";if(!e.x4&&e.x2&&t===4)return"parameters.isAllowedToUpscale.useX2Model"}},$j=e=>ir(kG,({postprocessing:t,config:n})=>{const{esrganModelName:r}=t,{maxUpscalePixels:i}=n,o=SCe(e,i),a=xCe(o,i),s=r.includes("x2")?2:4,l=wCe(a,s);return{isAllowedToUpscale:s===2?a.x2:a.x4,detailTKey:l}},Y_),fUe=e=>{const{t}=_Ce(),n=I.useMemo(()=>$j(e),[e]),{isAllowedToUpscale:r,detailTKey:i}=Mj(n);return{isAllowedToUpscale:r,detail:i?t(i):void 0}},CCe=ve("upscale/upscaleRequested"),ECe=()=>{pe({actionCreator:CCe,effect:async(e,{dispatch:t,getState:n})=>{var f;const r=le("session"),{imageDTO:i}=e.payload,{image_name:o}=i,a=n(),{isAllowedToUpscale:s,detailTKey:l}=$j(i)(a);if(!s){r.error({imageDTO:i},K(l??"parameters.isAllowedToUpscale.tooLarge")),t(nt({title:K(l??"parameters.isAllowedToUpscale.tooLarge"),status:"error"}));return}const{esrganModelName:u}=a.postprocessing,{autoAddBoardId:c}=a.gallery,d={prepend:!0,batch:{graph:rCe({image_name:o,esrganModelName:u,autoAddBoardId:c}),runs:1}};try{const h=t(ln.endpoints.enqueueBatch.initiate(d,{fixedCacheKey:"enqueueBatch"})),p=await h.unwrap();h.reset(),r.debug({enqueueResult:ft(p)},K("queue.graphQueued"))}catch(h){if(r.error({enqueueBatchArg:ft(d)},K("queue.graphFailedToQueue")),h instanceof Object&&"data"in h&&"status"in h&&h.status===403){const p=((f=h.data)==null?void 0:f.detail)||"Unknown Error";t(nt({title:K("queue.graphFailedToQueue"),status:"error",description:p,duration:15e3}));return}t(nt({title:K("queue.graphFailedToQueue"),status:"error"}))}}})},ACe=Ta(null),TCe=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,o9=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const t=e.match(TCe);if(!t)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return t.shift(),t},a9=e=>e==="*"||e==="x"||e==="X",s9=e=>{const t=parseInt(e,10);return isNaN(t)?e:t},PCe=(e,t)=>typeof e!=typeof t?[String(e),String(t)]:[e,t],kCe=(e,t)=>{if(a9(e)||a9(t))return 0;const[n,r]=PCe(s9(e),s9(t));return n>r?1:n{for(let n=0;n{const n=o9(e),r=o9(t),i=n.pop(),o=r.pop(),a=l9(n,r);return a!==0?a:i&&o?l9(i.split("."),o.split(".")):i||o?i?-1:1:0},MCe=(e,t)=>{const n=et(e),{nodes:r,edges:i}=n,o=[],a=r.filter(g5),s=sE(a,"id");return r.forEach(l=>{if(!g5(l))return;const u=t[l.data.type];if(!u){o.push({message:`${oe.t("nodes.node")} "${l.data.type}" ${oe.t("nodes.skipped")}`,issues:[`${oe.t("nodes.nodeType")}"${l.data.type}" ${oe.t("nodes.doesNotExist")}`],data:l});return}if(u.version&&l.data.version&&ICe(u.version,l.data.version)!==0){o.push({message:`${oe.t("nodes.node")} "${l.data.type}" ${oe.t("nodes.mismatchedVersion")}`,issues:[`${oe.t("nodes.node")} "${l.data.type}" v${l.data.version} ${oe.t("nodes.maybeIncompatible")} v${u.version}`],data:{node:l,nodeTemplate:ft(u)}});return}}),i.forEach((l,u)=>{const c=s[l.source],d=s[l.target],f=[];if(c?l.type==="default"&&!(l.sourceHandle in c.data.outputs)&&f.push(`${oe.t("nodes.outputNode")} "${l.source}.${l.sourceHandle}" ${oe.t("nodes.doesNotExist")}`):f.push(`${oe.t("nodes.outputNode")} ${l.source} ${oe.t("nodes.doesNotExist")}`),d?l.type==="default"&&!(l.targetHandle in d.data.inputs)&&f.push(`${oe.t("nodes.inputField")} "${l.target}.${l.targetHandle}" ${oe.t("nodes.doesNotExist")}`):f.push(`${oe.t("nodes.inputNode")} ${l.target} ${oe.t("nodes.doesNotExist")}`),t[(c==null?void 0:c.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${oe.t("nodes.sourceNode")} "${l.source}" ${oe.t("nodes.missingTemplate")} "${c==null?void 0:c.data.type}"`),t[(d==null?void 0:d.data.type)??"__UNKNOWN_NODE_TYPE__"]||f.push(`${oe.t("nodes.sourceNode")}"${l.target}" ${oe.t("nodes.missingTemplate")} "${d==null?void 0:d.data.type}"`),f.length){delete i[u];const h=l.type==="default"?l.sourceHandle:l.source,p=l.type==="default"?l.targetHandle:l.target;o.push({message:`Edge "${h} -> ${p}" skipped`,issues:f,data:l})}}),{workflow:n,errors:o}},RCe=()=>{pe({actionCreator:Vve,effect:(e,{dispatch:t,getState:n})=>{const r=le("nodes"),i=e.payload,o=n().nodes.nodeTemplates,{workflow:a,errors:s}=MCe(i,o);t(Lye(a)),s.length?(t(nt(tc({title:K("toast.loadedWithWarnings"),status:"warning"}))),s.forEach(({message:l,...u})=>{r.warn(u,l)})):t(nt(tc({title:K("toast.workflowLoaded"),status:"success"}))),t(Tz("nodes")),requestAnimationFrame(()=>{var l;(l=ACe.get())==null||l.fitView()})}})};function OCe(e){if(e.sheet)return e.sheet;for(var t=0;t0?tr(Vf,--oi):0,_f--,Sn===10&&(_f=1,YS--),Sn}function yi(){return Sn=oi2||Ig(Sn)>3?"":" "}function qCe(e,t){for(;--t&&yi()&&!(Sn<48||Sn>102||Sn>57&&Sn<65||Sn>70&&Sn<97););return Im(e,Wy()+(t<6&&ma()==32&&yi()==32))}function t3(e){for(;yi();)switch(Sn){case e:return oi;case 34:case 39:e!==34&&e!==39&&t3(Sn);break;case 40:e===41&&t3(e);break;case 92:yi();break}return oi}function WCe(e,t){for(;yi()&&e+Sn!==47+10;)if(e+Sn===42+42&&ma()===47)break;return"/*"+Im(t,oi-1)+"*"+QS(e===47?e:yi())}function KCe(e){for(;!Ig(ma());)yi();return Im(e,oi)}function XCe(e){return zj(Xy("",null,null,null,[""],e=Bj(e),0,[0],e))}function Xy(e,t,n,r,i,o,a,s,l){for(var u=0,c=0,d=a,f=0,h=0,p=0,m=1,_=1,v=1,y=0,g="",b=i,S=o,x=r,w=g;_;)switch(p=y,y=yi()){case 40:if(p!=108&&tr(w,d-1)==58){e3(w+=dt(Ky(y),"&","&\f"),"&\f")!=-1&&(v=-1);break}case 34:case 39:case 91:w+=Ky(y);break;case 9:case 10:case 13:case 32:w+=HCe(p);break;case 92:w+=qCe(Wy()-1,7);continue;case 47:switch(ma()){case 42:case 47:X0(QCe(WCe(yi(),Wy()),t,n),l);break;default:w+="/"}break;case 123*m:s[u++]=ta(w)*v;case 125*m:case 59:case 0:switch(y){case 0:case 125:_=0;case 59+c:v==-1&&(w=dt(w,/\f/g,"")),h>0&&ta(w)-d&&X0(h>32?c9(w+";",r,n,d-1):c9(dt(w," ","")+";",r,n,d-2),l);break;case 59:w+=";";default:if(X0(x=u9(w,t,n,u,c,i,s,g,b=[],S=[],d),o),y===123)if(c===0)Xy(w,t,x,x,b,o,d,s,S);else switch(f===99&&tr(w,3)===110?100:f){case 100:case 108:case 109:case 115:Xy(e,x,x,r&&X0(u9(e,x,x,0,0,i,s,g,i,b=[],d),S),i,S,d,s,r?b:S);break;default:Xy(w,x,x,x,[""],S,0,s,S)}}u=c=h=0,m=v=1,g=w="",d=a;break;case 58:d=1+ta(w),h=p;default:if(m<1){if(y==123)--m;else if(y==125&&m++==0&&GCe()==125)continue}switch(w+=QS(y),y*m){case 38:v=c>0?1:(w+="\f",-1);break;case 44:s[u++]=(ta(w)-1)*v,v=1;break;case 64:ma()===45&&(w+=Ky(yi())),f=ma(),c=d=ta(g=w+=KCe(Wy())),y++;break;case 45:p===45&&ta(w)==2&&(m=0)}}return o}function u9(e,t,n,r,i,o,a,s,l,u,c){for(var d=i-1,f=i===0?o:[""],h=OA(f),p=0,m=0,_=0;p0?f[v]+" "+y:dt(y,/&\f/g,f[v])))&&(l[_++]=g);return ZS(e,t,n,i===0?MA:s,l,u,c)}function QCe(e,t,n){return ZS(e,t,n,Nj,QS(UCe()),kg(e,2,-2),0)}function c9(e,t,n,r){return ZS(e,t,n,RA,kg(e,0,r),kg(e,r+1,-1),r)}function Fd(e,t){for(var n="",r=OA(e),i=0;i6)switch(tr(e,t+1)){case 109:if(tr(e,t+4)!==45)break;case 102:return dt(e,/(.+:)(.+)-([^]+)/,"$1"+ct+"$2-$3$1"+V1+(tr(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~e3(e,"stretch")?Vj(dt(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(tr(e,t+1)!==115)break;case 6444:switch(tr(e,ta(e)-3-(~e3(e,"!important")&&10))){case 107:return dt(e,":",":"+ct)+e;case 101:return dt(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+ct+(tr(e,14)===45?"inline-":"")+"box$3$1"+ct+"$2$3$1"+dr+"$2box$3")+e}break;case 5936:switch(tr(e,t+11)){case 114:return ct+e+dr+dt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return ct+e+dr+dt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return ct+e+dr+dt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return ct+e+dr+e+e}return e}var o5e=function(t,n,r,i){if(t.length>-1&&!t.return)switch(t.type){case RA:t.return=Vj(t.value,t.length);break;case Dj:return Fd([xh(t,{value:dt(t.value,"@","@"+ct)})],i);case MA:if(t.length)return VCe(t.props,function(o){switch(jCe(o,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fd([xh(t,{props:[dt(o,/:(read-\w+)/,":"+V1+"$1")]})],i);case"::placeholder":return Fd([xh(t,{props:[dt(o,/:(plac\w+)/,":"+ct+"input-$1")]}),xh(t,{props:[dt(o,/:(plac\w+)/,":"+V1+"$1")]}),xh(t,{props:[dt(o,/:(plac\w+)/,dr+"input-$1")]})],i)}return""})}},a5e=[o5e],s5e=function(t){var n=t.key;if(n==="css"){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,function(m){var _=m.getAttribute("data-emotion");_.indexOf(" ")!==-1&&(document.head.appendChild(m),m.setAttribute("data-s",""))})}var i=t.stylisPlugins||a5e,o={},a,s=[];a=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+n+' "]'),function(m){for(var _=m.getAttribute("data-emotion").split(" "),v=1;v<_.length;v++)o[_[v]]=!0;s.push(m)});var l,u=[r5e,i5e];{var c,d=[YCe,JCe(function(m){c.insert(m)})],f=ZCe(u.concat(i,d)),h=function(_){return Fd(XCe(_),f)};l=function(_,v,y,g){c=y,h(_?_+"{"+v.styles+"}":v.styles),g&&(p.inserted[v.name]=!0)}}var p={key:n,sheet:new NCe({key:n,container:a,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:o,registered:{},insert:l};return p.sheet.hydrate(s),p},l5e=!0;function u5e(e,t,n){var r="";return n.split(" ").forEach(function(i){e[i]!==void 0?t.push(e[i]+";"):r+=i+" "}),r}var Uj=function(t,n,r){var i=t.key+"-"+n.name;(r===!1||l5e===!1)&&t.registered[i]===void 0&&(t.registered[i]=n.styles)},Gj=function(t,n,r){Uj(t,n,r);var i=t.key+"-"+n.name;if(t.inserted[n.name]===void 0){var o=n;do t.insert(n===o?"."+i:"",o,t.sheet,!0),o=o.next;while(o!==void 0)}};function c5e(e){for(var t=0,n,r=0,i=e.length;i>=4;++r,i-=4)n=e.charCodeAt(r)&255|(e.charCodeAt(++r)&255)<<8|(e.charCodeAt(++r)&255)<<16|(e.charCodeAt(++r)&255)<<24,n=(n&65535)*1540483477+((n>>>16)*59797<<16),n^=n>>>24,t=(n&65535)*1540483477+((n>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(i){case 3:t^=(e.charCodeAt(r+2)&255)<<16;case 2:t^=(e.charCodeAt(r+1)&255)<<8;case 1:t^=e.charCodeAt(r)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var d5e={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},f5e=/[A-Z]|^ms/g,h5e=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Hj=function(t){return t.charCodeAt(1)===45},h9=function(t){return t!=null&&typeof t!="boolean"},sw=jj(function(e){return Hj(e)?e:e.replace(f5e,"-$&").toLowerCase()}),p9=function(t,n){switch(t){case"animation":case"animationName":if(typeof n=="string")return n.replace(h5e,function(r,i,o){return na={name:i,styles:o,next:na},i})}return d5e[t]!==1&&!Hj(t)&&typeof n=="number"&&n!==0?n+"px":n};function Mg(e,t,n){if(n==null)return"";if(n.__emotion_styles!==void 0)return n;switch(typeof n){case"boolean":return"";case"object":{if(n.anim===1)return na={name:n.name,styles:n.styles,next:na},n.name;if(n.styles!==void 0){var r=n.next;if(r!==void 0)for(;r!==void 0;)na={name:r.name,styles:r.styles,next:na},r=r.next;var i=n.styles+";";return i}return p5e(e,t,n)}case"function":{if(e!==void 0){var o=na,a=n(e);return na=o,Mg(e,t,a)}break}}if(t==null)return n;var s=t[n];return s!==void 0?s:n}function p5e(e,t,n){var r="";if(Array.isArray(n))for(var i=0;iq.jsx("div",{className:"chakra-portal-zIndex",style:{position:"absolute",zIndex:e.zIndex,top:0,left:0,right:0},children:e.children}),k5e=e=>{const{appendToParentPortal:t,children:n}=e,[r,i]=I.useState(null),o=I.useRef(null),[,a]=I.useState({});I.useEffect(()=>a({}),[]);const s=A5e(),l=C5e();U1(()=>{if(!r)return;const c=r.ownerDocument,d=t?s??c.body:c.body;if(!d)return;o.current=c.createElement("div"),o.current.className=NA,d.appendChild(o.current),a({});const f=o.current;return()=>{d.contains(f)&&d.removeChild(f)}},[r]);const u=l!=null&&l.zIndex?q.jsx(P5e,{zIndex:l==null?void 0:l.zIndex,children:n}):n;return o.current?hi.createPortal(q.jsx(Qj,{value:o.current,children:u}),o.current):q.jsx("span",{ref:c=>{c&&i(c)}})},I5e=e=>{const{children:t,containerRef:n,appendToParentPortal:r}=e,i=n.current,o=i??(typeof window<"u"?document.body:void 0),a=I.useMemo(()=>{const l=i==null?void 0:i.ownerDocument.createElement("div");return l&&(l.className=NA),l},[i]),[,s]=I.useState({});return U1(()=>s({}),[]),U1(()=>{if(!(!a||!o))return o.appendChild(a),()=>{o.removeChild(a)}},[a,o]),o&&a?hi.createPortal(q.jsx(Qj,{value:r?a:null,children:t}),a):null};function JS(e){const t={appendToParentPortal:!0,...e},{containerRef:n,...r}=t;return n?q.jsx(I5e,{containerRef:n,...r}):q.jsx(k5e,{...r})}JS.className=NA;JS.selector=T5e;JS.displayName="Portal";function Yj(){const e=I.useContext(Rg);if(!e)throw Error("useTheme: `theme` is undefined. Seems you forgot to wrap your app in `` or ``");return e}var DA=I.createContext({});DA.displayName="ColorModeContext";function e2(){const e=I.useContext(DA);if(e===void 0)throw new Error("useColorMode must be used within a ColorModeProvider");return e}function hUe(e,t){const{colorMode:n}=e2();return n==="dark"?t:e}function M5e(){const e=e2(),t=Yj();return{...e,theme:t}}function R5e(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__breakpoints)==null?void 0:s.asArray)==null?void 0:l[a]};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function O5e(e,t,n){var r,i;if(t==null)return t;const o=a=>{var s,l;return(l=(s=e.__cssMap)==null?void 0:s[a])==null?void 0:l.value};return(i=(r=o(t))!=null?r:o(n))!=null?i:n}function pUe(e,t,n){const r=Yj();return $5e(e,t,n)(r)}function $5e(e,t,n){const r=Array.isArray(t)?t:[t],i=Array.isArray(n)?n:[n];return o=>{const a=i.filter(Boolean),s=r.map((l,u)=>{var c,d;if(e==="breakpoints")return R5e(o,l,(c=a[u])!=null?c:l);const f=`${e}.${l}`;return O5e(o,f,(d=a[u])!=null?d:l)});return Array.isArray(t)?s:s[0]}}var Xl=(...e)=>e.filter(Boolean).join(" ");function N5e(){return!1}function ya(e){const t=typeof e;return e!=null&&(t==="object"||t==="function")&&!Array.isArray(e)}var gUe=e=>{const{condition:t,message:n}=e;t&&N5e()&&console.warn(n)};function ua(e,...t){return D5e(e)?e(...t):e}var D5e=e=>typeof e=="function",mUe=e=>e?"":void 0,yUe=e=>e?!0:void 0;function vUe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}function bUe(...e){return function(n){e.forEach(r=>{r==null||r(n)})}}var G1={exports:{}};G1.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,a=9007199254740991,s="[object Arguments]",l="[object Array]",u="[object AsyncFunction]",c="[object Boolean]",d="[object Date]",f="[object Error]",h="[object Function]",p="[object GeneratorFunction]",m="[object Map]",_="[object Number]",v="[object Null]",y="[object Object]",g="[object Proxy]",b="[object RegExp]",S="[object Set]",x="[object String]",w="[object Undefined]",C="[object WeakMap]",T="[object ArrayBuffer]",A="[object DataView]",k="[object Float32Array]",D="[object Float64Array]",M="[object Int8Array]",E="[object Int16Array]",P="[object Int32Array]",N="[object Uint8Array]",L="[object Uint8ClampedArray]",O="[object Uint16Array]",R="[object Uint32Array]",$=/[\\^$.*+?()[\]{}|]/g,z=/^\[object .+?Constructor\]$/,V=/^(?:0|[1-9]\d*)$/,H={};H[k]=H[D]=H[M]=H[E]=H[P]=H[N]=H[L]=H[O]=H[R]=!0,H[s]=H[l]=H[T]=H[c]=H[A]=H[d]=H[f]=H[h]=H[m]=H[_]=H[y]=H[b]=H[S]=H[x]=H[C]=!1;var Q=typeof Ve=="object"&&Ve&&Ve.Object===Object&&Ve,Z=typeof self=="object"&&self&&self.Object===Object&&self,J=Q||Z||Function("return this")(),j=t&&!t.nodeType&&t,X=j&&!0&&e&&!e.nodeType&&e,ee=X&&X.exports===j,ne=ee&&Q.process,fe=function(){try{var B=X&&X.require&&X.require("util").types;return B||ne&&ne.binding&&ne.binding("util")}catch{}}(),ce=fe&&fe.isTypedArray;function Be(B,U,Y){switch(Y.length){case 0:return B.call(U);case 1:return B.call(U,Y[0]);case 2:return B.call(U,Y[0],Y[1]);case 3:return B.call(U,Y[0],Y[1],Y[2])}return B.apply(U,Y)}function $e(B,U){for(var Y=-1,ge=Array(B);++Y-1}function Oa(B,U){var Y=this.__data__,ge=bc(Y,B);return ge<0?(++this.size,Y.push([B,U])):Y[ge][1]=U,this}Xn.prototype.clear=Ra,Xn.prototype.delete=ks,Xn.prototype.get=Is,Xn.prototype.has=vc,Xn.prototype.set=Oa;function Cr(B){var U=-1,Y=B==null?0:B.length;for(this.clear();++U1?Y[Je-1]:void 0,jt=Je>2?Y[2]:void 0;for(wt=B.length>3&&typeof wt=="function"?(Je--,wt):void 0,jt&&AH(Y[0],Y[1],jt)&&(wt=Je<3?void 0:wt,Je=1),U=Object(U);++ge-1&&B%1==0&&B0){if(++U>=i)return arguments[0]}else U=0;return B.apply(void 0,arguments)}}function $H(B){if(B!=null){try{return St.call(B)}catch{}try{return B+""}catch{}}return""}function Wm(B,U){return B===U||B!==B&&U!==U}var R2=xc(function(){return arguments}())?xc:function(B){return Wf(B)&&vn.call(B,"callee")&&!lo.call(B,"callee")},O2=Array.isArray;function $2(B){return B!=null&&$T(B.length)&&!N2(B)}function NH(B){return Wf(B)&&$2(B)}var OT=Yl||zH;function N2(B){if(!eu(B))return!1;var U=Sc(B);return U==h||U==p||U==u||U==g}function $T(B){return typeof B=="number"&&B>-1&&B%1==0&&B<=a}function eu(B){var U=typeof B;return B!=null&&(U=="object"||U=="function")}function Wf(B){return B!=null&&typeof B=="object"}function DH(B){if(!Wf(B)||Sc(B)!=y)return!1;var U=si(B);if(U===null)return!0;var Y=vn.call(U,"constructor")&&U.constructor;return typeof Y=="function"&&Y instanceof Y&&St.call(Y)==Ti}var NT=ce?we(ce):fH;function LH(B){return SH(B,DT(B))}function DT(B){return $2(B)?T2(B,!0):hH(B)}var FH=xH(function(B,U,Y,ge){IT(B,U,Y,ge)});function BH(B){return function(){return B}}function LT(B){return B}function zH(){return!1}e.exports=FH})(G1,G1.exports);var L5e=G1.exports;const ca=Nl(L5e);var F5e=e=>/!(important)?$/.test(e),y9=e=>typeof e=="string"?e.replace(/!(important)?$/,"").trim():e,B5e=(e,t)=>n=>{const r=String(t),i=F5e(r),o=y9(r),a=e?`${e}.${o}`:o;let s=ya(n.__cssMap)&&a in n.__cssMap?n.__cssMap[a].varRef:t;return s=y9(s),i?`${s} !important`:s};function LA(e){const{scale:t,transform:n,compose:r}=e;return(o,a)=>{var s;const l=B5e(t,o)(a);let u=(s=n==null?void 0:n(l,a))!=null?s:l;return r&&(u=r(u,a)),u}}var Q0=(...e)=>t=>e.reduce((n,r)=>r(n),t);function Oi(e,t){return n=>{const r={property:n,scale:e};return r.transform=LA({scale:e,transform:t}),r}}var z5e=({rtl:e,ltr:t})=>n=>n.direction==="rtl"?e:t;function j5e(e){const{property:t,scale:n,transform:r}=e;return{scale:n,property:z5e(t),transform:n?LA({scale:n,compose:r}):r}}var Zj=["rotate(var(--chakra-rotate, 0))","scaleX(var(--chakra-scale-x, 1))","scaleY(var(--chakra-scale-y, 1))","skewX(var(--chakra-skew-x, 0))","skewY(var(--chakra-skew-y, 0))"];function V5e(){return["translateX(var(--chakra-translate-x, 0))","translateY(var(--chakra-translate-y, 0))",...Zj].join(" ")}function U5e(){return["translate3d(var(--chakra-translate-x, 0), var(--chakra-translate-y, 0), 0)",...Zj].join(" ")}var G5e={"--chakra-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-sepia":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-drop-shadow":"var(--chakra-empty,/*!*/ /*!*/)",filter:["var(--chakra-blur)","var(--chakra-brightness)","var(--chakra-contrast)","var(--chakra-grayscale)","var(--chakra-hue-rotate)","var(--chakra-invert)","var(--chakra-saturate)","var(--chakra-sepia)","var(--chakra-drop-shadow)"].join(" ")},H5e={backdropFilter:["var(--chakra-backdrop-blur)","var(--chakra-backdrop-brightness)","var(--chakra-backdrop-contrast)","var(--chakra-backdrop-grayscale)","var(--chakra-backdrop-hue-rotate)","var(--chakra-backdrop-invert)","var(--chakra-backdrop-opacity)","var(--chakra-backdrop-saturate)","var(--chakra-backdrop-sepia)"].join(" "),"--chakra-backdrop-blur":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-brightness":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-contrast":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-grayscale":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-hue-rotate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-invert":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-opacity":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-saturate":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-backdrop-sepia":"var(--chakra-empty,/*!*/ /*!*/)"};function q5e(e){return{"--chakra-ring-offset-shadow":"var(--chakra-ring-inset) 0 0 0 var(--chakra-ring-offset-width) var(--chakra-ring-offset-color)","--chakra-ring-shadow":"var(--chakra-ring-inset) 0 0 0 calc(var(--chakra-ring-width) + var(--chakra-ring-offset-width)) var(--chakra-ring-color)","--chakra-ring-width":e,boxShadow:["var(--chakra-ring-offset-shadow)","var(--chakra-ring-shadow)","var(--chakra-shadow, 0 0 #0000)"].join(", ")}}var W5e={"row-reverse":{space:"--chakra-space-x-reverse",divide:"--chakra-divide-x-reverse"},"column-reverse":{space:"--chakra-space-y-reverse",divide:"--chakra-divide-y-reverse"}},n3={"to-t":"to top","to-tr":"to top right","to-r":"to right","to-br":"to bottom right","to-b":"to bottom","to-bl":"to bottom left","to-l":"to left","to-tl":"to top left"},K5e=new Set(Object.values(n3)),r3=new Set(["none","-moz-initial","inherit","initial","revert","unset"]),X5e=e=>e.trim();function Q5e(e,t){if(e==null||r3.has(e))return e;if(!(i3(e)||r3.has(e)))return`url('${e}')`;const i=/(^[a-z-A-Z]+)\((.*)\)/g.exec(e),o=i==null?void 0:i[1],a=i==null?void 0:i[2];if(!o||!a)return e;const s=o.includes("-gradient")?o:`${o}-gradient`,[l,...u]=a.split(",").map(X5e).filter(Boolean);if((u==null?void 0:u.length)===0)return e;const c=l in n3?n3[l]:l;u.unshift(c);const d=u.map(f=>{if(K5e.has(f))return f;const h=f.indexOf(" "),[p,m]=h!==-1?[f.substr(0,h),f.substr(h+1)]:[f],_=i3(m)?m:m&&m.split(" "),v=`colors.${p}`,y=v in t.__cssMap?t.__cssMap[v].varRef:p;return _?[y,...Array.isArray(_)?_:[_]].join(" "):y});return`${s}(${d.join(", ")})`}var i3=e=>typeof e=="string"&&e.includes("(")&&e.includes(")"),Y5e=(e,t)=>Q5e(e,t??{});function Z5e(e){return/^var\(--.+\)$/.test(e)}var J5e=e=>{const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}},Wo=e=>t=>`${e}(${t})`,ot={filter(e){return e!=="auto"?e:G5e},backdropFilter(e){return e!=="auto"?e:H5e},ring(e){return q5e(ot.px(e))},bgClip(e){return e==="text"?{color:"transparent",backgroundClip:"text"}:{backgroundClip:e}},transform(e){return e==="auto"?V5e():e==="auto-gpu"?U5e():e},vh(e){return e==="$100vh"?"var(--chakra-vh)":e},px(e){if(e==null)return e;const{unitless:t}=J5e(e);return t||typeof e=="number"?`${e}px`:e},fraction(e){return typeof e!="number"||e>1?e:`${e*100}%`},float(e,t){const n={left:"right",right:"left"};return t.direction==="rtl"?n[e]:e},degree(e){if(Z5e(e)||e==null)return e;const t=typeof e=="string"&&!e.endsWith("deg");return typeof e=="number"||t?`${e}deg`:e},gradient:Y5e,blur:Wo("blur"),opacity:Wo("opacity"),brightness:Wo("brightness"),contrast:Wo("contrast"),dropShadow:Wo("drop-shadow"),grayscale:Wo("grayscale"),hueRotate:Wo("hue-rotate"),invert:Wo("invert"),saturate:Wo("saturate"),sepia:Wo("sepia"),bgImage(e){return e==null||i3(e)||r3.has(e)?e:`url(${e})`},outline(e){const t=String(e)==="0"||String(e)==="none";return e!==null&&t?{outline:"2px solid transparent",outlineOffset:"2px"}:{outline:e}},flexDirection(e){var t;const{space:n,divide:r}=(t=W5e[e])!=null?t:{},i={flexDirection:e};return n&&(i[n]=1),r&&(i[r]=1),i}},G={borderWidths:Oi("borderWidths"),borderStyles:Oi("borderStyles"),colors:Oi("colors"),borders:Oi("borders"),gradients:Oi("gradients",ot.gradient),radii:Oi("radii",ot.px),space:Oi("space",Q0(ot.vh,ot.px)),spaceT:Oi("space",Q0(ot.vh,ot.px)),degreeT(e){return{property:e,transform:ot.degree}},prop(e,t,n){return{property:e,scale:t,...t&&{transform:LA({scale:t,transform:n})}}},propT(e,t){return{property:e,transform:t}},sizes:Oi("sizes",Q0(ot.vh,ot.px)),sizesT:Oi("sizes",Q0(ot.vh,ot.fraction)),shadows:Oi("shadows"),logical:j5e,blur:Oi("blur",ot.blur)},Qy={background:G.colors("background"),backgroundColor:G.colors("backgroundColor"),backgroundImage:G.gradients("backgroundImage"),backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0,backgroundAttachment:!0,backgroundClip:{transform:ot.bgClip},bgSize:G.prop("backgroundSize"),bgPosition:G.prop("backgroundPosition"),bg:G.colors("background"),bgColor:G.colors("backgroundColor"),bgPos:G.prop("backgroundPosition"),bgRepeat:G.prop("backgroundRepeat"),bgAttachment:G.prop("backgroundAttachment"),bgGradient:G.gradients("backgroundImage"),bgClip:{transform:ot.bgClip}};Object.assign(Qy,{bgImage:Qy.backgroundImage,bgImg:Qy.backgroundImage});var ut={border:G.borders("border"),borderWidth:G.borderWidths("borderWidth"),borderStyle:G.borderStyles("borderStyle"),borderColor:G.colors("borderColor"),borderRadius:G.radii("borderRadius"),borderTop:G.borders("borderTop"),borderBlockStart:G.borders("borderBlockStart"),borderTopLeftRadius:G.radii("borderTopLeftRadius"),borderStartStartRadius:G.logical({scale:"radii",property:{ltr:"borderTopLeftRadius",rtl:"borderTopRightRadius"}}),borderEndStartRadius:G.logical({scale:"radii",property:{ltr:"borderBottomLeftRadius",rtl:"borderBottomRightRadius"}}),borderTopRightRadius:G.radii("borderTopRightRadius"),borderStartEndRadius:G.logical({scale:"radii",property:{ltr:"borderTopRightRadius",rtl:"borderTopLeftRadius"}}),borderEndEndRadius:G.logical({scale:"radii",property:{ltr:"borderBottomRightRadius",rtl:"borderBottomLeftRadius"}}),borderRight:G.borders("borderRight"),borderInlineEnd:G.borders("borderInlineEnd"),borderBottom:G.borders("borderBottom"),borderBlockEnd:G.borders("borderBlockEnd"),borderBottomLeftRadius:G.radii("borderBottomLeftRadius"),borderBottomRightRadius:G.radii("borderBottomRightRadius"),borderLeft:G.borders("borderLeft"),borderInlineStart:{property:"borderInlineStart",scale:"borders"},borderInlineStartRadius:G.logical({scale:"radii",property:{ltr:["borderTopLeftRadius","borderBottomLeftRadius"],rtl:["borderTopRightRadius","borderBottomRightRadius"]}}),borderInlineEndRadius:G.logical({scale:"radii",property:{ltr:["borderTopRightRadius","borderBottomRightRadius"],rtl:["borderTopLeftRadius","borderBottomLeftRadius"]}}),borderX:G.borders(["borderLeft","borderRight"]),borderInline:G.borders("borderInline"),borderY:G.borders(["borderTop","borderBottom"]),borderBlock:G.borders("borderBlock"),borderTopWidth:G.borderWidths("borderTopWidth"),borderBlockStartWidth:G.borderWidths("borderBlockStartWidth"),borderTopColor:G.colors("borderTopColor"),borderBlockStartColor:G.colors("borderBlockStartColor"),borderTopStyle:G.borderStyles("borderTopStyle"),borderBlockStartStyle:G.borderStyles("borderBlockStartStyle"),borderBottomWidth:G.borderWidths("borderBottomWidth"),borderBlockEndWidth:G.borderWidths("borderBlockEndWidth"),borderBottomColor:G.colors("borderBottomColor"),borderBlockEndColor:G.colors("borderBlockEndColor"),borderBottomStyle:G.borderStyles("borderBottomStyle"),borderBlockEndStyle:G.borderStyles("borderBlockEndStyle"),borderLeftWidth:G.borderWidths("borderLeftWidth"),borderInlineStartWidth:G.borderWidths("borderInlineStartWidth"),borderLeftColor:G.colors("borderLeftColor"),borderInlineStartColor:G.colors("borderInlineStartColor"),borderLeftStyle:G.borderStyles("borderLeftStyle"),borderInlineStartStyle:G.borderStyles("borderInlineStartStyle"),borderRightWidth:G.borderWidths("borderRightWidth"),borderInlineEndWidth:G.borderWidths("borderInlineEndWidth"),borderRightColor:G.colors("borderRightColor"),borderInlineEndColor:G.colors("borderInlineEndColor"),borderRightStyle:G.borderStyles("borderRightStyle"),borderInlineEndStyle:G.borderStyles("borderInlineEndStyle"),borderTopRadius:G.radii(["borderTopLeftRadius","borderTopRightRadius"]),borderBottomRadius:G.radii(["borderBottomLeftRadius","borderBottomRightRadius"]),borderLeftRadius:G.radii(["borderTopLeftRadius","borderBottomLeftRadius"]),borderRightRadius:G.radii(["borderTopRightRadius","borderBottomRightRadius"])};Object.assign(ut,{rounded:ut.borderRadius,roundedTop:ut.borderTopRadius,roundedTopLeft:ut.borderTopLeftRadius,roundedTopRight:ut.borderTopRightRadius,roundedTopStart:ut.borderStartStartRadius,roundedTopEnd:ut.borderStartEndRadius,roundedBottom:ut.borderBottomRadius,roundedBottomLeft:ut.borderBottomLeftRadius,roundedBottomRight:ut.borderBottomRightRadius,roundedBottomStart:ut.borderEndStartRadius,roundedBottomEnd:ut.borderEndEndRadius,roundedLeft:ut.borderLeftRadius,roundedRight:ut.borderRightRadius,roundedStart:ut.borderInlineStartRadius,roundedEnd:ut.borderInlineEndRadius,borderStart:ut.borderInlineStart,borderEnd:ut.borderInlineEnd,borderTopStartRadius:ut.borderStartStartRadius,borderTopEndRadius:ut.borderStartEndRadius,borderBottomStartRadius:ut.borderEndStartRadius,borderBottomEndRadius:ut.borderEndEndRadius,borderStartRadius:ut.borderInlineStartRadius,borderEndRadius:ut.borderInlineEndRadius,borderStartWidth:ut.borderInlineStartWidth,borderEndWidth:ut.borderInlineEndWidth,borderStartColor:ut.borderInlineStartColor,borderEndColor:ut.borderInlineEndColor,borderStartStyle:ut.borderInlineStartStyle,borderEndStyle:ut.borderInlineEndStyle});var e3e={color:G.colors("color"),textColor:G.colors("color"),fill:G.colors("fill"),stroke:G.colors("stroke")},o3={boxShadow:G.shadows("boxShadow"),mixBlendMode:!0,blendMode:G.prop("mixBlendMode"),backgroundBlendMode:!0,bgBlendMode:G.prop("backgroundBlendMode"),opacity:!0};Object.assign(o3,{shadow:o3.boxShadow});var t3e={filter:{transform:ot.filter},blur:G.blur("--chakra-blur"),brightness:G.propT("--chakra-brightness",ot.brightness),contrast:G.propT("--chakra-contrast",ot.contrast),hueRotate:G.degreeT("--chakra-hue-rotate"),invert:G.propT("--chakra-invert",ot.invert),saturate:G.propT("--chakra-saturate",ot.saturate),dropShadow:G.propT("--chakra-drop-shadow",ot.dropShadow),backdropFilter:{transform:ot.backdropFilter},backdropBlur:G.blur("--chakra-backdrop-blur"),backdropBrightness:G.propT("--chakra-backdrop-brightness",ot.brightness),backdropContrast:G.propT("--chakra-backdrop-contrast",ot.contrast),backdropHueRotate:G.degreeT("--chakra-backdrop-hue-rotate"),backdropInvert:G.propT("--chakra-backdrop-invert",ot.invert),backdropSaturate:G.propT("--chakra-backdrop-saturate",ot.saturate)},H1={alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:{transform:ot.flexDirection},flex:!0,flexFlow:!0,flexGrow:!0,flexShrink:!0,flexBasis:G.sizes("flexBasis"),justifySelf:!0,alignSelf:!0,order:!0,placeItems:!0,placeContent:!0,placeSelf:!0,gap:G.space("gap"),rowGap:G.space("rowGap"),columnGap:G.space("columnGap")};Object.assign(H1,{flexDir:H1.flexDirection});var Jj={gridGap:G.space("gridGap"),gridColumnGap:G.space("gridColumnGap"),gridRowGap:G.space("gridRowGap"),gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridColumnStart:!0,gridColumnEnd:!0,gridRowStart:!0,gridRowEnd:!0,gridAutoRows:!0,gridTemplate:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0},n3e={appearance:!0,cursor:!0,resize:!0,userSelect:!0,pointerEvents:!0,outline:{transform:ot.outline},outlineOffset:!0,outlineColor:G.colors("outlineColor")},Di={width:G.sizesT("width"),inlineSize:G.sizesT("inlineSize"),height:G.sizes("height"),blockSize:G.sizes("blockSize"),boxSize:G.sizes(["width","height"]),minWidth:G.sizes("minWidth"),minInlineSize:G.sizes("minInlineSize"),minHeight:G.sizes("minHeight"),minBlockSize:G.sizes("minBlockSize"),maxWidth:G.sizes("maxWidth"),maxInlineSize:G.sizes("maxInlineSize"),maxHeight:G.sizes("maxHeight"),maxBlockSize:G.sizes("maxBlockSize"),overflow:!0,overflowX:!0,overflowY:!0,overscrollBehavior:!0,overscrollBehaviorX:!0,overscrollBehaviorY:!0,display:!0,aspectRatio:!0,hideFrom:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (min-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r.minW)!=null?i:e})`]:{display:"none"}}}},hideBelow:{scale:"breakpoints",transform:(e,t)=>{var n,r,i;return{[`@media screen and (max-width: ${(i=(r=(n=t.__breakpoints)==null?void 0:n.get(e))==null?void 0:r._minW)!=null?i:e})`]:{display:"none"}}}},verticalAlign:!0,boxSizing:!0,boxDecorationBreak:!0,float:G.propT("float",ot.float),objectFit:!0,objectPosition:!0,visibility:!0,isolation:!0};Object.assign(Di,{w:Di.width,h:Di.height,minW:Di.minWidth,maxW:Di.maxWidth,minH:Di.minHeight,maxH:Di.maxHeight,overscroll:Di.overscrollBehavior,overscrollX:Di.overscrollBehaviorX,overscrollY:Di.overscrollBehaviorY});var r3e={listStyleType:!0,listStylePosition:!0,listStylePos:G.prop("listStylePosition"),listStyleImage:!0,listStyleImg:G.prop("listStyleImage")};function i3e(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},a3e=o3e(i3e),s3e={border:"0px",clip:"rect(0, 0, 0, 0)",width:"1px",height:"1px",margin:"-1px",padding:"0px",overflow:"hidden",whiteSpace:"nowrap",position:"absolute"},l3e={position:"static",width:"auto",height:"auto",clip:"auto",padding:"0",margin:"0",overflow:"visible",whiteSpace:"normal"},lw=(e,t,n)=>{const r={},i=a3e(e,t,{});for(const o in i)o in n&&n[o]!=null||(r[o]=i[o]);return r},u3e={srOnly:{transform(e){return e===!0?s3e:e==="focusable"?l3e:{}}},layerStyle:{processResult:!0,transform:(e,t,n)=>lw(t,`layerStyles.${e}`,n)},textStyle:{processResult:!0,transform:(e,t,n)=>lw(t,`textStyles.${e}`,n)},apply:{processResult:!0,transform:(e,t,n)=>lw(t,e,n)}},up={position:!0,pos:G.prop("position"),zIndex:G.prop("zIndex","zIndices"),inset:G.spaceT("inset"),insetX:G.spaceT(["left","right"]),insetInline:G.spaceT("insetInline"),insetY:G.spaceT(["top","bottom"]),insetBlock:G.spaceT("insetBlock"),top:G.spaceT("top"),insetBlockStart:G.spaceT("insetBlockStart"),bottom:G.spaceT("bottom"),insetBlockEnd:G.spaceT("insetBlockEnd"),left:G.spaceT("left"),insetInlineStart:G.logical({scale:"space",property:{ltr:"left",rtl:"right"}}),right:G.spaceT("right"),insetInlineEnd:G.logical({scale:"space",property:{ltr:"right",rtl:"left"}})};Object.assign(up,{insetStart:up.insetInlineStart,insetEnd:up.insetInlineEnd});var c3e={ring:{transform:ot.ring},ringColor:G.colors("--chakra-ring-color"),ringOffset:G.prop("--chakra-ring-offset-width"),ringOffsetColor:G.colors("--chakra-ring-offset-color"),ringInset:G.prop("--chakra-ring-inset")},Ot={margin:G.spaceT("margin"),marginTop:G.spaceT("marginTop"),marginBlockStart:G.spaceT("marginBlockStart"),marginRight:G.spaceT("marginRight"),marginInlineEnd:G.spaceT("marginInlineEnd"),marginBottom:G.spaceT("marginBottom"),marginBlockEnd:G.spaceT("marginBlockEnd"),marginLeft:G.spaceT("marginLeft"),marginInlineStart:G.spaceT("marginInlineStart"),marginX:G.spaceT(["marginInlineStart","marginInlineEnd"]),marginInline:G.spaceT("marginInline"),marginY:G.spaceT(["marginTop","marginBottom"]),marginBlock:G.spaceT("marginBlock"),padding:G.space("padding"),paddingTop:G.space("paddingTop"),paddingBlockStart:G.space("paddingBlockStart"),paddingRight:G.space("paddingRight"),paddingBottom:G.space("paddingBottom"),paddingBlockEnd:G.space("paddingBlockEnd"),paddingLeft:G.space("paddingLeft"),paddingInlineStart:G.space("paddingInlineStart"),paddingInlineEnd:G.space("paddingInlineEnd"),paddingX:G.space(["paddingInlineStart","paddingInlineEnd"]),paddingInline:G.space("paddingInline"),paddingY:G.space(["paddingTop","paddingBottom"]),paddingBlock:G.space("paddingBlock")};Object.assign(Ot,{m:Ot.margin,mt:Ot.marginTop,mr:Ot.marginRight,me:Ot.marginInlineEnd,marginEnd:Ot.marginInlineEnd,mb:Ot.marginBottom,ml:Ot.marginLeft,ms:Ot.marginInlineStart,marginStart:Ot.marginInlineStart,mx:Ot.marginX,my:Ot.marginY,p:Ot.padding,pt:Ot.paddingTop,py:Ot.paddingY,px:Ot.paddingX,pb:Ot.paddingBottom,pl:Ot.paddingLeft,ps:Ot.paddingInlineStart,paddingStart:Ot.paddingInlineStart,pr:Ot.paddingRight,pe:Ot.paddingInlineEnd,paddingEnd:Ot.paddingInlineEnd});var d3e={textDecorationColor:G.colors("textDecorationColor"),textDecoration:!0,textDecor:{property:"textDecoration"},textDecorationLine:!0,textDecorationStyle:!0,textDecorationThickness:!0,textUnderlineOffset:!0,textShadow:G.shadows("textShadow")},f3e={clipPath:!0,transform:G.propT("transform",ot.transform),transformOrigin:!0,translateX:G.spaceT("--chakra-translate-x"),translateY:G.spaceT("--chakra-translate-y"),skewX:G.degreeT("--chakra-skew-x"),skewY:G.degreeT("--chakra-skew-y"),scaleX:G.prop("--chakra-scale-x"),scaleY:G.prop("--chakra-scale-y"),scale:G.prop(["--chakra-scale-x","--chakra-scale-y"]),rotate:G.degreeT("--chakra-rotate")},h3e={transition:!0,transitionDelay:!0,animation:!0,willChange:!0,transitionDuration:G.prop("transitionDuration","transition.duration"),transitionProperty:G.prop("transitionProperty","transition.property"),transitionTimingFunction:G.prop("transitionTimingFunction","transition.easing")},p3e={fontFamily:G.prop("fontFamily","fonts"),fontSize:G.prop("fontSize","fontSizes",ot.px),fontWeight:G.prop("fontWeight","fontWeights"),lineHeight:G.prop("lineHeight","lineHeights"),letterSpacing:G.prop("letterSpacing","letterSpacings"),textAlign:!0,fontStyle:!0,textIndent:!0,wordBreak:!0,overflowWrap:!0,textOverflow:!0,textTransform:!0,whiteSpace:!0,isTruncated:{transform(e){if(e===!0)return{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},noOfLines:{static:{overflow:"hidden",textOverflow:"ellipsis",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:"var(--chakra-line-clamp)"},property:"--chakra-line-clamp"}},g3e={scrollBehavior:!0,scrollSnapAlign:!0,scrollSnapStop:!0,scrollSnapType:!0,scrollMargin:G.spaceT("scrollMargin"),scrollMarginTop:G.spaceT("scrollMarginTop"),scrollMarginBottom:G.spaceT("scrollMarginBottom"),scrollMarginLeft:G.spaceT("scrollMarginLeft"),scrollMarginRight:G.spaceT("scrollMarginRight"),scrollMarginX:G.spaceT(["scrollMarginLeft","scrollMarginRight"]),scrollMarginY:G.spaceT(["scrollMarginTop","scrollMarginBottom"]),scrollPadding:G.spaceT("scrollPadding"),scrollPaddingTop:G.spaceT("scrollPaddingTop"),scrollPaddingBottom:G.spaceT("scrollPaddingBottom"),scrollPaddingLeft:G.spaceT("scrollPaddingLeft"),scrollPaddingRight:G.spaceT("scrollPaddingRight"),scrollPaddingX:G.spaceT(["scrollPaddingLeft","scrollPaddingRight"]),scrollPaddingY:G.spaceT(["scrollPaddingTop","scrollPaddingBottom"])};function eV(e){return ya(e)&&e.reference?e.reference:String(e)}var t2=(e,...t)=>t.map(eV).join(` ${e} `).replace(/calc/g,""),v9=(...e)=>`calc(${t2("+",...e)})`,b9=(...e)=>`calc(${t2("-",...e)})`,a3=(...e)=>`calc(${t2("*",...e)})`,_9=(...e)=>`calc(${t2("/",...e)})`,S9=e=>{const t=eV(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:a3(t,-1)},bu=Object.assign(e=>({add:(...t)=>bu(v9(e,...t)),subtract:(...t)=>bu(b9(e,...t)),multiply:(...t)=>bu(a3(e,...t)),divide:(...t)=>bu(_9(e,...t)),negate:()=>bu(S9(e)),toString:()=>e.toString()}),{add:v9,subtract:b9,multiply:a3,divide:_9,negate:S9});function m3e(e,t="-"){return e.replace(/\s+/g,t)}function y3e(e){const t=m3e(e.toString());return b3e(v3e(t))}function v3e(e){return e.includes("\\.")?e:!Number.isInteger(parseFloat(e.toString()))?e.replace(".","\\."):e}function b3e(e){return e.replace(/[!-,/:-@[-^`{-~]/g,"\\$&")}function _3e(e,t=""){return[t,e].filter(Boolean).join("-")}function S3e(e,t){return`var(${e}${t?`, ${t}`:""})`}function x3e(e,t=""){return y3e(`--${_3e(e,t)}`)}function Pe(e,t,n){const r=x3e(e,n);return{variable:r,reference:S3e(r,t)}}function w3e(e,t){const n={};for(const r of t){if(Array.isArray(r)){const[i,o]=r;n[i]=Pe(`${e}-${i}`,o);continue}n[r]=Pe(`${e}-${r}`)}return n}function C3e(e){const t=e==null?0:e.length;return t?e[t-1]:void 0}function E3e(e){const t=parseFloat(e.toString()),n=e.toString().replace(String(t),"");return{unitless:!n,value:t,unit:n}}function s3(e){if(e==null)return e;const{unitless:t}=E3e(e);return t||typeof e=="number"?`${e}px`:e}var tV=(e,t)=>parseInt(e[1],10)>parseInt(t[1],10)?1:-1,FA=e=>Object.fromEntries(Object.entries(e).sort(tV));function x9(e){const t=FA(e);return Object.assign(Object.values(t),t)}function A3e(e){const t=Object.keys(FA(e));return new Set(t)}function w9(e){var t;if(!e)return e;e=(t=s3(e))!=null?t:e;const n=-.02;return typeof e=="number"?`${e+n}`:e.replace(/(\d+\.?\d*)/u,r=>`${parseFloat(r)+n}`)}function jh(e,t){const n=["@media screen"];return e&&n.push("and",`(min-width: ${s3(e)})`),t&&n.push("and",`(max-width: ${s3(t)})`),n.join(" ")}function T3e(e){var t;if(!e)return null;e.base=(t=e.base)!=null?t:"0px";const n=x9(e),r=Object.entries(e).sort(tV).map(([a,s],l,u)=>{var c;let[,d]=(c=u[l+1])!=null?c:[];return d=parseFloat(d)>0?w9(d):void 0,{_minW:w9(s),breakpoint:a,minW:s,maxW:d,maxWQuery:jh(null,d),minWQuery:jh(s),minMaxQuery:jh(s,d)}}),i=A3e(e),o=Array.from(i.values());return{keys:i,normalized:n,isResponsive(a){const s=Object.keys(a);return s.length>0&&s.every(l=>i.has(l))},asObject:FA(e),asArray:x9(e),details:r,get(a){return r.find(s=>s.breakpoint===a)},media:[null,...n.map(a=>jh(a)).slice(1)],toArrayValue(a){if(!ya(a))throw new Error("toArrayValue: value must be an object");const s=o.map(l=>{var u;return(u=a[l])!=null?u:null});for(;C3e(s)===null;)s.pop();return s},toObjectValue(a){if(!Array.isArray(a))throw new Error("toObjectValue: value must be an array");return a.reduce((s,l,u)=>{const c=o[u];return c!=null&&l!=null&&(s[c]=l),s},{})}}}var Qn={hover:(e,t)=>`${e}:hover ${t}, ${e}[data-hover] ${t}`,focus:(e,t)=>`${e}:focus ${t}, ${e}[data-focus] ${t}`,focusVisible:(e,t)=>`${e}:focus-visible ${t}`,focusWithin:(e,t)=>`${e}:focus-within ${t}`,active:(e,t)=>`${e}:active ${t}, ${e}[data-active] ${t}`,disabled:(e,t)=>`${e}:disabled ${t}, ${e}[data-disabled] ${t}`,invalid:(e,t)=>`${e}:invalid ${t}, ${e}[data-invalid] ${t}`,checked:(e,t)=>`${e}:checked ${t}, ${e}[data-checked] ${t}`,indeterminate:(e,t)=>`${e}:indeterminate ${t}, ${e}[aria-checked=mixed] ${t}, ${e}[data-indeterminate] ${t}`,readOnly:(e,t)=>`${e}:read-only ${t}, ${e}[readonly] ${t}, ${e}[data-read-only] ${t}`,expanded:(e,t)=>`${e}:read-only ${t}, ${e}[aria-expanded=true] ${t}, ${e}[data-expanded] ${t}`,placeholderShown:(e,t)=>`${e}:placeholder-shown ${t}`},Ls=e=>nV(t=>e(t,"&"),"[role=group]","[data-group]",".group"),La=e=>nV(t=>e(t,"~ &"),"[data-peer]",".peer"),nV=(e,...t)=>t.map(e).join(", "),n2={_hover:"&:hover, &[data-hover]",_active:"&:active, &[data-active]",_focus:"&:focus, &[data-focus]",_highlighted:"&[data-highlighted]",_focusWithin:"&:focus-within",_focusVisible:"&:focus-visible, &[data-focus-visible]",_disabled:"&:disabled, &[disabled], &[aria-disabled=true], &[data-disabled]",_readOnly:"&[aria-readonly=true], &[readonly], &[data-readonly]",_before:"&::before",_after:"&::after",_empty:"&:empty",_expanded:"&[aria-expanded=true], &[data-expanded]",_checked:"&[aria-checked=true], &[data-checked]",_grabbed:"&[aria-grabbed=true], &[data-grabbed]",_pressed:"&[aria-pressed=true], &[data-pressed]",_invalid:"&[aria-invalid=true], &[data-invalid]",_valid:"&[data-valid], &[data-state=valid]",_loading:"&[data-loading], &[aria-busy=true]",_selected:"&[aria-selected=true], &[data-selected]",_hidden:"&[hidden], &[data-hidden]",_autofill:"&:-webkit-autofill",_even:"&:nth-of-type(even)",_odd:"&:nth-of-type(odd)",_first:"&:first-of-type",_firstLetter:"&::first-letter",_last:"&:last-of-type",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_visited:"&:visited",_activeLink:"&[aria-current=page]",_activeStep:"&[aria-current=step]",_indeterminate:"&:indeterminate, &[aria-checked=mixed], &[data-indeterminate]",_groupHover:Ls(Qn.hover),_peerHover:La(Qn.hover),_groupFocus:Ls(Qn.focus),_peerFocus:La(Qn.focus),_groupFocusVisible:Ls(Qn.focusVisible),_peerFocusVisible:La(Qn.focusVisible),_groupActive:Ls(Qn.active),_peerActive:La(Qn.active),_groupDisabled:Ls(Qn.disabled),_peerDisabled:La(Qn.disabled),_groupInvalid:Ls(Qn.invalid),_peerInvalid:La(Qn.invalid),_groupChecked:Ls(Qn.checked),_peerChecked:La(Qn.checked),_groupFocusWithin:Ls(Qn.focusWithin),_peerFocusWithin:La(Qn.focusWithin),_peerPlaceholderShown:La(Qn.placeholderShown),_placeholder:"&::placeholder",_placeholderShown:"&:placeholder-shown",_fullScreen:"&:fullscreen",_selection:"&::selection",_rtl:"[dir=rtl] &, &[dir=rtl]",_ltr:"[dir=ltr] &, &[dir=ltr]",_mediaDark:"@media (prefers-color-scheme: dark)",_mediaReduceMotion:"@media (prefers-reduced-motion: reduce)",_dark:".chakra-ui-dark &:not([data-theme]),[data-theme=dark] &:not([data-theme]),&[data-theme=dark]",_light:".chakra-ui-light &:not([data-theme]),[data-theme=light] &:not([data-theme]),&[data-theme=light]",_horizontal:"&[data-orientation=horizontal]",_vertical:"&[data-orientation=vertical]"},rV=Object.keys(n2);function C9(e,t){return Pe(String(e).replace(/\./g,"-"),void 0,t)}function P3e(e,t){let n={};const r={};for(const[i,o]of Object.entries(e)){const{isSemantic:a,value:s}=o,{variable:l,reference:u}=C9(i,t==null?void 0:t.cssVarPrefix);if(!a){if(i.startsWith("space")){const f=i.split("."),[h,...p]=f,m=`${h}.-${p.join(".")}`,_=bu.negate(s),v=bu.negate(u);r[m]={value:_,var:l,varRef:v}}n[l]=s,r[i]={value:s,var:l,varRef:u};continue}const c=f=>{const p=[String(i).split(".")[0],f].join(".");if(!e[p])return f;const{reference:_}=C9(p,t==null?void 0:t.cssVarPrefix);return _},d=ya(s)?s:{default:s};n=ca(n,Object.entries(d).reduce((f,[h,p])=>{var m,_;if(!p)return f;const v=c(`${p}`);if(h==="default")return f[l]=v,f;const y=(_=(m=n2)==null?void 0:m[h])!=null?_:h;return f[y]={[l]:v},f},{})),r[i]={value:u,var:l,varRef:u}}return{cssVars:n,cssMap:r}}function k3e(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}function I3e(e,t){const n={};for(const r of t)r in e&&(n[r]=e[r]);return n}function M3e(e){return typeof e=="object"&&e!=null&&!Array.isArray(e)}function E9(e,t,n={}){const{stop:r,getKey:i}=n;function o(a,s=[]){var l;if(M3e(a)||Array.isArray(a)){const u={};for(const[c,d]of Object.entries(a)){const f=(l=i==null?void 0:i(c))!=null?l:c,h=[...s,f];if(r!=null&&r(a,h))return t(a,s);u[f]=o(d,h)}return u}return t(a,s)}return o(e)}var R3e=["colors","borders","borderWidths","borderStyles","fonts","fontSizes","fontWeights","gradients","letterSpacings","lineHeights","radii","space","shadows","sizes","zIndices","transition","blur","breakpoints"];function O3e(e){return I3e(e,R3e)}function $3e(e){return e.semanticTokens}function N3e(e){const{__cssMap:t,__cssVars:n,__breakpoints:r,...i}=e;return i}var D3e=e=>rV.includes(e)||e==="default";function L3e({tokens:e,semanticTokens:t}){const n={};return E9(e,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!1,value:r})}),E9(t,(r,i)=>{r!=null&&(n[i.join(".")]={isSemantic:!0,value:r})},{stop:r=>Object.keys(r).every(D3e)}),n}function F3e(e){var t;const n=N3e(e),r=O3e(n),i=$3e(n),o=L3e({tokens:r,semanticTokens:i}),a=(t=n.config)==null?void 0:t.cssVarPrefix,{cssMap:s,cssVars:l}=P3e(o,{cssVarPrefix:a});return Object.assign(n,{__cssVars:{...{"--chakra-ring-inset":"var(--chakra-empty,/*!*/ /*!*/)","--chakra-ring-offset-width":"0px","--chakra-ring-offset-color":"#fff","--chakra-ring-color":"rgba(66, 153, 225, 0.6)","--chakra-ring-offset-shadow":"0 0 #0000","--chakra-ring-shadow":"0 0 #0000","--chakra-space-x-reverse":"0","--chakra-space-y-reverse":"0"},...l},__cssMap:s,__breakpoints:T3e(n.breakpoints)}),n}var BA=ca({},Qy,ut,e3e,H1,Di,t3e,c3e,n3e,Jj,u3e,up,o3,Ot,g3e,p3e,d3e,f3e,r3e,h3e),B3e=Object.assign({},Ot,Di,H1,Jj,up),_Ue=Object.keys(B3e),z3e=[...Object.keys(BA),...rV],j3e={...BA,...n2},V3e=e=>e in j3e,U3e=e=>t=>{if(!t.__breakpoints)return e;const{isResponsive:n,toArrayValue:r,media:i}=t.__breakpoints,o={};for(const a in e){let s=ua(e[a],t);if(s==null)continue;if(s=ya(s)&&n(s)?r(s):s,!Array.isArray(s)){o[a]=s;continue}const l=s.slice(0,i.length).length;for(let u=0;ue.startsWith("--")&&typeof t=="string"&&!H3e(t),W3e=(e,t)=>{var n,r;if(t==null)return t;const i=l=>{var u,c;return(c=(u=e.__cssMap)==null?void 0:u[l])==null?void 0:c.varRef},o=l=>{var u;return(u=i(l))!=null?u:l},[a,s]=G3e(t);return t=(r=(n=i(a))!=null?n:o(s))!=null?r:o(t),t};function K3e(e){const{configs:t={},pseudos:n={},theme:r}=e,i=(o,a=!1)=>{var s,l,u;const c=ua(o,r),d=U3e(c)(r);let f={};for(let h in d){const p=d[h];let m=ua(p,r);h in n&&(h=n[h]),q3e(h,m)&&(m=W3e(r,m));let _=t[h];if(_===!0&&(_={property:h}),ya(m)){f[h]=(s=f[h])!=null?s:{},f[h]=ca({},f[h],i(m,!0));continue}let v=(u=(l=_==null?void 0:_.transform)==null?void 0:l.call(_,m,r,c))!=null?u:m;v=_!=null&&_.processResult?i(v,!0):v;const y=ua(_==null?void 0:_.property,r);if(!a&&(_!=null&&_.static)){const g=ua(_.static,r);f=ca({},f,g)}if(y&&Array.isArray(y)){for(const g of y)f[g]=v;continue}if(y){y==="&"&&ya(v)?f=ca({},f,v):f[y]=v;continue}if(ya(v)){f=ca({},f,v);continue}f[h]=v}return f};return i}var iV=e=>t=>K3e({theme:t,pseudos:n2,configs:BA})(e);function je(e){return{definePartsStyle(t){return t},defineMultiStyleConfig(t){return{parts:e,...t}}}}function X3e(e,t){if(Array.isArray(e))return e;if(ya(e))return t(e);if(e!=null)return[e]}function Q3e(e,t){for(let n=t+1;n{ca(u,{[g]:f?y[g]:{[v]:y[g]}})});continue}if(!h){f?ca(u,y):u[v]=y;continue}u[v]=y}}return u}}function Z3e(e){return t=>{var n;const{variant:r,size:i,theme:o}=t,a=Y3e(o);return ca({},ua((n=e.baseStyle)!=null?n:{},t),a(e,"sizes",i,t),a(e,"variants",r,t))}}function SUe(e,t,n){var r,i,o;return(o=(i=(r=e.__cssMap)==null?void 0:r[`${t}.${n}`])==null?void 0:i.varRef)!=null?o:n}function Rm(e){return k3e(e,["styleConfig","size","variant","colorScheme"])}var J3e={common:"background-color, border-color, color, fill, stroke, opacity, box-shadow, transform",colors:"background-color, border-color, color, fill, stroke",dimensions:"width, height",position:"left, right, top, bottom",background:"background-color, background-image, background-position"},e4e={"ease-in":"cubic-bezier(0.4, 0, 1, 1)","ease-out":"cubic-bezier(0, 0, 0.2, 1)","ease-in-out":"cubic-bezier(0.4, 0, 0.2, 1)"},t4e={"ultra-fast":"50ms",faster:"100ms",fast:"150ms",normal:"200ms",slow:"300ms",slower:"400ms","ultra-slow":"500ms"},n4e={property:J3e,easing:e4e,duration:t4e},r4e=n4e,i4e={hide:-1,auto:"auto",base:0,docked:10,dropdown:1e3,sticky:1100,banner:1200,overlay:1300,modal:1400,popover:1500,skipLink:1600,toast:1700,tooltip:1800},o4e=i4e,a4e={none:0,"1px":"1px solid","2px":"2px solid","4px":"4px solid","8px":"8px solid"},s4e=a4e,l4e={base:"0em",sm:"30em",md:"48em",lg:"62em",xl:"80em","2xl":"96em"},u4e=l4e,c4e={transparent:"transparent",current:"currentColor",black:"#000000",white:"#FFFFFF",whiteAlpha:{50:"rgba(255, 255, 255, 0.04)",100:"rgba(255, 255, 255, 0.06)",200:"rgba(255, 255, 255, 0.08)",300:"rgba(255, 255, 255, 0.16)",400:"rgba(255, 255, 255, 0.24)",500:"rgba(255, 255, 255, 0.36)",600:"rgba(255, 255, 255, 0.48)",700:"rgba(255, 255, 255, 0.64)",800:"rgba(255, 255, 255, 0.80)",900:"rgba(255, 255, 255, 0.92)"},blackAlpha:{50:"rgba(0, 0, 0, 0.04)",100:"rgba(0, 0, 0, 0.06)",200:"rgba(0, 0, 0, 0.08)",300:"rgba(0, 0, 0, 0.16)",400:"rgba(0, 0, 0, 0.24)",500:"rgba(0, 0, 0, 0.36)",600:"rgba(0, 0, 0, 0.48)",700:"rgba(0, 0, 0, 0.64)",800:"rgba(0, 0, 0, 0.80)",900:"rgba(0, 0, 0, 0.92)"},gray:{50:"#F7FAFC",100:"#EDF2F7",200:"#E2E8F0",300:"#CBD5E0",400:"#A0AEC0",500:"#718096",600:"#4A5568",700:"#2D3748",800:"#1A202C",900:"#171923"},red:{50:"#FFF5F5",100:"#FED7D7",200:"#FEB2B2",300:"#FC8181",400:"#F56565",500:"#E53E3E",600:"#C53030",700:"#9B2C2C",800:"#822727",900:"#63171B"},orange:{50:"#FFFAF0",100:"#FEEBC8",200:"#FBD38D",300:"#F6AD55",400:"#ED8936",500:"#DD6B20",600:"#C05621",700:"#9C4221",800:"#7B341E",900:"#652B19"},yellow:{50:"#FFFFF0",100:"#FEFCBF",200:"#FAF089",300:"#F6E05E",400:"#ECC94B",500:"#D69E2E",600:"#B7791F",700:"#975A16",800:"#744210",900:"#5F370E"},green:{50:"#F0FFF4",100:"#C6F6D5",200:"#9AE6B4",300:"#68D391",400:"#48BB78",500:"#38A169",600:"#2F855A",700:"#276749",800:"#22543D",900:"#1C4532"},teal:{50:"#E6FFFA",100:"#B2F5EA",200:"#81E6D9",300:"#4FD1C5",400:"#38B2AC",500:"#319795",600:"#2C7A7B",700:"#285E61",800:"#234E52",900:"#1D4044"},blue:{50:"#ebf8ff",100:"#bee3f8",200:"#90cdf4",300:"#63b3ed",400:"#4299e1",500:"#3182ce",600:"#2b6cb0",700:"#2c5282",800:"#2a4365",900:"#1A365D"},cyan:{50:"#EDFDFD",100:"#C4F1F9",200:"#9DECF9",300:"#76E4F7",400:"#0BC5EA",500:"#00B5D8",600:"#00A3C4",700:"#0987A0",800:"#086F83",900:"#065666"},purple:{50:"#FAF5FF",100:"#E9D8FD",200:"#D6BCFA",300:"#B794F4",400:"#9F7AEA",500:"#805AD5",600:"#6B46C1",700:"#553C9A",800:"#44337A",900:"#322659"},pink:{50:"#FFF5F7",100:"#FED7E2",200:"#FBB6CE",300:"#F687B3",400:"#ED64A6",500:"#D53F8C",600:"#B83280",700:"#97266D",800:"#702459",900:"#521B41"},linkedin:{50:"#E8F4F9",100:"#CFEDFB",200:"#9BDAF3",300:"#68C7EC",400:"#34B3E4",500:"#00A0DC",600:"#008CC9",700:"#0077B5",800:"#005E93",900:"#004471"},facebook:{50:"#E8F4F9",100:"#D9DEE9",200:"#B7C2DA",300:"#6482C0",400:"#4267B2",500:"#385898",600:"#314E89",700:"#29487D",800:"#223B67",900:"#1E355B"},messenger:{50:"#D0E6FF",100:"#B9DAFF",200:"#A2CDFF",300:"#7AB8FF",400:"#2E90FF",500:"#0078FF",600:"#0063D1",700:"#0052AC",800:"#003C7E",900:"#002C5C"},whatsapp:{50:"#dffeec",100:"#b9f5d0",200:"#90edb3",300:"#65e495",400:"#3cdd78",500:"#22c35e",600:"#179848",700:"#0c6c33",800:"#01421c",900:"#001803"},twitter:{50:"#E5F4FD",100:"#C8E9FB",200:"#A8DCFA",300:"#83CDF7",400:"#57BBF5",500:"#1DA1F2",600:"#1A94DA",700:"#1681BF",800:"#136B9E",900:"#0D4D71"},telegram:{50:"#E3F2F9",100:"#C5E4F3",200:"#A2D4EC",300:"#7AC1E4",400:"#47A9DA",500:"#0088CC",600:"#007AB8",700:"#006BA1",800:"#005885",900:"#003F5E"}},d4e=c4e,f4e={none:"0",sm:"0.125rem",base:"0.25rem",md:"0.375rem",lg:"0.5rem",xl:"0.75rem","2xl":"1rem","3xl":"1.5rem",full:"9999px"},h4e=f4e,p4e={xs:"0 0 0 1px rgba(0, 0, 0, 0.05)",sm:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",base:"0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)",md:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",lg:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",xl:"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)","2xl":"0 25px 50px -12px rgba(0, 0, 0, 0.25)",outline:"0 0 0 3px rgba(66, 153, 225, 0.6)",inner:"inset 0 2px 4px 0 rgba(0,0,0,0.06)",none:"none","dark-lg":"rgba(0, 0, 0, 0.1) 0px 0px 0px 1px, rgba(0, 0, 0, 0.2) 0px 5px 10px, rgba(0, 0, 0, 0.4) 0px 15px 40px"},g4e=p4e,m4e={none:0,sm:"4px",base:"8px",md:"12px",lg:"16px",xl:"24px","2xl":"40px","3xl":"64px"},y4e=m4e,v4e={letterSpacings:{tighter:"-0.05em",tight:"-0.025em",normal:"0",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeights:{normal:"normal",none:1,shorter:1.25,short:1.375,base:1.5,tall:1.625,taller:"2",3:".75rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem"},fontWeights:{hairline:100,thin:200,light:300,normal:400,medium:500,semibold:600,bold:700,extrabold:800,black:900},fonts:{heading:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',body:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',mono:'SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace'},fontSizes:{"3xs":"0.45rem","2xs":"0.625rem",xs:"0.75rem",sm:"0.875rem",md:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem","5xl":"3rem","6xl":"3.75rem","7xl":"4.5rem","8xl":"6rem","9xl":"8rem"}},oV=v4e,aV={px:"1px",.5:"0.125rem",1:"0.25rem",1.5:"0.375rem",2:"0.5rem",2.5:"0.625rem",3:"0.75rem",3.5:"0.875rem",4:"1rem",5:"1.25rem",6:"1.5rem",7:"1.75rem",8:"2rem",9:"2.25rem",10:"2.5rem",12:"3rem",14:"3.5rem",16:"4rem",20:"5rem",24:"6rem",28:"7rem",32:"8rem",36:"9rem",40:"10rem",44:"11rem",48:"12rem",52:"13rem",56:"14rem",60:"15rem",64:"16rem",72:"18rem",80:"20rem",96:"24rem"},b4e={max:"max-content",min:"min-content",full:"100%","3xs":"14rem","2xs":"16rem",xs:"20rem",sm:"24rem",md:"28rem",lg:"32rem",xl:"36rem","2xl":"42rem","3xl":"48rem","4xl":"56rem","5xl":"64rem","6xl":"72rem","7xl":"80rem","8xl":"90rem",prose:"60ch"},_4e={sm:"640px",md:"768px",lg:"1024px",xl:"1280px"},S4e={...aV,...b4e,container:_4e},sV=S4e,x4e={breakpoints:u4e,zIndices:o4e,radii:h4e,blur:y4e,colors:d4e,...oV,sizes:sV,shadows:g4e,space:aV,borders:s4e,transition:r4e},{defineMultiStyleConfig:w4e,definePartsStyle:Vh}=je(["stepper","step","title","description","indicator","separator","icon","number"]),Ka=Pe("stepper-indicator-size"),ad=Pe("stepper-icon-size"),sd=Pe("stepper-title-font-size"),Uh=Pe("stepper-description-font-size"),wh=Pe("stepper-accent-color"),C4e=Vh(({colorScheme:e})=>({stepper:{display:"flex",justifyContent:"space-between",gap:"4","&[data-orientation=vertical]":{flexDirection:"column",alignItems:"flex-start"},"&[data-orientation=horizontal]":{flexDirection:"row",alignItems:"center"},[wh.variable]:`colors.${e}.500`,_dark:{[wh.variable]:`colors.${e}.200`}},title:{fontSize:sd.reference,fontWeight:"medium"},description:{fontSize:Uh.reference,color:"chakra-subtle-text"},number:{fontSize:sd.reference},step:{flexShrink:0,position:"relative",display:"flex",gap:"2","&[data-orientation=horizontal]":{alignItems:"center"},flex:"1","&:last-of-type:not([data-stretch])":{flex:"initial"}},icon:{flexShrink:0,width:ad.reference,height:ad.reference},indicator:{flexShrink:0,borderRadius:"full",width:Ka.reference,height:Ka.reference,display:"flex",justifyContent:"center",alignItems:"center","&[data-status=active]":{borderWidth:"2px",borderColor:wh.reference},"&[data-status=complete]":{bg:wh.reference,color:"chakra-inverse-text"},"&[data-status=incomplete]":{borderWidth:"2px"}},separator:{bg:"chakra-border-color",flex:"1","&[data-status=complete]":{bg:wh.reference},"&[data-orientation=horizontal]":{width:"100%",height:"2px",marginStart:"2"},"&[data-orientation=vertical]":{width:"2px",position:"absolute",height:"100%",maxHeight:`calc(100% - ${Ka.reference} - 8px)`,top:`calc(${Ka.reference} + 4px)`,insetStart:`calc(${Ka.reference} / 2 - 1px)`}}})),E4e=w4e({baseStyle:C4e,sizes:{xs:Vh({stepper:{[Ka.variable]:"sizes.4",[ad.variable]:"sizes.3",[sd.variable]:"fontSizes.xs",[Uh.variable]:"fontSizes.xs"}}),sm:Vh({stepper:{[Ka.variable]:"sizes.6",[ad.variable]:"sizes.4",[sd.variable]:"fontSizes.sm",[Uh.variable]:"fontSizes.xs"}}),md:Vh({stepper:{[Ka.variable]:"sizes.8",[ad.variable]:"sizes.5",[sd.variable]:"fontSizes.md",[Uh.variable]:"fontSizes.sm"}}),lg:Vh({stepper:{[Ka.variable]:"sizes.10",[ad.variable]:"sizes.6",[sd.variable]:"fontSizes.lg",[Uh.variable]:"fontSizes.md"}})},defaultProps:{size:"md",colorScheme:"blue"}});function pt(e,t={}){let n=!1;function r(){if(!n){n=!0;return}throw new Error("[anatomy] .part(...) should only be called once. Did you mean to use .extend(...) ?")}function i(...c){r();for(const d of c)t[d]=l(d);return pt(e,t)}function o(...c){for(const d of c)d in t||(t[d]=l(d));return pt(e,t)}function a(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.selector]))}function s(){return Object.fromEntries(Object.entries(t).map(([d,f])=>[d,f.className]))}function l(c){const h=`chakra-${(["container","root"].includes(c??"")?[e]:[e,c]).filter(Boolean).join("__")}`;return{className:h,selector:`.${h}`,toString:()=>c}}return{parts:i,toPart:l,extend:o,selectors:a,classnames:s,get keys(){return Object.keys(t)},__type:{}}}var lV=pt("accordion").parts("root","container","button","panel").extend("icon"),A4e=pt("alert").parts("title","description","container").extend("icon","spinner"),T4e=pt("avatar").parts("label","badge","container").extend("excessLabel","group"),P4e=pt("breadcrumb").parts("link","item","container").extend("separator");pt("button").parts();var uV=pt("checkbox").parts("control","icon","container").extend("label");pt("progress").parts("track","filledTrack").extend("label");var k4e=pt("drawer").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),cV=pt("editable").parts("preview","input","textarea"),I4e=pt("form").parts("container","requiredIndicator","helperText"),M4e=pt("formError").parts("text","icon"),dV=pt("input").parts("addon","field","element","group"),R4e=pt("list").parts("container","item","icon"),fV=pt("menu").parts("button","list","item").extend("groupTitle","icon","command","divider"),hV=pt("modal").parts("overlay","dialogContainer","dialog").extend("header","closeButton","body","footer"),pV=pt("numberinput").parts("root","field","stepperGroup","stepper");pt("pininput").parts("field");var gV=pt("popover").parts("content","header","body","footer").extend("popper","arrow","closeButton"),mV=pt("progress").parts("label","filledTrack","track"),O4e=pt("radio").parts("container","control","label"),yV=pt("select").parts("field","icon"),vV=pt("slider").parts("container","track","thumb","filledTrack","mark"),$4e=pt("stat").parts("container","label","helpText","number","icon"),bV=pt("switch").parts("container","track","thumb"),N4e=pt("table").parts("table","thead","tbody","tr","th","td","tfoot","caption"),_V=pt("tabs").parts("root","tab","tablist","tabpanel","tabpanels","indicator"),D4e=pt("tag").parts("container","label","closeButton"),L4e=pt("card").parts("container","header","body","footer");function Pu(e,t,n){return Math.min(Math.max(e,n),t)}class F4e extends Error{constructor(t){super(`Failed to parse color: "${t}"`)}}var Gh=F4e;function zA(e){if(typeof e!="string")throw new Gh(e);if(e.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=e.trim();t=q4e.test(e)?j4e(e):e;const n=V4e.exec(t);if(n){const a=Array.from(n).slice(1);return[...a.slice(0,3).map(s=>parseInt(Og(s,2),16)),parseInt(Og(a[3]||"f",2),16)/255]}const r=U4e.exec(t);if(r){const a=Array.from(r).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,16)),parseInt(a[3]||"ff",16)/255]}const i=G4e.exec(t);if(i){const a=Array.from(i).slice(1);return[...a.slice(0,3).map(s=>parseInt(s,10)),parseFloat(a[3]||"1")]}const o=H4e.exec(t);if(o){const[a,s,l,u]=Array.from(o).slice(1).map(parseFloat);if(Pu(0,100,s)!==s)throw new Gh(e);if(Pu(0,100,l)!==l)throw new Gh(e);return[...W4e(a,s,l),Number.isNaN(u)?1:u]}throw new Gh(e)}function B4e(e){let t=5381,n=e.length;for(;n;)t=t*33^e.charCodeAt(--n);return(t>>>0)%2341}const A9=e=>parseInt(e.replace(/_/g,""),36),z4e="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce((e,t)=>{const n=A9(t.substring(0,3)),r=A9(t.substring(3)).toString(16);let i="";for(let o=0;o<6-r.length;o++)i+="0";return e[n]=`${i}${r}`,e},{});function j4e(e){const t=e.toLowerCase().trim(),n=z4e[B4e(t)];if(!n)throw new Gh(e);return`#${n}`}const Og=(e,t)=>Array.from(Array(t)).map(()=>e).join(""),V4e=new RegExp(`^#${Og("([a-f0-9])",3)}([a-f0-9])?$`,"i"),U4e=new RegExp(`^#${Og("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i"),G4e=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${Og(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i"),H4e=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i,q4e=/^[a-z]+$/i,T9=e=>Math.round(e*255),W4e=(e,t,n)=>{let r=n/100;if(t===0)return[r,r,r].map(T9);const i=(e%360+360)%360/60,o=(1-Math.abs(2*r-1))*(t/100),a=o*(1-Math.abs(i%2-1));let s=0,l=0,u=0;i>=0&&i<1?(s=o,l=a):i>=1&&i<2?(s=a,l=o):i>=2&&i<3?(l=o,u=a):i>=3&&i<4?(l=a,u=o):i>=4&&i<5?(s=a,u=o):i>=5&&i<6&&(s=o,u=a);const c=r-o/2,d=s+c,f=l+c,h=u+c;return[d,f,h].map(T9)};function K4e(e,t,n,r){return`rgba(${Pu(0,255,e).toFixed()}, ${Pu(0,255,t).toFixed()}, ${Pu(0,255,n).toFixed()}, ${parseFloat(Pu(0,1,r).toFixed(3))})`}function X4e(e,t){const[n,r,i,o]=zA(e);return K4e(n,r,i,o-t)}function Q4e(e){const[t,n,r,i]=zA(e);let o=a=>{const s=Pu(0,255,a).toString(16);return s.length===1?`0${s}`:s};return`#${o(t)}${o(n)}${o(r)}${i<1?o(Math.round(i*255)):""}`}function Y4e(e,t,n,r,i){for(t=t.split?t.split("."):t,r=0;rObject.keys(e).length===0,Rr=(e,t,n)=>{const r=Y4e(e,`colors.${t}`,t);try{return Q4e(r),r}catch{return n??"#000000"}},J4e=e=>{const[t,n,r]=zA(e);return(t*299+n*587+r*114)/1e3},eEe=e=>t=>{const n=Rr(t,e);return J4e(n)<128?"dark":"light"},tEe=e=>t=>eEe(e)(t)==="dark",Sf=(e,t)=>n=>{const r=Rr(n,e);return X4e(r,1-t)};function P9(e="1rem",t="rgba(255, 255, 255, 0.15)"){return{backgroundImage:`linear-gradient( + 45deg, + ${t} 25%, + transparent 25%, + transparent 50%, + ${t} 50%, + ${t} 75%, + transparent 75%, + transparent + )`,backgroundSize:`${e} ${e}`}}var nEe=()=>`#${Math.floor(Math.random()*16777215).toString(16).padEnd(6,"0")}`;function rEe(e){const t=nEe();return!e||Z4e(e)?t:e.string&&e.colors?oEe(e.string,e.colors):e.string&&!e.colors?iEe(e.string):e.colors&&!e.string?aEe(e.colors):t}function iEe(e){let t=0;if(e.length===0)return t.toString();for(let r=0;r>r*8&255;n+=`00${i.toString(16)}`.substr(-2)}return n}function oEe(e,t){let n=0;if(e.length===0)return t[0];for(let r=0;rn.colorMode==="dark"?t:e}function jA(e){const{orientation:t,vertical:n,horizontal:r}=e;return t?t==="vertical"?n:r:{}}function SV(e){return ya(e)&&e.reference?e.reference:String(e)}var r2=(e,...t)=>t.map(SV).join(` ${e} `).replace(/calc/g,""),k9=(...e)=>`calc(${r2("+",...e)})`,I9=(...e)=>`calc(${r2("-",...e)})`,l3=(...e)=>`calc(${r2("*",...e)})`,M9=(...e)=>`calc(${r2("/",...e)})`,R9=e=>{const t=SV(e);return t!=null&&!Number.isNaN(parseFloat(t))?String(t).startsWith("-")?String(t).slice(1):`-${t}`:l3(t,-1)},Xa=Object.assign(e=>({add:(...t)=>Xa(k9(e,...t)),subtract:(...t)=>Xa(I9(e,...t)),multiply:(...t)=>Xa(l3(e,...t)),divide:(...t)=>Xa(M9(e,...t)),negate:()=>Xa(R9(e)),toString:()=>e.toString()}),{add:k9,subtract:I9,multiply:l3,divide:M9,negate:R9});function sEe(e){return!Number.isInteger(parseFloat(e.toString()))}function lEe(e,t="-"){return e.replace(/\s+/g,t)}function xV(e){const t=lEe(e.toString());return t.includes("\\.")?e:sEe(e)?t.replace(".","\\."):e}function uEe(e,t=""){return[t,xV(e)].filter(Boolean).join("-")}function cEe(e,t){return`var(${xV(e)}${t?`, ${t}`:""})`}function dEe(e,t=""){return`--${uEe(e,t)}`}function nn(e,t){const n=dEe(e,t==null?void 0:t.prefix);return{variable:n,reference:cEe(n,fEe(t==null?void 0:t.fallback))}}function fEe(e){return typeof e=="string"?e:e==null?void 0:e.reference}var{defineMultiStyleConfig:hEe,definePartsStyle:Yy}=je(bV.keys),cp=nn("switch-track-width"),Bu=nn("switch-track-height"),uw=nn("switch-track-diff"),pEe=Xa.subtract(cp,Bu),u3=nn("switch-thumb-x"),Ch=nn("switch-bg"),gEe=e=>{const{colorScheme:t}=e;return{borderRadius:"full",p:"0.5",width:[cp.reference],height:[Bu.reference],transitionProperty:"common",transitionDuration:"fast",[Ch.variable]:"colors.gray.300",_dark:{[Ch.variable]:"colors.whiteAlpha.400"},_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed"},_checked:{[Ch.variable]:`colors.${t}.500`,_dark:{[Ch.variable]:`colors.${t}.200`}},bg:Ch.reference}},mEe={bg:"white",transitionProperty:"transform",transitionDuration:"normal",borderRadius:"inherit",width:[Bu.reference],height:[Bu.reference],_checked:{transform:`translateX(${u3.reference})`}},yEe=Yy(e=>({container:{[uw.variable]:pEe,[u3.variable]:uw.reference,_rtl:{[u3.variable]:Xa(uw).negate().toString()}},track:gEe(e),thumb:mEe})),vEe={sm:Yy({container:{[cp.variable]:"1.375rem",[Bu.variable]:"sizes.3"}}),md:Yy({container:{[cp.variable]:"1.875rem",[Bu.variable]:"sizes.4"}}),lg:Yy({container:{[cp.variable]:"2.875rem",[Bu.variable]:"sizes.6"}})},bEe=hEe({baseStyle:yEe,sizes:vEe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:_Ee,definePartsStyle:Bd}=je(N4e.keys),SEe=Bd({table:{fontVariantNumeric:"lining-nums tabular-nums",borderCollapse:"collapse",width:"full"},th:{fontFamily:"heading",fontWeight:"bold",textTransform:"uppercase",letterSpacing:"wider",textAlign:"start"},td:{textAlign:"start"},caption:{mt:4,fontFamily:"heading",textAlign:"center",fontWeight:"medium"}}),q1={"&[data-is-numeric=true]":{textAlign:"end"}},xEe=Bd(e=>{const{colorScheme:t}=e;return{th:{color:W("gray.600","gray.400")(e),borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},td:{borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},caption:{color:W("gray.600","gray.100")(e)},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),wEe=Bd(e=>{const{colorScheme:t}=e;return{th:{color:W("gray.600","gray.400")(e),borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},td:{borderBottom:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e),...q1},caption:{color:W("gray.600","gray.100")(e)},tbody:{tr:{"&:nth-of-type(odd)":{"th, td":{borderBottomWidth:"1px",borderColor:W(`${t}.100`,`${t}.700`)(e)},td:{background:W(`${t}.100`,`${t}.700`)(e)}}}},tfoot:{tr:{"&:last-of-type":{th:{borderBottomWidth:0}}}}}}),CEe={simple:xEe,striped:wEe,unstyled:{}},EEe={sm:Bd({th:{px:"4",py:"1",lineHeight:"4",fontSize:"xs"},td:{px:"4",py:"2",fontSize:"sm",lineHeight:"4"},caption:{px:"4",py:"2",fontSize:"xs"}}),md:Bd({th:{px:"6",py:"3",lineHeight:"4",fontSize:"xs"},td:{px:"6",py:"4",lineHeight:"5"},caption:{px:"6",py:"2",fontSize:"sm"}}),lg:Bd({th:{px:"8",py:"4",lineHeight:"5",fontSize:"sm"},td:{px:"8",py:"5",lineHeight:"6"},caption:{px:"6",py:"2",fontSize:"md"}})},AEe=_Ee({baseStyle:SEe,variants:CEe,sizes:EEe,defaultProps:{variant:"simple",size:"md",colorScheme:"gray"}}),Kr=Pe("tabs-color"),Co=Pe("tabs-bg"),Y0=Pe("tabs-border-color"),{defineMultiStyleConfig:TEe,definePartsStyle:va}=je(_V.keys),PEe=e=>{const{orientation:t}=e;return{display:t==="vertical"?"flex":"block"}},kEe=e=>{const{isFitted:t}=e;return{flex:t?1:void 0,transitionProperty:"common",transitionDuration:"normal",_focusVisible:{zIndex:1,boxShadow:"outline"},_disabled:{cursor:"not-allowed",opacity:.4}}},IEe=e=>{const{align:t="start",orientation:n}=e;return{justifyContent:{end:"flex-end",center:"center",start:"flex-start"}[t],flexDirection:n==="vertical"?"column":"row"}},MEe={p:4},REe=va(e=>({root:PEe(e),tab:kEe(e),tablist:IEe(e),tabpanel:MEe})),OEe={sm:va({tab:{py:1,px:4,fontSize:"sm"}}),md:va({tab:{fontSize:"md",py:2,px:4}}),lg:va({tab:{fontSize:"lg",py:3,px:4}})},$Ee=va(e=>{const{colorScheme:t,orientation:n}=e,r=n==="vertical",i=r?"borderStart":"borderBottom",o=r?"marginStart":"marginBottom";return{tablist:{[i]:"2px solid",borderColor:"inherit"},tab:{[i]:"2px solid",borderColor:"transparent",[o]:"-2px",_selected:{[Kr.variable]:`colors.${t}.600`,_dark:{[Kr.variable]:`colors.${t}.300`},borderColor:"currentColor"},_active:{[Co.variable]:"colors.gray.200",_dark:{[Co.variable]:"colors.whiteAlpha.300"}},_disabled:{_active:{bg:"none"}},color:Kr.reference,bg:Co.reference}}}),NEe=va(e=>{const{colorScheme:t}=e;return{tab:{borderTopRadius:"md",border:"1px solid",borderColor:"transparent",mb:"-1px",[Y0.variable]:"transparent",_selected:{[Kr.variable]:`colors.${t}.600`,[Y0.variable]:"colors.white",_dark:{[Kr.variable]:`colors.${t}.300`,[Y0.variable]:"colors.gray.800"},borderColor:"inherit",borderBottomColor:Y0.reference},color:Kr.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),DEe=va(e=>{const{colorScheme:t}=e;return{tab:{border:"1px solid",borderColor:"inherit",[Co.variable]:"colors.gray.50",_dark:{[Co.variable]:"colors.whiteAlpha.50"},mb:"-1px",_notLast:{marginEnd:"-1px"},_selected:{[Co.variable]:"colors.white",[Kr.variable]:`colors.${t}.600`,_dark:{[Co.variable]:"colors.gray.800",[Kr.variable]:`colors.${t}.300`},borderColor:"inherit",borderTopColor:"currentColor",borderBottomColor:"transparent"},color:Kr.reference,bg:Co.reference},tablist:{mb:"-1px",borderBottom:"1px solid",borderColor:"inherit"}}}),LEe=va(e=>{const{colorScheme:t,theme:n}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",color:"gray.600",_selected:{color:Rr(n,`${t}.700`),bg:Rr(n,`${t}.100`)}}}}),FEe=va(e=>{const{colorScheme:t}=e;return{tab:{borderRadius:"full",fontWeight:"semibold",[Kr.variable]:"colors.gray.600",_dark:{[Kr.variable]:"inherit"},_selected:{[Kr.variable]:"colors.white",[Co.variable]:`colors.${t}.600`,_dark:{[Kr.variable]:"colors.gray.800",[Co.variable]:`colors.${t}.300`}},color:Kr.reference,bg:Co.reference}}}),BEe=va({}),zEe={line:$Ee,enclosed:NEe,"enclosed-colored":DEe,"soft-rounded":LEe,"solid-rounded":FEe,unstyled:BEe},jEe=TEe({baseStyle:REe,sizes:OEe,variants:zEe,defaultProps:{size:"md",variant:"line",colorScheme:"blue"}}),gn=w3e("badge",["bg","color","shadow"]),VEe={px:1,textTransform:"uppercase",fontSize:"xs",borderRadius:"sm",fontWeight:"bold",bg:gn.bg.reference,color:gn.color.reference,boxShadow:gn.shadow.reference},UEe=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.500`,.6)(n);return{[gn.bg.variable]:`colors.${t}.500`,[gn.color.variable]:"colors.white",_dark:{[gn.bg.variable]:r,[gn.color.variable]:"colors.whiteAlpha.800"}}},GEe=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.200`,.16)(n);return{[gn.bg.variable]:`colors.${t}.100`,[gn.color.variable]:`colors.${t}.800`,_dark:{[gn.bg.variable]:r,[gn.color.variable]:`colors.${t}.200`}}},HEe=e=>{const{colorScheme:t,theme:n}=e,r=Sf(`${t}.200`,.8)(n);return{[gn.color.variable]:`colors.${t}.500`,_dark:{[gn.color.variable]:r},[gn.shadow.variable]:`inset 0 0 0px 1px ${gn.color.reference}`}},qEe={solid:UEe,subtle:GEe,outline:HEe},dp={baseStyle:VEe,variants:qEe,defaultProps:{variant:"subtle",colorScheme:"gray"}},{defineMultiStyleConfig:WEe,definePartsStyle:zu}=je(D4e.keys),O9=Pe("tag-bg"),$9=Pe("tag-color"),cw=Pe("tag-shadow"),Zy=Pe("tag-min-height"),Jy=Pe("tag-min-width"),ev=Pe("tag-font-size"),tv=Pe("tag-padding-inline"),KEe={fontWeight:"medium",lineHeight:1.2,outline:0,[$9.variable]:gn.color.reference,[O9.variable]:gn.bg.reference,[cw.variable]:gn.shadow.reference,color:$9.reference,bg:O9.reference,boxShadow:cw.reference,borderRadius:"md",minH:Zy.reference,minW:Jy.reference,fontSize:ev.reference,px:tv.reference,_focusVisible:{[cw.variable]:"shadows.outline"}},XEe={lineHeight:1.2,overflow:"visible"},QEe={fontSize:"lg",w:"5",h:"5",transitionProperty:"common",transitionDuration:"normal",borderRadius:"full",marginStart:"1.5",marginEnd:"-1",opacity:.5,_disabled:{opacity:.4},_focusVisible:{boxShadow:"outline",bg:"rgba(0, 0, 0, 0.14)"},_hover:{opacity:.8},_active:{opacity:1}},YEe=zu({container:KEe,label:XEe,closeButton:QEe}),ZEe={sm:zu({container:{[Zy.variable]:"sizes.5",[Jy.variable]:"sizes.5",[ev.variable]:"fontSizes.xs",[tv.variable]:"space.2"},closeButton:{marginEnd:"-2px",marginStart:"0.35rem"}}),md:zu({container:{[Zy.variable]:"sizes.6",[Jy.variable]:"sizes.6",[ev.variable]:"fontSizes.sm",[tv.variable]:"space.2"}}),lg:zu({container:{[Zy.variable]:"sizes.8",[Jy.variable]:"sizes.8",[ev.variable]:"fontSizes.md",[tv.variable]:"space.3"}})},JEe={subtle:zu(e=>{var t;return{container:(t=dp.variants)==null?void 0:t.subtle(e)}}),solid:zu(e=>{var t;return{container:(t=dp.variants)==null?void 0:t.solid(e)}}),outline:zu(e=>{var t;return{container:(t=dp.variants)==null?void 0:t.outline(e)}})},eAe=WEe({variants:JEe,baseStyle:YEe,sizes:ZEe,defaultProps:{size:"md",variant:"subtle",colorScheme:"gray"}}),{definePartsStyle:Ja,defineMultiStyleConfig:tAe}=je(dV.keys),ld=Pe("input-height"),ud=Pe("input-font-size"),cd=Pe("input-padding"),dd=Pe("input-border-radius"),nAe=Ja({addon:{height:ld.reference,fontSize:ud.reference,px:cd.reference,borderRadius:dd.reference},field:{width:"100%",height:ld.reference,fontSize:ud.reference,px:cd.reference,borderRadius:dd.reference,minWidth:0,outline:0,position:"relative",appearance:"none",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed"}}}),Fs={lg:{[ud.variable]:"fontSizes.lg",[cd.variable]:"space.4",[dd.variable]:"radii.md",[ld.variable]:"sizes.12"},md:{[ud.variable]:"fontSizes.md",[cd.variable]:"space.4",[dd.variable]:"radii.md",[ld.variable]:"sizes.10"},sm:{[ud.variable]:"fontSizes.sm",[cd.variable]:"space.3",[dd.variable]:"radii.sm",[ld.variable]:"sizes.8"},xs:{[ud.variable]:"fontSizes.xs",[cd.variable]:"space.2",[dd.variable]:"radii.sm",[ld.variable]:"sizes.6"}},rAe={lg:Ja({field:Fs.lg,group:Fs.lg}),md:Ja({field:Fs.md,group:Fs.md}),sm:Ja({field:Fs.sm,group:Fs.sm}),xs:Ja({field:Fs.xs,group:Fs.xs})};function VA(e){const{focusBorderColor:t,errorBorderColor:n}=e;return{focusBorderColor:t||W("blue.500","blue.300")(e),errorBorderColor:n||W("red.500","red.300")(e)}}var iAe=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=VA(e);return{field:{border:"1px solid",borderColor:"inherit",bg:"inherit",_hover:{borderColor:W("gray.300","whiteAlpha.400")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Rr(t,r),boxShadow:`0 0 0 1px ${Rr(t,r)}`},_focusVisible:{zIndex:1,borderColor:Rr(t,n),boxShadow:`0 0 0 1px ${Rr(t,n)}`}},addon:{border:"1px solid",borderColor:W("inherit","whiteAlpha.50")(e),bg:W("gray.100","whiteAlpha.300")(e)}}}),oAe=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=VA(e);return{field:{border:"2px solid",borderColor:"transparent",bg:W("gray.100","whiteAlpha.50")(e),_hover:{bg:W("gray.200","whiteAlpha.100")(e)},_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Rr(t,r)},_focusVisible:{bg:"transparent",borderColor:Rr(t,n)}},addon:{border:"2px solid",borderColor:"transparent",bg:W("gray.100","whiteAlpha.50")(e)}}}),aAe=Ja(e=>{const{theme:t}=e,{focusBorderColor:n,errorBorderColor:r}=VA(e);return{field:{borderBottom:"1px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent",_readOnly:{boxShadow:"none !important",userSelect:"all"},_invalid:{borderColor:Rr(t,r),boxShadow:`0px 1px 0px 0px ${Rr(t,r)}`},_focusVisible:{borderColor:Rr(t,n),boxShadow:`0px 1px 0px 0px ${Rr(t,n)}`}},addon:{borderBottom:"2px solid",borderColor:"inherit",borderRadius:"0",px:"0",bg:"transparent"}}}),sAe=Ja({field:{bg:"transparent",px:"0",height:"auto"},addon:{bg:"transparent",px:"0",height:"auto"}}),lAe={outline:iAe,filled:oAe,flushed:aAe,unstyled:sAe},ht=tAe({baseStyle:nAe,sizes:rAe,variants:lAe,defaultProps:{size:"md",variant:"outline"}}),N9,uAe={...(N9=ht.baseStyle)==null?void 0:N9.field,paddingY:"2",minHeight:"20",lineHeight:"short",verticalAlign:"top"},D9,L9,cAe={outline:e=>{var t,n;return(n=(t=ht.variants)==null?void 0:t.outline(e).field)!=null?n:{}},flushed:e=>{var t,n;return(n=(t=ht.variants)==null?void 0:t.flushed(e).field)!=null?n:{}},filled:e=>{var t,n;return(n=(t=ht.variants)==null?void 0:t.filled(e).field)!=null?n:{}},unstyled:(L9=(D9=ht.variants)==null?void 0:D9.unstyled.field)!=null?L9:{}},F9,B9,z9,j9,V9,U9,G9,H9,dAe={xs:(B9=(F9=ht.sizes)==null?void 0:F9.xs.field)!=null?B9:{},sm:(j9=(z9=ht.sizes)==null?void 0:z9.sm.field)!=null?j9:{},md:(U9=(V9=ht.sizes)==null?void 0:V9.md.field)!=null?U9:{},lg:(H9=(G9=ht.sizes)==null?void 0:G9.lg.field)!=null?H9:{}},fAe={baseStyle:uAe,sizes:dAe,variants:cAe,defaultProps:{size:"md",variant:"outline"}},Z0=nn("tooltip-bg"),dw=nn("tooltip-fg"),hAe=nn("popper-arrow-bg"),pAe={bg:Z0.reference,color:dw.reference,[Z0.variable]:"colors.gray.700",[dw.variable]:"colors.whiteAlpha.900",_dark:{[Z0.variable]:"colors.gray.300",[dw.variable]:"colors.gray.900"},[hAe.variable]:Z0.reference,px:"2",py:"0.5",borderRadius:"sm",fontWeight:"medium",fontSize:"sm",boxShadow:"md",maxW:"xs",zIndex:"tooltip"},gAe={baseStyle:pAe},{defineMultiStyleConfig:mAe,definePartsStyle:Hh}=je(mV.keys),yAe=e=>{const{colorScheme:t,theme:n,isIndeterminate:r,hasStripe:i}=e,o=W(P9(),P9("1rem","rgba(0,0,0,0.1)"))(e),a=W(`${t}.500`,`${t}.200`)(e),s=`linear-gradient( + to right, + transparent 0%, + ${Rr(n,a)} 50%, + transparent 100% + )`;return{...!r&&i&&o,...r?{bgImage:s}:{bgColor:a}}},vAe={lineHeight:"1",fontSize:"0.25em",fontWeight:"bold",color:"white"},bAe=e=>({bg:W("gray.100","whiteAlpha.300")(e)}),_Ae=e=>({transitionProperty:"common",transitionDuration:"slow",...yAe(e)}),SAe=Hh(e=>({label:vAe,filledTrack:_Ae(e),track:bAe(e)})),xAe={xs:Hh({track:{h:"1"}}),sm:Hh({track:{h:"2"}}),md:Hh({track:{h:"3"}}),lg:Hh({track:{h:"4"}})},wAe=mAe({sizes:xAe,baseStyle:SAe,defaultProps:{size:"md",colorScheme:"blue"}}),CAe=e=>typeof e=="function";function $r(e,...t){return CAe(e)?e(...t):e}var{definePartsStyle:nv,defineMultiStyleConfig:EAe}=je(uV.keys),fp=Pe("checkbox-size"),AAe=e=>{const{colorScheme:t}=e;return{w:fp.reference,h:fp.reference,transitionProperty:"box-shadow",transitionDuration:"normal",border:"2px solid",borderRadius:"sm",borderColor:"inherit",color:"white",_checked:{bg:W(`${t}.500`,`${t}.200`)(e),borderColor:W(`${t}.500`,`${t}.200`)(e),color:W("white","gray.900")(e),_hover:{bg:W(`${t}.600`,`${t}.300`)(e),borderColor:W(`${t}.600`,`${t}.300`)(e)},_disabled:{borderColor:W("gray.200","transparent")(e),bg:W("gray.200","whiteAlpha.300")(e),color:W("gray.500","whiteAlpha.500")(e)}},_indeterminate:{bg:W(`${t}.500`,`${t}.200`)(e),borderColor:W(`${t}.500`,`${t}.200`)(e),color:W("white","gray.900")(e)},_disabled:{bg:W("gray.100","whiteAlpha.100")(e),borderColor:W("gray.100","transparent")(e)},_focusVisible:{boxShadow:"outline"},_invalid:{borderColor:W("red.500","red.300")(e)}}},TAe={_disabled:{cursor:"not-allowed"}},PAe={userSelect:"none",_disabled:{opacity:.4}},kAe={transitionProperty:"transform",transitionDuration:"normal"},IAe=nv(e=>({icon:kAe,container:TAe,control:$r(AAe,e),label:PAe})),MAe={sm:nv({control:{[fp.variable]:"sizes.3"},label:{fontSize:"sm"},icon:{fontSize:"3xs"}}),md:nv({control:{[fp.variable]:"sizes.4"},label:{fontSize:"md"},icon:{fontSize:"2xs"}}),lg:nv({control:{[fp.variable]:"sizes.5"},label:{fontSize:"lg"},icon:{fontSize:"2xs"}})},W1=EAe({baseStyle:IAe,sizes:MAe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:RAe,definePartsStyle:rv}=je(O4e.keys),OAe=e=>{var t;const n=(t=$r(W1.baseStyle,e))==null?void 0:t.control;return{...n,borderRadius:"full",_checked:{...n==null?void 0:n._checked,_before:{content:'""',display:"inline-block",pos:"relative",w:"50%",h:"50%",borderRadius:"50%",bg:"currentColor"}}}},$Ae=rv(e=>{var t,n,r,i;return{label:(n=(t=W1).baseStyle)==null?void 0:n.call(t,e).label,container:(i=(r=W1).baseStyle)==null?void 0:i.call(r,e).container,control:OAe(e)}}),NAe={md:rv({control:{w:"4",h:"4"},label:{fontSize:"md"}}),lg:rv({control:{w:"5",h:"5"},label:{fontSize:"lg"}}),sm:rv({control:{width:"3",height:"3"},label:{fontSize:"sm"}})},DAe=RAe({baseStyle:$Ae,sizes:NAe,defaultProps:{size:"md",colorScheme:"blue"}}),{defineMultiStyleConfig:LAe,definePartsStyle:FAe}=je(yV.keys),J0=Pe("select-bg"),q9,BAe={...(q9=ht.baseStyle)==null?void 0:q9.field,appearance:"none",paddingBottom:"1px",lineHeight:"normal",bg:J0.reference,[J0.variable]:"colors.white",_dark:{[J0.variable]:"colors.gray.700"},"> option, > optgroup":{bg:J0.reference}},zAe={width:"6",height:"100%",insetEnd:"2",position:"relative",color:"currentColor",fontSize:"xl",_disabled:{opacity:.5}},jAe=FAe({field:BAe,icon:zAe}),ey={paddingInlineEnd:"8"},W9,K9,X9,Q9,Y9,Z9,J9,eM,VAe={lg:{...(W9=ht.sizes)==null?void 0:W9.lg,field:{...(K9=ht.sizes)==null?void 0:K9.lg.field,...ey}},md:{...(X9=ht.sizes)==null?void 0:X9.md,field:{...(Q9=ht.sizes)==null?void 0:Q9.md.field,...ey}},sm:{...(Y9=ht.sizes)==null?void 0:Y9.sm,field:{...(Z9=ht.sizes)==null?void 0:Z9.sm.field,...ey}},xs:{...(J9=ht.sizes)==null?void 0:J9.xs,field:{...(eM=ht.sizes)==null?void 0:eM.xs.field,...ey},icon:{insetEnd:"1"}}},UAe=LAe({baseStyle:jAe,sizes:VAe,variants:ht.variants,defaultProps:ht.defaultProps}),fw=Pe("skeleton-start-color"),hw=Pe("skeleton-end-color"),GAe={[fw.variable]:"colors.gray.100",[hw.variable]:"colors.gray.400",_dark:{[fw.variable]:"colors.gray.800",[hw.variable]:"colors.gray.600"},background:fw.reference,borderColor:hw.reference,opacity:.7,borderRadius:"sm"},HAe={baseStyle:GAe},pw=Pe("skip-link-bg"),qAe={borderRadius:"md",fontWeight:"semibold",_focusVisible:{boxShadow:"outline",padding:"4",position:"fixed",top:"6",insetStart:"6",[pw.variable]:"colors.white",_dark:{[pw.variable]:"colors.gray.700"},bg:pw.reference}},WAe={baseStyle:qAe},{defineMultiStyleConfig:KAe,definePartsStyle:i2}=je(vV.keys),$g=Pe("slider-thumb-size"),Ng=Pe("slider-track-size"),Zs=Pe("slider-bg"),XAe=e=>{const{orientation:t}=e;return{display:"inline-block",position:"relative",cursor:"pointer",_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"},...jA({orientation:t,vertical:{h:"100%"},horizontal:{w:"100%"}})}},QAe=e=>({...jA({orientation:e.orientation,horizontal:{h:Ng.reference},vertical:{w:Ng.reference}}),overflow:"hidden",borderRadius:"sm",[Zs.variable]:"colors.gray.200",_dark:{[Zs.variable]:"colors.whiteAlpha.200"},_disabled:{[Zs.variable]:"colors.gray.300",_dark:{[Zs.variable]:"colors.whiteAlpha.300"}},bg:Zs.reference}),YAe=e=>{const{orientation:t}=e;return{...jA({orientation:t,vertical:{left:"50%",transform:"translateX(-50%)",_active:{transform:"translateX(-50%) scale(1.15)"}},horizontal:{top:"50%",transform:"translateY(-50%)",_active:{transform:"translateY(-50%) scale(1.15)"}}}),w:$g.reference,h:$g.reference,display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",outline:0,zIndex:1,borderRadius:"full",bg:"white",boxShadow:"base",border:"1px solid",borderColor:"transparent",transitionProperty:"transform",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{bg:"gray.300"}}},ZAe=e=>{const{colorScheme:t}=e;return{width:"inherit",height:"inherit",[Zs.variable]:`colors.${t}.500`,_dark:{[Zs.variable]:`colors.${t}.200`},bg:Zs.reference}},JAe=i2(e=>({container:XAe(e),track:QAe(e),thumb:YAe(e),filledTrack:ZAe(e)})),eTe=i2({container:{[$g.variable]:"sizes.4",[Ng.variable]:"sizes.1"}}),tTe=i2({container:{[$g.variable]:"sizes.3.5",[Ng.variable]:"sizes.1"}}),nTe=i2({container:{[$g.variable]:"sizes.2.5",[Ng.variable]:"sizes.0.5"}}),rTe={lg:eTe,md:tTe,sm:nTe},iTe=KAe({baseStyle:JAe,sizes:rTe,defaultProps:{size:"md",colorScheme:"blue"}}),_u=nn("spinner-size"),oTe={width:[_u.reference],height:[_u.reference]},aTe={xs:{[_u.variable]:"sizes.3"},sm:{[_u.variable]:"sizes.4"},md:{[_u.variable]:"sizes.6"},lg:{[_u.variable]:"sizes.8"},xl:{[_u.variable]:"sizes.12"}},sTe={baseStyle:oTe,sizes:aTe,defaultProps:{size:"md"}},{defineMultiStyleConfig:lTe,definePartsStyle:wV}=je($4e.keys),uTe={fontWeight:"medium"},cTe={opacity:.8,marginBottom:"2"},dTe={verticalAlign:"baseline",fontWeight:"semibold"},fTe={marginEnd:1,w:"3.5",h:"3.5",verticalAlign:"middle"},hTe=wV({container:{},label:uTe,helpText:cTe,number:dTe,icon:fTe}),pTe={md:wV({label:{fontSize:"sm"},helpText:{fontSize:"sm"},number:{fontSize:"2xl"}})},gTe=lTe({baseStyle:hTe,sizes:pTe,defaultProps:{size:"md"}}),gw=Pe("kbd-bg"),mTe={[gw.variable]:"colors.gray.100",_dark:{[gw.variable]:"colors.whiteAlpha.100"},bg:gw.reference,borderRadius:"md",borderWidth:"1px",borderBottomWidth:"3px",fontSize:"0.8em",fontWeight:"bold",lineHeight:"normal",px:"0.4em",whiteSpace:"nowrap"},yTe={baseStyle:mTe},vTe={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",cursor:"pointer",textDecoration:"none",outline:"none",color:"inherit",_hover:{textDecoration:"underline"},_focusVisible:{boxShadow:"outline"}},bTe={baseStyle:vTe},{defineMultiStyleConfig:_Te,definePartsStyle:STe}=je(R4e.keys),xTe={marginEnd:"2",display:"inline",verticalAlign:"text-bottom"},wTe=STe({icon:xTe}),CTe=_Te({baseStyle:wTe}),{defineMultiStyleConfig:ETe,definePartsStyle:ATe}=je(fV.keys),Zo=Pe("menu-bg"),mw=Pe("menu-shadow"),TTe={[Zo.variable]:"#fff",[mw.variable]:"shadows.sm",_dark:{[Zo.variable]:"colors.gray.700",[mw.variable]:"shadows.dark-lg"},color:"inherit",minW:"3xs",py:"2",zIndex:1,borderRadius:"md",borderWidth:"1px",bg:Zo.reference,boxShadow:mw.reference},PTe={py:"1.5",px:"3",transitionProperty:"background",transitionDuration:"ultra-fast",transitionTimingFunction:"ease-in",_focus:{[Zo.variable]:"colors.gray.100",_dark:{[Zo.variable]:"colors.whiteAlpha.100"}},_active:{[Zo.variable]:"colors.gray.200",_dark:{[Zo.variable]:"colors.whiteAlpha.200"}},_expanded:{[Zo.variable]:"colors.gray.100",_dark:{[Zo.variable]:"colors.whiteAlpha.100"}},_disabled:{opacity:.4,cursor:"not-allowed"},bg:Zo.reference},kTe={mx:4,my:2,fontWeight:"semibold",fontSize:"sm"},ITe={display:"inline-flex",alignItems:"center",justifyContent:"center",flexShrink:0},MTe={opacity:.6},RTe={border:0,borderBottom:"1px solid",borderColor:"inherit",my:"2",opacity:.6},OTe={transitionProperty:"common",transitionDuration:"normal"},$Te=ATe({button:OTe,list:TTe,item:PTe,groupTitle:kTe,icon:ITe,command:MTe,divider:RTe}),NTe=ETe({baseStyle:$Te}),{defineMultiStyleConfig:DTe,definePartsStyle:c3}=je(hV.keys),yw=Pe("modal-bg"),vw=Pe("modal-shadow"),LTe={bg:"blackAlpha.600",zIndex:"modal"},FTe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{display:"flex",zIndex:"modal",justifyContent:"center",alignItems:t?"center":"flex-start",overflow:n==="inside"?"hidden":"auto",overscrollBehaviorY:"none"}},BTe=e=>{const{isCentered:t,scrollBehavior:n}=e;return{borderRadius:"md",color:"inherit",my:t?"auto":"16",mx:t?"auto":void 0,zIndex:"modal",maxH:n==="inside"?"calc(100% - 7.5rem)":void 0,[yw.variable]:"colors.white",[vw.variable]:"shadows.lg",_dark:{[yw.variable]:"colors.gray.700",[vw.variable]:"shadows.dark-lg"},bg:yw.reference,boxShadow:vw.reference}},zTe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},jTe={position:"absolute",top:"2",insetEnd:"3"},VTe=e=>{const{scrollBehavior:t}=e;return{px:"6",py:"2",flex:"1",overflow:t==="inside"?"auto":void 0}},UTe={px:"6",py:"4"},GTe=c3(e=>({overlay:LTe,dialogContainer:$r(FTe,e),dialog:$r(BTe,e),header:zTe,closeButton:jTe,body:$r(VTe,e),footer:UTe}));function fo(e){return c3(e==="full"?{dialog:{maxW:"100vw",minH:"$100vh",my:"0",borderRadius:"0"}}:{dialog:{maxW:e}})}var HTe={xs:fo("xs"),sm:fo("sm"),md:fo("md"),lg:fo("lg"),xl:fo("xl"),"2xl":fo("2xl"),"3xl":fo("3xl"),"4xl":fo("4xl"),"5xl":fo("5xl"),"6xl":fo("6xl"),full:fo("full")},qTe=DTe({baseStyle:GTe,sizes:HTe,defaultProps:{size:"md"}}),{defineMultiStyleConfig:WTe,definePartsStyle:CV}=je(pV.keys),UA=nn("number-input-stepper-width"),EV=nn("number-input-input-padding"),KTe=Xa(UA).add("0.5rem").toString(),bw=nn("number-input-bg"),_w=nn("number-input-color"),Sw=nn("number-input-border-color"),XTe={[UA.variable]:"sizes.6",[EV.variable]:KTe},QTe=e=>{var t,n;return(n=(t=$r(ht.baseStyle,e))==null?void 0:t.field)!=null?n:{}},YTe={width:UA.reference},ZTe={borderStart:"1px solid",borderStartColor:Sw.reference,color:_w.reference,bg:bw.reference,[_w.variable]:"colors.chakra-body-text",[Sw.variable]:"colors.chakra-border-color",_dark:{[_w.variable]:"colors.whiteAlpha.800",[Sw.variable]:"colors.whiteAlpha.300"},_active:{[bw.variable]:"colors.gray.200",_dark:{[bw.variable]:"colors.whiteAlpha.300"}},_disabled:{opacity:.4,cursor:"not-allowed"}},JTe=CV(e=>{var t;return{root:XTe,field:(t=$r(QTe,e))!=null?t:{},stepperGroup:YTe,stepper:ZTe}});function ty(e){var t,n,r;const i=(t=ht.sizes)==null?void 0:t[e],o={lg:"md",md:"md",sm:"sm",xs:"sm"},a=(r=(n=i.field)==null?void 0:n.fontSize)!=null?r:"md",s=oV.fontSizes[a];return CV({field:{...i.field,paddingInlineEnd:EV.reference,verticalAlign:"top"},stepper:{fontSize:Xa(s).multiply(.75).toString(),_first:{borderTopEndRadius:o[e]},_last:{borderBottomEndRadius:o[e],mt:"-1px",borderTopWidth:1}}})}var ePe={xs:ty("xs"),sm:ty("sm"),md:ty("md"),lg:ty("lg")},tPe=WTe({baseStyle:JTe,sizes:ePe,variants:ht.variants,defaultProps:ht.defaultProps}),tM,nPe={...(tM=ht.baseStyle)==null?void 0:tM.field,textAlign:"center"},rPe={lg:{fontSize:"lg",w:12,h:12,borderRadius:"md"},md:{fontSize:"md",w:10,h:10,borderRadius:"md"},sm:{fontSize:"sm",w:8,h:8,borderRadius:"sm"},xs:{fontSize:"xs",w:6,h:6,borderRadius:"sm"}},nM,rM,iPe={outline:e=>{var t,n,r;return(r=(n=$r((t=ht.variants)==null?void 0:t.outline,e))==null?void 0:n.field)!=null?r:{}},flushed:e=>{var t,n,r;return(r=(n=$r((t=ht.variants)==null?void 0:t.flushed,e))==null?void 0:n.field)!=null?r:{}},filled:e=>{var t,n,r;return(r=(n=$r((t=ht.variants)==null?void 0:t.filled,e))==null?void 0:n.field)!=null?r:{}},unstyled:(rM=(nM=ht.variants)==null?void 0:nM.unstyled.field)!=null?rM:{}},oPe={baseStyle:nPe,sizes:rPe,variants:iPe,defaultProps:ht.defaultProps},{defineMultiStyleConfig:aPe,definePartsStyle:sPe}=je(gV.keys),ny=nn("popper-bg"),lPe=nn("popper-arrow-bg"),iM=nn("popper-arrow-shadow-color"),uPe={zIndex:10},cPe={[ny.variable]:"colors.white",bg:ny.reference,[lPe.variable]:ny.reference,[iM.variable]:"colors.gray.200",_dark:{[ny.variable]:"colors.gray.700",[iM.variable]:"colors.whiteAlpha.300"},width:"xs",border:"1px solid",borderColor:"inherit",borderRadius:"md",boxShadow:"sm",zIndex:"inherit",_focusVisible:{outline:0,boxShadow:"outline"}},dPe={px:3,py:2,borderBottomWidth:"1px"},fPe={px:3,py:2},hPe={px:3,py:2,borderTopWidth:"1px"},pPe={position:"absolute",borderRadius:"md",top:1,insetEnd:2,padding:2},gPe=sPe({popper:uPe,content:cPe,header:dPe,body:fPe,footer:hPe,closeButton:pPe}),mPe=aPe({baseStyle:gPe}),{definePartsStyle:d3,defineMultiStyleConfig:yPe}=je(k4e.keys),xw=Pe("drawer-bg"),ww=Pe("drawer-box-shadow");function Dc(e){return d3(e==="full"?{dialog:{maxW:"100vw",h:"100vh"}}:{dialog:{maxW:e}})}var vPe={bg:"blackAlpha.600",zIndex:"overlay"},bPe={display:"flex",zIndex:"modal",justifyContent:"center"},_Pe=e=>{const{isFullHeight:t}=e;return{...t&&{height:"100vh"},zIndex:"modal",maxH:"100vh",color:"inherit",[xw.variable]:"colors.white",[ww.variable]:"shadows.lg",_dark:{[xw.variable]:"colors.gray.700",[ww.variable]:"shadows.dark-lg"},bg:xw.reference,boxShadow:ww.reference}},SPe={px:"6",py:"4",fontSize:"xl",fontWeight:"semibold"},xPe={position:"absolute",top:"2",insetEnd:"3"},wPe={px:"6",py:"2",flex:"1",overflow:"auto"},CPe={px:"6",py:"4"},EPe=d3(e=>({overlay:vPe,dialogContainer:bPe,dialog:$r(_Pe,e),header:SPe,closeButton:xPe,body:wPe,footer:CPe})),APe={xs:Dc("xs"),sm:Dc("md"),md:Dc("lg"),lg:Dc("2xl"),xl:Dc("4xl"),full:Dc("full")},TPe=yPe({baseStyle:EPe,sizes:APe,defaultProps:{size:"xs"}}),{definePartsStyle:PPe,defineMultiStyleConfig:kPe}=je(cV.keys),IPe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},MPe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},RPe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},OPe=PPe({preview:IPe,input:MPe,textarea:RPe}),$Pe=kPe({baseStyle:OPe}),{definePartsStyle:NPe,defineMultiStyleConfig:DPe}=je(I4e.keys),zd=Pe("form-control-color"),LPe={marginStart:"1",[zd.variable]:"colors.red.500",_dark:{[zd.variable]:"colors.red.300"},color:zd.reference},FPe={mt:"2",[zd.variable]:"colors.gray.600",_dark:{[zd.variable]:"colors.whiteAlpha.600"},color:zd.reference,lineHeight:"normal",fontSize:"sm"},BPe=NPe({container:{width:"100%",position:"relative"},requiredIndicator:LPe,helperText:FPe}),zPe=DPe({baseStyle:BPe}),{definePartsStyle:jPe,defineMultiStyleConfig:VPe}=je(M4e.keys),jd=Pe("form-error-color"),UPe={[jd.variable]:"colors.red.500",_dark:{[jd.variable]:"colors.red.300"},color:jd.reference,mt:"2",fontSize:"sm",lineHeight:"normal"},GPe={marginEnd:"0.5em",[jd.variable]:"colors.red.500",_dark:{[jd.variable]:"colors.red.300"},color:jd.reference},HPe=jPe({text:UPe,icon:GPe}),qPe=VPe({baseStyle:HPe}),WPe={fontSize:"md",marginEnd:"3",mb:"2",fontWeight:"medium",transitionProperty:"common",transitionDuration:"normal",opacity:1,_disabled:{opacity:.4}},KPe={baseStyle:WPe},XPe={fontFamily:"heading",fontWeight:"bold"},QPe={"4xl":{fontSize:["6xl",null,"7xl"],lineHeight:1},"3xl":{fontSize:["5xl",null,"6xl"],lineHeight:1},"2xl":{fontSize:["4xl",null,"5xl"],lineHeight:[1.2,null,1]},xl:{fontSize:["3xl",null,"4xl"],lineHeight:[1.33,null,1.2]},lg:{fontSize:["2xl",null,"3xl"],lineHeight:[1.33,null,1.2]},md:{fontSize:"xl",lineHeight:1.2},sm:{fontSize:"md",lineHeight:1.2},xs:{fontSize:"sm",lineHeight:1.2}},YPe={baseStyle:XPe,sizes:QPe,defaultProps:{size:"xl"}},{defineMultiStyleConfig:ZPe,definePartsStyle:JPe}=je(P4e.keys),Cw=Pe("breadcrumb-link-decor"),eke={transitionProperty:"common",transitionDuration:"fast",transitionTimingFunction:"ease-out",outline:"none",color:"inherit",textDecoration:Cw.reference,[Cw.variable]:"none","&:not([aria-current=page])":{cursor:"pointer",_hover:{[Cw.variable]:"underline"},_focusVisible:{boxShadow:"outline"}}},tke=JPe({link:eke}),nke=ZPe({baseStyle:tke}),rke={lineHeight:"1.2",borderRadius:"md",fontWeight:"semibold",transitionProperty:"common",transitionDuration:"normal",_focusVisible:{boxShadow:"outline"},_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{_disabled:{bg:"initial"}}},AV=e=>{const{colorScheme:t,theme:n}=e;if(t==="gray")return{color:W("gray.800","whiteAlpha.900")(e),_hover:{bg:W("gray.100","whiteAlpha.200")(e)},_active:{bg:W("gray.200","whiteAlpha.300")(e)}};const r=Sf(`${t}.200`,.12)(n),i=Sf(`${t}.200`,.24)(n);return{color:W(`${t}.600`,`${t}.200`)(e),bg:"transparent",_hover:{bg:W(`${t}.50`,r)(e)},_active:{bg:W(`${t}.100`,i)(e)}}},ike=e=>{const{colorScheme:t}=e,n=W("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"},...$r(AV,e)}},oke={yellow:{bg:"yellow.400",color:"black",hoverBg:"yellow.500",activeBg:"yellow.600"},cyan:{bg:"cyan.400",color:"black",hoverBg:"cyan.500",activeBg:"cyan.600"}},ake=e=>{var t;const{colorScheme:n}=e;if(n==="gray"){const l=W("gray.100","whiteAlpha.200")(e);return{bg:l,color:W("gray.800","whiteAlpha.900")(e),_hover:{bg:W("gray.200","whiteAlpha.300")(e),_disabled:{bg:l}},_active:{bg:W("gray.300","whiteAlpha.400")(e)}}}const{bg:r=`${n}.500`,color:i="white",hoverBg:o=`${n}.600`,activeBg:a=`${n}.700`}=(t=oke[n])!=null?t:{},s=W(r,`${n}.200`)(e);return{bg:s,color:W(i,"gray.800")(e),_hover:{bg:W(o,`${n}.300`)(e),_disabled:{bg:s}},_active:{bg:W(a,`${n}.400`)(e)}}},ske=e=>{const{colorScheme:t}=e;return{padding:0,height:"auto",lineHeight:"normal",verticalAlign:"baseline",color:W(`${t}.500`,`${t}.200`)(e),_hover:{textDecoration:"underline",_disabled:{textDecoration:"none"}},_active:{color:W(`${t}.700`,`${t}.500`)(e)}}},lke={bg:"none",color:"inherit",display:"inline",lineHeight:"inherit",m:"0",p:"0"},uke={ghost:AV,outline:ike,solid:ake,link:ske,unstyled:lke},cke={lg:{h:"12",minW:"12",fontSize:"lg",px:"6"},md:{h:"10",minW:"10",fontSize:"md",px:"4"},sm:{h:"8",minW:"8",fontSize:"sm",px:"3"},xs:{h:"6",minW:"6",fontSize:"xs",px:"2"}},dke={baseStyle:rke,variants:uke,sizes:cke,defaultProps:{variant:"solid",size:"md",colorScheme:"gray"}},{definePartsStyle:ju,defineMultiStyleConfig:fke}=je(L4e.keys),K1=Pe("card-bg"),is=Pe("card-padding"),TV=Pe("card-shadow"),iv=Pe("card-radius"),PV=Pe("card-border-width","0"),kV=Pe("card-border-color"),hke=ju({container:{[K1.variable]:"colors.chakra-body-bg",backgroundColor:K1.reference,boxShadow:TV.reference,borderRadius:iv.reference,color:"chakra-body-text",borderWidth:PV.reference,borderColor:kV.reference},body:{padding:is.reference,flex:"1 1 0%"},header:{padding:is.reference},footer:{padding:is.reference}}),pke={sm:ju({container:{[iv.variable]:"radii.base",[is.variable]:"space.3"}}),md:ju({container:{[iv.variable]:"radii.md",[is.variable]:"space.5"}}),lg:ju({container:{[iv.variable]:"radii.xl",[is.variable]:"space.7"}})},gke={elevated:ju({container:{[TV.variable]:"shadows.base",_dark:{[K1.variable]:"colors.gray.700"}}}),outline:ju({container:{[PV.variable]:"1px",[kV.variable]:"colors.chakra-border-color"}}),filled:ju({container:{[K1.variable]:"colors.chakra-subtle-bg"}}),unstyled:{body:{[is.variable]:0},header:{[is.variable]:0},footer:{[is.variable]:0}}},mke=fke({baseStyle:hke,variants:gke,sizes:pke,defaultProps:{variant:"elevated",size:"md"}}),hp=nn("close-button-size"),Eh=nn("close-button-bg"),yke={w:[hp.reference],h:[hp.reference],borderRadius:"md",transitionProperty:"common",transitionDuration:"normal",_disabled:{opacity:.4,cursor:"not-allowed",boxShadow:"none"},_hover:{[Eh.variable]:"colors.blackAlpha.100",_dark:{[Eh.variable]:"colors.whiteAlpha.100"}},_active:{[Eh.variable]:"colors.blackAlpha.200",_dark:{[Eh.variable]:"colors.whiteAlpha.200"}},_focusVisible:{boxShadow:"outline"},bg:Eh.reference},vke={lg:{[hp.variable]:"sizes.10",fontSize:"md"},md:{[hp.variable]:"sizes.8",fontSize:"xs"},sm:{[hp.variable]:"sizes.6",fontSize:"2xs"}},bke={baseStyle:yke,sizes:vke,defaultProps:{size:"md"}},{variants:_ke,defaultProps:Ske}=dp,xke={fontFamily:"mono",fontSize:"sm",px:"0.2em",borderRadius:"sm",bg:gn.bg.reference,color:gn.color.reference,boxShadow:gn.shadow.reference},wke={baseStyle:xke,variants:_ke,defaultProps:Ske},Cke={w:"100%",mx:"auto",maxW:"prose",px:"4"},Eke={baseStyle:Cke},Ake={opacity:.6,borderColor:"inherit"},Tke={borderStyle:"solid"},Pke={borderStyle:"dashed"},kke={solid:Tke,dashed:Pke},Ike={baseStyle:Ake,variants:kke,defaultProps:{variant:"solid"}},{definePartsStyle:Mke,defineMultiStyleConfig:Rke}=je(lV.keys),Oke={borderTopWidth:"1px",borderColor:"inherit",_last:{borderBottomWidth:"1px"}},$ke={transitionProperty:"common",transitionDuration:"normal",fontSize:"md",_focusVisible:{boxShadow:"outline"},_hover:{bg:"blackAlpha.50"},_disabled:{opacity:.4,cursor:"not-allowed"},px:"4",py:"2"},Nke={pt:"2",px:"4",pb:"5"},Dke={fontSize:"1.25em"},Lke=Mke({container:Oke,button:$ke,panel:Nke,icon:Dke}),Fke=Rke({baseStyle:Lke}),{definePartsStyle:Om,defineMultiStyleConfig:Bke}=je(A4e.keys),vi=Pe("alert-fg"),ys=Pe("alert-bg"),zke=Om({container:{bg:ys.reference,px:"4",py:"3"},title:{fontWeight:"bold",lineHeight:"6",marginEnd:"2"},description:{lineHeight:"6"},icon:{color:vi.reference,flexShrink:0,marginEnd:"3",w:"5",h:"6"},spinner:{color:vi.reference,flexShrink:0,marginEnd:"3",w:"5",h:"5"}});function GA(e){const{theme:t,colorScheme:n}=e,r=Sf(`${n}.200`,.16)(t);return{light:`colors.${n}.100`,dark:r}}var jke=Om(e=>{const{colorScheme:t}=e,n=GA(e);return{container:{[vi.variable]:`colors.${t}.500`,[ys.variable]:n.light,_dark:{[vi.variable]:`colors.${t}.200`,[ys.variable]:n.dark}}}}),Vke=Om(e=>{const{colorScheme:t}=e,n=GA(e);return{container:{[vi.variable]:`colors.${t}.500`,[ys.variable]:n.light,_dark:{[vi.variable]:`colors.${t}.200`,[ys.variable]:n.dark},paddingStart:"3",borderStartWidth:"4px",borderStartColor:vi.reference}}}),Uke=Om(e=>{const{colorScheme:t}=e,n=GA(e);return{container:{[vi.variable]:`colors.${t}.500`,[ys.variable]:n.light,_dark:{[vi.variable]:`colors.${t}.200`,[ys.variable]:n.dark},pt:"2",borderTopWidth:"4px",borderTopColor:vi.reference}}}),Gke=Om(e=>{const{colorScheme:t}=e;return{container:{[vi.variable]:"colors.white",[ys.variable]:`colors.${t}.500`,_dark:{[vi.variable]:"colors.gray.900",[ys.variable]:`colors.${t}.200`},color:vi.reference}}}),Hke={subtle:jke,"left-accent":Vke,"top-accent":Uke,solid:Gke},qke=Bke({baseStyle:zke,variants:Hke,defaultProps:{variant:"subtle",colorScheme:"blue"}}),{definePartsStyle:IV,defineMultiStyleConfig:Wke}=je(T4e.keys),Vd=Pe("avatar-border-color"),pp=Pe("avatar-bg"),Dg=Pe("avatar-font-size"),xf=Pe("avatar-size"),Kke={borderRadius:"full",border:"0.2em solid",borderColor:Vd.reference,[Vd.variable]:"white",_dark:{[Vd.variable]:"colors.gray.800"}},Xke={bg:pp.reference,fontSize:Dg.reference,width:xf.reference,height:xf.reference,lineHeight:"1",[pp.variable]:"colors.gray.200",_dark:{[pp.variable]:"colors.whiteAlpha.400"}},Qke=e=>{const{name:t,theme:n}=e,r=t?rEe({string:t}):"colors.gray.400",i=tEe(r)(n);let o="white";return i||(o="gray.800"),{bg:pp.reference,fontSize:Dg.reference,color:o,borderColor:Vd.reference,verticalAlign:"top",width:xf.reference,height:xf.reference,"&:not([data-loaded])":{[pp.variable]:r},[Vd.variable]:"colors.white",_dark:{[Vd.variable]:"colors.gray.800"}}},Yke={fontSize:Dg.reference,lineHeight:"1"},Zke=IV(e=>({badge:$r(Kke,e),excessLabel:$r(Xke,e),container:$r(Qke,e),label:Yke}));function Bs(e){const t=e!=="100%"?sV[e]:void 0;return IV({container:{[xf.variable]:t??e,[Dg.variable]:`calc(${t??e} / 2.5)`},excessLabel:{[xf.variable]:t??e,[Dg.variable]:`calc(${t??e} / 2.5)`}})}var Jke={"2xs":Bs(4),xs:Bs(6),sm:Bs(8),md:Bs(12),lg:Bs(16),xl:Bs(24),"2xl":Bs(32),full:Bs("100%")},e6e=Wke({baseStyle:Zke,sizes:Jke,defaultProps:{size:"md"}}),t6e={Accordion:Fke,Alert:qke,Avatar:e6e,Badge:dp,Breadcrumb:nke,Button:dke,Checkbox:W1,CloseButton:bke,Code:wke,Container:Eke,Divider:Ike,Drawer:TPe,Editable:$Pe,Form:zPe,FormError:qPe,FormLabel:KPe,Heading:YPe,Input:ht,Kbd:yTe,Link:bTe,List:CTe,Menu:NTe,Modal:qTe,NumberInput:tPe,PinInput:oPe,Popover:mPe,Progress:wAe,Radio:DAe,Select:UAe,Skeleton:HAe,SkipLink:WAe,Slider:iTe,Spinner:sTe,Stat:gTe,Switch:bEe,Table:AEe,Tabs:jEe,Tag:eAe,Textarea:fAe,Tooltip:gAe,Card:mke,Stepper:E4e},n6e={colors:{"chakra-body-text":{_light:"gray.800",_dark:"whiteAlpha.900"},"chakra-body-bg":{_light:"white",_dark:"gray.800"},"chakra-border-color":{_light:"gray.200",_dark:"whiteAlpha.300"},"chakra-inverse-text":{_light:"white",_dark:"gray.800"},"chakra-subtle-bg":{_light:"gray.100",_dark:"gray.700"},"chakra-subtle-text":{_light:"gray.600",_dark:"gray.400"},"chakra-placeholder-color":{_light:"gray.500",_dark:"whiteAlpha.400"}}},r6e={global:{body:{fontFamily:"body",color:"chakra-body-text",bg:"chakra-body-bg",transitionProperty:"background-color",transitionDuration:"normal",lineHeight:"base"},"*::placeholder":{color:"chakra-placeholder-color"},"*, *::before, &::after":{borderColor:"chakra-border-color"}}},i6e="ltr",o6e={useSystemColorMode:!1,initialColorMode:"light",cssVarPrefix:"chakra"},a6e={semanticTokens:n6e,direction:i6e,...x4e,components:t6e,styles:r6e,config:o6e},s6e=a6e;function l6e(e,t){const n={};return Object.keys(e).forEach(r=>{t.includes(r)||(n[r]=e[r])}),n}function u6e(e,t,n,r){const i=typeof t=="string"?t.split("."):[t];for(r=0;r{const t=new WeakMap;return(r,i,o,a)=>{if(typeof r>"u")return e(r,i,o);t.has(r)||t.set(r,new Map);const s=t.get(r);if(s.has(i))return s.get(i);const l=e(r,i,o,a);return s.set(i,l),l}},MV=c6e(u6e);function RV(e,t){const n={};return Object.keys(e).forEach(r=>{const i=e[r];t(i,r,e)&&(n[r]=i)}),n}var OV=e=>RV(e,t=>t!=null);function d6e(e){return typeof e=="function"}function $V(e,...t){return d6e(e)?e(...t):e}function xUe(...e){return function(n){e.some(r=>(r==null||r(n),n==null?void 0:n.defaultPrevented))}}var f6e=typeof Element<"u",h6e=typeof Map=="function",p6e=typeof Set=="function",g6e=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function ov(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,r,i;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!ov(e[r],t[r]))return!1;return!0}var o;if(h6e&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!ov(r.value[1],t.get(r.value[0])))return!1;return!0}if(p6e&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(g6e&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,i[r]))return!1;if(f6e&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((i[r]==="_owner"||i[r]==="__v"||i[r]==="__o")&&e.$$typeof)&&!ov(e[i[r]],t[i[r]]))return!1;return!0}return e!==e&&t!==t}var m6e=function(t,n){try{return ov(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const y6e=Nl(m6e);function NV(e,t={}){var n;const{styleConfig:r,...i}=t,{theme:o,colorMode:a}=M5e(),s=e?MV(o,`components.${e}`):void 0,l=r||s,u=ca({theme:o,colorMode:a},(n=l==null?void 0:l.defaultProps)!=null?n:{},OV(l6e(i,["children"]))),c=I.useRef({});if(l){const f=Z3e(l)(u);y6e(c.current,f)||(c.current=f)}return c.current}function $m(e,t={}){return NV(e,t)}function v6e(e,t={}){return NV(e,t)}var b6e=new Set([...z3e,"textStyle","layerStyle","apply","noOfLines","focusBorderColor","errorBorderColor","as","__css","css","sx"]),_6e=new Set(["htmlWidth","htmlHeight","htmlSize","htmlTranslate"]);function S6e(e){return _6e.has(e)||!b6e.has(e)}function x6e(e,...t){if(e==null)throw new TypeError("Cannot convert undefined or null to object");const n={...e};for(const r of t)if(r!=null)for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&(i in n&&delete n[i],n[i]=r[i]);return n}function w6e(e){const t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}var C6e=/^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/,E6e=jj(function(e){return C6e.test(e)||e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)<91}),A6e=E6e,T6e=function(t){return t!=="theme"},oM=function(t){return typeof t=="string"&&t.charCodeAt(0)>96?A6e:T6e},aM=function(t,n,r){var i;if(n){var o=n.shouldForwardProp;i=t.__emotion_forwardProp&&o?function(a){return t.__emotion_forwardProp(a)&&o(a)}:o}return typeof i!="function"&&r&&(i=t.__emotion_forwardProp),i},P6e=function(t){var n=t.cache,r=t.serialized,i=t.isStringTag;return Uj(n,r,i),m5e(function(){return Gj(n,r,i)}),null},k6e=function e(t,n){var r=t.__emotion_real===t,i=r&&t.__emotion_base||t,o,a;n!==void 0&&(o=n.label,a=n.target);var s=aM(t,n,r),l=s||oM(i),u=!l("as");return function(){var c=arguments,d=r&&t.__emotion_styles!==void 0?t.__emotion_styles.slice(0):[];if(o!==void 0&&d.push("label:"+o+";"),c[0]==null||c[0].raw===void 0)d.push.apply(d,c);else{d.push(c[0][0]);for(var f=c.length,h=1;ht=>{const{theme:n,css:r,__css:i,sx:o,...a}=t,s=RV(a,(d,f)=>V3e(f)),l=$V(e,t),u=x6e({},i,l,OV(s),o),c=iV(u)(t.theme);return r?[c,r]:c};function Ew(e,t){const{baseStyle:n,...r}=t??{};r.shouldForwardProp||(r.shouldForwardProp=S6e);const i=R6e({baseStyle:n}),o=M6e(e,r)(i);return bt.forwardRef(function(l,u){const{colorMode:c,forced:d}=e2();return bt.createElement(o,{ref:u,"data-theme":d?c:void 0,...l})})}function O6e(){const e=new Map;return new Proxy(Ew,{apply(t,n,r){return Ew(...r)},get(t,n){return e.has(n)||e.set(n,Ew(n)),e.get(n)}})}var ar=O6e();function Ai(e){return I.forwardRef(e)}function $6e(e={}){const{strict:t=!0,errorMessage:n="useContext: `context` is undefined. Seems you forgot to wrap component within the Provider",name:r}=e,i=I.createContext(void 0);i.displayName=r;function o(){var a;const s=I.useContext(i);if(!s&&t){const l=new Error(n);throw l.name="ContextError",(a=Error.captureStackTrace)==null||a.call(Error,l,o),l}return s}return[i.Provider,o,i]}function N6e(e){const{cssVarsRoot:t,theme:n,children:r}=e,i=I.useMemo(()=>F3e(n),[n]);return q.jsxs(b5e,{theme:i,children:[q.jsx(D6e,{root:t}),r]})}function D6e({root:e=":host, :root"}){const t=[e,"[data-theme]"].join(",");return q.jsx(Xj,{styles:n=>({[t]:n.__cssVars})})}$6e({name:"StylesContext",errorMessage:"useStyles: `styles` is undefined. Seems you forgot to wrap the components in `` "});function wUe(){const{colorMode:e}=e2();return q.jsx(Xj,{styles:t=>{const n=MV(t,"styles.global"),r=$V(n,{theme:t,colorMode:e});return r?iV(r)(t):void 0}})}var L6e=(e,t)=>e.find(n=>n.id===t);function lM(e,t){const n=DV(e,t),r=n?e[n].findIndex(i=>i.id===t):-1;return{position:n,index:r}}function DV(e,t){for(const[n,r]of Object.entries(e))if(L6e(r,t))return n}function F6e(e){const t=e.includes("right"),n=e.includes("left");let r="center";return t&&(r="flex-end"),n&&(r="flex-start"),{display:"flex",flexDirection:"column",alignItems:r}}function B6e(e){const n=e==="top"||e==="bottom"?"0 auto":void 0,r=e.includes("top")?"env(safe-area-inset-top, 0px)":void 0,i=e.includes("bottom")?"env(safe-area-inset-bottom, 0px)":void 0,o=e.includes("left")?void 0:"env(safe-area-inset-right, 0px)",a=e.includes("right")?void 0:"env(safe-area-inset-left, 0px)";return{position:"fixed",zIndex:"var(--toast-z-index, 5500)",pointerEvents:"none",display:"flex",flexDirection:"column",margin:n,top:r,bottom:i,right:o,left:a}}function z6e(e,t=[]){const n=I.useRef(e);return I.useEffect(()=>{n.current=e}),I.useCallback((...r)=>{var i;return(i=n.current)==null?void 0:i.call(n,...r)},t)}function j6e(e,t){const n=z6e(e);I.useEffect(()=>{if(t==null)return;let r=null;return r=window.setTimeout(()=>{n()},t),()=>{r&&window.clearTimeout(r)}},[t,n])}function uM(e,t){const n=I.useRef(!1),r=I.useRef(!1);I.useEffect(()=>{if(n.current&&r.current)return e();r.current=!0},t),I.useEffect(()=>(n.current=!0,()=>{n.current=!1}),[])}const LV=I.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"}),o2=I.createContext({}),Nm=I.createContext(null),a2=typeof document<"u",HA=a2?I.useLayoutEffect:I.useEffect,FV=I.createContext({strict:!1});function V6e(e,t,n,r){const{visualElement:i}=I.useContext(o2),o=I.useContext(FV),a=I.useContext(Nm),s=I.useContext(LV).reducedMotion,l=I.useRef();r=r||o.renderer,!l.current&&r&&(l.current=r(e,{visualState:t,parent:i,props:n,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:s}));const u=l.current;I.useInsertionEffect(()=>{u&&u.update(n,a)});const c=I.useRef(!!window.HandoffAppearAnimations);return HA(()=>{u&&(u.render(),c.current&&u.animationState&&u.animationState.animateChanges())}),I.useEffect(()=>{u&&(u.updateFeatures(),!c.current&&u.animationState&&u.animationState.animateChanges(),window.HandoffAppearAnimations=void 0,c.current=!1)}),u}function fd(e){return typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function U6e(e,t,n){return I.useCallback(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n=="function"?n(r):fd(n)&&(n.current=r))},[t])}function Lg(e){return typeof e=="string"||Array.isArray(e)}function s2(e){return typeof e=="object"&&typeof e.start=="function"}const qA=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],WA=["initial",...qA];function l2(e){return s2(e.animate)||WA.some(t=>Lg(e[t]))}function BV(e){return!!(l2(e)||e.variants)}function G6e(e,t){if(l2(e)){const{initial:n,animate:r}=e;return{initial:n===!1||Lg(n)?n:void 0,animate:Lg(r)?r:void 0}}return e.inherit!==!1?t:{}}function H6e(e){const{initial:t,animate:n}=G6e(e,I.useContext(o2));return I.useMemo(()=>({initial:t,animate:n}),[cM(t),cM(n)])}function cM(e){return Array.isArray(e)?e.join(" "):e}const dM={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},Fg={};for(const e in dM)Fg[e]={isEnabled:t=>dM[e].some(n=>!!t[n])};function q6e(e){for(const t in e)Fg[t]={...Fg[t],...e[t]}}const KA=I.createContext({}),zV=I.createContext({}),W6e=Symbol.for("motionComponentSymbol");function K6e({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&q6e(e);function o(s,l){let u;const c={...I.useContext(LV),...s,layoutId:X6e(s)},{isStatic:d}=c,f=H6e(s),h=r(s,d);if(!d&&a2){f.visualElement=V6e(i,h,c,t);const p=I.useContext(zV),m=I.useContext(FV).strict;f.visualElement&&(u=f.visualElement.loadFeatures(c,m,e,p))}return I.createElement(o2.Provider,{value:f},u&&f.visualElement?I.createElement(u,{visualElement:f.visualElement,...c}):null,n(i,s,U6e(h,f.visualElement,l),h,d,f.visualElement))}const a=I.forwardRef(o);return a[W6e]=i,a}function X6e({layoutId:e}){const t=I.useContext(KA).id;return t&&e!==void 0?t+"-"+e:e}function Q6e(e){function t(r,i={}){return K6e(e(r,i))}if(typeof Proxy>"u")return t;const n=new Map;return new Proxy(t,{get:(r,i)=>(n.has(i)||n.set(i,t(i)),n.get(i))})}const Y6e=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function XA(e){return typeof e!="string"||e.includes("-")?!1:!!(Y6e.indexOf(e)>-1||/[A-Z]/.test(e))}const Q1={};function Z6e(e){Object.assign(Q1,e)}const Dm=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],mc=new Set(Dm);function jV(e,{layout:t,layoutId:n}){return mc.has(e)||e.startsWith("origin")||(t||n!==void 0)&&(!!Q1[e]||e==="opacity")}const ai=e=>!!(e&&e.getVelocity),J6e={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},e8e=Dm.length;function t8e(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let o="";for(let a=0;at=>typeof t=="string"&&t.startsWith(e),UV=VV("--"),f3=VV("var(--"),n8e=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,r8e=(e,t)=>t&&typeof e=="number"?t.transform(e):e,Ol=(e,t,n)=>Math.min(Math.max(n,e),t),yc={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},gp={...yc,transform:e=>Ol(0,1,e)},ry={...yc,default:1},mp=e=>Math.round(e*1e5)/1e5,u2=/(-)?([\d]*\.?[\d])+/g,GV=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,i8e=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function Lm(e){return typeof e=="string"}const Fm=e=>({test:t=>Lm(t)&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),js=Fm("deg"),ba=Fm("%"),Ie=Fm("px"),o8e=Fm("vh"),a8e=Fm("vw"),fM={...ba,parse:e=>ba.parse(e)/100,transform:e=>ba.transform(e*100)},hM={...yc,transform:Math.round},HV={borderWidth:Ie,borderTopWidth:Ie,borderRightWidth:Ie,borderBottomWidth:Ie,borderLeftWidth:Ie,borderRadius:Ie,radius:Ie,borderTopLeftRadius:Ie,borderTopRightRadius:Ie,borderBottomRightRadius:Ie,borderBottomLeftRadius:Ie,width:Ie,maxWidth:Ie,height:Ie,maxHeight:Ie,size:Ie,top:Ie,right:Ie,bottom:Ie,left:Ie,padding:Ie,paddingTop:Ie,paddingRight:Ie,paddingBottom:Ie,paddingLeft:Ie,margin:Ie,marginTop:Ie,marginRight:Ie,marginBottom:Ie,marginLeft:Ie,rotate:js,rotateX:js,rotateY:js,rotateZ:js,scale:ry,scaleX:ry,scaleY:ry,scaleZ:ry,skew:js,skewX:js,skewY:js,distance:Ie,translateX:Ie,translateY:Ie,translateZ:Ie,x:Ie,y:Ie,z:Ie,perspective:Ie,transformPerspective:Ie,opacity:gp,originX:fM,originY:fM,originZ:Ie,zIndex:hM,fillOpacity:gp,strokeOpacity:gp,numOctaves:hM};function QA(e,t,n,r){const{style:i,vars:o,transform:a,transformOrigin:s}=e;let l=!1,u=!1,c=!0;for(const d in t){const f=t[d];if(UV(d)){o[d]=f;continue}const h=HV[d],p=r8e(f,h);if(mc.has(d)){if(l=!0,a[d]=p,!c)continue;f!==(h.default||0)&&(c=!1)}else d.startsWith("origin")?(u=!0,s[d]=p):i[d]=p}if(t.transform||(l||r?i.transform=t8e(e.transform,n,c,r):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:f="50%",originZ:h=0}=s;i.transformOrigin=`${d} ${f} ${h}`}}const YA=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function qV(e,t,n){for(const r in t)!ai(t[r])&&!jV(r,n)&&(e[r]=t[r])}function s8e({transformTemplate:e},t,n){return I.useMemo(()=>{const r=YA();return QA(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function l8e(e,t,n){const r=e.style||{},i={};return qV(i,r,e),Object.assign(i,s8e(e,t,n)),e.transformValues?e.transformValues(i):i}function u8e(e,t,n){const r={},i=l8e(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}const c8e=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","transformValues","custom","inherit","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","ignoreStrict","viewport"]);function Y1(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||c8e.has(e)}let WV=e=>!Y1(e);function d8e(e){e&&(WV=t=>t.startsWith("on")?!Y1(t):e(t))}try{d8e(require("@emotion/is-prop-valid").default)}catch{}function f8e(e,t,n){const r={};for(const i in e)i==="values"&&typeof e.values=="object"||(WV(i)||n===!0&&Y1(i)||!t&&!Y1(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}function pM(e,t,n){return typeof e=="string"?e:Ie.transform(t+n*e)}function h8e(e,t,n){const r=pM(t,e.x,e.width),i=pM(n,e.y,e.height);return`${r} ${i}`}const p8e={offset:"stroke-dashoffset",array:"stroke-dasharray"},g8e={offset:"strokeDashoffset",array:"strokeDasharray"};function m8e(e,t,n=1,r=0,i=!0){e.pathLength=1;const o=i?p8e:g8e;e[o.offset]=Ie.transform(-r);const a=Ie.transform(t),s=Ie.transform(n);e[o.array]=`${a} ${s}`}function ZA(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:o,pathLength:a,pathSpacing:s=1,pathOffset:l=0,...u},c,d,f){if(QA(e,u,c,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:h,style:p,dimensions:m}=e;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(i!==void 0||o!==void 0||p.transform)&&(p.transformOrigin=h8e(m,i!==void 0?i:.5,o!==void 0?o:.5)),t!==void 0&&(h.x=t),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),a!==void 0&&m8e(h,a,s,l,!1)}const KV=()=>({...YA(),attrs:{}}),JA=e=>typeof e=="string"&&e.toLowerCase()==="svg";function y8e(e,t,n,r){const i=I.useMemo(()=>{const o=KV();return ZA(o,t,{enableHardwareAcceleration:!1},JA(r),e.transformTemplate),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};qV(o,e.style,e),i.style={...o,...i.style}}return i}function v8e(e=!1){return(n,r,i,{latestValues:o},a)=>{const l=(XA(n)?y8e:u8e)(r,o,a,n),c={...f8e(r,typeof n=="string",e),...l,ref:i},{children:d}=r,f=I.useMemo(()=>ai(d)?d.get():d,[d]);return I.createElement(n,{...c,children:f})}}const eT=e=>e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();function XV(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(const o in n)e.style.setProperty(o,n[o])}const QV=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function YV(e,t,n,r){XV(e,t,void 0,r);for(const i in t.attrs)e.setAttribute(QV.has(i)?i:eT(i),t.attrs[i])}function tT(e,t){const{style:n}=e,r={};for(const i in n)(ai(n[i])||t.style&&ai(t.style[i])||jV(i,e))&&(r[i]=n[i]);return r}function ZV(e,t){const n=tT(e,t);for(const r in e)if(ai(e[r])||ai(t[r])){const i=Dm.indexOf(r)!==-1?"attr"+r.charAt(0).toUpperCase()+r.substring(1):r;n[i]=e[r]}return n}function nT(e,t,n,r={},i={}){return typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"&&(t=t(n!==void 0?n:e.custom,r,i)),t}function JV(e){const t=I.useRef(null);return t.current===null&&(t.current=e()),t.current}const Z1=e=>Array.isArray(e),b8e=e=>!!(e&&typeof e=="object"&&e.mix&&e.toValue),_8e=e=>Z1(e)?e[e.length-1]||0:e;function av(e){const t=ai(e)?e.get():e;return b8e(t)?t.toValue():t}function S8e({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,o){const a={latestValues:x8e(r,i,o,e),renderState:t()};return n&&(a.mount=s=>n(r,s,a)),a}const eU=e=>(t,n)=>{const r=I.useContext(o2),i=I.useContext(Nm),o=()=>S8e(e,t,r,i);return n?o():JV(o)};function x8e(e,t,n,r){const i={},o=r(e,{});for(const f in o)i[f]=av(o[f]);let{initial:a,animate:s}=e;const l=l2(e),u=BV(e);t&&u&&!l&&e.inherit!==!1&&(a===void 0&&(a=t.initial),s===void 0&&(s=t.animate));let c=n?n.initial===!1:!1;c=c||a===!1;const d=c?s:a;return d&&typeof d!="boolean"&&!s2(d)&&(Array.isArray(d)?d:[d]).forEach(h=>{const p=nT(e,h);if(!p)return;const{transitionEnd:m,transition:_,...v}=p;for(const y in v){let g=v[y];if(Array.isArray(g)){const b=c?g.length-1:0;g=g[b]}g!==null&&(i[y]=g)}for(const y in m)i[y]=m[y]}),i}const un=e=>e;function w8e(e){let t=[],n=[],r=0,i=!1,o=!1;const a=new WeakSet,s={schedule:(l,u=!1,c=!1)=>{const d=c&&i,f=d?t:n;return u&&a.add(l),f.indexOf(l)===-1&&(f.push(l),d&&i&&(r=t.length)),l},cancel:l=>{const u=n.indexOf(l);u!==-1&&n.splice(u,1),a.delete(l)},process:l=>{if(i){o=!0;return}if(i=!0,[t,n]=[n,t],n.length=0,r=t.length,r)for(let u=0;u(d[f]=w8e(()=>n=!0),d),{}),a=d=>o[d].process(i),s=()=>{const d=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(d-i.timestamp,C8e),1),i.timestamp=d,i.isProcessing=!0,iy.forEach(a),i.isProcessing=!1,n&&t&&(r=!1,e(s))},l=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:iy.reduce((d,f)=>{const h=o[f];return d[f]=(p,m=!1,_=!1)=>(n||l(),h.schedule(p,m,_)),d},{}),cancel:d=>iy.forEach(f=>o[f].cancel(d)),state:i,steps:o}}const{schedule:kt,cancel:vs,state:hr,steps:Aw}=E8e(typeof requestAnimationFrame<"u"?requestAnimationFrame:un,!0),A8e={useVisualState:eU({scrapeMotionValuesFromProps:ZV,createRenderState:KV,onMount:(e,t,{renderState:n,latestValues:r})=>{kt.read(()=>{try{n.dimensions=typeof t.getBBox=="function"?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),kt.render(()=>{ZA(n,r,{enableHardwareAcceleration:!1},JA(t.tagName),e.transformTemplate),YV(t,n)})}})},T8e={useVisualState:eU({scrapeMotionValuesFromProps:tT,createRenderState:YA})};function P8e(e,{forwardMotionProps:t=!1},n,r){return{...XA(e)?A8e:T8e,preloadedFeatures:n,useRender:v8e(t),createVisualElement:r,Component:e}}function es(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}const tU=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1;function c2(e,t="page"){return{point:{x:e[t+"X"],y:e[t+"Y"]}}}const k8e=e=>t=>tU(t)&&e(t,c2(t));function os(e,t,n,r){return es(e,t,k8e(n),r)}const I8e=(e,t)=>n=>t(e(n)),yl=(...e)=>e.reduce(I8e);function nU(e){let t=null;return()=>{const n=()=>{t=null};return t===null?(t=e,n):!1}}const gM=nU("dragHorizontal"),mM=nU("dragVertical");function rU(e){let t=!1;if(e==="y")t=mM();else if(e==="x")t=gM();else{const n=gM(),r=mM();n&&r?t=()=>{n(),r()}:(n&&n(),r&&r())}return t}function iU(){const e=rU(!0);return e?(e(),!1):!0}class Ql{constructor(t){this.isMounted=!1,this.node=t}update(){}}function yM(e,t){const n="pointer"+(t?"enter":"leave"),r="onHover"+(t?"Start":"End"),i=(o,a)=>{if(o.type==="touch"||iU())return;const s=e.getProps();e.animationState&&s.whileHover&&e.animationState.setActive("whileHover",t),s[r]&&kt.update(()=>s[r](o,a))};return os(e.current,n,i,{passive:!e.getProps()[r]})}class M8e extends Ql{mount(){this.unmount=yl(yM(this.node,!0),yM(this.node,!1))}unmount(){}}class R8e extends Ql{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=yl(es(this.node.current,"focus",()=>this.onFocus()),es(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const oU=(e,t)=>t?e===t?!0:oU(e,t.parentElement):!1;function Tw(e,t){if(!t)return;const n=new PointerEvent("pointer"+e);t(n,c2(n))}class O8e extends Ql{constructor(){super(...arguments),this.removeStartListeners=un,this.removeEndListeners=un,this.removeAccessibleListeners=un,this.startPointerPress=(t,n)=>{if(this.removeEndListeners(),this.isPressing)return;const r=this.node.getProps(),o=os(window,"pointerup",(s,l)=>{if(!this.checkPressEnd())return;const{onTap:u,onTapCancel:c}=this.node.getProps();kt.update(()=>{oU(this.node.current,s.target)?u&&u(s,l):c&&c(s,l)})},{passive:!(r.onTap||r.onPointerUp)}),a=os(window,"pointercancel",(s,l)=>this.cancelPress(s,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=yl(o,a),this.startPress(t,n)},this.startAccessiblePress=()=>{const t=o=>{if(o.key!=="Enter"||this.isPressing)return;const a=s=>{s.key!=="Enter"||!this.checkPressEnd()||Tw("up",(l,u)=>{const{onTap:c}=this.node.getProps();c&&kt.update(()=>c(l,u))})};this.removeEndListeners(),this.removeEndListeners=es(this.node.current,"keyup",a),Tw("down",(s,l)=>{this.startPress(s,l)})},n=es(this.node.current,"keydown",t),r=()=>{this.isPressing&&Tw("cancel",(o,a)=>this.cancelPress(o,a))},i=es(this.node.current,"blur",r);this.removeAccessibleListeners=yl(n,i)}}startPress(t,n){this.isPressing=!0;const{onTapStart:r,whileTap:i}=this.node.getProps();i&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&kt.update(()=>r(t,n))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!iU()}cancelPress(t,n){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&kt.update(()=>r(t,n))}mount(){const t=this.node.getProps(),n=os(this.node.current,"pointerdown",this.startPointerPress,{passive:!(t.onTapStart||t.onPointerStart)}),r=es(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=yl(n,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const h3=new WeakMap,Pw=new WeakMap,$8e=e=>{const t=h3.get(e.target);t&&t(e)},N8e=e=>{e.forEach($8e)};function D8e({root:e,...t}){const n=e||document;Pw.has(n)||Pw.set(n,{});const r=Pw.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(N8e,{root:e,...t})),r[i]}function L8e(e,t,n){const r=D8e(t);return h3.set(e,n),r.observe(e),()=>{h3.delete(e),r.unobserve(e)}}const F8e={some:0,all:1};class B8e extends Ql{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:n,margin:r,amount:i="some",once:o}=t,a={root:n?n.current:void 0,rootMargin:r,threshold:typeof i=="number"?i:F8e[i]},s=l=>{const{isIntersecting:u}=l;if(this.isInView===u||(this.isInView=u,o&&!u&&this.hasEnteredView))return;u&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",u);const{onViewportEnter:c,onViewportLeave:d}=this.node.getProps(),f=u?c:d;f&&f(l)};return L8e(this.node.current,a,s)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:n}=this.node;["amount","margin","root"].some(z8e(t,n))&&this.startObserver()}unmount(){}}function z8e({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}const j8e={inView:{Feature:B8e},tap:{Feature:O8e},focus:{Feature:R8e},hover:{Feature:M8e}};function aU(e,t){if(!Array.isArray(t))return!1;const n=t.length;if(n!==e.length)return!1;for(let r=0;rt[r]=n.get()),t}function U8e(e){const t={};return e.values.forEach((n,r)=>t[r]=n.getVelocity()),t}function d2(e,t,n){const r=e.getProps();return nT(r,t,n!==void 0?n:r.custom,V8e(e),U8e(e))}const G8e="framerAppearId",H8e="data-"+eT(G8e);let q8e=un,rT=un;const vl=e=>e*1e3,as=e=>e/1e3,W8e={current:!1},sU=e=>Array.isArray(e)&&typeof e[0]=="number";function lU(e){return!!(!e||typeof e=="string"&&uU[e]||sU(e)||Array.isArray(e)&&e.every(lU))}const qh=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,uU={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:qh([0,.65,.55,1]),circOut:qh([.55,0,1,.45]),backIn:qh([.31,.01,.66,-.59]),backOut:qh([.33,1.53,.69,.99])};function cU(e){if(e)return sU(e)?qh(e):Array.isArray(e)?e.map(cU):uU[e]}function K8e(e,t,n,{delay:r=0,duration:i,repeat:o=0,repeatType:a="loop",ease:s,times:l}={}){const u={[t]:n};l&&(u.offset=l);const c=cU(s);return Array.isArray(c)&&(u.easing=c),e.animate(u,{delay:r,duration:i,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:a==="reverse"?"alternate":"normal"})}function X8e(e,{repeat:t,repeatType:n="loop"}){const r=t&&n!=="loop"&&t%2===1?0:e.length-1;return e[r]}const dU=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,Q8e=1e-7,Y8e=12;function Z8e(e,t,n,r,i){let o,a,s=0;do a=t+(n-t)/2,o=dU(a,r,i)-e,o>0?n=a:t=a;while(Math.abs(o)>Q8e&&++sZ8e(o,0,1,e,n);return o=>o===0||o===1?o:dU(i(o),t,r)}const J8e=Bm(.42,0,1,1),eIe=Bm(0,0,.58,1),fU=Bm(.42,0,.58,1),tIe=e=>Array.isArray(e)&&typeof e[0]!="number",hU=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,pU=e=>t=>1-e(1-t),gU=e=>1-Math.sin(Math.acos(e)),iT=pU(gU),nIe=hU(iT),mU=Bm(.33,1.53,.69,.99),oT=pU(mU),rIe=hU(oT),iIe=e=>(e*=2)<1?.5*oT(e):.5*(2-Math.pow(2,-10*(e-1))),oIe={linear:un,easeIn:J8e,easeInOut:fU,easeOut:eIe,circIn:gU,circInOut:nIe,circOut:iT,backIn:oT,backInOut:rIe,backOut:mU,anticipate:iIe},vM=e=>{if(Array.isArray(e)){rT(e.length===4);const[t,n,r,i]=e;return Bm(t,n,r,i)}else if(typeof e=="string")return oIe[e];return e},aT=(e,t)=>n=>!!(Lm(n)&&i8e.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),yU=(e,t,n)=>r=>{if(!Lm(r))return r;const[i,o,a,s]=r.match(u2);return{[e]:parseFloat(i),[t]:parseFloat(o),[n]:parseFloat(a),alpha:s!==void 0?parseFloat(s):1}},aIe=e=>Ol(0,255,e),kw={...yc,transform:e=>Math.round(aIe(e))},ku={test:aT("rgb","red"),parse:yU("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+kw.transform(e)+", "+kw.transform(t)+", "+kw.transform(n)+", "+mp(gp.transform(r))+")"};function sIe(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}const p3={test:aT("#"),parse:sIe,transform:ku.transform},hd={test:aT("hsl","hue"),parse:yU("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>"hsla("+Math.round(e)+", "+ba.transform(mp(t))+", "+ba.transform(mp(n))+", "+mp(gp.transform(r))+")"},Ir={test:e=>ku.test(e)||p3.test(e)||hd.test(e),parse:e=>ku.test(e)?ku.parse(e):hd.test(e)?hd.parse(e):p3.parse(e),transform:e=>Lm(e)?e:e.hasOwnProperty("red")?ku.transform(e):hd.transform(e)},Zt=(e,t,n)=>-n*e+n*t+e;function Iw(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function lIe({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,o=0,a=0;if(!t)i=o=a=n;else{const s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;i=Iw(l,s,e+1/3),o=Iw(l,s,e),a=Iw(l,s,e-1/3)}return{red:Math.round(i*255),green:Math.round(o*255),blue:Math.round(a*255),alpha:r}}const Mw=(e,t,n)=>{const r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},uIe=[p3,ku,hd],cIe=e=>uIe.find(t=>t.test(e));function bM(e){const t=cIe(e);let n=t.parse(e);return t===hd&&(n=lIe(n)),n}const vU=(e,t)=>{const n=bM(e),r=bM(t),i={...n};return o=>(i.red=Mw(n.red,r.red,o),i.green=Mw(n.green,r.green,o),i.blue=Mw(n.blue,r.blue,o),i.alpha=Zt(n.alpha,r.alpha,o),ku.transform(i))};function dIe(e){var t,n;return isNaN(e)&&Lm(e)&&(((t=e.match(u2))===null||t===void 0?void 0:t.length)||0)+(((n=e.match(GV))===null||n===void 0?void 0:n.length)||0)>0}const bU={regex:n8e,countKey:"Vars",token:"${v}",parse:un},_U={regex:GV,countKey:"Colors",token:"${c}",parse:Ir.parse},SU={regex:u2,countKey:"Numbers",token:"${n}",parse:yc.parse};function Rw(e,{regex:t,countKey:n,token:r,parse:i}){const o=e.tokenised.match(t);o&&(e["num"+n]=o.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...o.map(i)))}function J1(e){const t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes("var(--")&&Rw(n,bU),Rw(n,_U),Rw(n,SU),n}function xU(e){return J1(e).values}function wU(e){const{values:t,numColors:n,numVars:r,tokenised:i}=J1(e),o=t.length;return a=>{let s=i;for(let l=0;ltypeof e=="number"?0:e;function hIe(e){const t=xU(e);return wU(e)(t.map(fIe))}const $l={test:dIe,parse:xU,createTransformer:wU,getAnimatableNone:hIe},CU=(e,t)=>n=>`${n>0?t:e}`;function EU(e,t){return typeof e=="number"?n=>Zt(e,t,n):Ir.test(e)?vU(e,t):e.startsWith("var(")?CU(e,t):TU(e,t)}const AU=(e,t)=>{const n=[...e],r=n.length,i=e.map((o,a)=>EU(o,t[a]));return o=>{for(let a=0;a{const n={...e,...t},r={};for(const i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=EU(e[i],t[i]));return i=>{for(const o in r)n[o]=r[o](i);return n}},TU=(e,t)=>{const n=$l.createTransformer(t),r=J1(e),i=J1(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?yl(AU(r.values,i.values),n):CU(e,t)},Bg=(e,t,n)=>{const r=t-e;return r===0?1:(n-e)/r},_M=(e,t)=>n=>Zt(e,t,n);function gIe(e){return typeof e=="number"?_M:typeof e=="string"?Ir.test(e)?vU:TU:Array.isArray(e)?AU:typeof e=="object"?pIe:_M}function mIe(e,t,n){const r=[],i=n||gIe(e[0]),o=e.length-1;for(let a=0;at[0];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const a=mIe(t,r,i),s=a.length,l=u=>{let c=0;if(s>1)for(;cl(Ol(e[0],e[o-1],u)):l}function yIe(e,t){const n=e[e.length-1];for(let r=1;r<=t;r++){const i=Bg(0,t,r);e.push(Zt(n,1,i))}}function vIe(e){const t=[0];return yIe(t,e.length-1),t}function bIe(e,t){return e.map(n=>n*t)}function _Ie(e,t){return e.map(()=>t||fU).splice(0,e.length-1)}function eb({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){const i=tIe(r)?r.map(vM):vM(r),o={done:!1,value:t[0]},a=bIe(n&&n.length===t.length?n:vIe(t),e),s=PU(a,t,{ease:Array.isArray(i)?i:_Ie(t,i)});return{calculatedDuration:e,next:l=>(o.value=s(l),o.done=l>=e,o)}}function kU(e,t){return t?e*(1e3/t):0}const SIe=5;function IU(e,t,n){const r=Math.max(t-SIe,0);return kU(n-e(r),t-r)}const Ow=.001,xIe=.01,SM=10,wIe=.05,CIe=1;function EIe({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,o;q8e(e<=vl(SM));let a=1-t;a=Ol(wIe,CIe,a),e=Ol(xIe,SM,as(e)),a<1?(i=u=>{const c=u*a,d=c*e,f=c-n,h=g3(u,a),p=Math.exp(-d);return Ow-f/h*p},o=u=>{const d=u*a*e,f=d*n+n,h=Math.pow(a,2)*Math.pow(u,2)*e,p=Math.exp(-d),m=g3(Math.pow(u,2),a);return(-i(u)+Ow>0?-1:1)*((f-h)*p)/m}):(i=u=>{const c=Math.exp(-u*e),d=(u-n)*e+1;return-Ow+c*d},o=u=>{const c=Math.exp(-u*e),d=(n-u)*(e*e);return c*d});const s=5/e,l=TIe(i,o,s);if(e=vl(e),isNaN(l))return{stiffness:100,damping:10,duration:e};{const u=Math.pow(l,2)*r;return{stiffness:u,damping:a*2*Math.sqrt(r*u),duration:e}}}const AIe=12;function TIe(e,t,n){let r=n;for(let i=1;ie[n]!==void 0)}function IIe(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!xM(e,kIe)&&xM(e,PIe)){const n=EIe(e);t={...t,...n,velocity:0,mass:1},t.isResolvedFromDuration=!0}return t}function MU({keyframes:e,restDelta:t,restSpeed:n,...r}){const i=e[0],o=e[e.length-1],a={done:!1,value:i},{stiffness:s,damping:l,mass:u,velocity:c,duration:d,isResolvedFromDuration:f}=IIe(r),h=c?-as(c):0,p=l/(2*Math.sqrt(s*u)),m=o-i,_=as(Math.sqrt(s/u)),v=Math.abs(m)<5;n||(n=v?.01:2),t||(t=v?.005:.5);let y;if(p<1){const g=g3(_,p);y=b=>{const S=Math.exp(-p*_*b);return o-S*((h+p*_*m)/g*Math.sin(g*b)+m*Math.cos(g*b))}}else if(p===1)y=g=>o-Math.exp(-_*g)*(m+(h+_*m)*g);else{const g=_*Math.sqrt(p*p-1);y=b=>{const S=Math.exp(-p*_*b),x=Math.min(g*b,300);return o-S*((h+p*_*m)*Math.sinh(x)+g*m*Math.cosh(x))/g}}return{calculatedDuration:f&&d||null,next:g=>{const b=y(g);if(f)a.done=g>=d;else{let S=h;g!==0&&(p<1?S=IU(y,g,b):S=0);const x=Math.abs(S)<=n,w=Math.abs(o-b)<=t;a.done=x&&w}return a.value=a.done?o:b,a}}}function wM({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:o=500,modifyTarget:a,min:s,max:l,restDelta:u=.5,restSpeed:c}){const d=e[0],f={done:!1,value:d},h=C=>s!==void 0&&Cl,p=C=>s===void 0?l:l===void 0||Math.abs(s-C)-m*Math.exp(-C/r),g=C=>v+y(C),b=C=>{const T=y(C),A=g(C);f.done=Math.abs(T)<=u,f.value=f.done?v:A};let S,x;const w=C=>{h(f.value)&&(S=C,x=MU({keyframes:[f.value,p(f.value)],velocity:IU(g,C,f.value),damping:i,stiffness:o,restDelta:u,restSpeed:c}))};return w(0),{calculatedDuration:null,next:C=>{let T=!1;return!x&&S===void 0&&(T=!0,b(C),w(C)),S!==void 0&&C>S?x.next(C-S):(!T&&b(C),f)}}}const MIe=e=>{const t=({timestamp:n})=>e(n);return{start:()=>kt.update(t,!0),stop:()=>vs(t),now:()=>hr.isProcessing?hr.timestamp:performance.now()}},CM=2e4;function EM(e){let t=0;const n=50;let r=e.next(t);for(;!r.done&&t=CM?1/0:t}const RIe={decay:wM,inertia:wM,tween:eb,keyframes:eb,spring:MU};function tb({autoplay:e=!0,delay:t=0,driver:n=MIe,keyframes:r,type:i="keyframes",repeat:o=0,repeatDelay:a=0,repeatType:s="loop",onPlay:l,onStop:u,onComplete:c,onUpdate:d,...f}){let h=1,p=!1,m,_;const v=()=>{_=new Promise(z=>{m=z})};v();let y;const g=RIe[i]||eb;let b;g!==eb&&typeof r[0]!="number"&&(b=PU([0,100],r,{clamp:!1}),r=[0,100]);const S=g({...f,keyframes:r});let x;s==="mirror"&&(x=g({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let w="idle",C=null,T=null,A=null;S.calculatedDuration===null&&o&&(S.calculatedDuration=EM(S));const{calculatedDuration:k}=S;let D=1/0,M=1/0;k!==null&&(D=k+a,M=D*(o+1)-a);let E=0;const P=z=>{if(T===null)return;h>0&&(T=Math.min(T,z)),h<0&&(T=Math.min(z-M/h,T)),C!==null?E=C:E=Math.round(z-T)*h;const V=E-t*(h>=0?1:-1),H=h>=0?V<0:V>M;E=Math.max(V,0),w==="finished"&&C===null&&(E=M);let Q=E,Z=S;if(o){const ee=E/D;let ne=Math.floor(ee),fe=ee%1;!fe&&ee>=1&&(fe=1),fe===1&&ne--,ne=Math.min(ne,o+1);const ce=!!(ne%2);ce&&(s==="reverse"?(fe=1-fe,a&&(fe-=a/D)):s==="mirror"&&(Z=x));let Be=Ol(0,1,fe);E>M&&(Be=s==="reverse"&&ce?1:0),Q=Be*D}const J=H?{done:!1,value:r[0]}:Z.next(Q);b&&(J.value=b(J.value));let{done:j}=J;!H&&k!==null&&(j=h>=0?E>=M:E<=0);const X=C===null&&(w==="finished"||w==="running"&&j);return d&&d(J.value),X&&O(),J},N=()=>{y&&y.stop(),y=void 0},L=()=>{w="idle",N(),m(),v(),T=A=null},O=()=>{w="finished",c&&c(),N(),m()},R=()=>{if(p)return;y||(y=n(P));const z=y.now();l&&l(),C!==null?T=z-C:(!T||w==="finished")&&(T=z),w==="finished"&&v(),A=T,C=null,w="running",y.start()};e&&R();const $={then(z,V){return _.then(z,V)},get time(){return as(E)},set time(z){z=vl(z),E=z,C!==null||!y||h===0?C=z:T=y.now()-z/h},get duration(){const z=S.calculatedDuration===null?EM(S):S.calculatedDuration;return as(z)},get speed(){return h},set speed(z){z===h||!y||(h=z,$.time=as(E))},get state(){return w},play:R,pause:()=>{w="paused",C=E},stop:()=>{p=!0,w!=="idle"&&(w="idle",u&&u(),L())},cancel:()=>{A!==null&&P(A),L()},complete:()=>{w="finished"},sample:z=>(T=0,P(z))};return $}function OIe(e){let t;return()=>(t===void 0&&(t=e()),t)}const $Ie=OIe(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),NIe=new Set(["opacity","clipPath","filter","transform","backgroundColor"]),oy=10,DIe=2e4,LIe=(e,t)=>t.type==="spring"||e==="backgroundColor"||!lU(t.ease);function FIe(e,t,{onUpdate:n,onComplete:r,...i}){if(!($Ie()&&NIe.has(t)&&!i.repeatDelay&&i.repeatType!=="mirror"&&i.damping!==0&&i.type!=="inertia"))return!1;let a=!1,s,l;const u=()=>{l=new Promise(y=>{s=y})};u();let{keyframes:c,duration:d=300,ease:f,times:h}=i;if(LIe(t,i)){const y=tb({...i,repeat:0,delay:0});let g={done:!1,value:c[0]};const b=[];let S=0;for(;!g.done&&Sp.cancel(),_=()=>{kt.update(m),s(),u()};return p.onfinish=()=>{e.set(X8e(c,i)),r&&r(),_()},{then(y,g){return l.then(y,g)},attachTimeline(y){return p.timeline=y,p.onfinish=null,un},get time(){return as(p.currentTime||0)},set time(y){p.currentTime=vl(y)},get speed(){return p.playbackRate},set speed(y){p.playbackRate=y},get duration(){return as(d)},play:()=>{a||(p.play(),vs(m))},pause:()=>p.pause(),stop:()=>{if(a=!0,p.playState==="idle")return;const{currentTime:y}=p;if(y){const g=tb({...i,autoplay:!1});e.setWithVelocity(g.sample(y-oy).value,g.sample(y).value,oy)}_()},complete:()=>p.finish(),cancel:_}}function BIe({keyframes:e,delay:t,onUpdate:n,onComplete:r}){const i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:un,pause:un,stop:un,then:o=>(o(),Promise.resolve()),cancel:un,complete:un});return t?tb({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}const zIe={type:"spring",stiffness:500,damping:25,restSpeed:10},jIe=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),VIe={type:"keyframes",duration:.8},UIe={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},GIe=(e,{keyframes:t})=>t.length>2?VIe:mc.has(e)?e.startsWith("scale")?jIe(t[1]):zIe:UIe,m3=(e,t)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&($l.test(t)||t==="0")&&!t.startsWith("url(")),HIe=new Set(["brightness","contrast","saturate","opacity"]);function qIe(e){const[t,n]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[r]=n.match(u2)||[];if(!r)return e;const i=n.replace(r,"");let o=HIe.has(t)?1:0;return r!==n&&(o*=100),t+"("+o+i+")"}const WIe=/([a-z-]*)\(.*?\)/g,y3={...$l,getAnimatableNone:e=>{const t=e.match(WIe);return t?t.map(qIe).join(" "):e}},KIe={...HV,color:Ir,backgroundColor:Ir,outlineColor:Ir,fill:Ir,stroke:Ir,borderColor:Ir,borderTopColor:Ir,borderRightColor:Ir,borderBottomColor:Ir,borderLeftColor:Ir,filter:y3,WebkitFilter:y3},sT=e=>KIe[e];function RU(e,t){let n=sT(e);return n!==y3&&(n=$l),n.getAnimatableNone?n.getAnimatableNone(t):void 0}const OU=e=>/^0[^.\s]+$/.test(e);function XIe(e){if(typeof e=="number")return e===0;if(e!==null)return e==="none"||e==="0"||OU(e)}function QIe(e,t,n,r){const i=m3(t,n);let o;Array.isArray(n)?o=[...n]:o=[null,n];const a=r.from!==void 0?r.from:e.get();let s;const l=[];for(let u=0;ui=>{const o=$U(r,e)||{},a=o.delay||r.delay||0;let{elapsed:s=0}=r;s=s-vl(a);const l=QIe(t,e,n,o),u=l[0],c=l[l.length-1],d=m3(e,u),f=m3(e,c);let h={keyframes:l,velocity:t.getVelocity(),ease:"easeOut",...o,delay:-s,onUpdate:p=>{t.set(p),o.onUpdate&&o.onUpdate(p)},onComplete:()=>{i(),o.onComplete&&o.onComplete()}};if(YIe(o)||(h={...h,...GIe(e,h)}),h.duration&&(h.duration=vl(h.duration)),h.repeatDelay&&(h.repeatDelay=vl(h.repeatDelay)),!d||!f||W8e.current||o.type===!1)return BIe(h);if(t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){const p=FIe(t,e,h);if(p)return p}return tb(h)};function nb(e){return!!(ai(e)&&e.add)}const NU=e=>/^\-?\d*\.?\d+$/.test(e);function uT(e,t){e.indexOf(t)===-1&&e.push(t)}function cT(e,t){const n=e.indexOf(t);n>-1&&e.splice(n,1)}class dT{constructor(){this.subscriptions=[]}add(t){return uT(this.subscriptions,t),()=>cT(this.subscriptions,t)}notify(t,n,r){const i=this.subscriptions.length;if(i)if(i===1)this.subscriptions[0](t,n,r);else for(let o=0;o!isNaN(parseFloat(e));class JIe{constructor(t,n={}){this.version="10.16.1",this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(r,i=!0)=>{this.prev=this.current,this.current=r;const{delta:o,timestamp:a}=hr;this.lastUpdated!==a&&(this.timeDelta=o,this.lastUpdated=a,kt.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),i&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>kt.postRender(this.velocityCheck),this.velocityCheck=({timestamp:r})=>{r!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=t,this.canTrackVelocity=ZIe(this.current),this.owner=n.owner}onChange(t){return this.on("change",t)}on(t,n){this.events[t]||(this.events[t]=new dT);const r=this.events[t].add(n);return t==="change"?()=>{r(),kt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,n){this.passiveEffect=t,this.stopPassiveEffect=n}set(t,n=!0){!n||!this.passiveEffect?this.updateAndNotify(t,n):this.passiveEffect(t,this.updateAndNotify)}setWithVelocity(t,n,r){this.set(n),this.prev=t,this.timeDelta=r}jump(t){this.updateAndNotify(t),this.prev=t,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?kU(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(t){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=t(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function wf(e,t){return new JIe(e,t)}const DU=e=>t=>t.test(e),e9e={test:e=>e==="auto",parse:e=>e},LU=[yc,Ie,ba,js,a8e,o8e,e9e],Ah=e=>LU.find(DU(e)),t9e=[...LU,Ir,$l],n9e=e=>t9e.find(DU(e));function r9e(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,wf(n))}function i9e(e,t){const n=d2(e,t);let{transitionEnd:r={},transition:i={},...o}=n?e.makeTargetAnimatable(n,!1):{};o={...o,...r};for(const a in o){const s=_8e(o[a]);r9e(e,a,s)}}function o9e(e,t,n){var r,i;const o=Object.keys(t).filter(s=>!e.hasValue(s)),a=o.length;if(a)for(let s=0;sl.remove(d))),u.push(m)}return a&&Promise.all(u).then(()=>{a&&i9e(e,a)}),u}function v3(e,t,n={}){const r=d2(e,t,n.custom);let{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);const o=r?()=>Promise.all(FU(e,r,n)):()=>Promise.resolve(),a=e.variantChildren&&e.variantChildren.size?(l=0)=>{const{delayChildren:u=0,staggerChildren:c,staggerDirection:d}=i;return u9e(e,t,u+l,c,d,n)}:()=>Promise.resolve(),{when:s}=i;if(s){const[l,u]=s==="beforeChildren"?[o,a]:[a,o];return l().then(()=>u())}else return Promise.all([o(),a(n.delay)])}function u9e(e,t,n=0,r=0,i=1,o){const a=[],s=(e.variantChildren.size-1)*r,l=i===1?(u=0)=>u*r:(u=0)=>s-u*r;return Array.from(e.variantChildren).sort(c9e).forEach((u,c)=>{u.notify("AnimationStart",t),a.push(v3(u,t,{...o,delay:n+l(c)}).then(()=>u.notify("AnimationComplete",t)))}),Promise.all(a)}function c9e(e,t){return e.sortNodePosition(t)}function d9e(e,t,n={}){e.notify("AnimationStart",t);let r;if(Array.isArray(t)){const i=t.map(o=>v3(e,o,n));r=Promise.all(i)}else if(typeof t=="string")r=v3(e,t,n);else{const i=typeof t=="function"?d2(e,t,n.custom):t;r=Promise.all(FU(e,i,n))}return r.then(()=>e.notify("AnimationComplete",t))}const f9e=[...qA].reverse(),h9e=qA.length;function p9e(e){return t=>Promise.all(t.map(({animation:n,options:r})=>d9e(e,n,r)))}function g9e(e){let t=p9e(e);const n=y9e();let r=!0;const i=(l,u)=>{const c=d2(e,u);if(c){const{transition:d,transitionEnd:f,...h}=c;l={...l,...h,...f}}return l};function o(l){t=l(e)}function a(l,u){const c=e.getProps(),d=e.getVariantContext(!0)||{},f=[],h=new Set;let p={},m=1/0;for(let v=0;vm&&S;const A=Array.isArray(b)?b:[b];let k=A.reduce(i,{});x===!1&&(k={});const{prevResolvedValues:D={}}=g,M={...D,...k},E=P=>{T=!0,h.delete(P),g.needsAnimating[P]=!0};for(const P in M){const N=k[P],L=D[P];p.hasOwnProperty(P)||(N!==L?Z1(N)&&Z1(L)?!aU(N,L)||C?E(P):g.protectedKeys[P]=!0:N!==void 0?E(P):h.add(P):N!==void 0&&h.has(P)?E(P):g.protectedKeys[P]=!0)}g.prevProp=b,g.prevResolvedValues=k,g.isActive&&(p={...p,...k}),r&&e.blockInitialAnimation&&(T=!1),T&&!w&&f.push(...A.map(P=>({animation:P,options:{type:y,...l}})))}if(h.size){const v={};h.forEach(y=>{const g=e.getBaseTarget(y);g!==void 0&&(v[y]=g)}),f.push({animation:v})}let _=!!f.length;return r&&c.initial===!1&&!e.manuallyAnimateOnMount&&(_=!1),r=!1,_?t(f):Promise.resolve()}function s(l,u,c){var d;if(n[l].isActive===u)return Promise.resolve();(d=e.variantChildren)===null||d===void 0||d.forEach(h=>{var p;return(p=h.animationState)===null||p===void 0?void 0:p.setActive(l,u)}),n[l].isActive=u;const f=a(c,l);for(const h in n)n[h].protectedKeys={};return f}return{animateChanges:a,setActive:s,setAnimateFunction:o,getState:()=>n}}function m9e(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!aU(t,e):!1}function lu(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function y9e(){return{animate:lu(!0),whileInView:lu(),whileHover:lu(),whileTap:lu(),whileDrag:lu(),whileFocus:lu(),exit:lu()}}class v9e extends Ql{constructor(t){super(t),t.animationState||(t.animationState=g9e(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();this.unmount(),s2(t)&&(this.unmount=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:n}=this.node.prevProps||{};t!==n&&this.updateAnimationControlsSubscription()}unmount(){}}let b9e=0;class _9e extends Ql{constructor(){super(...arguments),this.id=b9e++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:n,custom:r}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;const o=this.node.animationState.setActive("exit",!t,{custom:r??this.node.getProps().custom});n&&!t&&o.then(()=>n(this.id))}mount(){const{register:t}=this.node.presenceContext||{};t&&(this.unmount=t(this.id))}unmount(){}}const S9e={animation:{Feature:v9e},exit:{Feature:_9e}},AM=(e,t)=>Math.abs(e-t);function x9e(e,t){const n=AM(e.x,t.x),r=AM(e.y,t.y);return Math.sqrt(n**2+r**2)}class BU{constructor(t,n,{transformPagePoint:r}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const u=Nw(this.lastMoveEventInfo,this.history),c=this.startEvent!==null,d=x9e(u.offset,{x:0,y:0})>=3;if(!c&&!d)return;const{point:f}=u,{timestamp:h}=hr;this.history.push({...f,timestamp:h});const{onStart:p,onMove:m}=this.handlers;c||(p&&p(this.lastMoveEvent,u),this.startEvent=this.lastMoveEvent),m&&m(this.lastMoveEvent,u)},this.handlePointerMove=(u,c)=>{this.lastMoveEvent=u,this.lastMoveEventInfo=$w(c,this.transformPagePoint),kt.update(this.updatePoint,!0)},this.handlePointerUp=(u,c)=>{if(this.end(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const{onEnd:d,onSessionEnd:f}=this.handlers,h=Nw(u.type==="pointercancel"?this.lastMoveEventInfo:$w(c,this.transformPagePoint),this.history);this.startEvent&&d&&d(u,h),f&&f(u,h)},!tU(t))return;this.handlers=n,this.transformPagePoint=r;const i=c2(t),o=$w(i,this.transformPagePoint),{point:a}=o,{timestamp:s}=hr;this.history=[{...a,timestamp:s}];const{onSessionStart:l}=n;l&&l(t,Nw(o,this.history)),this.removeListeners=yl(os(window,"pointermove",this.handlePointerMove),os(window,"pointerup",this.handlePointerUp),os(window,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),vs(this.updatePoint)}}function $w(e,t){return t?{point:t(e.point)}:e}function TM(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Nw({point:e},t){return{point:e,delta:TM(e,zU(t)),offset:TM(e,w9e(t)),velocity:C9e(t,.1)}}function w9e(e){return e[0]}function zU(e){return e[e.length-1]}function C9e(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null;const i=zU(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>vl(t)));)n--;if(!r)return{x:0,y:0};const o=as(i.timestamp-r.timestamp);if(o===0)return{x:0,y:0};const a={x:(i.x-r.x)/o,y:(i.y-r.y)/o};return a.x===1/0&&(a.x=0),a.y===1/0&&(a.y=0),a}function xi(e){return e.max-e.min}function b3(e,t=0,n=.01){return Math.abs(e-t)<=n}function PM(e,t,n,r=.5){e.origin=r,e.originPoint=Zt(t.min,t.max,e.origin),e.scale=xi(n)/xi(t),(b3(e.scale,1,1e-4)||isNaN(e.scale))&&(e.scale=1),e.translate=Zt(n.min,n.max,e.origin)-e.originPoint,(b3(e.translate)||isNaN(e.translate))&&(e.translate=0)}function yp(e,t,n,r){PM(e.x,t.x,n.x,r?r.originX:void 0),PM(e.y,t.y,n.y,r?r.originY:void 0)}function kM(e,t,n){e.min=n.min+t.min,e.max=e.min+xi(t)}function E9e(e,t,n){kM(e.x,t.x,n.x),kM(e.y,t.y,n.y)}function IM(e,t,n){e.min=t.min-n.min,e.max=e.min+xi(t)}function vp(e,t,n){IM(e.x,t.x,n.x),IM(e.y,t.y,n.y)}function A9e(e,{min:t,max:n},r){return t!==void 0&&en&&(e=r?Zt(n,e,r.max):Math.min(e,n)),e}function MM(e,t,n){return{min:t!==void 0?e.min+t:void 0,max:n!==void 0?e.max+n-(e.max-e.min):void 0}}function T9e(e,{top:t,left:n,bottom:r,right:i}){return{x:MM(e.x,n,i),y:MM(e.y,t,r)}}function RM(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.minr?n=Bg(t.min,t.max-r,e.min):r>i&&(n=Bg(e.min,e.max-i,t.min)),Ol(0,1,n)}function I9e(e,t){const n={};return t.min!==void 0&&(n.min=t.min-e.min),t.max!==void 0&&(n.max=t.max-e.min),n}const _3=.35;function M9e(e=_3){return e===!1?e=0:e===!0&&(e=_3),{x:OM(e,"left","right"),y:OM(e,"top","bottom")}}function OM(e,t,n){return{min:$M(e,t),max:$M(e,n)}}function $M(e,t){return typeof e=="number"?e:e[t]||0}const NM=()=>({translate:0,scale:1,origin:0,originPoint:0}),pd=()=>({x:NM(),y:NM()}),DM=()=>({min:0,max:0}),_n=()=>({x:DM(),y:DM()});function Qo(e){return[e("x"),e("y")]}function jU({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function R9e({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function O9e(e,t){if(!t)return e;const n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Dw(e){return e===void 0||e===1}function S3({scale:e,scaleX:t,scaleY:n}){return!Dw(e)||!Dw(t)||!Dw(n)}function pu(e){return S3(e)||VU(e)||e.z||e.rotate||e.rotateX||e.rotateY}function VU(e){return LM(e.x)||LM(e.y)}function LM(e){return e&&e!=="0%"}function rb(e,t,n){const r=e-n,i=t*r;return n+i}function FM(e,t,n,r,i){return i!==void 0&&(e=rb(e,i,r)),rb(e,n,r)+t}function x3(e,t=0,n=1,r,i){e.min=FM(e.min,t,n,r,i),e.max=FM(e.max,t,n,r,i)}function UU(e,{x:t,y:n}){x3(e.x,t.translate,t.scale,t.originPoint),x3(e.y,n.translate,n.scale,n.originPoint)}function $9e(e,t,n,r=!1){const i=n.length;if(!i)return;t.x=t.y=1;let o,a;for(let s=0;s1.0000000000001||e<.999999999999?e:1}function qs(e,t){e.min=e.min+t,e.max=e.max+t}function zM(e,t,[n,r,i]){const o=t[i]!==void 0?t[i]:.5,a=Zt(e.min,e.max,o);x3(e,t[n],t[r],a,t.scale)}const N9e=["x","scaleX","originX"],D9e=["y","scaleY","originY"];function gd(e,t){zM(e.x,t,N9e),zM(e.y,t,D9e)}function GU(e,t){return jU(O9e(e.getBoundingClientRect(),t))}function L9e(e,t,n){const r=GU(e,n),{scroll:i}=t;return i&&(qs(r.x,i.offset.x),qs(r.y,i.offset.y)),r}const F9e=new WeakMap;class B9e{constructor(t){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=_n(),this.visualElement=t}start(t,{snapToCursor:n=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const i=l=>{this.stopAnimation(),n&&this.snapToCursor(c2(l,"page").point)},o=(l,u)=>{const{drag:c,dragPropagation:d,onDragStart:f}=this.getProps();if(c&&!d&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=rU(c),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qo(p=>{let m=this.getAxisMotionValue(p).get()||0;if(ba.test(m)){const{projection:_}=this.visualElement;if(_&&_.layout){const v=_.layout.layoutBox[p];v&&(m=xi(v)*(parseFloat(m)/100))}}this.originPoint[p]=m}),f&&kt.update(()=>f(l,u),!1,!0);const{animationState:h}=this.visualElement;h&&h.setActive("whileDrag",!0)},a=(l,u)=>{const{dragPropagation:c,dragDirectionLock:d,onDirectionLock:f,onDrag:h}=this.getProps();if(!c&&!this.openGlobalLock)return;const{offset:p}=u;if(d&&this.currentDirection===null){this.currentDirection=z9e(p),this.currentDirection!==null&&f&&f(this.currentDirection);return}this.updateAxis("x",u.point,p),this.updateAxis("y",u.point,p),this.visualElement.render(),h&&h(l,u)},s=(l,u)=>this.stop(l,u);this.panSession=new BU(t,{onSessionStart:i,onStart:o,onMove:a,onSessionEnd:s},{transformPagePoint:this.visualElement.getTransformPagePoint()})}stop(t,n){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:i}=n;this.startAnimation(i);const{onDragEnd:o}=this.getProps();o&&kt.update(()=>o(t,n))}cancel(){this.isDragging=!1;const{projection:t,animationState:n}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(t,n,r){const{drag:i}=this.getProps();if(!r||!ay(t,i,this.currentDirection))return;const o=this.getAxisMotionValue(t);let a=this.originPoint[t]+r[t];this.constraints&&this.constraints[t]&&(a=A9e(a,this.constraints[t],this.elastic[t])),o.set(a)}resolveConstraints(){const{dragConstraints:t,dragElastic:n}=this.getProps(),{layout:r}=this.visualElement.projection||{},i=this.constraints;t&&fd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=T9e(r.layoutBox,t):this.constraints=!1,this.elastic=M9e(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Qo(o=>{this.getAxisMotionValue(o)&&(this.constraints[o]=I9e(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!fd(t))return!1;const r=t.current,{projection:i}=this.visualElement;if(!i||!i.layout)return!1;const o=L9e(r,i.root,this.visualElement.getTransformPagePoint());let a=P9e(i.layout.layoutBox,o);if(n){const s=n(R9e(a));this.hasMutatedConstraints=!!s,s&&(a=jU(s))}return a}startAnimation(t){const{drag:n,dragMomentum:r,dragElastic:i,dragTransition:o,dragSnapToOrigin:a,onDragTransitionEnd:s}=this.getProps(),l=this.constraints||{},u=Qo(c=>{if(!ay(c,n,this.currentDirection))return;let d=l&&l[c]||{};a&&(d={min:0,max:0});const f=i?200:1e6,h=i?40:1e7,p={type:"inertia",velocity:r?t[c]:0,bounceStiffness:f,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...d};return this.startAxisValueAnimation(c,p)});return Promise.all(u).then(s)}startAxisValueAnimation(t,n){const r=this.getAxisMotionValue(t);return r.start(lT(t,r,0,n))}stopAnimation(){Qo(t=>this.getAxisMotionValue(t).stop())}getAxisMotionValue(t){const n="_drag"+t.toUpperCase(),r=this.visualElement.getProps(),i=r[n];return i||this.visualElement.getValue(t,(r.initial?r.initial[t]:void 0)||0)}snapToCursor(t){Qo(n=>{const{drag:r}=this.getProps();if(!ay(n,r,this.currentDirection))return;const{projection:i}=this.visualElement,o=this.getAxisMotionValue(n);if(i&&i.layout){const{min:a,max:s}=i.layout.layoutBox[n];o.set(t[n]-Zt(a,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!fd(n)||!r||!this.constraints)return;this.stopAnimation();const i={x:0,y:0};Qo(a=>{const s=this.getAxisMotionValue(a);if(s){const l=s.get();i[a]=k9e({min:l,max:l},this.constraints[a])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Qo(a=>{if(!ay(a,t,null))return;const s=this.getAxisMotionValue(a),{min:l,max:u}=this.constraints[a];s.set(Zt(l,u,i[a]))})}addListeners(){if(!this.visualElement.current)return;F9e.set(this.visualElement,this);const t=this.visualElement.current,n=os(t,"pointerdown",l=>{const{drag:u,dragListener:c=!0}=this.getProps();u&&c&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();fd(l)&&(this.constraints=this.resolveRefConstraints())},{projection:i}=this.visualElement,o=i.addEventListener("measure",r);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),r();const a=es(window,"resize",()=>this.scalePositionWithinConstraints()),s=i.addEventListener("didUpdate",({delta:l,hasLayoutChanged:u})=>{this.isDragging&&u&&(Qo(c=>{const d=this.getAxisMotionValue(c);d&&(this.originPoint[c]+=l[c].translate,d.set(d.get()+l[c].translate))}),this.visualElement.render())});return()=>{a(),n(),o(),s&&s()}}getProps(){const t=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:i=!1,dragConstraints:o=!1,dragElastic:a=_3,dragMomentum:s=!0}=t;return{...t,drag:n,dragDirectionLock:r,dragPropagation:i,dragConstraints:o,dragElastic:a,dragMomentum:s}}}function ay(e,t,n){return(t===!0||t===e)&&(n===null||n===e)}function z9e(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}class j9e extends Ql{constructor(t){super(t),this.removeGroupControls=un,this.removeListeners=un,this.controls=new B9e(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||un}unmount(){this.removeGroupControls(),this.removeListeners()}}const jM=e=>(t,n)=>{e&&kt.update(()=>e(t,n))};class V9e extends Ql{constructor(){super(...arguments),this.removePointerDownListener=un}onPointerDown(t){this.session=new BU(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint()})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:n,onPan:r,onPanEnd:i}=this.node.getProps();return{onSessionStart:jM(t),onStart:jM(n),onMove:r,onEnd:(o,a)=>{delete this.session,i&&kt.update(()=>i(o,a))}}}mount(){this.removePointerDownListener=os(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function U9e(){const e=I.useContext(Nm);if(e===null)return[!0,null];const{isPresent:t,onExitComplete:n,register:r}=e,i=I.useId();return I.useEffect(()=>r(i),[]),!t&&n?[!1,()=>n&&n(i)]:[!0]}function G9e(){return H9e(I.useContext(Nm))}function H9e(e){return e===null?!0:e.isPresent}const sv={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function VM(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Th={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Ie.test(e))e=parseFloat(e);else return e;const n=VM(e,t.target.x),r=VM(e,t.target.y);return`${n}% ${r}%`}},q9e={correct:(e,{treeScale:t,projectionDelta:n})=>{const r=e,i=$l.parse(e);if(i.length>5)return r;const o=$l.createTransformer(e),a=typeof i[0]!="number"?1:0,s=n.x.scale*t.x,l=n.y.scale*t.y;i[0+a]/=s,i[1+a]/=l;const u=Zt(s,l,.5);return typeof i[2+a]=="number"&&(i[2+a]/=u),typeof i[3+a]=="number"&&(i[3+a]/=u),o(i)}};class W9e extends bt.Component{componentDidMount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r,layoutId:i}=this.props,{projection:o}=t;Z6e(K9e),o&&(n.group&&n.group.add(o),r&&r.register&&i&&r.register(o),o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),sv.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:n,visualElement:r,drag:i,isPresent:o}=this.props,a=r.projection;return a&&(a.isPresent=o,i||t.layoutDependency!==n||n===void 0?a.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?a.promote():a.relegate()||kt.postRender(()=>{const s=a.getStack();(!s||!s.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),queueMicrotask(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:i}=t;i&&(i.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(i),r&&r.deregister&&r.deregister(i))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function HU(e){const[t,n]=U9e(),r=I.useContext(KA);return bt.createElement(W9e,{...e,layoutGroup:r,switchLayoutGroup:I.useContext(zV),isPresent:t,safeToRemove:n})}const K9e={borderRadius:{...Th,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Th,borderTopRightRadius:Th,borderBottomLeftRadius:Th,borderBottomRightRadius:Th,boxShadow:q9e},qU=["TopLeft","TopRight","BottomLeft","BottomRight"],X9e=qU.length,UM=e=>typeof e=="string"?parseFloat(e):e,GM=e=>typeof e=="number"||Ie.test(e);function Q9e(e,t,n,r,i,o){i?(e.opacity=Zt(0,n.opacity!==void 0?n.opacity:1,Y9e(r)),e.opacityExit=Zt(t.opacity!==void 0?t.opacity:1,0,Z9e(r))):o&&(e.opacity=Zt(t.opacity!==void 0?t.opacity:1,n.opacity!==void 0?n.opacity:1,r));for(let a=0;art?1:n(Bg(e,t,r))}function qM(e,t){e.min=t.min,e.max=t.max}function $i(e,t){qM(e.x,t.x),qM(e.y,t.y)}function WM(e,t,n,r,i){return e-=t,e=rb(e,1/n,r),i!==void 0&&(e=rb(e,1/i,r)),e}function J9e(e,t=0,n=1,r=.5,i,o=e,a=e){if(ba.test(t)&&(t=parseFloat(t),t=Zt(a.min,a.max,t/100)-a.min),typeof t!="number")return;let s=Zt(o.min,o.max,r);e===o&&(s-=t),e.min=WM(e.min,t,n,s,i),e.max=WM(e.max,t,n,s,i)}function KM(e,t,[n,r,i],o,a){J9e(e,t[n],t[r],t[i],t.scale,o,a)}const eMe=["x","scaleX","originX"],tMe=["y","scaleY","originY"];function XM(e,t,n,r){KM(e.x,t,eMe,n?n.x:void 0,r?r.x:void 0),KM(e.y,t,tMe,n?n.y:void 0,r?r.y:void 0)}function QM(e){return e.translate===0&&e.scale===1}function KU(e){return QM(e.x)&&QM(e.y)}function nMe(e,t){return e.x.min===t.x.min&&e.x.max===t.x.max&&e.y.min===t.y.min&&e.y.max===t.y.max}function XU(e,t){return Math.round(e.x.min)===Math.round(t.x.min)&&Math.round(e.x.max)===Math.round(t.x.max)&&Math.round(e.y.min)===Math.round(t.y.min)&&Math.round(e.y.max)===Math.round(t.y.max)}function YM(e){return xi(e.x)/xi(e.y)}class rMe{constructor(){this.members=[]}add(t){uT(this.members,t),t.scheduleRender()}remove(t){if(cT(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(t){const n=this.members.findIndex(i=>t===i);if(n===0)return!1;let r;for(let i=n;i>=0;i--){const o=this.members[i];if(o.isPresent!==!1){r=o;break}}return r?(this.promote(r),!0):!1}promote(t,n){const r=this.lead;if(t!==r&&(this.prevLead=r,this.lead=t,t.show(),r)){r.instance&&r.scheduleRender(),t.scheduleRender(),t.resumeFrom=r,n&&(t.resumeFrom.preserveOpacity=!0),r.snapshot&&(t.snapshot=r.snapshot,t.snapshot.latestValues=r.animationValues||r.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:i}=t.options;i===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:n,resumingFrom:r}=t;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function ZM(e,t,n){let r="";const i=e.x.translate/t.x,o=e.y.translate/t.y;if((i||o)&&(r=`translate3d(${i}px, ${o}px, 0) `),(t.x!==1||t.y!==1)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){const{rotate:l,rotateX:u,rotateY:c}=n;l&&(r+=`rotate(${l}deg) `),u&&(r+=`rotateX(${u}deg) `),c&&(r+=`rotateY(${c}deg) `)}const a=e.x.scale*t.x,s=e.y.scale*t.y;return(a!==1||s!==1)&&(r+=`scale(${a}, ${s})`),r||"none"}const iMe=(e,t)=>e.depth-t.depth;class oMe{constructor(){this.children=[],this.isDirty=!1}add(t){uT(this.children,t),this.isDirty=!0}remove(t){cT(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(iMe),this.isDirty=!1,this.children.forEach(t)}}function aMe(e,t){const n=performance.now(),r=({timestamp:i})=>{const o=i-n;o>=t&&(vs(r),e(o-t))};return kt.read(r,!0),()=>vs(r)}function sMe(e){window.MotionDebug&&window.MotionDebug.record(e)}function lMe(e){return e instanceof SVGElement&&e.tagName!=="svg"}function uMe(e,t,n){const r=ai(e)?e:wf(e);return r.start(lT("",r,t,n)),r.animation}const JM=["","X","Y","Z"],eR=1e3;let cMe=0;const gu={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function QU({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(a={},s=t==null?void 0:t()){this.id=cMe++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{gu.totalNodes=gu.resolvedTargetDeltas=gu.recalculatedProjection=0,this.nodes.forEach(hMe),this.nodes.forEach(vMe),this.nodes.forEach(bMe),this.nodes.forEach(pMe),sMe(gu)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=a,this.root=s?s.root||s:this,this.path=s?[...s.path,s]:[],this.parent=s,this.depth=s?s.depth+1:0;for(let l=0;lthis.root.updateBlockedByResize=!1;e(a,()=>{this.root.updateBlockedByResize=!0,d&&d(),d=aMe(f,250),sv.hasAnimatedSinceResize&&(sv.hasAnimatedSinceResize=!1,this.nodes.forEach(nR))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&c&&(l||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||c.getDefaultTransition()||CMe,{onLayoutAnimationStart:_,onLayoutAnimationComplete:v}=c.getProps(),y=!this.targetLayout||!XU(this.targetLayout,p)||h,g=!f&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||g||f&&(y||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(d,g);const b={...$U(m,"layout"),onPlay:_,onComplete:v};(c.shouldReduceMotion||this.options.layoutRoot)&&(b.delay=0,b.type=!1),this.startAnimation(b)}else f||nR(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const a=this.getStack();a&&a.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,vs(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(_Me),this.animationId++)}getTransformTemplate(){const{visualElement:a}=this.options;return a&&a.getProps().transformTemplate}willUpdate(a=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let c=0;cthis.update()))}clearAllSnapshots(){this.nodes.forEach(gMe),this.sharedNodes.forEach(SMe)}scheduleUpdateProjection(){kt.preRender(this.updateProjection,!1,!0)}scheduleCheckAfterUnmount(){kt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l{const S=b/1e3;rR(d.x,a.x,S),rR(d.y,a.y,S),this.setTargetDelta(d),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(vp(f,this.layout.layoutBox,this.relativeParent.layout.layoutBox),xMe(this.relativeTarget,this.relativeTargetOrigin,f,S),g&&nMe(this.relativeTarget,g)&&(this.isProjectionDirty=!1),g||(g=_n()),$i(g,this.relativeTarget)),m&&(this.animationValues=c,Q9e(c,u,this.latestValues,S,y,v)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(a){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(vs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=kt.update(()=>{sv.hasAnimatedSinceResize=!0,this.currentAnimation=uMe(0,eR,{...a,onUpdate:s=>{this.mixTargetDelta(s),a.onUpdate&&a.onUpdate(s)},onComplete:()=>{a.onComplete&&a.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const a=this.getStack();a&&a.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(eR),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const a=this.getLead();let{targetWithTransforms:s,target:l,layout:u,latestValues:c}=a;if(!(!s||!l||!u)){if(this!==a&&this.layout&&u&&YU(this.options.animationType,this.layout.layoutBox,u.layoutBox)){l=this.target||_n();const d=xi(this.layout.layoutBox.x);l.x.min=a.target.x.min,l.x.max=l.x.min+d;const f=xi(this.layout.layoutBox.y);l.y.min=a.target.y.min,l.y.max=l.y.min+f}$i(s,l),gd(s,c),yp(this.projectionDeltaWithTransform,this.layoutCorrected,s,c)}}registerSharedNode(a,s){this.sharedNodes.has(a)||this.sharedNodes.set(a,new rMe),this.sharedNodes.get(a).add(s);const u=s.options.initialPromotionConfig;s.promote({transition:u?u.transition:void 0,preserveFollowOpacity:u&&u.shouldPreserveFollowOpacity?u.shouldPreserveFollowOpacity(s):void 0})}isLead(){const a=this.getStack();return a?a.lead===this:!0}getLead(){var a;const{layoutId:s}=this.options;return s?((a=this.getStack())===null||a===void 0?void 0:a.lead)||this:this}getPrevLead(){var a;const{layoutId:s}=this.options;return s?(a=this.getStack())===null||a===void 0?void 0:a.prevLead:void 0}getStack(){const{layoutId:a}=this.options;if(a)return this.root.sharedNodes.get(a)}promote({needsReset:a,transition:s,preserveFollowOpacity:l}={}){const u=this.getStack();u&&u.promote(this,l),a&&(this.projectionDelta=void 0,this.needsReset=!0),s&&this.setOptions({transition:s})}relegate(){const a=this.getStack();return a?a.relegate(this):!1}resetRotation(){const{visualElement:a}=this.options;if(!a)return;let s=!1;const{latestValues:l}=a;if((l.rotate||l.rotateX||l.rotateY||l.rotateZ)&&(s=!0),!s)return;const u={};for(let c=0;c{var s;return(s=a.currentAnimation)===null||s===void 0?void 0:s.stop()}),this.root.nodes.forEach(tR),this.root.sharedNodes.clear()}}}function dMe(e){e.updateLayout()}function fMe(e){var t;const n=((t=e.resumeFrom)===null||t===void 0?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:i}=e.layout,{animationType:o}=e.options,a=n.source!==e.layout.source;o==="size"?Qo(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=xi(f);f.min=r[d].min,f.max=f.min+h}):YU(o,n.layoutBox,r)&&Qo(d=>{const f=a?n.measuredBox[d]:n.layoutBox[d],h=xi(r[d]);f.max=f.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[d].max=e.relativeTarget[d].min+h)});const s=pd();yp(s,r,n.layoutBox);const l=pd();a?yp(l,e.applyTransform(i,!0),n.measuredBox):yp(l,r,n.layoutBox);const u=!KU(s);let c=!1;if(!e.resumeFrom){const d=e.getClosestProjectingParent();if(d&&!d.resumeFrom){const{snapshot:f,layout:h}=d;if(f&&h){const p=_n();vp(p,n.layoutBox,f.layoutBox);const m=_n();vp(m,r,h.layoutBox),XU(p,m)||(c=!0),d.options.layoutRoot&&(e.relativeTarget=m,e.relativeTargetOrigin=p,e.relativeParent=d)}}}e.notifyListeners("didUpdate",{layout:r,snapshot:n,delta:l,layoutDelta:s,hasLayoutChanged:u,hasRelativeTargetChanged:c})}else if(e.isLead()){const{onExitComplete:r}=e.options;r&&r()}e.options.transition=void 0}function hMe(e){gu.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function pMe(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function gMe(e){e.clearSnapshot()}function tR(e){e.clearMeasurements()}function mMe(e){e.isLayoutDirty=!1}function yMe(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function nR(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function vMe(e){e.resolveTargetDelta()}function bMe(e){e.calcProjection()}function _Me(e){e.resetRotation()}function SMe(e){e.removeLeadSnapshot()}function rR(e,t,n){e.translate=Zt(t.translate,0,n),e.scale=Zt(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function iR(e,t,n,r){e.min=Zt(t.min,n.min,r),e.max=Zt(t.max,n.max,r)}function xMe(e,t,n,r){iR(e.x,t.x,n.x,r),iR(e.y,t.y,n.y,r)}function wMe(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const CMe={duration:.45,ease:[.4,0,.1,1]},oR=e=>typeof navigator<"u"&&navigator.userAgent.toLowerCase().includes(e),aR=oR("applewebkit/")&&!oR("chrome/")?Math.round:un;function sR(e){e.min=aR(e.min),e.max=aR(e.max)}function EMe(e){sR(e.x),sR(e.y)}function YU(e,t,n){return e==="position"||e==="preserve-aspect"&&!b3(YM(t),YM(n),.2)}const AMe=QU({attachResizeListener:(e,t)=>es(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Lw={current:void 0},ZU=QU({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!Lw.current){const e=new AMe({});e.mount(window),e.setOptions({layoutScroll:!0}),Lw.current=e}return Lw.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),TMe={pan:{Feature:V9e},drag:{Feature:j9e,ProjectionNode:ZU,MeasureLayout:HU}},PMe=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function kMe(e){const t=PMe.exec(e);if(!t)return[,];const[,n,r]=t;return[n,r]}function w3(e,t,n=1){const[r,i]=kMe(e);if(!r)return;const o=window.getComputedStyle(t).getPropertyValue(r);if(o){const a=o.trim();return NU(a)?parseFloat(a):a}else return f3(i)?w3(i,t,n+1):i}function IMe(e,{...t},n){const r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&(n={...n}),e.values.forEach(i=>{const o=i.get();if(!f3(o))return;const a=w3(o,r);a&&i.set(a)});for(const i in t){const o=t[i];if(!f3(o))continue;const a=w3(o,r);a&&(t[i]=a,n||(n={}),n[i]===void 0&&(n[i]=o))}return{target:t,transitionEnd:n}}const MMe=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),JU=e=>MMe.has(e),RMe=e=>Object.keys(e).some(JU),lR=e=>e===yc||e===Ie,uR=(e,t)=>parseFloat(e.split(", ")[t]),cR=(e,t)=>(n,{transform:r})=>{if(r==="none"||!r)return 0;const i=r.match(/^matrix3d\((.+)\)$/);if(i)return uR(i[1],t);{const o=r.match(/^matrix\((.+)\)$/);return o?uR(o[1],e):0}},OMe=new Set(["x","y","z"]),$Me=Dm.filter(e=>!OMe.has(e));function NMe(e){const t=[];return $Me.forEach(n=>{const r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),t.length&&e.render(),t}const Cf={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:cR(4,13),y:cR(5,14)};Cf.translateX=Cf.x;Cf.translateY=Cf.y;const DMe=(e,t,n)=>{const r=t.measureViewportBox(),i=t.current,o=getComputedStyle(i),{display:a}=o,s={};a==="none"&&t.setStaticValue("display",e.display||"block"),n.forEach(u=>{s[u]=Cf[u](r,o)}),t.render();const l=t.measureViewportBox();return n.forEach(u=>{const c=t.getValue(u);c&&c.jump(s[u]),e[u]=Cf[u](l,o)}),e},LMe=(e,t,n={},r={})=>{t={...t},r={...r};const i=Object.keys(t).filter(JU);let o=[],a=!1;const s=[];if(i.forEach(l=>{const u=e.getValue(l);if(!e.hasValue(l))return;let c=n[l],d=Ah(c);const f=t[l];let h;if(Z1(f)){const p=f.length,m=f[0]===null?1:0;c=f[m],d=Ah(c);for(let _=m;_=0?window.pageYOffset:null,u=DMe(t,e,s);return o.length&&o.forEach(([c,d])=>{e.getValue(c).set(d)}),e.render(),a2&&l!==null&&window.scrollTo({top:l}),{target:u,transitionEnd:r}}else return{target:t,transitionEnd:r}};function FMe(e,t,n,r){return RMe(t)?LMe(e,t,n,r):{target:t,transitionEnd:r}}const BMe=(e,t,n,r)=>{const i=IMe(e,t,r);return t=i.target,r=i.transitionEnd,FMe(e,t,n,r)},C3={current:null},eG={current:!1};function zMe(){if(eG.current=!0,!!a2)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>C3.current=e.matches;e.addListener(t),t()}else C3.current=!1}function jMe(e,t,n){const{willChange:r}=t;for(const i in t){const o=t[i],a=n[i];if(ai(o))e.addValue(i,o),nb(r)&&r.add(i);else if(ai(a))e.addValue(i,wf(o,{owner:e})),nb(r)&&r.remove(i);else if(a!==o)if(e.hasValue(i)){const s=e.getValue(i);!s.hasAnimated&&s.set(o)}else{const s=e.getStaticValue(i);e.addValue(i,wf(s!==void 0?s:o,{owner:e}))}}for(const i in n)t[i]===void 0&&e.removeValue(i);return t}const dR=new WeakMap,tG=Object.keys(Fg),VMe=tG.length,fR=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],UMe=WA.length;class GMe{constructor({parent:t,props:n,presenceContext:r,reducedMotionConfig:i,visualState:o},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>kt.render(this.render,!1,!0);const{latestValues:s,renderState:l}=o;this.latestValues=s,this.baseTarget={...s},this.initialValues=n.initial?{...s}:{},this.renderState=l,this.parent=t,this.props=n,this.presenceContext=r,this.depth=t?t.depth+1:0,this.reducedMotionConfig=i,this.options=a,this.isControllingVariants=l2(n),this.isVariantNode=BV(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:u,...c}=this.scrapeMotionValuesFromProps(n,{});for(const d in c){const f=c[d];s[d]!==void 0&&ai(f)&&(f.set(s[d],!1),nb(u)&&u.add(d))}}scrapeMotionValuesFromProps(t,n){return{}}mount(t){this.current=t,dR.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,r)=>this.bindToMotionValue(r,n)),eG.current||zMe(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:C3.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){dR.delete(this.current),this.projection&&this.projection.unmount(),vs(this.notifyUpdate),vs(this.render),this.valueSubscriptions.forEach(t=>t()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const t in this.events)this.events[t].clear();for(const t in this.features)this.features[t].unmount();this.current=null}bindToMotionValue(t,n){const r=mc.has(t),i=n.on("change",a=>{this.latestValues[t]=a,this.props.onUpdate&&kt.update(this.notifyUpdate,!1,!0),r&&this.projection&&(this.projection.isTransformDirty=!0)}),o=n.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(t,()=>{i(),o()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}loadFeatures({children:t,...n},r,i,o){let a,s;for(let l=0;lthis.scheduleRender(),animationType:typeof u=="string"?u:"both",initialPromotionConfig:o,layoutScroll:f,layoutRoot:h})}return s}updateFeatures(){for(const t in this.features){const n=this.features[t];n.isMounted?n.update():(n.mount(),n.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):_n()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,n){this.latestValues[t]=n}makeTargetAnimatable(t,n=!0){return this.makeTargetAnimatableFromInstance(t,this.props,n)}update(t,n){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;rn.variantChildren.delete(t)}addValue(t,n){n!==this.values.get(t)&&(this.removeValue(t),this.bindToMotionValue(t,n)),this.values.set(t,n),this.latestValues[t]=n.get()}removeValue(t){this.values.delete(t);const n=this.valueSubscriptions.get(t);n&&(n(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,n){if(this.props.values&&this.props.values[t])return this.props.values[t];let r=this.values.get(t);return r===void 0&&n!==void 0&&(r=wf(n,{owner:this}),this.addValue(t,r)),r}readValue(t){var n;return this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:(n=this.getBaseTargetFromProps(this.props,t))!==null&&n!==void 0?n:this.readValueFromInstance(this.current,t,this.options)}setBaseTarget(t,n){this.baseTarget[t]=n}getBaseTarget(t){var n;const{initial:r}=this.props,i=typeof r=="string"||typeof r=="object"?(n=nT(this.props,r))===null||n===void 0?void 0:n[t]:void 0;if(r&&i!==void 0)return i;const o=this.getBaseTargetFromProps(this.props,t);return o!==void 0&&!ai(o)?o:this.initialValues[t]!==void 0&&i===void 0?void 0:this.baseTarget[t]}on(t,n){return this.events[t]||(this.events[t]=new dT),this.events[t].add(n)}notify(t,...n){this.events[t]&&this.events[t].notify(...n)}}class nG extends GMe{sortInstanceNodePosition(t,n){return t.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(t,n){return t.style?t.style[n]:void 0}removeValueFromRenderState(t,{vars:n,style:r}){delete n[t],delete r[t]}makeTargetAnimatableFromInstance({transition:t,transitionEnd:n,...r},{transformValues:i},o){let a=s9e(r,t||{},this);if(i&&(n&&(n=i(n)),r&&(r=i(r)),a&&(a=i(a))),o){o9e(this,r,a);const s=BMe(this,r,a,n);n=s.transitionEnd,r=s.target}return{transition:t,transitionEnd:n,...r}}}function HMe(e){return window.getComputedStyle(e)}class qMe extends nG{readValueFromInstance(t,n){if(mc.has(n)){const r=sT(n);return r&&r.default||0}else{const r=HMe(t),i=(UV(n)?r.getPropertyValue(n):r[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(t,{transformPagePoint:n}){return GU(t,n)}build(t,n,r,i){QA(t,n,r,i.transformTemplate)}scrapeMotionValuesFromProps(t,n){return tT(t,n)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ai(t)&&(this.childSubscription=t.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}renderInstance(t,n,r,i){XV(t,n,r,i)}}class WMe extends nG{constructor(){super(...arguments),this.isSVGTag=!1}getBaseTargetFromProps(t,n){return t[n]}readValueFromInstance(t,n){if(mc.has(n)){const r=sT(n);return r&&r.default||0}return n=QV.has(n)?n:eT(n),t.getAttribute(n)}measureInstanceViewportBox(){return _n()}scrapeMotionValuesFromProps(t,n){return ZV(t,n)}build(t,n,r,i){ZA(t,n,r,this.isSVGTag,i.transformTemplate)}renderInstance(t,n,r,i){YV(t,n,r,i)}mount(t){this.isSVGTag=JA(t.tagName),super.mount(t)}}const KMe=(e,t)=>XA(e)?new WMe(t,{enableHardwareAcceleration:!1}):new qMe(t,{enableHardwareAcceleration:!0}),XMe={layout:{ProjectionNode:ZU,MeasureLayout:HU}},QMe={...S9e,...j8e,...TMe,...XMe},rG=Q6e((e,t)=>P8e(e,t,QMe,KMe));function iG(){const e=I.useRef(!1);return HA(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function YMe(){const e=iG(),[t,n]=I.useState(0),r=I.useCallback(()=>{e.current&&n(t+1)},[t]);return[I.useCallback(()=>kt.postRender(r),[r]),t]}class ZMe extends I.Component{getSnapshotBeforeUpdate(t){const n=this.props.childRef.current;if(n&&t.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=n.offsetHeight||0,r.width=n.offsetWidth||0,r.top=n.offsetTop,r.left=n.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function JMe({children:e,isPresent:t}){const n=I.useId(),r=I.useRef(null),i=I.useRef({width:0,height:0,top:0,left:0});return I.useInsertionEffect(()=>{const{width:o,height:a,top:s,left:l}=i.current;if(t||!r.current||!o||!a)return;r.current.dataset.motionPopId=n;const u=document.createElement("style");return document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` + [data-motion-pop-id="${n}"] { + position: absolute !important; + width: ${o}px !important; + height: ${a}px !important; + top: ${s}px !important; + left: ${l}px !important; + } + `),()=>{document.head.removeChild(u)}},[t]),I.createElement(ZMe,{isPresent:t,childRef:r,sizeRef:i},I.cloneElement(e,{ref:r}))}const Fw=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:o,mode:a})=>{const s=JV(eRe),l=I.useId(),u=I.useMemo(()=>({id:l,initial:t,isPresent:n,custom:i,onExitComplete:c=>{s.set(c,!0);for(const d of s.values())if(!d)return;r&&r()},register:c=>(s.set(c,!1),()=>s.delete(c))}),o?void 0:[n]);return I.useMemo(()=>{s.forEach((c,d)=>s.set(d,!1))},[n]),I.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),a==="popLayout"&&(e=I.createElement(JMe,{isPresent:n},e)),I.createElement(Nm.Provider,{value:u},e)};function eRe(){return new Map}function tRe(e){return I.useEffect(()=>()=>e(),[])}const Uc=e=>e.key||"";function nRe(e,t){e.forEach(n=>{const r=Uc(n);t.set(r,n)})}function rRe(e){const t=[];return I.Children.forEach(e,n=>{I.isValidElement(n)&&t.push(n)}),t}const oG=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:o=!0,mode:a="sync"})=>{const s=I.useContext(KA).forceRender||YMe()[0],l=iG(),u=rRe(e);let c=u;const d=I.useRef(new Map).current,f=I.useRef(c),h=I.useRef(new Map).current,p=I.useRef(!0);if(HA(()=>{p.current=!1,nRe(u,h),f.current=c}),tRe(()=>{p.current=!0,h.clear(),d.clear()}),p.current)return I.createElement(I.Fragment,null,c.map(y=>I.createElement(Fw,{key:Uc(y),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:o,mode:a},y)));c=[...c];const m=f.current.map(Uc),_=u.map(Uc),v=m.length;for(let y=0;y{if(_.indexOf(g)!==-1)return;const b=h.get(g);if(!b)return;const S=m.indexOf(g);let x=y;if(!x){const w=()=>{h.delete(g),d.delete(g);const C=f.current.findIndex(T=>T.key===g);if(f.current.splice(C,1),!d.size){if(f.current=u,l.current===!1)return;s(),r&&r()}};x=I.createElement(Fw,{key:Uc(b),isPresent:!1,onExitComplete:w,custom:t,presenceAffectsLayout:o,mode:a},b),d.set(g,x)}c.splice(S,0,x)}),c=c.map(y=>{const g=y.key;return d.has(g)?y:I.createElement(Fw,{key:Uc(y),isPresent:!0,presenceAffectsLayout:o,mode:a},y)}),I.createElement(I.Fragment,null,d.size?c:c.map(y=>I.cloneElement(y)))};var iRe={initial:e=>{const{position:t}=e,n=["top","bottom"].includes(t)?"y":"x";let r=["top-right","bottom-right"].includes(t)?1:-1;return t==="bottom"&&(r=1),{opacity:0,[n]:r*24}},animate:{opacity:1,y:0,x:0,scale:1,transition:{duration:.4,ease:[.4,0,.2,1]}},exit:{opacity:0,scale:.85,transition:{duration:.2,ease:[.4,0,1,1]}}},aG=I.memo(e=>{const{id:t,message:n,onCloseComplete:r,onRequestRemove:i,requestClose:o=!1,position:a="bottom",duration:s=5e3,containerStyle:l,motionVariants:u=iRe,toastSpacing:c="0.5rem"}=e,[d,f]=I.useState(s),h=G9e();uM(()=>{h||r==null||r()},[h]),uM(()=>{f(s)},[s]);const p=()=>f(null),m=()=>f(s),_=()=>{h&&i()};I.useEffect(()=>{h&&o&&i()},[h,o,i]),j6e(_,d);const v=I.useMemo(()=>({pointerEvents:"auto",maxWidth:560,minWidth:300,margin:c,...l}),[l,c]),y=I.useMemo(()=>F6e(a),[a]);return q.jsx(rG.div,{layout:!0,className:"chakra-toast",variants:u,initial:"initial",animate:"animate",exit:"exit",onHoverStart:p,onHoverEnd:m,custom:{position:a},style:y,children:q.jsx(ar.div,{role:"status","aria-atomic":"true",className:"chakra-toast__inner",__css:v,children:ua(n,{id:t,onClose:_})})})});aG.displayName="ToastComponent";function oRe(e,t){var n;const r=e??"bottom",o={"top-start":{ltr:"top-left",rtl:"top-right"},"top-end":{ltr:"top-right",rtl:"top-left"},"bottom-start":{ltr:"bottom-left",rtl:"bottom-right"},"bottom-end":{ltr:"bottom-right",rtl:"bottom-left"}}[r];return(n=o==null?void 0:o[t])!=null?n:r}var hR={path:q.jsxs("g",{stroke:"currentColor",strokeWidth:"1.5",children:[q.jsx("path",{strokeLinecap:"round",fill:"none",d:"M9,9a3,3,0,1,1,4,2.829,1.5,1.5,0,0,0-1,1.415V14.25"}),q.jsx("path",{fill:"currentColor",strokeLinecap:"round",d:"M12,17.25a.375.375,0,1,0,.375.375A.375.375,0,0,0,12,17.25h0"}),q.jsx("circle",{fill:"none",strokeMiterlimit:"10",cx:"12",cy:"12",r:"11.25"})]}),viewBox:"0 0 24 24"},zm=Ai((e,t)=>{const{as:n,viewBox:r,color:i="currentColor",focusable:o=!1,children:a,className:s,__css:l,...u}=e,c=Xl("chakra-icon",s),d=$m("Icon",e),f={w:"1em",h:"1em",display:"inline-block",lineHeight:"1em",flexShrink:0,color:i,...l,...d},h={ref:t,focusable:o,className:c,__css:f},p=r??hR.viewBox;if(n&&typeof n!="string")return q.jsx(ar.svg,{as:n,...h,...u});const m=a??hR.path;return q.jsx(ar.svg,{verticalAlign:"middle",viewBox:p,...h,...u,children:m})});zm.displayName="Icon";function aRe(e){return q.jsx(zm,{viewBox:"0 0 24 24",...e,children:q.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.014,12.014,0,0,0,12,0Zm6.927,8.2-6.845,9.289a1.011,1.011,0,0,1-1.43.188L5.764,13.769a1,1,0,1,1,1.25-1.562l4.076,3.261,6.227-8.451A1,1,0,1,1,18.927,8.2Z"})})}function sRe(e){return q.jsx(zm,{viewBox:"0 0 24 24",...e,children:q.jsx("path",{fill:"currentColor",d:"M12,0A12,12,0,1,0,24,12,12.013,12.013,0,0,0,12,0Zm.25,5a1.5,1.5,0,1,1-1.5,1.5A1.5,1.5,0,0,1,12.25,5ZM14.5,18.5h-4a1,1,0,0,1,0-2h.75a.25.25,0,0,0,.25-.25v-4.5a.25.25,0,0,0-.25-.25H10.5a1,1,0,0,1,0-2h1a2,2,0,0,1,2,2v4.75a.25.25,0,0,0,.25.25h.75a1,1,0,1,1,0,2Z"})})}function pR(e){return q.jsx(zm,{viewBox:"0 0 24 24",...e,children:q.jsx("path",{fill:"currentColor",d:"M11.983,0a12.206,12.206,0,0,0-8.51,3.653A11.8,11.8,0,0,0,0,12.207,11.779,11.779,0,0,0,11.8,24h.214A12.111,12.111,0,0,0,24,11.791h0A11.766,11.766,0,0,0,11.983,0ZM10.5,16.542a1.476,1.476,0,0,1,1.449-1.53h.027a1.527,1.527,0,0,1,1.523,1.47,1.475,1.475,0,0,1-1.449,1.53h-.027A1.529,1.529,0,0,1,10.5,16.542ZM11,12.5v-6a1,1,0,0,1,2,0v6a1,1,0,1,1-2,0Z"})})}var lRe=S5e({"0%":{transform:"rotate(0deg)"},"100%":{transform:"rotate(360deg)"}}),fT=Ai((e,t)=>{const n=$m("Spinner",e),{label:r="Loading...",thickness:i="2px",speed:o="0.45s",emptyColor:a="transparent",className:s,...l}=Rm(e),u=Xl("chakra-spinner",s),c={display:"inline-block",borderColor:"currentColor",borderStyle:"solid",borderRadius:"99999px",borderWidth:i,borderBottomColor:a,borderLeftColor:a,animation:`${lRe} ${o} linear infinite`,...n};return q.jsx(ar.div,{ref:t,__css:c,className:u,...l,children:r&&q.jsx(ar.span,{srOnly:!0,children:r})})});fT.displayName="Spinner";var[uRe,hT]=Mm({name:"AlertContext",hookName:"useAlertContext",providerName:""}),[cRe,pT]=Mm({name:"AlertStylesContext",hookName:"useAlertStyles",providerName:""}),sG={info:{icon:sRe,colorScheme:"blue"},warning:{icon:pR,colorScheme:"orange"},success:{icon:aRe,colorScheme:"green"},error:{icon:pR,colorScheme:"red"},loading:{icon:fT,colorScheme:"blue"}};function dRe(e){return sG[e].colorScheme}function fRe(e){return sG[e].icon}var lG=Ai(function(t,n){const r=pT(),{status:i}=hT(),o={display:"inline",...r.description};return q.jsx(ar.div,{ref:n,"data-status":i,...t,className:Xl("chakra-alert__desc",t.className),__css:o})});lG.displayName="AlertDescription";function uG(e){const{status:t}=hT(),n=fRe(t),r=pT(),i=t==="loading"?r.spinner:r.icon;return q.jsx(ar.span,{display:"inherit","data-status":t,...e,className:Xl("chakra-alert__icon",e.className),__css:i,children:e.children||q.jsx(n,{h:"100%",w:"100%"})})}uG.displayName="AlertIcon";var cG=Ai(function(t,n){const r=pT(),{status:i}=hT();return q.jsx(ar.div,{ref:n,"data-status":i,...t,className:Xl("chakra-alert__title",t.className),__css:r.title})});cG.displayName="AlertTitle";var dG=Ai(function(t,n){var r;const{status:i="info",addRole:o=!0,...a}=Rm(t),s=(r=t.colorScheme)!=null?r:dRe(i),l=v6e("Alert",{...t,colorScheme:s}),u={width:"100%",display:"flex",alignItems:"center",position:"relative",overflow:"hidden",...l.container};return q.jsx(uRe,{value:{status:i},children:q.jsx(cRe,{value:l,children:q.jsx(ar.div,{"data-status":i,role:o?"alert":void 0,ref:n,...a,className:Xl("chakra-alert",t.className),__css:u})})})});dG.displayName="Alert";function hRe(e){return q.jsx(zm,{focusable:"false","aria-hidden":!0,...e,children:q.jsx("path",{fill:"currentColor",d:"M.439,21.44a1.5,1.5,0,0,0,2.122,2.121L11.823,14.3a.25.25,0,0,1,.354,0l9.262,9.263a1.5,1.5,0,1,0,2.122-2.121L14.3,12.177a.25.25,0,0,1,0-.354l9.263-9.262A1.5,1.5,0,0,0,21.439.44L12.177,9.7a.25.25,0,0,1-.354,0L2.561.44A1.5,1.5,0,0,0,.439,2.561L9.7,11.823a.25.25,0,0,1,0,.354Z"})})}var fG=Ai(function(t,n){const r=$m("CloseButton",t),{children:i,isDisabled:o,__css:a,...s}=Rm(t),l={outline:0,display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0};return q.jsx(ar.button,{type:"button","aria-label":"Close",ref:n,disabled:o,__css:{...l,...r,...a},...s,children:i||q.jsx(hRe,{width:"1em",height:"1em"})})});fG.displayName="CloseButton";var pRe={top:[],"top-left":[],"top-right":[],"bottom-left":[],bottom:[],"bottom-right":[]},aa=gRe(pRe);function gRe(e){let t=e;const n=new Set,r=i=>{t=i(t),n.forEach(o=>o())};return{getState:()=>t,subscribe:i=>(n.add(i),()=>{r(()=>e),n.delete(i)}),removeToast:(i,o)=>{r(a=>({...a,[o]:a[o].filter(s=>s.id!=i)}))},notify:(i,o)=>{const a=mRe(i,o),{position:s,id:l}=a;return r(u=>{var c,d;const h=s.includes("top")?[a,...(c=u[s])!=null?c:[]]:[...(d=u[s])!=null?d:[],a];return{...u,[s]:h}}),l},update:(i,o)=>{i&&r(a=>{const s={...a},{position:l,index:u}=lM(s,i);return l&&u!==-1&&(s[l][u]={...s[l][u],...o,message:hG(o)}),s})},closeAll:({positions:i}={})=>{r(o=>(i??["bottom","bottom-right","bottom-left","top","top-left","top-right"]).reduce((l,u)=>(l[u]=o[u].map(c=>({...c,requestClose:!0})),l),{...o}))},close:i=>{r(o=>{const a=DV(o,i);return a?{...o,[a]:o[a].map(s=>s.id==i?{...s,requestClose:!0}:s)}:o})},isActive:i=>!!lM(aa.getState(),i).position}}var gR=0;function mRe(e,t={}){var n,r;gR+=1;const i=(n=t.id)!=null?n:gR,o=(r=t.position)!=null?r:"bottom";return{id:i,message:e,position:o,duration:t.duration,onCloseComplete:t.onCloseComplete,onRequestRemove:()=>aa.removeToast(String(i),o),status:t.status,requestClose:!1,containerStyle:t.containerStyle}}var yRe=e=>{const{status:t,variant:n="solid",id:r,title:i,isClosable:o,onClose:a,description:s,colorScheme:l,icon:u}=e,c=r?{root:`toast-${r}`,title:`toast-${r}-title`,description:`toast-${r}-description`}:void 0;return q.jsxs(dG,{addRole:!1,status:t,variant:n,id:c==null?void 0:c.root,alignItems:"start",borderRadius:"md",boxShadow:"lg",paddingEnd:8,textAlign:"start",width:"auto",colorScheme:l,children:[q.jsx(uG,{children:u}),q.jsxs(ar.div,{flex:"1",maxWidth:"100%",children:[i&&q.jsx(cG,{id:c==null?void 0:c.title,children:i}),s&&q.jsx(lG,{id:c==null?void 0:c.description,display:"block",children:s})]}),o&&q.jsx(fG,{size:"sm",onClick:a,position:"absolute",insetEnd:1,top:1})]})};function hG(e={}){const{render:t,toastComponent:n=yRe}=e;return i=>typeof t=="function"?t({...i,...e}):q.jsx(n,{...i,...e})}function vRe(e,t){const n=i=>{var o;return{...t,...i,position:oRe((o=i==null?void 0:i.position)!=null?o:t==null?void 0:t.position,e)}},r=i=>{const o=n(i),a=hG(o);return aa.notify(a,o)};return r.update=(i,o)=>{aa.update(i,n(o))},r.promise=(i,o)=>{const a=r({...o.loading,status:"loading",duration:null});i.then(s=>r.update(a,{status:"success",duration:5e3,...ua(o.success,s)})).catch(s=>r.update(a,{status:"error",duration:5e3,...ua(o.error,s)}))},r.closeAll=aa.closeAll,r.close=aa.close,r.isActive=aa.isActive,r}var[EUe,AUe]=Mm({name:"ToastOptionsContext",strict:!1}),bRe=e=>{const t=I.useSyncExternalStore(aa.subscribe,aa.getState,aa.getState),{motionVariants:n,component:r=aG,portalProps:i}=e,a=Object.keys(t).map(s=>{const l=t[s];return q.jsx("div",{role:"region","aria-live":"polite","aria-label":"Notifications",id:`chakra-toast-manager-${s}`,style:B6e(s),children:q.jsx(oG,{initial:!1,children:l.map(u=>q.jsx(r,{motionVariants:n,...u},u.id))})},s)});return q.jsx(JS,{...i,children:a})},_Re={duration:5e3,variant:"solid"},Lc={theme:s6e,colorMode:"light",toggleColorMode:()=>{},setColorMode:()=>{},defaultOptions:_Re,forced:!1};function SRe({theme:e=Lc.theme,colorMode:t=Lc.colorMode,toggleColorMode:n=Lc.toggleColorMode,setColorMode:r=Lc.setColorMode,defaultOptions:i=Lc.defaultOptions,motionVariants:o,toastSpacing:a,component:s,forced:l}=Lc){const u={colorMode:t,setColorMode:r,toggleColorMode:n,forced:l};return{ToastContainer:()=>q.jsx(N6e,{theme:e,children:q.jsx(DA.Provider,{value:u,children:q.jsx(bRe,{defaultOptions:i,motionVariants:o,toastSpacing:a,component:s})})}),toast:vRe(e.direction,i)}}var E3=Ai(function(t,n){const{htmlWidth:r,htmlHeight:i,alt:o,...a}=t;return q.jsx("img",{width:r,height:i,ref:n,alt:o,...a})});E3.displayName="NativeImage";function xRe(e){const{loading:t,src:n,srcSet:r,onLoad:i,onError:o,crossOrigin:a,sizes:s,ignoreFallback:l}=e,[u,c]=I.useState("pending");I.useEffect(()=>{c(n?"loading":"pending")},[n]);const d=I.useRef(),f=I.useCallback(()=>{if(!n)return;h();const p=new Image;p.src=n,a&&(p.crossOrigin=a),r&&(p.srcset=r),s&&(p.sizes=s),t&&(p.loading=t),p.onload=m=>{h(),c("loaded"),i==null||i(m)},p.onerror=m=>{h(),c("failed"),o==null||o(m)},d.current=p},[n,a,r,s,i,o,t]),h=()=>{d.current&&(d.current.onload=null,d.current.onerror=null,d.current=null)};return U1(()=>{if(!l)return u==="loading"&&f(),()=>{h()}},[u,f,l]),l?"loaded":u}var wRe=(e,t)=>e!=="loaded"&&t==="beforeLoadOrError"||e==="failed"&&t==="onError";function CRe(e,t=[]){const n=Object.assign({},e);for(const r of t)r in n&&delete n[r];return n}var gT=Ai(function(t,n){const{fallbackSrc:r,fallback:i,src:o,srcSet:a,align:s,fit:l,loading:u,ignoreFallback:c,crossOrigin:d,fallbackStrategy:f="beforeLoadOrError",referrerPolicy:h,...p}=t,m=r!==void 0||i!==void 0,_=u!=null||c||!m,v=xRe({...t,crossOrigin:d,ignoreFallback:_}),y=wRe(v,f),g={ref:n,objectFit:l,objectPosition:s,..._?p:CRe(p,["onError","onLoad"])};return y?i||q.jsx(ar.img,{as:E3,className:"chakra-image__placeholder",src:r,...g}):q.jsx(ar.img,{as:E3,src:o,srcSet:a,crossOrigin:d,loading:u,referrerPolicy:h,className:"chakra-image",...g})});gT.displayName="Image";var pG=Ai(function(t,n){const r=$m("Text",t),{className:i,align:o,decoration:a,casing:s,...l}=Rm(t),u=w6e({textAlign:t.align,textDecoration:t.decoration,textTransform:t.casing});return q.jsx(ar.p,{ref:n,className:Xl("chakra-text",t.className),...u,...l,__css:r})});pG.displayName="Text";var A3=Ai(function(t,n){const r=$m("Heading",t),{className:i,...o}=Rm(t);return q.jsx(ar.h2,{ref:n,className:Xl("chakra-heading",t.className),...o,__css:r})});A3.displayName="Heading";var ib=ar("div");ib.displayName="Box";var gG=Ai(function(t,n){const{size:r,centerContent:i=!0,...o}=t,a=i?{display:"flex",alignItems:"center",justifyContent:"center"}:{};return q.jsx(ib,{ref:n,boxSize:r,__css:{...a,flexShrink:0,flexGrow:0},...o})});gG.displayName="Square";var ERe=Ai(function(t,n){const{size:r,...i}=t;return q.jsx(gG,{size:r,ref:n,borderRadius:"9999px",...i})});ERe.displayName="Circle";var mT=Ai(function(t,n){const{direction:r,align:i,justify:o,wrap:a,basis:s,grow:l,shrink:u,...c}=t,d={display:"flex",flexDirection:r,alignItems:i,justifyContent:o,flexWrap:a,flexBasis:s,flexGrow:l,flexShrink:u};return q.jsx(ar.div,{ref:n,__css:d,...c})});mT.displayName="Flex";const ARe=F.object({status:F.literal(422),data:F.object({detail:F.array(F.object({loc:F.array(F.string()),msg:F.string(),type:F.string()}))})});function Gr(e,t,n=!1){e=String(e),t=String(t);const r=Array.from({length:21},(a,s)=>s*50),i=[0,5,10,15,20,25,30,35,40,45,50,55,59,64,68,73,77,82,86,95,100];return r.reduce((a,s,l)=>{const u=n?i[l]/100:1,c=n?50:i[r.length-1-l];return a[s]=`hsl(${e} ${t}% ${c}% / ${u})`,a},{})}const sy={H:220,S:16},ly={H:250,S:42},uy={H:47,S:42},cy={H:40,S:70},dy={H:28,S:42},fy={H:113,S:42},hy={H:0,S:42},TRe={base:Gr(sy.H,sy.S),baseAlpha:Gr(sy.H,sy.S,!0),accent:Gr(ly.H,ly.S),accentAlpha:Gr(ly.H,ly.S,!0),working:Gr(uy.H,uy.S),workingAlpha:Gr(uy.H,uy.S,!0),gold:Gr(cy.H,cy.S),goldAlpha:Gr(cy.H,cy.S,!0),warning:Gr(dy.H,dy.S),warningAlpha:Gr(dy.H,dy.S,!0),ok:Gr(fy.H,fy.S),okAlpha:Gr(fy.H,fy.S,!0),error:Gr(hy.H,hy.S),errorAlpha:Gr(hy.H,hy.S,!0)},{definePartsStyle:PRe,defineMultiStyleConfig:kRe}=je(lV.keys),IRe={border:"none"},MRe=e=>{const{colorScheme:t}=e;return{fontWeight:"600",fontSize:"sm",border:"none",borderRadius:"base",bg:W(`${t}.200`,`${t}.700`)(e),color:W(`${t}.900`,`${t}.100`)(e),_hover:{bg:W(`${t}.250`,`${t}.650`)(e)},_expanded:{bg:W(`${t}.250`,`${t}.650`)(e),borderBottomRadius:"none",_hover:{bg:W(`${t}.300`,`${t}.600`)(e)}}}},RRe=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.100`,`${t}.800`)(e),borderRadius:"base",borderTopRadius:"none"}},ORe={},$Re=PRe(e=>({container:IRe,button:MRe(e),panel:RRe(e),icon:ORe})),NRe=kRe({variants:{invokeAI:$Re},defaultProps:{variant:"invokeAI",colorScheme:"base"}}),DRe=e=>{const{colorScheme:t}=e;if(t==="base"){const r={bg:W("base.150","base.700")(e),color:W("base.300","base.500")(e),svg:{fill:W("base.300","base.500")(e)},opacity:1},i={bg:"none",color:W("base.300","base.500")(e),svg:{fill:W("base.500","base.500")(e)},opacity:1};return{bg:W("base.250","base.600")(e),color:W("base.850","base.100")(e),borderRadius:"base",svg:{fill:W("base.850","base.100")(e)},_hover:{bg:W("base.300","base.500")(e),color:W("base.900","base.50")(e),svg:{fill:W("base.900","base.50")(e)},_disabled:r},_disabled:r,'&[data-progress="true"]':{...i,_hover:i}}}const n={bg:W(`${t}.400`,`${t}.700`)(e),color:W(`${t}.600`,`${t}.500`)(e),svg:{fill:W(`${t}.600`,`${t}.500`)(e),filter:"unset"},opacity:.7,filter:"saturate(65%)"};return{bg:W(`${t}.400`,`${t}.600`)(e),color:W("base.50","base.100")(e),borderRadius:"base",svg:{fill:W("base.50","base.100")(e)},_disabled:n,_hover:{bg:W(`${t}.500`,`${t}.500`)(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)},_disabled:n}}},LRe=e=>{const{colorScheme:t}=e,n=W("gray.200","whiteAlpha.300")(e);return{border:"1px solid",borderColor:t==="gray"?n:"currentColor",_hover:{bg:W(`${t}.500`,`${t}.500`)(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)}},".chakra-button__group[data-attached][data-orientation=horizontal] > &:not(:last-of-type)":{marginEnd:"-1px"},".chakra-button__group[data-attached][data-orientation=vertical] > &:not(:last-of-type)":{marginBottom:"-1px"}}},FRe={variants:{invokeAI:DRe,invokeAIOutline:LRe},defaultProps:{variant:"invokeAI",colorScheme:"base"}},{definePartsStyle:BRe,defineMultiStyleConfig:zRe}=je(uV.keys),jRe=e=>{const{colorScheme:t}=e;return{bg:W("base.200","base.700")(e),borderColor:W("base.300","base.600")(e),color:W("base.900","base.100")(e),_checked:{bg:W(`${t}.300`,`${t}.500`)(e),borderColor:W(`${t}.300`,`${t}.500`)(e),color:W(`${t}.900`,`${t}.100`)(e),_hover:{bg:W(`${t}.400`,`${t}.500`)(e),borderColor:W(`${t}.400`,`${t}.500`)(e)},_disabled:{borderColor:"transparent",bg:"whiteAlpha.300",color:"whiteAlpha.500"}},_indeterminate:{bg:W(`${t}.300`,`${t}.600`)(e),borderColor:W(`${t}.300`,`${t}.600`)(e),color:W(`${t}.900`,`${t}.100`)(e)},_disabled:{bg:"whiteAlpha.100",borderColor:"transparent"},_focusVisible:{boxShadow:"none",outline:"none"},_invalid:{borderColor:W("error.600","error.300")(e)}}},VRe=BRe(e=>({control:jRe(e)})),URe=zRe({variants:{invokeAI:VRe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{definePartsStyle:GRe,defineMultiStyleConfig:HRe}=je(cV.keys),qRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal"},WRe=e=>({borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6},"::selection":{color:W("accent.900","accent.50")(e),bg:W("accent.200","accent.400")(e)}}),KRe={borderRadius:"md",py:"1",transitionProperty:"common",transitionDuration:"normal",width:"full",_focusVisible:{boxShadow:"outline"},_placeholder:{opacity:.6}},XRe=GRe(e=>({preview:qRe,input:WRe(e),textarea:KRe})),QRe=HRe({variants:{invokeAI:XRe},defaultProps:{size:"sm",variant:"invokeAI"}}),YRe=e=>({fontSize:"sm",marginEnd:0,mb:1,fontWeight:"400",transitionProperty:"common",transitionDuration:"normal",whiteSpace:"nowrap",_disabled:{opacity:.4},color:W("base.700","base.300")(e),_invalid:{color:W("error.500","error.300")(e)}}),ZRe={variants:{invokeAI:YRe},defaultProps:{variant:"invokeAI"}},f2=e=>({outline:"none",borderWidth:2,borderStyle:"solid",borderColor:W("base.200","base.800")(e),bg:W("base.50","base.900")(e),borderRadius:"base",color:W("base.900","base.100")(e),boxShadow:"none",_hover:{borderColor:W("base.300","base.600")(e)},_focus:{borderColor:W("accent.200","accent.600")(e),boxShadow:"none",_hover:{borderColor:W("accent.300","accent.500")(e)}},_invalid:{borderColor:W("error.300","error.600")(e),boxShadow:"none",_hover:{borderColor:W("error.400","error.500")(e)}},_disabled:{borderColor:W("base.300","base.700")(e),bg:W("base.300","base.700")(e),color:W("base.600","base.400")(e),_hover:{borderColor:W("base.300","base.700")(e)}},_placeholder:{color:W("base.700","base.400")(e)},"::selection":{bg:W("accent.200","accent.400")(e)}}),{definePartsStyle:JRe,defineMultiStyleConfig:eOe}=je(dV.keys),tOe=JRe(e=>({field:f2(e)})),nOe=eOe({variants:{invokeAI:tOe},defaultProps:{size:"sm",variant:"invokeAI"}}),{definePartsStyle:rOe,defineMultiStyleConfig:iOe}=je(fV.keys),oOe=rOe(e=>({button:{fontWeight:500,bg:W("base.300","base.500")(e),color:W("base.900","base.100")(e),_hover:{bg:W("base.400","base.600")(e),color:W("base.900","base.50")(e),fontWeight:600}},list:{zIndex:9999,color:W("base.900","base.150")(e),bg:W("base.200","base.800")(e),shadow:"dark-lg",border:"none"},item:{fontSize:"sm",bg:W("base.200","base.800")(e),_hover:{bg:W("base.300","base.700")(e),svg:{opacity:1}},_focus:{bg:W("base.400","base.600")(e)},svg:{opacity:.7,fontSize:14}}})),aOe=iOe({variants:{invokeAI:oOe},defaultProps:{variant:"invokeAI"}}),TUe={variants:{enter:{visibility:"visible",opacity:1,scale:1,transition:{duration:.07,ease:[.4,0,.2,1]}},exit:{transitionEnd:{visibility:"hidden"},opacity:0,scale:.8,transition:{duration:.07,easings:"easeOut"}}}},{defineMultiStyleConfig:sOe,definePartsStyle:lOe}=je(hV.keys),uOe=e=>({bg:W("blackAlpha.700","blackAlpha.700")(e)}),cOe={},dOe=()=>({layerStyle:"first",maxH:"80vh"}),fOe=()=>({fontWeight:"600",fontSize:"lg",layerStyle:"first",borderTopRadius:"base",borderInlineEndRadius:"base"}),hOe={},pOe={overflowY:"scroll"},gOe={},mOe=lOe(e=>({overlay:uOe(e),dialogContainer:cOe,dialog:dOe(),header:fOe(),closeButton:hOe,body:pOe,footer:gOe})),yOe=sOe({variants:{invokeAI:mOe},defaultProps:{variant:"invokeAI",size:"lg"}}),{defineMultiStyleConfig:vOe,definePartsStyle:bOe}=je(pV.keys),_Oe=e=>({height:8}),SOe=e=>({border:"none",fontWeight:"600",height:"auto",py:1,ps:2,pe:6,...f2(e)}),xOe=e=>({display:"flex"}),wOe=e=>({border:"none",px:2,py:0,mx:-2,my:0,svg:{color:W("base.700","base.300")(e),width:2.5,height:2.5,_hover:{color:W("base.900","base.100")(e)}}}),COe=bOe(e=>({root:_Oe(e),field:SOe(e),stepperGroup:xOe(e),stepper:wOe(e)})),EOe=vOe({variants:{invokeAI:COe},defaultProps:{size:"sm",variant:"invokeAI"}}),{defineMultiStyleConfig:AOe,definePartsStyle:mG}=je(gV.keys),yG=nn("popper-bg"),vG=nn("popper-arrow-bg"),bG=nn("popper-arrow-shadow-color"),TOe=e=>({[vG.variable]:W("colors.base.100","colors.base.800")(e),[yG.variable]:W("colors.base.100","colors.base.800")(e),[bG.variable]:W("colors.base.400","colors.base.600")(e),minW:"unset",width:"unset",p:4,bg:W("base.100","base.800")(e),border:"none",shadow:"dark-lg"}),POe=e=>({[vG.variable]:W("colors.base.100","colors.base.700")(e),[yG.variable]:W("colors.base.100","colors.base.700")(e),[bG.variable]:W("colors.base.400","colors.base.400")(e),p:4,bg:W("base.100","base.700")(e),border:"none",shadow:"dark-lg"}),kOe=mG(e=>({content:TOe(e),body:{padding:0}})),IOe=mG(e=>({content:POe(e),body:{padding:0}})),MOe=AOe({variants:{invokeAI:kOe,informational:IOe},defaultProps:{variant:"invokeAI"}}),{defineMultiStyleConfig:ROe,definePartsStyle:OOe}=je(mV.keys),$Oe=e=>({bg:"accentAlpha.700"}),NOe=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.200`,`${t}.700`)(e)}},DOe=OOe(e=>({filledTrack:$Oe(e),track:NOe(e)})),LOe=ROe({variants:{invokeAI:DOe},defaultProps:{variant:"invokeAI"}}),FOe={"::-webkit-scrollbar":{display:"none"},scrollbarWidth:"none"},{definePartsStyle:BOe,defineMultiStyleConfig:zOe}=je(yV.keys),jOe=e=>({color:W("base.200","base.300")(e)}),VOe=e=>({fontWeight:"600",...f2(e)}),UOe=BOe(e=>({field:VOe(e),icon:jOe(e)})),GOe=zOe({variants:{invokeAI:UOe},defaultProps:{size:"sm",variant:"invokeAI"}}),mR=Pe("skeleton-start-color"),yR=Pe("skeleton-end-color"),HOe={borderRadius:"base",maxW:"full",maxH:"full",_light:{[mR.variable]:"colors.base.250",[yR.variable]:"colors.base.450"},_dark:{[mR.variable]:"colors.base.700",[yR.variable]:"colors.base.500"}},qOe={variants:{invokeAI:HOe},defaultProps:{variant:"invokeAI"}},{definePartsStyle:WOe,defineMultiStyleConfig:KOe}=je(vV.keys),XOe=e=>({bg:W("base.400","base.600")(e),h:1.5}),QOe=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.400`,`${t}.600`)(e),h:1.5}},YOe=e=>({w:e.orientation==="horizontal"?2:4,h:e.orientation==="horizontal"?4:2,bg:W("base.50","base.100")(e)}),ZOe=e=>({fontSize:"2xs",fontWeight:"500",color:W("base.700","base.400")(e),mt:2,insetInlineStart:"unset"}),JOe=WOe(e=>({container:{_disabled:{opacity:.6,cursor:"default",pointerEvents:"none"}},track:XOe(e),filledTrack:QOe(e),thumb:YOe(e),mark:ZOe(e)})),e7e=KOe({variants:{invokeAI:JOe},defaultProps:{variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:t7e,definePartsStyle:n7e}=je(bV.keys),r7e=e=>{const{colorScheme:t}=e;return{bg:W("base.300","base.600")(e),_focusVisible:{boxShadow:"none"},_checked:{bg:W(`${t}.400`,`${t}.500`)(e)}}},i7e=e=>{const{colorScheme:t}=e;return{bg:W(`${t}.50`,`${t}.50`)(e)}},o7e=n7e(e=>({container:{},track:r7e(e),thumb:i7e(e)})),a7e=t7e({variants:{invokeAI:o7e},defaultProps:{size:"md",variant:"invokeAI",colorScheme:"accent"}}),{defineMultiStyleConfig:s7e,definePartsStyle:_G}=je(_V.keys),l7e=e=>({display:"flex",columnGap:4}),u7e=e=>({}),c7e=e=>{const{colorScheme:t}=e;return{display:"flex",flexDirection:"column",gap:1,color:W("base.700","base.400")(e),button:{fontSize:"sm",padding:2,borderRadius:"base",textShadow:W("0 0 0.3rem var(--invokeai-colors-accent-100)","0 0 0.3rem var(--invokeai-colors-accent-900)")(e),svg:{fill:W("base.700","base.300")(e)},_selected:{bg:W("accent.400","accent.600")(e),color:W("base.50","base.100")(e),svg:{fill:W("base.50","base.100")(e),filter:W(`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-600))`,`drop-shadow(0px 0px 0.3rem var(--invokeai-colors-${t}-800))`)(e)},_hover:{bg:W("accent.500","accent.500")(e),color:W("white","base.50")(e),svg:{fill:W("white","base.50")(e)}}},_hover:{bg:W("base.100","base.800")(e),color:W("base.900","base.50")(e),svg:{fill:W("base.800","base.100")(e)}}}}},d7e=e=>({padding:0,height:"100%"}),f7e=_G(e=>({root:l7e(e),tab:u7e(e),tablist:c7e(e),tabpanel:d7e(e)})),h7e=_G(e=>({tab:{borderTopRadius:"base",px:4,py:1,fontSize:"sm",color:W("base.600","base.400")(e),fontWeight:500,_selected:{color:W("accent.600","accent.400")(e)}},tabpanel:{p:0,pt:4,w:"full",h:"full"},tabpanels:{w:"full",h:"full"}})),p7e=s7e({variants:{line:h7e,appTabs:f7e},defaultProps:{variant:"appTabs",colorScheme:"accent"}}),g7e=e=>({color:W("error.500","error.400")(e)}),m7e=e=>({color:W("base.500","base.400")(e)}),y7e={variants:{subtext:m7e,error:g7e}},v7e=e=>({...f2(e),"::-webkit-scrollbar":{display:"initial"},"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-50) 0%, + var(--invokeai-colors-base-50) 70%, + var(--invokeai-colors-base-200) 70%, + var(--invokeai-colors-base-200) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-50) 0%, + var(--invokeai-colors-base-50) 70%, + var(--invokeai-colors-base-200) 70%, + var(--invokeai-colors-base-200) 100%)`}},_dark:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-900) 0%, + var(--invokeai-colors-base-900) 70%, + var(--invokeai-colors-base-800) 70%, + var(--invokeai-colors-base-800) 100%)`},_disabled:{"::-webkit-resizer":{backgroundImage:`linear-gradient(135deg, + var(--invokeai-colors-base-900) 0%, + var(--invokeai-colors-base-900) 70%, + var(--invokeai-colors-base-800) 70%, + var(--invokeai-colors-base-800) 100%)`}}},p:2}),b7e={variants:{invokeAI:v7e},defaultProps:{size:"md",variant:"invokeAI"}},_7e=nn("popper-arrow-bg"),S7e=e=>({borderRadius:"base",shadow:"dark-lg",bg:W("base.700","base.200")(e),[_7e.variable]:W("colors.base.700","colors.base.200")(e),pb:1.5}),x7e={baseStyle:S7e},vR={backgroundColor:"accentAlpha.150 !important",borderColor:"accentAlpha.700 !important",borderRadius:"base !important",borderStyle:"dashed !important",_dark:{borderColor:"accent.400 !important"}},w7e={".react-flow__nodesselection-rect":{...vR,padding:"1rem !important",boxSizing:"content-box !important",transform:"translate(-1rem, -1rem) !important"},".react-flow__selection":vR},C7e={config:{cssVarPrefix:"invokeai",initialColorMode:"dark",useSystemColorMode:!1},layerStyles:{body:{bg:"base.50",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.50"}},first:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.850",color:"base.100"}},second:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},third:{bg:"base.300",color:"base.900",".chakra-ui-dark &":{bg:"base.750",color:"base.100"}},nodeBody:{bg:"base.100",color:"base.900",".chakra-ui-dark &":{bg:"base.800",color:"base.100"}},nodeHeader:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}},nodeFooter:{bg:"base.200",color:"base.900",".chakra-ui-dark &":{bg:"base.900",color:"base.100"}}},styles:{global:()=>({layerStyle:"body","*":{...FOe},...w7e})},direction:"ltr",fonts:{body:"'Inter Variable', sans-serif",heading:"'Inter Variable', sans-serif"},shadows:{light:{accent:"0 0 10px 0 var(--invokeai-colors-accent-300)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-400)",ok:"0 0 7px var(--invokeai-colors-ok-600)",working:"0 0 7px var(--invokeai-colors-working-600)",error:"0 0 7px var(--invokeai-colors-error-600)"},dark:{accent:"0 0 10px 0 var(--invokeai-colors-accent-600)",accentHover:"0 0 10px 0 var(--invokeai-colors-accent-500)",ok:"0 0 7px var(--invokeai-colors-ok-400)",working:"0 0 7px var(--invokeai-colors-working-400)",error:"0 0 7px var(--invokeai-colors-error-400)"},selected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-400)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-500)"},hoverSelected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 4px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 4px var(--invokeai-colors-accent-400)"},hoverUnselected:{light:"0px 0px 0px 1px var(--invokeai-colors-base-150), 0px 0px 0px 3px var(--invokeai-colors-accent-500)",dark:"0px 0px 0px 1px var(--invokeai-colors-base-900), 0px 0px 0px 3px var(--invokeai-colors-accent-400)"},nodeSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-400)",dark:"0 0 0 3px var(--invokeai-colors-accent-500)"},nodeHovered:{light:"0 0 0 2px var(--invokeai-colors-accent-500)",dark:"0 0 0 2px var(--invokeai-colors-accent-400)"},nodeHoveredSelected:{light:"0 0 0 3px var(--invokeai-colors-accent-500)",dark:"0 0 0 3px var(--invokeai-colors-accent-400)"},nodeInProgress:{light:"0 0 0 2px var(--invokeai-colors-accent-500), 0 0 10px 2px var(--invokeai-colors-accent-600)",dark:"0 0 0 2px var(--invokeai-colors-yellow-400), 0 0 20px 2px var(--invokeai-colors-orange-700)"}},colors:TRe,components:{Button:FRe,Input:nOe,Editable:QRe,Textarea:b7e,Tabs:p7e,Progress:LOe,Accordion:NRe,FormLabel:ZRe,Switch:a7e,NumberInput:EOe,Select:GOe,Skeleton:qOe,Slider:e7e,Popover:MOe,Modal:yOe,Checkbox:URe,Menu:aOe,Text:y7e,Tooltip:x7e}},E7e={defaultOptions:{isClosable:!0}},{toast:Ph}=SRe({theme:C7e,defaultOptions:E7e.defaultOptions}),A7e=()=>{pe({matcher:ln.endpoints.enqueueBatch.matchFulfilled,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;le("queue").debug({enqueueResult:ft(t)},"Batch enqueued"),Ph.isActive("batch-queued")||Ph({id:"batch-queued",title:K("queue.batchQueued"),description:K("queue.batchQueuedDesc",{count:t.enqueued,direction:n.prepend?K("queue.front"):K("queue.back")}),duration:1e3,status:"success"})}}),pe({matcher:ln.endpoints.enqueueBatch.matchRejected,effect:async e=>{const t=e.payload,n=e.meta.arg.originalArgs;if(!t){Ph({title:K("queue.batchFailedToQueue"),status:"error",description:"Unknown Error"}),le("queue").error({batchConfig:ft(n),error:ft(t)},K("queue.batchFailedToQueue"));return}const r=ARe.safeParse(t);if(r.success)r.data.data.detail.map(i=>{Ph({id:"batch-failed-to-queue",title:Xk(MN(i.msg),{length:128}),status:"error",description:Xk(`Path: + ${i.loc.join(".")}`,{length:128})})});else{let i="Unknown Error",o;t.status===403&&"body"in t?i=Ny(t,"body.detail","Unknown Error"):t.status===403&&"error"in t?i=Ny(t,"error.detail","Unknown Error"):t.status===403&&"data"in t&&(i=Ny(t,"data.detail","Unknown Error"),o=15e3),Ph({title:K("queue.batchFailedToQueue"),status:"error",description:i,...o?{duration:o}:{}})}le("queue").error({batchConfig:ft(n),error:ft(t)},K("queue.batchFailedToQueue"))}})};function T3(e){"@babel/helpers - typeof";return T3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},T3(e)}var SG=[],T7e=SG.forEach,P7e=SG.slice;function P3(e){return T7e.call(P7e.call(arguments,1),function(t){if(t)for(var n in t)e[n]===void 0&&(e[n]=t[n])}),e}function xG(){return typeof XMLHttpRequest=="function"||(typeof XMLHttpRequest>"u"?"undefined":T3(XMLHttpRequest))==="object"}function k7e(e){return!!e&&typeof e.then=="function"}function I7e(e){return k7e(e)?e:Promise.resolve(e)}function M7e(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var k3={exports:{}},py={exports:{}},bR;function R7e(){return bR||(bR=1,function(e,t){var n=typeof self<"u"?self:Ve,r=function(){function o(){this.fetch=!1,this.DOMException=n.DOMException}return o.prototype=n,new o}();(function(o){(function(a){var s={searchParams:"URLSearchParams"in o,iterable:"Symbol"in o&&"iterator"in Symbol,blob:"FileReader"in o&&"Blob"in o&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in o,arrayBuffer:"ArrayBuffer"in o};function l(E){return E&&DataView.prototype.isPrototypeOf(E)}if(s.arrayBuffer)var u=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(E){return E&&u.indexOf(Object.prototype.toString.call(E))>-1};function d(E){if(typeof E!="string"&&(E=String(E)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(E))throw new TypeError("Invalid character in header field name");return E.toLowerCase()}function f(E){return typeof E!="string"&&(E=String(E)),E}function h(E){var P={next:function(){var N=E.shift();return{done:N===void 0,value:N}}};return s.iterable&&(P[Symbol.iterator]=function(){return P}),P}function p(E){this.map={},E instanceof p?E.forEach(function(P,N){this.append(N,P)},this):Array.isArray(E)?E.forEach(function(P){this.append(P[0],P[1])},this):E&&Object.getOwnPropertyNames(E).forEach(function(P){this.append(P,E[P])},this)}p.prototype.append=function(E,P){E=d(E),P=f(P);var N=this.map[E];this.map[E]=N?N+", "+P:P},p.prototype.delete=function(E){delete this.map[d(E)]},p.prototype.get=function(E){return E=d(E),this.has(E)?this.map[E]:null},p.prototype.has=function(E){return this.map.hasOwnProperty(d(E))},p.prototype.set=function(E,P){this.map[d(E)]=f(P)},p.prototype.forEach=function(E,P){for(var N in this.map)this.map.hasOwnProperty(N)&&E.call(P,this.map[N],N,this)},p.prototype.keys=function(){var E=[];return this.forEach(function(P,N){E.push(N)}),h(E)},p.prototype.values=function(){var E=[];return this.forEach(function(P){E.push(P)}),h(E)},p.prototype.entries=function(){var E=[];return this.forEach(function(P,N){E.push([N,P])}),h(E)},s.iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);function m(E){if(E.bodyUsed)return Promise.reject(new TypeError("Already read"));E.bodyUsed=!0}function _(E){return new Promise(function(P,N){E.onload=function(){P(E.result)},E.onerror=function(){N(E.error)}})}function v(E){var P=new FileReader,N=_(P);return P.readAsArrayBuffer(E),N}function y(E){var P=new FileReader,N=_(P);return P.readAsText(E),N}function g(E){for(var P=new Uint8Array(E),N=new Array(P.length),L=0;L-1?P:E}function C(E,P){P=P||{};var N=P.body;if(E instanceof C){if(E.bodyUsed)throw new TypeError("Already read");this.url=E.url,this.credentials=E.credentials,P.headers||(this.headers=new p(E.headers)),this.method=E.method,this.mode=E.mode,this.signal=E.signal,!N&&E._bodyInit!=null&&(N=E._bodyInit,E.bodyUsed=!0)}else this.url=String(E);if(this.credentials=P.credentials||this.credentials||"same-origin",(P.headers||!this.headers)&&(this.headers=new p(P.headers)),this.method=w(P.method||this.method||"GET"),this.mode=P.mode||this.mode||null,this.signal=P.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&N)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(N)}C.prototype.clone=function(){return new C(this,{body:this._bodyInit})};function T(E){var P=new FormData;return E.trim().split("&").forEach(function(N){if(N){var L=N.split("="),O=L.shift().replace(/\+/g," "),R=L.join("=").replace(/\+/g," ");P.append(decodeURIComponent(O),decodeURIComponent(R))}}),P}function A(E){var P=new p,N=E.replace(/\r?\n[\t ]+/g," ");return N.split(/\r?\n/).forEach(function(L){var O=L.split(":"),R=O.shift().trim();if(R){var $=O.join(":").trim();P.append(R,$)}}),P}S.call(C.prototype);function k(E,P){P||(P={}),this.type="default",this.status=P.status===void 0?200:P.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in P?P.statusText:"OK",this.headers=new p(P.headers),this.url=P.url||"",this._initBody(E)}S.call(k.prototype),k.prototype.clone=function(){return new k(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},k.error=function(){var E=new k(null,{status:0,statusText:""});return E.type="error",E};var D=[301,302,303,307,308];k.redirect=function(E,P){if(D.indexOf(P)===-1)throw new RangeError("Invalid status code");return new k(null,{status:P,headers:{location:E}})},a.DOMException=o.DOMException;try{new a.DOMException}catch{a.DOMException=function(P,N){this.message=P,this.name=N;var L=Error(P);this.stack=L.stack},a.DOMException.prototype=Object.create(Error.prototype),a.DOMException.prototype.constructor=a.DOMException}function M(E,P){return new Promise(function(N,L){var O=new C(E,P);if(O.signal&&O.signal.aborted)return L(new a.DOMException("Aborted","AbortError"));var R=new XMLHttpRequest;function $(){R.abort()}R.onload=function(){var z={status:R.status,statusText:R.statusText,headers:A(R.getAllResponseHeaders()||"")};z.url="responseURL"in R?R.responseURL:z.headers.get("X-Request-URL");var V="response"in R?R.response:R.responseText;N(new k(V,z))},R.onerror=function(){L(new TypeError("Network request failed"))},R.ontimeout=function(){L(new TypeError("Network request failed"))},R.onabort=function(){L(new a.DOMException("Aborted","AbortError"))},R.open(O.method,O.url,!0),O.credentials==="include"?R.withCredentials=!0:O.credentials==="omit"&&(R.withCredentials=!1),"responseType"in R&&s.blob&&(R.responseType="blob"),O.headers.forEach(function(z,V){R.setRequestHeader(V,z)}),O.signal&&(O.signal.addEventListener("abort",$),R.onreadystatechange=function(){R.readyState===4&&O.signal.removeEventListener("abort",$)}),R.send(typeof O._bodyInit>"u"?null:O._bodyInit)})}return M.polyfill=!0,o.fetch||(o.fetch=M,o.Headers=p,o.Request=C,o.Response=k),a.Headers=p,a.Request=C,a.Response=k,a.fetch=M,Object.defineProperty(a,"__esModule",{value:!0}),a})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;t=i.fetch,t.default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t}(py,py.exports)),py.exports}(function(e,t){var n;if(typeof fetch=="function"&&(typeof Ve<"u"&&Ve.fetch?n=Ve.fetch:typeof window<"u"&&window.fetch?n=window.fetch:n=fetch),typeof M7e<"u"&&(typeof window>"u"||typeof window.document>"u")){var r=n||R7e();r.default&&(r=r.default),t.default=r,e.exports=t.default}})(k3,k3.exports);var wG=k3.exports;const CG=Nl(wG),_R=ZR({__proto__:null,default:CG},[wG]);function ob(e){"@babel/helpers - typeof";return ob=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ob(e)}var ss;typeof fetch=="function"&&(typeof global<"u"&&global.fetch?ss=global.fetch:typeof window<"u"&&window.fetch?ss=window.fetch:ss=fetch);var zg;xG()&&(typeof global<"u"&&global.XMLHttpRequest?zg=global.XMLHttpRequest:typeof window<"u"&&window.XMLHttpRequest&&(zg=window.XMLHttpRequest));var ab;typeof ActiveXObject=="function"&&(typeof global<"u"&&global.ActiveXObject?ab=global.ActiveXObject:typeof window<"u"&&window.ActiveXObject&&(ab=window.ActiveXObject));!ss&&_R&&!zg&&!ab&&(ss=CG||_R);typeof ss!="function"&&(ss=void 0);var I3=function(t,n){if(n&&ob(n)==="object"){var r="";for(var i in n)r+="&"+encodeURIComponent(i)+"="+encodeURIComponent(n[i]);if(!r)return t;t=t+(t.indexOf("?")!==-1?"&":"?")+r.slice(1)}return t},SR=function(t,n,r){ss(t,n).then(function(i){if(!i.ok)return r(i.statusText||"Error",{status:i.status});i.text().then(function(o){r(null,{status:i.status,data:o})}).catch(r)}).catch(r)},xR=!1,O7e=function(t,n,r,i){t.queryStringParams&&(n=I3(n,t.queryStringParams));var o=P3({},typeof t.customHeaders=="function"?t.customHeaders():t.customHeaders);r&&(o["Content-Type"]="application/json");var a=typeof t.requestOptions=="function"?t.requestOptions(r):t.requestOptions,s=P3({method:r?"POST":"GET",body:r?t.stringify(r):void 0,headers:o},xR?{}:a);try{SR(n,s,i)}catch(l){if(!a||Object.keys(a).length===0||!l.message||l.message.indexOf("not implemented")<0)return i(l);try{Object.keys(a).forEach(function(u){delete s[u]}),SR(n,s,i),xR=!0}catch(u){i(u)}}},$7e=function(t,n,r,i){r&&ob(r)==="object"&&(r=I3("",r).slice(1)),t.queryStringParams&&(n=I3(n,t.queryStringParams));try{var o;zg?o=new zg:o=new ab("MSXML2.XMLHTTP.3.0"),o.open(r?"POST":"GET",n,1),t.crossDomain||o.setRequestHeader("X-Requested-With","XMLHttpRequest"),o.withCredentials=!!t.withCredentials,r&&o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.overrideMimeType&&o.overrideMimeType("application/json");var a=t.customHeaders;if(a=typeof a=="function"?a():a,a)for(var s in a)o.setRequestHeader(s,a[s]);o.onreadystatechange=function(){o.readyState>3&&i(o.status>=400?o.statusText:null,{status:o.status,data:o.responseText})},o.send(r)}catch(l){console&&console.log(l)}},N7e=function(t,n,r,i){if(typeof r=="function"&&(i=r,r=void 0),i=i||function(){},ss&&n.indexOf("file:")!==0)return O7e(t,n,r,i);if(xG()||typeof ActiveXObject=="function")return $7e(t,n,r,i);i(new Error("No fetch and no xhr implementation found!"))};function jg(e){"@babel/helpers - typeof";return jg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jg(e)}function D7e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wR(e,t){for(var n=0;n1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};D7e(this,e),this.services=t,this.options=n,this.allOptions=r,this.type="backend",this.init(t,n,r)}return L7e(e,[{key:"init",value:function(n){var r=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};this.services=n,this.options=P3(i,this.options||{},z7e()),this.allOptions=o,this.services&&this.options.reloadInterval&&setInterval(function(){return r.reload()},this.options.reloadInterval)}},{key:"readMulti",value:function(n,r,i){this._readAny(n,n,r,r,i)}},{key:"read",value:function(n,r,i){this._readAny([n],n,[r],r,i)}},{key:"_readAny",value:function(n,r,i,o,a){var s=this,l=this.options.loadPath;typeof this.options.loadPath=="function"&&(l=this.options.loadPath(n,i)),l=I7e(l),l.then(function(u){if(!u)return a(null,{});var c=s.services.interpolator.interpolate(u,{lng:n.join("+"),ns:i.join("+")});s.loadUrl(c,a,r,o)})}},{key:"loadUrl",value:function(n,r,i,o){var a=this,s=typeof i=="string"?[i]:i,l=typeof o=="string"?[o]:o,u=this.options.parseLoadPayload(s,l);this.options.request(this.options,n,u,function(c,d){if(d&&(d.status>=500&&d.status<600||!d.status))return r("failed loading "+n+"; status code: "+d.status,!0);if(d&&d.status>=400&&d.status<500)return r("failed loading "+n+"; status code: "+d.status,!1);if(!d&&c&&c.message&&c.message.indexOf("Failed to fetch")>-1)return r("failed loading "+n+": "+c.message,!0);if(c)return r(c,!1);var f,h;try{typeof d.data=="string"?f=a.options.parse(d.data,i,o):f=d.data}catch{h="failed parsing "+n+" to json"}if(h)return r(h,!1);r(null,f)})}},{key:"create",value:function(n,r,i,o,a){var s=this;if(this.options.addPath){typeof n=="string"&&(n=[n]);var l=this.options.parsePayload(r,i,o),u=0,c=[],d=[];n.forEach(function(f){var h=s.options.addPath;typeof s.options.addPath=="function"&&(h=s.options.addPath(f,r));var p=s.services.interpolator.interpolate(h,{lng:f,ns:r});s.options.request(s.options,p,l,function(m,_){u+=1,c.push(m),d.push(_),u===n.length&&typeof a=="function"&&a(c,d)})})}}},{key:"reload",value:function(){var n=this,r=this.services,i=r.backendConnector,o=r.languageUtils,a=r.logger,s=i.language;if(!(s&&s.toLowerCase()==="cimode")){var l=[],u=function(d){var f=o.toResolveHierarchy(d);f.forEach(function(h){l.indexOf(h)<0&&l.push(h)})};u(s),this.allOptions.preload&&this.allOptions.preload.forEach(function(c){return u(c)}),l.forEach(function(c){n.allOptions.ns.forEach(function(d){i.read(c,d,"read",null,null,function(f,h){f&&a.warn("loading namespace ".concat(d," for language ").concat(c," failed"),f),!f&&h&&a.log("loaded namespace ".concat(d," for language ").concat(c),h),i.loaded("".concat(c,"|").concat(d),f,h)})})})}}}]),e}();AG.type="backend";oe.use(AG).use(mCe).init({fallbackLng:"en",debug:!1,backend:{loadPath:"/locales/{{lng}}.json"},interpolation:{escapeValue:!1},returnNull:!1});const j7e=Br(yE,bE,vE,hm),V7e=()=>{pe({matcher:j7e,effect:async(e,{dispatch:t,getOriginalState:n})=>{var s;const r=n().controlAdapters,i=Xi(r).some(l=>l.isEnabled&&l.type==="controlnet"),o=Xi(r).some(l=>l.isEnabled&&l.type==="t2i_adapter");let a=null;if(yE.match(e)&&(a=e.payload.type),bE.match(e)&&(a=e.payload.type),vE.match(e)&&(a=e.payload.type),hm.match(e)){const l=(s=Tr(r,e.payload.id))==null?void 0:s.type;if(!l)return;a=l}if(a==="controlnet"&&o||a==="t2i_adapter"&&i){const l=a==="controlnet"?oe.t("controlnet.controlNetEnabledT2IDisabled"):oe.t("controlnet.t2iEnabledControlNetDisabled"),u=oe.t("controlnet.controlNetT2IMutexDesc");t(nt({title:l,description:u,status:"warning"}))}}})},TG=Z$(),pe=TG.startListening;hxe();pxe();bxe();ixe();oxe();axe();sxe();lxe();e1e();fxe();gxe();mxe();B2e();txe();q2e();Xve();A7e();S2e();y2e();m1e();v2e();g1e();h1e();_2e();eCe();Wve();Vwe();Uwe();Hwe();qwe();Kwe();zwe();jwe();Zwe();Jwe();Xwe();Ywe();Wwe();Qwe();C2e();w2e();nxe();rxe();cxe();dxe();t1e();Bwe();RCe();uxe();_xe();Zve();xxe();Qve();Kve();ECe();nCe();Exe();V7e();const U7e={canvas:sle,gallery:sfe,generation:Doe,nodes:Fye,postprocessing:Bye,system:qye,config:Are,ui:Yye,hotkeys:Qye,controlAdapters:pie,dynamicPrompts:ble,deleteImageModal:fle,changeBoardModal:ule,lora:cfe,modelmanager:Xye,sdxl:jye,queue:Xoe,[Do.reducerPath]:Do.reducer},G7e=Pf(U7e),H7e=xve(G7e),q7e=["canvas","gallery","generation","sdxl","nodes","postprocessing","system","ui","controlAdapters","dynamicPrompts","lora","modelmanager"],PG=R$({reducer:H7e,enhancers:e=>e.concat(wve(window.localStorage,q7e,{persistDebounce:300,serialize:Nve,unserialize:Lve,prefix:Cve})).concat(eN()),middleware:e=>e({serializableCheck:!1,immutableCheck:!1}).concat(Do.middleware).concat(tve).prepend(TG.middleware),devTools:{actionSanitizer:Uve,stateSanitizer:Hve,trace:!0,predicate:(e,t)=>!Gve.includes(t.type)}}),kG=e=>e;xF.set(PG);const W7e=e=>{const{socket:t,storeApi:n}=e,{dispatch:r}=n;t.on("connect",()=>{le("socketio").debug("Connected"),r(xD());const o=Nn.get();t.emit("subscribe_queue",{queue_id:o})}),t.on("connect_error",i=>{i&&i.message&&i.data==="ERR_UNAUTHENTICATED"&&r(nt(tc({title:i.message,status:"error",duration:1e4})))}),t.on("disconnect",()=>{r(wD())}),t.on("invocation_started",i=>{r(ED({data:i}))}),t.on("generator_progress",i=>{r(kD({data:i}))}),t.on("invocation_error",i=>{r(AD({data:i}))}),t.on("invocation_complete",i=>{r(dE({data:i}))}),t.on("graph_execution_state_complete",i=>{r(TD({data:i}))}),t.on("model_load_started",i=>{r(ID({data:i}))}),t.on("model_load_completed",i=>{r(RD({data:i}))}),t.on("session_retrieval_error",i=>{r($D({data:i}))}),t.on("invocation_retrieval_error",i=>{r(DD({data:i}))}),t.on("queue_item_status_changed",i=>{r(FD({data:i}))})},Ca=Object.create(null);Ca.open="0";Ca.close="1";Ca.ping="2";Ca.pong="3";Ca.message="4";Ca.upgrade="5";Ca.noop="6";const lv=Object.create(null);Object.keys(Ca).forEach(e=>{lv[Ca[e]]=e});const M3={type:"error",data:"parser error"},IG=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",MG=typeof ArrayBuffer=="function",RG=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,yT=({type:e,data:t},n,r)=>IG&&t instanceof Blob?n?r(t):CR(t,r):MG&&(t instanceof ArrayBuffer||RG(t))?n?r(t):CR(new Blob([t]),r):r(Ca[e]+(t||"")),CR=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function ER(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Bw;function K7e(e,t){if(IG&&e.data instanceof Blob)return e.data.arrayBuffer().then(ER).then(t);if(MG&&(e.data instanceof ArrayBuffer||RG(e.data)))return t(ER(e.data));yT(e,!1,n=>{Bw||(Bw=new TextEncoder),t(Bw.encode(n))})}const AR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wh=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e{let t=e.length*.75,n=e.length,r,i=0,o,a,s,l;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const u=new ArrayBuffer(t),c=new Uint8Array(u);for(r=0;r>4,c[i++]=(a&15)<<4|s>>2,c[i++]=(s&3)<<6|l&63;return u},Q7e=typeof ArrayBuffer=="function",vT=(e,t)=>{if(typeof e!="string")return{type:"message",data:OG(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Y7e(e.substring(1),t)}:lv[n]?e.length>1?{type:lv[n],data:e.substring(1)}:{type:lv[n]}:M3},Y7e=(e,t)=>{if(Q7e){const n=X7e(e);return OG(n,t)}else return{base64:!0,data:e}},OG=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},$G=String.fromCharCode(30),Z7e=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{yT(o,!1,s=>{r[a]=s,++i===n&&t(r.join($G))})})},J7e=(e,t)=>{const n=e.split($G),r=[];for(let i=0;i{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let zw;function gy(e){return e.reduce((t,n)=>t+n.length,0)}function my(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;iMath.pow(2,53-32)-1){s.enqueue(M3);break}i=c*Math.pow(2,32)+u.getUint32(4),r=3}else{if(gy(n)e){s.enqueue(M3);break}}}})}const NG=4;function wn(e){if(e)return n$e(e)}function n$e(e){for(var t in wn.prototype)e[t]=wn.prototype[t];return e}wn.prototype.on=wn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};wn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this};wn.prototype.off=wn.prototype.removeListener=wn.prototype.removeAllListeners=wn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;itypeof self<"u"?self:typeof window<"u"?window:Function("return this")())();function DG(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const r$e=Vi.setTimeout,i$e=Vi.clearTimeout;function h2(e,t){t.useNativeTimers?(e.setTimeoutFn=r$e.bind(Vi),e.clearTimeoutFn=i$e.bind(Vi)):(e.setTimeoutFn=Vi.setTimeout.bind(Vi),e.clearTimeoutFn=Vi.clearTimeout.bind(Vi))}const o$e=1.33;function a$e(e){return typeof e=="string"?s$e(e):Math.ceil((e.byteLength||e.size)*o$e)}function s$e(e){let t=0,n=0;for(let r=0,i=e.length;r=57344?n+=3:(r++,n+=4);return n}function l$e(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function u$e(e){let t={},n=e.split("&");for(let r=0,i=n.length;r0);return t}function FG(){const e=kR(+new Date);return e!==PR?(TR=0,PR=e):e+"."+kR(TR++)}for(;yy{this.readyState="paused",t()};if(this.polling||!this.writable){let r=0;this.polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};J7e(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Z7e(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=FG()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}request(t={}){return Object.assign(t,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new Ud(this.uri(),t)}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}let Ud=class uv extends wn{constructor(t,n){super(),h2(this,n),this.opts=n,this.method=n.method||"GET",this.uri=t,this.data=n.data!==void 0?n.data:null,this.create()}create(){var t;const n=DG(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this.opts.xd;const r=this.xhr=new zG(n);try{r.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this.opts.extraHeaders[i])}}catch{}if(this.method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this.opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(r.timeout=this.opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this.opts.cookieJar)===null||i===void 0||i.parseCookies(r)),r.readyState===4&&(r.status===200||r.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof r.status=="number"?r.status:0)},0))},r.send(this.data)}catch(i){this.setTimeoutFn(()=>{this.onError(i)},0);return}typeof document<"u"&&(this.index=uv.requestsCount++,uv.requests[this.index]=this)}onError(t){this.emitReserved("error",t,this.xhr),this.cleanup(!0)}cleanup(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=h$e,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete uv.requests[this.index],this.xhr=null}}onLoad(){const t=this.xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}};Ud.requestsCount=0;Ud.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",IR);else if(typeof addEventListener=="function"){const e="onpagehide"in Vi?"pagehide":"unload";addEventListener(e,IR,!1)}}function IR(){for(let e in Ud.requests)Ud.requests.hasOwnProperty(e)&&Ud.requests[e].abort()}const _T=(()=>typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0))(),vy=Vi.WebSocket||Vi.MozWebSocket,MR=!0,m$e="arraybuffer",RR=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class y$e extends bT{constructor(t){super(t),this.supportsBinary=!t.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const t=this.uri(),n=this.opts.protocols,r=RR?{}:DG(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=MR&&!RR?n?new vy(t,n):new vy(t):new vy(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n{const a={};try{MR&&this.ws.send(o)}catch{}i&&_T(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=FG()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}check(){return!!vy}}class v$e extends bT{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(t=>{const n=t$e(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=e$e();i.readable.pipeTo(t.writable),this.writer=i.writable.getWriter();const o=()=>{r.read().then(({done:s,value:l})=>{s||(this.onPacket(l),o())}).catch(s=>{})};o();const a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this.writer.write(a).then(()=>this.onOpen())})}))}write(t){this.writable=!1;for(let n=0;n{i&&_T(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this.transport)===null||t===void 0||t.close()}}const b$e={websocket:y$e,webtransport:v$e,polling:g$e},_$e=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,S$e=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function O3(e){const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=_$e.exec(e||""),o={},a=14;for(;a--;)o[S$e[a]]=i[a]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=x$e(o,o.path),o.queryKey=w$e(o,o.query),o}function x$e(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function w$e(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}let jG=class Gc extends wn{constructor(t,n={}){super(),this.binaryType=m$e,this.writeBuffer=[],t&&typeof t=="object"&&(n=t,t=null),t?(t=O3(t),n.hostname=t.host,n.secure=t.protocol==="https"||t.protocol==="wss",n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=O3(n.host).host),h2(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=n.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=u$e(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=NG,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new b$e[t](r)}open(){let t;if(this.opts.rememberUpgrade&&Gc.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",n=>this.onClose("transport close",n))}probe(t){let n=this.createTransport(t),r=!1;Gc.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",d=>{if(!r)if(d.type==="pong"&&d.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Gc.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(c(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const f=new Error("probe error");f.transport=n.name,this.emitReserved("upgradeError",f)}}))};function o(){r||(r=!0,c(),n.close(),n=null)}const a=d=>{const f=new Error("probe error: "+d);f.transport=n.name,o(),this.emitReserved("upgradeError",f)};function s(){a("transport closed")}function l(){a("socket closed")}function u(d){n&&d.name!==n.name&&o()}const c=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",s),this.off("close",l),this.off("upgrading",u)};n.once("open",i),n.once("error",a),n.once("close",s),this.once("close",l),this.once("upgrading",u),this.upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onOpen(){if(this.readyState="open",Gc.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let t=0;const n=this.upgrades.length;for(;t{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this.getWritablePackets();this.transport.send(t),this.prevBufferLen=t.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r0&&n>this.maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}write(t,n,r){return this.sendPacket("message",t,n,r),this}send(t,n,r){return this.sendPacket("message",t,n,r),this}sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this.onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}onError(t){Gc.priorWebsocketSuccess=!1,this.emitReserved("error",t),this.onClose("transport error",t)}onClose(t,n){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(t){const n=[];let r=0;const i=t.length;for(;rtypeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,VG=Object.prototype.toString,T$e=typeof Blob=="function"||typeof Blob<"u"&&VG.call(Blob)==="[object BlobConstructor]",P$e=typeof File=="function"||typeof File<"u"&&VG.call(File)==="[object FileConstructor]";function ST(e){return E$e&&(e instanceof ArrayBuffer||A$e(e))||T$e&&e instanceof Blob||P$e&&e instanceof File}function cv(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n=0&&e.num{delete this.acks[t];for(let a=0;a{this.io.clearTimeoutFn(o),n.apply(this,[null,...a])}}emitWithAck(t,...n){const r=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((i,o)=>{n.push((a,s)=>r?a?o(a):i(s):i(a)),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:Ye.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n)}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case Ye.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ye.EVENT:case Ye.BINARY_EVENT:this.onevent(t);break;case Ye.ACK:case Ye.BINARY_ACK:this.onack(t);break;case Ye.DISCONNECT:this.ondisconnect();break;case Ye.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:Ye.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(n.apply(this,t.data),delete this.acks[t.id])}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ye.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r0&&e.jitter<=1?e.jitter:0,this.attempts=0}Uf.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0};Uf.prototype.reset=function(){this.attempts=0};Uf.prototype.setMin=function(e){this.ms=e};Uf.prototype.setMax=function(e){this.max=e};Uf.prototype.setJitter=function(e){this.jitter=e};class D3 extends wn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,h2(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Uf({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||N$e;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new jG(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=vo(n,"open",function(){r.onopen(),t&&t()}),o=s=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",s),t?t(s):this.maybeReconnectOnOpen()},a=vo(n,"error",o);if(this._timeout!==!1){const s=this._timeout,l=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},s);this.opts.autoUnref&&l.unref(),this.subs.push(()=>{this.clearTimeoutFn(l)})}return this.subs.push(i),this.subs.push(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(vo(t,"ping",this.onping.bind(this)),vo(t,"data",this.ondata.bind(this)),vo(t,"error",this.onerror.bind(this)),vo(t,"close",this.onclose.bind(this)),vo(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){_T(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new UG(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;rt()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(t,n){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const kh={};function dv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=C$e(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=kh[i]&&o in kh[i].nsps,s=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let l;return s?l=new D3(r,t):(kh[i]||(kh[i]=new D3(r,t)),l=kh[i]),n.query&&!t.query&&(t.query=n.queryKey),l.socket(n.path,t)}Object.assign(dv,{Manager:D3,Socket:UG,io:dv,connect:dv});const $R=()=>{let e=!1,n=`${window.location.protocol==="https:"?"wss":"ws"}://${window.location.host}`;const r={timeout:6e4,path:"/ws/socket.io",autoConnect:!1};if(["nodes","package"].includes("production")){const a=dg.get();a&&(n=a.replace(/^https?\:\/\//i,""));const s=cg.get();s&&(r.auth={token:s}),r.transports=["websocket","polling"]}const i=dv(n,r);return a=>s=>l=>{e||(W7e({storeApi:a,socket:i}),e=!0,i.connect()),s(l)}},L$e=""+new URL("logo-13003d72.png",import.meta.url).href,F$e=()=>q.jsxs(mT,{position:"relative",width:"100vw",height:"100vh",alignItems:"center",justifyContent:"center",bg:"#151519",children:[q.jsx(gT,{src:L$e,w:"8rem",h:"8rem"}),q.jsx(fT,{label:"Loading",color:"grey",position:"absolute",size:"sm",width:"24px !important",height:"24px !important",right:"1.5rem",bottom:"1.5rem"})]}),B$e=I.memo(F$e),p2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Gf(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function wT(e){return"nodeType"in e}function jr(e){var t,n;return e?Gf(e)?e:wT(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function CT(e){const{Document:t}=jr(e);return e instanceof t}function jm(e){return Gf(e)?!1:e instanceof jr(e).HTMLElement}function z$e(e){return e instanceof jr(e).SVGElement}function Hf(e){return e?Gf(e)?e.document:wT(e)?CT(e)?e:jm(e)?e.ownerDocument:document:document:document}const Ea=p2?I.useLayoutEffect:I.useEffect;function g2(e){const t=I.useRef(e);return Ea(()=>{t.current=e}),I.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i{e.current=setInterval(r,i)},[]),n=I.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Vg(e,t){t===void 0&&(t=[e]);const n=I.useRef(e);return Ea(()=>{n.current!==e&&(n.current=e)},t),n}function Vm(e,t){const n=I.useRef();return I.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function sb(e){const t=g2(e),n=I.useRef(null),r=I.useCallback(i=>{i!==n.current&&(t==null||t(i,n.current)),n.current=i},[]);return[n,r]}function lb(e){const t=I.useRef();return I.useEffect(()=>{t.current=e},[e]),t.current}let jw={};function m2(e,t){return I.useMemo(()=>{if(t)return t;const n=jw[e]==null?0:jw[e]+1;return jw[e]=n,e+"-"+n},[e,t])}function GG(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i{const s=Object.entries(a);for(const[l,u]of s){const c=o[l];c!=null&&(o[l]=c+e*u)}return o},{...t})}}const Gd=GG(1),ub=GG(-1);function V$e(e){return"clientX"in e&&"clientY"in e}function ET(e){if(!e)return!1;const{KeyboardEvent:t}=jr(e.target);return t&&e instanceof t}function U$e(e){if(!e)return!1;const{TouchEvent:t}=jr(e.target);return t&&e instanceof t}function Ug(e){if(U$e(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return V$e(e)?{x:e.clientX,y:e.clientY}:null}const Gg=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Gg.Translate.toString(e),Gg.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),NR="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function G$e(e){return e.matches(NR)?e:e.querySelector(NR)}const H$e={display:"none"};function q$e(e){let{id:t,value:n}=e;return bt.createElement("div",{id:t,style:H$e},n)}const W$e={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};function K$e(e){let{id:t,announcement:n}=e;return bt.createElement("div",{id:t,style:W$e,role:"status","aria-live":"assertive","aria-atomic":!0},n)}function X$e(){const[e,t]=I.useState("");return{announce:I.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const HG=I.createContext(null);function Q$e(e){const t=I.useContext(HG);I.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function Y$e(){const[e]=I.useState(()=>new Set),t=I.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[I.useCallback(r=>{let{type:i,event:o}=r;e.forEach(a=>{var s;return(s=a[i])==null?void 0:s.call(a,o)})},[e]),t]}const Z$e={draggable:` + To pick up a draggable item, press the space bar. + While dragging, use the arrow keys to move the item. + Press space again to drop the item in its new position, or press escape to cancel. + `},J$e={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function eNe(e){let{announcements:t=J$e,container:n,hiddenTextDescribedById:r,screenReaderInstructions:i=Z$e}=e;const{announce:o,announcement:a}=X$e(),s=m2("DndLiveRegion"),[l,u]=I.useState(!1);if(I.useEffect(()=>{u(!0)},[]),Q$e(I.useMemo(()=>({onDragStart(d){let{active:f}=d;o(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:h}=d;t.onDragMove&&o(t.onDragMove({active:f,over:h}))},onDragOver(d){let{active:f,over:h}=d;o(t.onDragOver({active:f,over:h}))},onDragEnd(d){let{active:f,over:h}=d;o(t.onDragEnd({active:f,over:h}))},onDragCancel(d){let{active:f,over:h}=d;o(t.onDragCancel({active:f,over:h}))}}),[o,t])),!l)return null;const c=bt.createElement(bt.Fragment,null,bt.createElement(q$e,{id:r,value:i.draggable}),bt.createElement(K$e,{id:s,announcement:a}));return n?hi.createPortal(c,n):c}var Pn;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Pn||(Pn={}));function cb(){}function DR(e,t){return I.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function tNe(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(r=>r!=null),[...t])}const Fo=Object.freeze({x:0,y:0});function nNe(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function rNe(e,t){const n=Ug(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function iNe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return n-r}function oNe(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function aNe(e){let{left:t,top:n,height:r,width:i}=e;return[{x:t,y:n},{x:t+i,y:n},{x:t,y:n+r},{x:t+i,y:n+r}]}function sNe(e,t){if(!e||e.length===0)return null;const[n]=e;return t?n[t]:n}function lNe(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),i=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),a=i-r,s=o-n;if(r{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const i=[];for(const o of r){const{id:a}=o,s=n.get(a);if(s){const l=lNe(s,t);l>0&&i.push({id:a,data:{droppableContainer:o,value:l}})}}return i.sort(oNe)};function cNe(e,t){const{top:n,left:r,bottom:i,right:o}=t;return n<=e.y&&e.y<=i&&r<=e.x&&e.x<=o}const dNe=e=>{let{droppableContainers:t,droppableRects:n,pointerCoordinates:r}=e;if(!r)return[];const i=[];for(const o of t){const{id:a}=o,s=n.get(a);if(s&&cNe(r,s)){const u=aNe(s).reduce((d,f)=>d+nNe(r,f),0),c=Number((u/4).toFixed(4));i.push({id:a,data:{droppableContainer:o,value:c}})}}return i.sort(iNe)};function fNe(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function qG(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:Fo}function hNe(e){return function(n){for(var r=arguments.length,i=new Array(r>1?r-1:0),o=1;o({...a,top:a.top+e*s.y,bottom:a.bottom+e*s.y,left:a.left+e*s.x,right:a.right+e*s.x}),{...n})}}const pNe=hNe(1);function WG(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function gNe(e,t,n){const r=WG(t);if(!r)return e;const{scaleX:i,scaleY:o,x:a,y:s}=r,l=e.left-a-(1-i)*parseFloat(n),u=e.top-s-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),c=i?e.width/i:e.width,d=o?e.height/o:e.height;return{width:c,height:d,top:u,right:l+c,bottom:u+d,left:l}}const mNe={ignoreTransform:!1};function Um(e,t){t===void 0&&(t=mNe);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:u,transformOrigin:c}=jr(e).getComputedStyle(e);u&&(n=gNe(n,u,c))}const{top:r,left:i,width:o,height:a,bottom:s,right:l}=n;return{top:r,left:i,width:o,height:a,bottom:s,right:l}}function LR(e){return Um(e,{ignoreTransform:!0})}function yNe(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function vNe(e,t){return t===void 0&&(t=jr(e).getComputedStyle(e)),t.position==="fixed"}function bNe(e,t){t===void 0&&(t=jr(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(i=>{const o=t[i];return typeof o=="string"?n.test(o):!1})}function AT(e,t){const n=[];function r(i){if(t!=null&&n.length>=t||!i)return n;if(CT(i)&&i.scrollingElement!=null&&!n.includes(i.scrollingElement))return n.push(i.scrollingElement),n;if(!jm(i)||z$e(i)||n.includes(i))return n;const o=jr(e).getComputedStyle(i);return i!==e&&bNe(i,o)&&n.push(i),vNe(i,o)?n:r(i.parentNode)}return e?r(e):n}function KG(e){const[t]=AT(e,1);return t??null}function Vw(e){return!p2||!e?null:Gf(e)?e:wT(e)?CT(e)||e===Hf(e).scrollingElement?window:jm(e)?e:null:null}function XG(e){return Gf(e)?e.scrollX:e.scrollLeft}function QG(e){return Gf(e)?e.scrollY:e.scrollTop}function L3(e){return{x:XG(e),y:QG(e)}}var zn;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(zn||(zn={}));function YG(e){return!p2||!e?!1:e===document.scrollingElement}function ZG(e){const t={x:0,y:0},n=YG(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},i=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,a=e.scrollTop>=r.y,s=e.scrollLeft>=r.x;return{isTop:i,isLeft:o,isBottom:a,isRight:s,maxScroll:r,minScroll:t}}const _Ne={x:.2,y:.2};function SNe(e,t,n,r,i){let{top:o,left:a,right:s,bottom:l}=n;r===void 0&&(r=10),i===void 0&&(i=_Ne);const{isTop:u,isBottom:c,isLeft:d,isRight:f}=ZG(e),h={x:0,y:0},p={x:0,y:0},m={height:t.height*i.y,width:t.width*i.x};return!u&&o<=t.top+m.height?(h.y=zn.Backward,p.y=r*Math.abs((t.top+m.height-o)/m.height)):!c&&l>=t.bottom-m.height&&(h.y=zn.Forward,p.y=r*Math.abs((t.bottom-m.height-l)/m.height)),!f&&s>=t.right-m.width?(h.x=zn.Forward,p.x=r*Math.abs((t.right-m.width-s)/m.width)):!d&&a<=t.left+m.width&&(h.x=zn.Backward,p.x=r*Math.abs((t.left+m.width-a)/m.width)),{direction:h,speed:p}}function xNe(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:i}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:i,width:e.clientWidth,height:e.clientHeight}}function JG(e){return e.reduce((t,n)=>Gd(t,L3(n)),Fo)}function wNe(e){return e.reduce((t,n)=>t+XG(n),0)}function CNe(e){return e.reduce((t,n)=>t+QG(n),0)}function eH(e,t){if(t===void 0&&(t=Um),!e)return;const{top:n,left:r,bottom:i,right:o}=t(e);KG(e)&&(i<=0||o<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ENe=[["x",["left","right"],wNe],["y",["top","bottom"],CNe]];class TT{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=AT(n),i=JG(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,a,s]of ENe)for(const l of a)Object.defineProperty(this,l,{get:()=>{const u=s(r),c=i[o]-u;return this.rect[l]+c},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class bp{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var i;(i=this.target)==null||i.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function ANe(e){const{EventTarget:t}=jr(e);return e instanceof t?e:Hf(e)}function Uw(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var Bi;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Bi||(Bi={}));function FR(e){e.preventDefault()}function TNe(e){e.stopPropagation()}var At;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(At||(At={}));const tH={start:[At.Space,At.Enter],cancel:[At.Esc],end:[At.Space,At.Enter]},PNe=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case At.Right:return{...n,x:n.x+25};case At.Left:return{...n,x:n.x-25};case At.Down:return{...n,y:n.y+25};case At.Up:return{...n,y:n.y-25}}};class nH{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new bp(Hf(n)),this.windowListeners=new bp(jr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Bi.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&eH(r),n(Fo)}handleKeyDown(t){if(ET(t)){const{active:n,context:r,options:i}=this.props,{keyboardCodes:o=tH,coordinateGetter:a=PNe,scrollBehavior:s="smooth"}=i,{code:l}=t;if(o.end.includes(l)){this.handleEnd(t);return}if(o.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:u}=r.current,c=u?{x:u.left,y:u.top}:Fo;this.referenceCoordinates||(this.referenceCoordinates=c);const d=a(t,{active:n,context:r.current,currentCoordinates:c});if(d){const f=ub(d,c),h={x:0,y:0},{scrollableAncestors:p}=r.current;for(const m of p){const _=t.code,{isTop:v,isRight:y,isLeft:g,isBottom:b,maxScroll:S,minScroll:x}=ZG(m),w=xNe(m),C={x:Math.min(_===At.Right?w.right-w.width/2:w.right,Math.max(_===At.Right?w.left:w.left+w.width/2,d.x)),y:Math.min(_===At.Down?w.bottom-w.height/2:w.bottom,Math.max(_===At.Down?w.top:w.top+w.height/2,d.y))},T=_===At.Right&&!y||_===At.Left&&!g,A=_===At.Down&&!b||_===At.Up&&!v;if(T&&C.x!==d.x){const k=m.scrollLeft+f.x,D=_===At.Right&&k<=S.x||_===At.Left&&k>=x.x;if(D&&!f.y){m.scrollTo({left:k,behavior:s});return}D?h.x=m.scrollLeft-k:h.x=_===At.Right?m.scrollLeft-S.x:m.scrollLeft-x.x,h.x&&m.scrollBy({left:-h.x,behavior:s});break}else if(A&&C.y!==d.y){const k=m.scrollTop+f.y,D=_===At.Down&&k<=S.y||_===At.Up&&k>=x.y;if(D&&!f.x){m.scrollTo({top:k,behavior:s});return}D?h.y=m.scrollTop-k:h.y=_===At.Down?m.scrollTop-S.y:m.scrollTop-x.y,h.y&&m.scrollBy({top:-h.y,behavior:s});break}}this.handleMove(t,Gd(ub(d,this.referenceCoordinates),h))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}nH.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=tH,onActivation:i}=t,{active:o}=n;const{code:a}=e.nativeEvent;if(r.start.includes(a)){const s=o.activatorNode.current;return s&&e.target!==s?!1:(e.preventDefault(),i==null||i({event:e.nativeEvent}),!0)}return!1}}];function BR(e){return!!(e&&"distance"in e)}function zR(e){return!!(e&&"delay"in e)}class PT{constructor(t,n,r){var i;r===void 0&&(r=ANe(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:a}=o;this.props=t,this.events=n,this.document=Hf(a),this.documentListeners=new bp(this.document),this.listeners=new bp(r),this.windowListeners=new bp(jr(a)),this.initialCoordinates=(i=Ug(o))!=null?i:Fo,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(Bi.Resize,this.handleCancel),this.windowListeners.add(Bi.DragStart,FR),this.windowListeners.add(Bi.VisibilityChange,this.handleCancel),this.windowListeners.add(Bi.ContextMenu,FR),this.documentListeners.add(Bi.Keydown,this.handleKeydown),n){if(BR(n))return;if(zR(n)){this.timeoutId=setTimeout(this.handleStart,n.delay);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Bi.Click,TNe,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Bi.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:i,props:o}=this,{onMove:a,options:{activationConstraint:s}}=o;if(!i)return;const l=(n=Ug(t))!=null?n:Fo,u=ub(i,l);if(!r&&s){if(zR(s))return Uw(u,s.tolerance)?this.handleCancel():void 0;if(BR(s))return s.tolerance!=null&&Uw(u,s.tolerance)?this.handleCancel():Uw(u,s.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),a(l)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===At.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const kNe={move:{name:"pointermove"},end:{name:"pointerup"}};class rH extends PT{constructor(t){const{event:n}=t,r=Hf(n.target);super(t,kNe,r)}}rH.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r==null||r({event:n}),!0)}}];const INe={move:{name:"mousemove"},end:{name:"mouseup"}};var F3;(function(e){e[e.RightClick=2]="RightClick"})(F3||(F3={}));class iH extends PT{constructor(t){super(t,INe,Hf(t.event.target))}}iH.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===F3.RightClick?!1:(r==null||r({event:n}),!0)}}];const Gw={move:{name:"touchmove"},end:{name:"touchend"}};class oH extends PT{constructor(t){super(t,Gw)}static setup(){return window.addEventListener(Gw.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Gw.move.name,t)};function t(){}}}oH.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:i}=n;return i.length>1?!1:(r==null||r({event:n}),!0)}}];var _p;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(_p||(_p={}));var db;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(db||(db={}));function MNe(e){let{acceleration:t,activator:n=_p.Pointer,canScroll:r,draggingRect:i,enabled:o,interval:a=5,order:s=db.TreeOrder,pointerCoordinates:l,scrollableAncestors:u,scrollableAncestorRects:c,delta:d,threshold:f}=e;const h=ONe({delta:d,disabled:!o}),[p,m]=j$e(),_=I.useRef({x:0,y:0}),v=I.useRef({x:0,y:0}),y=I.useMemo(()=>{switch(n){case _p.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case _p.DraggableRect:return i}},[n,i,l]),g=I.useRef(null),b=I.useCallback(()=>{const x=g.current;if(!x)return;const w=_.current.x*v.current.x,C=_.current.y*v.current.y;x.scrollBy(w,C)},[]),S=I.useMemo(()=>s===db.TreeOrder?[...u].reverse():u,[s,u]);I.useEffect(()=>{if(!o||!u.length||!y){m();return}for(const x of S){if((r==null?void 0:r(x))===!1)continue;const w=u.indexOf(x),C=c[w];if(!C)continue;const{direction:T,speed:A}=SNe(x,C,y,t,f);for(const k of["x","y"])h[k][T[k]]||(A[k]=0,T[k]=0);if(A.x>0||A.y>0){m(),g.current=x,p(b,a),_.current=A,v.current=T;return}}_.current={x:0,y:0},v.current={x:0,y:0},m()},[t,b,r,m,o,a,JSON.stringify(y),JSON.stringify(h),p,u,S,c,JSON.stringify(f)])}const RNe={x:{[zn.Backward]:!1,[zn.Forward]:!1},y:{[zn.Backward]:!1,[zn.Forward]:!1}};function ONe(e){let{delta:t,disabled:n}=e;const r=lb(t);return Vm(i=>{if(n||!r||!i)return RNe;const o={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[zn.Backward]:i.x[zn.Backward]||o.x===-1,[zn.Forward]:i.x[zn.Forward]||o.x===1},y:{[zn.Backward]:i.y[zn.Backward]||o.y===-1,[zn.Forward]:i.y[zn.Forward]||o.y===1}}},[n,t,r])}function $Ne(e,t){const n=t!==null?e.get(t):void 0,r=n?n.node.current:null;return Vm(i=>{var o;return t===null?null:(o=r??i)!=null?o:null},[r,t])}function NNe(e,t){return I.useMemo(()=>e.reduce((n,r)=>{const{sensor:i}=r,o=i.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}var Hg;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Hg||(Hg={}));var B3;(function(e){e.Optimized="optimized"})(B3||(B3={}));const jR=new Map;function DNe(e,t){let{dragging:n,dependencies:r,config:i}=t;const[o,a]=I.useState(null),{frequency:s,measure:l,strategy:u}=i,c=I.useRef(e),d=_(),f=Vg(d),h=I.useCallback(function(v){v===void 0&&(v=[]),!f.current&&a(y=>y===null?v:y.concat(v.filter(g=>!y.includes(g))))},[f]),p=I.useRef(null),m=Vm(v=>{if(d&&!n)return jR;if(!v||v===jR||c.current!==e||o!=null){const y=new Map;for(let g of e){if(!g)continue;if(o&&o.length>0&&!o.includes(g.id)&&g.rect.current){y.set(g.id,g.rect.current);continue}const b=g.node.current,S=b?new TT(l(b),b):null;g.rect.current=S,S&&y.set(g.id,S)}return y}return v},[e,o,n,d,l]);return I.useEffect(()=>{c.current=e},[e]),I.useEffect(()=>{d||h()},[n,d]),I.useEffect(()=>{o&&o.length>0&&a(null)},[JSON.stringify(o)]),I.useEffect(()=>{d||typeof s!="number"||p.current!==null||(p.current=setTimeout(()=>{h(),p.current=null},s))},[s,d,h,...r]),{droppableRects:m,measureDroppableContainers:h,measuringScheduled:o!=null};function _(){switch(u){case Hg.Always:return!1;case Hg.BeforeDragging:return n;default:return!n}}}function kT(e,t){return Vm(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function LNe(e,t){return kT(e,t)}function FNe(e){let{callback:t,disabled:n}=e;const r=g2(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(r)},[r,n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function y2(e){let{callback:t,disabled:n}=e;const r=g2(t),i=I.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(r)},[n]);return I.useEffect(()=>()=>i==null?void 0:i.disconnect(),[i]),i}function BNe(e){return new TT(Um(e),e)}function VR(e,t,n){t===void 0&&(t=BNe);const[r,i]=I.useReducer(s,null),o=FNe({callback(l){if(e)for(const u of l){const{type:c,target:d}=u;if(c==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=y2({callback:i});return Ea(()=>{i(),e?(a==null||a.observe(e),o==null||o.observe(document.body,{childList:!0,subtree:!0})):(a==null||a.disconnect(),o==null||o.disconnect())},[e]),r;function s(l){if(!e)return null;if(e.isConnected===!1){var u;return(u=l??n)!=null?u:null}const c=t(e);return JSON.stringify(l)===JSON.stringify(c)?l:c}}function zNe(e){const t=kT(e);return qG(e,t)}const UR=[];function jNe(e){const t=I.useRef(e),n=Vm(r=>e?r&&r!==UR&&e&&t.current&&e.parentNode===t.current.parentNode?r:AT(e):UR,[e]);return I.useEffect(()=>{t.current=e},[e]),n}function VNe(e){const[t,n]=I.useState(null),r=I.useRef(e),i=I.useCallback(o=>{const a=Vw(o.target);a&&n(s=>s?(s.set(a,L3(a)),new Map(s)):null)},[]);return I.useEffect(()=>{const o=r.current;if(e!==o){a(o);const s=e.map(l=>{const u=Vw(l);return u?(u.addEventListener("scroll",i,{passive:!0}),[u,L3(u)]):null}).filter(l=>l!=null);n(s.length?new Map(s):null),r.current=e}return()=>{a(e),a(o)};function a(s){s.forEach(l=>{const u=Vw(l);u==null||u.removeEventListener("scroll",i)})}},[i,e]),I.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>Gd(o,a),Fo):JG(e):Fo,[e,t])}function GR(e,t){t===void 0&&(t=[]);const n=I.useRef(null);return I.useEffect(()=>{n.current=null},t),I.useEffect(()=>{const r=e!==Fo;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?ub(e,n.current):Fo}function UNe(e){I.useEffect(()=>{if(!p2)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function GNe(e,t){return I.useMemo(()=>e.reduce((n,r)=>{let{eventName:i,handler:o}=r;return n[i]=a=>{o(a,t)},n},{}),[e,t])}function aH(e){return I.useMemo(()=>e?yNe(e):null,[e])}const Hw=[];function HNe(e,t){t===void 0&&(t=Um);const[n]=e,r=aH(n?jr(n):null),[i,o]=I.useReducer(s,Hw),a=y2({callback:o});return e.length>0&&i===Hw&&o(),Ea(()=>{e.length?e.forEach(l=>a==null?void 0:a.observe(l)):(a==null||a.disconnect(),o())},[e]),i;function s(){return e.length?e.map(l=>YG(l)?r:new TT(t(l),l)):Hw}}function sH(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return jm(t)?t:e}function qNe(e){let{measure:t}=e;const[n,r]=I.useState(null),i=I.useCallback(u=>{for(const{target:c}of u)if(jm(c)){r(d=>{const f=t(c);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),o=y2({callback:i}),a=I.useCallback(u=>{const c=sH(u);o==null||o.disconnect(),c&&(o==null||o.observe(c)),r(c?t(c):null)},[t,o]),[s,l]=sb(a);return I.useMemo(()=>({nodeRef:s,rect:n,setRef:l}),[n,s,l])}const WNe=[{sensor:rH,options:{}},{sensor:nH,options:{}}],KNe={current:{}},fv={draggable:{measure:LR},droppable:{measure:LR,strategy:Hg.WhileDragging,frequency:B3.Optimized},dragOverlay:{measure:Um}};class Sp extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const XNe={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new Sp,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:cb},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:fv,measureDroppableContainers:cb,windowRect:null,measuringScheduled:!1},lH={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:cb,draggableNodes:new Map,over:null,measureDroppableContainers:cb},Gm=I.createContext(lH),uH=I.createContext(XNe);function QNe(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new Sp}}}function YNe(e,t){switch(t.type){case Pn.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Pn.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case Pn.DragEnd:case Pn.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Pn.RegisterDroppable:{const{element:n}=t,{id:r}=n,i=new Sp(e.droppable.containers);return i.set(r,n),{...e,droppable:{...e.droppable,containers:i}}}case Pn.SetDroppableDisabled:{const{id:n,key:r,disabled:i}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Sp(e.droppable.containers);return a.set(n,{...o,disabled:i}),{...e,droppable:{...e.droppable,containers:a}}}case Pn.UnregisterDroppable:{const{id:n,key:r}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new Sp(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function ZNe(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:i}=I.useContext(Gm),o=lb(r),a=lb(n==null?void 0:n.id);return I.useEffect(()=>{if(!t&&!r&&o&&a!=null){if(!ET(o)||document.activeElement===o.target)return;const s=i.get(a);if(!s)return;const{activatorNode:l,node:u}=s;if(!l.current&&!u.current)return;requestAnimationFrame(()=>{for(const c of[l.current,u.current]){if(!c)continue;const d=G$e(c);if(d){d.focus();break}}})}},[r,t,i,a,o]),null}function cH(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((i,o)=>o({transform:i,...r}),n):n}function JNe(e){return I.useMemo(()=>({draggable:{...fv.draggable,...e==null?void 0:e.draggable},droppable:{...fv.droppable,...e==null?void 0:e.droppable},dragOverlay:{...fv.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function eDe(e){let{activeNode:t,measure:n,initialRect:r,config:i=!0}=e;const o=I.useRef(!1),{x:a,y:s}=typeof i=="boolean"?{x:i,y:i}:i;Ea(()=>{if(!a&&!s||!t){o.current=!1;return}if(o.current||!r)return;const u=t==null?void 0:t.node.current;if(!u||u.isConnected===!1)return;const c=n(u),d=qG(c,r);if(a||(d.x=0),s||(d.y=0),o.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=KG(u);f&&f.scrollBy({top:d.y,left:d.x})}},[t,a,s,r,n])}const v2=I.createContext({...Fo,scaleX:1,scaleY:1});var Ws;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(Ws||(Ws={}));const tDe=I.memo(function(t){var n,r,i,o;let{id:a,accessibility:s,autoScroll:l=!0,children:u,sensors:c=WNe,collisionDetection:d=uNe,measuring:f,modifiers:h,...p}=t;const m=I.useReducer(YNe,void 0,QNe),[_,v]=m,[y,g]=Y$e(),[b,S]=I.useState(Ws.Uninitialized),x=b===Ws.Initialized,{draggable:{active:w,nodes:C,translate:T},droppable:{containers:A}}=_,k=w?C.get(w):null,D=I.useRef({initial:null,translated:null}),M=I.useMemo(()=>{var Kt;return w!=null?{id:w,data:(Kt=k==null?void 0:k.data)!=null?Kt:KNe,rect:D}:null},[w,k]),E=I.useRef(null),[P,N]=I.useState(null),[L,O]=I.useState(null),R=Vg(p,Object.values(p)),$=m2("DndDescribedBy",a),z=I.useMemo(()=>A.getEnabled(),[A]),V=JNe(f),{droppableRects:H,measureDroppableContainers:Q,measuringScheduled:Z}=DNe(z,{dragging:x,dependencies:[T.x,T.y],config:V.droppable}),J=$Ne(C,w),j=I.useMemo(()=>L?Ug(L):null,[L]),X=Zl(),ee=LNe(J,V.draggable.measure);eDe({activeNode:w?C.get(w):null,config:X.layoutShiftCompensation,initialRect:ee,measure:V.draggable.measure});const ne=VR(J,V.draggable.measure,ee),fe=VR(J?J.parentElement:null),ce=I.useRef({activatorEvent:null,active:null,activeNode:J,collisionRect:null,collisions:null,droppableRects:H,draggableNodes:C,draggingNode:null,draggingNodeRect:null,droppableContainers:A,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Be=A.getNodeFor((n=ce.current.over)==null?void 0:n.id),$e=qNe({measure:V.dragOverlay.measure}),we=(r=$e.nodeRef.current)!=null?r:J,Ke=x?(i=$e.rect)!=null?i:ne:null,be=!!($e.nodeRef.current&&$e.rect),zt=zNe(be?null:ne),Hn=aH(we?jr(we):null),rn=jNe(x?Be??J:null),It=HNe(rn),St=cH(h,{transform:{x:T.x-zt.x,y:T.y-zt.y,scaleX:1,scaleY:1},activatorEvent:L,active:M,activeNodeRect:ne,containerNodeRect:fe,draggingNodeRect:Ke,over:ce.current.over,overlayNodeRect:$e.rect,scrollableAncestors:rn,scrollableAncestorRects:It,windowRect:Hn}),vn=j?Gd(j,T):null,Vr=VNe(rn),so=GR(Vr),Ti=GR(Vr,[ne]),sr=Gd(St,so),qn=Ke?pNe(Ke,St):null,Sr=M&&qn?d({active:M,collisionRect:qn,droppableRects:H,droppableContainers:z,pointerCoordinates:vn}):null,on=sNe(Sr,"id"),[Mt,si]=I.useState(null),Pi=be?St:Gd(St,Ti),lo=fNe(Pi,(o=Mt==null?void 0:Mt.rect)!=null?o:null,ne),Ma=I.useCallback((Kt,xt)=>{let{sensor:Kn,options:$n}=xt;if(E.current==null)return;const lr=C.get(E.current);if(!lr)return;const xr=Kt.nativeEvent,Ur=new Kn({active:E.current,activeNode:lr,event:xr,options:$n,context:ce,onStart(wr){const Xn=E.current;if(Xn==null)return;const Ra=C.get(Xn);if(!Ra)return;const{onDragStart:ks}=R.current,Is={active:{id:Xn,data:Ra.data,rect:D}};hi.unstable_batchedUpdates(()=>{ks==null||ks(Is),S(Ws.Initializing),v({type:Pn.DragStart,initialCoordinates:wr,active:Xn}),y({type:"onDragStart",event:Is})})},onMove(wr){v({type:Pn.DragMove,coordinates:wr})},onEnd:Uo(Pn.DragEnd),onCancel:Uo(Pn.DragCancel)});hi.unstable_batchedUpdates(()=>{N(Ur),O(Kt.nativeEvent)});function Uo(wr){return async function(){const{active:Ra,collisions:ks,over:Is,scrollAdjustedTranslate:vc}=ce.current;let Oa=null;if(Ra&&vc){const{cancelDrop:Cr}=R.current;Oa={activatorEvent:xr,active:Ra,collisions:ks,delta:vc,over:Is},wr===Pn.DragEnd&&typeof Cr=="function"&&await Promise.resolve(Cr(Oa))&&(wr=Pn.DragCancel)}E.current=null,hi.unstable_batchedUpdates(()=>{v({type:wr}),S(Ws.Uninitialized),si(null),N(null),O(null);const Cr=wr===Pn.DragEnd?"onDragEnd":"onDragCancel";if(Oa){const Jl=R.current[Cr];Jl==null||Jl(Oa),y({type:Cr,event:Oa})}})}}},[C]),Wn=I.useCallback((Kt,xt)=>(Kn,$n)=>{const lr=Kn.nativeEvent,xr=C.get($n);if(E.current!==null||!xr||lr.dndKit||lr.defaultPrevented)return;const Ur={active:xr};Kt(Kn,xt.options,Ur)===!0&&(lr.dndKit={capturedBy:xt.sensor},E.current=$n,Ma(Kn,xt))},[C,Ma]),uo=NNe(c,Wn);UNe(c),Ea(()=>{ne&&b===Ws.Initializing&&S(Ws.Initialized)},[ne,b]),I.useEffect(()=>{const{onDragMove:Kt}=R.current,{active:xt,activatorEvent:Kn,collisions:$n,over:lr}=ce.current;if(!xt||!Kn)return;const xr={active:xt,activatorEvent:Kn,collisions:$n,delta:{x:sr.x,y:sr.y},over:lr};hi.unstable_batchedUpdates(()=>{Kt==null||Kt(xr),y({type:"onDragMove",event:xr})})},[sr.x,sr.y]),I.useEffect(()=>{const{active:Kt,activatorEvent:xt,collisions:Kn,droppableContainers:$n,scrollAdjustedTranslate:lr}=ce.current;if(!Kt||E.current==null||!xt||!lr)return;const{onDragOver:xr}=R.current,Ur=$n.get(on),Uo=Ur&&Ur.rect.current?{id:Ur.id,rect:Ur.rect.current,data:Ur.data,disabled:Ur.disabled}:null,wr={active:Kt,activatorEvent:xt,collisions:Kn,delta:{x:lr.x,y:lr.y},over:Uo};hi.unstable_batchedUpdates(()=>{si(Uo),xr==null||xr(wr),y({type:"onDragOver",event:wr})})},[on]),Ea(()=>{ce.current={activatorEvent:L,active:M,activeNode:J,collisionRect:qn,collisions:Sr,droppableRects:H,draggableNodes:C,draggingNode:we,draggingNodeRect:Ke,droppableContainers:A,over:Mt,scrollableAncestors:rn,scrollAdjustedTranslate:sr},D.current={initial:Ke,translated:qn}},[M,J,Sr,qn,C,we,Ke,H,A,Mt,rn,sr]),MNe({...X,delta:T,draggingRect:qn,pointerCoordinates:vn,scrollableAncestors:rn,scrollableAncestorRects:It});const Yl=I.useMemo(()=>({active:M,activeNode:J,activeNodeRect:ne,activatorEvent:L,collisions:Sr,containerNodeRect:fe,dragOverlay:$e,draggableNodes:C,droppableContainers:A,droppableRects:H,over:Mt,measureDroppableContainers:Q,scrollableAncestors:rn,scrollableAncestorRects:It,measuringConfiguration:V,measuringScheduled:Z,windowRect:Hn}),[M,J,ne,L,Sr,fe,$e,C,A,H,Mt,Q,rn,It,V,Z,Hn]),Vo=I.useMemo(()=>({activatorEvent:L,activators:uo,active:M,activeNodeRect:ne,ariaDescribedById:{draggable:$},dispatch:v,draggableNodes:C,over:Mt,measureDroppableContainers:Q}),[L,uo,M,ne,v,$,C,Mt,Q]);return bt.createElement(HG.Provider,{value:g},bt.createElement(Gm.Provider,{value:Vo},bt.createElement(uH.Provider,{value:Yl},bt.createElement(v2.Provider,{value:lo},u)),bt.createElement(ZNe,{disabled:(s==null?void 0:s.restoreFocus)===!1})),bt.createElement(eNe,{...s,hiddenTextDescribedById:$}));function Zl(){const Kt=(P==null?void 0:P.autoScrollEnabled)===!1,xt=typeof l=="object"?l.enabled===!1:l===!1,Kn=x&&!Kt&&!xt;return typeof l=="object"?{...l,enabled:Kn}:{enabled:Kn}}}),nDe=I.createContext(null),HR="button",rDe="Droppable";function PUe(e){let{id:t,data:n,disabled:r=!1,attributes:i}=e;const o=m2(rDe),{activators:a,activatorEvent:s,active:l,activeNodeRect:u,ariaDescribedById:c,draggableNodes:d,over:f}=I.useContext(Gm),{role:h=HR,roleDescription:p="draggable",tabIndex:m=0}=i??{},_=(l==null?void 0:l.id)===t,v=I.useContext(_?v2:nDe),[y,g]=sb(),[b,S]=sb(),x=GNe(a,t),w=Vg(n);Ea(()=>(d.set(t,{id:t,key:o,node:y,activatorNode:b,data:w}),()=>{const T=d.get(t);T&&T.key===o&&d.delete(t)}),[d,t]);const C=I.useMemo(()=>({role:h,tabIndex:m,"aria-disabled":r,"aria-pressed":_&&h===HR?!0:void 0,"aria-roledescription":p,"aria-describedby":c.draggable}),[r,h,m,_,p,c.draggable]);return{active:l,activatorEvent:s,activeNodeRect:u,attributes:C,isDragging:_,listeners:r?void 0:x,node:y,over:f,setNodeRef:g,setActivatorNodeRef:S,transform:v}}function iDe(){return I.useContext(uH)}const oDe="Droppable",aDe={timeout:25};function kUe(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:i}=e;const o=m2(oDe),{active:a,dispatch:s,over:l,measureDroppableContainers:u}=I.useContext(Gm),c=I.useRef({disabled:n}),d=I.useRef(!1),f=I.useRef(null),h=I.useRef(null),{disabled:p,updateMeasurementsFor:m,timeout:_}={...aDe,...i},v=Vg(m??r),y=I.useCallback(()=>{if(!d.current){d.current=!0;return}h.current!=null&&clearTimeout(h.current),h.current=setTimeout(()=>{u(Array.isArray(v.current)?v.current:[v.current]),h.current=null},_)},[_]),g=y2({callback:y,disabled:p||!a}),b=I.useCallback((C,T)=>{g&&(T&&(g.unobserve(T),d.current=!1),C&&g.observe(C))},[g]),[S,x]=sb(b),w=Vg(t);return I.useEffect(()=>{!g||!S.current||(g.disconnect(),d.current=!1,g.observe(S.current))},[S,g]),Ea(()=>(s({type:Pn.RegisterDroppable,element:{id:r,key:o,disabled:n,node:S,rect:f,data:w}}),()=>s({type:Pn.UnregisterDroppable,key:o,id:r})),[r]),I.useEffect(()=>{n!==c.current.disabled&&(s({type:Pn.SetDroppableDisabled,id:r,key:o,disabled:n}),c.current.disabled=n)},[r,o,n,s]),{active:a,rect:f,isOver:(l==null?void 0:l.id)===r,node:S,over:l,setNodeRef:x}}function sDe(e){let{animation:t,children:n}=e;const[r,i]=I.useState(null),[o,a]=I.useState(null),s=lb(n);return!n&&!r&&s&&i(s),Ea(()=>{if(!o)return;const l=r==null?void 0:r.key,u=r==null?void 0:r.props.id;if(l==null||u==null){i(null);return}Promise.resolve(t(u,o)).then(()=>{i(null)})},[t,r,o]),bt.createElement(bt.Fragment,null,n,r?I.cloneElement(r,{ref:a}):null)}const lDe={x:0,y:0,scaleX:1,scaleY:1};function uDe(e){let{children:t}=e;return bt.createElement(Gm.Provider,{value:lH},bt.createElement(v2.Provider,{value:lDe},t))}const cDe={position:"fixed",touchAction:"none"},dDe=e=>ET(e)?"transform 250ms ease":void 0,fDe=I.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:i,children:o,className:a,rect:s,style:l,transform:u,transition:c=dDe}=e;if(!s)return null;const d=i?u:{...u,scaleX:1,scaleY:1},f={...cDe,width:s.width,height:s.height,top:s.top,left:s.left,transform:Gg.Transform.toString(d),transformOrigin:i&&r?rNe(r,s):void 0,transition:typeof c=="function"?c(r):c,...l};return bt.createElement(n,{className:a,style:f,ref:t},o)}),hDe=e=>t=>{let{active:n,dragOverlay:r}=t;const i={},{styles:o,className:a}=e;if(o!=null&&o.active)for(const[s,l]of Object.entries(o.active))l!==void 0&&(i[s]=n.node.style.getPropertyValue(s),n.node.style.setProperty(s,l));if(o!=null&&o.dragOverlay)for(const[s,l]of Object.entries(o.dragOverlay))l!==void 0&&r.node.style.setProperty(s,l);return a!=null&&a.active&&n.node.classList.add(a.active),a!=null&&a.dragOverlay&&r.node.classList.add(a.dragOverlay),function(){for(const[l,u]of Object.entries(i))n.node.style.setProperty(l,u);a!=null&&a.active&&n.node.classList.remove(a.active)}},pDe=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Gg.Transform.toString(t)},{transform:Gg.Transform.toString(n)}]},gDe={duration:250,easing:"ease",keyframes:pDe,sideEffects:hDe({styles:{active:{opacity:"0"}}})};function mDe(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:i}=e;return g2((o,a)=>{if(t===null)return;const s=n.get(o);if(!s)return;const l=s.node.current;if(!l)return;const u=sH(a);if(!u)return;const{transform:c}=jr(a).getComputedStyle(a),d=WG(c);if(!d)return;const f=typeof t=="function"?t:yDe(t);return eH(l,i.draggable.measure),f({active:{id:o,data:s.data,node:l,rect:i.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:a,rect:i.dragOverlay.measure(u)},droppableContainers:r,measuringConfiguration:i,transform:d})})}function yDe(e){const{duration:t,easing:n,sideEffects:r,keyframes:i}={...gDe,...e};return o=>{let{active:a,dragOverlay:s,transform:l,...u}=o;if(!t)return;const c={x:s.rect.left-a.rect.left,y:s.rect.top-a.rect.top},d={scaleX:l.scaleX!==1?a.rect.width*l.scaleX/s.rect.width:1,scaleY:l.scaleY!==1?a.rect.height*l.scaleY/s.rect.height:1},f={x:l.x-c.x,y:l.y-c.y,...d},h=i({...u,active:a,dragOverlay:s,transform:{initial:l,final:f}}),[p]=h,m=h[h.length-1];if(JSON.stringify(p)===JSON.stringify(m))return;const _=r==null?void 0:r({active:a,dragOverlay:s,...u}),v=s.node.animate(h,{duration:t,easing:n,fill:"forwards"});return new Promise(y=>{v.onfinish=()=>{_==null||_(),y()}})}}let qR=0;function vDe(e){return I.useMemo(()=>{if(e!=null)return qR++,qR},[e])}const bDe=bt.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:i,transition:o,modifiers:a,wrapperElement:s="div",className:l,zIndex:u=999}=e;const{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggableNodes:p,droppableContainers:m,dragOverlay:_,over:v,measuringConfiguration:y,scrollableAncestors:g,scrollableAncestorRects:b,windowRect:S}=iDe(),x=I.useContext(v2),w=vDe(d==null?void 0:d.id),C=cH(a,{activatorEvent:c,active:d,activeNodeRect:f,containerNodeRect:h,draggingNodeRect:_.rect,over:v,overlayNodeRect:_.rect,scrollableAncestors:g,scrollableAncestorRects:b,transform:x,windowRect:S}),T=kT(f),A=mDe({config:r,draggableNodes:p,droppableContainers:m,measuringConfiguration:y}),k=T?_.setRef:void 0;return bt.createElement(uDe,null,bt.createElement(sDe,{animation:A},d&&w?bt.createElement(fDe,{key:w,id:d.id,ref:k,as:s,activatorEvent:c,adjustScale:t,className:l,transition:o,rect:T,style:{zIndex:u,...i},transform:C},n):null))}),_De=ir([kG,TA],({nodes:e},t)=>t==="nodes"?e.viewport.zoom:1),SDe=()=>{const e=Mj(_De);return I.useCallback(({activatorEvent:n,draggingNodeRect:r,transform:i})=>{if(r&&n){const o=Ug(n);if(!o)return i;const a=o.x-r.left,s=o.y-r.top,l=i.x+a-r.width/2,u=i.y+s-r.height/2,c=i.scaleX*e,d=i.scaleY*e;return{x:l,y:u,scaleX:c,scaleY:d}}return i},[e])},xDe=e=>{if(!e.pointerCoordinates)return[];const t=document.elementsFromPoint(e.pointerCoordinates.x,e.pointerCoordinates.y),n=e.droppableContainers.filter(r=>r.node.current?t.includes(r.node.current):!1);return dNe({...e,droppableContainers:n})};function wDe(e){return q.jsx(tDe,{...e})}const by=28,WR={w:by,h:by,maxW:by,maxH:by,shadow:"dark-lg",borderRadius:"lg",opacity:.3,bg:"base.800",color:"base.50",_dark:{borderColor:"base.200",bg:"base.900",color:"base.100"}},CDe=e=>{if(!e.dragData)return null;if(e.dragData.payloadType==="NODE_FIELD"){const{field:t,fieldTemplate:n}=e.dragData.payload;return q.jsx(ib,{sx:{position:"relative",p:2,px:3,opacity:.7,bg:"base.300",borderRadius:"base",boxShadow:"dark-lg",whiteSpace:"nowrap",fontSize:"sm"},children:q.jsx(pG,{children:t.label||n.title})})}if(e.dragData.payloadType==="IMAGE_DTO"){const{thumbnail_url:t,width:n,height:r}=e.dragData.payload.imageDTO;return q.jsx(ib,{sx:{position:"relative",width:"full",height:"full",display:"flex",alignItems:"center",justifyContent:"center"},children:q.jsx(gT,{sx:{...WR},objectFit:"contain",src:t,width:n,height:r})})}return e.dragData.payloadType==="IMAGE_DTOS"?q.jsxs(mT,{sx:{position:"relative",alignItems:"center",justifyContent:"center",flexDir:"column",...WR},children:[q.jsx(A3,{children:e.dragData.payload.imageDTOs.length}),q.jsx(A3,{size:"sm",children:"Images"})]}):null},EDe=I.memo(CDe),ADe=e=>{const[t,n]=I.useState(null),r=le("images"),i=iCe(),o=I.useCallback(d=>{r.trace({dragData:ft(d.active.data.current)},"Drag started");const f=d.active.data.current;f&&n(f)},[r]),a=I.useCallback(d=>{var h;r.trace({dragData:ft(d.active.data.current)},"Drag ended");const f=(h=d.over)==null?void 0:h.data.current;!t||!f||(i(kj({overData:f,activeData:t})),n(null))},[t,i,r]),s=DR(iH,{activationConstraint:{distance:10}}),l=DR(oH,{activationConstraint:{distance:10}}),u=tNe(s,l),c=SDe();return q.jsxs(wDe,{onDragStart:o,onDragEnd:a,sensors:u,collisionDetection:xDe,autoScroll:!1,children:[e.children,q.jsx(bDe,{dropAnimation:null,modifiers:[c],style:{width:"min-content",height:"min-content",cursor:"grabbing",userSelect:"none",padding:"10rem"},children:q.jsx(oG,{children:t&&q.jsx(rG.div,{layout:!0,initial:{opacity:0,scale:.7},animate:{opacity:1,scale:1,transition:{duration:.1}},children:q.jsx(EDe,{dragData:t})},"overlay-drag-image")})})]})},TDe=I.memo(ADe),KR=Ta(void 0),XR=Ta(void 0),PDe=I.lazy(()=>f$(()=>import("./App-d620b60d.js"),["./App-d620b60d.js","./MantineProvider-17a58e64.js","./App-6125620a.css"],import.meta.url)),kDe=I.lazy(()=>f$(()=>import("./ThemeLocaleProvider-58d6b3b6.js"),["./ThemeLocaleProvider-58d6b3b6.js","./MantineProvider-17a58e64.js","./ThemeLocaleProvider-90f0fcd3.css"],import.meta.url)),IDe=({apiUrl:e,token:t,config:n,headerComponent:r,middleware:i,projectId:o,queueId:a,selectedImage:s,customStarUi:l})=>(I.useEffect(()=>(t&&cg.set(t),e&&dg.set(e),o&&g1.set(o),a&&Nn.set(a),Pz(),i&&i.length>0?L5($R(),...i):L5($R()),()=>{dg.set(void 0),cg.set(void 0),g1.set(void 0),Nn.set(aL)}),[e,t,i,o,a]),I.useEffect(()=>(l&&KR.set(l),()=>{KR.set(void 0)}),[l]),I.useEffect(()=>(r&&XR.set(r),()=>{XR.set(void 0)}),[r]),q.jsx(bt.StrictMode,{children:q.jsx(Ase,{store:PG,children:q.jsx(bt.Suspense,{fallback:q.jsx(B$e,{}),children:q.jsx(kDe,{children:q.jsx(TDe,{children:q.jsx(PDe,{config:n,selectedImage:s})})})})})})),MDe=I.memo(IDe);qw.createRoot(document.getElementById("root")).render(q.jsx(MDe,{}));export{$m as $,Gn as A,_o as B,Hge as C,ii as D,gl as E,Yo as F,Cze as G,eA as H,ICe as I,Ai as J,zm as K,M5e as L,AUe as M,vRe as N,Mm as O,Kge as P,ar as Q,Xl as R,Kp as S,z6e as T,vUe as U,gUe as V,oG as W,rG as X,v6e as Y,Rm as Z,fT as _,rN as a,NE as a$,mUe as a0,yUe as a1,U1 as a2,uM as a3,S5e as a4,bUe as a5,ua as a6,Nl as a7,f1 as a8,IK as a9,tc as aA,ib as aB,mT as aC,A3 as aD,TA as aE,Y_ as aF,_Ce as aG,tze as aH,s5e as aI,$A as aJ,Gj as aK,u5e as aL,hi as aM,VT as aN,e2 as aO,fVe as aP,LBe as aQ,rze as aR,ize as aS,OBe as aT,MBe as aU,pG as aV,Bc as aW,Jve as aX,$z as aY,nVe as aZ,$Be as a_,bt as aa,$V as ab,xUe as ac,w6e as ad,ya as ae,Yj as af,JS as ag,U9e as ah,fG as ai,_Ue as aj,Pe as ak,pUe as al,SUe as am,ir as an,kG as ao,aE as ap,Mj as aq,GBe as ar,_m as as,XL as at,SF as au,V_ as av,le as aw,iCe as ax,iVe as ay,nt as az,Bb as b,iLe as b$,IA as b0,TVe as b1,gT as b2,L$e as b3,oe as b4,KBe as b5,nze as b6,xFe as b7,fie as b8,$E as b9,zBe as bA,vze as bB,kUe as bC,PUe as bD,ap as bE,K as bF,hze as bG,yze as bH,FBe as bI,BBe as bJ,YBe as bK,C1 as bL,jBe as bM,rl as bN,f0 as bO,mze as bP,pze as bQ,gze as bR,ODe as bS,QDe as bT,YDe as bU,ZDe as bV,JDe as bW,$oe as bX,ELe as bY,qje as bZ,Wje as b_,rLe as ba,SVe as bb,aVe as bc,PVe as bd,AVe as be,Cve as bf,oVe as bg,lVe as bh,Uye as bi,Gye as bj,vVe as bk,_Ve as bl,sVe as bm,wVe as bn,uVe as bo,UBe as bp,rVe as bq,TUe as br,UH as bs,DDe as bt,$De as bu,NDe as bv,Ve as bw,VBe as bx,cze as by,uze as bz,TQ as c,DF as c$,RLe as c0,tLe as c1,_Le as c2,sLe as c3,vxe as c4,nLe as c5,ALe as c6,eLe as c7,LLe as c8,oLe as c9,Yje as cA,Zje as cB,pLe as cC,Jje as cD,gLe as cE,eVe as cF,mLe as cG,tVe as cH,xze as cI,cg as cJ,f1e as cK,ZBe as cL,Eu as cM,Do as cN,afe as cO,ve as cP,KR as cQ,dze as cR,fze as cS,dle as cT,Vve as cU,Tz as cV,HL as cW,RBe as cX,Pj as cY,XBe as cZ,fg as c_,d6 as ca,aLe as cb,f6 as cc,hLe as cd,xLe as ce,KVe as cf,uLe as cg,YI as ch,wze as ci,HVe as cj,cLe as ck,ZI as cl,mu as cm,tie as cn,vE as co,WVe as cp,e9 as cq,nie as cr,qVe as cs,fLe as ct,JI as cu,rie as cv,yxe as cw,lLe as cx,iI as cy,Qje as cz,pne as d,Toe as d$,hUe as d0,QBe as d1,T0 as d2,m5 as d3,AFe as d4,bFe as d5,dFe as d6,fFe as d7,yFe as d8,En as d9,Tze as dA,Kze as dB,Xze as dC,Eoe as dD,Qze as dE,WDe as dF,Yze as dG,X_ as dH,Coe as dI,tje as dJ,gm as dK,oUe as dL,GVe as dM,cUe as dN,UVe as dO,nje as dP,rje as dQ,dUe as dR,ije as dS,uUe as dT,oje as dU,aje as dV,woe as dW,QVe as dX,sje as dY,Aoe as dZ,Zze as d_,tA as da,hs as db,Xi as dc,di as dd,mFe as de,yLe as df,AA as dg,vFe as dh,EVe as di,oE as dj,zje as dk,Dje as dl,Lje as dm,Uje as dn,Fje as dp,Vje as dq,jje as dr,Z2e as ds,cje as dt,Ize as du,qBe as dv,HBe as dw,Oze as dx,lE as dy,eje as dz,iD as e,DLe as e$,Jze as e0,Wze as e1,Bje as e2,kd as e3,Mf as e4,wLe as e5,ple as e6,gle as e7,NBe as e8,_ze as e9,qDe as eA,jDe as eB,zDe as eC,hm as eD,yE as eE,oie as eF,aie as eG,VD as eH,iie as eI,UD as eJ,sie as eK,FDe as eL,XVe as eM,Kje as eN,SE as eO,zye as eP,tCe as eQ,iL as eR,zVe as eS,eFe as eT,Noe as eU,JLe as eV,fi as eW,SLe as eX,$Le as eY,yie as eZ,sp as e_,Sze as ea,FF as eb,bze as ec,Kb as ed,ZLe as ee,HLe as ef,qLe as eg,WLe as eh,mie as ei,Tr as ej,s6 as ek,VDe as el,sze as em,oze as en,aze as eo,jl as ep,F6 as eq,cie as er,l6 as es,u1e as et,l1e as eu,UDe as ev,GDe as ew,Zb as ex,HDe as ey,die as ez,dN as f,Bh as f$,Xje as f0,kLe as f1,ILe as f2,MLe as f3,TLe as f4,PLe as f5,Ooe as f6,zLe as f7,BLe as f8,sFe as f9,lUe as fA,aUe as fB,cVe as fC,nUe as fD,tUe as fE,YVe as fF,iUe as fG,XDe as fH,ZVe as fI,rUe as fJ,KDe as fK,GB as fL,Pze as fM,t5 as fN,L0e as fO,dje as fP,Dze as fQ,Lze as fR,j0e as fS,tI as fT,wB as fU,Cm as fV,Eze as fW,vu as fX,hje as fY,CVe as fZ,$L as f_,GFe as fa,TBe as fb,HFe as fc,ULe as fd,GLe as fe,VLe as ff,KLe as fg,XLe as fh,QLe as fi,YLe as fj,wE as fk,_Fe as fl,Hje as fm,fUe as fn,CCe as fo,gVe as fp,ue as fq,Qe as fr,$t as fs,pa as ft,dLe as fu,VVe as fv,sUe as fw,eUe as fx,dVe as fy,JVe as fz,bN as g,zFe as g$,Rze as g0,kze as g1,fje as g2,pje as g3,Sje as g4,Aze as g5,gje as g6,mje as g7,WBe as g8,$1 as g9,ft as gA,Nye as gB,wg as gC,Pl as gD,$je as gE,kje as gF,Oje as gG,Ije as gH,Tje as gI,vje as gJ,Rje as gK,rz as gL,RVe as gM,kVe as gN,IVe as gO,MVe as gP,TFe as gQ,gFe as gR,wFe as gS,EFe as gT,yu as gU,Lz as gV,dq as gW,Ue as gX,nBe as gY,SBe as gZ,_Be as g_,Te as ga,yje as gb,Dye as gc,B0 as gd,Mze as ge,xje as gf,bje as gg,Gze as gh,jze as gi,zze as gj,Bze as gk,Hze as gl,_je as gm,Eje as gn,Cje as go,Nje as gp,ACe as gq,Vze as gr,Uze as gs,Gje as gt,Aje as gu,wje as gv,Pje as gw,$0e as gx,jVe as gy,XI as gz,qb as h,jFe as h$,dBe as h0,wBe as h1,c1e as h2,OFe as h3,YFe as h4,mh as h5,KFe as h6,$Fe as h7,Z_ as h8,QFe as h9,tBe as hA,ZFe as hB,iFe as hC,oFe as hD,IBe as hE,$Ve as hF,OVe as hG,cBe as hH,oBe as hI,iBe as hJ,r1e as hK,BFe as hL,RFe as hM,yBe as hN,mBe as hO,lBe as hP,aBe as hQ,sBe as hR,PBe as hS,pBe as hT,kBe as hU,WFe as hV,qFe as hW,kFe as hX,PFe as hY,ABe as hZ,aFe as h_,IFe as ha,XFe as hb,MFe as hc,DFe as hd,rFe as he,nFe as hf,tFe as hg,xBe as hh,dre as hi,_a as hj,oL as hk,Boe as hl,lFe as hm,uFe as hn,cFe as ho,bBe as hp,FFe as hq,LFe as hr,tle as hs,vBe as ht,s1e as hu,nle as hv,CA as hw,P2e as hx,VFe as hy,rBe as hz,sne as i,a1e as i0,n1e as i1,i1e as i2,o1e as i3,BVe as i4,hVe as i5,pVe as i6,Ere as i7,Yve as i8,XR as i9,Xj as ia,DA as ib,ca as ic,a6e as id,N6e as ie,wUe as ig,E5e as ih,EUe as ii,bRe as ij,C7e as ik,E7e as il,b5e as im,Cn as j,jJ as k,Hb as l,If as m,cm as n,ri as o,Vb as p,W4 as q,uN as r,J4 as s,fm as t,YN as u,I as v,q as w,Zi as x,dn as y,$d as z}; diff --git a/pyproject.toml b/pyproject.toml index 21d803c312..1cd62c36ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -49,6 +49,7 @@ dependencies = [ "fastapi~=0.103.2", "fastapi-events~=0.9.1", "huggingface-hub~=0.16.4", + "imohash", "invisible-watermark~=0.2.0", # needed to install SDXL base and refiner using their repo_ids "matplotlib", # needed for plotting of Penner easing functions "mediapipe", # needed for "mediapipeface" controlnet model @@ -136,6 +137,7 @@ dependencies = [ "invokeai-node-web" = "invokeai.app.api_app:invoke_api" "invokeai-import-images" = "invokeai.frontend.install.import_images:main" "invokeai-db-maintenance" = "invokeai.backend.util.db_maintenance:main" +"invokeai-migrate-models-to-db" = "invokeai.backend.model_manager.migrate_to_db:main" [project.urls] "Homepage" = "https://invoke-ai.github.io/InvokeAI/" diff --git a/tests/app/services/model_records/test_model_records_sql.py b/tests/app/services/model_records/test_model_records_sql.py new file mode 100644 index 0000000000..002c3e2c07 --- /dev/null +++ b/tests/app/services/model_records/test_model_records_sql.py @@ -0,0 +1,267 @@ +""" +Test the refactored model config classes. +""" + +from hashlib import sha256 + +import pytest + +from invokeai.app.services.config import InvokeAIAppConfig +from invokeai.app.services.model_records import ( + DuplicateModelException, + ModelRecordServiceBase, + ModelRecordServiceSQL, + UnknownModelException, +) +from invokeai.app.services.shared.sqlite import SqliteDatabase +from invokeai.backend.model_manager.config import ( + BaseModelType, + MainCheckpointConfig, + MainDiffusersConfig, + ModelType, + TextualInversionConfig, + VaeDiffusersConfig, +) +from invokeai.backend.util.logging import InvokeAILogger + + +@pytest.fixture +def store(datadir) -> ModelRecordServiceBase: + config = InvokeAIAppConfig(root=datadir) + logger = InvokeAILogger.get_logger(config=config) + db = SqliteDatabase(config, logger) + return ModelRecordServiceSQL(db) + + +def example_config() -> TextualInversionConfig: + return TextualInversionConfig( + path="/tmp/pokemon.bin", + name="old name", + base=BaseModelType("sd-1"), + type=ModelType("embedding"), + format="embedding_file", + original_hash="ABC123", + ) + + +def test_type(store: ModelRecordServiceBase): + config = example_config() + store.add_model("key1", config) + config1 = store.get_model("key1") + assert type(config1) == TextualInversionConfig + + +def test_add(store: ModelRecordServiceBase): + raw = { + "path": "/tmp/foo.ckpt", + "name": "model1", + "base": BaseModelType("sd-1"), + "type": "main", + "config": "/tmp/foo.yaml", + "variant": "normal", + "format": "checkpoint", + "original_hash": "111222333444", + } + store.add_model("key1", raw) + config1 = store.get_model("key1") + assert config1 is not None + assert type(config1) == MainCheckpointConfig + assert config1.base == BaseModelType("sd-1") + assert config1.name == "model1" + assert config1.original_hash == "111222333444" + assert config1.current_hash is None + + +def test_dup(store: ModelRecordServiceBase): + config = example_config() + store.add_model("key1", example_config()) + with pytest.raises(DuplicateModelException): + store.add_model("key1", config) + with pytest.raises(DuplicateModelException): + store.add_model("key2", config) + + +def test_update(store: ModelRecordServiceBase): + config = example_config() + store.add_model("key1", config) + config = store.get_model("key1") + assert config.name == "old name" + + config.name = "new name" + store.update_model("key1", config) + new_config = store.get_model("key1") + assert new_config.name == "new name" + + +def test_rename(store: ModelRecordServiceBase): + config = example_config() + store.add_model("key1", config) + config = store.get_model("key1") + assert config.name == "old name" + + store.rename_model("key1", "new name") + new_config = store.get_model("key1") + assert new_config.name == "new name" + + +def test_unknown_key(store: ModelRecordServiceBase): + config = example_config() + store.add_model("key1", config) + with pytest.raises(UnknownModelException): + store.update_model("unknown_key", config) + + +def test_delete(store: ModelRecordServiceBase): + config = example_config() + store.add_model("key1", config) + config = store.get_model("key1") + store.del_model("key1") + with pytest.raises(UnknownModelException): + config = store.get_model("key1") + + +def test_exists(store: ModelRecordServiceBase): + config = example_config() + store.add_model("key1", config) + assert store.exists("key1") + assert not store.exists("key2") + + +def test_filter(store: ModelRecordServiceBase): + config1 = MainDiffusersConfig( + path="/tmp/config1", + name="config1", + base=BaseModelType("sd-1"), + type=ModelType("main"), + original_hash="CONFIG1HASH", + ) + config2 = MainDiffusersConfig( + path="/tmp/config2", + name="config2", + base=BaseModelType("sd-1"), + type=ModelType("main"), + original_hash="CONFIG2HASH", + ) + config3 = VaeDiffusersConfig( + path="/tmp/config3", + name="config3", + base=BaseModelType("sd-2"), + type=ModelType("vae"), + original_hash="CONFIG3HASH", + ) + for c in config1, config2, config3: + store.add_model(sha256(c.name.encode("utf-8")).hexdigest(), c) + matches = store.search_by_attr(model_type=ModelType("main")) + assert len(matches) == 2 + assert matches[0].name in {"config1", "config2"} + + matches = store.search_by_attr(model_type=ModelType("vae")) + assert len(matches) == 1 + assert matches[0].name == "config3" + assert matches[0].key == sha256("config3".encode("utf-8")).hexdigest() + assert isinstance(matches[0].type, ModelType) # This tests that we get proper enums back + + matches = store.search_by_hash("CONFIG1HASH") + assert len(matches) == 1 + assert matches[0].original_hash == "CONFIG1HASH" + + matches = store.all_models() + assert len(matches) == 3 + + +def test_unique(store: ModelRecordServiceBase): + config1 = MainDiffusersConfig( + path="/tmp/config1", + base=BaseModelType("sd-1"), + type=ModelType("main"), + name="nonuniquename", + original_hash="CONFIG1HASH", + ) + config2 = MainDiffusersConfig( + path="/tmp/config2", + base=BaseModelType("sd-2"), + type=ModelType("main"), + name="nonuniquename", + original_hash="CONFIG1HASH", + ) + config3 = VaeDiffusersConfig( + path="/tmp/config3", + base=BaseModelType("sd-2"), + type=ModelType("vae"), + name="nonuniquename", + original_hash="CONFIG1HASH", + ) + config4 = MainDiffusersConfig( + path="/tmp/config4", + base=BaseModelType("sd-1"), + type=ModelType("main"), + name="nonuniquename", + original_hash="CONFIG1HASH", + ) + # config1, config2 and config3 are compatible because they have unique combos + # of name, type and base + for c in config1, config2, config3: + store.add_model(sha256(c.path.encode("utf-8")).hexdigest(), c) + + # config4 clashes with config1 and should raise an integrity error + with pytest.raises(DuplicateModelException): + store.add_model(sha256(c.path.encode("utf-8")).hexdigest(), config4) + + +def test_filter_2(store: ModelRecordServiceBase): + config1 = MainDiffusersConfig( + path="/tmp/config1", + name="config1", + base=BaseModelType("sd-1"), + type=ModelType("main"), + original_hash="CONFIG1HASH", + ) + config2 = MainDiffusersConfig( + path="/tmp/config2", + name="config2", + base=BaseModelType("sd-1"), + type=ModelType("main"), + original_hash="CONFIG2HASH", + ) + config3 = MainDiffusersConfig( + path="/tmp/config3", + name="dup_name1", + base=BaseModelType("sd-2"), + type=ModelType("main"), + original_hash="CONFIG3HASH", + ) + config4 = MainDiffusersConfig( + path="/tmp/config4", + name="dup_name1", + base=BaseModelType("sdxl"), + type=ModelType("main"), + original_hash="CONFIG3HASH", + ) + config5 = VaeDiffusersConfig( + path="/tmp/config5", + name="dup_name1", + base=BaseModelType("sd-1"), + type=ModelType("vae"), + original_hash="CONFIG3HASH", + ) + for c in config1, config2, config3, config4, config5: + store.add_model(sha256(c.path.encode("utf-8")).hexdigest(), c) + + matches = store.search_by_attr( + model_type=ModelType("main"), + model_name="dup_name1", + ) + assert len(matches) == 2 + + matches = store.search_by_attr( + base_model=BaseModelType("sd-1"), + model_type=ModelType("main"), + ) + assert len(matches) == 2 + + matches = store.search_by_attr( + base_model=BaseModelType("sd-1"), + model_type=ModelType("vae"), + model_name="dup_name1", + ) + assert len(matches) == 1 diff --git a/tests/nodes/test_graph_execution_state.py b/tests/nodes/test_graph_execution_state.py index f518460612..cc40970ace 100644 --- a/tests/nodes/test_graph_execution_state.py +++ b/tests/nodes/test_graph_execution_state.py @@ -68,6 +68,7 @@ def mock_services() -> InvocationServices: latents=None, # type: ignore logger=logging, # type: ignore model_manager=None, # type: ignore + model_records=None, # type: ignore names=None, # type: ignore performance_statistics=InvocationStatsService(), processor=DefaultInvocationProcessor(), diff --git a/tests/nodes/test_invoker.py b/tests/nodes/test_invoker.py index 25b02955b0..c775fb93f2 100644 --- a/tests/nodes/test_invoker.py +++ b/tests/nodes/test_invoker.py @@ -73,6 +73,7 @@ def mock_services() -> InvocationServices: latents=None, # type: ignore logger=logging, # type: ignore model_manager=None, # type: ignore + model_records=None, # type: ignore names=None, # type: ignore performance_statistics=InvocationStatsService(), processor=DefaultInvocationProcessor(),