diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 3cb301a..7fcdded 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -16,6 +16,7 @@ permissions: jobs: deploy: runs-on: ubuntu-latest + if: github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false) steps: - uses: actions/checkout@v4 - name: Configure Git Credentials @@ -32,7 +33,7 @@ jobs: path: .cache restore-keys: | mkdocs-material- - - run: pip install mkdocs-material + - run: pip install mkdocs-material mkdocs-llmstxt==0.1.0 - name: Build docs run: mkdocs build diff --git a/.github/workflows/tests-frontend.yml b/.github/workflows/tests-frontend.yml new file mode 100644 index 0000000..d72cb65 --- /dev/null +++ b/.github/workflows/tests-frontend.yml @@ -0,0 +1,17 @@ +name: tests + +on: [push, pull_request] + +jobs: + prettier: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + - name: Run prettier + run: | + cd frontend + npm install + npx prettier --check . \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..7a0c833 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,39 @@ +name: tests + +on: [push, pull_request] + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - name: Run linters + run: | + pip install ruff pyright + pip install -e .[dev] + ruff check . + ruff format --check --diff . + pyright + test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + python: + - '3.10' + - '3.13' + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Run tests + run: | + python -m pip install -U pip + pip install '.[dev, tts]' + python -m pytest --capture=no + shell: bash diff --git a/.gitignore b/.gitignore index 75607a6..f1a1283 100644 --- a/.gitignore +++ b/.gitignore @@ -16,10 +16,9 @@ demo/scratch .gradio .vscode .DS_Store -test/ .venv* .env -!dist/fastrtc-0.0.19.dev0-py3-none-any.whl +!dist/fastrtc-0.0.28.dev0-py3-none-any.whl backend/fastrtc/templates/* -frontend/package-lock.json \ No newline at end of file +frontend/package-lock.json diff --git a/backend/fastrtc/__init__.py b/backend/fastrtc/__init__.py index 97e1bd0..20e4be5 100644 --- a/backend/fastrtc/__init__.py +++ b/backend/fastrtc/__init__.py @@ -1,6 +1,10 @@ from .credentials import ( + get_cloudflare_turn_credentials, + get_cloudflare_turn_credentials_async, get_hf_turn_credentials, + get_hf_turn_credentials_async, get_turn_credentials, + get_turn_credentials_async, get_twilio_turn_credentials, ) from .pause_detection import ( @@ -13,7 +17,11 @@ from .reply_on_pause import AlgoOptions, ReplyOnPause from .reply_on_stopwords import ReplyOnStopWords from .speech_to_text import MoonshineSTT, get_stt_model from .stream import Stream, UIArgs -from .text_to_speech import KokoroTTSOptions, get_tts_model +from .text_to_speech import ( + CartesiaTTSOptions, + KokoroTTSOptions, + get_tts_model, +) from .tracks import ( AsyncAudioVideoStreamHandler, AsyncStreamHandler, @@ -27,6 +35,7 @@ from .utils import ( AdditionalOutputs, CloseStream, Warning, + WebRTCData, WebRTCError, aggregate_bytes_to_16bit, async_aggregate_bytes_to_16bit, @@ -70,6 +79,10 @@ __all__ = [ "Warning", "get_tts_model", "KokoroTTSOptions", + "get_cloudflare_turn_credentials_async", + "get_hf_turn_credentials_async", + "get_turn_credentials_async", + "get_cloudflare_turn_credentials", "wait_for_item", "UIArgs", "ModelOptions", @@ -79,4 +92,6 @@ __all__ = [ "VideoStreamHandler", "CloseStream", "get_current_context", + "CartesiaTTSOptions", + "WebRTCData", ] diff --git a/backend/fastrtc/credentials.py b/backend/fastrtc/credentials.py index 884753e..0bbf615 100644 --- a/backend/fastrtc/credentials.py +++ b/backend/fastrtc/credentials.py @@ -1,29 +1,268 @@ import os +import warnings from typing import Literal -import requests +import httpx + +CLOUDFLARE_FASTRTC_TURN_URL = "https://turn.fastrtc.org/credentials" + +async_httpx_client = httpx.AsyncClient() -def get_hf_turn_credentials(token=None): +def _format_response(response): + if response.is_success: + return response.json() + else: + raise Exception( + f"Failed to get TURN credentials: {response.status_code} {response.text}" + ) + + +def get_hf_turn_credentials(token=None, ttl=600): + """Retrieves TURN credentials from Hugging Face (deprecated). + + This function fetches TURN server credentials using a Hugging Face token. + It is deprecated and `get_cloudflare_turn_credentials` should be used instead. + + Args: + token (str, optional): Hugging Face API token. Defaults to None, in which + case the HF_TOKEN environment variable is used. + ttl (int, optional): Time-to-live for the credentials in seconds. + Defaults to 600. + + Returns: + dict: A dictionary containing the TURN credentials. + + Raises: + ValueError: If no token is provided and the HF_TOKEN environment variable + is not set. + Exception: If the request to the TURN server fails. + """ + warnings.warn( + "get_hf_turn_credentials is deprecated. Use get_cloudflare_turn_credentials instead.", + UserWarning, + ) if token is None: token = os.getenv("HF_TOKEN") - credentials = requests.get( - "https://fastrtc-turn-server-login.hf.space/credentials", - headers={"X-HF-Access-Token": token}, + if token is None: + raise ValueError( + "HF_TOKEN environment variable must be set or token must be provided to use get_hf_turn_credentials" + ) + response = httpx.get( + CLOUDFLARE_FASTRTC_TURN_URL, + headers={ + "Authorization": f"Bearer {token}", + "Content-Type": "application/json", + }, + params={"ttl": ttl}, ) - if not credentials.status_code == 200: - raise ValueError("Failed to get credentials from HF turn server") - return { - "iceServers": [ - { - "urls": "turn:gradio-turn.com:80", - **credentials.json(), + return _format_response(response) + + +async def get_hf_turn_credentials_async( + token=None, ttl=600, client: httpx.AsyncClient | None = None +): + """Asynchronously retrieves TURN credentials from Hugging Face (deprecated). + + This function asynchronously fetches TURN server credentials using a Hugging Face + token. It is deprecated and `get_cloudflare_turn_credentials_async` should be + used instead. + + Args: + token (str, optional): Hugging Face API token. Defaults to None, in which + case the HF_TOKEN environment variable is used. + ttl (int, optional): Time-to-live for the credentials in seconds. + Defaults to 600. + client (httpx.AsyncClient | None, optional): An existing httpx async client + to use for the request. If None, a default client is used. Defaults to None. + + Returns: + dict: A dictionary containing the TURN credentials. + + Raises: + ValueError: If no token is provided and the HF_TOKEN environment variable + is not set. + Exception: If the request to the TURN server fails. + """ + warnings.warn( + "get_hf_turn_credentials_async is deprecated. Use get_cloudflare_turn_credentials_async instead.", + UserWarning, + ) + if client is None: + client = async_httpx_client + + if token is None: + token = os.getenv("HF_TOKEN") + if token is None: + raise ValueError( + "HF_TOKEN environment variable must be set or token must be provided to use get_hf_turn_credentials" + ) + async with client: + response = await client.get( + "https://turn.fastrtc.org/credentials", + headers={"Authorization": f"Bearer {token}"}, + params={"ttl": ttl}, + ) + return _format_response(response) + + +def get_cloudflare_turn_credentials( + turn_key_id=None, turn_key_api_token=None, hf_token=None, ttl=600 +): + """Retrieves TURN credentials from Cloudflare or Hugging Face. + + Fetches TURN server credentials either directly from Cloudflare using API keys + or via the Hugging Face TURN endpoint using an HF token. The HF token method + takes precedence if provided. + + Args: + turn_key_id (str, optional): Cloudflare TURN key ID. Defaults to None, + in which case the CLOUDFLARE_TURN_KEY_ID environment variable is used. + turn_key_api_token (str, optional): Cloudflare TURN key API token. + Defaults to None, in which case the CLOUDFLARE_TURN_KEY_API_TOKEN + environment variable is used. + hf_token (str, optional): Hugging Face API token. If provided, this method + is used instead of Cloudflare keys. Defaults to None, in which case + the HF_TOKEN environment variable is used. + ttl (int, optional): Time-to-live for the credentials in seconds. + Defaults to 600. + + Returns: + dict: A dictionary containing the TURN credentials (ICE servers). + + Raises: + ValueError: If neither HF token nor Cloudflare keys (either as arguments + or environment variables) are provided. + Exception: If the request to the credential server fails. + """ + if hf_token is None: + hf_token = os.getenv("HF_TOKEN") + if hf_token: + return httpx.get( + CLOUDFLARE_FASTRTC_TURN_URL, + headers={"Authorization": f"Bearer {hf_token}"}, + params={"ttl": ttl}, + ).json() + else: + if turn_key_id is None or turn_key_api_token is None: + turn_key_id = os.getenv("CLOUDFLARE_TURN_KEY_ID") + turn_key_api_token = os.getenv("CLOUDFLARE_TURN_KEY_API_TOKEN") + if turn_key_id is None or turn_key_api_token is None: + raise ValueError( + "HF_TOKEN or CLOUDFLARE_TURN_KEY_ID and CLOUDFLARE_TURN_KEY_API_TOKEN must be set to use get_cloudflare_turn_credentials_sync" + ) + response = httpx.post( + f"https://rtc.live.cloudflare.com/v1/turn/keys/{turn_key_id}/credentials/generate-ice-servers", + headers={ + "Authorization": f"Bearer {turn_key_api_token}", + "Content-Type": "application/json", }, - ] - } + json={"ttl": ttl}, + ) + if response.is_success: + return response.json() + else: + raise Exception( + f"Failed to get TURN credentials: {response.status_code} {response.text}" + ) + + +async def get_cloudflare_turn_credentials_async( + turn_key_id=None, + turn_key_api_token=None, + hf_token=None, + ttl=600, + client: httpx.AsyncClient | None = None, +): + """Asynchronously retrieves TURN credentials from Cloudflare or Hugging Face. + + Asynchronously fetches TURN server credentials either directly from Cloudflare + using API keys or via the Hugging Face TURN endpoint using an HF token. The HF + token method takes precedence if provided. + + Args: + turn_key_id (str, optional): Cloudflare TURN key ID. Defaults to None, + in which case the CLOUDFLARE_TURN_KEY_ID environment variable is used. + turn_key_api_token (str, optional): Cloudflare TURN key API token. + Defaults to None, in which case the CLOUDFLARE_TURN_KEY_API_TOKEN + environment variable is used. + hf_token (str, optional): Hugging Face API token. If provided, this method + is used instead of Cloudflare keys. Defaults to None, in which case + the HF_TOKEN environment variable is used. + ttl (int, optional): Time-to-live for the credentials in seconds. + Defaults to 600. + client (httpx.AsyncClient | None, optional): An existing httpx async client + to use for the request. If None, a new client is created per request. + Defaults to None. + + Returns: + dict: A dictionary containing the TURN credentials (ICE servers). + + Raises: + ValueError: If neither HF token nor Cloudflare keys (either as arguments + or environment variables) are provided. + Exception: If the request to the credential server fails. + """ + if client is None: + client = async_httpx_client + + if hf_token is None: + hf_token = os.getenv("HF_TOKEN", "").strip() + if hf_token: + async with httpx.AsyncClient() as client: + response = await client.get( + CLOUDFLARE_FASTRTC_TURN_URL, + headers={"Authorization": f"Bearer {hf_token}"}, + params={"ttl": ttl}, + ) + return _format_response(response) + else: + if turn_key_id is None or turn_key_api_token is None: + turn_key_id = os.getenv("CLOUDFLARE_TURN_KEY_ID") + turn_key_api_token = os.getenv("CLOUDFLARE_TURN_KEY_API_TOKEN") + if turn_key_id is None or turn_key_api_token is None: + raise ValueError( + "HF_TOKEN or CLOUDFLARE_TURN_KEY_ID and CLOUDFLARE_TURN_KEY_API_TOKEN must be set to use get_cloudflare_turn_credentials" + ) + async with httpx.AsyncClient() as client: + response = await client.post( + f"https://rtc.live.cloudflare.com/v1/turn/keys/{turn_key_id}/credentials/generate-ice-servers", + headers={ + "Authorization": f"Bearer {turn_key_api_token}", + "Content-Type": "application/json", + }, + json={"ttl": ttl}, + ) + if response.is_success: + return response.json() + else: + raise Exception( + f"Failed to get TURN credentials: {response.status_code} {response.text}" + ) def get_twilio_turn_credentials(twilio_sid=None, twilio_token=None): + """Retrieves TURN credentials from Twilio. + + Uses the Twilio REST API to generate temporary TURN credentials. Requires + the `twilio` package to be installed. + + Args: + twilio_sid (str, optional): Twilio Account SID. Defaults to None, in which + case the TWILIO_ACCOUNT_SID environment variable is used. + twilio_token (str, optional): Twilio Auth Token. Defaults to None, in which + case the TWILIO_AUTH_TOKEN environment variable is used. + + Returns: + dict: A dictionary containing the TURN credentials formatted for WebRTC, + including 'iceServers' and 'iceTransportPolicy'. + + Raises: + ImportError: If the `twilio` package is not installed. + ValueError: If Twilio credentials (SID and token) are not provided either + as arguments or environment variables. + TwilioRestException: If the Twilio API request fails. + """ try: from twilio.rest import Client except ImportError: @@ -43,10 +282,105 @@ def get_twilio_turn_credentials(twilio_sid=None, twilio_token=None): } -def get_turn_credentials(method: Literal["hf", "twilio"] = "hf", **kwargs): +def get_turn_credentials( + method: Literal["hf", "twilio", "cloudflare"] = "cloudflare", **kwargs +): + """Retrieves TURN credentials from the specified provider. + + Acts as a dispatcher function to call the appropriate credential retrieval + function based on the method specified. + + Args: + method (Literal["hf", "twilio", "cloudflare"], optional): The provider + to use. 'hf' uses the deprecated Hugging Face endpoint. 'cloudflare' + uses either Cloudflare keys or the HF endpoint. 'twilio' uses the + Twilio API. Defaults to "cloudflare". + **kwargs: Additional keyword arguments passed directly to the underlying + provider-specific function (e.g., `token`, `ttl` for 'hf'; + `twilio_sid`, `twilio_token` for 'twilio'; `turn_key_id`, + `turn_key_api_token`, `hf_token`, `ttl` for 'cloudflare'). + + Returns: + dict: A dictionary containing the TURN credentials from the chosen provider. + + Raises: + ValueError: If an invalid method is specified. + Also raises exceptions from the underlying provider functions (see their + docstrings). + """ if method == "hf": - return get_hf_turn_credentials(**kwargs) + warnings.warn( + "Method 'hf' is deprecated. Use 'cloudflare' instead.", UserWarning + ) + # Ensure only relevant kwargs are passed + hf_kwargs = {k: v for k, v in kwargs.items() if k in ["token", "ttl"]} + return get_hf_turn_credentials(**hf_kwargs) + elif method == "cloudflare": + # Ensure only relevant kwargs are passed + cf_kwargs = { + k: v + for k, v in kwargs.items() + if k in ["turn_key_id", "turn_key_api_token", "hf_token", "ttl"] + } + return get_cloudflare_turn_credentials(**cf_kwargs) elif method == "twilio": - return get_twilio_turn_credentials(**kwargs) + # Ensure only relevant kwargs are passed + twilio_kwargs = { + k: v for k, v in kwargs.items() if k in ["twilio_sid", "twilio_token"] + } + return get_twilio_turn_credentials(**twilio_kwargs) else: - raise ValueError("Invalid method. Must be 'hf' or 'twilio'") + raise ValueError("Invalid method. Must be 'hf', 'twilio', or 'cloudflare'") + + +async def get_turn_credentials_async( + method: Literal["hf", "twilio", "cloudflare"] = "cloudflare", **kwargs +): + """Asynchronously retrieves TURN credentials from the specified provider. + + Acts as an async dispatcher function to call the appropriate async credential + retrieval function based on the method specified. + + Args: + method (Literal["hf", "twilio", "cloudflare"], optional): The provider + to use. 'hf' uses the deprecated Hugging Face endpoint. 'cloudflare' + uses either Cloudflare keys or the HF endpoint. 'twilio' is not + supported asynchronously by this function yet. Defaults to "cloudflare". + **kwargs: Additional keyword arguments passed directly to the underlying + provider-specific async function (e.g., `token`, `ttl`, `client` for 'hf'; + `turn_key_id`, `turn_key_api_token`, `hf_token`, `ttl`, `client` for + 'cloudflare'). + + Returns: + dict: A dictionary containing the TURN credentials from the chosen provider. + + Raises: + ValueError: If an invalid or unsupported method is specified (currently + 'twilio' is not supported asynchronously here). + NotImplementedError: If method 'twilio' is requested. + Also raises exceptions from the underlying provider functions (see their + docstrings). + """ + if method == "hf": + warnings.warn( + "Method 'hf' is deprecated. Use 'cloudflare' instead.", UserWarning + ) + # Ensure only relevant kwargs are passed + hf_kwargs = {k: v for k, v in kwargs.items() if k in ["token", "ttl", "client"]} + return await get_hf_turn_credentials_async(**hf_kwargs) + elif method == "cloudflare": + # Ensure only relevant kwargs are passed + cf_kwargs = { + k: v + for k, v in kwargs.items() + if k in ["turn_key_id", "turn_key_api_token", "hf_token", "ttl", "client"] + } + return await get_cloudflare_turn_credentials_async(**cf_kwargs) + elif method == "twilio": + # Twilio client library doesn't have a standard async interface for this. + # You might need to run the sync version in an executor or use a different library. + raise NotImplementedError( + "Async retrieval for Twilio credentials is not implemented." + ) + else: + raise ValueError("Invalid method. Must be 'hf', 'twilio', or 'cloudflare'") diff --git a/backend/fastrtc/pause_detection/silero.py b/backend/fastrtc/pause_detection/silero.py index ecbcd61..51ff55f 100644 --- a/backend/fastrtc/pause_detection/silero.py +++ b/backend/fastrtc/pause_detection/silero.py @@ -2,14 +2,13 @@ import logging import warnings from dataclasses import dataclass from functools import lru_cache -from typing import List import click import numpy as np from huggingface_hub import hf_hub_download from numpy.typing import NDArray -from ..utils import AudioChunk +from ..utils import AudioChunk, audio_to_float32 from .protocol import PauseDetectionModel logger = logging.getLogger(__name__) @@ -102,7 +101,7 @@ class SileroVADModel: return h, c @staticmethod - def collect_chunks(audio: np.ndarray, chunks: List[AudioChunk]) -> np.ndarray: + def collect_chunks(audio: np.ndarray, chunks: list[AudioChunk]) -> np.ndarray: """Collects and concatenates audio chunks.""" if not chunks: return np.array([], dtype=np.float32) @@ -116,7 +115,7 @@ class SileroVADModel: audio: np.ndarray, vad_options: SileroVadOptions, **kwargs, - ) -> List[AudioChunk]: + ) -> list[AudioChunk]: """This method is used for splitting long audios into speech chunks using silero VAD. Args: @@ -275,8 +274,7 @@ class SileroVADModel: sampling_rate, audio_ = audio logger.debug("VAD audio shape input: %s", audio_.shape) try: - if audio_.dtype != np.float32: - audio_ = audio_.astype(np.float32) / 32768.0 + audio_ = audio_to_float32(audio_) sr = 16000 if sr != sampling_rate: try: diff --git a/backend/fastrtc/reply_on_pause.py b/backend/fastrtc/reply_on_pause.py index 64623dc..ab1513c 100644 --- a/backend/fastrtc/reply_on_pause.py +++ b/backend/fastrtc/reply_on_pause.py @@ -1,27 +1,37 @@ import asyncio import inspect +from collections.abc import AsyncGenerator, Callable, Generator from dataclasses import dataclass, field from logging import getLogger from threading import Event -from typing import Any, AsyncGenerator, Callable, Generator, Literal, cast +from typing import Any, Literal, cast import numpy as np from numpy.typing import NDArray from .pause_detection import ModelOptions, PauseDetectionModel, get_silero_model from .tracks import EmitType, StreamHandler -from .utils import create_message, split_output +from .utils import AdditionalOutputs, WebRTCData, create_message, split_output logger = getLogger(__name__) @dataclass class AlgoOptions: - """Algorithm options.""" + """ + Algorithm options. + + Attributes: + - audio_chunk_duration: Duration in seconds of audio chunks passed to the VAD model. + - started_talking_threshold: If the chunk has more than started_talking_threshold seconds of speech, the user started talking. + - speech_threshold: If, after the user started speaking, there is a chunk with less than speech_threshold seconds of speech, the user stopped speaking. + - max_continuous_speech_s: Max duration of speech chunks before the handler is triggered, even if a pause is not detected by the VAD model. + """ audio_chunk_duration: float = 0.6 started_talking_threshold: float = 0.2 speech_threshold: float = 0.1 + max_continuous_speech_s: float = float("inf") @dataclass @@ -57,6 +67,14 @@ ReplyFnGenerator = ( [tuple[int, NDArray[np.int16]], Any], AsyncGenerator[EmitType, None], ] + | Callable[ + [WebRTCData], + Generator[EmitType, None, None], + ] + | Callable[ + [WebRTCData, Any], + AsyncGenerator[EmitType, None], + ] ) @@ -65,6 +83,34 @@ async def iterate(generator: Generator) -> Any: class ReplyOnPause(StreamHandler): + """ + A stream handler that processes incoming audio, detects pauses, + and triggers a reply function (`fn`) when a pause is detected. + + This handler accumulates audio chunks, uses a Voice Activity Detection (VAD) + model to determine speech segments, and identifies pauses based on configurable + thresholds. Once a pause is detected after speech has started, it calls the + provided generator function `fn` with the accumulated audio. + + It can optionally run a `startup_fn` at the beginning and supports interruption + of the reply function if new audio arrives. + + Attributes: + fn (ReplyFnGenerator): The generator function to call when a pause is detected. + startup_fn (Callable | None): An optional function to run at startup. + algo_options (AlgoOptions): Configuration for the pause detection algorithm. + model_options (ModelOptions | None): Configuration for the VAD model. + can_interrupt (bool): Whether incoming audio can interrupt the `fn` execution. + expected_layout (Literal["mono", "stereo"]): Expected audio channel layout. + output_sample_rate (int): Sample rate for the output audio from `fn`. + input_sample_rate (int): Expected sample rate of the input audio. + model (PauseDetectionModel): The VAD model instance. + state (AppState): The current state of the pause detection logic. + generator (Generator | AsyncGenerator | None): The active generator instance from `fn`. + event (Event): Threading event used to signal pause detection. + loop (asyncio.AbstractEventLoop): The asyncio event loop. + """ + def __init__( self, fn: ReplyFnGenerator, @@ -77,7 +123,26 @@ class ReplyOnPause(StreamHandler): output_frame_size: int | None = None, # Deprecated input_sample_rate: int = 48000, model: PauseDetectionModel | None = None, + needs_args: bool = False, ): + """ + Initializes the ReplyOnPause handler. + + Args: + fn: The generator function to execute upon pause detection. + It receives `(sample_rate, audio_array)` and optionally `*args`. + startup_fn: An optional function to run once at the beginning. + algo_options: Options for the pause detection algorithm. + model_options: Options for the VAD model. + can_interrupt: If True, incoming audio during `fn` execution + will stop the generator and process the new audio. + expected_layout: Expected input audio layout ('mono' or 'stereo'). + output_sample_rate: The sample rate expected for audio yielded by `fn`. + output_frame_size: Deprecated. + input_sample_rate: The expected sample rate of incoming audio. + model: An optional pre-initialized VAD model instance. + needs_args: Whether the reply function expects additional arguments. + """ super().__init__( expected_layout, output_sample_rate, @@ -97,12 +162,20 @@ class ReplyOnPause(StreamHandler): self.model_options = model_options self.algo_options = algo_options or AlgoOptions() self.startup_fn = startup_fn + self.needs_args = needs_args @property def _needs_additional_inputs(self) -> bool: - return len(inspect.signature(self.fn).parameters) > 1 + """Checks if the reply function `fn` expects additional arguments.""" + return len(inspect.signature(self.fn).parameters) > 1 or self.needs_args def start_up(self): + """ + Executes the startup function `startup_fn` if provided. + + Waits for additional arguments if `_needs_additional_inputs` is True + before calling `startup_fn`. Sets the `event` after completion. + """ if self.startup_fn: if self._needs_additional_inputs: self.wait_for_args_sync() @@ -113,6 +186,7 @@ class ReplyOnPause(StreamHandler): self.event.set() def copy(self): + """Creates a new instance of ReplyOnPause with the same configuration.""" return ReplyOnPause( self.fn, self.startup_fn, @@ -124,12 +198,28 @@ class ReplyOnPause(StreamHandler): self.output_frame_size, self.input_sample_rate, self.model, + self.needs_args, ) def determine_pause( self, audio: np.ndarray, sampling_rate: int, state: AppState ) -> bool: - """Take in the stream, determine if a pause happened""" + """ + Analyzes an audio chunk to detect if a significant pause occurred after speech. + + Uses the VAD model to measure speech duration within the chunk. Updates the + application state (`state`) regarding whether talking has started and + accumulates speech segments. + + Args: + audio: The numpy array containing the audio chunk. + sampling_rate: The sample rate of the audio chunk. + state: The current application state. + + Returns: + True if a pause satisfying the configured thresholds is detected + after speech has started, False otherwise. + """ duration = len(audio) / sampling_rate if duration >= self.algo_options.audio_chunk_duration: @@ -141,17 +231,35 @@ class ReplyOnPause(StreamHandler): ): state.started_talking = True logger.debug("Started talking") + self.send_message_sync(create_message("log", "started_talking")) if state.started_talking: if state.stream is None: state.stream = audio else: state.stream = np.concatenate((state.stream, audio)) + + # Check if continuous speech limit has been reached + current_duration = len(state.stream) / sampling_rate + if current_duration >= self.algo_options.max_continuous_speech_s: + return True state.buffer = None + + # Check if a pause has been detected by the VAD model if dur_vad < self.algo_options.speech_threshold and state.started_talking: return True return False def process_audio(self, audio: tuple[int, np.ndarray], state: AppState) -> None: + """ + Processes an incoming audio frame. + + Appends the frame to the buffer, runs pause detection on the buffer, + and updates the application state. + + Args: + audio: A tuple containing the sample rate and the audio frame data. + state: The current application state to update. + """ frame_rate, array = audio array = np.squeeze(array) if not state.sampling_rate: @@ -167,6 +275,16 @@ class ReplyOnPause(StreamHandler): state.pause_detected = pause_detected def receive(self, frame: tuple[int, np.ndarray]) -> None: + """ + Receives an audio frame from the stream. + + Processes the audio frame using `process_audio`. If a pause is detected, + it sets the `event`. If interruption is enabled and a reply is ongoing, + it closes the current generator and clears the processing queue. + + Args: + frame: A tuple containing the sample rate and the audio frame data. + """ if self.state.responding and not self.can_interrupt: return self.process_audio(frame, self.state) @@ -179,7 +297,13 @@ class ReplyOnPause(StreamHandler): self.clear_queue() def _close_generator(self): - """Properly close the generator to ensure resources are released.""" + """ + Safely closes the active reply generator (`self.generator`). + + Handles both synchronous and asynchronous generators, ensuring proper + resource cleanup (e.g., calling `aclose()` or `close()`). + Logs any errors during closure. + """ if self.generator is None: return @@ -199,6 +323,12 @@ class ReplyOnPause(StreamHandler): logger.debug(f"Error closing generator: {e}") def reset(self): + """ + Resets the handler state to its initial condition. + + Clears accumulated audio, resets state flags, closes any active generator, + and clears the event flag. Also handles resetting argument state for phone mode. + """ super().reset() if self.phone_mode: self.args_set.set() @@ -206,28 +336,58 @@ class ReplyOnPause(StreamHandler): self.event.clear() self.state = AppState() + def trigger_response(self): + """ + Manually triggers the response generation process. + + Sets the event flag, effectively simulating a pause detection. + Initializes the stream buffer if it's empty. + """ + self.event.set() + if self.state.stream is None: + self.state.stream = np.array([], dtype=np.int16) + async def async_iterate(self, generator) -> EmitType: + """Helper function to get the next item from an async generator.""" return await anext(generator) def emit(self): + """ + Produces the next output chunk from the reply generator (`fn`). + + This method is called repeatedly after a pause is detected (event is set). + If the generator is not already running, it initializes it by calling `fn` + with the accumulated audio and any required additional arguments. + It then yields the next item from the generator. Handles both sync and + async generators. Resets the state upon generator completion or error. + + Returns: + The next output item from the generator, or None if no pause event + has occurred or the generator is exhausted. + + Raises: + Exception: Re-raises exceptions occurring within the `fn` generator. + """ if not self.event.is_set(): return None else: if not self.generator: self.send_message_sync(create_message("log", "pause_detected")) - if self._needs_additional_inputs and not self.args_set.is_set(): - if not self.phone_mode: - self.wait_for_args_sync() - else: - self.latest_args = [None] - self.args_set.set() - logger.debug("Creating generator") - audio = cast(np.ndarray, self.state.stream).reshape(1, -1) - if self._needs_additional_inputs: - self.latest_args[0] = (self.state.sampling_rate, audio) - self.generator = self.fn(*self.latest_args) # type: ignore + if self._needs_additional_inputs and not self.phone_mode: + self.wait_for_args_sync() else: - self.generator = self.fn((self.state.sampling_rate, audio)) # type: ignore + self.latest_args = [None] + self.args_set.set() + logger.debug("Creating generator") + if self.state.stream is not None and self.state.stream.size > 0: + audio = cast(np.ndarray, self.state.stream).reshape(1, -1) + else: + audio = np.array([[]], dtype=np.int16) + if isinstance(self.latest_args[0], WebRTCData): + self.latest_args[0].audio = (self.state.sampling_rate, audio) + else: + self.latest_args[0] = (self.state.sampling_rate, audio) + self.generator = self.fn(*self.latest_args) # type: ignore logger.debug("Latest args: %s", self.latest_args) self.state = self.state.new() self.state.responding = True @@ -243,7 +403,7 @@ class ReplyOnPause(StreamHandler): self.send_message_sync(create_message("log", "response_starting")) self.state.responded_audio = True if self.phone_mode: - if additional_outputs: + if isinstance(additional_outputs, AdditionalOutputs): self.latest_args = [None] + list(additional_outputs.args) return output except (StopIteration, StopAsyncIteration): diff --git a/backend/fastrtc/reply_on_stopwords.py b/backend/fastrtc/reply_on_stopwords.py index 5503851..2a2d598 100644 --- a/backend/fastrtc/reply_on_stopwords.py +++ b/backend/fastrtc/reply_on_stopwords.py @@ -1,7 +1,8 @@ import asyncio import logging import re -from typing import Callable, Literal +from collections.abc import Callable +from typing import Literal import numpy as np @@ -20,15 +21,33 @@ logger = logging.getLogger(__name__) class ReplyOnStopWordsState(AppState): + """Extends AppState to include state specific to stop word detection.""" + stop_word_detected: bool = False post_stop_word_buffer: np.ndarray | None = None started_talking_pre_stop_word: bool = False def new(self): + """Creates a new instance of ReplyOnStopWordsState.""" return ReplyOnStopWordsState() class ReplyOnStopWords(ReplyOnPause): + """ + A stream handler that extends ReplyOnPause to trigger based on stop words + followed by a pause. + + This handler listens to the incoming audio stream, performs Speech-to-Text (STT) + to detect predefined stop words. Once a stop word is detected, it waits for a + subsequent pause in speech (using the VAD model) before triggering the reply + function (`fn`) with the audio recorded *after* the stop word. + + Attributes: + stop_words (list[str]): A list of words or phrases that trigger the pause detection. + state (ReplyOnStopWordsState): The current state of the stop word and pause detection logic. + stt_model: The Speech-to-Text model instance used for detecting stop words. + """ + def __init__( self, fn: ReplyFnGenerator, @@ -42,7 +61,28 @@ class ReplyOnStopWords(ReplyOnPause): output_frame_size: int | None = None, # Deprecated input_sample_rate: int = 48000, model: PauseDetectionModel | None = None, + needs_args: bool = False, ): + """ + Initializes the ReplyOnStopWords handler. + + Args: + fn: The generator function to execute upon stop word and pause detection. + It receives `(sample_rate, audio_array)` and optionally `*args`. + stop_words: A list of strings (words or phrases) to listen for. + Detection is case-insensitive and ignores punctuation. + startup_fn: An optional function to run once at the beginning. + algo_options: Options for the pause detection algorithm (used after stop word). + model_options: Options for the VAD model. + can_interrupt: If True, incoming audio during `fn` execution + will stop the generator and process the new audio. + expected_layout: Expected input audio layout ('mono' or 'stereo'). + output_sample_rate: The sample rate expected for audio yielded by `fn`. + output_frame_size: Deprecated. + input_sample_rate: The expected sample rate of incoming audio. + model: An optional pre-initialized VAD model instance. + needs_args: Whether the reply function expects additional arguments. + """ super().__init__( fn, algo_options=algo_options, @@ -54,12 +94,25 @@ class ReplyOnStopWords(ReplyOnPause): output_frame_size=output_frame_size, input_sample_rate=input_sample_rate, model=model, + needs_args=needs_args, ) self.stop_words = stop_words self.state = ReplyOnStopWordsState() self.stt_model = get_stt_model("moonshine/base") def stop_word_detected(self, text: str) -> bool: + """ + Checks if any of the configured stop words are present in the text. + + Performs a case-insensitive search, treating multi-word stop phrases + correctly and ignoring basic punctuation. + + Args: + text: The text transcribed from the audio. + + Returns: + True if a stop word is found, False otherwise. + """ for stop_word in self.stop_words: stop_word = stop_word.lower().strip().split(" ") if bool( @@ -75,24 +128,43 @@ class ReplyOnStopWords(ReplyOnPause): async def _send_stopword( self, ): + """Internal async method to send a 'stopword' message via the channel.""" if self.channel: self.channel.send(create_message("stopword", "")) logger.debug("Sent stopword") def send_stopword(self): + """Sends a 'stopword' message asynchronously via the communication channel.""" asyncio.run_coroutine_threadsafe(self._send_stopword(), self.loop) def determine_pause( # type: ignore self, audio: np.ndarray, sampling_rate: int, state: ReplyOnStopWordsState ) -> bool: - """Take in the stream, determine if a pause happened""" + """ + Analyzes an audio chunk to detect stop words and subsequent pauses. + + Overrides the `ReplyOnPause.determine_pause` method. + First, it performs STT on the audio buffer to detect stop words. + Once a stop word is detected (`state.stop_word_detected` is True), it then + uses the VAD model (similar to `ReplyOnPause`) to detect a pause in the + audio *following* the stop word. + + Args: + audio: The numpy array containing the audio chunk. + sampling_rate: The sample rate of the audio chunk. + state: The current application state (ReplyOnStopWordsState). + + Returns: + True if a stop word has been detected and a subsequent pause + satisfying the configured thresholds is detected, False otherwise. + """ import librosa duration = len(audio) / sampling_rate if duration >= self.algo_options.audio_chunk_duration: if not state.stop_word_detected: - audio_f32 = audio_to_float32((sampling_rate, audio)) + audio_f32 = audio_to_float32(audio) audio_rs = librosa.resample( audio_f32, orig_sr=sampling_rate, target_sr=16000 ) @@ -142,12 +214,19 @@ class ReplyOnStopWords(ReplyOnPause): return False def reset(self): + """ + Resets the handler state to its initial condition. + + Clears accumulated audio, resets state flags (including stop word state), + closes any active generator, and clears the event flag. + """ super().reset() self.generator = None self.event.clear() self.state = ReplyOnStopWordsState() def copy(self): + """Creates a new instance of ReplyOnStopWords with the same configuration.""" return ReplyOnStopWords( self.fn, self.stop_words, @@ -160,4 +239,5 @@ class ReplyOnStopWords(ReplyOnPause): self.output_frame_size, self.input_sample_rate, self.model, + self.needs_args, ) diff --git a/backend/fastrtc/speech_to_text/stt_.py b/backend/fastrtc/speech_to_text/stt_.py index f8d7a6c..c4c31d8 100644 --- a/backend/fastrtc/speech_to_text/stt_.py +++ b/backend/fastrtc/speech_to_text/stt_.py @@ -32,8 +32,7 @@ class MoonshineSTT(STTModel): def stt(self, audio: tuple[int, NDArray[np.int16 | np.float32]]) -> str: sr, audio_np = audio # type: ignore - if audio_np.dtype == np.int16: - audio_np = audio_to_float32(audio) + audio_np = audio_to_float32(audio_np) if sr != 16000: audio_np: NDArray[np.float32] = librosa.resample( audio_np, orig_sr=sr, target_sr=16000 diff --git a/backend/fastrtc/stream.py b/backend/fastrtc/stream.py index 329ba04..6e0846f 100644 --- a/backend/fastrtc/stream.py +++ b/backend/fastrtc/stream.py @@ -1,15 +1,16 @@ +import inspect import logging +from collections.abc import Callable +from contextlib import AbstractAsyncContextManager from pathlib import Path from typing import ( Any, - AsyncContextManager, - Callable, Literal, - Optional, TypedDict, cast, ) +import anyio import gradio as gr from fastapi import FastAPI, Request, WebSocket from fastapi.responses import HTMLResponse @@ -19,6 +20,7 @@ from pydantic import BaseModel from typing_extensions import NotRequired from .tracks import HandlerType, StreamHandlerImpl +from .utils import RTCConfigurationCallable from .webrtc import WebRTC from .webrtc_connection_mixin import WebRTCConnectionMixin from .websocket import WebSocketHandler @@ -29,13 +31,17 @@ curr_dir = Path(__file__).parent class Body(BaseModel): - sdp: Optional[str] = None - candidate: Optional[dict[str, Any]] = None + sdp: str | None = None + candidate: dict[str, Any] | None = None type: str webrtc_id: str class UIArgs(TypedDict): + """ + UI customization arguments for the Gradio Blocks UI of the Stream class + """ + title: NotRequired[str] """Title of the demo""" subtitle: NotRequired[str] @@ -53,9 +59,39 @@ class UIArgs(TypedDict): If "submit", the input will be sent when the submit event is triggered by the user. If "change", the input will be sent whenever the user changes the input value. """ + hide_title: NotRequired[bool] + """If True, the title and subtitle will not be displayed.""" class Stream(WebRTCConnectionMixin): + """ + Define an audio or video stream with a built-in UI, mountable on a FastAPI app. + + This class encapsulates the logic for handling real-time communication (WebRTC) + streams, including setting up peer connections, managing tracks, generating + a Gradio user interface, and integrating with FastAPI for API endpoints. + It supports different modes (send, receive, send-receive) and modalities + (audio, video, audio-video), and can optionally handle additional Gradio + input/output components alongside the stream. It also provides functionality + for telephone integration via the FastPhone method. + + Attributes: + mode (Literal["send-receive", "receive", "send"]): The direction of the stream. + modality (Literal["video", "audio", "audio-video"]): The type of media stream. + rtp_params (dict[str, Any] | None): Parameters for RTP encoding. + event_handler (HandlerType): The main function to process stream data. + concurrency_limit (int): The maximum number of concurrent connections allowed. + time_limit (float | None): Time limit in seconds for the event handler execution. + allow_extra_tracks (bool): Whether to allow extra tracks beyond the specified modality. + additional_output_components (list[Component] | None): Extra Gradio output components. + additional_input_components (list[Component] | None): Extra Gradio input components. + additional_outputs_handler (Callable | None): Handler for additional outputs. + track_constraints (dict[str, Any] | None): Constraints for media tracks (e.g., resolution). + webrtc_component (WebRTC): The underlying Gradio WebRTC component instance. + rtc_configuration (dict[str, Any] | None): Configuration for the RTCPeerConnection (e.g., ICE servers). + _ui (Blocks): The Gradio Blocks UI instance. + """ + def __init__( self, handler: HandlerType, @@ -65,17 +101,55 @@ class Stream(WebRTCConnectionMixin): modality: Literal["video", "audio", "audio-video"] = "video", concurrency_limit: int | None | Literal["default"] = "default", time_limit: float | None = None, + allow_extra_tracks: bool = False, rtp_params: dict[str, Any] | None = None, - rtc_configuration: dict[str, Any] | None = None, + rtc_configuration: RTCConfigurationCallable | None = None, + server_rtc_configuration: dict[str, Any] | None = None, + track_constraints: dict[str, Any] | None = None, additional_inputs: list[Component] | None = None, additional_outputs: list[Component] | None = None, ui_args: UIArgs | None = None, + verbose: bool = True, ): + """ + Initialize the Stream instance. + + Args: + handler: The function to handle incoming stream data and return output data. + additional_outputs_handler: An optional function to handle updates to additional output components. + mode: The direction of the stream ('send', 'receive', or 'send-receive'). + modality: The type of media ('video', 'audio', or 'audio-video'). + concurrency_limit: Maximum number of concurrent connections. 'default' maps to 1. + time_limit: Maximum execution time for the handler function in seconds. + allow_extra_tracks: If True, allows connections with tracks not matching the modality. + rtp_params: Optional dictionary of RTP encoding parameters. + rtc_configuration: Optional Callable or dictionary for RTCPeerConnection configuration (e.g., ICE servers). + Required when deploying on Colab or Spaces. + server_rtc_configuration: Optional dictionary for RTCPeerConnection configuration on the server side. Note + that setting iceServers to be an empty list will mean no ICE servers will be used in the server. + track_constraints: Optional dictionary of constraints for media tracks (e.g., resolution, frame rate). + additional_inputs: Optional list of extra Gradio input components. + additional_outputs: Optional list of extra Gradio output components. Requires `additional_outputs_handler`. + ui_args: Optional dictionary to customize the default UI appearance (title, subtitle, icon, etc.). + verbose: Whether to print verbose logging on startup. + + Raises: + ValueError: If `additional_outputs` are provided without `additional_outputs_handler`. + """ WebRTCConnectionMixin.__init__(self) self.mode = mode self.modality = modality self.rtp_params = rtp_params self.event_handler = handler + if ( + ui_args + and ui_args.get("variant") == "textbox" + and hasattr(handler, "needs_args") + ): + self.event_handler.needs_args = True # type: ignore + else: + self.event_handler.needs_args = False # type: ignore + self.concurrency_limit = cast( (int), 1 if concurrency_limit in ["default", None] else concurrency_limit, @@ -84,14 +158,33 @@ class Stream(WebRTCConnectionMixin): int | Literal["default"] | None, concurrency_limit ) self.time_limit = time_limit + self.allow_extra_tracks = allow_extra_tracks self.additional_output_components = additional_outputs self.additional_input_components = additional_inputs self.additional_outputs_handler = additional_outputs_handler + self.track_constraints = track_constraints + self.webrtc_component: WebRTC self.rtc_configuration = rtc_configuration + self.server_rtc_configuration = self.convert_to_aiortc_format( + server_rtc_configuration + ) + self.verbose = verbose self._ui = self._generate_default_ui(ui_args) self._ui.launch = self._wrap_gradio_launch(self._ui.launch) def mount(self, app: FastAPI, path: str = ""): + """ + Mount the stream's API endpoints onto a FastAPI application. + + This method adds the necessary routes (`/webrtc/offer`, `/telephone/handler`, + `/telephone/incoming`, `/websocket/offer`) to the provided FastAPI app, + prefixed with the optional `path`. It also injects a startup message + into the app's lifespan. + + Args: + app: The FastAPI application instance. + path: An optional URL prefix for the mounted routes. + """ from fastapi import APIRouter router = APIRouter(prefix=path) @@ -104,7 +197,18 @@ class Stream(WebRTCConnectionMixin): app.include_router(router) @staticmethod - def print_error(env: Literal["colab", "spaces"]): + def _print_error(env: Literal["colab", "spaces"]): + """ + Print an error message and raise RuntimeError for missing rtc_configuration. + + Used internally when running in Colab or Spaces without necessary WebRTC setup. + + Args: + env: The environment ('colab' or 'spaces') where the error occurred. + + Raises: + RuntimeError: Always raised after printing the error message. + """ import click print( @@ -120,14 +224,34 @@ class Stream(WebRTCConnectionMixin): ) def _check_colab_or_spaces(self): + """ + Check if running in Colab or Spaces and if rtc_configuration is missing. + + Calls `_print_error` if the conditions are met. + + Raises: + RuntimeError: If running in Colab/Spaces without `rtc_configuration`. + """ from gradio.utils import colab_check, get_space if colab_check() and not self.rtc_configuration: - self.print_error("colab") + self._print_error("colab") if get_space() and not self.rtc_configuration: - self.print_error("spaces") + self._print_error("spaces") def _wrap_gradio_launch(self, callable): + """ + Wrap the Gradio launch method to inject environment checks. + + Ensures that `_check_colab_or_spaces` is called during the application + lifespan when `Blocks.launch()` is invoked. + + Args: + callable: The original `gradio.Blocks.launch` method. + + Returns: + A wrapped version of the launch method. + """ import contextlib def wrapper(*args, **kwargs): @@ -151,20 +275,30 @@ class Stream(WebRTCConnectionMixin): return wrapper def _inject_startup_message( - self, lifespan: Callable[[FastAPI], AsyncContextManager] | None = None + self, lifespan: Callable[[FastAPI], AbstractAsyncContextManager] | None = None ): + """ + Create a FastAPI lifespan context manager to print startup messages and check environment. + + Args: + lifespan: An optional existing lifespan context manager to wrap. + + Returns: + An async context manager function suitable for `FastAPI(lifespan=...)`. + """ import contextlib import click def print_startup_message(): self._check_colab_or_spaces() - print( - click.style("INFO", fg="green") - + ":\t Visit " - + click.style("https://fastrtc.org/userguide/api/", fg="cyan") - + " for WebRTC or Websocket API docs." - ) + if self.verbose: + print( + click.style("INFO", fg="green") + + ":\t Visit " + + click.style("https://fastrtc.org/userguide/api/", fg="cyan") + + " for WebRTC or Websocket API docs." + ) @contextlib.asynccontextmanager async def new_lifespan(app: FastAPI): @@ -181,7 +315,26 @@ class Stream(WebRTCConnectionMixin): def _generate_default_ui( self, ui_args: UIArgs | None = None, - ): + ) -> Blocks: + """ + Generate the default Gradio UI based on mode, modality, and arguments. + + Constructs a `gradio.Blocks` interface with the appropriate WebRTC component + and any specified additional input/output components. + + Args: + ui_args: Optional dictionary containing UI customization arguments + (title, subtitle, icon, etc.). + + Returns: + A `gradio.Blocks` instance representing the generated UI. + + Raises: + ValueError: If `additional_outputs` are provided without + `additional_outputs_handler`. + ValueError: If the combination of `mode` and `modality` is invalid + or not supported for UI generation. + """ ui_args = ui_args or {} same_components = [] additional_input_components = self.additional_input_components or [] @@ -201,21 +354,22 @@ class Stream(WebRTCConnectionMixin): same_components.append(component) if self.modality == "video" and self.mode == "receive": with gr.Blocks() as demo: - gr.HTML( - f""" -

- {ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")} -

- """ - ) - if ui_args.get("subtitle"): - gr.Markdown( + if not ui_args.get("hide_title"): + gr.HTML( f""" -
- {ui_args.get("subtitle")} -
- """ +

+ {ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")} +

+ """ ) + if ui_args.get("subtitle"): + gr.Markdown( + f""" +
+ {ui_args.get("subtitle")} +
+ """ + ) with gr.Row(): with gr.Column(): if additional_input_components: @@ -226,9 +380,11 @@ class Stream(WebRTCConnectionMixin): output_video = WebRTC( label="Video Stream", rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, mode="receive", modality="video", ) + self.webrtc_component = output_video for component in additional_output_components: if component not in same_components: component.render() @@ -251,21 +407,22 @@ class Stream(WebRTCConnectionMixin): ) elif self.modality == "video" and self.mode == "send": with gr.Blocks() as demo: - gr.HTML( - f""" -

- {ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")} -

- """ - ) - if ui_args.get("subtitle"): - gr.Markdown( + if not ui_args.get("hide_title"): + gr.HTML( f""" -
- {ui_args.get("subtitle")} -
- """ +

+ {ui_args.get("title", "Video Streaming (Powered by FastRTC ⚡️)")} +

+ """ ) + if ui_args.get("subtitle"): + gr.Markdown( + f""" +
+ {ui_args.get("subtitle")} +
+ """ + ) with gr.Row(): if additional_input_components: with gr.Column(): @@ -275,9 +432,11 @@ class Stream(WebRTCConnectionMixin): output_video = WebRTC( label="Video Stream", rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, mode="send", modality="video", ) + self.webrtc_component = output_video for component in additional_output_components: if component not in same_components: component.render() @@ -322,6 +481,7 @@ class Stream(WebRTCConnectionMixin): image = WebRTC( label="Stream", rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, mode="send-receive", modality="video", ) @@ -332,7 +492,7 @@ class Stream(WebRTCConnectionMixin): for component in additional_output_components: if component not in same_components: component.render() - + self.webrtc_component = image image.stream( fn=self.event_handler, inputs=[image] + additional_input_components, @@ -351,41 +511,43 @@ class Stream(WebRTCConnectionMixin): ) elif self.modality == "audio" and self.mode == "receive": with gr.Blocks() as demo: - gr.HTML( - f""" -

- {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} -

- """ - ) - if ui_args.get("subtitle"): - gr.Markdown( + if not ui_args.get("hide_title"): + gr.HTML( f""" -
- {ui_args.get("subtitle")} -
- """ +

+ {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} +

+ """ ) + if ui_args.get("subtitle"): + gr.Markdown( + f""" +
+ {ui_args.get("subtitle")} +
+ """ + ) with gr.Row(): with gr.Column(): for component in additional_input_components: component.render() button = gr.Button("Start Stream", variant="primary") - if additional_output_components: - with gr.Column(): - output_video = WebRTC( - label="Audio Stream", - rtc_configuration=self.rtc_configuration, - mode="receive", - modality="audio", - icon=ui_args.get("icon"), - icon_button_color=ui_args.get("icon_button_color"), - pulse_color=ui_args.get("pulse_color"), - icon_radius=ui_args.get("icon_radius"), - ) - for component in additional_output_components: - if component not in same_components: - component.render() + with gr.Column(): + output_video = WebRTC( + label="Audio Stream", + rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, + mode="receive", + modality="audio", + icon=ui_args.get("icon"), + icon_button_color=ui_args.get("icon_button_color"), + pulse_color=ui_args.get("pulse_color"), + icon_radius=ui_args.get("icon_radius"), + ) + self.webrtc_component = output_video + for component in additional_output_components: + if component not in same_components: + component.render() output_video.stream( fn=self.event_handler, inputs=self.additional_input_components, @@ -405,41 +567,74 @@ class Stream(WebRTCConnectionMixin): ) elif self.modality == "audio" and self.mode == "send": with gr.Blocks() as demo: - gr.HTML( - f""" -

- {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} -

- """ - ) - if ui_args.get("subtitle"): - gr.Markdown( + if not ui_args.get("hide_title"): + gr.HTML( f""" -
- {ui_args.get("subtitle")} -
- """ +

+ {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} +

+ """ ) - with gr.Row(): - with gr.Column(): - with gr.Group(): - image = WebRTC( - label="Stream", - rtc_configuration=self.rtc_configuration, - mode="send", - modality="audio", - icon=ui_args.get("icon"), - icon_button_color=ui_args.get("icon_button_color"), - pulse_color=ui_args.get("pulse_color"), - icon_radius=ui_args.get("icon_radius"), - ) - for component in additional_input_components: - if component not in same_components: + if ui_args.get("subtitle"): + gr.Markdown( + f""" +
+ {ui_args.get("subtitle")} +
+ """ + ) + if ui_args.get("variant", "textbox"): + with gr.Row(): + if additional_input_components: + with gr.Column(): + for component in additional_input_components: component.render() - if additional_output_components: + diff_output_components = [ + component + for component in additional_output_components + if component not in same_components + ] + if diff_output_components: + with gr.Column(): + for component in diff_output_components: + component.render() + with gr.Row(): + image = WebRTC( + label="Stream", + rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, + mode="send", + modality="audio", + icon=ui_args.get("icon"), + icon_button_color=ui_args.get("icon_button_color"), + pulse_color=ui_args.get("pulse_color"), + icon_radius=ui_args.get("icon_radius"), + variant=ui_args.get("variant", "wave"), + ) + else: + with gr.Row(): with gr.Column(): - for component in additional_output_components: - component.render() + with gr.Group(): + image = WebRTC( + label="Stream", + rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, + mode="send", + modality="audio", + icon=ui_args.get("icon"), + icon_button_color=ui_args.get("icon_button_color"), + pulse_color=ui_args.get("pulse_color"), + icon_radius=ui_args.get("icon_radius"), + variant=ui_args.get("variant", "wave"), + ) + for component in additional_input_components: + if component not in same_components: + component.render() + if additional_output_components: + with gr.Column(): + for component in additional_output_components: + component.render() + self.webrtc_component = image image.stream( fn=self.event_handler, inputs=[image] + additional_input_components, @@ -458,83 +653,132 @@ class Stream(WebRTCConnectionMixin): ) elif self.modality == "audio" and self.mode == "send-receive": with gr.Blocks() as demo: - gr.HTML( - f""" -

- {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} -

- """ - ) - if ui_args.get("subtitle"): - gr.Markdown( + if not ui_args.get("hide_title"): + gr.HTML( f""" -
- {ui_args.get("subtitle")} -
- """ +

+ {ui_args.get("title", "Audio Streaming (Powered by FastRTC ⚡️)")} +

+ """ ) - with gr.Row(): - with gr.Column(): - with gr.Group(): - image = WebRTC( - label="Stream", - rtc_configuration=self.rtc_configuration, - mode="send-receive", - modality="audio", - icon=ui_args.get("icon"), - icon_button_color=ui_args.get("icon_button_color"), - pulse_color=ui_args.get("pulse_color"), - icon_radius=ui_args.get("icon_radius"), - ) - for component in additional_input_components: - if component not in same_components: - component.render() - if additional_output_components: - with gr.Column(): - for component in additional_output_components: - component.render() - - image.stream( - fn=self.event_handler, - inputs=[image] + additional_input_components, - outputs=[image], - time_limit=self.time_limit, - concurrency_limit=self.concurrency_limit, # type: ignore - send_input_on=ui_args.get("send_input_on", "change"), - ) - if additional_output_components: - assert self.additional_outputs_handler - image.on_additional_outputs( - self.additional_outputs_handler, - inputs=additional_output_components, - outputs=additional_output_components, - concurrency_limit=self.concurrency_limit_gradio, # type: ignore + if ui_args.get("subtitle"): + gr.Markdown( + f""" +
+ {ui_args.get("subtitle")} +
+ """ ) + if ui_args.get("variant", "") == "textbox": + with gr.Row(): + if additional_input_components: + with gr.Column(): + for component in additional_input_components: + component.render() + diff_output_components = [ + component + for component in additional_output_components + if component not in same_components + ] + if diff_output_components: + with gr.Column(): + for component in diff_output_components: + component.render() + with gr.Row(): + image = WebRTC( + label="Stream", + rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, + mode="send-receive", + modality="audio", + icon=ui_args.get("icon"), + icon_button_color=ui_args.get("icon_button_color"), + pulse_color=ui_args.get("pulse_color"), + icon_radius=ui_args.get("icon_radius"), + variant=ui_args.get("variant", "wave"), + ) + else: + if additional_output_components: + with gr.Row(): + with gr.Column(): + image = WebRTC( + label="Stream", + rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, + mode="send-receive", + modality="audio", + icon=ui_args.get("icon"), + icon_button_color=ui_args.get("icon_button_color"), + pulse_color=ui_args.get("pulse_color"), + icon_radius=ui_args.get("icon_radius"), + ) + for component in additional_input_components: + if component not in same_components: + component.render() + with gr.Column(): + for component in additional_output_components: + component.render() + else: + with gr.Row(): + with gr.Column(): + image = WebRTC( + label="Stream", + rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, + mode="send-receive", + modality="audio", + icon=ui_args.get("icon"), + icon_button_color=ui_args.get("icon_button_color"), + pulse_color=ui_args.get("pulse_color"), + icon_radius=ui_args.get("icon_radius"), + ) + for component in additional_input_components: + if component not in same_components: + component.render() + self.webrtc_component = image + image.stream( + fn=self.event_handler, + inputs=[image] + additional_input_components, + outputs=[image], + time_limit=self.time_limit, + concurrency_limit=self.concurrency_limit, # type: ignore + send_input_on=ui_args.get("send_input_on", "change"), + ) + if additional_output_components: + assert self.additional_outputs_handler + image.on_additional_outputs( + self.additional_outputs_handler, + inputs=additional_output_components, + outputs=additional_output_components, + concurrency_limit=self.concurrency_limit_gradio, # type: ignore + ) elif self.modality == "audio-video" and self.mode == "send-receive": css = """.my-group {max-width: 600px !important; max-height: 600 !important;} .my-column {display: flex !important; justify-content: center !important; align-items: center !important};""" with gr.Blocks(css=css) as demo: - gr.HTML( - f""" -

- {ui_args.get("title", "Audio Video Streaming (Powered by FastRTC ⚡️)")} -

- """ - ) - if ui_args.get("subtitle"): - gr.Markdown( + if not ui_args.get("hide_title"): + gr.HTML( f""" -
- {ui_args.get("subtitle")} -
- """ +

+ {ui_args.get("title", "Audio Video Streaming (Powered by FastRTC ⚡️)")} +

+ """ ) + if ui_args.get("subtitle"): + gr.Markdown( + f""" +
+ {ui_args.get("subtitle")} +
+ """ + ) with gr.Row(): with gr.Column(elem_classes=["my-column"]): with gr.Group(elem_classes=["my-group"]): image = WebRTC( label="Stream", rtc_configuration=self.rtc_configuration, + track_constraints=self.track_constraints, mode="send-receive", modality="audio-video", icon=ui_args.get("icon"), @@ -542,6 +786,7 @@ class Stream(WebRTCConnectionMixin): pulse_color=ui_args.get("pulse_color"), icon_radius=ui_args.get("icon_radius"), ) + self.webrtc_component = image for component in additional_input_components: if component not in same_components: component.render() @@ -572,29 +817,82 @@ class Stream(WebRTCConnectionMixin): @property def ui(self) -> Blocks: + """ + Get the Gradio Blocks UI instance associated with this stream. + + Returns: + The `gradio.Blocks` UI instance. + """ return self._ui @ui.setter def ui(self, blocks: Blocks): + """ + Set a custom Gradio Blocks UI for this stream. + + Args: + blocks: The `gradio.Blocks` instance to use as the UI. + """ self._ui = blocks async def offer(self, body: Body): + """ + Handle an incoming WebRTC offer via HTTP POST. + + Processes the SDP offer and ICE candidates from the client to establish + a WebRTC connection. + + Args: + body: A Pydantic model containing the SDP offer, optional ICE candidate, + type ('offer'), and a unique WebRTC ID. + + Returns: + A dictionary containing the SDP answer generated by the server. + """ return await self.handle_offer( body.model_dump(), set_outputs=self.set_additional_outputs(body.webrtc_id) ) + async def get_rtc_configuration(self): + if inspect.isfunction(self.rtc_configuration): + if inspect.iscoroutinefunction(self.rtc_configuration): + return await self.rtc_configuration() + else: + return anyio.to_thread.run_sync(self.rtc_configuration) # type: ignore + else: + return self.rtc_configuration + async def handle_incoming_call(self, request: Request): + """ + Handle incoming telephone calls (e.g., via Twilio). + + Generates TwiML instructions to connect the incoming call to the + WebSocket handler (`/telephone/handler`) for audio streaming. + + Args: + request: The FastAPI Request object for the incoming call webhook. + + Returns: + An HTMLResponse containing the TwiML instructions as XML. + """ from twilio.twiml.voice_response import Connect, VoiceResponse response = VoiceResponse() response.say("Connecting to the AI assistant.") connect = Connect() - connect.stream(url=f"wss://{request.url.hostname}/telephone/handler") + path = request.url.path.removesuffix("/telephone/incoming") + connect.stream(url=f"wss://{request.url.hostname}{path}/telephone/handler") response.append(connect) response.say("The call has been disconnected.") return HTMLResponse(content=str(response), media_type="application/xml") async def telephone_handler(self, websocket: WebSocket): + """ + The websocket endpoint for streaming audio over Twilio phone. + + Args: + websocket: The incoming WebSocket connection object. + """ handler = cast(StreamHandlerImpl, self.event_handler.copy()) # type: ignore handler.phone_mode = True @@ -618,6 +916,15 @@ class Stream(WebRTCConnectionMixin): await ws.handle_websocket(websocket) async def websocket_offer(self, websocket: WebSocket): + """ + Handle WebRTC signaling over a WebSocket connection. + + Provides an alternative to the HTTP POST `/webrtc/offer` endpoint for + exchanging SDP offers/answers and ICE candidates via WebSocket messages. + + Args: + websocket: The incoming WebSocket connection object. + """ handler = cast(StreamHandlerImpl, self.event_handler.copy()) # type: ignore handler.phone_mode = False @@ -652,6 +959,25 @@ class Stream(WebRTCConnectionMixin): port: int = 8000, **kwargs, ): + """ + Launch the FastPhone service for telephone integration. + + Starts a local FastAPI server, mounts the stream, creates a public tunnel + (using Gradio's tunneling), registers the tunnel URL with the FastPhone + backend service, and prints the assigned phone number and access code. + This allows users to call the phone number and interact with the stream handler. + + Args: + token: Optional Hugging Face Hub token for authentication with the + FastPhone service. If None, attempts to find one automatically. + host: The local host address to bind the server to. + port: The local port to bind the server to. + **kwargs: Additional keyword arguments passed to `uvicorn.run`. + + Raises: + httpx.HTTPStatusError: If registration with the FastPhone service fails. + RuntimeError: If running in Colab/Spaces without `rtc_configuration`. + """ import atexit import inspect import secrets @@ -698,6 +1024,7 @@ class Stream(WebRTCConnectionMixin): json={"url": host}, headers={"Authorization": token or get_token() or ""}, ) + r.raise_for_status() except Exception: URL = "https://fastrtc-fastphone.hf.space" r = httpx.post( @@ -706,6 +1033,14 @@ class Stream(WebRTCConnectionMixin): headers={"Authorization": token or get_token() or ""}, ) r.raise_for_status() + if r.status_code == 202: + print( + click.style("INFO", fg="orange") + + ":\t You have " + + "run out of your quota" + ) + return + data = r.json() code = f"{data['code']}" phone_number = data["phone"] diff --git a/backend/fastrtc/templates/component/_basePickBy-Bz_aTL3_.js b/backend/fastrtc/templates/component/_basePickBy-Bz_aTL3_.js new file mode 100644 index 0000000..adc30e0 --- /dev/null +++ b/backend/fastrtc/templates/component/_basePickBy-Bz_aTL3_.js @@ -0,0 +1,151 @@ +import { e as x, c as b, g as m, k as P, h as p, j as w, l as N, m as c, n as I, t as A, o as M } from "./_baseUniq-BN26mYqf.js"; +import { aJ as g, az as E, aK as F, aL as _, aM as $, aN as l, aO as B, aP as T, aQ as y, aR as L } from "./mermaid.core-Cmyps_S7.js"; +var R = /\s/; +function S(n) { + for (var r = n.length; r-- && R.test(n.charAt(r)); ) + ; + return r; +} +var z = /^\s+/; +function G(n) { + return n && n.slice(0, S(n) + 1).replace(z, ""); +} +var o = NaN, H = /^[-+]0x[0-9a-f]+$/i, K = /^0b[01]+$/i, q = /^0o[0-7]+$/i, C = parseInt; +function J(n) { + if (typeof n == "number") + return n; + if (x(n)) + return o; + if (g(n)) { + var r = typeof n.valueOf == "function" ? n.valueOf() : n; + n = g(r) ? r + "" : r; + } + if (typeof n != "string") + return n === 0 ? n : +n; + n = G(n); + var t = K.test(n); + return t || q.test(n) ? C(n.slice(2), t ? 2 : 8) : H.test(n) ? o : +n; +} +var v = 1 / 0, Q = 17976931348623157e292; +function W(n) { + if (!n) + return n === 0 ? n : 0; + if (n = J(n), n === v || n === -v) { + var r = n < 0 ? -1 : 1; + return r * Q; + } + return n === n ? n : 0; +} +function X(n) { + var r = W(n), t = r % 1; + return r === r ? t ? r - t : r : 0; +} +function fn(n) { + var r = n == null ? 0 : n.length; + return r ? b(n) : []; +} +var O = Object.prototype, Y = O.hasOwnProperty, dn = E(function(n, r) { + n = Object(n); + var t = -1, i = r.length, a = i > 2 ? r[2] : void 0; + for (a && F(r[0], r[1], a) && (i = 1); ++t < i; ) + for (var f = r[t], e = _(f), s = -1, d = e.length; ++s < d; ) { + var u = e[s], h = n[u]; + (h === void 0 || $(h, O[u]) && !Y.call(n, u)) && (n[u] = f[u]); + } + return n; +}); +function un(n) { + var r = n == null ? 0 : n.length; + return r ? n[r - 1] : void 0; +} +function D(n) { + return function(r, t, i) { + var a = Object(r); + if (!l(r)) { + var f = m(t); + r = P(r), t = function(s) { + return f(a[s], s, a); + }; + } + var e = n(r, t, i); + return e > -1 ? a[f ? r[e] : e] : void 0; + }; +} +var U = Math.max; +function Z(n, r, t) { + var i = n == null ? 0 : n.length; + if (!i) + return -1; + var a = t == null ? 0 : X(t); + return a < 0 && (a = U(i + a, 0)), p(n, m(r), a); +} +var hn = D(Z); +function V(n, r) { + var t = -1, i = l(n) ? Array(n.length) : []; + return w(n, function(a, f, e) { + i[++t] = r(a, f, e); + }), i; +} +function gn(n, r) { + var t = B(n) ? N : V; + return t(n, m(r)); +} +var j = Object.prototype, k = j.hasOwnProperty; +function nn(n, r) { + return n != null && k.call(n, r); +} +function mn(n, r) { + return n != null && c(n, r, nn); +} +function rn(n, r) { + return n < r; +} +function tn(n, r, t) { + for (var i = -1, a = n.length; ++i < a; ) { + var f = n[i], e = r(f); + if (e != null && (s === void 0 ? e === e && !x(e) : t(e, s))) + var s = e, d = f; + } + return d; +} +function on(n) { + return n && n.length ? tn(n, T, rn) : void 0; +} +function an(n, r, t, i) { + if (!g(n)) + return n; + r = I(r, n); + for (var a = -1, f = r.length, e = f - 1, s = n; s != null && ++a < f; ) { + var d = A(r[a]), u = t; + if (d === "__proto__" || d === "constructor" || d === "prototype") + return n; + if (a != e) { + var h = s[d]; + u = void 0, u === void 0 && (u = g(h) ? h : y(r[a + 1]) ? [] : {}); + } + L(s, d, u), s = s[d]; + } + return n; +} +function vn(n, r, t) { + for (var i = -1, a = r.length, f = {}; ++i < a; ) { + var e = r[i], s = M(n, e); + t(s, e) && an(f, I(e, n), s); + } + return f; +} +export { + rn as a, + tn as b, + V as c, + vn as d, + on as e, + fn as f, + hn as g, + mn as h, + dn as i, + X as j, + un as l, + gn as m, + W as t +}; diff --git a/backend/fastrtc/templates/component/_baseUniq-BN26mYqf.js b/backend/fastrtc/templates/component/_baseUniq-BN26mYqf.js new file mode 100644 index 0000000..1573022 --- /dev/null +++ b/backend/fastrtc/templates/component/_baseUniq-BN26mYqf.js @@ -0,0 +1,615 @@ +import { b9 as I, ba as Rn, bb as w, aO as T, aN as sn, bc as xn, bd as Mn, be as mn, bf as un, bg as x, aL as G, bh as Fn, bi as on, bj as Cn, bk as S, bl as R, b7 as gn, aJ as ln, bm as Dn, bn as D, bo as Nn, bp as Gn, bq as _, aR as Un, br as Bn, aM as Kn, bs as J, bt as jn, bu as Hn, aQ as Yn, aP as cn, b5 as qn, bv as m } from "./mermaid.core-Cmyps_S7.js"; +var Zn = "[object Symbol]"; +function U(n) { + return typeof n == "symbol" || I(n) && Rn(n) == Zn; +} +function bn(n, r) { + for (var e = -1, t = n == null ? 0 : n.length, a = Array(t); ++e < t; ) + a[e] = r(n[e], e, n); + return a; +} +var Jn = 1 / 0, Q = w ? w.prototype : void 0, X = Q ? Q.toString : void 0; +function dn(n) { + if (typeof n == "string") + return n; + if (T(n)) + return bn(n, dn) + ""; + if (U(n)) + return X ? X.call(n) : ""; + var r = n + ""; + return r == "0" && 1 / n == -Jn ? "-0" : r; +} +function Qn() { +} +function pn(n, r) { + for (var e = -1, t = n == null ? 0 : n.length; ++e < t && r(n[e], e, n) !== !1; ) + ; + return n; +} +function Xn(n, r, e, t) { + for (var a = n.length, i = e + -1; ++i < a; ) + if (r(n[i], i, n)) + return i; + return -1; +} +function Wn(n) { + return n !== n; +} +function zn(n, r, e) { + for (var t = e - 1, a = n.length; ++t < a; ) + if (n[t] === r) + return t; + return -1; +} +function Vn(n, r, e) { + return r === r ? zn(n, r, e) : Xn(n, Wn, e); +} +function kn(n, r) { + var e = n == null ? 0 : n.length; + return !!e && Vn(n, r, 0) > -1; +} +function $(n) { + return sn(n) ? xn(n) : Mn(n); +} +var nr = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, rr = /^\w*$/; +function B(n, r) { + if (T(n)) + return !1; + var e = typeof n; + return e == "number" || e == "symbol" || e == "boolean" || n == null || U(n) ? !0 : rr.test(n) || !nr.test(n) || r != null && n in Object(r); +} +var er = 500; +function tr(n) { + var r = mn(n, function(t) { + return e.size === er && e.clear(), t; + }), e = r.cache; + return r; +} +var ir = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, ar = /\\(\\)?/g, fr = tr(function(n) { + var r = []; + return n.charCodeAt(0) === 46 && r.push(""), n.replace(ir, function(e, t, a, i) { + r.push(a ? i.replace(ar, "$1") : t || e); + }), r; +}); +function sr(n) { + return n == null ? "" : dn(n); +} +function An(n, r) { + return T(n) ? n : B(n, r) ? [n] : fr(sr(n)); +} +var ur = 1 / 0; +function M(n) { + if (typeof n == "string" || U(n)) + return n; + var r = n + ""; + return r == "0" && 1 / n == -ur ? "-0" : r; +} +function yn(n, r) { + r = An(r, n); + for (var e = 0, t = r.length; n != null && e < t; ) + n = n[M(r[e++])]; + return e && e == t ? n : void 0; +} +function or(n, r, e) { + var t = n == null ? void 0 : yn(n, r); + return t === void 0 ? e : t; +} +function K(n, r) { + for (var e = -1, t = r.length, a = n.length; ++e < t; ) + n[a + e] = r[e]; + return n; +} +var W = w ? w.isConcatSpreadable : void 0; +function gr(n) { + return T(n) || un(n) || !!(W && n && n[W]); +} +function _t(n, r, e, t, a) { + var i = -1, f = n.length; + for (e || (e = gr), a || (a = []); ++i < f; ) { + var s = n[i]; + e(s) ? K(a, s) : t || (a[a.length] = s); + } + return a; +} +function lr(n, r, e, t) { + var a = -1, i = n == null ? 0 : n.length; + for (t && i && (e = n[++a]); ++a < i; ) + e = r(e, n[a], a, n); + return e; +} +function cr(n, r) { + return n && x(r, $(r), n); +} +function br(n, r) { + return n && x(r, G(r), n); +} +function Tn(n, r) { + for (var e = -1, t = n == null ? 0 : n.length, a = 0, i = []; ++e < t; ) { + var f = n[e]; + r(f, e, n) && (i[a++] = f); + } + return i; +} +function hn() { + return []; +} +var dr = Object.prototype, pr = dr.propertyIsEnumerable, z = Object.getOwnPropertySymbols, j = z ? function(n) { + return n == null ? [] : (n = Object(n), Tn(z(n), function(r) { + return pr.call(n, r); + })); +} : hn; +function Ar(n, r) { + return x(n, j(n), r); +} +var yr = Object.getOwnPropertySymbols, wn = yr ? function(n) { + for (var r = []; n; ) + K(r, j(n)), n = Fn(n); + return r; +} : hn; +function Tr(n, r) { + return x(n, wn(n), r); +} +function On(n, r, e) { + var t = r(n); + return T(n) ? t : K(t, e(n)); +} +function N(n) { + return On(n, $, j); +} +function hr(n) { + return On(n, G, wn); +} +var wr = Object.prototype, Or = wr.hasOwnProperty; +function $r(n) { + var r = n.length, e = new n.constructor(r); + return r && typeof n[0] == "string" && Or.call(n, "index") && (e.index = n.index, e.input = n.input), e; +} +function _r(n, r) { + var e = r ? on(n.buffer) : n.buffer; + return new n.constructor(e, n.byteOffset, n.byteLength); +} +var Ir = /\w*$/; +function Sr(n) { + var r = new n.constructor(n.source, Ir.exec(n)); + return r.lastIndex = n.lastIndex, r; +} +var V = w ? w.prototype : void 0, k = V ? V.valueOf : void 0; +function Er(n) { + return k ? Object(k.call(n)) : {}; +} +var Pr = "[object Boolean]", vr = "[object Date]", Lr = "[object Map]", Rr = "[object Number]", xr = "[object RegExp]", Mr = "[object Set]", mr = "[object String]", Fr = "[object Symbol]", Cr = "[object ArrayBuffer]", Dr = "[object DataView]", Nr = "[object Float32Array]", Gr = "[object Float64Array]", Ur = "[object Int8Array]", Br = "[object Int16Array]", Kr = "[object Int32Array]", jr = "[object Uint8Array]", Hr = "[object Uint8ClampedArray]", Yr = "[object Uint16Array]", qr = "[object Uint32Array]"; +function Zr(n, r, e) { + var t = n.constructor; + switch (r) { + case Cr: + return on(n); + case Pr: + case vr: + return new t(+n); + case Dr: + return _r(n, e); + case Nr: + case Gr: + case Ur: + case Br: + case Kr: + case jr: + case Hr: + case Yr: + case qr: + return Cn(n, e); + case Lr: + return new t(); + case Rr: + case mr: + return new t(n); + case xr: + return Sr(n); + case Mr: + return new t(); + case Fr: + return Er(n); + } +} +var Jr = "[object Map]"; +function Qr(n) { + return I(n) && S(n) == Jr; +} +var nn = R && R.isMap, Xr = nn ? gn(nn) : Qr, Wr = "[object Set]"; +function zr(n) { + return I(n) && S(n) == Wr; +} +var rn = R && R.isSet, Vr = rn ? gn(rn) : zr, kr = 1, ne = 2, re = 4, $n = "[object Arguments]", ee = "[object Array]", te = "[object Boolean]", ie = "[object Date]", ae = "[object Error]", _n = "[object Function]", fe = "[object GeneratorFunction]", se = "[object Map]", ue = "[object Number]", In = "[object Object]", oe = "[object RegExp]", ge = "[object Set]", le = "[object String]", ce = "[object Symbol]", be = "[object WeakMap]", de = "[object ArrayBuffer]", pe = "[object DataView]", Ae = "[object Float32Array]", ye = "[object Float64Array]", Te = "[object Int8Array]", he = "[object Int16Array]", we = "[object Int32Array]", Oe = "[object Uint8Array]", $e = "[object Uint8ClampedArray]", _e = "[object Uint16Array]", Ie = "[object Uint32Array]", g = {}; +g[$n] = g[ee] = g[de] = g[pe] = g[te] = g[ie] = g[Ae] = g[ye] = g[Te] = g[he] = g[we] = g[se] = g[ue] = g[In] = g[oe] = g[ge] = g[le] = g[ce] = g[Oe] = g[$e] = g[_e] = g[Ie] = !0; +g[ae] = g[_n] = g[be] = !1; +function F(n, r, e, t, a, i) { + var f, s = r & kr, u = r & ne, b = r & re; + if (f !== void 0) + return f; + if (!ln(n)) + return n; + var l = T(n); + if (l) { + if (f = $r(n), !s) + return Dn(n, f); + } else { + var o = S(n), c = o == _n || o == fe; + if (D(n)) + return Nn(n, s); + if (o == In || o == $n || c && !a) { + if (f = u || c ? {} : Gn(n), !s) + return u ? Tr(n, br(f, n)) : Ar(n, cr(f, n)); + } else { + if (!g[o]) + return a ? n : {}; + f = Zr(n, o, s); + } + } + i || (i = new _()); + var h = i.get(n); + if (h) + return h; + i.set(n, f), Vr(n) ? n.forEach(function(d) { + f.add(F(d, r, e, d, n, i)); + }) : Xr(n) && n.forEach(function(d, p) { + f.set(p, F(d, r, e, p, n, i)); + }); + var A = b ? u ? hr : N : u ? G : $, y = l ? void 0 : A(n); + return pn(y || n, function(d, p) { + y && (p = d, d = n[p]), Un(f, p, F(d, r, e, p, n, i)); + }), f; +} +var Se = "__lodash_hash_undefined__"; +function Ee(n) { + return this.__data__.set(n, Se), this; +} +function Pe(n) { + return this.__data__.has(n); +} +function E(n) { + var r = -1, e = n == null ? 0 : n.length; + for (this.__data__ = new Bn(); ++r < e; ) + this.add(n[r]); +} +E.prototype.add = E.prototype.push = Ee; +E.prototype.has = Pe; +function ve(n, r) { + for (var e = -1, t = n == null ? 0 : n.length; ++e < t; ) + if (r(n[e], e, n)) + return !0; + return !1; +} +function Sn(n, r) { + return n.has(r); +} +var Le = 1, Re = 2; +function En(n, r, e, t, a, i) { + var f = e & Le, s = n.length, u = r.length; + if (s != u && !(f && u > s)) + return !1; + var b = i.get(n), l = i.get(r); + if (b && l) + return b == r && l == n; + var o = -1, c = !0, h = e & Re ? new E() : void 0; + for (i.set(n, r), i.set(r, n); ++o < s; ) { + var A = n[o], y = r[o]; + if (t) + var d = f ? t(y, A, o, r, n, i) : t(A, y, o, n, r, i); + if (d !== void 0) { + if (d) + continue; + c = !1; + break; + } + if (h) { + if (!ve(r, function(p, O) { + if (!Sn(h, O) && (A === p || a(A, p, e, t, i))) + return h.push(O); + })) { + c = !1; + break; + } + } else if (!(A === y || a(A, y, e, t, i))) { + c = !1; + break; + } + } + return i.delete(n), i.delete(r), c; +} +function xe(n) { + var r = -1, e = Array(n.size); + return n.forEach(function(t, a) { + e[++r] = [a, t]; + }), e; +} +function H(n) { + var r = -1, e = Array(n.size); + return n.forEach(function(t) { + e[++r] = t; + }), e; +} +var Me = 1, me = 2, Fe = "[object Boolean]", Ce = "[object Date]", De = "[object Error]", Ne = "[object Map]", Ge = "[object Number]", Ue = "[object RegExp]", Be = "[object Set]", Ke = "[object String]", je = "[object Symbol]", He = "[object ArrayBuffer]", Ye = "[object DataView]", en = w ? w.prototype : void 0, C = en ? en.valueOf : void 0; +function qe(n, r, e, t, a, i, f) { + switch (e) { + case Ye: + if (n.byteLength != r.byteLength || n.byteOffset != r.byteOffset) + return !1; + n = n.buffer, r = r.buffer; + case He: + return !(n.byteLength != r.byteLength || !i(new J(n), new J(r))); + case Fe: + case Ce: + case Ge: + return Kn(+n, +r); + case De: + return n.name == r.name && n.message == r.message; + case Ue: + case Ke: + return n == r + ""; + case Ne: + var s = xe; + case Be: + var u = t & Me; + if (s || (s = H), n.size != r.size && !u) + return !1; + var b = f.get(n); + if (b) + return b == r; + t |= me, f.set(n, r); + var l = En(s(n), s(r), t, a, i, f); + return f.delete(n), l; + case je: + if (C) + return C.call(n) == C.call(r); + } + return !1; +} +var Ze = 1, Je = Object.prototype, Qe = Je.hasOwnProperty; +function Xe(n, r, e, t, a, i) { + var f = e & Ze, s = N(n), u = s.length, b = N(r), l = b.length; + if (u != l && !f) + return !1; + for (var o = u; o--; ) { + var c = s[o]; + if (!(f ? c in r : Qe.call(r, c))) + return !1; + } + var h = i.get(n), A = i.get(r); + if (h && A) + return h == r && A == n; + var y = !0; + i.set(n, r), i.set(r, n); + for (var d = f; ++o < u; ) { + c = s[o]; + var p = n[c], O = r[c]; + if (t) + var Z = f ? t(O, p, c, r, n, i) : t(p, O, c, n, r, i); + if (!(Z === void 0 ? p === O || a(p, O, e, t, i) : Z)) { + y = !1; + break; + } + d || (d = c == "constructor"); + } + if (y && !d) { + var P = n.constructor, v = r.constructor; + P != v && "constructor" in n && "constructor" in r && !(typeof P == "function" && P instanceof P && typeof v == "function" && v instanceof v) && (y = !1); + } + return i.delete(n), i.delete(r), y; +} +var We = 1, tn = "[object Arguments]", an = "[object Array]", L = "[object Object]", ze = Object.prototype, fn = ze.hasOwnProperty; +function Ve(n, r, e, t, a, i) { + var f = T(n), s = T(r), u = f ? an : S(n), b = s ? an : S(r); + u = u == tn ? L : u, b = b == tn ? L : b; + var l = u == L, o = b == L, c = u == b; + if (c && D(n)) { + if (!D(r)) + return !1; + f = !0, l = !1; + } + if (c && !l) + return i || (i = new _()), f || jn(n) ? En(n, r, e, t, a, i) : qe(n, r, u, e, t, a, i); + if (!(e & We)) { + var h = l && fn.call(n, "__wrapped__"), A = o && fn.call(r, "__wrapped__"); + if (h || A) { + var y = h ? n.value() : n, d = A ? r.value() : r; + return i || (i = new _()), a(y, d, e, t, i); + } + } + return c ? (i || (i = new _()), Xe(n, r, e, t, a, i)) : !1; +} +function Y(n, r, e, t, a) { + return n === r ? !0 : n == null || r == null || !I(n) && !I(r) ? n !== n && r !== r : Ve(n, r, e, t, Y, a); +} +var ke = 1, nt = 2; +function rt(n, r, e, t) { + var a = e.length, i = a; + if (n == null) + return !i; + for (n = Object(n); a--; ) { + var f = e[a]; + if (f[2] ? f[1] !== n[f[0]] : !(f[0] in n)) + return !1; + } + for (; ++a < i; ) { + f = e[a]; + var s = f[0], u = n[s], b = f[1]; + if (f[2]) { + if (u === void 0 && !(s in n)) + return !1; + } else { + var l = new _(), o; + if (!(o === void 0 ? Y(b, u, ke | nt, t, l) : o)) + return !1; + } + } + return !0; +} +function Pn(n) { + return n === n && !ln(n); +} +function et(n) { + for (var r = $(n), e = r.length; e--; ) { + var t = r[e], a = n[t]; + r[e] = [t, a, Pn(a)]; + } + return r; +} +function vn(n, r) { + return function(e) { + return e == null ? !1 : e[n] === r && (r !== void 0 || n in Object(e)); + }; +} +function tt(n) { + var r = et(n); + return r.length == 1 && r[0][2] ? vn(r[0][0], r[0][1]) : function(e) { + return e === n || rt(e, n, r); + }; +} +function it(n, r) { + return n != null && r in Object(n); +} +function at(n, r, e) { + r = An(r, n); + for (var t = -1, a = r.length, i = !1; ++t < a; ) { + var f = M(r[t]); + if (!(i = n != null && e(n, f))) + break; + n = n[f]; + } + return i || ++t != a ? i : (a = n == null ? 0 : n.length, !!a && Hn(a) && Yn(f, a) && (T(n) || un(n))); +} +function ft(n, r) { + return n != null && at(n, r, it); +} +var st = 1, ut = 2; +function ot(n, r) { + return B(n) && Pn(r) ? vn(M(n), r) : function(e) { + var t = or(e, n); + return t === void 0 && t === r ? ft(e, n) : Y(r, t, st | ut); + }; +} +function gt(n) { + return function(r) { + return r == null ? void 0 : r[n]; + }; +} +function lt(n) { + return function(r) { + return yn(r, n); + }; +} +function ct(n) { + return B(n) ? gt(M(n)) : lt(n); +} +function Ln(n) { + return typeof n == "function" ? n : n == null ? cn : typeof n == "object" ? T(n) ? ot(n[0], n[1]) : tt(n) : ct(n); +} +function bt(n, r) { + return n && qn(n, r, $); +} +function dt(n, r) { + return function(e, t) { + if (e == null) + return e; + if (!sn(e)) + return n(e, t); + for (var a = e.length, i = -1, f = Object(e); ++i < a && t(f[i], i, f) !== !1; ) + ; + return e; + }; +} +var q = dt(bt); +function pt(n) { + return typeof n == "function" ? n : cn; +} +function It(n, r) { + var e = T(n) ? pn : q; + return e(n, pt(r)); +} +function At(n, r) { + var e = []; + return q(n, function(t, a, i) { + r(t, a, i) && e.push(t); + }), e; +} +function St(n, r) { + var e = T(n) ? Tn : At; + return e(n, Ln(r)); +} +function yt(n, r) { + return bn(r, function(e) { + return n[e]; + }); +} +function Et(n) { + return n == null ? [] : yt(n, $(n)); +} +function Pt(n) { + return n === void 0; +} +function Tt(n, r, e, t, a) { + return a(n, function(i, f, s) { + e = t ? (t = !1, i) : r(e, i, f, s); + }), e; +} +function vt(n, r, e) { + var t = T(n) ? lr : Tt, a = arguments.length < 3; + return t(n, Ln(r), e, a, q); +} +var ht = 1 / 0, wt = m && 1 / H(new m([, -0]))[1] == ht ? function(n) { + return new m(n); +} : Qn, Ot = 200; +function Lt(n, r, e) { + var t = -1, a = kn, i = n.length, f = !0, s = [], u = s; + if (i >= Ot) { + var b = r ? null : wt(n); + if (b) + return H(b); + f = !1, a = Sn, u = new E(); + } else + u = r ? [] : s; + n: + for (; ++t < i; ) { + var l = n[t], o = r ? r(l) : l; + if (l = l !== 0 ? l : 0, f && o === o) { + for (var c = u.length; c--; ) + if (u[c] === o) + continue n; + r && u.push(o), s.push(l); + } else a(u, o, e) || (u !== s && u.push(o), s.push(l)); + } + return s; +} +export { + Tn as A, + At as B, + ve as C, + Qn as D, + E as S, + Lt as a, + F as b, + _t as c, + It as d, + U as e, + St as f, + Ln as g, + Xn as h, + Pt as i, + q as j, + $ as k, + bn as l, + at as m, + An as n, + yn as o, + pt as p, + bt as q, + vt as r, + ft as s, + M as t, + sr as u, + Et as v, + kn as w, + Sn as x, + Vn as y, + hr as z +}; diff --git a/backend/fastrtc/templates/component/arc-DNvJTUeW.js b/backend/fastrtc/templates/component/arc-DNvJTUeW.js new file mode 100644 index 0000000..e65c3ef --- /dev/null +++ b/backend/fastrtc/templates/component/arc-DNvJTUeW.js @@ -0,0 +1,83 @@ +import { $ as ln, a0 as an, a1 as y, a2 as tn, a3 as G, a4 as q, a5 as _, a6 as un, a7 as rn, a8 as K, a9 as o, aa as z, ab as sn, ac as on, ad as fn } from "./mermaid.core-Cmyps_S7.js"; +function cn(l) { + return l.innerRadius; +} +function yn(l) { + return l.outerRadius; +} +function gn(l) { + return l.startAngle; +} +function dn(l) { + return l.endAngle; +} +function mn(l) { + return l && l.padAngle; +} +function pn(l, h, I, D, v, A, B, a) { + var O = I - l, i = D - h, n = B - v, d = a - A, u = d * O - n * i; + if (!(u * u < y)) + return u = (n * (h - A) - d * (l - v)) / u, [l + u * O, h + u * i]; +} +function V(l, h, I, D, v, A, B) { + var a = l - I, O = h - D, i = (B ? A : -A) / K(a * a + O * O), n = i * O, d = -i * a, u = l + n, s = h + d, f = I + n, c = D + d, C = (u + f) / 2, t = (s + c) / 2, m = f - u, g = c - s, R = m * m + g * g, T = v - A, P = u * c - f * s, S = (g < 0 ? -1 : 1) * K(fn(0, T * T * R - P * P)), $ = (P * g - m * S) / R, j = (-P * m - g * S) / R, w = (P * g + m * S) / R, p = (-P * m + g * S) / R, x = $ - C, e = j - t, r = w - C, F = p - t; + return x * x + e * e > r * r + F * F && ($ = w, j = p), { + cx: $, + cy: j, + x01: -n, + y01: -d, + x11: $ * (v / T - 1), + y11: j * (v / T - 1) + }; +} +function hn() { + var l = cn, h = yn, I = z(0), D = null, v = gn, A = dn, B = mn, a = null, O = ln(i); + function i() { + var n, d, u = +l.apply(this, arguments), s = +h.apply(this, arguments), f = v.apply(this, arguments) - an, c = A.apply(this, arguments) - an, C = un(c - f), t = c > f; + if (a || (a = n = O()), s < u && (d = s, s = u, u = d), !(s > y)) a.moveTo(0, 0); + else if (C > tn - y) + a.moveTo(s * G(f), s * q(f)), a.arc(0, 0, s, f, c, !t), u > y && (a.moveTo(u * G(c), u * q(c)), a.arc(0, 0, u, c, f, t)); + else { + var m = f, g = c, R = f, T = c, P = C, S = C, $ = B.apply(this, arguments) / 2, j = $ > y && (D ? +D.apply(this, arguments) : K(u * u + s * s)), w = _(un(s - u) / 2, +I.apply(this, arguments)), p = w, x = w, e, r; + if (j > y) { + var F = sn(j / u * q($)), L = sn(j / s * q($)); + (P -= F * 2) > y ? (F *= t ? 1 : -1, R += F, T -= F) : (P = 0, R = T = (f + c) / 2), (S -= L * 2) > y ? (L *= t ? 1 : -1, m += L, g -= L) : (S = 0, m = g = (f + c) / 2); + } + var H = s * G(m), J = s * q(m), M = u * G(T), N = u * q(T); + if (w > y) { + var Q = s * G(g), U = s * q(g), W = u * G(R), X = u * q(R), E; + if (C < rn) + if (E = pn(H, J, W, X, Q, U, M, N)) { + var Y = H - E[0], Z = J - E[1], b = Q - E[0], k = U - E[1], nn = 1 / q(on((Y * b + Z * k) / (K(Y * Y + Z * Z) * K(b * b + k * k))) / 2), en = K(E[0] * E[0] + E[1] * E[1]); + p = _(w, (u - en) / (nn - 1)), x = _(w, (s - en) / (nn + 1)); + } else + p = x = 0; + } + S > y ? x > y ? (e = V(W, X, H, J, s, x, t), r = V(Q, U, M, N, s, x, t), a.moveTo(e.cx + e.x01, e.cy + e.y01), x < w ? a.arc(e.cx, e.cy, x, o(e.y01, e.x01), o(r.y01, r.x01), !t) : (a.arc(e.cx, e.cy, x, o(e.y01, e.x01), o(e.y11, e.x11), !t), a.arc(0, 0, s, o(e.cy + e.y11, e.cx + e.x11), o(r.cy + r.y11, r.cx + r.x11), !t), a.arc(r.cx, r.cy, x, o(r.y11, r.x11), o(r.y01, r.x01), !t))) : (a.moveTo(H, J), a.arc(0, 0, s, m, g, !t)) : a.moveTo(H, J), !(u > y) || !(P > y) ? a.lineTo(M, N) : p > y ? (e = V(M, N, Q, U, u, -p, t), r = V(H, J, W, X, u, -p, t), a.lineTo(e.cx + e.x01, e.cy + e.y01), p < w ? a.arc(e.cx, e.cy, p, o(e.y01, e.x01), o(r.y01, r.x01), !t) : (a.arc(e.cx, e.cy, p, o(e.y01, e.x01), o(e.y11, e.x11), !t), a.arc(0, 0, u, o(e.cy + e.y11, e.cx + e.x11), o(r.cy + r.y11, r.cx + r.x11), t), a.arc(r.cx, r.cy, p, o(r.y11, r.x11), o(r.y01, r.x01), !t))) : a.arc(0, 0, u, T, R, t); + } + if (a.closePath(), n) return a = null, n + "" || null; + } + return i.centroid = function() { + var n = (+l.apply(this, arguments) + +h.apply(this, arguments)) / 2, d = (+v.apply(this, arguments) + +A.apply(this, arguments)) / 2 - rn / 2; + return [G(d) * n, q(d) * n]; + }, i.innerRadius = function(n) { + return arguments.length ? (l = typeof n == "function" ? n : z(+n), i) : l; + }, i.outerRadius = function(n) { + return arguments.length ? (h = typeof n == "function" ? n : z(+n), i) : h; + }, i.cornerRadius = function(n) { + return arguments.length ? (I = typeof n == "function" ? n : z(+n), i) : I; + }, i.padRadius = function(n) { + return arguments.length ? (D = n == null ? null : typeof n == "function" ? n : z(+n), i) : D; + }, i.startAngle = function(n) { + return arguments.length ? (v = typeof n == "function" ? n : z(+n), i) : v; + }, i.endAngle = function(n) { + return arguments.length ? (A = typeof n == "function" ? n : z(+n), i) : A; + }, i.padAngle = function(n) { + return arguments.length ? (B = typeof n == "function" ? n : z(+n), i) : B; + }, i.context = function(n) { + return arguments.length ? (a = n ?? null, i) : a; + }, i; +} +export { + hn as d +}; diff --git a/backend/fastrtc/templates/component/architectureDiagram-IEHRJDOE-Dkm_-XtH.js b/backend/fastrtc/templates/component/architectureDiagram-IEHRJDOE-Dkm_-XtH.js new file mode 100644 index 0000000..2e52229 --- /dev/null +++ b/backend/fastrtc/templates/component/architectureDiagram-IEHRJDOE-Dkm_-XtH.js @@ -0,0 +1,4631 @@ +import { C as qe, _ as nt, aG as Je, aH as Qe, n as Ke, o as je, s as _e, g as tr, c as er, b as rr, d as fe, l as be, j as ir, t as ar, H as nr, V as or, aj as Ne, aI as Ee } from "./mermaid.core-Cmyps_S7.js"; +import { p as sr } from "./chunk-4BMEZGHF-skpIwyQ5.js"; +import { I as hr } from "./chunk-XZIHB7SX-BL75jMe6.js"; +import { p as lr } from "./radar-MK3ICKWK-Bw4p6KaX.js"; +import { c as Pe } from "./cytoscape.esm-C2cgT2B2.js"; +import { c as Le, g as fr } from "./index-DeMSGuTm.js"; +var Ge = { exports: {} }, pe = { exports: {} }, ye = { exports: {} }, xe; +function cr() { + return xe || (xe = 1, function(C, U) { + (function(G, L) { + C.exports = L(); + })(Le, function() { + return ( + /******/ + function(A) { + var G = {}; + function L(u) { + if (G[u]) + return G[u].exports; + var l = G[u] = { + /******/ + i: u, + /******/ + l: !1, + /******/ + exports: {} + /******/ + }; + return A[u].call(l.exports, l, l.exports, L), l.l = !0, l.exports; + } + return L.m = A, L.c = G, L.i = function(u) { + return u; + }, L.d = function(u, l, a) { + L.o(u, l) || Object.defineProperty(u, l, { + /******/ + configurable: !1, + /******/ + enumerable: !0, + /******/ + get: a + /******/ + }); + }, L.n = function(u) { + var l = u && u.__esModule ? ( + /******/ + function() { + return u.default; + } + ) : ( + /******/ + function() { + return u; + } + ); + return L.d(l, "a", l), l; + }, L.o = function(u, l) { + return Object.prototype.hasOwnProperty.call(u, l); + }, L.p = "", L(L.s = 28); + }([ + /* 0 */ + /***/ + function(A, G, L) { + function u() { + } + u.QUALITY = 1, u.DEFAULT_CREATE_BENDS_AS_NEEDED = !1, u.DEFAULT_INCREMENTAL = !1, u.DEFAULT_ANIMATION_ON_LAYOUT = !0, u.DEFAULT_ANIMATION_DURING_LAYOUT = !1, u.DEFAULT_ANIMATION_PERIOD = 50, u.DEFAULT_UNIFORM_LEAF_NODE_SIZES = !1, u.DEFAULT_GRAPH_MARGIN = 15, u.NODE_DIMENSIONS_INCLUDE_LABELS = !1, u.SIMPLE_NODE_SIZE = 40, u.SIMPLE_NODE_HALF_SIZE = u.SIMPLE_NODE_SIZE / 2, u.EMPTY_COMPOUND_NODE_SIZE = 40, u.MIN_EDGE_LENGTH = 1, u.WORLD_BOUNDARY = 1e6, u.INITIAL_WORLD_BOUNDARY = u.WORLD_BOUNDARY / 1e3, u.WORLD_CENTER_X = 1200, u.WORLD_CENTER_Y = 900, A.exports = u; + }, + /* 1 */ + /***/ + function(A, G, L) { + var u = L(2), l = L(8), a = L(9); + function r(f, i, g) { + u.call(this, g), this.isOverlapingSourceAndTarget = !1, this.vGraphObject = g, this.bendpoints = [], this.source = f, this.target = i; + } + r.prototype = Object.create(u.prototype); + for (var e in u) + r[e] = u[e]; + r.prototype.getSource = function() { + return this.source; + }, r.prototype.getTarget = function() { + return this.target; + }, r.prototype.isInterGraph = function() { + return this.isInterGraph; + }, r.prototype.getLength = function() { + return this.length; + }, r.prototype.isOverlapingSourceAndTarget = function() { + return this.isOverlapingSourceAndTarget; + }, r.prototype.getBendpoints = function() { + return this.bendpoints; + }, r.prototype.getLca = function() { + return this.lca; + }, r.prototype.getSourceInLca = function() { + return this.sourceInLca; + }, r.prototype.getTargetInLca = function() { + return this.targetInLca; + }, r.prototype.getOtherEnd = function(f) { + if (this.source === f) + return this.target; + if (this.target === f) + return this.source; + throw "Node is not incident with this edge"; + }, r.prototype.getOtherEndInGraph = function(f, i) { + for (var g = this.getOtherEnd(f), t = i.getGraphManager().getRoot(); ; ) { + if (g.getOwner() == i) + return g; + if (g.getOwner() == t) + break; + g = g.getOwner().getParent(); + } + return null; + }, r.prototype.updateLength = function() { + var f = new Array(4); + this.isOverlapingSourceAndTarget = l.getIntersection(this.target.getRect(), this.source.getRect(), f), this.isOverlapingSourceAndTarget || (this.lengthX = f[0] - f[2], this.lengthY = f[1] - f[3], Math.abs(this.lengthX) < 1 && (this.lengthX = a.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = a.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY)); + }, r.prototype.updateLengthSimple = function() { + this.lengthX = this.target.getCenterX() - this.source.getCenterX(), this.lengthY = this.target.getCenterY() - this.source.getCenterY(), Math.abs(this.lengthX) < 1 && (this.lengthX = a.sign(this.lengthX)), Math.abs(this.lengthY) < 1 && (this.lengthY = a.sign(this.lengthY)), this.length = Math.sqrt(this.lengthX * this.lengthX + this.lengthY * this.lengthY); + }, A.exports = r; + }, + /* 2 */ + /***/ + function(A, G, L) { + function u(l) { + this.vGraphObject = l; + } + A.exports = u; + }, + /* 3 */ + /***/ + function(A, G, L) { + var u = L(2), l = L(10), a = L(13), r = L(0), e = L(16), f = L(5); + function i(t, s, o, c) { + o == null && c == null && (c = s), u.call(this, c), t.graphManager != null && (t = t.graphManager), this.estimatedSize = l.MIN_VALUE, this.inclusionTreeDepth = l.MAX_VALUE, this.vGraphObject = c, this.edges = [], this.graphManager = t, o != null && s != null ? this.rect = new a(s.x, s.y, o.width, o.height) : this.rect = new a(); + } + i.prototype = Object.create(u.prototype); + for (var g in u) + i[g] = u[g]; + i.prototype.getEdges = function() { + return this.edges; + }, i.prototype.getChild = function() { + return this.child; + }, i.prototype.getOwner = function() { + return this.owner; + }, i.prototype.getWidth = function() { + return this.rect.width; + }, i.prototype.setWidth = function(t) { + this.rect.width = t; + }, i.prototype.getHeight = function() { + return this.rect.height; + }, i.prototype.setHeight = function(t) { + this.rect.height = t; + }, i.prototype.getCenterX = function() { + return this.rect.x + this.rect.width / 2; + }, i.prototype.getCenterY = function() { + return this.rect.y + this.rect.height / 2; + }, i.prototype.getCenter = function() { + return new f(this.rect.x + this.rect.width / 2, this.rect.y + this.rect.height / 2); + }, i.prototype.getLocation = function() { + return new f(this.rect.x, this.rect.y); + }, i.prototype.getRect = function() { + return this.rect; + }, i.prototype.getDiagonal = function() { + return Math.sqrt(this.rect.width * this.rect.width + this.rect.height * this.rect.height); + }, i.prototype.getHalfTheDiagonal = function() { + return Math.sqrt(this.rect.height * this.rect.height + this.rect.width * this.rect.width) / 2; + }, i.prototype.setRect = function(t, s) { + this.rect.x = t.x, this.rect.y = t.y, this.rect.width = s.width, this.rect.height = s.height; + }, i.prototype.setCenter = function(t, s) { + this.rect.x = t - this.rect.width / 2, this.rect.y = s - this.rect.height / 2; + }, i.prototype.setLocation = function(t, s) { + this.rect.x = t, this.rect.y = s; + }, i.prototype.moveBy = function(t, s) { + this.rect.x += t, this.rect.y += s; + }, i.prototype.getEdgeListToNode = function(t) { + var s = [], o = this; + return o.edges.forEach(function(c) { + if (c.target == t) { + if (c.source != o) throw "Incorrect edge source!"; + s.push(c); + } + }), s; + }, i.prototype.getEdgesBetween = function(t) { + var s = [], o = this; + return o.edges.forEach(function(c) { + if (!(c.source == o || c.target == o)) throw "Incorrect edge source and/or target"; + (c.target == t || c.source == t) && s.push(c); + }), s; + }, i.prototype.getNeighborsList = function() { + var t = /* @__PURE__ */ new Set(), s = this; + return s.edges.forEach(function(o) { + if (o.source == s) + t.add(o.target); + else { + if (o.target != s) + throw "Incorrect incidency!"; + t.add(o.source); + } + }), t; + }, i.prototype.withChildren = function() { + var t = /* @__PURE__ */ new Set(), s, o; + if (t.add(this), this.child != null) + for (var c = this.child.getNodes(), h = 0; h < c.length; h++) + s = c[h], o = s.withChildren(), o.forEach(function(T) { + t.add(T); + }); + return t; + }, i.prototype.getNoOfChildren = function() { + var t = 0, s; + if (this.child == null) + t = 1; + else + for (var o = this.child.getNodes(), c = 0; c < o.length; c++) + s = o[c], t += s.getNoOfChildren(); + return t == 0 && (t = 1), t; + }, i.prototype.getEstimatedSize = function() { + if (this.estimatedSize == l.MIN_VALUE) + throw "assert failed"; + return this.estimatedSize; + }, i.prototype.calcEstimatedSize = function() { + return this.child == null ? this.estimatedSize = (this.rect.width + this.rect.height) / 2 : (this.estimatedSize = this.child.calcEstimatedSize(), this.rect.width = this.estimatedSize, this.rect.height = this.estimatedSize, this.estimatedSize); + }, i.prototype.scatter = function() { + var t, s, o = -r.INITIAL_WORLD_BOUNDARY, c = r.INITIAL_WORLD_BOUNDARY; + t = r.WORLD_CENTER_X + e.nextDouble() * (c - o) + o; + var h = -r.INITIAL_WORLD_BOUNDARY, T = r.INITIAL_WORLD_BOUNDARY; + s = r.WORLD_CENTER_Y + e.nextDouble() * (T - h) + h, this.rect.x = t, this.rect.y = s; + }, i.prototype.updateBounds = function() { + if (this.getChild() == null) + throw "assert failed"; + if (this.getChild().getNodes().length != 0) { + var t = this.getChild(); + if (t.updateBounds(!0), this.rect.x = t.getLeft(), this.rect.y = t.getTop(), this.setWidth(t.getRight() - t.getLeft()), this.setHeight(t.getBottom() - t.getTop()), r.NODE_DIMENSIONS_INCLUDE_LABELS) { + var s = t.getRight() - t.getLeft(), o = t.getBottom() - t.getTop(); + this.labelWidth && (this.labelPosHorizontal == "left" ? (this.rect.x -= this.labelWidth, this.setWidth(s + this.labelWidth)) : this.labelPosHorizontal == "center" && this.labelWidth > s ? (this.rect.x -= (this.labelWidth - s) / 2, this.setWidth(this.labelWidth)) : this.labelPosHorizontal == "right" && this.setWidth(s + this.labelWidth)), this.labelHeight && (this.labelPosVertical == "top" ? (this.rect.y -= this.labelHeight, this.setHeight(o + this.labelHeight)) : this.labelPosVertical == "center" && this.labelHeight > o ? (this.rect.y -= (this.labelHeight - o) / 2, this.setHeight(this.labelHeight)) : this.labelPosVertical == "bottom" && this.setHeight(o + this.labelHeight)); + } + } + }, i.prototype.getInclusionTreeDepth = function() { + if (this.inclusionTreeDepth == l.MAX_VALUE) + throw "assert failed"; + return this.inclusionTreeDepth; + }, i.prototype.transform = function(t) { + var s = this.rect.x; + s > r.WORLD_BOUNDARY ? s = r.WORLD_BOUNDARY : s < -r.WORLD_BOUNDARY && (s = -r.WORLD_BOUNDARY); + var o = this.rect.y; + o > r.WORLD_BOUNDARY ? o = r.WORLD_BOUNDARY : o < -r.WORLD_BOUNDARY && (o = -r.WORLD_BOUNDARY); + var c = new f(s, o), h = t.inverseTransformPoint(c); + this.setLocation(h.x, h.y); + }, i.prototype.getLeft = function() { + return this.rect.x; + }, i.prototype.getRight = function() { + return this.rect.x + this.rect.width; + }, i.prototype.getTop = function() { + return this.rect.y; + }, i.prototype.getBottom = function() { + return this.rect.y + this.rect.height; + }, i.prototype.getParent = function() { + return this.owner == null ? null : this.owner.getParent(); + }, A.exports = i; + }, + /* 4 */ + /***/ + function(A, G, L) { + var u = L(0); + function l() { + } + for (var a in u) + l[a] = u[a]; + l.MAX_ITERATIONS = 2500, l.DEFAULT_EDGE_LENGTH = 50, l.DEFAULT_SPRING_STRENGTH = 0.45, l.DEFAULT_REPULSION_STRENGTH = 4500, l.DEFAULT_GRAVITY_STRENGTH = 0.4, l.DEFAULT_COMPOUND_GRAVITY_STRENGTH = 1, l.DEFAULT_GRAVITY_RANGE_FACTOR = 3.8, l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = 1.5, l.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION = !0, l.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION = !0, l.DEFAULT_COOLING_FACTOR_INCREMENTAL = 0.3, l.COOLING_ADAPTATION_FACTOR = 0.33, l.ADAPTATION_LOWER_NODE_LIMIT = 1e3, l.ADAPTATION_UPPER_NODE_LIMIT = 5e3, l.MAX_NODE_DISPLACEMENT_INCREMENTAL = 100, l.MAX_NODE_DISPLACEMENT = l.MAX_NODE_DISPLACEMENT_INCREMENTAL * 3, l.MIN_REPULSION_DIST = l.DEFAULT_EDGE_LENGTH / 10, l.CONVERGENCE_CHECK_PERIOD = 100, l.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = 0.1, l.MIN_EDGE_LENGTH = 1, l.GRID_CALCULATION_CHECK_PERIOD = 10, A.exports = l; + }, + /* 5 */ + /***/ + function(A, G, L) { + function u(l, a) { + l == null && a == null ? (this.x = 0, this.y = 0) : (this.x = l, this.y = a); + } + u.prototype.getX = function() { + return this.x; + }, u.prototype.getY = function() { + return this.y; + }, u.prototype.setX = function(l) { + this.x = l; + }, u.prototype.setY = function(l) { + this.y = l; + }, u.prototype.getDifference = function(l) { + return new DimensionD(this.x - l.x, this.y - l.y); + }, u.prototype.getCopy = function() { + return new u(this.x, this.y); + }, u.prototype.translate = function(l) { + return this.x += l.width, this.y += l.height, this; + }, A.exports = u; + }, + /* 6 */ + /***/ + function(A, G, L) { + var u = L(2), l = L(10), a = L(0), r = L(7), e = L(3), f = L(1), i = L(13), g = L(12), t = L(11); + function s(c, h, T) { + u.call(this, T), this.estimatedSize = l.MIN_VALUE, this.margin = a.DEFAULT_GRAPH_MARGIN, this.edges = [], this.nodes = [], this.isConnected = !1, this.parent = c, h != null && h instanceof r ? this.graphManager = h : h != null && h instanceof Layout && (this.graphManager = h.graphManager); + } + s.prototype = Object.create(u.prototype); + for (var o in u) + s[o] = u[o]; + s.prototype.getNodes = function() { + return this.nodes; + }, s.prototype.getEdges = function() { + return this.edges; + }, s.prototype.getGraphManager = function() { + return this.graphManager; + }, s.prototype.getParent = function() { + return this.parent; + }, s.prototype.getLeft = function() { + return this.left; + }, s.prototype.getRight = function() { + return this.right; + }, s.prototype.getTop = function() { + return this.top; + }, s.prototype.getBottom = function() { + return this.bottom; + }, s.prototype.isConnected = function() { + return this.isConnected; + }, s.prototype.add = function(c, h, T) { + if (h == null && T == null) { + var v = c; + if (this.graphManager == null) + throw "Graph has no graph mgr!"; + if (this.getNodes().indexOf(v) > -1) + throw "Node already in graph!"; + return v.owner = this, this.getNodes().push(v), v; + } else { + var d = c; + if (!(this.getNodes().indexOf(h) > -1 && this.getNodes().indexOf(T) > -1)) + throw "Source or target not in graph!"; + if (!(h.owner == T.owner && h.owner == this)) + throw "Both owners must be this graph!"; + return h.owner != T.owner ? null : (d.source = h, d.target = T, d.isInterGraph = !1, this.getEdges().push(d), h.edges.push(d), T != h && T.edges.push(d), d); + } + }, s.prototype.remove = function(c) { + var h = c; + if (c instanceof e) { + if (h == null) + throw "Node is null!"; + if (!(h.owner != null && h.owner == this)) + throw "Owner graph is invalid!"; + if (this.graphManager == null) + throw "Owner graph manager is invalid!"; + for (var T = h.edges.slice(), v, d = T.length, N = 0; N < d; N++) + v = T[N], v.isInterGraph ? this.graphManager.remove(v) : v.source.owner.remove(v); + var S = this.nodes.indexOf(h); + if (S == -1) + throw "Node not in owner node list!"; + this.nodes.splice(S, 1); + } else if (c instanceof f) { + var v = c; + if (v == null) + throw "Edge is null!"; + if (!(v.source != null && v.target != null)) + throw "Source and/or target is null!"; + if (!(v.source.owner != null && v.target.owner != null && v.source.owner == this && v.target.owner == this)) + throw "Source and/or target owner is invalid!"; + var M = v.source.edges.indexOf(v), P = v.target.edges.indexOf(v); + if (!(M > -1 && P > -1)) + throw "Source and/or target doesn't know this edge!"; + v.source.edges.splice(M, 1), v.target != v.source && v.target.edges.splice(P, 1); + var S = v.source.owner.getEdges().indexOf(v); + if (S == -1) + throw "Not in owner's edge list!"; + v.source.owner.getEdges().splice(S, 1); + } + }, s.prototype.updateLeftTop = function() { + for (var c = l.MAX_VALUE, h = l.MAX_VALUE, T, v, d, N = this.getNodes(), S = N.length, M = 0; M < S; M++) { + var P = N[M]; + T = P.getTop(), v = P.getLeft(), c > T && (c = T), h > v && (h = v); + } + return c == l.MAX_VALUE ? null : (N[0].getParent().paddingLeft != null ? d = N[0].getParent().paddingLeft : d = this.margin, this.left = h - d, this.top = c - d, new g(this.left, this.top)); + }, s.prototype.updateBounds = function(c) { + for (var h = l.MAX_VALUE, T = -l.MAX_VALUE, v = l.MAX_VALUE, d = -l.MAX_VALUE, N, S, M, P, K, X = this.nodes, k = X.length, D = 0; D < k; D++) { + var rt = X[D]; + c && rt.child != null && rt.updateBounds(), N = rt.getLeft(), S = rt.getRight(), M = rt.getTop(), P = rt.getBottom(), h > N && (h = N), T < S && (T = S), v > M && (v = M), d < P && (d = P); + } + var n = new i(h, v, T - h, d - v); + h == l.MAX_VALUE && (this.left = this.parent.getLeft(), this.right = this.parent.getRight(), this.top = this.parent.getTop(), this.bottom = this.parent.getBottom()), X[0].getParent().paddingLeft != null ? K = X[0].getParent().paddingLeft : K = this.margin, this.left = n.x - K, this.right = n.x + n.width + K, this.top = n.y - K, this.bottom = n.y + n.height + K; + }, s.calculateBounds = function(c) { + for (var h = l.MAX_VALUE, T = -l.MAX_VALUE, v = l.MAX_VALUE, d = -l.MAX_VALUE, N, S, M, P, K = c.length, X = 0; X < K; X++) { + var k = c[X]; + N = k.getLeft(), S = k.getRight(), M = k.getTop(), P = k.getBottom(), h > N && (h = N), T < S && (T = S), v > M && (v = M), d < P && (d = P); + } + var D = new i(h, v, T - h, d - v); + return D; + }, s.prototype.getInclusionTreeDepth = function() { + return this == this.graphManager.getRoot() ? 1 : this.parent.getInclusionTreeDepth(); + }, s.prototype.getEstimatedSize = function() { + if (this.estimatedSize == l.MIN_VALUE) + throw "assert failed"; + return this.estimatedSize; + }, s.prototype.calcEstimatedSize = function() { + for (var c = 0, h = this.nodes, T = h.length, v = 0; v < T; v++) { + var d = h[v]; + c += d.calcEstimatedSize(); + } + return c == 0 ? this.estimatedSize = a.EMPTY_COMPOUND_NODE_SIZE : this.estimatedSize = c / Math.sqrt(this.nodes.length), this.estimatedSize; + }, s.prototype.updateConnected = function() { + var c = this; + if (this.nodes.length == 0) { + this.isConnected = !0; + return; + } + var h = new t(), T = /* @__PURE__ */ new Set(), v = this.nodes[0], d, N, S = v.withChildren(); + for (S.forEach(function(D) { + h.push(D), T.add(D); + }); h.length !== 0; ) { + v = h.shift(), d = v.getEdges(); + for (var M = d.length, P = 0; P < M; P++) { + var K = d[P]; + if (N = K.getOtherEndInGraph(v, this), N != null && !T.has(N)) { + var X = N.withChildren(); + X.forEach(function(D) { + h.push(D), T.add(D); + }); + } + } + } + if (this.isConnected = !1, T.size >= this.nodes.length) { + var k = 0; + T.forEach(function(D) { + D.owner == c && k++; + }), k == this.nodes.length && (this.isConnected = !0); + } + }, A.exports = s; + }, + /* 7 */ + /***/ + function(A, G, L) { + var u, l = L(1); + function a(r) { + u = L(6), this.layout = r, this.graphs = [], this.edges = []; + } + a.prototype.addRoot = function() { + var r = this.layout.newGraph(), e = this.layout.newNode(null), f = this.add(r, e); + return this.setRootGraph(f), this.rootGraph; + }, a.prototype.add = function(r, e, f, i, g) { + if (f == null && i == null && g == null) { + if (r == null) + throw "Graph is null!"; + if (e == null) + throw "Parent node is null!"; + if (this.graphs.indexOf(r) > -1) + throw "Graph already in this graph mgr!"; + if (this.graphs.push(r), r.parent != null) + throw "Already has a parent!"; + if (e.child != null) + throw "Already has a child!"; + return r.parent = e, e.child = r, r; + } else { + g = f, i = e, f = r; + var t = i.getOwner(), s = g.getOwner(); + if (!(t != null && t.getGraphManager() == this)) + throw "Source not in this graph mgr!"; + if (!(s != null && s.getGraphManager() == this)) + throw "Target not in this graph mgr!"; + if (t == s) + return f.isInterGraph = !1, t.add(f, i, g); + if (f.isInterGraph = !0, f.source = i, f.target = g, this.edges.indexOf(f) > -1) + throw "Edge already in inter-graph edge list!"; + if (this.edges.push(f), !(f.source != null && f.target != null)) + throw "Edge source and/or target is null!"; + if (!(f.source.edges.indexOf(f) == -1 && f.target.edges.indexOf(f) == -1)) + throw "Edge already in source and/or target incidency list!"; + return f.source.edges.push(f), f.target.edges.push(f), f; + } + }, a.prototype.remove = function(r) { + if (r instanceof u) { + var e = r; + if (e.getGraphManager() != this) + throw "Graph not in this graph mgr"; + if (!(e == this.rootGraph || e.parent != null && e.parent.graphManager == this)) + throw "Invalid parent node!"; + var f = []; + f = f.concat(e.getEdges()); + for (var i, g = f.length, t = 0; t < g; t++) + i = f[t], e.remove(i); + var s = []; + s = s.concat(e.getNodes()); + var o; + g = s.length; + for (var t = 0; t < g; t++) + o = s[t], e.remove(o); + e == this.rootGraph && this.setRootGraph(null); + var c = this.graphs.indexOf(e); + this.graphs.splice(c, 1), e.parent = null; + } else if (r instanceof l) { + if (i = r, i == null) + throw "Edge is null!"; + if (!i.isInterGraph) + throw "Not an inter-graph edge!"; + if (!(i.source != null && i.target != null)) + throw "Source and/or target is null!"; + if (!(i.source.edges.indexOf(i) != -1 && i.target.edges.indexOf(i) != -1)) + throw "Source and/or target doesn't know this edge!"; + var c = i.source.edges.indexOf(i); + if (i.source.edges.splice(c, 1), c = i.target.edges.indexOf(i), i.target.edges.splice(c, 1), !(i.source.owner != null && i.source.owner.getGraphManager() != null)) + throw "Edge owner graph or owner graph manager is null!"; + if (i.source.owner.getGraphManager().edges.indexOf(i) == -1) + throw "Not in owner graph manager's edge list!"; + var c = i.source.owner.getGraphManager().edges.indexOf(i); + i.source.owner.getGraphManager().edges.splice(c, 1); + } + }, a.prototype.updateBounds = function() { + this.rootGraph.updateBounds(!0); + }, a.prototype.getGraphs = function() { + return this.graphs; + }, a.prototype.getAllNodes = function() { + if (this.allNodes == null) { + for (var r = [], e = this.getGraphs(), f = e.length, i = 0; i < f; i++) + r = r.concat(e[i].getNodes()); + this.allNodes = r; + } + return this.allNodes; + }, a.prototype.resetAllNodes = function() { + this.allNodes = null; + }, a.prototype.resetAllEdges = function() { + this.allEdges = null; + }, a.prototype.resetAllNodesToApplyGravitation = function() { + this.allNodesToApplyGravitation = null; + }, a.prototype.getAllEdges = function() { + if (this.allEdges == null) { + var r = [], e = this.getGraphs(); + e.length; + for (var f = 0; f < e.length; f++) + r = r.concat(e[f].getEdges()); + r = r.concat(this.edges), this.allEdges = r; + } + return this.allEdges; + }, a.prototype.getAllNodesToApplyGravitation = function() { + return this.allNodesToApplyGravitation; + }, a.prototype.setAllNodesToApplyGravitation = function(r) { + if (this.allNodesToApplyGravitation != null) + throw "assert failed"; + this.allNodesToApplyGravitation = r; + }, a.prototype.getRoot = function() { + return this.rootGraph; + }, a.prototype.setRootGraph = function(r) { + if (r.getGraphManager() != this) + throw "Root not in this graph mgr!"; + this.rootGraph = r, r.parent == null && (r.parent = this.layout.newNode("Root node")); + }, a.prototype.getLayout = function() { + return this.layout; + }, a.prototype.isOneAncestorOfOther = function(r, e) { + if (!(r != null && e != null)) + throw "assert failed"; + if (r == e) + return !0; + var f = r.getOwner(), i; + do { + if (i = f.getParent(), i == null) + break; + if (i == e) + return !0; + if (f = i.getOwner(), f == null) + break; + } while (!0); + f = e.getOwner(); + do { + if (i = f.getParent(), i == null) + break; + if (i == r) + return !0; + if (f = i.getOwner(), f == null) + break; + } while (!0); + return !1; + }, a.prototype.calcLowestCommonAncestors = function() { + for (var r, e, f, i, g, t = this.getAllEdges(), s = t.length, o = 0; o < s; o++) { + if (r = t[o], e = r.source, f = r.target, r.lca = null, r.sourceInLca = e, r.targetInLca = f, e == f) { + r.lca = e.getOwner(); + continue; + } + for (i = e.getOwner(); r.lca == null; ) { + for (r.targetInLca = f, g = f.getOwner(); r.lca == null; ) { + if (g == i) { + r.lca = g; + break; + } + if (g == this.rootGraph) + break; + if (r.lca != null) + throw "assert failed"; + r.targetInLca = g.getParent(), g = r.targetInLca.getOwner(); + } + if (i == this.rootGraph) + break; + r.lca == null && (r.sourceInLca = i.getParent(), i = r.sourceInLca.getOwner()); + } + if (r.lca == null) + throw "assert failed"; + } + }, a.prototype.calcLowestCommonAncestor = function(r, e) { + if (r == e) + return r.getOwner(); + var f = r.getOwner(); + do { + if (f == null) + break; + var i = e.getOwner(); + do { + if (i == null) + break; + if (i == f) + return i; + i = i.getParent().getOwner(); + } while (!0); + f = f.getParent().getOwner(); + } while (!0); + return f; + }, a.prototype.calcInclusionTreeDepths = function(r, e) { + r == null && e == null && (r = this.rootGraph, e = 1); + for (var f, i = r.getNodes(), g = i.length, t = 0; t < g; t++) + f = i[t], f.inclusionTreeDepth = e, f.child != null && this.calcInclusionTreeDepths(f.child, e + 1); + }, a.prototype.includesInvalidEdge = function() { + for (var r, e = [], f = this.edges.length, i = 0; i < f; i++) + r = this.edges[i], this.isOneAncestorOfOther(r.source, r.target) && e.push(r); + for (var i = 0; i < e.length; i++) + this.remove(e[i]); + return !1; + }, A.exports = a; + }, + /* 8 */ + /***/ + function(A, G, L) { + var u = L(12); + function l() { + } + l.calcSeparationAmount = function(a, r, e, f) { + if (!a.intersects(r)) + throw "assert failed"; + var i = new Array(2); + this.decideDirectionsForOverlappingNodes(a, r, i), e[0] = Math.min(a.getRight(), r.getRight()) - Math.max(a.x, r.x), e[1] = Math.min(a.getBottom(), r.getBottom()) - Math.max(a.y, r.y), a.getX() <= r.getX() && a.getRight() >= r.getRight() ? e[0] += Math.min(r.getX() - a.getX(), a.getRight() - r.getRight()) : r.getX() <= a.getX() && r.getRight() >= a.getRight() && (e[0] += Math.min(a.getX() - r.getX(), r.getRight() - a.getRight())), a.getY() <= r.getY() && a.getBottom() >= r.getBottom() ? e[1] += Math.min(r.getY() - a.getY(), a.getBottom() - r.getBottom()) : r.getY() <= a.getY() && r.getBottom() >= a.getBottom() && (e[1] += Math.min(a.getY() - r.getY(), r.getBottom() - a.getBottom())); + var g = Math.abs((r.getCenterY() - a.getCenterY()) / (r.getCenterX() - a.getCenterX())); + r.getCenterY() === a.getCenterY() && r.getCenterX() === a.getCenterX() && (g = 1); + var t = g * e[0], s = e[1] / g; + e[0] < s ? s = e[0] : t = e[1], e[0] = -1 * i[0] * (s / 2 + f), e[1] = -1 * i[1] * (t / 2 + f); + }, l.decideDirectionsForOverlappingNodes = function(a, r, e) { + a.getCenterX() < r.getCenterX() ? e[0] = -1 : e[0] = 1, a.getCenterY() < r.getCenterY() ? e[1] = -1 : e[1] = 1; + }, l.getIntersection2 = function(a, r, e) { + var f = a.getCenterX(), i = a.getCenterY(), g = r.getCenterX(), t = r.getCenterY(); + if (a.intersects(r)) + return e[0] = f, e[1] = i, e[2] = g, e[3] = t, !0; + var s = a.getX(), o = a.getY(), c = a.getRight(), h = a.getX(), T = a.getBottom(), v = a.getRight(), d = a.getWidthHalf(), N = a.getHeightHalf(), S = r.getX(), M = r.getY(), P = r.getRight(), K = r.getX(), X = r.getBottom(), k = r.getRight(), D = r.getWidthHalf(), rt = r.getHeightHalf(), n = !1, m = !1; + if (f === g) { + if (i > t) + return e[0] = f, e[1] = o, e[2] = g, e[3] = X, !1; + if (i < t) + return e[0] = f, e[1] = T, e[2] = g, e[3] = M, !1; + } else if (i === t) { + if (f > g) + return e[0] = s, e[1] = i, e[2] = P, e[3] = t, !1; + if (f < g) + return e[0] = c, e[1] = i, e[2] = S, e[3] = t, !1; + } else { + var p = a.height / a.width, E = r.height / r.width, y = (t - i) / (g - f), I = void 0, w = void 0, R = void 0, W = void 0, x = void 0, q = void 0; + if (-p === y ? f > g ? (e[0] = h, e[1] = T, n = !0) : (e[0] = c, e[1] = o, n = !0) : p === y && (f > g ? (e[0] = s, e[1] = o, n = !0) : (e[0] = v, e[1] = T, n = !0)), -E === y ? g > f ? (e[2] = K, e[3] = X, m = !0) : (e[2] = P, e[3] = M, m = !0) : E === y && (g > f ? (e[2] = S, e[3] = M, m = !0) : (e[2] = k, e[3] = X, m = !0)), n && m) + return !1; + if (f > g ? i > t ? (I = this.getCardinalDirection(p, y, 4), w = this.getCardinalDirection(E, y, 2)) : (I = this.getCardinalDirection(-p, y, 3), w = this.getCardinalDirection(-E, y, 1)) : i > t ? (I = this.getCardinalDirection(-p, y, 1), w = this.getCardinalDirection(-E, y, 3)) : (I = this.getCardinalDirection(p, y, 2), w = this.getCardinalDirection(E, y, 4)), !n) + switch (I) { + case 1: + W = o, R = f + -N / y, e[0] = R, e[1] = W; + break; + case 2: + R = v, W = i + d * y, e[0] = R, e[1] = W; + break; + case 3: + W = T, R = f + N / y, e[0] = R, e[1] = W; + break; + case 4: + R = h, W = i + -d * y, e[0] = R, e[1] = W; + break; + } + if (!m) + switch (w) { + case 1: + q = M, x = g + -rt / y, e[2] = x, e[3] = q; + break; + case 2: + x = k, q = t + D * y, e[2] = x, e[3] = q; + break; + case 3: + q = X, x = g + rt / y, e[2] = x, e[3] = q; + break; + case 4: + x = K, q = t + -D * y, e[2] = x, e[3] = q; + break; + } + } + return !1; + }, l.getCardinalDirection = function(a, r, e) { + return a > r ? e : 1 + e % 4; + }, l.getIntersection = function(a, r, e, f) { + if (f == null) + return this.getIntersection2(a, r, e); + var i = a.x, g = a.y, t = r.x, s = r.y, o = e.x, c = e.y, h = f.x, T = f.y, v = void 0, d = void 0, N = void 0, S = void 0, M = void 0, P = void 0, K = void 0, X = void 0, k = void 0; + return N = s - g, M = i - t, K = t * g - i * s, S = T - c, P = o - h, X = h * c - o * T, k = N * P - S * M, k === 0 ? null : (v = (M * X - P * K) / k, d = (S * K - N * X) / k, new u(v, d)); + }, l.angleOfVector = function(a, r, e, f) { + var i = void 0; + return a !== e ? (i = Math.atan((f - r) / (e - a)), e < a ? i += Math.PI : f < r && (i += this.TWO_PI)) : f < r ? i = this.ONE_AND_HALF_PI : i = this.HALF_PI, i; + }, l.doIntersect = function(a, r, e, f) { + var i = a.x, g = a.y, t = r.x, s = r.y, o = e.x, c = e.y, h = f.x, T = f.y, v = (t - i) * (T - c) - (h - o) * (s - g); + if (v === 0) + return !1; + var d = ((T - c) * (h - i) + (o - h) * (T - g)) / v, N = ((g - s) * (h - i) + (t - i) * (T - g)) / v; + return 0 < d && d < 1 && 0 < N && N < 1; + }, l.findCircleLineIntersections = function(a, r, e, f, i, g, t) { + var s = (e - a) * (e - a) + (f - r) * (f - r), o = 2 * ((a - i) * (e - a) + (r - g) * (f - r)), c = (a - i) * (a - i) + (r - g) * (r - g) - t * t, h = o * o - 4 * s * c; + if (h >= 0) { + var T = (-o + Math.sqrt(o * o - 4 * s * c)) / (2 * s), v = (-o - Math.sqrt(o * o - 4 * s * c)) / (2 * s), d = null; + return T >= 0 && T <= 1 ? [T] : v >= 0 && v <= 1 ? [v] : d; + } else return null; + }, l.HALF_PI = 0.5 * Math.PI, l.ONE_AND_HALF_PI = 1.5 * Math.PI, l.TWO_PI = 2 * Math.PI, l.THREE_PI = 3 * Math.PI, A.exports = l; + }, + /* 9 */ + /***/ + function(A, G, L) { + function u() { + } + u.sign = function(l) { + return l > 0 ? 1 : l < 0 ? -1 : 0; + }, u.floor = function(l) { + return l < 0 ? Math.ceil(l) : Math.floor(l); + }, u.ceil = function(l) { + return l < 0 ? Math.floor(l) : Math.ceil(l); + }, A.exports = u; + }, + /* 10 */ + /***/ + function(A, G, L) { + function u() { + } + u.MAX_VALUE = 2147483647, u.MIN_VALUE = -2147483648, A.exports = u; + }, + /* 11 */ + /***/ + function(A, G, L) { + var u = /* @__PURE__ */ function() { + function i(g, t) { + for (var s = 0; s < t.length; s++) { + var o = t[s]; + o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(g, o.key, o); + } + } + return function(g, t, s) { + return t && i(g.prototype, t), s && i(g, s), g; + }; + }(); + function l(i, g) { + if (!(i instanceof g)) + throw new TypeError("Cannot call a class as a function"); + } + var a = function(g) { + return { value: g, next: null, prev: null }; + }, r = function(g, t, s, o) { + return g !== null ? g.next = t : o.head = t, s !== null ? s.prev = t : o.tail = t, t.prev = g, t.next = s, o.length++, t; + }, e = function(g, t) { + var s = g.prev, o = g.next; + return s !== null ? s.next = o : t.head = o, o !== null ? o.prev = s : t.tail = s, g.prev = g.next = null, t.length--, g; + }, f = function() { + function i(g) { + var t = this; + l(this, i), this.length = 0, this.head = null, this.tail = null, g != null && g.forEach(function(s) { + return t.push(s); + }); + } + return u(i, [{ + key: "size", + value: function() { + return this.length; + } + }, { + key: "insertBefore", + value: function(t, s) { + return r(s.prev, a(t), s, this); + } + }, { + key: "insertAfter", + value: function(t, s) { + return r(s, a(t), s.next, this); + } + }, { + key: "insertNodeBefore", + value: function(t, s) { + return r(s.prev, t, s, this); + } + }, { + key: "insertNodeAfter", + value: function(t, s) { + return r(s, t, s.next, this); + } + }, { + key: "push", + value: function(t) { + return r(this.tail, a(t), null, this); + } + }, { + key: "unshift", + value: function(t) { + return r(null, a(t), this.head, this); + } + }, { + key: "remove", + value: function(t) { + return e(t, this); + } + }, { + key: "pop", + value: function() { + return e(this.tail, this).value; + } + }, { + key: "popNode", + value: function() { + return e(this.tail, this); + } + }, { + key: "shift", + value: function() { + return e(this.head, this).value; + } + }, { + key: "shiftNode", + value: function() { + return e(this.head, this); + } + }, { + key: "get_object_at", + value: function(t) { + if (t <= this.length()) { + for (var s = 1, o = this.head; s < t; ) + o = o.next, s++; + return o.value; + } + } + }, { + key: "set_object_at", + value: function(t, s) { + if (t <= this.length()) { + for (var o = 1, c = this.head; o < t; ) + c = c.next, o++; + c.value = s; + } + } + }]), i; + }(); + A.exports = f; + }, + /* 12 */ + /***/ + function(A, G, L) { + function u(l, a, r) { + this.x = null, this.y = null, l == null && a == null && r == null ? (this.x = 0, this.y = 0) : typeof l == "number" && typeof a == "number" && r == null ? (this.x = l, this.y = a) : l.constructor.name == "Point" && a == null && r == null && (r = l, this.x = r.x, this.y = r.y); + } + u.prototype.getX = function() { + return this.x; + }, u.prototype.getY = function() { + return this.y; + }, u.prototype.getLocation = function() { + return new u(this.x, this.y); + }, u.prototype.setLocation = function(l, a, r) { + l.constructor.name == "Point" && a == null && r == null ? (r = l, this.setLocation(r.x, r.y)) : typeof l == "number" && typeof a == "number" && r == null && (parseInt(l) == l && parseInt(a) == a ? this.move(l, a) : (this.x = Math.floor(l + 0.5), this.y = Math.floor(a + 0.5))); + }, u.prototype.move = function(l, a) { + this.x = l, this.y = a; + }, u.prototype.translate = function(l, a) { + this.x += l, this.y += a; + }, u.prototype.equals = function(l) { + if (l.constructor.name == "Point") { + var a = l; + return this.x == a.x && this.y == a.y; + } + return this == l; + }, u.prototype.toString = function() { + return new u().constructor.name + "[x=" + this.x + ",y=" + this.y + "]"; + }, A.exports = u; + }, + /* 13 */ + /***/ + function(A, G, L) { + function u(l, a, r, e) { + this.x = 0, this.y = 0, this.width = 0, this.height = 0, l != null && a != null && r != null && e != null && (this.x = l, this.y = a, this.width = r, this.height = e); + } + u.prototype.getX = function() { + return this.x; + }, u.prototype.setX = function(l) { + this.x = l; + }, u.prototype.getY = function() { + return this.y; + }, u.prototype.setY = function(l) { + this.y = l; + }, u.prototype.getWidth = function() { + return this.width; + }, u.prototype.setWidth = function(l) { + this.width = l; + }, u.prototype.getHeight = function() { + return this.height; + }, u.prototype.setHeight = function(l) { + this.height = l; + }, u.prototype.getRight = function() { + return this.x + this.width; + }, u.prototype.getBottom = function() { + return this.y + this.height; + }, u.prototype.intersects = function(l) { + return !(this.getRight() < l.x || this.getBottom() < l.y || l.getRight() < this.x || l.getBottom() < this.y); + }, u.prototype.getCenterX = function() { + return this.x + this.width / 2; + }, u.prototype.getMinX = function() { + return this.getX(); + }, u.prototype.getMaxX = function() { + return this.getX() + this.width; + }, u.prototype.getCenterY = function() { + return this.y + this.height / 2; + }, u.prototype.getMinY = function() { + return this.getY(); + }, u.prototype.getMaxY = function() { + return this.getY() + this.height; + }, u.prototype.getWidthHalf = function() { + return this.width / 2; + }, u.prototype.getHeightHalf = function() { + return this.height / 2; + }, A.exports = u; + }, + /* 14 */ + /***/ + function(A, G, L) { + var u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(a) { + return typeof a; + } : function(a) { + return a && typeof Symbol == "function" && a.constructor === Symbol && a !== Symbol.prototype ? "symbol" : typeof a; + }; + function l() { + } + l.lastID = 0, l.createID = function(a) { + return l.isPrimitive(a) ? a : (a.uniqueID != null || (a.uniqueID = l.getString(), l.lastID++), a.uniqueID); + }, l.getString = function(a) { + return a == null && (a = l.lastID), "Object#" + a; + }, l.isPrimitive = function(a) { + var r = typeof a > "u" ? "undefined" : u(a); + return a == null || r != "object" && r != "function"; + }, A.exports = l; + }, + /* 15 */ + /***/ + function(A, G, L) { + function u(o) { + if (Array.isArray(o)) { + for (var c = 0, h = Array(o.length); c < o.length; c++) + h[c] = o[c]; + return h; + } else + return Array.from(o); + } + var l = L(0), a = L(7), r = L(3), e = L(1), f = L(6), i = L(5), g = L(17), t = L(29); + function s(o) { + t.call(this), this.layoutQuality = l.QUALITY, this.createBendsAsNeeded = l.DEFAULT_CREATE_BENDS_AS_NEEDED, this.incremental = l.DEFAULT_INCREMENTAL, this.animationOnLayout = l.DEFAULT_ANIMATION_ON_LAYOUT, this.animationDuringLayout = l.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = l.DEFAULT_ANIMATION_PERIOD, this.uniformLeafNodeSizes = l.DEFAULT_UNIFORM_LEAF_NODE_SIZES, this.edgeToDummyNodes = /* @__PURE__ */ new Map(), this.graphManager = new a(this), this.isLayoutFinished = !1, this.isSubLayout = !1, this.isRemoteUse = !1, o != null && (this.isRemoteUse = o); + } + s.RANDOM_SEED = 1, s.prototype = Object.create(t.prototype), s.prototype.getGraphManager = function() { + return this.graphManager; + }, s.prototype.getAllNodes = function() { + return this.graphManager.getAllNodes(); + }, s.prototype.getAllEdges = function() { + return this.graphManager.getAllEdges(); + }, s.prototype.getAllNodesToApplyGravitation = function() { + return this.graphManager.getAllNodesToApplyGravitation(); + }, s.prototype.newGraphManager = function() { + var o = new a(this); + return this.graphManager = o, o; + }, s.prototype.newGraph = function(o) { + return new f(null, this.graphManager, o); + }, s.prototype.newNode = function(o) { + return new r(this.graphManager, o); + }, s.prototype.newEdge = function(o) { + return new e(null, null, o); + }, s.prototype.checkLayoutSuccess = function() { + return this.graphManager.getRoot() == null || this.graphManager.getRoot().getNodes().length == 0 || this.graphManager.includesInvalidEdge(); + }, s.prototype.runLayout = function() { + this.isLayoutFinished = !1, this.tilingPreLayout && this.tilingPreLayout(), this.initParameters(); + var o; + return this.checkLayoutSuccess() ? o = !1 : o = this.layout(), l.ANIMATE === "during" ? !1 : (o && (this.isSubLayout || this.doPostLayout()), this.tilingPostLayout && this.tilingPostLayout(), this.isLayoutFinished = !0, o); + }, s.prototype.doPostLayout = function() { + this.incremental || this.transform(), this.update(); + }, s.prototype.update2 = function() { + if (this.createBendsAsNeeded && (this.createBendpointsFromDummyNodes(), this.graphManager.resetAllEdges()), !this.isRemoteUse) { + for (var o = this.graphManager.getAllEdges(), c = 0; c < o.length; c++) + o[c]; + for (var h = this.graphManager.getRoot().getNodes(), c = 0; c < h.length; c++) + h[c]; + this.update(this.graphManager.getRoot()); + } + }, s.prototype.update = function(o) { + if (o == null) + this.update2(); + else if (o instanceof r) { + var c = o; + if (c.getChild() != null) + for (var h = c.getChild().getNodes(), T = 0; T < h.length; T++) + update(h[T]); + if (c.vGraphObject != null) { + var v = c.vGraphObject; + v.update(c); + } + } else if (o instanceof e) { + var d = o; + if (d.vGraphObject != null) { + var N = d.vGraphObject; + N.update(d); + } + } else if (o instanceof f) { + var S = o; + if (S.vGraphObject != null) { + var M = S.vGraphObject; + M.update(S); + } + } + }, s.prototype.initParameters = function() { + this.isSubLayout || (this.layoutQuality = l.QUALITY, this.animationDuringLayout = l.DEFAULT_ANIMATION_DURING_LAYOUT, this.animationPeriod = l.DEFAULT_ANIMATION_PERIOD, this.animationOnLayout = l.DEFAULT_ANIMATION_ON_LAYOUT, this.incremental = l.DEFAULT_INCREMENTAL, this.createBendsAsNeeded = l.DEFAULT_CREATE_BENDS_AS_NEEDED, this.uniformLeafNodeSizes = l.DEFAULT_UNIFORM_LEAF_NODE_SIZES), this.animationDuringLayout && (this.animationOnLayout = !1); + }, s.prototype.transform = function(o) { + if (o == null) + this.transform(new i(0, 0)); + else { + var c = new g(), h = this.graphManager.getRoot().updateLeftTop(); + if (h != null) { + c.setWorldOrgX(o.x), c.setWorldOrgY(o.y), c.setDeviceOrgX(h.x), c.setDeviceOrgY(h.y); + for (var T = this.getAllNodes(), v, d = 0; d < T.length; d++) + v = T[d], v.transform(c); + } + } + }, s.prototype.positionNodesRandomly = function(o) { + if (o == null) + this.positionNodesRandomly(this.getGraphManager().getRoot()), this.getGraphManager().getRoot().updateBounds(!0); + else + for (var c, h, T = o.getNodes(), v = 0; v < T.length; v++) + c = T[v], h = c.getChild(), h == null || h.getNodes().length == 0 ? c.scatter() : (this.positionNodesRandomly(h), c.updateBounds()); + }, s.prototype.getFlatForest = function() { + for (var o = [], c = !0, h = this.graphManager.getRoot().getNodes(), T = !0, v = 0; v < h.length; v++) + h[v].getChild() != null && (T = !1); + if (!T) + return o; + var d = /* @__PURE__ */ new Set(), N = [], S = /* @__PURE__ */ new Map(), M = []; + for (M = M.concat(h); M.length > 0 && c; ) { + for (N.push(M[0]); N.length > 0 && c; ) { + var P = N[0]; + N.splice(0, 1), d.add(P); + for (var K = P.getEdges(), v = 0; v < K.length; v++) { + var X = K[v].getOtherEnd(P); + if (S.get(P) != X) + if (!d.has(X)) + N.push(X), S.set(X, P); + else { + c = !1; + break; + } + } + } + if (!c) + o = []; + else { + var k = [].concat(u(d)); + o.push(k); + for (var v = 0; v < k.length; v++) { + var D = k[v], rt = M.indexOf(D); + rt > -1 && M.splice(rt, 1); + } + d = /* @__PURE__ */ new Set(), S = /* @__PURE__ */ new Map(); + } + } + return o; + }, s.prototype.createDummyNodesForBendpoints = function(o) { + for (var c = [], h = o.source, T = this.graphManager.calcLowestCommonAncestor(o.source, o.target), v = 0; v < o.bendpoints.length; v++) { + var d = this.newNode(null); + d.setRect(new Point(0, 0), new Dimension(1, 1)), T.add(d); + var N = this.newEdge(null); + this.graphManager.add(N, h, d), c.add(d), h = d; + } + var N = this.newEdge(null); + return this.graphManager.add(N, h, o.target), this.edgeToDummyNodes.set(o, c), o.isInterGraph() ? this.graphManager.remove(o) : T.remove(o), c; + }, s.prototype.createBendpointsFromDummyNodes = function() { + var o = []; + o = o.concat(this.graphManager.getAllEdges()), o = [].concat(u(this.edgeToDummyNodes.keys())).concat(o); + for (var c = 0; c < o.length; c++) { + var h = o[c]; + if (h.bendpoints.length > 0) { + for (var T = this.edgeToDummyNodes.get(h), v = 0; v < T.length; v++) { + var d = T[v], N = new i(d.getCenterX(), d.getCenterY()), S = h.bendpoints.get(v); + S.x = N.x, S.y = N.y, d.getOwner().remove(d); + } + this.graphManager.add(h, h.source, h.target); + } + } + }, s.transform = function(o, c, h, T) { + if (h != null && T != null) { + var v = c; + if (o <= 50) { + var d = c / h; + v -= (c - d) / 50 * (50 - o); + } else { + var N = c * T; + v += (N - c) / 50 * (o - 50); + } + return v; + } else { + var S, M; + return o <= 50 ? (S = 9 * c / 500, M = c / 10) : (S = 9 * c / 50, M = -8 * c), S * o + M; + } + }, s.findCenterOfTree = function(o) { + var c = []; + c = c.concat(o); + var h = [], T = /* @__PURE__ */ new Map(), v = !1, d = null; + (c.length == 1 || c.length == 2) && (v = !0, d = c[0]); + for (var N = 0; N < c.length; N++) { + var S = c[N], M = S.getNeighborsList().size; + T.set(S, S.getNeighborsList().size), M == 1 && h.push(S); + } + var P = []; + for (P = P.concat(h); !v; ) { + var K = []; + K = K.concat(P), P = []; + for (var N = 0; N < c.length; N++) { + var S = c[N], X = c.indexOf(S); + X >= 0 && c.splice(X, 1); + var k = S.getNeighborsList(); + k.forEach(function(n) { + if (h.indexOf(n) < 0) { + var m = T.get(n), p = m - 1; + p == 1 && P.push(n), T.set(n, p); + } + }); + } + h = h.concat(P), (c.length == 1 || c.length == 2) && (v = !0, d = c[0]); + } + return d; + }, s.prototype.setGraphManager = function(o) { + this.graphManager = o; + }, A.exports = s; + }, + /* 16 */ + /***/ + function(A, G, L) { + function u() { + } + u.seed = 1, u.x = 0, u.nextDouble = function() { + return u.x = Math.sin(u.seed++) * 1e4, u.x - Math.floor(u.x); + }, A.exports = u; + }, + /* 17 */ + /***/ + function(A, G, L) { + var u = L(5); + function l(a, r) { + this.lworldOrgX = 0, this.lworldOrgY = 0, this.ldeviceOrgX = 0, this.ldeviceOrgY = 0, this.lworldExtX = 1, this.lworldExtY = 1, this.ldeviceExtX = 1, this.ldeviceExtY = 1; + } + l.prototype.getWorldOrgX = function() { + return this.lworldOrgX; + }, l.prototype.setWorldOrgX = function(a) { + this.lworldOrgX = a; + }, l.prototype.getWorldOrgY = function() { + return this.lworldOrgY; + }, l.prototype.setWorldOrgY = function(a) { + this.lworldOrgY = a; + }, l.prototype.getWorldExtX = function() { + return this.lworldExtX; + }, l.prototype.setWorldExtX = function(a) { + this.lworldExtX = a; + }, l.prototype.getWorldExtY = function() { + return this.lworldExtY; + }, l.prototype.setWorldExtY = function(a) { + this.lworldExtY = a; + }, l.prototype.getDeviceOrgX = function() { + return this.ldeviceOrgX; + }, l.prototype.setDeviceOrgX = function(a) { + this.ldeviceOrgX = a; + }, l.prototype.getDeviceOrgY = function() { + return this.ldeviceOrgY; + }, l.prototype.setDeviceOrgY = function(a) { + this.ldeviceOrgY = a; + }, l.prototype.getDeviceExtX = function() { + return this.ldeviceExtX; + }, l.prototype.setDeviceExtX = function(a) { + this.ldeviceExtX = a; + }, l.prototype.getDeviceExtY = function() { + return this.ldeviceExtY; + }, l.prototype.setDeviceExtY = function(a) { + this.ldeviceExtY = a; + }, l.prototype.transformX = function(a) { + var r = 0, e = this.lworldExtX; + return e != 0 && (r = this.ldeviceOrgX + (a - this.lworldOrgX) * this.ldeviceExtX / e), r; + }, l.prototype.transformY = function(a) { + var r = 0, e = this.lworldExtY; + return e != 0 && (r = this.ldeviceOrgY + (a - this.lworldOrgY) * this.ldeviceExtY / e), r; + }, l.prototype.inverseTransformX = function(a) { + var r = 0, e = this.ldeviceExtX; + return e != 0 && (r = this.lworldOrgX + (a - this.ldeviceOrgX) * this.lworldExtX / e), r; + }, l.prototype.inverseTransformY = function(a) { + var r = 0, e = this.ldeviceExtY; + return e != 0 && (r = this.lworldOrgY + (a - this.ldeviceOrgY) * this.lworldExtY / e), r; + }, l.prototype.inverseTransformPoint = function(a) { + var r = new u(this.inverseTransformX(a.x), this.inverseTransformY(a.y)); + return r; + }, A.exports = l; + }, + /* 18 */ + /***/ + function(A, G, L) { + function u(t) { + if (Array.isArray(t)) { + for (var s = 0, o = Array(t.length); s < t.length; s++) + o[s] = t[s]; + return o; + } else + return Array.from(t); + } + var l = L(15), a = L(4), r = L(0), e = L(8), f = L(9); + function i() { + l.call(this), this.useSmartIdealEdgeLengthCalculation = a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = a.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = a.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = a.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.displacementThresholdPerNode = 3 * a.DEFAULT_EDGE_LENGTH / 100, this.coolingFactor = a.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.initialCoolingFactor = a.DEFAULT_COOLING_FACTOR_INCREMENTAL, this.totalDisplacement = 0, this.oldTotalDisplacement = 0, this.maxIterations = a.MAX_ITERATIONS; + } + i.prototype = Object.create(l.prototype); + for (var g in l) + i[g] = l[g]; + i.prototype.initParameters = function() { + l.prototype.initParameters.call(this, arguments), this.totalIterations = 0, this.notAnimatedIterations = 0, this.useFRGridVariant = a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION, this.grid = []; + }, i.prototype.calcIdealEdgeLengths = function() { + for (var t, s, o, c, h, T, v, d = this.getGraphManager().getAllEdges(), N = 0; N < d.length; N++) + t = d[N], s = t.idealLength, t.isInterGraph && (c = t.getSource(), h = t.getTarget(), T = t.getSourceInLca().getEstimatedSize(), v = t.getTargetInLca().getEstimatedSize(), this.useSmartIdealEdgeLengthCalculation && (t.idealLength += T + v - 2 * r.SIMPLE_NODE_SIZE), o = t.getLca().getInclusionTreeDepth(), t.idealLength += s * a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR * (c.getInclusionTreeDepth() + h.getInclusionTreeDepth() - 2 * o)); + }, i.prototype.initSpringEmbedder = function() { + var t = this.getAllNodes().length; + this.incremental ? (t > a.ADAPTATION_LOWER_NODE_LIMIT && (this.coolingFactor = Math.max(this.coolingFactor * a.COOLING_ADAPTATION_FACTOR, this.coolingFactor - (t - a.ADAPTATION_LOWER_NODE_LIMIT) / (a.ADAPTATION_UPPER_NODE_LIMIT - a.ADAPTATION_LOWER_NODE_LIMIT) * this.coolingFactor * (1 - a.COOLING_ADAPTATION_FACTOR))), this.maxNodeDisplacement = a.MAX_NODE_DISPLACEMENT_INCREMENTAL) : (t > a.ADAPTATION_LOWER_NODE_LIMIT ? this.coolingFactor = Math.max(a.COOLING_ADAPTATION_FACTOR, 1 - (t - a.ADAPTATION_LOWER_NODE_LIMIT) / (a.ADAPTATION_UPPER_NODE_LIMIT - a.ADAPTATION_LOWER_NODE_LIMIT) * (1 - a.COOLING_ADAPTATION_FACTOR)) : this.coolingFactor = 1, this.initialCoolingFactor = this.coolingFactor, this.maxNodeDisplacement = a.MAX_NODE_DISPLACEMENT), this.maxIterations = Math.max(this.getAllNodes().length * 5, this.maxIterations), this.displacementThresholdPerNode = 3 * a.DEFAULT_EDGE_LENGTH / 100, this.totalDisplacementThreshold = this.displacementThresholdPerNode * this.getAllNodes().length, this.repulsionRange = this.calcRepulsionRange(); + }, i.prototype.calcSpringForces = function() { + for (var t = this.getAllEdges(), s, o = 0; o < t.length; o++) + s = t[o], this.calcSpringForce(s, s.idealLength); + }, i.prototype.calcRepulsionForces = function() { + var t = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, s = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, o, c, h, T, v = this.getAllNodes(), d; + if (this.useFRGridVariant) + for (this.totalIterations % a.GRID_CALCULATION_CHECK_PERIOD == 1 && t && this.updateGrid(), d = /* @__PURE__ */ new Set(), o = 0; o < v.length; o++) + h = v[o], this.calculateRepulsionForceOfANode(h, d, t, s), d.add(h); + else + for (o = 0; o < v.length; o++) + for (h = v[o], c = o + 1; c < v.length; c++) + T = v[c], h.getOwner() == T.getOwner() && this.calcRepulsionForce(h, T); + }, i.prototype.calcGravitationalForces = function() { + for (var t, s = this.getAllNodesToApplyGravitation(), o = 0; o < s.length; o++) + t = s[o], this.calcGravitationalForce(t); + }, i.prototype.moveNodes = function() { + for (var t = this.getAllNodes(), s, o = 0; o < t.length; o++) + s = t[o], s.move(); + }, i.prototype.calcSpringForce = function(t, s) { + var o = t.getSource(), c = t.getTarget(), h, T, v, d; + if (this.uniformLeafNodeSizes && o.getChild() == null && c.getChild() == null) + t.updateLengthSimple(); + else if (t.updateLength(), t.isOverlapingSourceAndTarget) + return; + h = t.getLength(), h != 0 && (T = t.edgeElasticity * (h - s), v = T * (t.lengthX / h), d = T * (t.lengthY / h), o.springForceX += v, o.springForceY += d, c.springForceX -= v, c.springForceY -= d); + }, i.prototype.calcRepulsionForce = function(t, s) { + var o = t.getRect(), c = s.getRect(), h = new Array(2), T = new Array(4), v, d, N, S, M, P, K; + if (o.intersects(c)) { + e.calcSeparationAmount(o, c, h, a.DEFAULT_EDGE_LENGTH / 2), P = 2 * h[0], K = 2 * h[1]; + var X = t.noOfChildren * s.noOfChildren / (t.noOfChildren + s.noOfChildren); + t.repulsionForceX -= X * P, t.repulsionForceY -= X * K, s.repulsionForceX += X * P, s.repulsionForceY += X * K; + } else + this.uniformLeafNodeSizes && t.getChild() == null && s.getChild() == null ? (v = c.getCenterX() - o.getCenterX(), d = c.getCenterY() - o.getCenterY()) : (e.getIntersection(o, c, T), v = T[2] - T[0], d = T[3] - T[1]), Math.abs(v) < a.MIN_REPULSION_DIST && (v = f.sign(v) * a.MIN_REPULSION_DIST), Math.abs(d) < a.MIN_REPULSION_DIST && (d = f.sign(d) * a.MIN_REPULSION_DIST), N = v * v + d * d, S = Math.sqrt(N), M = (t.nodeRepulsion / 2 + s.nodeRepulsion / 2) * t.noOfChildren * s.noOfChildren / N, P = M * v / S, K = M * d / S, t.repulsionForceX -= P, t.repulsionForceY -= K, s.repulsionForceX += P, s.repulsionForceY += K; + }, i.prototype.calcGravitationalForce = function(t) { + var s, o, c, h, T, v, d, N; + s = t.getOwner(), o = (s.getRight() + s.getLeft()) / 2, c = (s.getTop() + s.getBottom()) / 2, h = t.getCenterX() - o, T = t.getCenterY() - c, v = Math.abs(h) + t.getWidth() / 2, d = Math.abs(T) + t.getHeight() / 2, t.getOwner() == this.graphManager.getRoot() ? (N = s.getEstimatedSize() * this.gravityRangeFactor, (v > N || d > N) && (t.gravitationForceX = -this.gravityConstant * h, t.gravitationForceY = -this.gravityConstant * T)) : (N = s.getEstimatedSize() * this.compoundGravityRangeFactor, (v > N || d > N) && (t.gravitationForceX = -this.gravityConstant * h * this.compoundGravityConstant, t.gravitationForceY = -this.gravityConstant * T * this.compoundGravityConstant)); + }, i.prototype.isConverged = function() { + var t, s = !1; + return this.totalIterations > this.maxIterations / 3 && (s = Math.abs(this.totalDisplacement - this.oldTotalDisplacement) < 2), t = this.totalDisplacement < this.totalDisplacementThreshold, this.oldTotalDisplacement = this.totalDisplacement, t || s; + }, i.prototype.animate = function() { + this.animationDuringLayout && !this.isSubLayout && (this.notAnimatedIterations == this.animationPeriod ? (this.update(), this.notAnimatedIterations = 0) : this.notAnimatedIterations++); + }, i.prototype.calcNoOfChildrenForAllNodes = function() { + for (var t, s = this.graphManager.getAllNodes(), o = 0; o < s.length; o++) + t = s[o], t.noOfChildren = t.getNoOfChildren(); + }, i.prototype.calcGrid = function(t) { + var s = 0, o = 0; + s = parseInt(Math.ceil((t.getRight() - t.getLeft()) / this.repulsionRange)), o = parseInt(Math.ceil((t.getBottom() - t.getTop()) / this.repulsionRange)); + for (var c = new Array(s), h = 0; h < s; h++) + c[h] = new Array(o); + for (var h = 0; h < s; h++) + for (var T = 0; T < o; T++) + c[h][T] = new Array(); + return c; + }, i.prototype.addNodeToGrid = function(t, s, o) { + var c = 0, h = 0, T = 0, v = 0; + c = parseInt(Math.floor((t.getRect().x - s) / this.repulsionRange)), h = parseInt(Math.floor((t.getRect().width + t.getRect().x - s) / this.repulsionRange)), T = parseInt(Math.floor((t.getRect().y - o) / this.repulsionRange)), v = parseInt(Math.floor((t.getRect().height + t.getRect().y - o) / this.repulsionRange)); + for (var d = c; d <= h; d++) + for (var N = T; N <= v; N++) + this.grid[d][N].push(t), t.setGridCoordinates(c, h, T, v); + }, i.prototype.updateGrid = function() { + var t, s, o = this.getAllNodes(); + for (this.grid = this.calcGrid(this.graphManager.getRoot()), t = 0; t < o.length; t++) + s = o[t], this.addNodeToGrid(s, this.graphManager.getRoot().getLeft(), this.graphManager.getRoot().getTop()); + }, i.prototype.calculateRepulsionForceOfANode = function(t, s, o, c) { + if (this.totalIterations % a.GRID_CALCULATION_CHECK_PERIOD == 1 && o || c) { + var h = /* @__PURE__ */ new Set(); + t.surrounding = new Array(); + for (var T, v = this.grid, d = t.startX - 1; d < t.finishX + 2; d++) + for (var N = t.startY - 1; N < t.finishY + 2; N++) + if (!(d < 0 || N < 0 || d >= v.length || N >= v[0].length)) { + for (var S = 0; S < v[d][N].length; S++) + if (T = v[d][N][S], !(t.getOwner() != T.getOwner() || t == T) && !s.has(T) && !h.has(T)) { + var M = Math.abs(t.getCenterX() - T.getCenterX()) - (t.getWidth() / 2 + T.getWidth() / 2), P = Math.abs(t.getCenterY() - T.getCenterY()) - (t.getHeight() / 2 + T.getHeight() / 2); + M <= this.repulsionRange && P <= this.repulsionRange && h.add(T); + } + } + t.surrounding = [].concat(u(h)); + } + for (d = 0; d < t.surrounding.length; d++) + this.calcRepulsionForce(t, t.surrounding[d]); + }, i.prototype.calcRepulsionRange = function() { + return 0; + }, A.exports = i; + }, + /* 19 */ + /***/ + function(A, G, L) { + var u = L(1), l = L(4); + function a(e, f, i) { + u.call(this, e, f, i), this.idealLength = l.DEFAULT_EDGE_LENGTH, this.edgeElasticity = l.DEFAULT_SPRING_STRENGTH; + } + a.prototype = Object.create(u.prototype); + for (var r in u) + a[r] = u[r]; + A.exports = a; + }, + /* 20 */ + /***/ + function(A, G, L) { + var u = L(3), l = L(4); + function a(e, f, i, g) { + u.call(this, e, f, i, g), this.nodeRepulsion = l.DEFAULT_REPULSION_STRENGTH, this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0, this.startX = 0, this.finishX = 0, this.startY = 0, this.finishY = 0, this.surrounding = []; + } + a.prototype = Object.create(u.prototype); + for (var r in u) + a[r] = u[r]; + a.prototype.setGridCoordinates = function(e, f, i, g) { + this.startX = e, this.finishX = f, this.startY = i, this.finishY = g; + }, A.exports = a; + }, + /* 21 */ + /***/ + function(A, G, L) { + function u(l, a) { + this.width = 0, this.height = 0, l !== null && a !== null && (this.height = a, this.width = l); + } + u.prototype.getWidth = function() { + return this.width; + }, u.prototype.setWidth = function(l) { + this.width = l; + }, u.prototype.getHeight = function() { + return this.height; + }, u.prototype.setHeight = function(l) { + this.height = l; + }, A.exports = u; + }, + /* 22 */ + /***/ + function(A, G, L) { + var u = L(14); + function l() { + this.map = {}, this.keys = []; + } + l.prototype.put = function(a, r) { + var e = u.createID(a); + this.contains(e) || (this.map[e] = r, this.keys.push(a)); + }, l.prototype.contains = function(a) { + return u.createID(a), this.map[a] != null; + }, l.prototype.get = function(a) { + var r = u.createID(a); + return this.map[r]; + }, l.prototype.keySet = function() { + return this.keys; + }, A.exports = l; + }, + /* 23 */ + /***/ + function(A, G, L) { + var u = L(14); + function l() { + this.set = {}; + } + l.prototype.add = function(a) { + var r = u.createID(a); + this.contains(r) || (this.set[r] = a); + }, l.prototype.remove = function(a) { + delete this.set[u.createID(a)]; + }, l.prototype.clear = function() { + this.set = {}; + }, l.prototype.contains = function(a) { + return this.set[u.createID(a)] == a; + }, l.prototype.isEmpty = function() { + return this.size() === 0; + }, l.prototype.size = function() { + return Object.keys(this.set).length; + }, l.prototype.addAllTo = function(a) { + for (var r = Object.keys(this.set), e = r.length, f = 0; f < e; f++) + a.push(this.set[r[f]]); + }, l.prototype.size = function() { + return Object.keys(this.set).length; + }, l.prototype.addAll = function(a) { + for (var r = a.length, e = 0; e < r; e++) { + var f = a[e]; + this.add(f); + } + }, A.exports = l; + }, + /* 24 */ + /***/ + function(A, G, L) { + function u() { + } + u.multMat = function(l, a) { + for (var r = [], e = 0; e < l.length; e++) { + r[e] = []; + for (var f = 0; f < a[0].length; f++) { + r[e][f] = 0; + for (var i = 0; i < l[0].length; i++) + r[e][f] += l[e][i] * a[i][f]; + } + } + return r; + }, u.transpose = function(l) { + for (var a = [], r = 0; r < l[0].length; r++) { + a[r] = []; + for (var e = 0; e < l.length; e++) + a[r][e] = l[e][r]; + } + return a; + }, u.multCons = function(l, a) { + for (var r = [], e = 0; e < l.length; e++) + r[e] = l[e] * a; + return r; + }, u.minusOp = function(l, a) { + for (var r = [], e = 0; e < l.length; e++) + r[e] = l[e] - a[e]; + return r; + }, u.dotProduct = function(l, a) { + for (var r = 0, e = 0; e < l.length; e++) + r += l[e] * a[e]; + return r; + }, u.mag = function(l) { + return Math.sqrt(this.dotProduct(l, l)); + }, u.normalize = function(l) { + for (var a = [], r = this.mag(l), e = 0; e < l.length; e++) + a[e] = l[e] / r; + return a; + }, u.multGamma = function(l) { + for (var a = [], r = 0, e = 0; e < l.length; e++) + r += l[e]; + r *= -1 / l.length; + for (var f = 0; f < l.length; f++) + a[f] = r + l[f]; + return a; + }, u.multL = function(l, a, r) { + for (var e = [], f = [], i = [], g = 0; g < a[0].length; g++) { + for (var t = 0, s = 0; s < a.length; s++) + t += -0.5 * a[s][g] * l[s]; + f[g] = t; + } + for (var o = 0; o < r.length; o++) { + for (var c = 0, h = 0; h < r.length; h++) + c += r[o][h] * f[h]; + i[o] = c; + } + for (var T = 0; T < a.length; T++) { + for (var v = 0, d = 0; d < a[0].length; d++) + v += a[T][d] * i[d]; + e[T] = v; + } + return e; + }, A.exports = u; + }, + /* 25 */ + /***/ + function(A, G, L) { + var u = /* @__PURE__ */ function() { + function e(f, i) { + for (var g = 0; g < i.length; g++) { + var t = i[g]; + t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(f, t.key, t); + } + } + return function(f, i, g) { + return i && e(f.prototype, i), g && e(f, g), f; + }; + }(); + function l(e, f) { + if (!(e instanceof f)) + throw new TypeError("Cannot call a class as a function"); + } + var a = L(11), r = function() { + function e(f, i) { + l(this, e), (i !== null || i !== void 0) && (this.compareFunction = this._defaultCompareFunction); + var g = void 0; + f instanceof a ? g = f.size() : g = f.length, this._quicksort(f, 0, g - 1); + } + return u(e, [{ + key: "_quicksort", + value: function(i, g, t) { + if (g < t) { + var s = this._partition(i, g, t); + this._quicksort(i, g, s), this._quicksort(i, s + 1, t); + } + } + }, { + key: "_partition", + value: function(i, g, t) { + for (var s = this._get(i, g), o = g, c = t; ; ) { + for (; this.compareFunction(s, this._get(i, c)); ) + c--; + for (; this.compareFunction(this._get(i, o), s); ) + o++; + if (o < c) + this._swap(i, o, c), o++, c--; + else return c; + } + } + }, { + key: "_get", + value: function(i, g) { + return i instanceof a ? i.get_object_at(g) : i[g]; + } + }, { + key: "_set", + value: function(i, g, t) { + i instanceof a ? i.set_object_at(g, t) : i[g] = t; + } + }, { + key: "_swap", + value: function(i, g, t) { + var s = this._get(i, g); + this._set(i, g, this._get(i, t)), this._set(i, t, s); + } + }, { + key: "_defaultCompareFunction", + value: function(i, g) { + return g > i; + } + }]), e; + }(); + A.exports = r; + }, + /* 26 */ + /***/ + function(A, G, L) { + function u() { + } + u.svd = function(l) { + this.U = null, this.V = null, this.s = null, this.m = 0, this.n = 0, this.m = l.length, this.n = l[0].length; + var a = Math.min(this.m, this.n); + this.s = function(Nt) { + for (var Mt = []; Nt-- > 0; ) + Mt.push(0); + return Mt; + }(Math.min(this.m + 1, this.n)), this.U = function(Nt) { + var Mt = function Zt(Gt) { + if (Gt.length == 0) + return 0; + for (var $t = [], Ft = 0; Ft < Gt[0]; Ft++) + $t.push(Zt(Gt.slice(1))); + return $t; + }; + return Mt(Nt); + }([this.m, a]), this.V = function(Nt) { + var Mt = function Zt(Gt) { + if (Gt.length == 0) + return 0; + for (var $t = [], Ft = 0; Ft < Gt[0]; Ft++) + $t.push(Zt(Gt.slice(1))); + return $t; + }; + return Mt(Nt); + }([this.n, this.n]); + for (var r = function(Nt) { + for (var Mt = []; Nt-- > 0; ) + Mt.push(0); + return Mt; + }(this.n), e = function(Nt) { + for (var Mt = []; Nt-- > 0; ) + Mt.push(0); + return Mt; + }(this.m), f = !0, i = Math.min(this.m - 1, this.n), g = Math.max(0, Math.min(this.n - 2, this.m)), t = 0; t < Math.max(i, g); t++) { + if (t < i) { + this.s[t] = 0; + for (var s = t; s < this.m; s++) + this.s[t] = u.hypot(this.s[t], l[s][t]); + if (this.s[t] !== 0) { + l[t][t] < 0 && (this.s[t] = -this.s[t]); + for (var o = t; o < this.m; o++) + l[o][t] /= this.s[t]; + l[t][t] += 1; + } + this.s[t] = -this.s[t]; + } + for (var c = t + 1; c < this.n; c++) { + if (/* @__PURE__ */ function(Nt, Mt) { + return Nt && Mt; + }(t < i, this.s[t] !== 0)) { + for (var h = 0, T = t; T < this.m; T++) + h += l[T][t] * l[T][c]; + h = -h / l[t][t]; + for (var v = t; v < this.m; v++) + l[v][c] += h * l[v][t]; + } + r[c] = l[t][c]; + } + if (/* @__PURE__ */ function(Nt, Mt) { + return Mt; + }(f, t < i)) + for (var d = t; d < this.m; d++) + this.U[d][t] = l[d][t]; + if (t < g) { + r[t] = 0; + for (var N = t + 1; N < this.n; N++) + r[t] = u.hypot(r[t], r[N]); + if (r[t] !== 0) { + r[t + 1] < 0 && (r[t] = -r[t]); + for (var S = t + 1; S < this.n; S++) + r[S] /= r[t]; + r[t + 1] += 1; + } + if (r[t] = -r[t], /* @__PURE__ */ function(Nt, Mt) { + return Nt && Mt; + }(t + 1 < this.m, r[t] !== 0)) { + for (var M = t + 1; M < this.m; M++) + e[M] = 0; + for (var P = t + 1; P < this.n; P++) + for (var K = t + 1; K < this.m; K++) + e[K] += r[P] * l[K][P]; + for (var X = t + 1; X < this.n; X++) + for (var k = -r[X] / r[t + 1], D = t + 1; D < this.m; D++) + l[D][X] += k * e[D]; + } + for (var rt = t + 1; rt < this.n; rt++) + this.V[rt][t] = r[rt]; + } + } + var n = Math.min(this.n, this.m + 1); + i < this.n && (this.s[i] = l[i][i]), this.m < n && (this.s[n - 1] = 0), g + 1 < n && (r[g] = l[g][n - 1]), r[n - 1] = 0; + { + for (var m = i; m < a; m++) { + for (var p = 0; p < this.m; p++) + this.U[p][m] = 0; + this.U[m][m] = 1; + } + for (var E = i - 1; E >= 0; E--) + if (this.s[E] !== 0) { + for (var y = E + 1; y < a; y++) { + for (var I = 0, w = E; w < this.m; w++) + I += this.U[w][E] * this.U[w][y]; + I = -I / this.U[E][E]; + for (var R = E; R < this.m; R++) + this.U[R][y] += I * this.U[R][E]; + } + for (var W = E; W < this.m; W++) + this.U[W][E] = -this.U[W][E]; + this.U[E][E] = 1 + this.U[E][E]; + for (var x = 0; x < E - 1; x++) + this.U[x][E] = 0; + } else { + for (var q = 0; q < this.m; q++) + this.U[q][E] = 0; + this.U[E][E] = 1; + } + } + for (var V = this.n - 1; V >= 0; V--) { + if (/* @__PURE__ */ function(Nt, Mt) { + return Nt && Mt; + }(V < g, r[V] !== 0)) + for (var Y = V + 1; Y < a; Y++) { + for (var et = 0, z = V + 1; z < this.n; z++) + et += this.V[z][V] * this.V[z][Y]; + et = -et / this.V[V + 1][V]; + for (var O = V + 1; O < this.n; O++) + this.V[O][Y] += et * this.V[O][V]; + } + for (var H = 0; H < this.n; H++) + this.V[H][V] = 0; + this.V[V][V] = 1; + } + for (var B = n - 1, _ = Math.pow(2, -52), lt = Math.pow(2, -966); n > 0; ) { + var J = void 0, Rt = void 0; + for (J = n - 2; J >= -1 && J !== -1; J--) + if (Math.abs(r[J]) <= lt + _ * (Math.abs(this.s[J]) + Math.abs(this.s[J + 1]))) { + r[J] = 0; + break; + } + if (J === n - 2) + Rt = 4; + else { + var Lt = void 0; + for (Lt = n - 1; Lt >= J && Lt !== J; Lt--) { + var vt = (Lt !== n ? Math.abs(r[Lt]) : 0) + (Lt !== J + 1 ? Math.abs(r[Lt - 1]) : 0); + if (Math.abs(this.s[Lt]) <= lt + _ * vt) { + this.s[Lt] = 0; + break; + } + } + Lt === J ? Rt = 3 : Lt === n - 1 ? Rt = 1 : (Rt = 2, J = Lt); + } + switch (J++, Rt) { + case 1: + { + var it = r[n - 2]; + r[n - 2] = 0; + for (var gt = n - 2; gt >= J; gt--) { + var Tt = u.hypot(this.s[gt], it), At = this.s[gt] / Tt, Dt = it / Tt; + this.s[gt] = Tt, gt !== J && (it = -Dt * r[gt - 1], r[gt - 1] = At * r[gt - 1]); + for (var mt = 0; mt < this.n; mt++) + Tt = At * this.V[mt][gt] + Dt * this.V[mt][n - 1], this.V[mt][n - 1] = -Dt * this.V[mt][gt] + At * this.V[mt][n - 1], this.V[mt][gt] = Tt; + } + } + break; + case 2: + { + var xt = r[J - 1]; + r[J - 1] = 0; + for (var St = J; St < n; St++) { + var Vt = u.hypot(this.s[St], xt), Xt = this.s[St] / Vt, Ut = xt / Vt; + this.s[St] = Vt, xt = -Ut * r[St], r[St] = Xt * r[St]; + for (var bt = 0; bt < this.m; bt++) + Vt = Xt * this.U[bt][St] + Ut * this.U[bt][J - 1], this.U[bt][J - 1] = -Ut * this.U[bt][St] + Xt * this.U[bt][J - 1], this.U[bt][St] = Vt; + } + } + break; + case 3: + { + var Ht = Math.max(Math.max(Math.max(Math.max(Math.abs(this.s[n - 1]), Math.abs(this.s[n - 2])), Math.abs(r[n - 2])), Math.abs(this.s[J])), Math.abs(r[J])), Bt = this.s[n - 1] / Ht, F = this.s[n - 2] / Ht, b = r[n - 2] / Ht, $ = this.s[J] / Ht, Q = r[J] / Ht, Z = ((F + Bt) * (F - Bt) + b * b) / 2, at = Bt * b * (Bt * b), ut = 0; + /* @__PURE__ */ (function(Nt, Mt) { + return Nt || Mt; + })(Z !== 0, at !== 0) && (ut = Math.sqrt(Z * Z + at), Z < 0 && (ut = -ut), ut = at / (Z + ut)); + for (var ot = ($ + Bt) * ($ - Bt) + ut, tt = $ * Q, j = J; j < n - 1; j++) { + var dt = u.hypot(ot, tt), wt = ot / dt, yt = tt / dt; + j !== J && (r[j - 1] = dt), ot = wt * this.s[j] + yt * r[j], r[j] = wt * r[j] - yt * this.s[j], tt = yt * this.s[j + 1], this.s[j + 1] = wt * this.s[j + 1]; + for (var It = 0; It < this.n; It++) + dt = wt * this.V[It][j] + yt * this.V[It][j + 1], this.V[It][j + 1] = -yt * this.V[It][j] + wt * this.V[It][j + 1], this.V[It][j] = dt; + if (dt = u.hypot(ot, tt), wt = ot / dt, yt = tt / dt, this.s[j] = dt, ot = wt * r[j] + yt * this.s[j + 1], this.s[j + 1] = -yt * r[j] + wt * this.s[j + 1], tt = yt * r[j + 1], r[j + 1] = wt * r[j + 1], j < this.m - 1) + for (var ft = 0; ft < this.m; ft++) + dt = wt * this.U[ft][j] + yt * this.U[ft][j + 1], this.U[ft][j + 1] = -yt * this.U[ft][j] + wt * this.U[ft][j + 1], this.U[ft][j] = dt; + } + r[n - 2] = ot; + } + break; + case 4: + { + if (this.s[J] <= 0) { + this.s[J] = this.s[J] < 0 ? -this.s[J] : 0; + for (var st = 0; st <= B; st++) + this.V[st][J] = -this.V[st][J]; + } + for (; J < B && !(this.s[J] >= this.s[J + 1]); ) { + var Ct = this.s[J]; + if (this.s[J] = this.s[J + 1], this.s[J + 1] = Ct, J < this.n - 1) + for (var ct = 0; ct < this.n; ct++) + Ct = this.V[ct][J + 1], this.V[ct][J + 1] = this.V[ct][J], this.V[ct][J] = Ct; + if (J < this.m - 1) + for (var ht = 0; ht < this.m; ht++) + Ct = this.U[ht][J + 1], this.U[ht][J + 1] = this.U[ht][J], this.U[ht][J] = Ct; + J++; + } + n--; + } + break; + } + } + var Wt = { U: this.U, V: this.V, S: this.s }; + return Wt; + }, u.hypot = function(l, a) { + var r = void 0; + return Math.abs(l) > Math.abs(a) ? (r = a / l, r = Math.abs(l) * Math.sqrt(1 + r * r)) : a != 0 ? (r = l / a, r = Math.abs(a) * Math.sqrt(1 + r * r)) : r = 0, r; + }, A.exports = u; + }, + /* 27 */ + /***/ + function(A, G, L) { + var u = /* @__PURE__ */ function() { + function r(e, f) { + for (var i = 0; i < f.length; i++) { + var g = f[i]; + g.enumerable = g.enumerable || !1, g.configurable = !0, "value" in g && (g.writable = !0), Object.defineProperty(e, g.key, g); + } + } + return function(e, f, i) { + return f && r(e.prototype, f), i && r(e, i), e; + }; + }(); + function l(r, e) { + if (!(r instanceof e)) + throw new TypeError("Cannot call a class as a function"); + } + var a = function() { + function r(e, f) { + var i = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 1, g = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : -1, t = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : -1; + l(this, r), this.sequence1 = e, this.sequence2 = f, this.match_score = i, this.mismatch_penalty = g, this.gap_penalty = t, this.iMax = e.length + 1, this.jMax = f.length + 1, this.grid = new Array(this.iMax); + for (var s = 0; s < this.iMax; s++) { + this.grid[s] = new Array(this.jMax); + for (var o = 0; o < this.jMax; o++) + this.grid[s][o] = 0; + } + this.tracebackGrid = new Array(this.iMax); + for (var c = 0; c < this.iMax; c++) { + this.tracebackGrid[c] = new Array(this.jMax); + for (var h = 0; h < this.jMax; h++) + this.tracebackGrid[c][h] = [null, null, null]; + } + this.alignments = [], this.score = -1, this.computeGrids(); + } + return u(r, [{ + key: "getScore", + value: function() { + return this.score; + } + }, { + key: "getAlignments", + value: function() { + return this.alignments; + } + // Main dynamic programming procedure + }, { + key: "computeGrids", + value: function() { + for (var f = 1; f < this.jMax; f++) + this.grid[0][f] = this.grid[0][f - 1] + this.gap_penalty, this.tracebackGrid[0][f] = [!1, !1, !0]; + for (var i = 1; i < this.iMax; i++) + this.grid[i][0] = this.grid[i - 1][0] + this.gap_penalty, this.tracebackGrid[i][0] = [!1, !0, !1]; + for (var g = 1; g < this.iMax; g++) + for (var t = 1; t < this.jMax; t++) { + var s = void 0; + this.sequence1[g - 1] === this.sequence2[t - 1] ? s = this.grid[g - 1][t - 1] + this.match_score : s = this.grid[g - 1][t - 1] + this.mismatch_penalty; + var o = this.grid[g - 1][t] + this.gap_penalty, c = this.grid[g][t - 1] + this.gap_penalty, h = [s, o, c], T = this.arrayAllMaxIndexes(h); + this.grid[g][t] = h[T[0]], this.tracebackGrid[g][t] = [T.includes(0), T.includes(1), T.includes(2)]; + } + this.score = this.grid[this.iMax - 1][this.jMax - 1]; + } + // Gets all possible valid sequence combinations + }, { + key: "alignmentTraceback", + value: function() { + var f = []; + for (f.push({ + pos: [this.sequence1.length, this.sequence2.length], + seq1: "", + seq2: "" + }); f[0]; ) { + var i = f[0], g = this.tracebackGrid[i.pos[0]][i.pos[1]]; + g[0] && f.push({ + pos: [i.pos[0] - 1, i.pos[1] - 1], + seq1: this.sequence1[i.pos[0] - 1] + i.seq1, + seq2: this.sequence2[i.pos[1] - 1] + i.seq2 + }), g[1] && f.push({ + pos: [i.pos[0] - 1, i.pos[1]], + seq1: this.sequence1[i.pos[0] - 1] + i.seq1, + seq2: "-" + i.seq2 + }), g[2] && f.push({ + pos: [i.pos[0], i.pos[1] - 1], + seq1: "-" + i.seq1, + seq2: this.sequence2[i.pos[1] - 1] + i.seq2 + }), i.pos[0] === 0 && i.pos[1] === 0 && this.alignments.push({ + sequence1: i.seq1, + sequence2: i.seq2 + }), f.shift(); + } + return this.alignments; + } + // Helper Functions + }, { + key: "getAllIndexes", + value: function(f, i) { + for (var g = [], t = -1; (t = f.indexOf(i, t + 1)) !== -1; ) + g.push(t); + return g; + } + }, { + key: "arrayAllMaxIndexes", + value: function(f) { + return this.getAllIndexes(f, Math.max.apply(null, f)); + } + }]), r; + }(); + A.exports = a; + }, + /* 28 */ + /***/ + function(A, G, L) { + var u = function() { + }; + u.FDLayout = L(18), u.FDLayoutConstants = L(4), u.FDLayoutEdge = L(19), u.FDLayoutNode = L(20), u.DimensionD = L(21), u.HashMap = L(22), u.HashSet = L(23), u.IGeometry = L(8), u.IMath = L(9), u.Integer = L(10), u.Point = L(12), u.PointD = L(5), u.RandomSeed = L(16), u.RectangleD = L(13), u.Transform = L(17), u.UniqueIDGeneretor = L(14), u.Quicksort = L(25), u.LinkedList = L(11), u.LGraphObject = L(2), u.LGraph = L(6), u.LEdge = L(1), u.LGraphManager = L(7), u.LNode = L(3), u.Layout = L(15), u.LayoutConstants = L(0), u.NeedlemanWunsch = L(27), u.Matrix = L(24), u.SVD = L(26), A.exports = u; + }, + /* 29 */ + /***/ + function(A, G, L) { + function u() { + this.listeners = []; + } + var l = u.prototype; + l.addListener = function(a, r) { + this.listeners.push({ + event: a, + callback: r + }); + }, l.removeListener = function(a, r) { + for (var e = this.listeners.length; e >= 0; e--) { + var f = this.listeners[e]; + f.event === a && f.callback === r && this.listeners.splice(e, 1); + } + }, l.emit = function(a, r) { + for (var e = 0; e < this.listeners.length; e++) { + var f = this.listeners[e]; + a === f.event && f.callback(r); + } + }, A.exports = u; + } + /******/ + ]) + ); + }); + }(ye)), ye.exports; +} +var Ie; +function ur() { + return Ie || (Ie = 1, function(C, U) { + (function(G, L) { + C.exports = L(cr()); + })(Le, function(A) { + return ( + /******/ + (() => { + var G = { + /***/ + 45: ( + /***/ + (a, r, e) => { + var f = {}; + f.layoutBase = e(551), f.CoSEConstants = e(806), f.CoSEEdge = e(767), f.CoSEGraph = e(880), f.CoSEGraphManager = e(578), f.CoSELayout = e(765), f.CoSENode = e(991), f.ConstraintHandler = e(902), a.exports = f; + } + ), + /***/ + 806: ( + /***/ + (a, r, e) => { + var f = e(551).FDLayoutConstants; + function i() { + } + for (var g in f) + i[g] = f[g]; + i.DEFAULT_USE_MULTI_LEVEL_SCALING = !1, i.DEFAULT_RADIAL_SEPARATION = f.DEFAULT_EDGE_LENGTH, i.DEFAULT_COMPONENT_SEPERATION = 60, i.TILE = !0, i.TILING_PADDING_VERTICAL = 10, i.TILING_PADDING_HORIZONTAL = 10, i.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, i.ENFORCE_CONSTRAINTS = !0, i.APPLY_LAYOUT = !0, i.RELAX_MOVEMENT_ON_CONSTRAINTS = !0, i.TREE_REDUCTION_ON_INCREMENTAL = !0, i.PURE_INCREMENTAL = i.DEFAULT_INCREMENTAL, a.exports = i; + } + ), + /***/ + 767: ( + /***/ + (a, r, e) => { + var f = e(551).FDLayoutEdge; + function i(t, s, o) { + f.call(this, t, s, o); + } + i.prototype = Object.create(f.prototype); + for (var g in f) + i[g] = f[g]; + a.exports = i; + } + ), + /***/ + 880: ( + /***/ + (a, r, e) => { + var f = e(551).LGraph; + function i(t, s, o) { + f.call(this, t, s, o); + } + i.prototype = Object.create(f.prototype); + for (var g in f) + i[g] = f[g]; + a.exports = i; + } + ), + /***/ + 578: ( + /***/ + (a, r, e) => { + var f = e(551).LGraphManager; + function i(t) { + f.call(this, t); + } + i.prototype = Object.create(f.prototype); + for (var g in f) + i[g] = f[g]; + a.exports = i; + } + ), + /***/ + 765: ( + /***/ + (a, r, e) => { + var f = e(551).FDLayout, i = e(578), g = e(880), t = e(991), s = e(767), o = e(806), c = e(902), h = e(551).FDLayoutConstants, T = e(551).LayoutConstants, v = e(551).Point, d = e(551).PointD, N = e(551).DimensionD, S = e(551).Layout, M = e(551).Integer, P = e(551).IGeometry, K = e(551).LGraph, X = e(551).Transform, k = e(551).LinkedList; + function D() { + f.call(this), this.toBeTiled = {}, this.constraints = {}; + } + D.prototype = Object.create(f.prototype); + for (var rt in f) + D[rt] = f[rt]; + D.prototype.newGraphManager = function() { + var n = new i(this); + return this.graphManager = n, n; + }, D.prototype.newGraph = function(n) { + return new g(null, this.graphManager, n); + }, D.prototype.newNode = function(n) { + return new t(this.graphManager, n); + }, D.prototype.newEdge = function(n) { + return new s(null, null, n); + }, D.prototype.initParameters = function() { + f.prototype.initParameters.call(this, arguments), this.isSubLayout || (o.DEFAULT_EDGE_LENGTH < 10 ? this.idealEdgeLength = 10 : this.idealEdgeLength = o.DEFAULT_EDGE_LENGTH, this.useSmartIdealEdgeLengthCalculation = o.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION, this.gravityConstant = h.DEFAULT_GRAVITY_STRENGTH, this.compoundGravityConstant = h.DEFAULT_COMPOUND_GRAVITY_STRENGTH, this.gravityRangeFactor = h.DEFAULT_GRAVITY_RANGE_FACTOR, this.compoundGravityRangeFactor = h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR, this.prunedNodesAll = [], this.growTreeIterations = 0, this.afterGrowthIterations = 0, this.isTreeGrowing = !1, this.isGrowthFinished = !1); + }, D.prototype.initSpringEmbedder = function() { + f.prototype.initSpringEmbedder.call(this), this.coolingCycle = 0, this.maxCoolingCycle = this.maxIterations / h.CONVERGENCE_CHECK_PERIOD, this.finalTemperature = 0.04, this.coolingAdjuster = 1; + }, D.prototype.layout = function() { + var n = T.DEFAULT_CREATE_BENDS_AS_NEEDED; + return n && (this.createBendpoints(), this.graphManager.resetAllEdges()), this.level = 0, this.classicLayout(); + }, D.prototype.classicLayout = function() { + if (this.nodesWithGravity = this.calculateNodesToApplyGravitationTo(), this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity), this.calcNoOfChildrenForAllNodes(), this.graphManager.calcLowestCommonAncestors(), this.graphManager.calcInclusionTreeDepths(), this.graphManager.getRoot().calcEstimatedSize(), this.calcIdealEdgeLengths(), this.incremental) { + if (o.TREE_REDUCTION_ON_INCREMENTAL) { + this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation(); + var m = new Set(this.getAllNodes()), p = this.nodesWithGravity.filter(function(I) { + return m.has(I); + }); + this.graphManager.setAllNodesToApplyGravitation(p); + } + } else { + var n = this.getFlatForest(); + if (n.length > 0) + this.positionNodesRadially(n); + else { + this.reduceTrees(), this.graphManager.resetAllNodesToApplyGravitation(); + var m = new Set(this.getAllNodes()), p = this.nodesWithGravity.filter(function(E) { + return m.has(E); + }); + this.graphManager.setAllNodesToApplyGravitation(p), this.positionNodesRandomly(); + } + } + return Object.keys(this.constraints).length > 0 && (c.handleConstraints(this), this.initConstraintVariables()), this.initSpringEmbedder(), o.APPLY_LAYOUT && this.runSpringEmbedder(), !0; + }, D.prototype.tick = function() { + if (this.totalIterations++, this.totalIterations === this.maxIterations && !this.isTreeGrowing && !this.isGrowthFinished) + if (this.prunedNodesAll.length > 0) + this.isTreeGrowing = !0; + else + return !0; + if (this.totalIterations % h.CONVERGENCE_CHECK_PERIOD == 0 && !this.isTreeGrowing && !this.isGrowthFinished) { + if (this.isConverged()) + if (this.prunedNodesAll.length > 0) + this.isTreeGrowing = !0; + else + return !0; + this.coolingCycle++, this.layoutQuality == 0 ? this.coolingAdjuster = this.coolingCycle : this.layoutQuality == 1 && (this.coolingAdjuster = this.coolingCycle / 3), this.coolingFactor = Math.max(this.initialCoolingFactor - Math.pow(this.coolingCycle, Math.log(100 * (this.initialCoolingFactor - this.finalTemperature)) / Math.log(this.maxCoolingCycle)) / 100 * this.coolingAdjuster, this.finalTemperature), this.animationPeriod = Math.ceil(this.initialAnimationPeriod * Math.sqrt(this.coolingFactor)); + } + if (this.isTreeGrowing) { + if (this.growTreeIterations % 10 == 0) + if (this.prunedNodesAll.length > 0) { + this.graphManager.updateBounds(), this.updateGrid(), this.growTree(this.prunedNodesAll), this.graphManager.resetAllNodesToApplyGravitation(); + var n = new Set(this.getAllNodes()), m = this.nodesWithGravity.filter(function(y) { + return n.has(y); + }); + this.graphManager.setAllNodesToApplyGravitation(m), this.graphManager.updateBounds(), this.updateGrid(), o.PURE_INCREMENTAL ? this.coolingFactor = h.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 : this.coolingFactor = h.DEFAULT_COOLING_FACTOR_INCREMENTAL; + } else + this.isTreeGrowing = !1, this.isGrowthFinished = !0; + this.growTreeIterations++; + } + if (this.isGrowthFinished) { + if (this.isConverged()) + return !0; + this.afterGrowthIterations % 10 == 0 && (this.graphManager.updateBounds(), this.updateGrid()), o.PURE_INCREMENTAL ? this.coolingFactor = h.DEFAULT_COOLING_FACTOR_INCREMENTAL / 2 * ((100 - this.afterGrowthIterations) / 100) : this.coolingFactor = h.DEFAULT_COOLING_FACTOR_INCREMENTAL * ((100 - this.afterGrowthIterations) / 100), this.afterGrowthIterations++; + } + var p = !this.isTreeGrowing && !this.isGrowthFinished, E = this.growTreeIterations % 10 == 1 && this.isTreeGrowing || this.afterGrowthIterations % 10 == 1 && this.isGrowthFinished; + return this.totalDisplacement = 0, this.graphManager.updateBounds(), this.calcSpringForces(), this.calcRepulsionForces(p, E), this.calcGravitationalForces(), this.moveNodes(), this.animate(), !1; + }, D.prototype.getPositionsData = function() { + for (var n = this.graphManager.getAllNodes(), m = {}, p = 0; p < n.length; p++) { + var E = n[p].rect, y = n[p].id; + m[y] = { + id: y, + x: E.getCenterX(), + y: E.getCenterY(), + w: E.width, + h: E.height + }; + } + return m; + }, D.prototype.runSpringEmbedder = function() { + this.initialAnimationPeriod = 25, this.animationPeriod = this.initialAnimationPeriod; + var n = !1; + if (h.ANIMATE === "during") + this.emit("layoutstarted"); + else { + for (; !n; ) + n = this.tick(); + this.graphManager.updateBounds(); + } + }, D.prototype.moveNodes = function() { + for (var n = this.getAllNodes(), m, p = 0; p < n.length; p++) + m = n[p], m.calculateDisplacement(); + Object.keys(this.constraints).length > 0 && this.updateDisplacements(); + for (var p = 0; p < n.length; p++) + m = n[p], m.move(); + }, D.prototype.initConstraintVariables = function() { + var n = this; + this.idToNodeMap = /* @__PURE__ */ new Map(), this.fixedNodeSet = /* @__PURE__ */ new Set(); + for (var m = this.graphManager.getAllNodes(), p = 0; p < m.length; p++) { + var E = m[p]; + this.idToNodeMap.set(E.id, E); + } + var y = function O(H) { + for (var B = H.getChild().getNodes(), _, lt = 0, J = 0; J < B.length; J++) + _ = B[J], _.getChild() == null ? n.fixedNodeSet.has(_.id) && (lt += 100) : lt += O(_); + return lt; + }; + if (this.constraints.fixedNodeConstraint) { + this.constraints.fixedNodeConstraint.forEach(function(B) { + n.fixedNodeSet.add(B.nodeId); + }); + for (var m = this.graphManager.getAllNodes(), E, p = 0; p < m.length; p++) + if (E = m[p], E.getChild() != null) { + var I = y(E); + I > 0 && (E.fixedNodeWeight = I); + } + } + if (this.constraints.relativePlacementConstraint) { + var w = /* @__PURE__ */ new Map(), R = /* @__PURE__ */ new Map(); + if (this.dummyToNodeForVerticalAlignment = /* @__PURE__ */ new Map(), this.dummyToNodeForHorizontalAlignment = /* @__PURE__ */ new Map(), this.fixedNodesOnHorizontal = /* @__PURE__ */ new Set(), this.fixedNodesOnVertical = /* @__PURE__ */ new Set(), this.fixedNodeSet.forEach(function(O) { + n.fixedNodesOnHorizontal.add(O), n.fixedNodesOnVertical.add(O); + }), this.constraints.alignmentConstraint) { + if (this.constraints.alignmentConstraint.vertical) + for (var W = this.constraints.alignmentConstraint.vertical, p = 0; p < W.length; p++) + this.dummyToNodeForVerticalAlignment.set("dummy" + p, []), W[p].forEach(function(H) { + w.set(H, "dummy" + p), n.dummyToNodeForVerticalAlignment.get("dummy" + p).push(H), n.fixedNodeSet.has(H) && n.fixedNodesOnHorizontal.add("dummy" + p); + }); + if (this.constraints.alignmentConstraint.horizontal) + for (var x = this.constraints.alignmentConstraint.horizontal, p = 0; p < x.length; p++) + this.dummyToNodeForHorizontalAlignment.set("dummy" + p, []), x[p].forEach(function(H) { + R.set(H, "dummy" + p), n.dummyToNodeForHorizontalAlignment.get("dummy" + p).push(H), n.fixedNodeSet.has(H) && n.fixedNodesOnVertical.add("dummy" + p); + }); + } + if (o.RELAX_MOVEMENT_ON_CONSTRAINTS) + this.shuffle = function(O) { + var H, B, _; + for (_ = O.length - 1; _ >= 2 * O.length / 3; _--) + H = Math.floor(Math.random() * (_ + 1)), B = O[_], O[_] = O[H], O[H] = B; + return O; + }, this.nodesInRelativeHorizontal = [], this.nodesInRelativeVertical = [], this.nodeToRelativeConstraintMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToRelativeConstraintMapVertical = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapHorizontal = /* @__PURE__ */ new Map(), this.nodeToTempPositionMapVertical = /* @__PURE__ */ new Map(), this.constraints.relativePlacementConstraint.forEach(function(O) { + if (O.left) { + var H = w.has(O.left) ? w.get(O.left) : O.left, B = w.has(O.right) ? w.get(O.right) : O.right; + n.nodesInRelativeHorizontal.includes(H) || (n.nodesInRelativeHorizontal.push(H), n.nodeToRelativeConstraintMapHorizontal.set(H, []), n.dummyToNodeForVerticalAlignment.has(H) ? n.nodeToTempPositionMapHorizontal.set(H, n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(H)[0]).getCenterX()) : n.nodeToTempPositionMapHorizontal.set(H, n.idToNodeMap.get(H).getCenterX())), n.nodesInRelativeHorizontal.includes(B) || (n.nodesInRelativeHorizontal.push(B), n.nodeToRelativeConstraintMapHorizontal.set(B, []), n.dummyToNodeForVerticalAlignment.has(B) ? n.nodeToTempPositionMapHorizontal.set(B, n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(B)[0]).getCenterX()) : n.nodeToTempPositionMapHorizontal.set(B, n.idToNodeMap.get(B).getCenterX())), n.nodeToRelativeConstraintMapHorizontal.get(H).push({ right: B, gap: O.gap }), n.nodeToRelativeConstraintMapHorizontal.get(B).push({ left: H, gap: O.gap }); + } else { + var _ = R.has(O.top) ? R.get(O.top) : O.top, lt = R.has(O.bottom) ? R.get(O.bottom) : O.bottom; + n.nodesInRelativeVertical.includes(_) || (n.nodesInRelativeVertical.push(_), n.nodeToRelativeConstraintMapVertical.set(_, []), n.dummyToNodeForHorizontalAlignment.has(_) ? n.nodeToTempPositionMapVertical.set(_, n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(_)[0]).getCenterY()) : n.nodeToTempPositionMapVertical.set(_, n.idToNodeMap.get(_).getCenterY())), n.nodesInRelativeVertical.includes(lt) || (n.nodesInRelativeVertical.push(lt), n.nodeToRelativeConstraintMapVertical.set(lt, []), n.dummyToNodeForHorizontalAlignment.has(lt) ? n.nodeToTempPositionMapVertical.set(lt, n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(lt)[0]).getCenterY()) : n.nodeToTempPositionMapVertical.set(lt, n.idToNodeMap.get(lt).getCenterY())), n.nodeToRelativeConstraintMapVertical.get(_).push({ bottom: lt, gap: O.gap }), n.nodeToRelativeConstraintMapVertical.get(lt).push({ top: _, gap: O.gap }); + } + }); + else { + var q = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map(); + this.constraints.relativePlacementConstraint.forEach(function(O) { + if (O.left) { + var H = w.has(O.left) ? w.get(O.left) : O.left, B = w.has(O.right) ? w.get(O.right) : O.right; + q.has(H) ? q.get(H).push(B) : q.set(H, [B]), q.has(B) ? q.get(B).push(H) : q.set(B, [H]); + } else { + var _ = R.has(O.top) ? R.get(O.top) : O.top, lt = R.has(O.bottom) ? R.get(O.bottom) : O.bottom; + V.has(_) ? V.get(_).push(lt) : V.set(_, [lt]), V.has(lt) ? V.get(lt).push(_) : V.set(lt, [_]); + } + }); + var Y = function(H, B) { + var _ = [], lt = [], J = new k(), Rt = /* @__PURE__ */ new Set(), Lt = 0; + return H.forEach(function(vt, it) { + if (!Rt.has(it)) { + _[Lt] = [], lt[Lt] = !1; + var gt = it; + for (J.push(gt), Rt.add(gt), _[Lt].push(gt); J.length != 0; ) { + gt = J.shift(), B.has(gt) && (lt[Lt] = !0); + var Tt = H.get(gt); + Tt.forEach(function(At) { + Rt.has(At) || (J.push(At), Rt.add(At), _[Lt].push(At)); + }); + } + Lt++; + } + }), { components: _, isFixed: lt }; + }, et = Y(q, n.fixedNodesOnHorizontal); + this.componentsOnHorizontal = et.components, this.fixedComponentsOnHorizontal = et.isFixed; + var z = Y(V, n.fixedNodesOnVertical); + this.componentsOnVertical = z.components, this.fixedComponentsOnVertical = z.isFixed; + } + } + }, D.prototype.updateDisplacements = function() { + var n = this; + if (this.constraints.fixedNodeConstraint && this.constraints.fixedNodeConstraint.forEach(function(z) { + var O = n.idToNodeMap.get(z.nodeId); + O.displacementX = 0, O.displacementY = 0; + }), this.constraints.alignmentConstraint) { + if (this.constraints.alignmentConstraint.vertical) + for (var m = this.constraints.alignmentConstraint.vertical, p = 0; p < m.length; p++) { + for (var E = 0, y = 0; y < m[p].length; y++) { + if (this.fixedNodeSet.has(m[p][y])) { + E = 0; + break; + } + E += this.idToNodeMap.get(m[p][y]).displacementX; + } + for (var I = E / m[p].length, y = 0; y < m[p].length; y++) + this.idToNodeMap.get(m[p][y]).displacementX = I; + } + if (this.constraints.alignmentConstraint.horizontal) + for (var w = this.constraints.alignmentConstraint.horizontal, p = 0; p < w.length; p++) { + for (var R = 0, y = 0; y < w[p].length; y++) { + if (this.fixedNodeSet.has(w[p][y])) { + R = 0; + break; + } + R += this.idToNodeMap.get(w[p][y]).displacementY; + } + for (var W = R / w[p].length, y = 0; y < w[p].length; y++) + this.idToNodeMap.get(w[p][y]).displacementY = W; + } + } + if (this.constraints.relativePlacementConstraint) + if (o.RELAX_MOVEMENT_ON_CONSTRAINTS) + this.totalIterations % 10 == 0 && (this.shuffle(this.nodesInRelativeHorizontal), this.shuffle(this.nodesInRelativeVertical)), this.nodesInRelativeHorizontal.forEach(function(z) { + if (!n.fixedNodesOnHorizontal.has(z)) { + var O = 0; + n.dummyToNodeForVerticalAlignment.has(z) ? O = n.idToNodeMap.get(n.dummyToNodeForVerticalAlignment.get(z)[0]).displacementX : O = n.idToNodeMap.get(z).displacementX, n.nodeToRelativeConstraintMapHorizontal.get(z).forEach(function(H) { + if (H.right) { + var B = n.nodeToTempPositionMapHorizontal.get(H.right) - n.nodeToTempPositionMapHorizontal.get(z) - O; + B < H.gap && (O -= H.gap - B); + } else { + var B = n.nodeToTempPositionMapHorizontal.get(z) - n.nodeToTempPositionMapHorizontal.get(H.left) + O; + B < H.gap && (O += H.gap - B); + } + }), n.nodeToTempPositionMapHorizontal.set(z, n.nodeToTempPositionMapHorizontal.get(z) + O), n.dummyToNodeForVerticalAlignment.has(z) ? n.dummyToNodeForVerticalAlignment.get(z).forEach(function(H) { + n.idToNodeMap.get(H).displacementX = O; + }) : n.idToNodeMap.get(z).displacementX = O; + } + }), this.nodesInRelativeVertical.forEach(function(z) { + if (!n.fixedNodesOnHorizontal.has(z)) { + var O = 0; + n.dummyToNodeForHorizontalAlignment.has(z) ? O = n.idToNodeMap.get(n.dummyToNodeForHorizontalAlignment.get(z)[0]).displacementY : O = n.idToNodeMap.get(z).displacementY, n.nodeToRelativeConstraintMapVertical.get(z).forEach(function(H) { + if (H.bottom) { + var B = n.nodeToTempPositionMapVertical.get(H.bottom) - n.nodeToTempPositionMapVertical.get(z) - O; + B < H.gap && (O -= H.gap - B); + } else { + var B = n.nodeToTempPositionMapVertical.get(z) - n.nodeToTempPositionMapVertical.get(H.top) + O; + B < H.gap && (O += H.gap - B); + } + }), n.nodeToTempPositionMapVertical.set(z, n.nodeToTempPositionMapVertical.get(z) + O), n.dummyToNodeForHorizontalAlignment.has(z) ? n.dummyToNodeForHorizontalAlignment.get(z).forEach(function(H) { + n.idToNodeMap.get(H).displacementY = O; + }) : n.idToNodeMap.get(z).displacementY = O; + } + }); + else { + for (var p = 0; p < this.componentsOnHorizontal.length; p++) { + var x = this.componentsOnHorizontal[p]; + if (this.fixedComponentsOnHorizontal[p]) + for (var y = 0; y < x.length; y++) + this.dummyToNodeForVerticalAlignment.has(x[y]) ? this.dummyToNodeForVerticalAlignment.get(x[y]).forEach(function(H) { + n.idToNodeMap.get(H).displacementX = 0; + }) : this.idToNodeMap.get(x[y]).displacementX = 0; + else { + for (var q = 0, V = 0, y = 0; y < x.length; y++) + if (this.dummyToNodeForVerticalAlignment.has(x[y])) { + var Y = this.dummyToNodeForVerticalAlignment.get(x[y]); + q += Y.length * this.idToNodeMap.get(Y[0]).displacementX, V += Y.length; + } else + q += this.idToNodeMap.get(x[y]).displacementX, V++; + for (var et = q / V, y = 0; y < x.length; y++) + this.dummyToNodeForVerticalAlignment.has(x[y]) ? this.dummyToNodeForVerticalAlignment.get(x[y]).forEach(function(H) { + n.idToNodeMap.get(H).displacementX = et; + }) : this.idToNodeMap.get(x[y]).displacementX = et; + } + } + for (var p = 0; p < this.componentsOnVertical.length; p++) { + var x = this.componentsOnVertical[p]; + if (this.fixedComponentsOnVertical[p]) + for (var y = 0; y < x.length; y++) + this.dummyToNodeForHorizontalAlignment.has(x[y]) ? this.dummyToNodeForHorizontalAlignment.get(x[y]).forEach(function(B) { + n.idToNodeMap.get(B).displacementY = 0; + }) : this.idToNodeMap.get(x[y]).displacementY = 0; + else { + for (var q = 0, V = 0, y = 0; y < x.length; y++) + if (this.dummyToNodeForHorizontalAlignment.has(x[y])) { + var Y = this.dummyToNodeForHorizontalAlignment.get(x[y]); + q += Y.length * this.idToNodeMap.get(Y[0]).displacementY, V += Y.length; + } else + q += this.idToNodeMap.get(x[y]).displacementY, V++; + for (var et = q / V, y = 0; y < x.length; y++) + this.dummyToNodeForHorizontalAlignment.has(x[y]) ? this.dummyToNodeForHorizontalAlignment.get(x[y]).forEach(function(J) { + n.idToNodeMap.get(J).displacementY = et; + }) : this.idToNodeMap.get(x[y]).displacementY = et; + } + } + } + }, D.prototype.calculateNodesToApplyGravitationTo = function() { + var n = [], m, p = this.graphManager.getGraphs(), E = p.length, y; + for (y = 0; y < E; y++) + m = p[y], m.updateConnected(), m.isConnected || (n = n.concat(m.getNodes())); + return n; + }, D.prototype.createBendpoints = function() { + var n = []; + n = n.concat(this.graphManager.getAllEdges()); + var m = /* @__PURE__ */ new Set(), p; + for (p = 0; p < n.length; p++) { + var E = n[p]; + if (!m.has(E)) { + var y = E.getSource(), I = E.getTarget(); + if (y == I) + E.getBendpoints().push(new d()), E.getBendpoints().push(new d()), this.createDummyNodesForBendpoints(E), m.add(E); + else { + var w = []; + if (w = w.concat(y.getEdgeListToNode(I)), w = w.concat(I.getEdgeListToNode(y)), !m.has(w[0])) { + if (w.length > 1) { + var R; + for (R = 0; R < w.length; R++) { + var W = w[R]; + W.getBendpoints().push(new d()), this.createDummyNodesForBendpoints(W); + } + } + w.forEach(function(x) { + m.add(x); + }); + } + } + } + if (m.size == n.length) + break; + } + }, D.prototype.positionNodesRadially = function(n) { + for (var m = new v(0, 0), p = Math.ceil(Math.sqrt(n.length)), E = 0, y = 0, I = 0, w = new d(0, 0), R = 0; R < n.length; R++) { + R % p == 0 && (I = 0, y = E, R != 0 && (y += o.DEFAULT_COMPONENT_SEPERATION), E = 0); + var W = n[R], x = S.findCenterOfTree(W); + m.x = I, m.y = y, w = D.radialLayout(W, x, m), w.y > E && (E = Math.floor(w.y)), I = Math.floor(w.x + o.DEFAULT_COMPONENT_SEPERATION); + } + this.transform(new d(T.WORLD_CENTER_X - w.x / 2, T.WORLD_CENTER_Y - w.y / 2)); + }, D.radialLayout = function(n, m, p) { + var E = Math.max(this.maxDiagonalInTree(n), o.DEFAULT_RADIAL_SEPARATION); + D.branchRadialLayout(m, null, 0, 359, 0, E); + var y = K.calculateBounds(n), I = new X(); + I.setDeviceOrgX(y.getMinX()), I.setDeviceOrgY(y.getMinY()), I.setWorldOrgX(p.x), I.setWorldOrgY(p.y); + for (var w = 0; w < n.length; w++) { + var R = n[w]; + R.transform(I); + } + var W = new d(y.getMaxX(), y.getMaxY()); + return I.inverseTransformPoint(W); + }, D.branchRadialLayout = function(n, m, p, E, y, I) { + var w = (E - p + 1) / 2; + w < 0 && (w += 180); + var R = (w + p) % 360, W = R * P.TWO_PI / 360, x = y * Math.cos(W), q = y * Math.sin(W); + n.setCenter(x, q); + var V = []; + V = V.concat(n.getEdges()); + var Y = V.length; + m != null && Y--; + for (var et = 0, z = V.length, O, H = n.getEdgesBetween(m); H.length > 1; ) { + var B = H[0]; + H.splice(0, 1); + var _ = V.indexOf(B); + _ >= 0 && V.splice(_, 1), z--, Y--; + } + m != null ? O = (V.indexOf(H[0]) + 1) % z : O = 0; + for (var lt = Math.abs(E - p) / Y, J = O; et != Y; J = ++J % z) { + var Rt = V[J].getOtherEnd(n); + if (Rt != m) { + var Lt = (p + et * lt) % 360, vt = (Lt + lt) % 360; + D.branchRadialLayout(Rt, n, Lt, vt, y + I, I), et++; + } + } + }, D.maxDiagonalInTree = function(n) { + for (var m = M.MIN_VALUE, p = 0; p < n.length; p++) { + var E = n[p], y = E.getDiagonal(); + y > m && (m = y); + } + return m; + }, D.prototype.calcRepulsionRange = function() { + return 2 * (this.level + 1) * this.idealEdgeLength; + }, D.prototype.groupZeroDegreeMembers = function() { + var n = this, m = {}; + this.memberGroups = {}, this.idToDummyNode = {}; + for (var p = [], E = this.graphManager.getAllNodes(), y = 0; y < E.length; y++) { + var I = E[y], w = I.getParent(); + this.getNodeDegreeWithChildren(I) === 0 && (w.id == null || !this.getToBeTiled(w)) && p.push(I); + } + for (var y = 0; y < p.length; y++) { + var I = p[y], R = I.getParent().id; + typeof m[R] > "u" && (m[R] = []), m[R] = m[R].concat(I); + } + Object.keys(m).forEach(function(W) { + if (m[W].length > 1) { + var x = "DummyCompound_" + W; + n.memberGroups[x] = m[W]; + var q = m[W][0].getParent(), V = new t(n.graphManager); + V.id = x, V.paddingLeft = q.paddingLeft || 0, V.paddingRight = q.paddingRight || 0, V.paddingBottom = q.paddingBottom || 0, V.paddingTop = q.paddingTop || 0, n.idToDummyNode[x] = V; + var Y = n.getGraphManager().add(n.newGraph(), V), et = q.getChild(); + et.add(V); + for (var z = 0; z < m[W].length; z++) { + var O = m[W][z]; + et.remove(O), Y.add(O); + } + } + }); + }, D.prototype.clearCompounds = function() { + var n = {}, m = {}; + this.performDFSOnCompounds(); + for (var p = 0; p < this.compoundOrder.length; p++) + m[this.compoundOrder[p].id] = this.compoundOrder[p], n[this.compoundOrder[p].id] = [].concat(this.compoundOrder[p].getChild().getNodes()), this.graphManager.remove(this.compoundOrder[p].getChild()), this.compoundOrder[p].child = null; + this.graphManager.resetAllNodes(), this.tileCompoundMembers(n, m); + }, D.prototype.clearZeroDegreeMembers = function() { + var n = this, m = this.tiledZeroDegreePack = []; + Object.keys(this.memberGroups).forEach(function(p) { + var E = n.idToDummyNode[p]; + if (m[p] = n.tileNodes(n.memberGroups[p], E.paddingLeft + E.paddingRight), E.rect.width = m[p].width, E.rect.height = m[p].height, E.setCenter(m[p].centerX, m[p].centerY), E.labelMarginLeft = 0, E.labelMarginTop = 0, o.NODE_DIMENSIONS_INCLUDE_LABELS) { + var y = E.rect.width, I = E.rect.height; + E.labelWidth && (E.labelPosHorizontal == "left" ? (E.rect.x -= E.labelWidth, E.setWidth(y + E.labelWidth), E.labelMarginLeft = E.labelWidth) : E.labelPosHorizontal == "center" && E.labelWidth > y ? (E.rect.x -= (E.labelWidth - y) / 2, E.setWidth(E.labelWidth), E.labelMarginLeft = (E.labelWidth - y) / 2) : E.labelPosHorizontal == "right" && E.setWidth(y + E.labelWidth)), E.labelHeight && (E.labelPosVertical == "top" ? (E.rect.y -= E.labelHeight, E.setHeight(I + E.labelHeight), E.labelMarginTop = E.labelHeight) : E.labelPosVertical == "center" && E.labelHeight > I ? (E.rect.y -= (E.labelHeight - I) / 2, E.setHeight(E.labelHeight), E.labelMarginTop = (E.labelHeight - I) / 2) : E.labelPosVertical == "bottom" && E.setHeight(I + E.labelHeight)); + } + }); + }, D.prototype.repopulateCompounds = function() { + for (var n = this.compoundOrder.length - 1; n >= 0; n--) { + var m = this.compoundOrder[n], p = m.id, E = m.paddingLeft, y = m.paddingTop, I = m.labelMarginLeft, w = m.labelMarginTop; + this.adjustLocations(this.tiledMemberPack[p], m.rect.x, m.rect.y, E, y, I, w); + } + }, D.prototype.repopulateZeroDegreeMembers = function() { + var n = this, m = this.tiledZeroDegreePack; + Object.keys(m).forEach(function(p) { + var E = n.idToDummyNode[p], y = E.paddingLeft, I = E.paddingTop, w = E.labelMarginLeft, R = E.labelMarginTop; + n.adjustLocations(m[p], E.rect.x, E.rect.y, y, I, w, R); + }); + }, D.prototype.getToBeTiled = function(n) { + var m = n.id; + if (this.toBeTiled[m] != null) + return this.toBeTiled[m]; + var p = n.getChild(); + if (p == null) + return this.toBeTiled[m] = !1, !1; + for (var E = p.getNodes(), y = 0; y < E.length; y++) { + var I = E[y]; + if (this.getNodeDegree(I) > 0) + return this.toBeTiled[m] = !1, !1; + if (I.getChild() == null) { + this.toBeTiled[I.id] = !1; + continue; + } + if (!this.getToBeTiled(I)) + return this.toBeTiled[m] = !1, !1; + } + return this.toBeTiled[m] = !0, !0; + }, D.prototype.getNodeDegree = function(n) { + n.id; + for (var m = n.getEdges(), p = 0, E = 0; E < m.length; E++) { + var y = m[E]; + y.getSource().id !== y.getTarget().id && (p = p + 1); + } + return p; + }, D.prototype.getNodeDegreeWithChildren = function(n) { + var m = this.getNodeDegree(n); + if (n.getChild() == null) + return m; + for (var p = n.getChild().getNodes(), E = 0; E < p.length; E++) { + var y = p[E]; + m += this.getNodeDegreeWithChildren(y); + } + return m; + }, D.prototype.performDFSOnCompounds = function() { + this.compoundOrder = [], this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes()); + }, D.prototype.fillCompexOrderByDFS = function(n) { + for (var m = 0; m < n.length; m++) { + var p = n[m]; + p.getChild() != null && this.fillCompexOrderByDFS(p.getChild().getNodes()), this.getToBeTiled(p) && this.compoundOrder.push(p); + } + }, D.prototype.adjustLocations = function(n, m, p, E, y, I, w) { + m += E + I, p += y + w; + for (var R = m, W = 0; W < n.rows.length; W++) { + var x = n.rows[W]; + m = R; + for (var q = 0, V = 0; V < x.length; V++) { + var Y = x[V]; + Y.rect.x = m, Y.rect.y = p, m += Y.rect.width + n.horizontalPadding, Y.rect.height > q && (q = Y.rect.height); + } + p += q + n.verticalPadding; + } + }, D.prototype.tileCompoundMembers = function(n, m) { + var p = this; + this.tiledMemberPack = [], Object.keys(n).forEach(function(E) { + var y = m[E]; + if (p.tiledMemberPack[E] = p.tileNodes(n[E], y.paddingLeft + y.paddingRight), y.rect.width = p.tiledMemberPack[E].width, y.rect.height = p.tiledMemberPack[E].height, y.setCenter(p.tiledMemberPack[E].centerX, p.tiledMemberPack[E].centerY), y.labelMarginLeft = 0, y.labelMarginTop = 0, o.NODE_DIMENSIONS_INCLUDE_LABELS) { + var I = y.rect.width, w = y.rect.height; + y.labelWidth && (y.labelPosHorizontal == "left" ? (y.rect.x -= y.labelWidth, y.setWidth(I + y.labelWidth), y.labelMarginLeft = y.labelWidth) : y.labelPosHorizontal == "center" && y.labelWidth > I ? (y.rect.x -= (y.labelWidth - I) / 2, y.setWidth(y.labelWidth), y.labelMarginLeft = (y.labelWidth - I) / 2) : y.labelPosHorizontal == "right" && y.setWidth(I + y.labelWidth)), y.labelHeight && (y.labelPosVertical == "top" ? (y.rect.y -= y.labelHeight, y.setHeight(w + y.labelHeight), y.labelMarginTop = y.labelHeight) : y.labelPosVertical == "center" && y.labelHeight > w ? (y.rect.y -= (y.labelHeight - w) / 2, y.setHeight(y.labelHeight), y.labelMarginTop = (y.labelHeight - w) / 2) : y.labelPosVertical == "bottom" && y.setHeight(w + y.labelHeight)); + } + }); + }, D.prototype.tileNodes = function(n, m) { + var p = this.tileNodesByFavoringDim(n, m, !0), E = this.tileNodesByFavoringDim(n, m, !1), y = this.getOrgRatio(p), I = this.getOrgRatio(E), w; + return I < y ? w = E : w = p, w; + }, D.prototype.getOrgRatio = function(n) { + var m = n.width, p = n.height, E = m / p; + return E < 1 && (E = 1 / E), E; + }, D.prototype.calcIdealRowWidth = function(n, m) { + var p = o.TILING_PADDING_VERTICAL, E = o.TILING_PADDING_HORIZONTAL, y = n.length, I = 0, w = 0, R = 0; + n.forEach(function(z) { + I += z.getWidth(), w += z.getHeight(), z.getWidth() > R && (R = z.getWidth()); + }); + var W = I / y, x = w / y, q = Math.pow(p - E, 2) + 4 * (W + E) * (x + p) * y, V = (E - p + Math.sqrt(q)) / (2 * (W + E)), Y; + m ? (Y = Math.ceil(V), Y == V && Y++) : Y = Math.floor(V); + var et = Y * (W + E) - E; + return R > et && (et = R), et += E * 2, et; + }, D.prototype.tileNodesByFavoringDim = function(n, m, p) { + var E = o.TILING_PADDING_VERTICAL, y = o.TILING_PADDING_HORIZONTAL, I = o.TILING_COMPARE_BY, w = { + rows: [], + rowWidth: [], + rowHeight: [], + width: 0, + height: m, + // assume minHeight equals to minWidth + verticalPadding: E, + horizontalPadding: y, + centerX: 0, + centerY: 0 + }; + I && (w.idealRowWidth = this.calcIdealRowWidth(n, p)); + var R = function(O) { + return O.rect.width * O.rect.height; + }, W = function(O, H) { + return R(H) - R(O); + }; + n.sort(function(z, O) { + var H = W; + return w.idealRowWidth ? (H = I, H(z.id, O.id)) : H(z, O); + }); + for (var x = 0, q = 0, V = 0; V < n.length; V++) { + var Y = n[V]; + x += Y.getCenterX(), q += Y.getCenterY(); + } + w.centerX = x / n.length, w.centerY = q / n.length; + for (var V = 0; V < n.length; V++) { + var Y = n[V]; + if (w.rows.length == 0) + this.insertNodeToRow(w, Y, 0, m); + else if (this.canAddHorizontal(w, Y.rect.width, Y.rect.height)) { + var et = w.rows.length - 1; + w.idealRowWidth || (et = this.getShortestRowIndex(w)), this.insertNodeToRow(w, Y, et, m); + } else + this.insertNodeToRow(w, Y, w.rows.length, m); + this.shiftToLastRow(w); + } + return w; + }, D.prototype.insertNodeToRow = function(n, m, p, E) { + var y = E; + if (p == n.rows.length) { + var I = []; + n.rows.push(I), n.rowWidth.push(y), n.rowHeight.push(0); + } + var w = n.rowWidth[p] + m.rect.width; + n.rows[p].length > 0 && (w += n.horizontalPadding), n.rowWidth[p] = w, n.width < w && (n.width = w); + var R = m.rect.height; + p > 0 && (R += n.verticalPadding); + var W = 0; + R > n.rowHeight[p] && (W = n.rowHeight[p], n.rowHeight[p] = R, W = n.rowHeight[p] - W), n.height += W, n.rows[p].push(m); + }, D.prototype.getShortestRowIndex = function(n) { + for (var m = -1, p = Number.MAX_VALUE, E = 0; E < n.rows.length; E++) + n.rowWidth[E] < p && (m = E, p = n.rowWidth[E]); + return m; + }, D.prototype.getLongestRowIndex = function(n) { + for (var m = -1, p = Number.MIN_VALUE, E = 0; E < n.rows.length; E++) + n.rowWidth[E] > p && (m = E, p = n.rowWidth[E]); + return m; + }, D.prototype.canAddHorizontal = function(n, m, p) { + if (n.idealRowWidth) { + var E = n.rows.length - 1, y = n.rowWidth[E]; + return y + m + n.horizontalPadding <= n.idealRowWidth; + } + var I = this.getShortestRowIndex(n); + if (I < 0) + return !0; + var w = n.rowWidth[I]; + if (w + n.horizontalPadding + m <= n.width) return !0; + var R = 0; + n.rowHeight[I] < p && I > 0 && (R = p + n.verticalPadding - n.rowHeight[I]); + var W; + n.width - w >= m + n.horizontalPadding ? W = (n.height + R) / (w + m + n.horizontalPadding) : W = (n.height + R) / n.width, R = p + n.verticalPadding; + var x; + return n.width < m ? x = (n.height + R) / m : x = (n.height + R) / n.width, x < 1 && (x = 1 / x), W < 1 && (W = 1 / W), W < x; + }, D.prototype.shiftToLastRow = function(n) { + var m = this.getLongestRowIndex(n), p = n.rowWidth.length - 1, E = n.rows[m], y = E[E.length - 1], I = y.width + n.horizontalPadding; + if (n.width - n.rowWidth[p] > I && m != p) { + E.splice(-1, 1), n.rows[p].push(y), n.rowWidth[m] = n.rowWidth[m] - I, n.rowWidth[p] = n.rowWidth[p] + I, n.width = n.rowWidth[instance.getLongestRowIndex(n)]; + for (var w = Number.MIN_VALUE, R = 0; R < E.length; R++) + E[R].height > w && (w = E[R].height); + m > 0 && (w += n.verticalPadding); + var W = n.rowHeight[m] + n.rowHeight[p]; + n.rowHeight[m] = w, n.rowHeight[p] < y.height + n.verticalPadding && (n.rowHeight[p] = y.height + n.verticalPadding); + var x = n.rowHeight[m] + n.rowHeight[p]; + n.height += x - W, this.shiftToLastRow(n); + } + }, D.prototype.tilingPreLayout = function() { + o.TILE && (this.groupZeroDegreeMembers(), this.clearCompounds(), this.clearZeroDegreeMembers()); + }, D.prototype.tilingPostLayout = function() { + o.TILE && (this.repopulateZeroDegreeMembers(), this.repopulateCompounds()); + }, D.prototype.reduceTrees = function() { + for (var n = [], m = !0, p; m; ) { + var E = this.graphManager.getAllNodes(), y = []; + m = !1; + for (var I = 0; I < E.length; I++) + if (p = E[I], p.getEdges().length == 1 && !p.getEdges()[0].isInterGraph && p.getChild() == null) { + if (o.PURE_INCREMENTAL) { + var w = p.getEdges()[0].getOtherEnd(p), R = new N(p.getCenterX() - w.getCenterX(), p.getCenterY() - w.getCenterY()); + y.push([p, p.getEdges()[0], p.getOwner(), R]); + } else + y.push([p, p.getEdges()[0], p.getOwner()]); + m = !0; + } + if (m == !0) { + for (var W = [], x = 0; x < y.length; x++) + y[x][0].getEdges().length == 1 && (W.push(y[x]), y[x][0].getOwner().remove(y[x][0])); + n.push(W), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges(); + } + } + this.prunedNodesAll = n; + }, D.prototype.growTree = function(n) { + for (var m = n.length, p = n[m - 1], E, y = 0; y < p.length; y++) + E = p[y], this.findPlaceforPrunedNode(E), E[2].add(E[0]), E[2].add(E[1], E[1].source, E[1].target); + n.splice(n.length - 1, 1), this.graphManager.resetAllNodes(), this.graphManager.resetAllEdges(); + }, D.prototype.findPlaceforPrunedNode = function(n) { + var m, p, E = n[0]; + if (E == n[1].source ? p = n[1].target : p = n[1].source, o.PURE_INCREMENTAL) + E.setCenter(p.getCenterX() + n[3].getWidth(), p.getCenterY() + n[3].getHeight()); + else { + var y = p.startX, I = p.finishX, w = p.startY, R = p.finishY, W = 0, x = 0, q = 0, V = 0, Y = [W, q, x, V]; + if (w > 0) + for (var et = y; et <= I; et++) + Y[0] += this.grid[et][w - 1].length + this.grid[et][w].length - 1; + if (I < this.grid.length - 1) + for (var et = w; et <= R; et++) + Y[1] += this.grid[I + 1][et].length + this.grid[I][et].length - 1; + if (R < this.grid[0].length - 1) + for (var et = y; et <= I; et++) + Y[2] += this.grid[et][R + 1].length + this.grid[et][R].length - 1; + if (y > 0) + for (var et = w; et <= R; et++) + Y[3] += this.grid[y - 1][et].length + this.grid[y][et].length - 1; + for (var z = M.MAX_VALUE, O, H, B = 0; B < Y.length; B++) + Y[B] < z ? (z = Y[B], O = 1, H = B) : Y[B] == z && O++; + if (O == 3 && z == 0) + Y[0] == 0 && Y[1] == 0 && Y[2] == 0 ? m = 1 : Y[0] == 0 && Y[1] == 0 && Y[3] == 0 ? m = 0 : Y[0] == 0 && Y[2] == 0 && Y[3] == 0 ? m = 3 : Y[1] == 0 && Y[2] == 0 && Y[3] == 0 && (m = 2); + else if (O == 2 && z == 0) { + var _ = Math.floor(Math.random() * 2); + Y[0] == 0 && Y[1] == 0 ? _ == 0 ? m = 0 : m = 1 : Y[0] == 0 && Y[2] == 0 ? _ == 0 ? m = 0 : m = 2 : Y[0] == 0 && Y[3] == 0 ? _ == 0 ? m = 0 : m = 3 : Y[1] == 0 && Y[2] == 0 ? _ == 0 ? m = 1 : m = 2 : Y[1] == 0 && Y[3] == 0 ? _ == 0 ? m = 1 : m = 3 : _ == 0 ? m = 2 : m = 3; + } else if (O == 4 && z == 0) { + var _ = Math.floor(Math.random() * 4); + m = _; + } else + m = H; + m == 0 ? E.setCenter(p.getCenterX(), p.getCenterY() - p.getHeight() / 2 - h.DEFAULT_EDGE_LENGTH - E.getHeight() / 2) : m == 1 ? E.setCenter(p.getCenterX() + p.getWidth() / 2 + h.DEFAULT_EDGE_LENGTH + E.getWidth() / 2, p.getCenterY()) : m == 2 ? E.setCenter(p.getCenterX(), p.getCenterY() + p.getHeight() / 2 + h.DEFAULT_EDGE_LENGTH + E.getHeight() / 2) : E.setCenter(p.getCenterX() - p.getWidth() / 2 - h.DEFAULT_EDGE_LENGTH - E.getWidth() / 2, p.getCenterY()); + } + }, a.exports = D; + } + ), + /***/ + 991: ( + /***/ + (a, r, e) => { + var f = e(551).FDLayoutNode, i = e(551).IMath; + function g(s, o, c, h) { + f.call(this, s, o, c, h); + } + g.prototype = Object.create(f.prototype); + for (var t in f) + g[t] = f[t]; + g.prototype.calculateDisplacement = function() { + var s = this.graphManager.getLayout(); + this.getChild() != null && this.fixedNodeWeight ? (this.displacementX += s.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.fixedNodeWeight, this.displacementY += s.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.fixedNodeWeight) : (this.displacementX += s.coolingFactor * (this.springForceX + this.repulsionForceX + this.gravitationForceX) / this.noOfChildren, this.displacementY += s.coolingFactor * (this.springForceY + this.repulsionForceY + this.gravitationForceY) / this.noOfChildren), Math.abs(this.displacementX) > s.coolingFactor * s.maxNodeDisplacement && (this.displacementX = s.coolingFactor * s.maxNodeDisplacement * i.sign(this.displacementX)), Math.abs(this.displacementY) > s.coolingFactor * s.maxNodeDisplacement && (this.displacementY = s.coolingFactor * s.maxNodeDisplacement * i.sign(this.displacementY)), this.child && this.child.getNodes().length > 0 && this.propogateDisplacementToChildren(this.displacementX, this.displacementY); + }, g.prototype.propogateDisplacementToChildren = function(s, o) { + for (var c = this.getChild().getNodes(), h, T = 0; T < c.length; T++) + h = c[T], h.getChild() == null ? (h.displacementX += s, h.displacementY += o) : h.propogateDisplacementToChildren(s, o); + }, g.prototype.move = function() { + var s = this.graphManager.getLayout(); + (this.child == null || this.child.getNodes().length == 0) && (this.moveBy(this.displacementX, this.displacementY), s.totalDisplacement += Math.abs(this.displacementX) + Math.abs(this.displacementY)), this.springForceX = 0, this.springForceY = 0, this.repulsionForceX = 0, this.repulsionForceY = 0, this.gravitationForceX = 0, this.gravitationForceY = 0, this.displacementX = 0, this.displacementY = 0; + }, g.prototype.setPred1 = function(s) { + this.pred1 = s; + }, g.prototype.getPred1 = function() { + return pred1; + }, g.prototype.getPred2 = function() { + return pred2; + }, g.prototype.setNext = function(s) { + this.next = s; + }, g.prototype.getNext = function() { + return next; + }, g.prototype.setProcessed = function(s) { + this.processed = s; + }, g.prototype.isProcessed = function() { + return processed; + }, a.exports = g; + } + ), + /***/ + 902: ( + /***/ + (a, r, e) => { + function f(c) { + if (Array.isArray(c)) { + for (var h = 0, T = Array(c.length); h < c.length; h++) + T[h] = c[h]; + return T; + } else + return Array.from(c); + } + var i = e(806), g = e(551).LinkedList, t = e(551).Matrix, s = e(551).SVD; + function o() { + } + o.handleConstraints = function(c) { + var h = {}; + h.fixedNodeConstraint = c.constraints.fixedNodeConstraint, h.alignmentConstraint = c.constraints.alignmentConstraint, h.relativePlacementConstraint = c.constraints.relativePlacementConstraint; + for (var T = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map(), d = [], N = [], S = c.getAllNodes(), M = 0, P = 0; P < S.length; P++) { + var K = S[P]; + K.getChild() == null && (v.set(K.id, M++), d.push(K.getCenterX()), N.push(K.getCenterY()), T.set(K.id, K)); + } + h.relativePlacementConstraint && h.relativePlacementConstraint.forEach(function(F) { + !F.gap && F.gap != 0 && (F.left ? F.gap = i.DEFAULT_EDGE_LENGTH + T.get(F.left).getWidth() / 2 + T.get(F.right).getWidth() / 2 : F.gap = i.DEFAULT_EDGE_LENGTH + T.get(F.top).getHeight() / 2 + T.get(F.bottom).getHeight() / 2); + }); + var X = function(b, $) { + return { x: b.x - $.x, y: b.y - $.y }; + }, k = function(b) { + var $ = 0, Q = 0; + return b.forEach(function(Z) { + $ += d[v.get(Z)], Q += N[v.get(Z)]; + }), { x: $ / b.size, y: Q / b.size }; + }, D = function(b, $, Q, Z, at) { + function ut(ft, st) { + var Ct = new Set(ft), ct = !0, ht = !1, Wt = void 0; + try { + for (var Nt = st[Symbol.iterator](), Mt; !(ct = (Mt = Nt.next()).done); ct = !0) { + var Zt = Mt.value; + Ct.add(Zt); + } + } catch (Gt) { + ht = !0, Wt = Gt; + } finally { + try { + !ct && Nt.return && Nt.return(); + } finally { + if (ht) + throw Wt; + } + } + return Ct; + } + var ot = /* @__PURE__ */ new Map(); + b.forEach(function(ft, st) { + ot.set(st, 0); + }), b.forEach(function(ft, st) { + ft.forEach(function(Ct) { + ot.set(Ct.id, ot.get(Ct.id) + 1); + }); + }); + var tt = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map(), dt = new g(); + ot.forEach(function(ft, st) { + ft == 0 ? (dt.push(st), Q || ($ == "horizontal" ? tt.set(st, v.has(st) ? d[v.get(st)] : Z.get(st)) : tt.set(st, v.has(st) ? N[v.get(st)] : Z.get(st)))) : tt.set(st, Number.NEGATIVE_INFINITY), Q && j.set(st, /* @__PURE__ */ new Set([st])); + }), Q && at.forEach(function(ft) { + var st = []; + if (ft.forEach(function(ht) { + Q.has(ht) && st.push(ht); + }), st.length > 0) { + var Ct = 0; + st.forEach(function(ht) { + $ == "horizontal" ? (tt.set(ht, v.has(ht) ? d[v.get(ht)] : Z.get(ht)), Ct += tt.get(ht)) : (tt.set(ht, v.has(ht) ? N[v.get(ht)] : Z.get(ht)), Ct += tt.get(ht)); + }), Ct = Ct / st.length, ft.forEach(function(ht) { + Q.has(ht) || tt.set(ht, Ct); + }); + } else { + var ct = 0; + ft.forEach(function(ht) { + $ == "horizontal" ? ct += v.has(ht) ? d[v.get(ht)] : Z.get(ht) : ct += v.has(ht) ? N[v.get(ht)] : Z.get(ht); + }), ct = ct / ft.length, ft.forEach(function(ht) { + tt.set(ht, ct); + }); + } + }); + for (var wt = function() { + var st = dt.shift(), Ct = b.get(st); + Ct.forEach(function(ct) { + if (tt.get(ct.id) < tt.get(st) + ct.gap) + if (Q && Q.has(ct.id)) { + var ht = void 0; + if ($ == "horizontal" ? ht = v.has(ct.id) ? d[v.get(ct.id)] : Z.get(ct.id) : ht = v.has(ct.id) ? N[v.get(ct.id)] : Z.get(ct.id), tt.set(ct.id, ht), ht < tt.get(st) + ct.gap) { + var Wt = tt.get(st) + ct.gap - ht; + j.get(st).forEach(function(Nt) { + tt.set(Nt, tt.get(Nt) - Wt); + }); + } + } else + tt.set(ct.id, tt.get(st) + ct.gap); + ot.set(ct.id, ot.get(ct.id) - 1), ot.get(ct.id) == 0 && dt.push(ct.id), Q && j.set(ct.id, ut(j.get(st), j.get(ct.id))); + }); + }; dt.length != 0; ) + wt(); + if (Q) { + var yt = /* @__PURE__ */ new Set(); + b.forEach(function(ft, st) { + ft.length == 0 && yt.add(st); + }); + var It = []; + j.forEach(function(ft, st) { + if (yt.has(st)) { + var Ct = !1, ct = !0, ht = !1, Wt = void 0; + try { + for (var Nt = ft[Symbol.iterator](), Mt; !(ct = (Mt = Nt.next()).done); ct = !0) { + var Zt = Mt.value; + Q.has(Zt) && (Ct = !0); + } + } catch (Ft) { + ht = !0, Wt = Ft; + } finally { + try { + !ct && Nt.return && Nt.return(); + } finally { + if (ht) + throw Wt; + } + } + if (!Ct) { + var Gt = !1, $t = void 0; + It.forEach(function(Ft, qt) { + Ft.has([].concat(f(ft))[0]) && (Gt = !0, $t = qt); + }), Gt ? ft.forEach(function(Ft) { + It[$t].add(Ft); + }) : It.push(new Set(ft)); + } + } + }), It.forEach(function(ft, st) { + var Ct = Number.POSITIVE_INFINITY, ct = Number.POSITIVE_INFINITY, ht = Number.NEGATIVE_INFINITY, Wt = Number.NEGATIVE_INFINITY, Nt = !0, Mt = !1, Zt = void 0; + try { + for (var Gt = ft[Symbol.iterator](), $t; !(Nt = ($t = Gt.next()).done); Nt = !0) { + var Ft = $t.value, qt = void 0; + $ == "horizontal" ? qt = v.has(Ft) ? d[v.get(Ft)] : Z.get(Ft) : qt = v.has(Ft) ? N[v.get(Ft)] : Z.get(Ft); + var _t = tt.get(Ft); + qt < Ct && (Ct = qt), qt > ht && (ht = qt), _t < ct && (ct = _t), _t > Wt && (Wt = _t); + } + } catch (ie) { + Mt = !0, Zt = ie; + } finally { + try { + !Nt && Gt.return && Gt.return(); + } finally { + if (Mt) + throw Zt; + } + } + var ce = (Ct + ht) / 2 - (ct + Wt) / 2, Kt = !0, te = !1, ee = void 0; + try { + for (var jt = ft[Symbol.iterator](), se; !(Kt = (se = jt.next()).done); Kt = !0) { + var re = se.value; + tt.set(re, tt.get(re) + ce); + } + } catch (ie) { + te = !0, ee = ie; + } finally { + try { + !Kt && jt.return && jt.return(); + } finally { + if (te) + throw ee; + } + } + }); + } + return tt; + }, rt = function(b) { + var $ = 0, Q = 0, Z = 0, at = 0; + if (b.forEach(function(j) { + j.left ? d[v.get(j.left)] - d[v.get(j.right)] >= 0 ? $++ : Q++ : N[v.get(j.top)] - N[v.get(j.bottom)] >= 0 ? Z++ : at++; + }), $ > Q && Z > at) + for (var ut = 0; ut < v.size; ut++) + d[ut] = -1 * d[ut], N[ut] = -1 * N[ut]; + else if ($ > Q) + for (var ot = 0; ot < v.size; ot++) + d[ot] = -1 * d[ot]; + else if (Z > at) + for (var tt = 0; tt < v.size; tt++) + N[tt] = -1 * N[tt]; + }, n = function(b) { + var $ = [], Q = new g(), Z = /* @__PURE__ */ new Set(), at = 0; + return b.forEach(function(ut, ot) { + if (!Z.has(ot)) { + $[at] = []; + var tt = ot; + for (Q.push(tt), Z.add(tt), $[at].push(tt); Q.length != 0; ) { + tt = Q.shift(); + var j = b.get(tt); + j.forEach(function(dt) { + Z.has(dt.id) || (Q.push(dt.id), Z.add(dt.id), $[at].push(dt.id)); + }); + } + at++; + } + }), $; + }, m = function(b) { + var $ = /* @__PURE__ */ new Map(); + return b.forEach(function(Q, Z) { + $.set(Z, []); + }), b.forEach(function(Q, Z) { + Q.forEach(function(at) { + $.get(Z).push(at), $.get(at.id).push({ id: Z, gap: at.gap, direction: at.direction }); + }); + }), $; + }, p = function(b) { + var $ = /* @__PURE__ */ new Map(); + return b.forEach(function(Q, Z) { + $.set(Z, []); + }), b.forEach(function(Q, Z) { + Q.forEach(function(at) { + $.get(at.id).push({ id: Z, gap: at.gap, direction: at.direction }); + }); + }), $; + }, E = [], y = [], I = !1, w = !1, R = /* @__PURE__ */ new Set(), W = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map(), q = []; + if (h.fixedNodeConstraint && h.fixedNodeConstraint.forEach(function(F) { + R.add(F.nodeId); + }), h.relativePlacementConstraint && (h.relativePlacementConstraint.forEach(function(F) { + F.left ? (W.has(F.left) ? W.get(F.left).push({ id: F.right, gap: F.gap, direction: "horizontal" }) : W.set(F.left, [{ id: F.right, gap: F.gap, direction: "horizontal" }]), W.has(F.right) || W.set(F.right, [])) : (W.has(F.top) ? W.get(F.top).push({ id: F.bottom, gap: F.gap, direction: "vertical" }) : W.set(F.top, [{ id: F.bottom, gap: F.gap, direction: "vertical" }]), W.has(F.bottom) || W.set(F.bottom, [])); + }), x = m(W), q = n(x)), i.TRANSFORM_ON_CONSTRAINT_HANDLING) { + if (h.fixedNodeConstraint && h.fixedNodeConstraint.length > 1) + h.fixedNodeConstraint.forEach(function(F, b) { + E[b] = [F.position.x, F.position.y], y[b] = [d[v.get(F.nodeId)], N[v.get(F.nodeId)]]; + }), I = !0; + else if (h.alignmentConstraint) + (function() { + var F = 0; + if (h.alignmentConstraint.vertical) { + for (var b = h.alignmentConstraint.vertical, $ = function(tt) { + var j = /* @__PURE__ */ new Set(); + b[tt].forEach(function(yt) { + j.add(yt); + }); + var dt = new Set([].concat(f(j)).filter(function(yt) { + return R.has(yt); + })), wt = void 0; + dt.size > 0 ? wt = d[v.get(dt.values().next().value)] : wt = k(j).x, b[tt].forEach(function(yt) { + E[F] = [wt, N[v.get(yt)]], y[F] = [d[v.get(yt)], N[v.get(yt)]], F++; + }); + }, Q = 0; Q < b.length; Q++) + $(Q); + I = !0; + } + if (h.alignmentConstraint.horizontal) { + for (var Z = h.alignmentConstraint.horizontal, at = function(tt) { + var j = /* @__PURE__ */ new Set(); + Z[tt].forEach(function(yt) { + j.add(yt); + }); + var dt = new Set([].concat(f(j)).filter(function(yt) { + return R.has(yt); + })), wt = void 0; + dt.size > 0 ? wt = d[v.get(dt.values().next().value)] : wt = k(j).y, Z[tt].forEach(function(yt) { + E[F] = [d[v.get(yt)], wt], y[F] = [d[v.get(yt)], N[v.get(yt)]], F++; + }); + }, ut = 0; ut < Z.length; ut++) + at(ut); + I = !0; + } + h.relativePlacementConstraint && (w = !0); + })(); + else if (h.relativePlacementConstraint) { + for (var V = 0, Y = 0, et = 0; et < q.length; et++) + q[et].length > V && (V = q[et].length, Y = et); + if (V < x.size / 2) + rt(h.relativePlacementConstraint), I = !1, w = !1; + else { + var z = /* @__PURE__ */ new Map(), O = /* @__PURE__ */ new Map(), H = []; + q[Y].forEach(function(F) { + W.get(F).forEach(function(b) { + b.direction == "horizontal" ? (z.has(F) ? z.get(F).push(b) : z.set(F, [b]), z.has(b.id) || z.set(b.id, []), H.push({ left: F, right: b.id })) : (O.has(F) ? O.get(F).push(b) : O.set(F, [b]), O.has(b.id) || O.set(b.id, []), H.push({ top: F, bottom: b.id })); + }); + }), rt(H), w = !1; + var B = D(z, "horizontal"), _ = D(O, "vertical"); + q[Y].forEach(function(F, b) { + y[b] = [d[v.get(F)], N[v.get(F)]], E[b] = [], B.has(F) ? E[b][0] = B.get(F) : E[b][0] = d[v.get(F)], _.has(F) ? E[b][1] = _.get(F) : E[b][1] = N[v.get(F)]; + }), I = !0; + } + } + if (I) { + for (var lt = void 0, J = t.transpose(E), Rt = t.transpose(y), Lt = 0; Lt < J.length; Lt++) + J[Lt] = t.multGamma(J[Lt]), Rt[Lt] = t.multGamma(Rt[Lt]); + var vt = t.multMat(J, t.transpose(Rt)), it = s.svd(vt); + lt = t.multMat(it.V, t.transpose(it.U)); + for (var gt = 0; gt < v.size; gt++) { + var Tt = [d[gt], N[gt]], At = [lt[0][0], lt[1][0]], Dt = [lt[0][1], lt[1][1]]; + d[gt] = t.dotProduct(Tt, At), N[gt] = t.dotProduct(Tt, Dt); + } + w && rt(h.relativePlacementConstraint); + } + } + if (i.ENFORCE_CONSTRAINTS) { + if (h.fixedNodeConstraint && h.fixedNodeConstraint.length > 0) { + var mt = { x: 0, y: 0 }; + h.fixedNodeConstraint.forEach(function(F, b) { + var $ = { x: d[v.get(F.nodeId)], y: N[v.get(F.nodeId)] }, Q = F.position, Z = X(Q, $); + mt.x += Z.x, mt.y += Z.y; + }), mt.x /= h.fixedNodeConstraint.length, mt.y /= h.fixedNodeConstraint.length, d.forEach(function(F, b) { + d[b] += mt.x; + }), N.forEach(function(F, b) { + N[b] += mt.y; + }), h.fixedNodeConstraint.forEach(function(F) { + d[v.get(F.nodeId)] = F.position.x, N[v.get(F.nodeId)] = F.position.y; + }); + } + if (h.alignmentConstraint) { + if (h.alignmentConstraint.vertical) + for (var xt = h.alignmentConstraint.vertical, St = function(b) { + var $ = /* @__PURE__ */ new Set(); + xt[b].forEach(function(at) { + $.add(at); + }); + var Q = new Set([].concat(f($)).filter(function(at) { + return R.has(at); + })), Z = void 0; + Q.size > 0 ? Z = d[v.get(Q.values().next().value)] : Z = k($).x, $.forEach(function(at) { + R.has(at) || (d[v.get(at)] = Z); + }); + }, Vt = 0; Vt < xt.length; Vt++) + St(Vt); + if (h.alignmentConstraint.horizontal) + for (var Xt = h.alignmentConstraint.horizontal, Ut = function(b) { + var $ = /* @__PURE__ */ new Set(); + Xt[b].forEach(function(at) { + $.add(at); + }); + var Q = new Set([].concat(f($)).filter(function(at) { + return R.has(at); + })), Z = void 0; + Q.size > 0 ? Z = N[v.get(Q.values().next().value)] : Z = k($).y, $.forEach(function(at) { + R.has(at) || (N[v.get(at)] = Z); + }); + }, bt = 0; bt < Xt.length; bt++) + Ut(bt); + } + h.relativePlacementConstraint && function() { + var F = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map(), Q = /* @__PURE__ */ new Map(), Z = /* @__PURE__ */ new Map(), at = /* @__PURE__ */ new Map(), ut = /* @__PURE__ */ new Set(), ot = /* @__PURE__ */ new Set(); + if (R.forEach(function(Yt) { + ut.add(Yt), ot.add(Yt); + }), h.alignmentConstraint) { + if (h.alignmentConstraint.vertical) + for (var tt = h.alignmentConstraint.vertical, j = function(Et) { + $.set("dummy" + Et, []), tt[Et].forEach(function(Ot) { + F.set(Ot, "dummy" + Et), $.get("dummy" + Et).push(Ot), R.has(Ot) && ut.add("dummy" + Et); + }), Z.set("dummy" + Et, d[v.get(tt[Et][0])]); + }, dt = 0; dt < tt.length; dt++) + j(dt); + if (h.alignmentConstraint.horizontal) + for (var wt = h.alignmentConstraint.horizontal, yt = function(Et) { + Q.set("dummy" + Et, []), wt[Et].forEach(function(Ot) { + b.set(Ot, "dummy" + Et), Q.get("dummy" + Et).push(Ot), R.has(Ot) && ot.add("dummy" + Et); + }), at.set("dummy" + Et, N[v.get(wt[Et][0])]); + }, It = 0; It < wt.length; It++) + yt(It); + } + var ft = /* @__PURE__ */ new Map(), st = /* @__PURE__ */ new Map(), Ct = function(Et) { + W.get(Et).forEach(function(Ot) { + var Jt = void 0, kt = void 0; + Ot.direction == "horizontal" ? (Jt = F.get(Et) ? F.get(Et) : Et, F.get(Ot.id) ? kt = { id: F.get(Ot.id), gap: Ot.gap, direction: Ot.direction } : kt = Ot, ft.has(Jt) ? ft.get(Jt).push(kt) : ft.set(Jt, [kt]), ft.has(kt.id) || ft.set(kt.id, [])) : (Jt = b.get(Et) ? b.get(Et) : Et, b.get(Ot.id) ? kt = { id: b.get(Ot.id), gap: Ot.gap, direction: Ot.direction } : kt = Ot, st.has(Jt) ? st.get(Jt).push(kt) : st.set(Jt, [kt]), st.has(kt.id) || st.set(kt.id, [])); + }); + }, ct = !0, ht = !1, Wt = void 0; + try { + for (var Nt = W.keys()[Symbol.iterator](), Mt; !(ct = (Mt = Nt.next()).done); ct = !0) { + var Zt = Mt.value; + Ct(Zt); + } + } catch (Yt) { + ht = !0, Wt = Yt; + } finally { + try { + !ct && Nt.return && Nt.return(); + } finally { + if (ht) + throw Wt; + } + } + var Gt = m(ft), $t = m(st), Ft = n(Gt), qt = n($t), _t = p(ft), ce = p(st), Kt = [], te = []; + Ft.forEach(function(Yt, Et) { + Kt[Et] = [], Yt.forEach(function(Ot) { + _t.get(Ot).length == 0 && Kt[Et].push(Ot); + }); + }), qt.forEach(function(Yt, Et) { + te[Et] = [], Yt.forEach(function(Ot) { + ce.get(Ot).length == 0 && te[Et].push(Ot); + }); + }); + var ee = D(ft, "horizontal", ut, Z, Kt), jt = D(st, "vertical", ot, at, te), se = function(Et) { + $.get(Et) ? $.get(Et).forEach(function(Ot) { + d[v.get(Ot)] = ee.get(Et); + }) : d[v.get(Et)] = ee.get(Et); + }, re = !0, ie = !1, Me = void 0; + try { + for (var ue = ee.keys()[Symbol.iterator](), Ae; !(re = (Ae = ue.next()).done); re = !0) { + var ge = Ae.value; + se(ge); + } + } catch (Yt) { + ie = !0, Me = Yt; + } finally { + try { + !re && ue.return && ue.return(); + } finally { + if (ie) + throw Me; + } + } + var ke = function(Et) { + Q.get(Et) ? Q.get(Et).forEach(function(Ot) { + N[v.get(Ot)] = jt.get(Et); + }) : N[v.get(Et)] = jt.get(Et); + }, de = !0, we = !1, Oe = void 0; + try { + for (var ve = jt.keys()[Symbol.iterator](), De; !(de = (De = ve.next()).done); de = !0) { + var ge = De.value; + ke(ge); + } + } catch (Yt) { + we = !0, Oe = Yt; + } finally { + try { + !de && ve.return && ve.return(); + } finally { + if (we) + throw Oe; + } + } + }(); + } + for (var Ht = 0; Ht < S.length; Ht++) { + var Bt = S[Ht]; + Bt.getChild() == null && Bt.setCenter(d[v.get(Bt.id)], N[v.get(Bt.id)]); + } + }, a.exports = o; + } + ), + /***/ + 551: ( + /***/ + (a) => { + a.exports = A; + } + ) + /******/ + }, L = {}; + function u(a) { + var r = L[a]; + if (r !== void 0) + return r.exports; + var e = L[a] = { + /******/ + // no module.id needed + /******/ + // no module.loaded needed + /******/ + exports: {} + /******/ + }; + return G[a](e, e.exports, u), e.exports; + } + var l = u(45); + return l; + })() + ); + }); + }(pe)), pe.exports; +} +(function(C, U) { + (function(G, L) { + C.exports = L(ur()); + })(Le, function(A) { + return ( + /******/ + (() => { + var G = { + /***/ + 658: ( + /***/ + (a) => { + a.exports = Object.assign != null ? Object.assign.bind(Object) : function(r) { + for (var e = arguments.length, f = Array(e > 1 ? e - 1 : 0), i = 1; i < e; i++) + f[i - 1] = arguments[i]; + return f.forEach(function(g) { + Object.keys(g).forEach(function(t) { + return r[t] = g[t]; + }); + }), r; + }; + } + ), + /***/ + 548: ( + /***/ + (a, r, e) => { + var f = /* @__PURE__ */ function() { + function t(s, o) { + var c = [], h = !0, T = !1, v = void 0; + try { + for (var d = s[Symbol.iterator](), N; !(h = (N = d.next()).done) && (c.push(N.value), !(o && c.length === o)); h = !0) + ; + } catch (S) { + T = !0, v = S; + } finally { + try { + !h && d.return && d.return(); + } finally { + if (T) throw v; + } + } + return c; + } + return function(s, o) { + if (Array.isArray(s)) + return s; + if (Symbol.iterator in Object(s)) + return t(s, o); + throw new TypeError("Invalid attempt to destructure non-iterable instance"); + }; + }(), i = e(140).layoutBase.LinkedList, g = {}; + g.getTopMostNodes = function(t) { + for (var s = {}, o = 0; o < t.length; o++) + s[t[o].id()] = !0; + var c = t.filter(function(h, T) { + typeof h == "number" && (h = T); + for (var v = h.parent()[0]; v != null; ) { + if (s[v.id()]) + return !1; + v = v.parent()[0]; + } + return !0; + }); + return c; + }, g.connectComponents = function(t, s, o, c) { + var h = new i(), T = /* @__PURE__ */ new Set(), v = [], d = void 0, N = void 0, S = void 0, M = !1, P = 1, K = [], X = [], k = function() { + var rt = t.collection(); + X.push(rt); + var n = o[0], m = t.collection(); + m.merge(n).merge(n.descendants().intersection(s)), v.push(n), m.forEach(function(y) { + h.push(y), T.add(y), rt.merge(y); + }); + for (var p = function() { + n = h.shift(); + var I = t.collection(); + n.neighborhood().nodes().forEach(function(x) { + s.intersection(n.edgesWith(x)).length > 0 && I.merge(x); + }); + for (var w = 0; w < I.length; w++) { + var R = I[w]; + if (d = o.intersection(R.union(R.ancestors())), d != null && !T.has(d[0])) { + var W = d.union(d.descendants()); + W.forEach(function(x) { + h.push(x), T.add(x), rt.merge(x), o.has(x) && v.push(x); + }); + } + } + }; h.length != 0; ) + p(); + if (rt.forEach(function(y) { + s.intersection(y.connectedEdges()).forEach(function(I) { + rt.has(I.source()) && rt.has(I.target()) && rt.merge(I); + }); + }), v.length == o.length && (M = !0), !M || M && P > 1) { + N = v[0], S = N.connectedEdges().length, v.forEach(function(y) { + y.connectedEdges().length < S && (S = y.connectedEdges().length, N = y); + }), K.push(N.id()); + var E = t.collection(); + E.merge(v[0]), v.forEach(function(y) { + E.merge(y); + }), v = [], o = o.difference(E), P++; + } + }; + do + k(); + while (!M); + return c && K.length > 0 && c.set("dummy" + (c.size + 1), K), X; + }, g.relocateComponent = function(t, s, o) { + if (!o.fixedNodeConstraint) { + var c = Number.POSITIVE_INFINITY, h = Number.NEGATIVE_INFINITY, T = Number.POSITIVE_INFINITY, v = Number.NEGATIVE_INFINITY; + if (o.quality == "draft") { + var d = !0, N = !1, S = void 0; + try { + for (var M = s.nodeIndexes[Symbol.iterator](), P; !(d = (P = M.next()).done); d = !0) { + var K = P.value, X = f(K, 2), k = X[0], D = X[1], rt = o.cy.getElementById(k); + if (rt) { + var n = rt.boundingBox(), m = s.xCoords[D] - n.w / 2, p = s.xCoords[D] + n.w / 2, E = s.yCoords[D] - n.h / 2, y = s.yCoords[D] + n.h / 2; + m < c && (c = m), p > h && (h = p), E < T && (T = E), y > v && (v = y); + } + } + } catch (x) { + N = !0, S = x; + } finally { + try { + !d && M.return && M.return(); + } finally { + if (N) + throw S; + } + } + var I = t.x - (h + c) / 2, w = t.y - (v + T) / 2; + s.xCoords = s.xCoords.map(function(x) { + return x + I; + }), s.yCoords = s.yCoords.map(function(x) { + return x + w; + }); + } else { + Object.keys(s).forEach(function(x) { + var q = s[x], V = q.getRect().x, Y = q.getRect().x + q.getRect().width, et = q.getRect().y, z = q.getRect().y + q.getRect().height; + V < c && (c = V), Y > h && (h = Y), et < T && (T = et), z > v && (v = z); + }); + var R = t.x - (h + c) / 2, W = t.y - (v + T) / 2; + Object.keys(s).forEach(function(x) { + var q = s[x]; + q.setCenter(q.getCenterX() + R, q.getCenterY() + W); + }); + } + } + }, g.calcBoundingBox = function(t, s, o, c) { + for (var h = Number.MAX_SAFE_INTEGER, T = Number.MIN_SAFE_INTEGER, v = Number.MAX_SAFE_INTEGER, d = Number.MIN_SAFE_INTEGER, N = void 0, S = void 0, M = void 0, P = void 0, K = t.descendants().not(":parent"), X = K.length, k = 0; k < X; k++) { + var D = K[k]; + N = s[c.get(D.id())] - D.width() / 2, S = s[c.get(D.id())] + D.width() / 2, M = o[c.get(D.id())] - D.height() / 2, P = o[c.get(D.id())] + D.height() / 2, h > N && (h = N), T < S && (T = S), v > M && (v = M), d < P && (d = P); + } + var rt = {}; + return rt.topLeftX = h, rt.topLeftY = v, rt.width = T - h, rt.height = d - v, rt; + }, g.calcParentsWithoutChildren = function(t, s) { + var o = t.collection(); + return s.nodes(":parent").forEach(function(c) { + var h = !1; + c.children().forEach(function(T) { + T.css("display") != "none" && (h = !0); + }), h || o.merge(c); + }), o; + }, a.exports = g; + } + ), + /***/ + 816: ( + /***/ + (a, r, e) => { + var f = e(548), i = e(140).CoSELayout, g = e(140).CoSENode, t = e(140).layoutBase.PointD, s = e(140).layoutBase.DimensionD, o = e(140).layoutBase.LayoutConstants, c = e(140).layoutBase.FDLayoutConstants, h = e(140).CoSEConstants, T = function(d, N) { + var S = d.cy, M = d.eles, P = M.nodes(), K = M.edges(), X = void 0, k = void 0, D = void 0, rt = {}; + d.randomize && (X = N.nodeIndexes, k = N.xCoords, D = N.yCoords); + var n = function(x) { + return typeof x == "function"; + }, m = function(x, q) { + return n(x) ? x(q) : x; + }, p = f.calcParentsWithoutChildren(S, M), E = function W(x, q, V, Y) { + for (var et = q.length, z = 0; z < et; z++) { + var O = q[z], H = null; + O.intersection(p).length == 0 && (H = O.children()); + var B = void 0, _ = O.layoutDimensions({ + nodeDimensionsIncludeLabels: Y.nodeDimensionsIncludeLabels + }); + if (O.outerWidth() != null && O.outerHeight() != null) + if (Y.randomize) + if (!O.isParent()) + B = x.add(new g(V.graphManager, new t(k[X.get(O.id())] - _.w / 2, D[X.get(O.id())] - _.h / 2), new s(parseFloat(_.w), parseFloat(_.h)))); + else { + var lt = f.calcBoundingBox(O, k, D, X); + O.intersection(p).length == 0 ? B = x.add(new g(V.graphManager, new t(lt.topLeftX, lt.topLeftY), new s(lt.width, lt.height))) : B = x.add(new g(V.graphManager, new t(lt.topLeftX, lt.topLeftY), new s(parseFloat(_.w), parseFloat(_.h)))); + } + else + B = x.add(new g(V.graphManager, new t(O.position("x") - _.w / 2, O.position("y") - _.h / 2), new s(parseFloat(_.w), parseFloat(_.h)))); + else + B = x.add(new g(this.graphManager)); + if (B.id = O.data("id"), B.nodeRepulsion = m(Y.nodeRepulsion, O), B.paddingLeft = parseInt(O.css("padding")), B.paddingTop = parseInt(O.css("padding")), B.paddingRight = parseInt(O.css("padding")), B.paddingBottom = parseInt(O.css("padding")), Y.nodeDimensionsIncludeLabels && (B.labelWidth = O.boundingBox({ includeLabels: !0, includeNodes: !1, includeOverlays: !1 }).w, B.labelHeight = O.boundingBox({ includeLabels: !0, includeNodes: !1, includeOverlays: !1 }).h, B.labelPosVertical = O.css("text-valign"), B.labelPosHorizontal = O.css("text-halign")), rt[O.data("id")] = B, isNaN(B.rect.x) && (B.rect.x = 0), isNaN(B.rect.y) && (B.rect.y = 0), H != null && H.length > 0) { + var J = void 0; + J = V.getGraphManager().add(V.newGraph(), B), W(J, H, V, Y); + } + } + }, y = function(x, q, V) { + for (var Y = 0, et = 0, z = 0; z < V.length; z++) { + var O = V[z], H = rt[O.data("source")], B = rt[O.data("target")]; + if (H && B && H !== B && H.getEdgesBetween(B).length == 0) { + var _ = q.add(x.newEdge(), H, B); + _.id = O.id(), _.idealLength = m(d.idealEdgeLength, O), _.edgeElasticity = m(d.edgeElasticity, O), Y += _.idealLength, et++; + } + } + d.idealEdgeLength != null && (et > 0 ? h.DEFAULT_EDGE_LENGTH = c.DEFAULT_EDGE_LENGTH = Y / et : n(d.idealEdgeLength) ? h.DEFAULT_EDGE_LENGTH = c.DEFAULT_EDGE_LENGTH = 50 : h.DEFAULT_EDGE_LENGTH = c.DEFAULT_EDGE_LENGTH = d.idealEdgeLength, h.MIN_REPULSION_DIST = c.MIN_REPULSION_DIST = c.DEFAULT_EDGE_LENGTH / 10, h.DEFAULT_RADIAL_SEPARATION = c.DEFAULT_EDGE_LENGTH); + }, I = function(x, q) { + q.fixedNodeConstraint && (x.constraints.fixedNodeConstraint = q.fixedNodeConstraint), q.alignmentConstraint && (x.constraints.alignmentConstraint = q.alignmentConstraint), q.relativePlacementConstraint && (x.constraints.relativePlacementConstraint = q.relativePlacementConstraint); + }; + d.nestingFactor != null && (h.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = c.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR = d.nestingFactor), d.gravity != null && (h.DEFAULT_GRAVITY_STRENGTH = c.DEFAULT_GRAVITY_STRENGTH = d.gravity), d.numIter != null && (h.MAX_ITERATIONS = c.MAX_ITERATIONS = d.numIter), d.gravityRange != null && (h.DEFAULT_GRAVITY_RANGE_FACTOR = c.DEFAULT_GRAVITY_RANGE_FACTOR = d.gravityRange), d.gravityCompound != null && (h.DEFAULT_COMPOUND_GRAVITY_STRENGTH = c.DEFAULT_COMPOUND_GRAVITY_STRENGTH = d.gravityCompound), d.gravityRangeCompound != null && (h.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = c.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR = d.gravityRangeCompound), d.initialEnergyOnIncremental != null && (h.DEFAULT_COOLING_FACTOR_INCREMENTAL = c.DEFAULT_COOLING_FACTOR_INCREMENTAL = d.initialEnergyOnIncremental), d.tilingCompareBy != null && (h.TILING_COMPARE_BY = d.tilingCompareBy), d.quality == "proof" ? o.QUALITY = 2 : o.QUALITY = 0, h.NODE_DIMENSIONS_INCLUDE_LABELS = c.NODE_DIMENSIONS_INCLUDE_LABELS = o.NODE_DIMENSIONS_INCLUDE_LABELS = d.nodeDimensionsIncludeLabels, h.DEFAULT_INCREMENTAL = c.DEFAULT_INCREMENTAL = o.DEFAULT_INCREMENTAL = !d.randomize, h.ANIMATE = c.ANIMATE = o.ANIMATE = d.animate, h.TILE = d.tile, h.TILING_PADDING_VERTICAL = typeof d.tilingPaddingVertical == "function" ? d.tilingPaddingVertical.call() : d.tilingPaddingVertical, h.TILING_PADDING_HORIZONTAL = typeof d.tilingPaddingHorizontal == "function" ? d.tilingPaddingHorizontal.call() : d.tilingPaddingHorizontal, h.DEFAULT_INCREMENTAL = c.DEFAULT_INCREMENTAL = o.DEFAULT_INCREMENTAL = !0, h.PURE_INCREMENTAL = !d.randomize, o.DEFAULT_UNIFORM_LEAF_NODE_SIZES = d.uniformNodeDimensions, d.step == "transformed" && (h.TRANSFORM_ON_CONSTRAINT_HANDLING = !0, h.ENFORCE_CONSTRAINTS = !1, h.APPLY_LAYOUT = !1), d.step == "enforced" && (h.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, h.ENFORCE_CONSTRAINTS = !0, h.APPLY_LAYOUT = !1), d.step == "cose" && (h.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, h.ENFORCE_CONSTRAINTS = !1, h.APPLY_LAYOUT = !0), d.step == "all" && (d.randomize ? h.TRANSFORM_ON_CONSTRAINT_HANDLING = !0 : h.TRANSFORM_ON_CONSTRAINT_HANDLING = !1, h.ENFORCE_CONSTRAINTS = !0, h.APPLY_LAYOUT = !0), d.fixedNodeConstraint || d.alignmentConstraint || d.relativePlacementConstraint ? h.TREE_REDUCTION_ON_INCREMENTAL = !1 : h.TREE_REDUCTION_ON_INCREMENTAL = !0; + var w = new i(), R = w.newGraphManager(); + return E(R.addRoot(), f.getTopMostNodes(P), w, d), y(w, R, K), I(w, d), w.runLayout(), rt; + }; + a.exports = { coseLayout: T }; + } + ), + /***/ + 212: ( + /***/ + (a, r, e) => { + var f = /* @__PURE__ */ function() { + function d(N, S) { + for (var M = 0; M < S.length; M++) { + var P = S[M]; + P.enumerable = P.enumerable || !1, P.configurable = !0, "value" in P && (P.writable = !0), Object.defineProperty(N, P.key, P); + } + } + return function(N, S, M) { + return S && d(N.prototype, S), M && d(N, M), N; + }; + }(); + function i(d, N) { + if (!(d instanceof N)) + throw new TypeError("Cannot call a class as a function"); + } + var g = e(658), t = e(548), s = e(657), o = s.spectralLayout, c = e(816), h = c.coseLayout, T = Object.freeze({ + // 'draft', 'default' or 'proof' + // - 'draft' only applies spectral layout + // - 'default' improves the quality with subsequent CoSE layout (fast cooling rate) + // - 'proof' improves the quality with subsequent CoSE layout (slow cooling rate) + quality: "default", + // Use random node positions at beginning of layout + // if this is set to false, then quality option must be "proof" + randomize: !0, + // Whether or not to animate the layout + animate: !0, + // Duration of animation in ms, if enabled + animationDuration: 1e3, + // Easing of animation, if enabled + animationEasing: void 0, + // Fit the viewport to the repositioned nodes + fit: !0, + // Padding around layout + padding: 30, + // Whether to include labels in node dimensions. Valid in "proof" quality + nodeDimensionsIncludeLabels: !1, + // Whether or not simple nodes (non-compound nodes) are of uniform dimensions + uniformNodeDimensions: !1, + // Whether to pack disconnected components - valid only if randomize: true + packComponents: !0, + // Layout step - all, transformed, enforced, cose - for debug purpose only + step: "all", + /* spectral layout options */ + // False for random, true for greedy + samplingType: !0, + // Sample size to construct distance matrix + sampleSize: 25, + // Separation amount between nodes + nodeSeparation: 75, + // Power iteration tolerance + piTol: 1e-7, + /* CoSE layout options */ + // Node repulsion (non overlapping) multiplier + nodeRepulsion: function(N) { + return 4500; + }, + // Ideal edge (non nested) length + idealEdgeLength: function(N) { + return 50; + }, + // Divisor to compute edge forces + edgeElasticity: function(N) { + return 0.45; + }, + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 0.1, + // Gravity force (constant) + gravity: 0.25, + // Maximum number of iterations to perform + numIter: 2500, + // For enabling tiling + tile: !0, + // The function that specifies the criteria for comparing nodes while sorting them during tiling operation. + // Takes the node id as a parameter and the default tiling operation is perfomed when this option is not set. + tilingCompareBy: void 0, + // Represents the amount of the vertical space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingVertical: 10, + // Represents the amount of the horizontal space to put between the zero degree members during the tiling operation(can also be a function) + tilingPaddingHorizontal: 10, + // Gravity range (constant) for compounds + gravityRangeCompound: 1.5, + // Gravity force (constant) for compounds + gravityCompound: 1, + // Gravity range (constant) + gravityRange: 3.8, + // Initial cooling factor for incremental layout + initialEnergyOnIncremental: 0.3, + /* constraint options */ + // Fix required nodes to predefined positions + // [{nodeId: 'n1', position: {x: 100, y: 200}, {...}] + fixedNodeConstraint: void 0, + // Align required nodes in vertical/horizontal direction + // {vertical: [['n1', 'n2')], ['n3', 'n4']], horizontal: ['n2', 'n4']} + alignmentConstraint: void 0, + // Place two nodes relatively in vertical/horizontal direction + // [{top: 'n1', bottom: 'n2', gap: 100}, {left: 'n3', right: 'n4', gap: 75}] + relativePlacementConstraint: void 0, + /* layout event callbacks */ + ready: function() { + }, + // on layoutready + stop: function() { + } + // on layoutstop + }), v = function() { + function d(N) { + i(this, d), this.options = g({}, T, N); + } + return f(d, [{ + key: "run", + value: function() { + var S = this, M = this.options, P = M.cy, K = M.eles, X = [], k = [], D = void 0, rt = []; + M.fixedNodeConstraint && (!Array.isArray(M.fixedNodeConstraint) || M.fixedNodeConstraint.length == 0) && (M.fixedNodeConstraint = void 0), M.alignmentConstraint && (M.alignmentConstraint.vertical && (!Array.isArray(M.alignmentConstraint.vertical) || M.alignmentConstraint.vertical.length == 0) && (M.alignmentConstraint.vertical = void 0), M.alignmentConstraint.horizontal && (!Array.isArray(M.alignmentConstraint.horizontal) || M.alignmentConstraint.horizontal.length == 0) && (M.alignmentConstraint.horizontal = void 0)), M.relativePlacementConstraint && (!Array.isArray(M.relativePlacementConstraint) || M.relativePlacementConstraint.length == 0) && (M.relativePlacementConstraint = void 0); + var n = M.fixedNodeConstraint || M.alignmentConstraint || M.relativePlacementConstraint; + n && (M.tile = !1, M.packComponents = !1); + var m = void 0, p = !1; + if (P.layoutUtilities && M.packComponents && (m = P.layoutUtilities("get"), m || (m = P.layoutUtilities()), p = !0), K.nodes().length > 0) + if (p) { + var I = t.getTopMostNodes(M.eles.nodes()); + if (D = t.connectComponents(P, M.eles, I), D.forEach(function(vt) { + var it = vt.boundingBox(); + rt.push({ x: it.x1 + it.w / 2, y: it.y1 + it.h / 2 }); + }), M.randomize && D.forEach(function(vt) { + M.eles = vt, X.push(o(M)); + }), M.quality == "default" || M.quality == "proof") { + var w = P.collection(); + if (M.tile) { + var R = /* @__PURE__ */ new Map(), W = [], x = [], q = 0, V = { nodeIndexes: R, xCoords: W, yCoords: x }, Y = []; + if (D.forEach(function(vt, it) { + vt.edges().length == 0 && (vt.nodes().forEach(function(gt, Tt) { + w.merge(vt.nodes()[Tt]), gt.isParent() || (V.nodeIndexes.set(vt.nodes()[Tt].id(), q++), V.xCoords.push(vt.nodes()[0].position().x), V.yCoords.push(vt.nodes()[0].position().y)); + }), Y.push(it)); + }), w.length > 1) { + var et = w.boundingBox(); + rt.push({ x: et.x1 + et.w / 2, y: et.y1 + et.h / 2 }), D.push(w), X.push(V); + for (var z = Y.length - 1; z >= 0; z--) + D.splice(Y[z], 1), X.splice(Y[z], 1), rt.splice(Y[z], 1); + } + } + D.forEach(function(vt, it) { + M.eles = vt, k.push(h(M, X[it])), t.relocateComponent(rt[it], k[it], M); + }); + } else + D.forEach(function(vt, it) { + t.relocateComponent(rt[it], X[it], M); + }); + var O = /* @__PURE__ */ new Set(); + if (D.length > 1) { + var H = [], B = K.filter(function(vt) { + return vt.css("display") == "none"; + }); + D.forEach(function(vt, it) { + var gt = void 0; + if (M.quality == "draft" && (gt = X[it].nodeIndexes), vt.nodes().not(B).length > 0) { + var Tt = {}; + Tt.edges = [], Tt.nodes = []; + var At = void 0; + vt.nodes().not(B).forEach(function(Dt) { + if (M.quality == "draft") + if (!Dt.isParent()) + At = gt.get(Dt.id()), Tt.nodes.push({ x: X[it].xCoords[At] - Dt.boundingbox().w / 2, y: X[it].yCoords[At] - Dt.boundingbox().h / 2, width: Dt.boundingbox().w, height: Dt.boundingbox().h }); + else { + var mt = t.calcBoundingBox(Dt, X[it].xCoords, X[it].yCoords, gt); + Tt.nodes.push({ x: mt.topLeftX, y: mt.topLeftY, width: mt.width, height: mt.height }); + } + else + k[it][Dt.id()] && Tt.nodes.push({ x: k[it][Dt.id()].getLeft(), y: k[it][Dt.id()].getTop(), width: k[it][Dt.id()].getWidth(), height: k[it][Dt.id()].getHeight() }); + }), vt.edges().forEach(function(Dt) { + var mt = Dt.source(), xt = Dt.target(); + if (mt.css("display") != "none" && xt.css("display") != "none") + if (M.quality == "draft") { + var St = gt.get(mt.id()), Vt = gt.get(xt.id()), Xt = [], Ut = []; + if (mt.isParent()) { + var bt = t.calcBoundingBox(mt, X[it].xCoords, X[it].yCoords, gt); + Xt.push(bt.topLeftX + bt.width / 2), Xt.push(bt.topLeftY + bt.height / 2); + } else + Xt.push(X[it].xCoords[St]), Xt.push(X[it].yCoords[St]); + if (xt.isParent()) { + var Ht = t.calcBoundingBox(xt, X[it].xCoords, X[it].yCoords, gt); + Ut.push(Ht.topLeftX + Ht.width / 2), Ut.push(Ht.topLeftY + Ht.height / 2); + } else + Ut.push(X[it].xCoords[Vt]), Ut.push(X[it].yCoords[Vt]); + Tt.edges.push({ startX: Xt[0], startY: Xt[1], endX: Ut[0], endY: Ut[1] }); + } else + k[it][mt.id()] && k[it][xt.id()] && Tt.edges.push({ startX: k[it][mt.id()].getCenterX(), startY: k[it][mt.id()].getCenterY(), endX: k[it][xt.id()].getCenterX(), endY: k[it][xt.id()].getCenterY() }); + }), Tt.nodes.length > 0 && (H.push(Tt), O.add(it)); + } + }); + var _ = m.packComponents(H, M.randomize).shifts; + if (M.quality == "draft") + X.forEach(function(vt, it) { + var gt = vt.xCoords.map(function(At) { + return At + _[it].dx; + }), Tt = vt.yCoords.map(function(At) { + return At + _[it].dy; + }); + vt.xCoords = gt, vt.yCoords = Tt; + }); + else { + var lt = 0; + O.forEach(function(vt) { + Object.keys(k[vt]).forEach(function(it) { + var gt = k[vt][it]; + gt.setCenter(gt.getCenterX() + _[lt].dx, gt.getCenterY() + _[lt].dy); + }), lt++; + }); + } + } + } else { + var E = M.eles.boundingBox(); + if (rt.push({ x: E.x1 + E.w / 2, y: E.y1 + E.h / 2 }), M.randomize) { + var y = o(M); + X.push(y); + } + M.quality == "default" || M.quality == "proof" ? (k.push(h(M, X[0])), t.relocateComponent(rt[0], k[0], M)) : t.relocateComponent(rt[0], X[0], M); + } + var J = function(it, gt) { + if (M.quality == "default" || M.quality == "proof") { + typeof it == "number" && (it = gt); + var Tt = void 0, At = void 0, Dt = it.data("id"); + return k.forEach(function(xt) { + Dt in xt && (Tt = { x: xt[Dt].getRect().getCenterX(), y: xt[Dt].getRect().getCenterY() }, At = xt[Dt]); + }), M.nodeDimensionsIncludeLabels && (At.labelWidth && (At.labelPosHorizontal == "left" ? Tt.x += At.labelWidth / 2 : At.labelPosHorizontal == "right" && (Tt.x -= At.labelWidth / 2)), At.labelHeight && (At.labelPosVertical == "top" ? Tt.y += At.labelHeight / 2 : At.labelPosVertical == "bottom" && (Tt.y -= At.labelHeight / 2))), Tt == null && (Tt = { x: it.position("x"), y: it.position("y") }), { + x: Tt.x, + y: Tt.y + }; + } else { + var mt = void 0; + return X.forEach(function(xt) { + var St = xt.nodeIndexes.get(it.id()); + St != null && (mt = { x: xt.xCoords[St], y: xt.yCoords[St] }); + }), mt == null && (mt = { x: it.position("x"), y: it.position("y") }), { + x: mt.x, + y: mt.y + }; + } + }; + if (M.quality == "default" || M.quality == "proof" || M.randomize) { + var Rt = t.calcParentsWithoutChildren(P, K), Lt = K.filter(function(vt) { + return vt.css("display") == "none"; + }); + M.eles = K.not(Lt), K.nodes().not(":parent").not(Lt).layoutPositions(S, M, J), Rt.length > 0 && Rt.forEach(function(vt) { + vt.position(J(vt)); + }); + } else + console.log("If randomize option is set to false, then quality option must be 'default' or 'proof'."); + } + }]), d; + }(); + a.exports = v; + } + ), + /***/ + 657: ( + /***/ + (a, r, e) => { + var f = e(548), i = e(140).layoutBase.Matrix, g = e(140).layoutBase.SVD, t = function(o) { + var c = o.cy, h = o.eles, T = h.nodes(), v = h.nodes(":parent"), d = /* @__PURE__ */ new Map(), N = /* @__PURE__ */ new Map(), S = /* @__PURE__ */ new Map(), M = [], P = [], K = [], X = [], k = [], D = [], rt = [], n = [], m = void 0, p = 1e8, E = 1e-9, y = o.piTol, I = o.samplingType, w = o.nodeSeparation, R = void 0, W = function() { + for (var b = 0, $ = 0, Q = !1; $ < R; ) { + b = Math.floor(Math.random() * m), Q = !1; + for (var Z = 0; Z < $; Z++) + if (X[Z] == b) { + Q = !0; + break; + } + if (!Q) + X[$] = b, $++; + else + continue; + } + }, x = function(b, $, Q) { + for (var Z = [], at = 0, ut = 0, ot = 0, tt = void 0, j = [], dt = 0, wt = 1, yt = 0; yt < m; yt++) + j[yt] = p; + for (Z[ut] = b, j[b] = 0; ut >= at; ) { + ot = Z[at++]; + for (var It = M[ot], ft = 0; ft < It.length; ft++) + tt = N.get(It[ft]), j[tt] == p && (j[tt] = j[ot] + 1, Z[++ut] = tt); + D[ot][$] = j[ot] * w; + } + if (Q) { + for (var st = 0; st < m; st++) + D[st][$] < k[st] && (k[st] = D[st][$]); + for (var Ct = 0; Ct < m; Ct++) + k[Ct] > dt && (dt = k[Ct], wt = Ct); + } + return wt; + }, q = function(b) { + var $ = void 0; + if (b) { + $ = Math.floor(Math.random() * m); + for (var Z = 0; Z < m; Z++) + k[Z] = p; + for (var at = 0; at < R; at++) + X[at] = $, $ = x($, at, b); + } else { + W(); + for (var Q = 0; Q < R; Q++) + x(X[Q], Q, b); + } + for (var ut = 0; ut < m; ut++) + for (var ot = 0; ot < R; ot++) + D[ut][ot] *= D[ut][ot]; + for (var tt = 0; tt < R; tt++) + rt[tt] = []; + for (var j = 0; j < R; j++) + for (var dt = 0; dt < R; dt++) + rt[j][dt] = D[X[dt]][j]; + }, V = function() { + for (var b = g.svd(rt), $ = b.S, Q = b.U, Z = b.V, at = $[0] * $[0] * $[0], ut = [], ot = 0; ot < R; ot++) { + ut[ot] = []; + for (var tt = 0; tt < R; tt++) + ut[ot][tt] = 0, ot == tt && (ut[ot][tt] = $[ot] / ($[ot] * $[ot] + at / ($[ot] * $[ot]))); + } + n = i.multMat(i.multMat(Z, ut), i.transpose(Q)); + }, Y = function() { + for (var b = void 0, $ = void 0, Q = [], Z = [], at = [], ut = [], ot = 0; ot < m; ot++) + Q[ot] = Math.random(), Z[ot] = Math.random(); + Q = i.normalize(Q), Z = i.normalize(Z); + for (var tt = E, j = E, dt = void 0; ; ) { + for (var wt = 0; wt < m; wt++) + at[wt] = Q[wt]; + if (Q = i.multGamma(i.multL(i.multGamma(at), D, n)), b = i.dotProduct(at, Q), Q = i.normalize(Q), tt = i.dotProduct(at, Q), dt = Math.abs(tt / j), dt <= 1 + y && dt >= 1) + break; + j = tt; + } + for (var yt = 0; yt < m; yt++) + at[yt] = Q[yt]; + for (j = E; ; ) { + for (var It = 0; It < m; It++) + ut[It] = Z[It]; + if (ut = i.minusOp(ut, i.multCons(at, i.dotProduct(at, ut))), Z = i.multGamma(i.multL(i.multGamma(ut), D, n)), $ = i.dotProduct(ut, Z), Z = i.normalize(Z), tt = i.dotProduct(ut, Z), dt = Math.abs(tt / j), dt <= 1 + y && dt >= 1) + break; + j = tt; + } + for (var ft = 0; ft < m; ft++) + ut[ft] = Z[ft]; + P = i.multCons(at, Math.sqrt(Math.abs(b))), K = i.multCons(ut, Math.sqrt(Math.abs($))); + }; + f.connectComponents(c, h, f.getTopMostNodes(T), d), v.forEach(function(F) { + f.connectComponents(c, h, f.getTopMostNodes(F.descendants().intersection(h)), d); + }); + for (var et = 0, z = 0; z < T.length; z++) + T[z].isParent() || N.set(T[z].id(), et++); + var O = !0, H = !1, B = void 0; + try { + for (var _ = d.keys()[Symbol.iterator](), lt; !(O = (lt = _.next()).done); O = !0) { + var J = lt.value; + N.set(J, et++); + } + } catch (F) { + H = !0, B = F; + } finally { + try { + !O && _.return && _.return(); + } finally { + if (H) + throw B; + } + } + for (var Rt = 0; Rt < N.size; Rt++) + M[Rt] = []; + v.forEach(function(F) { + for (var b = F.children().intersection(h); b.nodes(":childless").length == 0; ) + b = b.nodes()[0].children().intersection(h); + var $ = 0, Q = b.nodes(":childless")[0].connectedEdges().length; + b.nodes(":childless").forEach(function(Z, at) { + Z.connectedEdges().length < Q && (Q = Z.connectedEdges().length, $ = at); + }), S.set(F.id(), b.nodes(":childless")[$].id()); + }), T.forEach(function(F) { + var b = void 0; + F.isParent() ? b = N.get(S.get(F.id())) : b = N.get(F.id()), F.neighborhood().nodes().forEach(function($) { + h.intersection(F.edgesWith($)).length > 0 && ($.isParent() ? M[b].push(S.get($.id())) : M[b].push($.id())); + }); + }); + var Lt = function(b) { + var $ = N.get(b), Q = void 0; + d.get(b).forEach(function(Z) { + c.getElementById(Z).isParent() ? Q = S.get(Z) : Q = Z, M[$].push(Q), M[N.get(Q)].push(b); + }); + }, vt = !0, it = !1, gt = void 0; + try { + for (var Tt = d.keys()[Symbol.iterator](), At; !(vt = (At = Tt.next()).done); vt = !0) { + var Dt = At.value; + Lt(Dt); + } + } catch (F) { + it = !0, gt = F; + } finally { + try { + !vt && Tt.return && Tt.return(); + } finally { + if (it) + throw gt; + } + } + m = N.size; + var mt = void 0; + if (m > 2) { + R = m < o.sampleSize ? m : o.sampleSize; + for (var xt = 0; xt < m; xt++) + D[xt] = []; + for (var St = 0; St < R; St++) + n[St] = []; + return o.quality == "draft" || o.step == "all" ? (q(I), V(), Y(), mt = { nodeIndexes: N, xCoords: P, yCoords: K }) : (N.forEach(function(F, b) { + P.push(c.getElementById(b).position("x")), K.push(c.getElementById(b).position("y")); + }), mt = { nodeIndexes: N, xCoords: P, yCoords: K }), mt; + } else { + var Vt = N.keys(), Xt = c.getElementById(Vt.next().value), Ut = Xt.position(), bt = Xt.outerWidth(); + if (P.push(Ut.x), K.push(Ut.y), m == 2) { + var Ht = c.getElementById(Vt.next().value), Bt = Ht.outerWidth(); + P.push(Ut.x + bt / 2 + Bt / 2 + o.idealEdgeLength), K.push(Ut.y); + } + return mt = { nodeIndexes: N, xCoords: P, yCoords: K }, mt; + } + }; + a.exports = { spectralLayout: t }; + } + ), + /***/ + 579: ( + /***/ + (a, r, e) => { + var f = e(212), i = function(t) { + t && t("layout", "fcose", f); + }; + typeof cytoscape < "u" && i(cytoscape), a.exports = i; + } + ), + /***/ + 140: ( + /***/ + (a) => { + a.exports = A; + } + ) + /******/ + }, L = {}; + function u(a) { + var r = L[a]; + if (r !== void 0) + return r.exports; + var e = L[a] = { + /******/ + // no module.id needed + /******/ + // no module.loaded needed + /******/ + exports: {} + /******/ + }; + return G[a](e, e.exports, u), e.exports; + } + var l = u(579); + return l; + })() + ); + }); +})(Ge); +var gr = Ge.exports; +const dr = /* @__PURE__ */ fr(gr); +var Re = { + L: "left", + R: "right", + T: "top", + B: "bottom" +}, Se = { + L: /* @__PURE__ */ nt((C) => `${C},${C / 2} 0,${C} 0,0`, "L"), + R: /* @__PURE__ */ nt((C) => `0,${C / 2} ${C},0 ${C},${C}`, "R"), + T: /* @__PURE__ */ nt((C) => `0,0 ${C},0 ${C / 2},${C}`, "T"), + B: /* @__PURE__ */ nt((C) => `${C / 2},0 ${C},${C} 0,${C}`, "B") +}, he = { + L: /* @__PURE__ */ nt((C, U) => C - U + 2, "L"), + R: /* @__PURE__ */ nt((C, U) => C - 2, "R"), + T: /* @__PURE__ */ nt((C, U) => C - U + 2, "T"), + B: /* @__PURE__ */ nt((C, U) => C - 2, "B") +}, vr = /* @__PURE__ */ nt(function(C) { + return zt(C) ? C === "L" ? "R" : "L" : C === "T" ? "B" : "T"; +}, "getOppositeArchitectureDirection"), Fe = /* @__PURE__ */ nt(function(C) { + const U = C; + return U === "L" || U === "R" || U === "T" || U === "B"; +}, "isArchitectureDirection"), zt = /* @__PURE__ */ nt(function(C) { + const U = C; + return U === "L" || U === "R"; +}, "isArchitectureDirectionX"), Qt = /* @__PURE__ */ nt(function(C) { + const U = C; + return U === "T" || U === "B"; +}, "isArchitectureDirectionY"), Ce = /* @__PURE__ */ nt(function(C, U) { + const A = zt(C) && Qt(U), G = Qt(C) && zt(U); + return A || G; +}, "isArchitectureDirectionXY"), pr = /* @__PURE__ */ nt(function(C) { + const U = C[0], A = C[1], G = zt(U) && Qt(A), L = Qt(U) && zt(A); + return G || L; +}, "isArchitecturePairXY"), yr = /* @__PURE__ */ nt(function(C) { + return C !== "LL" && C !== "RR" && C !== "TT" && C !== "BB"; +}, "isValidArchitectureDirectionPair"), me = /* @__PURE__ */ nt(function(C, U) { + const A = `${C}${U}`; + return yr(A) ? A : void 0; +}, "getArchitectureDirectionPair"), Er = /* @__PURE__ */ nt(function([C, U], A) { + const G = A[0], L = A[1]; + return zt(G) ? Qt(L) ? [C + (G === "L" ? -1 : 1), U + (L === "T" ? 1 : -1)] : [C + (G === "L" ? -1 : 1), U] : zt(L) ? [C + (L === "L" ? 1 : -1), U + (G === "T" ? 1 : -1)] : [C, U + (G === "T" ? 1 : -1)]; +}, "shiftPositionByArchitectureDirectionPair"), mr = /* @__PURE__ */ nt(function(C) { + return C === "LT" || C === "TL" ? [1, 1] : C === "BL" || C === "LB" ? [1, -1] : C === "BR" || C === "RB" ? [-1, -1] : [-1, 1]; +}, "getArchitectureDirectionXYFactors"), Tr = /* @__PURE__ */ nt(function(C, U) { + return Ce(C, U) ? "bend" : zt(C) ? "horizontal" : "vertical"; +}, "getArchitectureDirectionAlignment"), Nr = /* @__PURE__ */ nt(function(C) { + return C.type === "service"; +}, "isArchitectureService"), Lr = /* @__PURE__ */ nt(function(C) { + return C.type === "junction"; +}, "isArchitectureJunction"), Ue = /* @__PURE__ */ nt((C) => C.data(), "edgeData"), ne = /* @__PURE__ */ nt((C) => C.data(), "nodeData"), Ye = qe.architecture, pt = new hr(() => ({ + nodes: {}, + groups: {}, + edges: [], + registeredIds: {}, + config: Ye, + dataStructures: void 0, + elements: {} +})), Cr = /* @__PURE__ */ nt(() => { + pt.reset(), ar(); +}, "clear"), Mr = /* @__PURE__ */ nt(function({ + id: C, + icon: U, + in: A, + title: G, + iconText: L +}) { + if (pt.records.registeredIds[C] !== void 0) + throw new Error( + `The service id [${C}] is already in use by another ${pt.records.registeredIds[C]}` + ); + if (A !== void 0) { + if (C === A) + throw new Error(`The service [${C}] cannot be placed within itself`); + if (pt.records.registeredIds[A] === void 0) + throw new Error( + `The service [${C}]'s parent does not exist. Please make sure the parent is created before this service` + ); + if (pt.records.registeredIds[A] === "node") + throw new Error(`The service [${C}]'s parent is not a group`); + } + pt.records.registeredIds[C] = "node", pt.records.nodes[C] = { + id: C, + type: "service", + icon: U, + iconText: L, + title: G, + edges: [], + in: A + }; +}, "addService"), Ar = /* @__PURE__ */ nt(() => Object.values(pt.records.nodes).filter(Nr), "getServices"), wr = /* @__PURE__ */ nt(function({ id: C, in: U }) { + pt.records.registeredIds[C] = "node", pt.records.nodes[C] = { + id: C, + type: "junction", + edges: [], + in: U + }; +}, "addJunction"), Or = /* @__PURE__ */ nt(() => Object.values(pt.records.nodes).filter(Lr), "getJunctions"), Dr = /* @__PURE__ */ nt(() => Object.values(pt.records.nodes), "getNodes"), Te = /* @__PURE__ */ nt((C) => pt.records.nodes[C], "getNode"), xr = /* @__PURE__ */ nt(function({ id: C, icon: U, in: A, title: G }) { + if (pt.records.registeredIds[C] !== void 0) + throw new Error( + `The group id [${C}] is already in use by another ${pt.records.registeredIds[C]}` + ); + if (A !== void 0) { + if (C === A) + throw new Error(`The group [${C}] cannot be placed within itself`); + if (pt.records.registeredIds[A] === void 0) + throw new Error( + `The group [${C}]'s parent does not exist. Please make sure the parent is created before this group` + ); + if (pt.records.registeredIds[A] === "node") + throw new Error(`The group [${C}]'s parent is not a group`); + } + pt.records.registeredIds[C] = "group", pt.records.groups[C] = { + id: C, + icon: U, + title: G, + in: A + }; +}, "addGroup"), Ir = /* @__PURE__ */ nt(() => Object.values(pt.records.groups), "getGroups"), Rr = /* @__PURE__ */ nt(function({ + lhsId: C, + rhsId: U, + lhsDir: A, + rhsDir: G, + lhsInto: L, + rhsInto: u, + lhsGroup: l, + rhsGroup: a, + title: r +}) { + if (!Fe(A)) + throw new Error( + `Invalid direction given for left hand side of edge ${C}--${U}. Expected (L,R,T,B) got ${A}` + ); + if (!Fe(G)) + throw new Error( + `Invalid direction given for right hand side of edge ${C}--${U}. Expected (L,R,T,B) got ${G}` + ); + if (pt.records.nodes[C] === void 0 && pt.records.groups[C] === void 0) + throw new Error( + `The left-hand id [${C}] does not yet exist. Please create the service/group before declaring an edge to it.` + ); + if (pt.records.nodes[U] === void 0 && pt.records.groups[C] === void 0) + throw new Error( + `The right-hand id [${U}] does not yet exist. Please create the service/group before declaring an edge to it.` + ); + const e = pt.records.nodes[C].in, f = pt.records.nodes[U].in; + if (l && e && f && e == f) + throw new Error( + `The left-hand id [${C}] is modified to traverse the group boundary, but the edge does not pass through two groups.` + ); + if (a && e && f && e == f) + throw new Error( + `The right-hand id [${U}] is modified to traverse the group boundary, but the edge does not pass through two groups.` + ); + const i = { + lhsId: C, + lhsDir: A, + lhsInto: L, + lhsGroup: l, + rhsId: U, + rhsDir: G, + rhsInto: u, + rhsGroup: a, + title: r + }; + pt.records.edges.push(i), pt.records.nodes[C] && pt.records.nodes[U] && (pt.records.nodes[C].edges.push(pt.records.edges[pt.records.edges.length - 1]), pt.records.nodes[U].edges.push(pt.records.edges[pt.records.edges.length - 1])); +}, "addEdge"), Sr = /* @__PURE__ */ nt(() => pt.records.edges, "getEdges"), Fr = /* @__PURE__ */ nt(() => { + if (pt.records.dataStructures === void 0) { + const C = {}, U = Object.entries(pt.records.nodes).reduce((a, [r, e]) => (a[r] = e.edges.reduce((f, i) => { + var s, o; + const g = (s = Te(i.lhsId)) == null ? void 0 : s.in, t = (o = Te(i.rhsId)) == null ? void 0 : o.in; + if (g && t && g !== t) { + const c = Tr(i.lhsDir, i.rhsDir); + c !== "bend" && (C[g] ?? (C[g] = {}), C[g][t] = c, C[t] ?? (C[t] = {}), C[t][g] = c); + } + if (i.lhsId === r) { + const c = me(i.lhsDir, i.rhsDir); + c && (f[c] = i.rhsId); + } else { + const c = me(i.rhsDir, i.lhsDir); + c && (f[c] = i.lhsId); + } + return f; + }, {}), a), {}), A = Object.keys(U)[0], G = { [A]: 1 }, L = Object.keys(U).reduce( + (a, r) => r === A ? a : { ...a, [r]: 1 }, + {} + ), u = /* @__PURE__ */ nt((a) => { + const r = { [a]: [0, 0] }, e = [a]; + for (; e.length > 0; ) { + const f = e.shift(); + if (f) { + G[f] = 1, delete L[f]; + const i = U[f], [g, t] = r[f]; + Object.entries(i).forEach(([s, o]) => { + G[o] || (r[o] = Er( + [g, t], + s + ), e.push(o)); + }); + } + } + return r; + }, "BFS"), l = [u(A)]; + for (; Object.keys(L).length > 0; ) + l.push(u(Object.keys(L)[0])); + pt.records.dataStructures = { + adjList: U, + spatialMaps: l, + groupAlignments: C + }; + } + return pt.records.dataStructures; +}, "getDataStructures"), br = /* @__PURE__ */ nt((C, U) => { + pt.records.elements[C] = U; +}, "setElementForId"), Pr = /* @__PURE__ */ nt((C) => pt.records.elements[C], "getElementById"), le = { + clear: Cr, + setDiagramTitle: Ke, + getDiagramTitle: je, + setAccTitle: _e, + getAccTitle: tr, + setAccDescription: er, + getAccDescription: rr, + addService: Mr, + getServices: Ar, + addJunction: wr, + getJunctions: Or, + getNodes: Dr, + getNode: Te, + addGroup: xr, + getGroups: Ir, + addEdge: Rr, + getEdges: Sr, + setElementForId: br, + getElementById: Pr, + getDataStructures: Fr +}; +function Pt(C) { + const U = fe().architecture; + return U != null && U[C] ? U[C] : Ye[C]; +} +nt(Pt, "getConfigField"); +var Gr = /* @__PURE__ */ nt((C, U) => { + sr(C, U), C.groups.map(U.addGroup), C.services.map((A) => U.addService({ ...A, type: "service" })), C.junctions.map((A) => U.addJunction({ ...A, type: "junction" })), C.edges.map(U.addEdge); +}, "populateDb"), Ur = { + parse: /* @__PURE__ */ nt(async (C) => { + const U = await lr("architecture", C); + be.debug(U), Gr(U, le); + }, "parse") +}, Yr = /* @__PURE__ */ nt((C) => ` + .edge { + stroke-width: ${C.archEdgeWidth}; + stroke: ${C.archEdgeColor}; + fill: none; + } + + .arrow { + fill: ${C.archEdgeArrowColor}; + } + + .node-bkg { + fill: none; + stroke: ${C.archGroupBorderColor}; + stroke-width: ${C.archGroupBorderWidth}; + stroke-dasharray: 8; + } + .node-icon-text { + display: flex; + align-items: center; + } + + .node-icon-text > div { + color: #fff; + margin: 1px; + height: fit-content; + text-align: center; + overflow: hidden; + display: -webkit-box; + -webkit-box-orient: vertical; + } +`, "getStyles"), Xr = Yr, ae = /* @__PURE__ */ nt((C) => `${C}`, "wrapIcon"), oe = { + prefix: "mermaid-architecture", + height: 80, + width: 80, + icons: { + database: { + body: ae( + '' + ) + }, + server: { + body: ae( + '' + ) + }, + disk: { + body: ae( + '' + ) + }, + internet: { + body: ae( + '' + ) + }, + cloud: { + body: ae( + '' + ) + }, + unknown: Je, + blank: { + body: ae("") + } + } +}, Hr = /* @__PURE__ */ nt(async function(C, U) { + const A = Pt("padding"), G = Pt("iconSize"), L = G / 2, u = G / 6, l = u / 2; + await Promise.all( + U.edges().map(async (a) => { + var P, K; + const { + source: r, + sourceDir: e, + sourceArrow: f, + sourceGroup: i, + target: g, + targetDir: t, + targetArrow: s, + targetGroup: o, + label: c + } = Ue(a); + let { x: h, y: T } = a[0].sourceEndpoint(); + const { x: v, y: d } = a[0].midpoint(); + let { x: N, y: S } = a[0].targetEndpoint(); + const M = A + 4; + if (i && (zt(e) ? h += e === "L" ? -M : M : T += e === "T" ? -M : M + 18), o && (zt(t) ? N += t === "L" ? -M : M : S += t === "T" ? -M : M + 18), !i && ((P = le.getNode(r)) == null ? void 0 : P.type) === "junction" && (zt(e) ? h += e === "L" ? L : -L : T += e === "T" ? L : -L), !o && ((K = le.getNode(g)) == null ? void 0 : K.type) === "junction" && (zt(t) ? N += t === "L" ? L : -L : S += t === "T" ? L : -L), a[0]._private.rscratch) { + const X = C.insert("g"); + if (X.insert("path").attr("d", `M ${h},${T} L ${v},${d} L${N},${S} `).attr("class", "edge"), f) { + const k = zt(e) ? he[e](h, u) : h - l, D = Qt(e) ? he[e](T, u) : T - l; + X.insert("polygon").attr("points", Se[e](u)).attr("transform", `translate(${k},${D})`).attr("class", "arrow"); + } + if (s) { + const k = zt(t) ? he[t](N, u) : N - l, D = Qt(t) ? he[t](S, u) : S - l; + X.insert("polygon").attr("points", Se[t](u)).attr("transform", `translate(${k},${D})`).attr("class", "arrow"); + } + if (c) { + const k = Ce(e, t) ? "XY" : zt(e) ? "X" : "Y"; + let D = 0; + k === "X" ? D = Math.abs(h - N) : k === "Y" ? D = Math.abs(T - S) / 1.5 : D = Math.abs(h - N) / 2; + const rt = X.append("g"); + if (await Ne( + rt, + c, + { + useHtmlLabels: !1, + width: D, + classes: "architecture-service-label" + }, + fe() + ), rt.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), k === "X") + rt.attr("transform", "translate(" + v + ", " + d + ")"); + else if (k === "Y") + rt.attr("transform", "translate(" + v + ", " + d + ") rotate(-90)"); + else if (k === "XY") { + const n = me(e, t); + if (n && pr(n)) { + const m = rt.node().getBoundingClientRect(), [p, E] = mr(n); + rt.attr("dominant-baseline", "auto").attr("transform", `rotate(${-1 * p * E * 45})`); + const y = rt.node().getBoundingClientRect(); + rt.attr( + "transform", + ` + translate(${v}, ${d - m.height / 2}) + translate(${p * y.width / 2}, ${E * y.height / 2}) + rotate(${-1 * p * E * 45}, 0, ${m.height / 2}) + ` + ); + } + } + } + } + }) + ); +}, "drawEdges"), Wr = /* @__PURE__ */ nt(async function(C, U) { + const G = Pt("padding") * 0.75, L = Pt("fontSize"), l = Pt("iconSize") / 2; + await Promise.all( + U.nodes().map(async (a) => { + const r = ne(a); + if (r.type === "group") { + const { h: e, w: f, x1: i, y1: g } = a.boundingBox(); + C.append("rect").attr("x", i + l).attr("y", g + l).attr("width", f).attr("height", e).attr("class", "node-bkg"); + const t = C.append("g"); + let s = i, o = g; + if (r.icon) { + const c = t.append("g"); + c.html( + `${await Ee(r.icon, { height: G, width: G, fallbackPrefix: oe.prefix })}` + ), c.attr( + "transform", + "translate(" + (s + l + 1) + ", " + (o + l + 1) + ")" + ), s += G, o += L / 2 - 1 - 2; + } + if (r.label) { + const c = t.append("g"); + await Ne( + c, + r.label, + { + useHtmlLabels: !1, + width: f, + classes: "architecture-service-label" + }, + fe() + ), c.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "start").attr("text-anchor", "start"), c.attr( + "transform", + "translate(" + (s + l + 4) + ", " + (o + l + 2) + ")" + ); + } + } + }) + ); +}, "drawGroups"), Vr = /* @__PURE__ */ nt(async function(C, U, A) { + for (const G of A) { + const L = U.append("g"), u = Pt("iconSize"); + if (G.title) { + const e = L.append("g"); + await Ne( + e, + G.title, + { + useHtmlLabels: !1, + width: u * 1.5, + classes: "architecture-service-label" + }, + fe() + ), e.attr("dy", "1em").attr("alignment-baseline", "middle").attr("dominant-baseline", "middle").attr("text-anchor", "middle"), e.attr("transform", "translate(" + u / 2 + ", " + u + ")"); + } + const l = L.append("g"); + if (G.icon) + l.html( + `${await Ee(G.icon, { height: u, width: u, fallbackPrefix: oe.prefix })}` + ); + else if (G.iconText) { + l.html( + `${await Ee("blank", { height: u, width: u, fallbackPrefix: oe.prefix })}` + ); + const i = l.append("g").append("foreignObject").attr("width", u).attr("height", u).append("div").attr("class", "node-icon-text").attr("style", `height: ${u}px;`).append("div").html(G.iconText), g = parseInt( + window.getComputedStyle(i.node(), null).getPropertyValue("font-size").replace(/\D/g, "") + ) ?? 16; + i.attr("style", `-webkit-line-clamp: ${Math.floor((u - 2) / g)};`); + } else + l.append("path").attr("class", "node-bkg").attr("id", "node-" + G.id).attr( + "d", + `M0 ${u} v${-u} q0,-5 5,-5 h${u} q5,0 5,5 v${u} H0 Z` + ); + L.attr("class", "architecture-service"); + const { width: a, height: r } = L._groups[0][0].getBBox(); + G.width = a, G.height = r, C.setElementForId(G.id, L); + } + return 0; +}, "drawServices"), zr = /* @__PURE__ */ nt(function(C, U, A) { + A.forEach((G) => { + const L = U.append("g"), u = Pt("iconSize"); + L.append("g").append("rect").attr("id", "node-" + G.id).attr("fill-opacity", "0").attr("width", u).attr("height", u), L.attr("class", "architecture-junction"); + const { width: a, height: r } = L._groups[0][0].getBBox(); + L.width = a, L.height = r, C.setElementForId(G.id, L); + }); +}, "drawJunctions"); +Qe([ + { + name: oe.prefix, + icons: oe + } +]); +Pe.use(dr); +function Xe(C, U) { + C.forEach((A) => { + U.add({ + group: "nodes", + data: { + type: "service", + id: A.id, + icon: A.icon, + label: A.title, + parent: A.in, + width: Pt("iconSize"), + height: Pt("iconSize") + }, + classes: "node-service" + }); + }); +} +nt(Xe, "addServices"); +function He(C, U) { + C.forEach((A) => { + U.add({ + group: "nodes", + data: { + type: "junction", + id: A.id, + parent: A.in, + width: Pt("iconSize"), + height: Pt("iconSize") + }, + classes: "node-junction" + }); + }); +} +nt(He, "addJunctions"); +function We(C, U) { + U.nodes().map((A) => { + const G = ne(A); + if (G.type === "group") + return; + G.x = A.position().x, G.y = A.position().y, C.getElementById(G.id).attr("transform", "translate(" + (G.x || 0) + "," + (G.y || 0) + ")"); + }); +} +nt(We, "positionNodes"); +function Ve(C, U) { + C.forEach((A) => { + U.add({ + group: "nodes", + data: { + type: "group", + id: A.id, + icon: A.icon, + label: A.title, + parent: A.in + }, + classes: "node-group" + }); + }); +} +nt(Ve, "addGroups"); +function ze(C, U) { + C.forEach((A) => { + const { lhsId: G, rhsId: L, lhsInto: u, lhsGroup: l, rhsInto: a, lhsDir: r, rhsDir: e, rhsGroup: f, title: i } = A, g = Ce(A.lhsDir, A.rhsDir) ? "segments" : "straight", t = { + id: `${G}-${L}`, + label: i, + source: G, + sourceDir: r, + sourceArrow: u, + sourceGroup: l, + sourceEndpoint: r === "L" ? "0 50%" : r === "R" ? "100% 50%" : r === "T" ? "50% 0" : "50% 100%", + target: L, + targetDir: e, + targetArrow: a, + targetGroup: f, + targetEndpoint: e === "L" ? "0 50%" : e === "R" ? "100% 50%" : e === "T" ? "50% 0" : "50% 100%" + }; + U.add({ + group: "edges", + data: t, + classes: g + }); + }); +} +nt(ze, "addEdges"); +function Be(C, U, A) { + const G = /* @__PURE__ */ nt((a, r) => Object.entries(a).reduce( + (e, [f, i]) => { + var s; + let g = 0; + const t = Object.entries(i); + if (t.length === 1) + return e[f] = t[0][1], e; + for (let o = 0; o < t.length - 1; o++) + for (let c = o + 1; c < t.length; c++) { + const [h, T] = t[o], [v, d] = t[c]; + if (((s = A[h]) == null ? void 0 : s[v]) === r) + e[f] ?? (e[f] = []), e[f] = [...e[f], ...T, ...d]; + else if (h === "default" || v === "default") + e[f] ?? (e[f] = []), e[f] = [...e[f], ...T, ...d]; + else { + const S = `${f}-${g++}`; + e[S] = T; + const M = `${f}-${g++}`; + e[M] = d; + } + } + return e; + }, + {} + ), "flattenAlignments"), L = U.map((a) => { + const r = {}, e = {}; + return Object.entries(a).forEach(([f, [i, g]]) => { + var s, o, c; + const t = ((s = C.getNode(f)) == null ? void 0 : s.in) ?? "default"; + r[g] ?? (r[g] = {}), (o = r[g])[t] ?? (o[t] = []), r[g][t].push(f), e[i] ?? (e[i] = {}), (c = e[i])[t] ?? (c[t] = []), e[i][t].push(f); + }), { + horiz: Object.values(G(r, "horizontal")).filter( + (f) => f.length > 1 + ), + vert: Object.values(G(e, "vertical")).filter( + (f) => f.length > 1 + ) + }; + }), [u, l] = L.reduce( + ([a, r], { horiz: e, vert: f }) => [ + [...a, ...e], + [...r, ...f] + ], + [[], []] + ); + return { + horizontal: u, + vertical: l + }; +} +nt(Be, "getAlignments"); +function $e(C) { + const U = [], A = /* @__PURE__ */ nt((L) => `${L[0]},${L[1]}`, "posToStr"), G = /* @__PURE__ */ nt((L) => L.split(",").map((u) => parseInt(u)), "strToPos"); + return C.forEach((L) => { + const u = Object.fromEntries( + Object.entries(L).map(([e, f]) => [A(f), e]) + ), l = [A([0, 0])], a = {}, r = { + L: [-1, 0], + R: [1, 0], + T: [0, 1], + B: [0, -1] + }; + for (; l.length > 0; ) { + const e = l.shift(); + if (e) { + a[e] = 1; + const f = u[e]; + if (f) { + const i = G(e); + Object.entries(r).forEach(([g, t]) => { + const s = A([i[0] + t[0], i[1] + t[1]]), o = u[s]; + o && !a[s] && (l.push(s), U.push({ + [Re[g]]: o, + [Re[vr(g)]]: f, + gap: 1.5 * Pt("iconSize") + })); + }); + } + } + } + }), U; +} +nt($e, "getRelativeConstraints"); +function Ze(C, U, A, G, L, { spatialMaps: u, groupAlignments: l }) { + return new Promise((a) => { + const r = ir("body").append("div").attr("id", "cy").attr("style", "display:none"), e = Pe({ + container: document.getElementById("cy"), + style: [ + { + selector: "edge", + style: { + "curve-style": "straight", + label: "data(label)", + "source-endpoint": "data(sourceEndpoint)", + "target-endpoint": "data(targetEndpoint)" + } + }, + { + selector: "edge.segments", + style: { + "curve-style": "segments", + "segment-weights": "0", + "segment-distances": [0.5], + // @ts-ignore Incorrect library types + "edge-distances": "endpoints", + "source-endpoint": "data(sourceEndpoint)", + "target-endpoint": "data(targetEndpoint)" + } + }, + { + selector: "node", + style: { + // @ts-ignore Incorrect library types + "compound-sizing-wrt-labels": "include" + } + }, + { + selector: "node[label]", + style: { + "text-valign": "bottom", + "text-halign": "center", + "font-size": `${Pt("fontSize")}px` + } + }, + { + selector: ".node-service", + style: { + label: "data(label)", + width: "data(width)", + height: "data(height)" + } + }, + { + selector: ".node-junction", + style: { + width: "data(width)", + height: "data(height)" + } + }, + { + selector: ".node-group", + style: { + // @ts-ignore Incorrect library types + padding: `${Pt("padding")}px` + } + } + ] + }); + r.remove(), Ve(A, e), Xe(C, e), He(U, e), ze(G, e); + const f = Be(L, u, l), i = $e(u), g = e.layout({ + name: "fcose", + quality: "proof", + styleEnabled: !1, + animate: !1, + nodeDimensionsIncludeLabels: !1, + // Adjust the edge parameters if it passes through the border of a group + // Hacky fix for: https://github.com/iVis-at-Bilkent/cytoscape.js-fcose/issues/67 + idealEdgeLength(t) { + const [s, o] = t.connectedNodes(), { parent: c } = ne(s), { parent: h } = ne(o); + return c === h ? 1.5 * Pt("iconSize") : 0.5 * Pt("iconSize"); + }, + edgeElasticity(t) { + const [s, o] = t.connectedNodes(), { parent: c } = ne(s), { parent: h } = ne(o); + return c === h ? 0.45 : 1e-3; + }, + alignmentConstraint: f, + relativePlacementConstraint: i + }); + g.one("layoutstop", () => { + var s; + function t(o, c, h, T) { + let v, d; + const { x: N, y: S } = o, { x: M, y: P } = c; + d = (T - S + (N - h) * (S - P) / (N - M)) / Math.sqrt(1 + Math.pow((S - P) / (N - M), 2)), v = Math.sqrt(Math.pow(T - S, 2) + Math.pow(h - N, 2) - Math.pow(d, 2)); + const K = Math.sqrt(Math.pow(M - N, 2) + Math.pow(P - S, 2)); + v = v / K; + let X = (M - N) * (T - S) - (P - S) * (h - N); + switch (!0) { + case X >= 0: + X = 1; + break; + case X < 0: + X = -1; + break; + } + let k = (M - N) * (h - N) + (P - S) * (T - S); + switch (!0) { + case k >= 0: + k = 1; + break; + case k < 0: + k = -1; + break; + } + return d = Math.abs(d) * X, v = v * k, { + distances: d, + weights: v + }; + } + nt(t, "getSegmentWeights"), e.startBatch(); + for (const o of Object.values(e.edges())) + if ((s = o.data) != null && s.call(o)) { + const { x: c, y: h } = o.source().position(), { x: T, y: v } = o.target().position(); + if (c !== T && h !== v) { + const d = o.sourceEndpoint(), N = o.targetEndpoint(), { sourceDir: S } = Ue(o), [M, P] = Qt(S) ? [d.x, N.y] : [N.x, d.y], { weights: K, distances: X } = t(d, N, M, P); + o.style("segment-distances", X), o.style("segment-weights", K); + } + } + e.endBatch(), g.run(); + }), g.run(), e.ready((t) => { + be.info("Ready", t), a(e); + }); + }); +} +nt(Ze, "layoutArchitecture"); +var Br = /* @__PURE__ */ nt(async (C, U, A, G) => { + const L = G.db, u = L.getServices(), l = L.getJunctions(), a = L.getGroups(), r = L.getEdges(), e = L.getDataStructures(), f = nr(U), i = f.append("g"); + i.attr("class", "architecture-edges"); + const g = f.append("g"); + g.attr("class", "architecture-services"); + const t = f.append("g"); + t.attr("class", "architecture-groups"), await Vr(L, g, u), zr(L, g, l); + const s = await Ze(u, l, a, r, L, e); + await Hr(i, s), await Wr(t, s), We(L, s), or(void 0, f, Pt("padding"), Pt("useMaxWidth")); +}, "draw"), $r = { draw: Br }, jr = { + parser: Ur, + db: le, + renderer: $r, + styles: Xr +}; +export { + jr as diagram +}; diff --git a/backend/fastrtc/templates/component/blockDiagram-JOT3LUYC-DC6f4uVN.js b/backend/fastrtc/templates/component/blockDiagram-JOT3LUYC-DC6f4uVN.js new file mode 100644 index 0000000..f588a77 --- /dev/null +++ b/backend/fastrtc/templates/component/blockDiagram-JOT3LUYC-DC6f4uVN.js @@ -0,0 +1,2247 @@ +import { _ as d, d as z, l as L, j as R, ah as de, E as at, ai as Z, aj as Yt, ak as ge, u as tt, al as ue, Q as pe, k as fe, t as xe, A as ye, R as be, am as we, an as xt, e as me, i as Tt } from "./mermaid.core-Cmyps_S7.js"; +import { c as Le } from "./clone-Bt-5RraT.js"; +import { G as Se } from "./graph-BaPzJnYr.js"; +import { c as ve } from "./channel-DQMget29.js"; +var yt = function() { + var e = /* @__PURE__ */ d(function(N, x, g, u) { + for (g = g || {}, u = N.length; u--; g[N[u]] = x) ; + return g; + }, "o"), t = [1, 7], r = [1, 13], n = [1, 14], i = [1, 15], a = [1, 19], s = [1, 16], l = [1, 17], o = [1, 18], f = [8, 30], h = [8, 21, 28, 29, 30, 31, 32, 40, 44, 47], y = [1, 23], b = [1, 24], m = [8, 15, 16, 21, 28, 29, 30, 31, 32, 40, 44, 47], E = [8, 15, 16, 21, 27, 28, 29, 30, 31, 32, 40, 44, 47], D = [1, 49], v = { + trace: /* @__PURE__ */ d(function() { + }, "trace"), + yy: {}, + symbols_: { error: 2, spaceLines: 3, SPACELINE: 4, NL: 5, separator: 6, SPACE: 7, EOF: 8, start: 9, BLOCK_DIAGRAM_KEY: 10, document: 11, stop: 12, statement: 13, link: 14, LINK: 15, START_LINK: 16, LINK_LABEL: 17, STR: 18, nodeStatement: 19, columnsStatement: 20, SPACE_BLOCK: 21, blockStatement: 22, classDefStatement: 23, cssClassStatement: 24, styleStatement: 25, node: 26, SIZE: 27, COLUMNS: 28, "id-block": 29, end: 30, block: 31, NODE_ID: 32, nodeShapeNLabel: 33, dirList: 34, DIR: 35, NODE_DSTART: 36, NODE_DEND: 37, BLOCK_ARROW_START: 38, BLOCK_ARROW_END: 39, classDef: 40, CLASSDEF_ID: 41, CLASSDEF_STYLEOPTS: 42, DEFAULT: 43, class: 44, CLASSENTITY_IDS: 45, STYLECLASS: 46, style: 47, STYLE_ENTITY_IDS: 48, STYLE_DEFINITION_DATA: 49, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 4: "SPACELINE", 5: "NL", 7: "SPACE", 8: "EOF", 10: "BLOCK_DIAGRAM_KEY", 15: "LINK", 16: "START_LINK", 17: "LINK_LABEL", 18: "STR", 21: "SPACE_BLOCK", 27: "SIZE", 28: "COLUMNS", 29: "id-block", 30: "end", 31: "block", 32: "NODE_ID", 35: "DIR", 36: "NODE_DSTART", 37: "NODE_DEND", 38: "BLOCK_ARROW_START", 39: "BLOCK_ARROW_END", 40: "classDef", 41: "CLASSDEF_ID", 42: "CLASSDEF_STYLEOPTS", 43: "DEFAULT", 44: "class", 45: "CLASSENTITY_IDS", 46: "STYLECLASS", 47: "style", 48: "STYLE_ENTITY_IDS", 49: "STYLE_DEFINITION_DATA" }, + productions_: [0, [3, 1], [3, 2], [3, 2], [6, 1], [6, 1], [6, 1], [9, 3], [12, 1], [12, 1], [12, 2], [12, 2], [11, 1], [11, 2], [14, 1], [14, 4], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [13, 1], [19, 3], [19, 2], [19, 1], [20, 1], [22, 4], [22, 3], [26, 1], [26, 2], [34, 1], [34, 2], [33, 3], [33, 4], [23, 3], [23, 3], [24, 3], [25, 3]], + performAction: /* @__PURE__ */ d(function(x, g, u, w, S, c, _) { + var p = c.length - 1; + switch (S) { + case 4: + w.getLogger().debug("Rule: separator (NL) "); + break; + case 5: + w.getLogger().debug("Rule: separator (Space) "); + break; + case 6: + w.getLogger().debug("Rule: separator (EOF) "); + break; + case 7: + w.getLogger().debug("Rule: hierarchy: ", c[p - 1]), w.setHierarchy(c[p - 1]); + break; + case 8: + w.getLogger().debug("Stop NL "); + break; + case 9: + w.getLogger().debug("Stop EOF "); + break; + case 10: + w.getLogger().debug("Stop NL2 "); + break; + case 11: + w.getLogger().debug("Stop EOF2 "); + break; + case 12: + w.getLogger().debug("Rule: statement: ", c[p]), typeof c[p].length == "number" ? this.$ = c[p] : this.$ = [c[p]]; + break; + case 13: + w.getLogger().debug("Rule: statement #2: ", c[p - 1]), this.$ = [c[p - 1]].concat(c[p]); + break; + case 14: + w.getLogger().debug("Rule: link: ", c[p], x), this.$ = { edgeTypeStr: c[p], label: "" }; + break; + case 15: + w.getLogger().debug("Rule: LABEL link: ", c[p - 3], c[p - 1], c[p]), this.$ = { edgeTypeStr: c[p], label: c[p - 1] }; + break; + case 18: + const A = parseInt(c[p]), O = w.generateId(); + this.$ = { id: O, type: "space", label: "", width: A, children: [] }; + break; + case 23: + w.getLogger().debug("Rule: (nodeStatement link node) ", c[p - 2], c[p - 1], c[p], " typestr: ", c[p - 1].edgeTypeStr); + const X = w.edgeStrToEdgeData(c[p - 1].edgeTypeStr); + this.$ = [ + { id: c[p - 2].id, label: c[p - 2].label, type: c[p - 2].type, directions: c[p - 2].directions }, + { id: c[p - 2].id + "-" + c[p].id, start: c[p - 2].id, end: c[p].id, label: c[p - 1].label, type: "edge", directions: c[p].directions, arrowTypeEnd: X, arrowTypeStart: "arrow_open" }, + { id: c[p].id, label: c[p].label, type: w.typeStr2Type(c[p].typeStr), directions: c[p].directions } + ]; + break; + case 24: + w.getLogger().debug("Rule: nodeStatement (abc88 node size) ", c[p - 1], c[p]), this.$ = { id: c[p - 1].id, label: c[p - 1].label, type: w.typeStr2Type(c[p - 1].typeStr), directions: c[p - 1].directions, widthInColumns: parseInt(c[p], 10) }; + break; + case 25: + w.getLogger().debug("Rule: nodeStatement (node) ", c[p]), this.$ = { id: c[p].id, label: c[p].label, type: w.typeStr2Type(c[p].typeStr), directions: c[p].directions, widthInColumns: 1 }; + break; + case 26: + w.getLogger().debug("APA123", this ? this : "na"), w.getLogger().debug("COLUMNS: ", c[p]), this.$ = { type: "column-setting", columns: c[p] === "auto" ? -1 : parseInt(c[p]) }; + break; + case 27: + w.getLogger().debug("Rule: id-block statement : ", c[p - 2], c[p - 1]), w.generateId(), this.$ = { ...c[p - 2], type: "composite", children: c[p - 1] }; + break; + case 28: + w.getLogger().debug("Rule: blockStatement : ", c[p - 2], c[p - 1], c[p]); + const W = w.generateId(); + this.$ = { id: W, type: "composite", label: "", children: c[p - 1] }; + break; + case 29: + w.getLogger().debug("Rule: node (NODE_ID separator): ", c[p]), this.$ = { id: c[p] }; + break; + case 30: + w.getLogger().debug("Rule: node (NODE_ID nodeShapeNLabel separator): ", c[p - 1], c[p]), this.$ = { id: c[p - 1], label: c[p].label, typeStr: c[p].typeStr, directions: c[p].directions }; + break; + case 31: + w.getLogger().debug("Rule: dirList: ", c[p]), this.$ = [c[p]]; + break; + case 32: + w.getLogger().debug("Rule: dirList: ", c[p - 1], c[p]), this.$ = [c[p - 1]].concat(c[p]); + break; + case 33: + w.getLogger().debug("Rule: nodeShapeNLabel: ", c[p - 2], c[p - 1], c[p]), this.$ = { typeStr: c[p - 2] + c[p], label: c[p - 1] }; + break; + case 34: + w.getLogger().debug("Rule: BLOCK_ARROW nodeShapeNLabel: ", c[p - 3], c[p - 2], " #3:", c[p - 1], c[p]), this.$ = { typeStr: c[p - 3] + c[p], label: c[p - 2], directions: c[p - 1] }; + break; + case 35: + case 36: + this.$ = { type: "classDef", id: c[p - 1].trim(), css: c[p].trim() }; + break; + case 37: + this.$ = { type: "applyClass", id: c[p - 1].trim(), styleClass: c[p].trim() }; + break; + case 38: + this.$ = { type: "applyStyles", id: c[p - 1].trim(), stylesStr: c[p].trim() }; + break; + } + }, "anonymous"), + table: [{ 9: 1, 10: [1, 2] }, { 1: [3] }, { 11: 3, 13: 4, 19: 5, 20: 6, 21: t, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }, { 8: [1, 20] }, e(f, [2, 12], { 13: 4, 19: 5, 20: 6, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 11: 21, 21: t, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }), e(h, [2, 16], { 14: 22, 15: y, 16: b }), e(h, [2, 17]), e(h, [2, 18]), e(h, [2, 19]), e(h, [2, 20]), e(h, [2, 21]), e(h, [2, 22]), e(m, [2, 25], { 27: [1, 25] }), e(h, [2, 26]), { 19: 26, 26: 12, 32: a }, { 11: 27, 13: 4, 19: 5, 20: 6, 21: t, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }, { 41: [1, 28], 43: [1, 29] }, { 45: [1, 30] }, { 48: [1, 31] }, e(E, [2, 29], { 33: 32, 36: [1, 33], 38: [1, 34] }), { 1: [2, 7] }, e(f, [2, 13]), { 26: 35, 32: a }, { 32: [2, 14] }, { 17: [1, 36] }, e(m, [2, 24]), { 11: 37, 13: 4, 14: 22, 15: y, 16: b, 19: 5, 20: 6, 21: t, 22: 8, 23: 9, 24: 10, 25: 11, 26: 12, 28: r, 29: n, 31: i, 32: a, 40: s, 44: l, 47: o }, { 30: [1, 38] }, { 42: [1, 39] }, { 42: [1, 40] }, { 46: [1, 41] }, { 49: [1, 42] }, e(E, [2, 30]), { 18: [1, 43] }, { 18: [1, 44] }, e(m, [2, 23]), { 18: [1, 45] }, { 30: [1, 46] }, e(h, [2, 28]), e(h, [2, 35]), e(h, [2, 36]), e(h, [2, 37]), e(h, [2, 38]), { 37: [1, 47] }, { 34: 48, 35: D }, { 15: [1, 50] }, e(h, [2, 27]), e(E, [2, 33]), { 39: [1, 51] }, { 34: 52, 35: D, 39: [2, 31] }, { 32: [2, 15] }, e(E, [2, 34]), { 39: [2, 32] }], + defaultActions: { 20: [2, 7], 23: [2, 14], 50: [2, 15], 52: [2, 32] }, + parseError: /* @__PURE__ */ d(function(x, g) { + if (g.recoverable) + this.trace(x); + else { + var u = new Error(x); + throw u.hash = g, u; + } + }, "parseError"), + parse: /* @__PURE__ */ d(function(x) { + var g = this, u = [0], w = [], S = [null], c = [], _ = this.table, p = "", A = 0, O = 0, X = 2, W = 1, ce = c.slice.call(arguments, 1), M = Object.create(this.lexer), J = { yy: {} }; + for (var gt in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, gt) && (J.yy[gt] = this.yy[gt]); + M.setInput(x, J.yy), J.yy.lexer = M, J.yy.parser = this, typeof M.yylloc > "u" && (M.yylloc = {}); + var ut = M.yylloc; + c.push(ut); + var oe = M.options && M.options.ranges; + typeof J.yy.parseError == "function" ? this.parseError = J.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function he(H) { + u.length = u.length - 2 * H, S.length = S.length - H, c.length = c.length - H; + } + d(he, "popStack"); + function Dt() { + var H; + return H = w.pop() || M.lex() || W, typeof H != "number" && (H instanceof Array && (w = H, H = w.pop()), H = g.symbols_[H] || H), H; + } + d(Dt, "lex"); + for (var Y, Q, U, pt, $ = {}, st, q, Nt, it; ; ) { + if (Q = u[u.length - 1], this.defaultActions[Q] ? U = this.defaultActions[Q] : ((Y === null || typeof Y > "u") && (Y = Dt()), U = _[Q] && _[Q][Y]), typeof U > "u" || !U.length || !U[0]) { + var ft = ""; + it = []; + for (st in _[Q]) + this.terminals_[st] && st > X && it.push("'" + this.terminals_[st] + "'"); + M.showPosition ? ft = "Parse error on line " + (A + 1) + `: +` + M.showPosition() + ` +Expecting ` + it.join(", ") + ", got '" + (this.terminals_[Y] || Y) + "'" : ft = "Parse error on line " + (A + 1) + ": Unexpected " + (Y == W ? "end of input" : "'" + (this.terminals_[Y] || Y) + "'"), this.parseError(ft, { + text: M.match, + token: this.terminals_[Y] || Y, + line: M.yylineno, + loc: ut, + expected: it + }); + } + if (U[0] instanceof Array && U.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + Q + ", token: " + Y); + switch (U[0]) { + case 1: + u.push(Y), S.push(M.yytext), c.push(M.yylloc), u.push(U[1]), Y = null, O = M.yyleng, p = M.yytext, A = M.yylineno, ut = M.yylloc; + break; + case 2: + if (q = this.productions_[U[1]][1], $.$ = S[S.length - q], $._$ = { + first_line: c[c.length - (q || 1)].first_line, + last_line: c[c.length - 1].last_line, + first_column: c[c.length - (q || 1)].first_column, + last_column: c[c.length - 1].last_column + }, oe && ($._$.range = [ + c[c.length - (q || 1)].range[0], + c[c.length - 1].range[1] + ]), pt = this.performAction.apply($, [ + p, + O, + A, + J.yy, + U[1], + S, + c + ].concat(ce)), typeof pt < "u") + return pt; + q && (u = u.slice(0, -1 * q * 2), S = S.slice(0, -1 * q), c = c.slice(0, -1 * q)), u.push(this.productions_[U[1]][0]), S.push($.$), c.push($._$), Nt = _[u[u.length - 2]][u[u.length - 1]], u.push(Nt); + break; + case 3: + return !0; + } + } + return !0; + }, "parse") + }, T = /* @__PURE__ */ function() { + var N = { + EOF: 1, + parseError: /* @__PURE__ */ d(function(g, u) { + if (this.yy.parser) + this.yy.parser.parseError(g, u); + else + throw new Error(g); + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ d(function(x, g) { + return this.yy = g || this.yy || {}, this._input = x, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ d(function() { + var x = this._input[0]; + this.yytext += x, this.yyleng++, this.offset++, this.match += x, this.matched += x; + var g = x.match(/(?:\r\n?|\n).*/g); + return g ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), x; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ d(function(x) { + var g = x.length, u = x.split(/(?:\r\n?|\n)/g); + this._input = x + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - g), this.offset -= g; + var w = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), u.length - 1 && (this.yylineno -= u.length - 1); + var S = this.yylloc.range; + return this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: u ? (u.length === w.length ? this.yylloc.first_column : 0) + w[w.length - u.length].length - u[0].length : this.yylloc.first_column - g + }, this.options.ranges && (this.yylloc.range = [S[0], S[0] + this.yyleng - g]), this.yyleng = this.yytext.length, this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ d(function() { + return this._more = !0, this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ d(function() { + if (this.options.backtrack_lexer) + this._backtrack = !0; + else + return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ d(function(x) { + this.unput(this.match.slice(x)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ d(function() { + var x = this.matched.substr(0, this.matched.length - this.match.length); + return (x.length > 20 ? "..." : "") + x.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ d(function() { + var x = this.match; + return x.length < 20 && (x += this._input.substr(0, 20 - x.length)), (x.substr(0, 20) + (x.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ d(function() { + var x = this.pastInput(), g = new Array(x.length + 1).join("-"); + return x + this.upcomingInput() + ` +` + g + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ d(function(x, g) { + var u, w, S; + if (this.options.backtrack_lexer && (S = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }, this.options.ranges && (S.yylloc.range = this.yylloc.range.slice(0))), w = x[0].match(/(?:\r\n?|\n).*/g), w && (this.yylineno += w.length), this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: w ? w[w.length - 1].length - w[w.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + x[0].length + }, this.yytext += x[0], this.match += x[0], this.matches = x, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(x[0].length), this.matched += x[0], u = this.performAction.call(this, this.yy, this, g, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), u) + return u; + if (this._backtrack) { + for (var c in S) + this[c] = S[c]; + return !1; + } + return !1; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ d(function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var x, g, u, w; + this._more || (this.yytext = "", this.match = ""); + for (var S = this._currentRules(), c = 0; c < S.length; c++) + if (u = this._input.match(this.rules[S[c]]), u && (!g || u[0].length > g[0].length)) { + if (g = u, w = c, this.options.backtrack_lexer) { + if (x = this.test_match(u, S[c]), x !== !1) + return x; + if (this._backtrack) { + g = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return g ? (x = this.test_match(g, S[w]), x !== !1 ? x : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ d(function() { + var g = this.next(); + return g || this.lex(); + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ d(function(g) { + this.conditionStack.push(g); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ d(function() { + var g = this.conditionStack.length - 1; + return g > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ d(function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ d(function(g) { + return g = this.conditionStack.length - 1 - Math.abs(g || 0), g >= 0 ? this.conditionStack[g] : "INITIAL"; + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ d(function(g) { + this.begin(g); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ d(function() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ d(function(g, u, w, S) { + switch (w) { + case 0: + return 10; + case 1: + return g.getLogger().debug("Found space-block"), 31; + case 2: + return g.getLogger().debug("Found nl-block"), 31; + case 3: + return g.getLogger().debug("Found space-block"), 29; + case 4: + g.getLogger().debug(".", u.yytext); + break; + case 5: + g.getLogger().debug("_", u.yytext); + break; + case 6: + return 5; + case 7: + return u.yytext = -1, 28; + case 8: + return u.yytext = u.yytext.replace(/columns\s+/, ""), g.getLogger().debug("COLUMNS (LEX)", u.yytext), 28; + case 9: + this.pushState("md_string"); + break; + case 10: + return "MD_STR"; + case 11: + this.popState(); + break; + case 12: + this.pushState("string"); + break; + case 13: + g.getLogger().debug("LEX: POPPING STR:", u.yytext), this.popState(); + break; + case 14: + return g.getLogger().debug("LEX: STR end:", u.yytext), "STR"; + case 15: + return u.yytext = u.yytext.replace(/space\:/, ""), g.getLogger().debug("SPACE NUM (LEX)", u.yytext), 21; + case 16: + return u.yytext = "1", g.getLogger().debug("COLUMNS (LEX)", u.yytext), 21; + case 17: + return 43; + case 18: + return "LINKSTYLE"; + case 19: + return "INTERPOLATE"; + case 20: + return this.pushState("CLASSDEF"), 40; + case 21: + return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID"; + case 22: + return this.popState(), this.pushState("CLASSDEFID"), 41; + case 23: + return this.popState(), 42; + case 24: + return this.pushState("CLASS"), 44; + case 25: + return this.popState(), this.pushState("CLASS_STYLE"), 45; + case 26: + return this.popState(), 46; + case 27: + return this.pushState("STYLE_STMNT"), 47; + case 28: + return this.popState(), this.pushState("STYLE_DEFINITION"), 48; + case 29: + return this.popState(), 49; + case 30: + return this.pushState("acc_title"), "acc_title"; + case 31: + return this.popState(), "acc_title_value"; + case 32: + return this.pushState("acc_descr"), "acc_descr"; + case 33: + return this.popState(), "acc_descr_value"; + case 34: + this.pushState("acc_descr_multiline"); + break; + case 35: + this.popState(); + break; + case 36: + return "acc_descr_multiline_value"; + case 37: + return 30; + case 38: + return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND"; + case 39: + return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND"; + case 40: + return this.popState(), g.getLogger().debug("Lex: ))"), "NODE_DEND"; + case 41: + return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND"; + case 42: + return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND"; + case 43: + return this.popState(), g.getLogger().debug("Lex: (-"), "NODE_DEND"; + case 44: + return this.popState(), g.getLogger().debug("Lex: -)"), "NODE_DEND"; + case 45: + return this.popState(), g.getLogger().debug("Lex: (("), "NODE_DEND"; + case 46: + return this.popState(), g.getLogger().debug("Lex: ]]"), "NODE_DEND"; + case 47: + return this.popState(), g.getLogger().debug("Lex: ("), "NODE_DEND"; + case 48: + return this.popState(), g.getLogger().debug("Lex: ])"), "NODE_DEND"; + case 49: + return this.popState(), g.getLogger().debug("Lex: /]"), "NODE_DEND"; + case 50: + return this.popState(), g.getLogger().debug("Lex: /]"), "NODE_DEND"; + case 51: + return this.popState(), g.getLogger().debug("Lex: )]"), "NODE_DEND"; + case 52: + return this.popState(), g.getLogger().debug("Lex: )"), "NODE_DEND"; + case 53: + return this.popState(), g.getLogger().debug("Lex: ]>"), "NODE_DEND"; + case 54: + return this.popState(), g.getLogger().debug("Lex: ]"), "NODE_DEND"; + case 55: + return g.getLogger().debug("Lexa: -)"), this.pushState("NODE"), 36; + case 56: + return g.getLogger().debug("Lexa: (-"), this.pushState("NODE"), 36; + case 57: + return g.getLogger().debug("Lexa: ))"), this.pushState("NODE"), 36; + case 58: + return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36; + case 59: + return g.getLogger().debug("Lex: ((("), this.pushState("NODE"), 36; + case 60: + return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36; + case 61: + return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36; + case 62: + return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36; + case 63: + return g.getLogger().debug("Lexc: >"), this.pushState("NODE"), 36; + case 64: + return g.getLogger().debug("Lexa: (["), this.pushState("NODE"), 36; + case 65: + return g.getLogger().debug("Lexa: )"), this.pushState("NODE"), 36; + case 66: + return this.pushState("NODE"), 36; + case 67: + return this.pushState("NODE"), 36; + case 68: + return this.pushState("NODE"), 36; + case 69: + return this.pushState("NODE"), 36; + case 70: + return this.pushState("NODE"), 36; + case 71: + return this.pushState("NODE"), 36; + case 72: + return this.pushState("NODE"), 36; + case 73: + return g.getLogger().debug("Lexa: ["), this.pushState("NODE"), 36; + case 74: + return this.pushState("BLOCK_ARROW"), g.getLogger().debug("LEX ARR START"), 38; + case 75: + return g.getLogger().debug("Lex: NODE_ID", u.yytext), 32; + case 76: + return g.getLogger().debug("Lex: EOF", u.yytext), 8; + case 77: + this.pushState("md_string"); + break; + case 78: + this.pushState("md_string"); + break; + case 79: + return "NODE_DESCR"; + case 80: + this.popState(); + break; + case 81: + g.getLogger().debug("Lex: Starting string"), this.pushState("string"); + break; + case 82: + g.getLogger().debug("LEX ARR: Starting string"), this.pushState("string"); + break; + case 83: + return g.getLogger().debug("LEX: NODE_DESCR:", u.yytext), "NODE_DESCR"; + case 84: + g.getLogger().debug("LEX POPPING"), this.popState(); + break; + case 85: + g.getLogger().debug("Lex: =>BAE"), this.pushState("ARROW_DIR"); + break; + case 86: + return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (right): dir:", u.yytext), "DIR"; + case 87: + return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (left):", u.yytext), "DIR"; + case 88: + return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (x):", u.yytext), "DIR"; + case 89: + return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (y):", u.yytext), "DIR"; + case 90: + return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (up):", u.yytext), "DIR"; + case 91: + return u.yytext = u.yytext.replace(/^,\s*/, ""), g.getLogger().debug("Lex (down):", u.yytext), "DIR"; + case 92: + return u.yytext = "]>", g.getLogger().debug("Lex (ARROW_DIR end):", u.yytext), this.popState(), this.popState(), "BLOCK_ARROW_END"; + case 93: + return g.getLogger().debug("Lex: LINK", "#" + u.yytext + "#"), 15; + case 94: + return g.getLogger().debug("Lex: LINK", u.yytext), 15; + case 95: + return g.getLogger().debug("Lex: LINK", u.yytext), 15; + case 96: + return g.getLogger().debug("Lex: LINK", u.yytext), 15; + case 97: + return g.getLogger().debug("Lex: START_LINK", u.yytext), this.pushState("LLABEL"), 16; + case 98: + return g.getLogger().debug("Lex: START_LINK", u.yytext), this.pushState("LLABEL"), 16; + case 99: + return g.getLogger().debug("Lex: START_LINK", u.yytext), this.pushState("LLABEL"), 16; + case 100: + this.pushState("md_string"); + break; + case 101: + return g.getLogger().debug("Lex: Starting string"), this.pushState("string"), "LINK_LABEL"; + case 102: + return this.popState(), g.getLogger().debug("Lex: LINK", "#" + u.yytext + "#"), 15; + case 103: + return this.popState(), g.getLogger().debug("Lex: LINK", u.yytext), 15; + case 104: + return this.popState(), g.getLogger().debug("Lex: LINK", u.yytext), 15; + case 105: + return g.getLogger().debug("Lex: COLON", u.yytext), u.yytext = u.yytext.slice(1), 27; + } + }, "anonymous"), + rules: [/^(?:block-beta\b)/, /^(?:block\s+)/, /^(?:block\n+)/, /^(?:block:)/, /^(?:[\s]+)/, /^(?:[\n]+)/, /^(?:((\u000D\u000A)|(\u000A)))/, /^(?:columns\s+auto\b)/, /^(?:columns\s+[\d]+)/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:space[:]\d+)/, /^(?:space\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\s+)/, /^(?:DEFAULT\s+)/, /^(?:\w+\s+)/, /^(?:[^\n]*)/, /^(?:class\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:style\s+)/, /^(?:(\w+)+((,\s*\w+)*))/, /^(?:[^\n]*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:end\b\s*)/, /^(?:\(\(\()/, /^(?:\)\)\))/, /^(?:[\)]\))/, /^(?:\}\})/, /^(?:\})/, /^(?:\(-)/, /^(?:-\))/, /^(?:\(\()/, /^(?:\]\])/, /^(?:\()/, /^(?:\]\))/, /^(?:\\\])/, /^(?:\/\])/, /^(?:\)\])/, /^(?:[\)])/, /^(?:\]>)/, /^(?:[\]])/, /^(?:-\))/, /^(?:\(-)/, /^(?:\)\))/, /^(?:\))/, /^(?:\(\(\()/, /^(?:\(\()/, /^(?:\{\{)/, /^(?:\{)/, /^(?:>)/, /^(?:\(\[)/, /^(?:\()/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\[\\)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:\[)/, /^(?:<\[)/, /^(?:[^\(\[\n\-\)\{\}\s\<\>:]+)/, /^(?:$)/, /^(?:["][`])/, /^(?:["][`])/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["])/, /^(?:["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:\]>\s*\()/, /^(?:,?\s*right\s*)/, /^(?:,?\s*left\s*)/, /^(?:,?\s*x\s*)/, /^(?:,?\s*y\s*)/, /^(?:,?\s*up\s*)/, /^(?:,?\s*down\s*)/, /^(?:\)\s*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*~~[\~]+\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:["][`])/, /^(?:["])/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?::\d+)/], + conditions: { STYLE_DEFINITION: { rules: [29], inclusive: !1 }, STYLE_STMNT: { rules: [28], inclusive: !1 }, CLASSDEFID: { rules: [23], inclusive: !1 }, CLASSDEF: { rules: [21, 22], inclusive: !1 }, CLASS_STYLE: { rules: [26], inclusive: !1 }, CLASS: { rules: [25], inclusive: !1 }, LLABEL: { rules: [100, 101, 102, 103, 104], inclusive: !1 }, ARROW_DIR: { rules: [86, 87, 88, 89, 90, 91, 92], inclusive: !1 }, BLOCK_ARROW: { rules: [77, 82, 85], inclusive: !1 }, NODE: { rules: [38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 78, 81], inclusive: !1 }, md_string: { rules: [10, 11, 79, 80], inclusive: !1 }, space: { rules: [], inclusive: !1 }, string: { rules: [13, 14, 83, 84], inclusive: !1 }, acc_descr_multiline: { rules: [35, 36], inclusive: !1 }, acc_descr: { rules: [33], inclusive: !1 }, acc_title: { rules: [31], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 15, 16, 17, 18, 19, 20, 24, 27, 30, 32, 34, 37, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 93, 94, 95, 96, 97, 98, 99, 105], inclusive: !0 } } + }; + return N; + }(); + v.lexer = T; + function k() { + this.yy = {}; + } + return d(k, "Parser"), k.prototype = v, v.Parser = k, new k(); +}(); +yt.parser = yt; +var Ee = yt, V = /* @__PURE__ */ new Map(), St = [], bt = /* @__PURE__ */ new Map(), Ct = "color", Bt = "fill", _e = "bgFill", Ht = ",", ke = z(), ct = /* @__PURE__ */ new Map(), De = /* @__PURE__ */ d((e) => me.sanitizeText(e, ke), "sanitizeText"), Ne = /* @__PURE__ */ d(function(e, t = "") { + let r = ct.get(e); + r || (r = { id: e, styles: [], textStyles: [] }, ct.set(e, r)), t != null && t.split(Ht).forEach((n) => { + const i = n.replace(/([^;]*);/, "$1").trim(); + if (RegExp(Ct).exec(n)) { + const s = i.replace(Bt, _e).replace(Ct, Bt); + r.textStyles.push(s); + } + r.styles.push(i); + }); +}, "addStyleClass"), Te = /* @__PURE__ */ d(function(e, t = "") { + const r = V.get(e); + t != null && (r.styles = t.split(Ht)); +}, "addStyle2Node"), Ce = /* @__PURE__ */ d(function(e, t) { + e.split(",").forEach(function(r) { + let n = V.get(r); + if (n === void 0) { + const i = r.trim(); + n = { id: i, type: "na", children: [] }, V.set(i, n); + } + n.classes || (n.classes = []), n.classes.push(t); + }); +}, "setCssClass"), Kt = /* @__PURE__ */ d((e, t) => { + const r = e.flat(), n = []; + for (const i of r) { + if (i.label && (i.label = De(i.label)), i.type === "classDef") { + Ne(i.id, i.css); + continue; + } + if (i.type === "applyClass") { + Ce(i.id, (i == null ? void 0 : i.styleClass) ?? ""); + continue; + } + if (i.type === "applyStyles") { + i != null && i.stylesStr && Te(i.id, i == null ? void 0 : i.stylesStr); + continue; + } + if (i.type === "column-setting") + t.columns = i.columns ?? -1; + else if (i.type === "edge") { + const a = (bt.get(i.id) ?? 0) + 1; + bt.set(i.id, a), i.id = a + "-" + i.id, St.push(i); + } else { + i.label || (i.type === "composite" ? i.label = "" : i.label = i.id); + const a = V.get(i.id); + if (a === void 0 ? V.set(i.id, i) : (i.type !== "na" && (a.type = i.type), i.label !== i.id && (a.label = i.label)), i.children && Kt(i.children, i), i.type === "space") { + const s = i.width ?? 1; + for (let l = 0; l < s; l++) { + const o = Le(i); + o.id = o.id + "-" + l, V.set(o.id, o), n.push(o); + } + } else a === void 0 && n.push(i); + } + } + t.children = n; +}, "populateBlockDatabase"), vt = [], rt = { id: "root", type: "composite", children: [], columns: -1 }, Be = /* @__PURE__ */ d(() => { + L.debug("Clear called"), xe(), rt = { id: "root", type: "composite", children: [], columns: -1 }, V = /* @__PURE__ */ new Map([["root", rt]]), vt = [], ct = /* @__PURE__ */ new Map(), St = [], bt = /* @__PURE__ */ new Map(); +}, "clear"); +function Xt(e) { + switch (L.debug("typeStr2Type", e), e) { + case "[]": + return "square"; + case "()": + return L.debug("we have a round"), "round"; + case "(())": + return "circle"; + case ">]": + return "rect_left_inv_arrow"; + case "{}": + return "diamond"; + case "{{}}": + return "hexagon"; + case "([])": + return "stadium"; + case "[[]]": + return "subroutine"; + case "[()]": + return "cylinder"; + case "((()))": + return "doublecircle"; + case "[//]": + return "lean_right"; + case "[\\\\]": + return "lean_left"; + case "[/\\]": + return "trapezoid"; + case "[\\/]": + return "inv_trapezoid"; + case "<[]>": + return "block_arrow"; + default: + return "na"; + } +} +d(Xt, "typeStr2Type"); +function Ut(e) { + switch (L.debug("typeStr2Type", e), e) { + case "==": + return "thick"; + default: + return "normal"; + } +} +d(Ut, "edgeTypeStr2Type"); +function jt(e) { + switch (e.trim()) { + case "--x": + return "arrow_cross"; + case "--o": + return "arrow_circle"; + default: + return "arrow_point"; + } +} +d(jt, "edgeStrToEdgeData"); +var It = 0, Ie = /* @__PURE__ */ d(() => (It++, "id-" + Math.random().toString(36).substr(2, 12) + "-" + It), "generateId"), Oe = /* @__PURE__ */ d((e) => { + rt.children = e, Kt(e, rt), vt = rt.children; +}, "setHierarchy"), Re = /* @__PURE__ */ d((e) => { + const t = V.get(e); + return t ? t.columns ? t.columns : t.children ? t.children.length : -1 : -1; +}, "getColumns"), ze = /* @__PURE__ */ d(() => [...V.values()], "getBlocksFlat"), Ae = /* @__PURE__ */ d(() => vt || [], "getBlocks"), Me = /* @__PURE__ */ d(() => St, "getEdges"), Fe = /* @__PURE__ */ d((e) => V.get(e), "getBlock"), We = /* @__PURE__ */ d((e) => { + V.set(e.id, e); +}, "setBlock"), Pe = /* @__PURE__ */ d(() => console, "getLogger"), Ye = /* @__PURE__ */ d(function() { + return ct; +}, "getClasses"), He = { + getConfig: /* @__PURE__ */ d(() => at().block, "getConfig"), + typeStr2Type: Xt, + edgeTypeStr2Type: Ut, + edgeStrToEdgeData: jt, + getLogger: Pe, + getBlocksFlat: ze, + getBlocks: Ae, + getEdges: Me, + setHierarchy: Oe, + getBlock: Fe, + setBlock: We, + getColumns: Re, + getClasses: Ye, + clear: Be, + generateId: Ie +}, Ke = He, nt = /* @__PURE__ */ d((e, t) => { + const r = ve, n = r(e, "r"), i = r(e, "g"), a = r(e, "b"); + return ye(n, i, a, t); +}, "fade"), Xe = /* @__PURE__ */ d((e) => `.label { + font-family: ${e.fontFamily}; + color: ${e.nodeTextColor || e.textColor}; + } + .cluster-label text { + fill: ${e.titleColor}; + } + .cluster-label span,p { + color: ${e.titleColor}; + } + + + + .label text,span,p { + fill: ${e.nodeTextColor || e.textColor}; + color: ${e.nodeTextColor || e.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; + stroke-width: 1px; + } + .flowchart-label text { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + .arrowheadPath { + fill: ${e.arrowheadColor}; + } + + .edgePath .path { + stroke: ${e.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${e.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${e.edgeLabelBackground}; + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${nt(e.edgeLabelBackground, 0.5)}; + // background-color: + } + + .node .cluster { + // fill: ${nt(e.mainBkg, 0.5)}; + fill: ${nt(e.clusterBkg, 0.5)}; + stroke: ${nt(e.clusterBorder, 0.2)}; + box-shadow: rgba(50, 50, 93, 0.25) 0px 13px 27px -5px, rgba(0, 0, 0, 0.3) 0px 8px 16px -8px; + stroke-width: 1px; + } + + .cluster text { + fill: ${e.titleColor}; + } + + .cluster span,p { + color: ${e.titleColor}; + } + /* .cluster div { + color: ${e.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${e.fontFamily}; + font-size: 12px; + background: ${e.tertiaryColor}; + border: 1px solid ${e.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; + } +`, "getStyles"), Ue = Xe, je = /* @__PURE__ */ d((e, t, r, n) => { + t.forEach((i) => { + rr[i](e, r, n); + }); +}, "insertMarkers"), Ve = /* @__PURE__ */ d((e, t, r) => { + L.trace("Making markers for ", r), e.append("defs").append("marker").attr("id", r + "_" + t + "-extensionStart").attr("class", "marker extension " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 1,7 L18,13 V 1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-extensionEnd").attr("class", "marker extension " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 1,1 V 13 L18,7 Z"); +}, "extension"), Ge = /* @__PURE__ */ d((e, t, r) => { + e.append("defs").append("marker").attr("id", r + "_" + t + "-compositionStart").attr("class", "marker composition " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-compositionEnd").attr("class", "marker composition " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); +}, "composition"), Ze = /* @__PURE__ */ d((e, t, r) => { + e.append("defs").append("marker").attr("id", r + "_" + t + "-aggregationStart").attr("class", "marker aggregation " + t).attr("refX", 18).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-aggregationEnd").attr("class", "marker aggregation " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L1,7 L9,1 Z"); +}, "aggregation"), qe = /* @__PURE__ */ d((e, t, r) => { + e.append("defs").append("marker").attr("id", r + "_" + t + "-dependencyStart").attr("class", "marker dependency " + t).attr("refX", 6).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("path").attr("d", "M 5,7 L9,13 L1,7 L9,1 Z"), e.append("defs").append("marker").attr("id", r + "_" + t + "-dependencyEnd").attr("class", "marker dependency " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z"); +}, "dependency"), Je = /* @__PURE__ */ d((e, t, r) => { + e.append("defs").append("marker").attr("id", r + "_" + t + "-lollipopStart").attr("class", "marker lollipop " + t).attr("refX", 13).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6), e.append("defs").append("marker").attr("id", r + "_" + t + "-lollipopEnd").attr("class", "marker lollipop " + t).attr("refX", 1).attr("refY", 7).attr("markerWidth", 190).attr("markerHeight", 240).attr("orient", "auto").append("circle").attr("stroke", "black").attr("fill", "transparent").attr("cx", 7).attr("cy", 7).attr("r", 6); +}, "lollipop"), Qe = /* @__PURE__ */ d((e, t, r) => { + e.append("marker").attr("id", r + "_" + t + "-pointEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 6).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", r + "_" + t + "-pointStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 4.5).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 5 L 10 10 L 10 0 z").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); +}, "point"), $e = /* @__PURE__ */ d((e, t, r) => { + e.append("marker").attr("id", r + "_" + t + "-circleEnd").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", 11).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", r + "_" + t + "-circleStart").attr("class", "marker " + t).attr("viewBox", "0 0 10 10").attr("refX", -1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("circle").attr("cx", "5").attr("cy", "5").attr("r", "5").attr("class", "arrowMarkerPath").style("stroke-width", 1).style("stroke-dasharray", "1,0"); +}, "circle"), tr = /* @__PURE__ */ d((e, t, r) => { + e.append("marker").attr("id", r + "_" + t + "-crossEnd").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", 12).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"), e.append("marker").attr("id", r + "_" + t + "-crossStart").attr("class", "marker cross " + t).attr("viewBox", "0 0 11 11").attr("refX", -1).attr("refY", 5.2).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 11).attr("markerHeight", 11).attr("orient", "auto").append("path").attr("d", "M 1,1 l 9,9 M 10,1 l -9,9").attr("class", "arrowMarkerPath").style("stroke-width", 2).style("stroke-dasharray", "1,0"); +}, "cross"), er = /* @__PURE__ */ d((e, t, r) => { + e.append("defs").append("marker").attr("id", r + "_" + t + "-barbEnd").attr("refX", 19).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 14).attr("markerUnits", "strokeWidth").attr("orient", "auto").append("path").attr("d", "M 19,7 L9,13 L14,7 L9,1 Z"); +}, "barb"), rr = { + extension: Ve, + composition: Ge, + aggregation: Ze, + dependency: qe, + lollipop: Je, + point: Qe, + circle: $e, + cross: tr, + barb: er +}, ar = je, Wt, Pt, I = ((Pt = (Wt = z()) == null ? void 0 : Wt.block) == null ? void 0 : Pt.padding) ?? 8; +function Vt(e, t) { + if (e === 0 || !Number.isInteger(e)) + throw new Error("Columns must be an integer !== 0."); + if (t < 0 || !Number.isInteger(t)) + throw new Error("Position must be a non-negative integer." + t); + if (e < 0) + return { px: t, py: 0 }; + if (e === 1) + return { px: 0, py: t }; + const r = t % e, n = Math.floor(t / e); + return { px: r, py: n }; +} +d(Vt, "calculateBlockPosition"); +var sr = /* @__PURE__ */ d((e) => { + let t = 0, r = 0; + for (const n of e.children) { + const { width: i, height: a, x: s, y: l } = n.size ?? { width: 0, height: 0, x: 0, y: 0 }; + L.debug( + "getMaxChildSize abc95 child:", + n.id, + "width:", + i, + "height:", + a, + "x:", + s, + "y:", + l, + n.type + ), n.type !== "space" && (i > t && (t = i / (e.widthInColumns ?? 1)), a > r && (r = a)); + } + return { width: t, height: r }; +}, "getMaxChildSize"); +function ot(e, t, r = 0, n = 0) { + var s, l, o, f, h, y, b, m, E, D, v; + L.debug( + "setBlockSizes abc95 (start)", + e.id, + (s = e == null ? void 0 : e.size) == null ? void 0 : s.x, + "block width =", + e == null ? void 0 : e.size, + "sieblingWidth", + r + ), (l = e == null ? void 0 : e.size) != null && l.width || (e.size = { + width: r, + height: n, + x: 0, + y: 0 + }); + let i = 0, a = 0; + if (((o = e.children) == null ? void 0 : o.length) > 0) { + for (const S of e.children) + ot(S, t); + const T = sr(e); + i = T.width, a = T.height, L.debug("setBlockSizes abc95 maxWidth of", e.id, ":s children is ", i, a); + for (const S of e.children) + S.size && (L.debug( + `abc95 Setting size of children of ${e.id} id=${S.id} ${i} ${a} ${JSON.stringify(S.size)}` + ), S.size.width = i * (S.widthInColumns ?? 1) + I * ((S.widthInColumns ?? 1) - 1), S.size.height = a, S.size.x = 0, S.size.y = 0, L.debug( + `abc95 updating size of ${e.id} children child:${S.id} maxWidth:${i} maxHeight:${a}` + )); + for (const S of e.children) + ot(S, t, i, a); + const k = e.columns ?? -1; + let N = 0; + for (const S of e.children) + N += S.widthInColumns ?? 1; + let x = e.children.length; + k > 0 && k < N && (x = k); + const g = Math.ceil(N / x); + let u = x * (i + I) + I, w = g * (a + I) + I; + if (u < r) { + L.debug( + `Detected to small siebling: abc95 ${e.id} sieblingWidth ${r} sieblingHeight ${n} width ${u}` + ), u = r, w = n; + const S = (r - x * I - I) / x, c = (n - g * I - I) / g; + L.debug("Size indata abc88", e.id, "childWidth", S, "maxWidth", i), L.debug("Size indata abc88", e.id, "childHeight", c, "maxHeight", a), L.debug("Size indata abc88 xSize", x, "padding", I); + for (const _ of e.children) + _.size && (_.size.width = S, _.size.height = c, _.size.x = 0, _.size.y = 0); + } + if (L.debug( + `abc95 (finale calc) ${e.id} xSize ${x} ySize ${g} columns ${k}${e.children.length} width=${Math.max(u, ((f = e.size) == null ? void 0 : f.width) || 0)}` + ), u < (((h = e == null ? void 0 : e.size) == null ? void 0 : h.width) || 0)) { + u = ((y = e == null ? void 0 : e.size) == null ? void 0 : y.width) || 0; + const S = k > 0 ? Math.min(e.children.length, k) : e.children.length; + if (S > 0) { + const c = (u - S * I - I) / S; + L.debug("abc95 (growing to fit) width", e.id, u, (b = e.size) == null ? void 0 : b.width, c); + for (const _ of e.children) + _.size && (_.size.width = c); + } + } + e.size = { + width: u, + height: w, + x: 0, + y: 0 + }; + } + L.debug( + "setBlockSizes abc94 (done)", + e.id, + (m = e == null ? void 0 : e.size) == null ? void 0 : m.x, + (E = e == null ? void 0 : e.size) == null ? void 0 : E.width, + (D = e == null ? void 0 : e.size) == null ? void 0 : D.y, + (v = e == null ? void 0 : e.size) == null ? void 0 : v.height + ); +} +d(ot, "setBlockSizes"); +function Et(e, t) { + var n, i, a, s, l, o, f, h, y, b, m, E, D, v, T, k, N; + L.debug( + `abc85 layout blocks (=>layoutBlocks) ${e.id} x: ${(n = e == null ? void 0 : e.size) == null ? void 0 : n.x} y: ${(i = e == null ? void 0 : e.size) == null ? void 0 : i.y} width: ${(a = e == null ? void 0 : e.size) == null ? void 0 : a.width}` + ); + const r = e.columns ?? -1; + if (L.debug("layoutBlocks columns abc95", e.id, "=>", r, e), e.children && // find max width of children + e.children.length > 0) { + const x = ((l = (s = e == null ? void 0 : e.children[0]) == null ? void 0 : s.size) == null ? void 0 : l.width) ?? 0, g = e.children.length * x + (e.children.length - 1) * I; + L.debug("widthOfChildren 88", g, "posX"); + let u = 0; + L.debug("abc91 block?.size?.x", e.id, (o = e == null ? void 0 : e.size) == null ? void 0 : o.x); + let w = (f = e == null ? void 0 : e.size) != null && f.x ? ((h = e == null ? void 0 : e.size) == null ? void 0 : h.x) + (-((y = e == null ? void 0 : e.size) == null ? void 0 : y.width) / 2 || 0) : -I, S = 0; + for (const c of e.children) { + const _ = e; + if (!c.size) + continue; + const { width: p, height: A } = c.size, { px: O, py: X } = Vt(r, u); + if (X != S && (S = X, w = (b = e == null ? void 0 : e.size) != null && b.x ? ((m = e == null ? void 0 : e.size) == null ? void 0 : m.x) + (-((E = e == null ? void 0 : e.size) == null ? void 0 : E.width) / 2 || 0) : -I, L.debug("New row in layout for block", e.id, " and child ", c.id, S)), L.debug( + `abc89 layout blocks (child) id: ${c.id} Pos: ${u} (px, py) ${O},${X} (${(D = _ == null ? void 0 : _.size) == null ? void 0 : D.x},${(v = _ == null ? void 0 : _.size) == null ? void 0 : v.y}) parent: ${_.id} width: ${p}${I}` + ), _.size) { + const W = p / 2; + c.size.x = w + I + W, L.debug( + `abc91 layout blocks (calc) px, pyid:${c.id} startingPos=X${w} new startingPosX${c.size.x} ${W} padding=${I} width=${p} halfWidth=${W} => x:${c.size.x} y:${c.size.y} ${c.widthInColumns} (width * (child?.w || 1)) / 2 ${p * ((c == null ? void 0 : c.widthInColumns) ?? 1) / 2}` + ), w = c.size.x + W, c.size.y = _.size.y - _.size.height / 2 + X * (A + I) + A / 2 + I, L.debug( + `abc88 layout blocks (calc) px, pyid:${c.id}startingPosX${w}${I}${W}=>x:${c.size.x}y:${c.size.y}${c.widthInColumns}(width * (child?.w || 1)) / 2${p * ((c == null ? void 0 : c.widthInColumns) ?? 1) / 2}` + ); + } + c.children && Et(c), u += (c == null ? void 0 : c.widthInColumns) ?? 1, L.debug("abc88 columnsPos", c, u); + } + } + L.debug( + `layout blocks (<==layoutBlocks) ${e.id} x: ${(T = e == null ? void 0 : e.size) == null ? void 0 : T.x} y: ${(k = e == null ? void 0 : e.size) == null ? void 0 : k.y} width: ${(N = e == null ? void 0 : e.size) == null ? void 0 : N.width}` + ); +} +d(Et, "layoutBlocks"); +function _t(e, { minX: t, minY: r, maxX: n, maxY: i } = { minX: 0, minY: 0, maxX: 0, maxY: 0 }) { + if (e.size && e.id !== "root") { + const { x: a, y: s, width: l, height: o } = e.size; + a - l / 2 < t && (t = a - l / 2), s - o / 2 < r && (r = s - o / 2), a + l / 2 > n && (n = a + l / 2), s + o / 2 > i && (i = s + o / 2); + } + if (e.children) + for (const a of e.children) + ({ minX: t, minY: r, maxX: n, maxY: i } = _t(a, { minX: t, minY: r, maxX: n, maxY: i })); + return { minX: t, minY: r, maxX: n, maxY: i }; +} +d(_t, "findBounds"); +function Gt(e) { + const t = e.getBlock("root"); + if (!t) + return; + ot(t, e, 0, 0), Et(t), L.debug("getBlocks", JSON.stringify(t, null, 2)); + const { minX: r, minY: n, maxX: i, maxY: a } = _t(t), s = a - n, l = i - r; + return { x: r, y: n, width: l, height: s }; +} +d(Gt, "layout"); +function wt(e, t) { + t && e.attr("style", t); +} +d(wt, "applyStyle"); +function Zt(e) { + const t = R(document.createElementNS("http://www.w3.org/2000/svg", "foreignObject")), r = t.append("xhtml:div"), n = e.label, i = e.isNode ? "nodeLabel" : "edgeLabel", a = r.append("span"); + return a.html(n), wt(a, e.labelStyle), a.attr("class", i), wt(r, e.labelStyle), r.style("display", "inline-block"), r.style("white-space", "nowrap"), r.attr("xmlns", "http://www.w3.org/1999/xhtml"), t.node(); +} +d(Zt, "addHtmlLabel"); +var ir = /* @__PURE__ */ d((e, t, r, n) => { + let i = e || ""; + if (typeof i == "object" && (i = i[0]), Z(z().flowchart.htmlLabels)) { + i = i.replace(/\\n|\n/g, "
"), L.debug("vertexText" + i); + const a = { + isNode: n, + label: we(xt(i)), + labelStyle: t.replace("fill:", "color:") + }; + return Zt(a); + } else { + const a = document.createElementNS("http://www.w3.org/2000/svg", "text"); + a.setAttribute("style", t.replace("color:", "fill:")); + let s = []; + typeof i == "string" ? s = i.split(/\\n|\n|/gi) : Array.isArray(i) ? s = i : s = []; + for (const l of s) { + const o = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + o.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), o.setAttribute("dy", "1em"), o.setAttribute("x", "0"), r ? o.setAttribute("class", "title-row") : o.setAttribute("class", "row"), o.textContent = l.trim(), a.appendChild(o); + } + return a; + } +}, "createLabel"), j = ir, nr = /* @__PURE__ */ d((e, t, r, n, i) => { + t.arrowTypeStart && Ot(e, "start", t.arrowTypeStart, r, n, i), t.arrowTypeEnd && Ot(e, "end", t.arrowTypeEnd, r, n, i); +}, "addEdgeMarkers"), lr = { + arrow_cross: "cross", + arrow_point: "point", + arrow_barb: "barb", + arrow_circle: "circle", + aggregation: "aggregation", + extension: "extension", + composition: "composition", + dependency: "dependency", + lollipop: "lollipop" +}, Ot = /* @__PURE__ */ d((e, t, r, n, i, a) => { + const s = lr[r]; + if (!s) { + L.warn(`Unknown arrow type: ${r}`); + return; + } + const l = t === "start" ? "Start" : "End"; + e.attr(`marker-${t}`, `url(${n}#${i}_${a}-${s}${l})`); +}, "addEdgeMarker"), mt = {}, P = {}, cr = /* @__PURE__ */ d((e, t) => { + const r = z(), n = Z(r.flowchart.htmlLabels), i = t.labelType === "markdown" ? Yt( + e, + t.label, + { + style: t.labelStyle, + useHtmlLabels: n, + addSvgBackground: !0 + }, + r + ) : j(t.label, t.labelStyle), a = e.insert("g").attr("class", "edgeLabel"), s = a.insert("g").attr("class", "label"); + s.node().appendChild(i); + let l = i.getBBox(); + if (n) { + const f = i.children[0], h = R(i); + l = f.getBoundingClientRect(), h.attr("width", l.width), h.attr("height", l.height); + } + s.attr("transform", "translate(" + -l.width / 2 + ", " + -l.height / 2 + ")"), mt[t.id] = a, t.width = l.width, t.height = l.height; + let o; + if (t.startLabelLeft) { + const f = j(t.startLabelLeft, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner"); + o = y.node().appendChild(f); + const b = f.getBBox(); + y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), P[t.id] || (P[t.id] = {}), P[t.id].startLeft = h, et(o, t.startLabelLeft); + } + if (t.startLabelRight) { + const f = j(t.startLabelRight, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner"); + o = h.node().appendChild(f), y.node().appendChild(f); + const b = f.getBBox(); + y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), P[t.id] || (P[t.id] = {}), P[t.id].startRight = h, et(o, t.startLabelRight); + } + if (t.endLabelLeft) { + const f = j(t.endLabelLeft, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner"); + o = y.node().appendChild(f); + const b = f.getBBox(); + y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), h.node().appendChild(f), P[t.id] || (P[t.id] = {}), P[t.id].endLeft = h, et(o, t.endLabelLeft); + } + if (t.endLabelRight) { + const f = j(t.endLabelRight, t.labelStyle), h = e.insert("g").attr("class", "edgeTerminals"), y = h.insert("g").attr("class", "inner"); + o = y.node().appendChild(f); + const b = f.getBBox(); + y.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), h.node().appendChild(f), P[t.id] || (P[t.id] = {}), P[t.id].endRight = h, et(o, t.endLabelRight); + } + return i; +}, "insertEdgeLabel"); +function et(e, t) { + z().flowchart.htmlLabels && e && (e.style.width = t.length * 9 + "px", e.style.height = "12px"); +} +d(et, "setTerminalWidth"); +var or = /* @__PURE__ */ d((e, t) => { + L.debug("Moving label abc88 ", e.id, e.label, mt[e.id], t); + let r = t.updatedPath ? t.updatedPath : t.originalPath; + const n = z(), { subGraphTitleTotalMargin: i } = ge(n); + if (e.label) { + const a = mt[e.id]; + let s = e.x, l = e.y; + if (r) { + const o = tt.calcLabelPosition(r); + L.debug( + "Moving label " + e.label + " from (", + s, + ",", + l, + ") to (", + o.x, + ",", + o.y, + ") abc88" + ), t.updatedPath && (s = o.x, l = o.y); + } + a.attr("transform", `translate(${s}, ${l + i / 2})`); + } + if (e.startLabelLeft) { + const a = P[e.id].startLeft; + let s = e.x, l = e.y; + if (r) { + const o = tt.calcTerminalLabelPosition(e.arrowTypeStart ? 10 : 0, "start_left", r); + s = o.x, l = o.y; + } + a.attr("transform", `translate(${s}, ${l})`); + } + if (e.startLabelRight) { + const a = P[e.id].startRight; + let s = e.x, l = e.y; + if (r) { + const o = tt.calcTerminalLabelPosition( + e.arrowTypeStart ? 10 : 0, + "start_right", + r + ); + s = o.x, l = o.y; + } + a.attr("transform", `translate(${s}, ${l})`); + } + if (e.endLabelLeft) { + const a = P[e.id].endLeft; + let s = e.x, l = e.y; + if (r) { + const o = tt.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_left", r); + s = o.x, l = o.y; + } + a.attr("transform", `translate(${s}, ${l})`); + } + if (e.endLabelRight) { + const a = P[e.id].endRight; + let s = e.x, l = e.y; + if (r) { + const o = tt.calcTerminalLabelPosition(e.arrowTypeEnd ? 10 : 0, "end_right", r); + s = o.x, l = o.y; + } + a.attr("transform", `translate(${s}, ${l})`); + } +}, "positionEdgeLabel"), hr = /* @__PURE__ */ d((e, t) => { + const r = e.x, n = e.y, i = Math.abs(t.x - r), a = Math.abs(t.y - n), s = e.width / 2, l = e.height / 2; + return i >= s || a >= l; +}, "outsideNode"), dr = /* @__PURE__ */ d((e, t, r) => { + L.debug(`intersection calc abc89: + outsidePoint: ${JSON.stringify(t)} + insidePoint : ${JSON.stringify(r)} + node : x:${e.x} y:${e.y} w:${e.width} h:${e.height}`); + const n = e.x, i = e.y, a = Math.abs(n - r.x), s = e.width / 2; + let l = r.x < t.x ? s - a : s + a; + const o = e.height / 2, f = Math.abs(t.y - r.y), h = Math.abs(t.x - r.x); + if (Math.abs(i - t.y) * s > Math.abs(n - t.x) * o) { + let y = r.y < t.y ? t.y - o - i : i - o - t.y; + l = h * y / f; + const b = { + x: r.x < t.x ? r.x + l : r.x - h + l, + y: r.y < t.y ? r.y + f - y : r.y - f + y + }; + return l === 0 && (b.x = t.x, b.y = t.y), h === 0 && (b.x = t.x), f === 0 && (b.y = t.y), L.debug(`abc89 topp/bott calc, Q ${f}, q ${y}, R ${h}, r ${l}`, b), b; + } else { + r.x < t.x ? l = t.x - s - n : l = n - s - t.x; + let y = f * l / h, b = r.x < t.x ? r.x + h - l : r.x - h + l, m = r.y < t.y ? r.y + y : r.y - y; + return L.debug(`sides calc abc89, Q ${f}, q ${y}, R ${h}, r ${l}`, { _x: b, _y: m }), l === 0 && (b = t.x, m = t.y), h === 0 && (b = t.x), f === 0 && (m = t.y), { x: b, y: m }; + } +}, "intersection"), Rt = /* @__PURE__ */ d((e, t) => { + L.debug("abc88 cutPathAtIntersect", e, t); + let r = [], n = e[0], i = !1; + return e.forEach((a) => { + if (!hr(t, a) && !i) { + const s = dr(t, n, a); + let l = !1; + r.forEach((o) => { + l = l || o.x === s.x && o.y === s.y; + }), r.some((o) => o.x === s.x && o.y === s.y) || r.push(s), i = !0; + } else + n = a, i || r.push(a); + }), r; +}, "cutPathAtIntersect"), gr = /* @__PURE__ */ d(function(e, t, r, n, i, a, s) { + let l = r.points; + L.debug("abc88 InsertEdge: edge=", r, "e=", t); + let o = !1; + const f = a.node(t.v); + var h = a.node(t.w); + h != null && h.intersect && (f != null && f.intersect) && (l = l.slice(1, r.points.length - 1), l.unshift(f.intersect(l[0])), l.push(h.intersect(l[l.length - 1]))), r.toCluster && (L.debug("to cluster abc88", n[r.toCluster]), l = Rt(r.points, n[r.toCluster].node), o = !0), r.fromCluster && (L.debug("from cluster abc88", n[r.fromCluster]), l = Rt(l.reverse(), n[r.fromCluster].node).reverse(), o = !0); + const y = l.filter((x) => !Number.isNaN(x.y)); + let b = be; + r.curve && (i === "graph" || i === "flowchart") && (b = r.curve); + const { x: m, y: E } = ue(r), D = pe().x(m).y(E).curve(b); + let v; + switch (r.thickness) { + case "normal": + v = "edge-thickness-normal"; + break; + case "thick": + v = "edge-thickness-thick"; + break; + case "invisible": + v = "edge-thickness-thick"; + break; + default: + v = ""; + } + switch (r.pattern) { + case "solid": + v += " edge-pattern-solid"; + break; + case "dotted": + v += " edge-pattern-dotted"; + break; + case "dashed": + v += " edge-pattern-dashed"; + break; + } + const T = e.append("path").attr("d", D(y)).attr("id", r.id).attr("class", " " + v + (r.classes ? " " + r.classes : "")).attr("style", r.style); + let k = ""; + (z().flowchart.arrowMarkerAbsolute || z().state.arrowMarkerAbsolute) && (k = window.location.protocol + "//" + window.location.host + window.location.pathname + window.location.search, k = k.replace(/\(/g, "\\("), k = k.replace(/\)/g, "\\)")), nr(T, r, k, s, i); + let N = {}; + return o && (N.updatedPath = l), N.originalPath = r.points, N; +}, "insertEdge"), ur = /* @__PURE__ */ d((e) => { + const t = /* @__PURE__ */ new Set(); + for (const r of e) + switch (r) { + case "x": + t.add("right"), t.add("left"); + break; + case "y": + t.add("up"), t.add("down"); + break; + default: + t.add(r); + break; + } + return t; +}, "expandAndDeduplicateDirections"), pr = /* @__PURE__ */ d((e, t, r) => { + const n = ur(e), i = 2, a = t.height + 2 * r.padding, s = a / i, l = t.width + 2 * s + r.padding, o = r.padding / 2; + return n.has("right") && n.has("left") && n.has("up") && n.has("down") ? [ + // Bottom + { x: 0, y: 0 }, + { x: s, y: 0 }, + { x: l / 2, y: 2 * o }, + { x: l - s, y: 0 }, + { x: l, y: 0 }, + // Right + { x: l, y: -a / 3 }, + { x: l + 2 * o, y: -a / 2 }, + { x: l, y: -2 * a / 3 }, + { x: l, y: -a }, + // Top + { x: l - s, y: -a }, + { x: l / 2, y: -a - 2 * o }, + { x: s, y: -a }, + // Left + { x: 0, y: -a }, + { x: 0, y: -2 * a / 3 }, + { x: -2 * o, y: -a / 2 }, + { x: 0, y: -a / 3 } + ] : n.has("right") && n.has("left") && n.has("up") ? [ + { x: s, y: 0 }, + { x: l - s, y: 0 }, + { x: l, y: -a / 2 }, + { x: l - s, y: -a }, + { x: s, y: -a }, + { x: 0, y: -a / 2 } + ] : n.has("right") && n.has("left") && n.has("down") ? [ + { x: 0, y: 0 }, + { x: s, y: -a }, + { x: l - s, y: -a }, + { x: l, y: 0 } + ] : n.has("right") && n.has("up") && n.has("down") ? [ + { x: 0, y: 0 }, + { x: l, y: -s }, + { x: l, y: -a + s }, + { x: 0, y: -a } + ] : n.has("left") && n.has("up") && n.has("down") ? [ + { x: l, y: 0 }, + { x: 0, y: -s }, + { x: 0, y: -a + s }, + { x: l, y: -a } + ] : n.has("right") && n.has("left") ? [ + { x: s, y: 0 }, + { x: s, y: -o }, + { x: l - s, y: -o }, + { x: l - s, y: 0 }, + { x: l, y: -a / 2 }, + { x: l - s, y: -a }, + { x: l - s, y: -a + o }, + { x: s, y: -a + o }, + { x: s, y: -a }, + { x: 0, y: -a / 2 } + ] : n.has("up") && n.has("down") ? [ + // Bottom center + { x: l / 2, y: 0 }, + // Left pont of bottom arrow + { x: 0, y: -o }, + { x: s, y: -o }, + // Left top over vertical section + { x: s, y: -a + o }, + { x: 0, y: -a + o }, + // Top of arrow + { x: l / 2, y: -a }, + { x: l, y: -a + o }, + // Top of right vertical bar + { x: l - s, y: -a + o }, + { x: l - s, y: -o }, + { x: l, y: -o } + ] : n.has("right") && n.has("up") ? [ + { x: 0, y: 0 }, + { x: l, y: -s }, + { x: 0, y: -a } + ] : n.has("right") && n.has("down") ? [ + { x: 0, y: 0 }, + { x: l, y: 0 }, + { x: 0, y: -a } + ] : n.has("left") && n.has("up") ? [ + { x: l, y: 0 }, + { x: 0, y: -s }, + { x: l, y: -a } + ] : n.has("left") && n.has("down") ? [ + { x: l, y: 0 }, + { x: 0, y: 0 }, + { x: l, y: -a } + ] : n.has("right") ? [ + { x: s, y: -o }, + { x: s, y: -o }, + { x: l - s, y: -o }, + { x: l - s, y: 0 }, + { x: l, y: -a / 2 }, + { x: l - s, y: -a }, + { x: l - s, y: -a + o }, + // top left corner of arrow + { x: s, y: -a + o }, + { x: s, y: -a + o } + ] : n.has("left") ? [ + { x: s, y: 0 }, + { x: s, y: -o }, + // Two points, the right corners + { x: l - s, y: -o }, + { x: l - s, y: -a + o }, + { x: s, y: -a + o }, + { x: s, y: -a }, + { x: 0, y: -a / 2 } + ] : n.has("up") ? [ + // Bottom center + { x: s, y: -o }, + // Left top over vertical section + { x: s, y: -a + o }, + { x: 0, y: -a + o }, + // Top of arrow + { x: l / 2, y: -a }, + { x: l, y: -a + o }, + // Top of right vertical bar + { x: l - s, y: -a + o }, + { x: l - s, y: -o } + ] : n.has("down") ? [ + // Bottom center + { x: l / 2, y: 0 }, + // Left pont of bottom arrow + { x: 0, y: -o }, + { x: s, y: -o }, + // Left top over vertical section + { x: s, y: -a + o }, + { x: l - s, y: -a + o }, + { x: l - s, y: -o }, + { x: l, y: -o } + ] : [{ x: 0, y: 0 }]; +}, "getArrowPoints"); +function qt(e, t) { + return e.intersect(t); +} +d(qt, "intersectNode"); +var fr = qt; +function Jt(e, t, r, n) { + var i = e.x, a = e.y, s = i - n.x, l = a - n.y, o = Math.sqrt(t * t * l * l + r * r * s * s), f = Math.abs(t * r * s / o); + n.x < i && (f = -f); + var h = Math.abs(t * r * l / o); + return n.y < a && (h = -h), { x: i + f, y: a + h }; +} +d(Jt, "intersectEllipse"); +var Qt = Jt; +function $t(e, t, r) { + return Qt(e, t, t, r); +} +d($t, "intersectCircle"); +var xr = $t; +function te(e, t, r, n) { + var i, a, s, l, o, f, h, y, b, m, E, D, v, T, k; + if (i = t.y - e.y, s = e.x - t.x, o = t.x * e.y - e.x * t.y, b = i * r.x + s * r.y + o, m = i * n.x + s * n.y + o, !(b !== 0 && m !== 0 && Lt(b, m)) && (a = n.y - r.y, l = r.x - n.x, f = n.x * r.y - r.x * n.y, h = a * e.x + l * e.y + f, y = a * t.x + l * t.y + f, !(h !== 0 && y !== 0 && Lt(h, y)) && (E = i * l - a * s, E !== 0))) + return D = Math.abs(E / 2), v = s * f - l * o, T = v < 0 ? (v - D) / E : (v + D) / E, v = a * o - i * f, k = v < 0 ? (v - D) / E : (v + D) / E, { x: T, y: k }; +} +d(te, "intersectLine"); +function Lt(e, t) { + return e * t > 0; +} +d(Lt, "sameSign"); +var yr = te, br = ee; +function ee(e, t, r) { + var n = e.x, i = e.y, a = [], s = Number.POSITIVE_INFINITY, l = Number.POSITIVE_INFINITY; + typeof t.forEach == "function" ? t.forEach(function(E) { + s = Math.min(s, E.x), l = Math.min(l, E.y); + }) : (s = Math.min(s, t.x), l = Math.min(l, t.y)); + for (var o = n - e.width / 2 - s, f = i - e.height / 2 - l, h = 0; h < t.length; h++) { + var y = t[h], b = t[h < t.length - 1 ? h + 1 : 0], m = yr( + e, + r, + { x: o + y.x, y: f + y.y }, + { x: o + b.x, y: f + b.y } + ); + m && a.push(m); + } + return a.length ? (a.length > 1 && a.sort(function(E, D) { + var v = E.x - r.x, T = E.y - r.y, k = Math.sqrt(v * v + T * T), N = D.x - r.x, x = D.y - r.y, g = Math.sqrt(N * N + x * x); + return k < g ? -1 : k === g ? 0 : 1; + }), a[0]) : e; +} +d(ee, "intersectPolygon"); +var wr = /* @__PURE__ */ d((e, t) => { + var r = e.x, n = e.y, i = t.x - r, a = t.y - n, s = e.width / 2, l = e.height / 2, o, f; + return Math.abs(a) * s > Math.abs(i) * l ? (a < 0 && (l = -l), o = a === 0 ? 0 : l * i / a, f = l) : (i < 0 && (s = -s), o = s, f = i === 0 ? 0 : s * a / i), { x: r + o, y: n + f }; +}, "intersectRect"), mr = wr, C = { + node: fr, + circle: xr, + ellipse: Qt, + polygon: br, + rect: mr +}, F = /* @__PURE__ */ d(async (e, t, r, n) => { + const i = z(); + let a; + const s = t.useHtmlLabels || Z(i.flowchart.htmlLabels); + r ? a = r : a = "node default"; + const l = e.insert("g").attr("class", a).attr("id", t.domId || t.id), o = l.insert("g").attr("class", "label").attr("style", t.labelStyle); + let f; + t.labelText === void 0 ? f = "" : f = typeof t.labelText == "string" ? t.labelText : t.labelText[0]; + const h = o.node(); + let y; + t.labelType === "markdown" ? y = Yt( + o, + Tt(xt(f), i), + { + useHtmlLabels: s, + width: t.width || i.flowchart.wrappingWidth, + classes: "markdown-node-label" + }, + i + ) : y = h.appendChild( + j(Tt(xt(f), i), t.labelStyle, !1, n) + ); + let b = y.getBBox(); + const m = t.padding / 2; + if (Z(i.flowchart.htmlLabels)) { + const E = y.children[0], D = R(y), v = E.getElementsByTagName("img"); + if (v) { + const T = f.replace(/]*>/g, "").trim() === ""; + await Promise.all( + [...v].map( + (k) => new Promise((N) => { + function x() { + if (k.style.display = "flex", k.style.flexDirection = "column", T) { + const g = i.fontSize ? i.fontSize : window.getComputedStyle(document.body).fontSize, w = parseInt(g, 10) * 5 + "px"; + k.style.minWidth = w, k.style.maxWidth = w; + } else + k.style.width = "100%"; + N(k); + } + d(x, "setupImage"), setTimeout(() => { + k.complete && x(); + }), k.addEventListener("error", x), k.addEventListener("load", x); + }) + ) + ); + } + b = E.getBoundingClientRect(), D.attr("width", b.width), D.attr("height", b.height); + } + return s ? o.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")") : o.attr("transform", "translate(0, " + -b.height / 2 + ")"), t.centerLabel && o.attr("transform", "translate(" + -b.width / 2 + ", " + -b.height / 2 + ")"), o.insert("rect", ":first-child"), { shapeSvg: l, bbox: b, halfPadding: m, label: o }; +}, "labelHelper"), B = /* @__PURE__ */ d((e, t) => { + const r = t.node().getBBox(); + e.width = r.width, e.height = r.height; +}, "updateNodeBounds"); +function G(e, t, r, n) { + return e.insert("polygon", ":first-child").attr( + "points", + n.map(function(i) { + return i.x + "," + i.y; + }).join(" ") + ).attr("class", "label-container").attr("transform", "translate(" + -t / 2 + "," + r / 2 + ")"); +} +d(G, "insertPolygonShape"); +var Lr = /* @__PURE__ */ d(async (e, t) => { + t.useHtmlLabels || z().flowchart.htmlLabels || (t.centerLabel = !0); + const { shapeSvg: n, bbox: i, halfPadding: a } = await F( + e, + t, + "node " + t.classes, + !0 + ); + L.info("Classes = ", t.classes); + const s = n.insert("rect", ":first-child"); + return s.attr("rx", t.rx).attr("ry", t.ry).attr("x", -i.width / 2 - a).attr("y", -i.height / 2 - a).attr("width", i.width + t.padding).attr("height", i.height + t.padding), B(t, s), t.intersect = function(l) { + return C.rect(t, l); + }, n; +}, "note"), Sr = Lr, zt = /* @__PURE__ */ d((e) => e ? " " + e : "", "formatClass"), K = /* @__PURE__ */ d((e, t) => `${t || "node default"}${zt(e.classes)} ${zt( + e.class +)}`, "getClassesFromNode"), At = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = n.height + t.padding, s = i + a, l = [ + { x: s / 2, y: 0 }, + { x: s, y: -s / 2 }, + { x: s / 2, y: -s }, + { x: 0, y: -s / 2 } + ]; + L.info("Question main (Circle)"); + const o = G(r, s, s, l); + return o.attr("style", t.style), B(t, o), t.intersect = function(f) { + return L.warn("Intersect called"), C.polygon(t, l, f); + }, r; +}, "question"), vr = /* @__PURE__ */ d((e, t) => { + const r = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), n = 28, i = [ + { x: 0, y: n / 2 }, + { x: n / 2, y: 0 }, + { x: 0, y: -n / 2 }, + { x: -n / 2, y: 0 } + ]; + return r.insert("polygon", ":first-child").attr( + "points", + i.map(function(s) { + return s.x + "," + s.y; + }).join(" ") + ).attr("class", "state-start").attr("r", 7).attr("width", 28).attr("height", 28), t.width = 28, t.height = 28, t.intersect = function(s) { + return C.circle(t, 14, s); + }, r; +}, "choice"), Er = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = 4, a = n.height + t.padding, s = a / i, l = n.width + 2 * s + t.padding, o = [ + { x: s, y: 0 }, + { x: l - s, y: 0 }, + { x: l, y: -a / 2 }, + { x: l - s, y: -a }, + { x: s, y: -a }, + { x: 0, y: -a / 2 } + ], f = G(r, l, a, o); + return f.attr("style", t.style), B(t, f), t.intersect = function(h) { + return C.polygon(t, o, h); + }, r; +}, "hexagon"), _r = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F(e, t, void 0, !0), i = 2, a = n.height + 2 * t.padding, s = a / i, l = n.width + 2 * s + t.padding, o = pr(t.directions, n, t), f = G(r, l, a, o); + return f.attr("style", t.style), B(t, f), t.intersect = function(h) { + return C.polygon(t, o, h); + }, r; +}, "block_arrow"), kr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = n.height + t.padding, s = [ + { x: -a / 2, y: 0 }, + { x: i, y: 0 }, + { x: i, y: -a }, + { x: -a / 2, y: -a }, + { x: 0, y: -a / 2 } + ]; + return G(r, i, a, s).attr("style", t.style), t.width = i + a, t.height = a, t.intersect = function(o) { + return C.polygon(t, s, o); + }, r; +}, "rect_left_inv_arrow"), Dr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F(e, t, K(t), !0), i = n.width + t.padding, a = n.height + t.padding, s = [ + { x: -2 * a / 6, y: 0 }, + { x: i - a / 6, y: 0 }, + { x: i + 2 * a / 6, y: -a }, + { x: a / 6, y: -a } + ], l = G(r, i, a, s); + return l.attr("style", t.style), B(t, l), t.intersect = function(o) { + return C.polygon(t, s, o); + }, r; +}, "lean_right"), Nr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = n.height + t.padding, s = [ + { x: 2 * a / 6, y: 0 }, + { x: i + a / 6, y: 0 }, + { x: i - 2 * a / 6, y: -a }, + { x: -a / 6, y: -a } + ], l = G(r, i, a, s); + return l.attr("style", t.style), B(t, l), t.intersect = function(o) { + return C.polygon(t, s, o); + }, r; +}, "lean_left"), Tr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = n.height + t.padding, s = [ + { x: -2 * a / 6, y: 0 }, + { x: i + 2 * a / 6, y: 0 }, + { x: i - a / 6, y: -a }, + { x: a / 6, y: -a } + ], l = G(r, i, a, s); + return l.attr("style", t.style), B(t, l), t.intersect = function(o) { + return C.polygon(t, s, o); + }, r; +}, "trapezoid"), Cr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = n.height + t.padding, s = [ + { x: a / 6, y: 0 }, + { x: i - a / 6, y: 0 }, + { x: i + 2 * a / 6, y: -a }, + { x: -2 * a / 6, y: -a } + ], l = G(r, i, a, s); + return l.attr("style", t.style), B(t, l), t.intersect = function(o) { + return C.polygon(t, s, o); + }, r; +}, "inv_trapezoid"), Br = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = n.height + t.padding, s = [ + { x: 0, y: 0 }, + { x: i + a / 2, y: 0 }, + { x: i, y: -a / 2 }, + { x: i + a / 2, y: -a }, + { x: 0, y: -a } + ], l = G(r, i, a, s); + return l.attr("style", t.style), B(t, l), t.intersect = function(o) { + return C.polygon(t, s, o); + }, r; +}, "rect_right_inv_arrow"), Ir = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = i / 2, s = a / (2.5 + i / 50), l = n.height + s + t.padding, o = "M 0," + s + " a " + a + "," + s + " 0,0,0 " + i + " 0 a " + a + "," + s + " 0,0,0 " + -i + " 0 l 0," + l + " a " + a + "," + s + " 0,0,0 " + i + " 0 l 0," + -l, f = r.attr("label-offset-y", s).insert("path", ":first-child").attr("style", t.style).attr("d", o).attr("transform", "translate(" + -i / 2 + "," + -(l / 2 + s) + ")"); + return B(t, f), t.intersect = function(h) { + const y = C.rect(t, h), b = y.x - t.x; + if (a != 0 && (Math.abs(b) < t.width / 2 || Math.abs(b) == t.width / 2 && Math.abs(y.y - t.y) > t.height / 2 - s)) { + let m = s * s * (1 - b * b / (a * a)); + m != 0 && (m = Math.sqrt(m)), m = s - m, h.y - t.y > 0 && (m = -m), y.y += m; + } + return y; + }, r; +}, "cylinder"), Or = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n, halfPadding: i } = await F( + e, + t, + "node " + t.classes + " " + t.class, + !0 + ), a = r.insert("rect", ":first-child"), s = t.positioned ? t.width : n.width + t.padding, l = t.positioned ? t.height : n.height + t.padding, o = t.positioned ? -s / 2 : -n.width / 2 - i, f = t.positioned ? -l / 2 : -n.height / 2 - i; + if (a.attr("class", "basic label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", o).attr("y", f).attr("width", s).attr("height", l), t.props) { + const h = new Set(Object.keys(t.props)); + t.props.borders && (ht(a, t.props.borders, s, l), h.delete("borders")), h.forEach((y) => { + L.warn(`Unknown node property ${y}`); + }); + } + return B(t, a), t.intersect = function(h) { + return C.rect(t, h); + }, r; +}, "rect"), Rr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n, halfPadding: i } = await F( + e, + t, + "node " + t.classes, + !0 + ), a = r.insert("rect", ":first-child"), s = t.positioned ? t.width : n.width + t.padding, l = t.positioned ? t.height : n.height + t.padding, o = t.positioned ? -s / 2 : -n.width / 2 - i, f = t.positioned ? -l / 2 : -n.height / 2 - i; + if (a.attr("class", "basic cluster composite label-container").attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("x", o).attr("y", f).attr("width", s).attr("height", l), t.props) { + const h = new Set(Object.keys(t.props)); + t.props.borders && (ht(a, t.props.borders, s, l), h.delete("borders")), h.forEach((y) => { + L.warn(`Unknown node property ${y}`); + }); + } + return B(t, a), t.intersect = function(h) { + return C.rect(t, h); + }, r; +}, "composite"), zr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r } = await F(e, t, "label", !0); + L.trace("Classes = ", t.class); + const n = r.insert("rect", ":first-child"), i = 0, a = 0; + if (n.attr("width", i).attr("height", a), r.attr("class", "label edgeLabel"), t.props) { + const s = new Set(Object.keys(t.props)); + t.props.borders && (ht(n, t.props.borders, i, a), s.delete("borders")), s.forEach((l) => { + L.warn(`Unknown node property ${l}`); + }); + } + return B(t, n), t.intersect = function(s) { + return C.rect(t, s); + }, r; +}, "labelRect"); +function ht(e, t, r, n) { + const i = [], a = /* @__PURE__ */ d((l) => { + i.push(l, 0); + }, "addBorder"), s = /* @__PURE__ */ d((l) => { + i.push(0, l); + }, "skipBorder"); + t.includes("t") ? (L.debug("add top border"), a(r)) : s(r), t.includes("r") ? (L.debug("add right border"), a(n)) : s(n), t.includes("b") ? (L.debug("add bottom border"), a(r)) : s(r), t.includes("l") ? (L.debug("add left border"), a(n)) : s(n), e.attr("stroke-dasharray", i.join(" ")); +} +d(ht, "applyNodePropertyBorders"); +var Ar = /* @__PURE__ */ d((e, t) => { + let r; + t.classes ? r = "node " + t.classes : r = "node default"; + const n = e.insert("g").attr("class", r).attr("id", t.domId || t.id), i = n.insert("rect", ":first-child"), a = n.insert("line"), s = n.insert("g").attr("class", "label"), l = t.labelText.flat ? t.labelText.flat() : t.labelText; + let o = ""; + typeof l == "object" ? o = l[0] : o = l, L.info("Label text abc79", o, l, typeof l == "object"); + const f = s.node().appendChild(j(o, t.labelStyle, !0, !0)); + let h = { width: 0, height: 0 }; + if (Z(z().flowchart.htmlLabels)) { + const D = f.children[0], v = R(f); + h = D.getBoundingClientRect(), v.attr("width", h.width), v.attr("height", h.height); + } + L.info("Text 2", l); + const y = l.slice(1, l.length); + let b = f.getBBox(); + const m = s.node().appendChild( + j(y.join ? y.join("
") : y, t.labelStyle, !0, !0) + ); + if (Z(z().flowchart.htmlLabels)) { + const D = m.children[0], v = R(m); + h = D.getBoundingClientRect(), v.attr("width", h.width), v.attr("height", h.height); + } + const E = t.padding / 2; + return R(m).attr( + "transform", + "translate( " + // (titleBox.width - bbox.width) / 2 + + (h.width > b.width ? 0 : (b.width - h.width) / 2) + ", " + (b.height + E + 5) + ")" + ), R(f).attr( + "transform", + "translate( " + // (titleBox.width - bbox.width) / 2 + + (h.width < b.width ? 0 : -(b.width - h.width) / 2) + ", 0)" + ), h = s.node().getBBox(), s.attr( + "transform", + "translate(" + -h.width / 2 + ", " + (-h.height / 2 - E + 3) + ")" + ), i.attr("class", "outer title-state").attr("x", -h.width / 2 - E).attr("y", -h.height / 2 - E).attr("width", h.width + t.padding).attr("height", h.height + t.padding), a.attr("class", "divider").attr("x1", -h.width / 2 - E).attr("x2", h.width / 2 + E).attr("y1", -h.height / 2 - E + b.height + E).attr("y2", -h.height / 2 - E + b.height + E), B(t, i), t.intersect = function(D) { + return C.rect(t, D); + }, n; +}, "rectWithTitle"), Mr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.height + t.padding, a = n.width + i / 4 + t.padding, s = r.insert("rect", ":first-child").attr("style", t.style).attr("rx", i / 2).attr("ry", i / 2).attr("x", -a / 2).attr("y", -i / 2).attr("width", a).attr("height", i); + return B(t, s), t.intersect = function(l) { + return C.rect(t, l); + }, r; +}, "stadium"), Fr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n, halfPadding: i } = await F( + e, + t, + K(t, void 0), + !0 + ), a = r.insert("circle", ":first-child"); + return a.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", n.width / 2 + i).attr("width", n.width + t.padding).attr("height", n.height + t.padding), L.info("Circle main"), B(t, a), t.intersect = function(s) { + return L.info("Circle intersect", t, n.width / 2 + i, s), C.circle(t, n.width / 2 + i, s); + }, r; +}, "circle"), Wr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n, halfPadding: i } = await F( + e, + t, + K(t, void 0), + !0 + ), a = 5, s = r.insert("g", ":first-child"), l = s.insert("circle"), o = s.insert("circle"); + return s.attr("class", t.class), l.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", n.width / 2 + i + a).attr("width", n.width + t.padding + a * 2).attr("height", n.height + t.padding + a * 2), o.attr("style", t.style).attr("rx", t.rx).attr("ry", t.ry).attr("r", n.width / 2 + i).attr("width", n.width + t.padding).attr("height", n.height + t.padding), L.info("DoubleCircle main"), B(t, l), t.intersect = function(f) { + return L.info("DoubleCircle intersect", t, n.width / 2 + i + a, f), C.circle(t, n.width / 2 + i + a, f); + }, r; +}, "doublecircle"), Pr = /* @__PURE__ */ d(async (e, t) => { + const { shapeSvg: r, bbox: n } = await F( + e, + t, + K(t, void 0), + !0 + ), i = n.width + t.padding, a = n.height + t.padding, s = [ + { x: 0, y: 0 }, + { x: i, y: 0 }, + { x: i, y: -a }, + { x: 0, y: -a }, + { x: 0, y: 0 }, + { x: -8, y: 0 }, + { x: i + 8, y: 0 }, + { x: i + 8, y: -a }, + { x: -8, y: -a }, + { x: -8, y: 0 } + ], l = G(r, i, a, s); + return l.attr("style", t.style), B(t, l), t.intersect = function(o) { + return C.polygon(t, s, o); + }, r; +}, "subroutine"), Yr = /* @__PURE__ */ d((e, t) => { + const r = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), n = r.insert("circle", ":first-child"); + return n.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), B(t, n), t.intersect = function(i) { + return C.circle(t, 7, i); + }, r; +}, "start"), Mt = /* @__PURE__ */ d((e, t, r) => { + const n = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id); + let i = 70, a = 10; + r === "LR" && (i = 10, a = 70); + const s = n.append("rect").attr("x", -1 * i / 2).attr("y", -1 * a / 2).attr("width", i).attr("height", a).attr("class", "fork-join"); + return B(t, s), t.height = t.height + t.padding / 2, t.width = t.width + t.padding / 2, t.intersect = function(l) { + return C.rect(t, l); + }, n; +}, "forkJoin"), Hr = /* @__PURE__ */ d((e, t) => { + const r = e.insert("g").attr("class", "node default").attr("id", t.domId || t.id), n = r.insert("circle", ":first-child"), i = r.insert("circle", ":first-child"); + return i.attr("class", "state-start").attr("r", 7).attr("width", 14).attr("height", 14), n.attr("class", "state-end").attr("r", 5).attr("width", 10).attr("height", 10), B(t, i), t.intersect = function(a) { + return C.circle(t, 7, a); + }, r; +}, "end"), Kr = /* @__PURE__ */ d((e, t) => { + var S; + const r = t.padding / 2, n = 4, i = 8; + let a; + t.classes ? a = "node " + t.classes : a = "node default"; + const s = e.insert("g").attr("class", a).attr("id", t.domId || t.id), l = s.insert("rect", ":first-child"), o = s.insert("line"), f = s.insert("line"); + let h = 0, y = n; + const b = s.insert("g").attr("class", "label"); + let m = 0; + const E = (S = t.classData.annotations) == null ? void 0 : S[0], D = t.classData.annotations[0] ? "«" + t.classData.annotations[0] + "»" : "", v = b.node().appendChild(j(D, t.labelStyle, !0, !0)); + let T = v.getBBox(); + if (Z(z().flowchart.htmlLabels)) { + const c = v.children[0], _ = R(v); + T = c.getBoundingClientRect(), _.attr("width", T.width), _.attr("height", T.height); + } + t.classData.annotations[0] && (y += T.height + n, h += T.width); + let k = t.classData.label; + t.classData.type !== void 0 && t.classData.type !== "" && (z().flowchart.htmlLabels ? k += "<" + t.classData.type + ">" : k += "<" + t.classData.type + ">"); + const N = b.node().appendChild(j(k, t.labelStyle, !0, !0)); + R(N).attr("class", "classTitle"); + let x = N.getBBox(); + if (Z(z().flowchart.htmlLabels)) { + const c = N.children[0], _ = R(N); + x = c.getBoundingClientRect(), _.attr("width", x.width), _.attr("height", x.height); + } + y += x.height + n, x.width > h && (h = x.width); + const g = []; + t.classData.members.forEach((c) => { + const _ = c.getDisplayDetails(); + let p = _.displayText; + z().flowchart.htmlLabels && (p = p.replace(//g, ">")); + const A = b.node().appendChild( + j( + p, + _.cssStyle ? _.cssStyle : t.labelStyle, + !0, + !0 + ) + ); + let O = A.getBBox(); + if (Z(z().flowchart.htmlLabels)) { + const X = A.children[0], W = R(A); + O = X.getBoundingClientRect(), W.attr("width", O.width), W.attr("height", O.height); + } + O.width > h && (h = O.width), y += O.height + n, g.push(A); + }), y += i; + const u = []; + if (t.classData.methods.forEach((c) => { + const _ = c.getDisplayDetails(); + let p = _.displayText; + z().flowchart.htmlLabels && (p = p.replace(//g, ">")); + const A = b.node().appendChild( + j( + p, + _.cssStyle ? _.cssStyle : t.labelStyle, + !0, + !0 + ) + ); + let O = A.getBBox(); + if (Z(z().flowchart.htmlLabels)) { + const X = A.children[0], W = R(A); + O = X.getBoundingClientRect(), W.attr("width", O.width), W.attr("height", O.height); + } + O.width > h && (h = O.width), y += O.height + n, u.push(A); + }), y += i, E) { + let c = (h - T.width) / 2; + R(v).attr( + "transform", + "translate( " + (-1 * h / 2 + c) + ", " + -1 * y / 2 + ")" + ), m = T.height + n; + } + let w = (h - x.width) / 2; + return R(N).attr( + "transform", + "translate( " + (-1 * h / 2 + w) + ", " + (-1 * y / 2 + m) + ")" + ), m += x.height + n, o.attr("class", "divider").attr("x1", -h / 2 - r).attr("x2", h / 2 + r).attr("y1", -y / 2 - r + i + m).attr("y2", -y / 2 - r + i + m), m += i, g.forEach((c) => { + R(c).attr( + "transform", + "translate( " + -h / 2 + ", " + (-1 * y / 2 + m + i / 2) + ")" + ); + const _ = c == null ? void 0 : c.getBBox(); + m += ((_ == null ? void 0 : _.height) ?? 0) + n; + }), m += i, f.attr("class", "divider").attr("x1", -h / 2 - r).attr("x2", h / 2 + r).attr("y1", -y / 2 - r + i + m).attr("y2", -y / 2 - r + i + m), m += i, u.forEach((c) => { + R(c).attr( + "transform", + "translate( " + -h / 2 + ", " + (-1 * y / 2 + m) + ")" + ); + const _ = c == null ? void 0 : c.getBBox(); + m += ((_ == null ? void 0 : _.height) ?? 0) + n; + }), l.attr("style", t.style).attr("class", "outer title-state").attr("x", -h / 2 - r).attr("y", -(y / 2) - r).attr("width", h + t.padding).attr("height", y + t.padding), B(t, l), t.intersect = function(c) { + return C.rect(t, c); + }, s; +}, "class_box"), Ft = { + rhombus: At, + composite: Rr, + question: At, + rect: Or, + labelRect: zr, + rectWithTitle: Ar, + choice: vr, + circle: Fr, + doublecircle: Wr, + stadium: Mr, + hexagon: Er, + block_arrow: _r, + rect_left_inv_arrow: kr, + lean_right: Dr, + lean_left: Nr, + trapezoid: Tr, + inv_trapezoid: Cr, + rect_right_inv_arrow: Br, + cylinder: Ir, + start: Yr, + end: Hr, + note: Sr, + subroutine: Pr, + fork: Mt, + join: Mt, + class_box: Kr +}, lt = {}, re = /* @__PURE__ */ d(async (e, t, r) => { + let n, i; + if (t.link) { + let a; + z().securityLevel === "sandbox" ? a = "_top" : t.linkTarget && (a = t.linkTarget || "_blank"), n = e.insert("svg:a").attr("xlink:href", t.link).attr("target", a), i = await Ft[t.shape](n, t, r); + } else + i = await Ft[t.shape](e, t, r), n = i; + return t.tooltip && i.attr("title", t.tooltip), t.class && i.attr("class", "node default " + t.class), lt[t.id] = n, t.haveCallback && lt[t.id].attr("class", lt[t.id].attr("class") + " clickable"), n; +}, "insertNode"), Xr = /* @__PURE__ */ d((e) => { + const t = lt[e.id]; + L.trace( + "Transforming node", + e.diff, + e, + "translate(" + (e.x - e.width / 2 - 5) + ", " + e.width / 2 + ")" + ); + const r = 8, n = e.diff || 0; + return e.clusterNode ? t.attr( + "transform", + "translate(" + (e.x + n - e.width / 2) + ", " + (e.y - e.height / 2 - r) + ")" + ) : t.attr("transform", "translate(" + e.x + ", " + e.y + ")"), n; +}, "positionNode"); +function kt(e, t, r = !1) { + var b, m, E; + const n = e; + let i = "default"; + (((b = n == null ? void 0 : n.classes) == null ? void 0 : b.length) || 0) > 0 && (i = ((n == null ? void 0 : n.classes) ?? []).join(" ")), i = i + " flowchart-label"; + let a = 0, s = "", l; + switch (n.type) { + case "round": + a = 5, s = "rect"; + break; + case "composite": + a = 0, s = "composite", l = 0; + break; + case "square": + s = "rect"; + break; + case "diamond": + s = "question"; + break; + case "hexagon": + s = "hexagon"; + break; + case "block_arrow": + s = "block_arrow"; + break; + case "odd": + s = "rect_left_inv_arrow"; + break; + case "lean_right": + s = "lean_right"; + break; + case "lean_left": + s = "lean_left"; + break; + case "trapezoid": + s = "trapezoid"; + break; + case "inv_trapezoid": + s = "inv_trapezoid"; + break; + case "rect_left_inv_arrow": + s = "rect_left_inv_arrow"; + break; + case "circle": + s = "circle"; + break; + case "ellipse": + s = "ellipse"; + break; + case "stadium": + s = "stadium"; + break; + case "subroutine": + s = "subroutine"; + break; + case "cylinder": + s = "cylinder"; + break; + case "group": + s = "rect"; + break; + case "doublecircle": + s = "doublecircle"; + break; + default: + s = "rect"; + } + const o = de((n == null ? void 0 : n.styles) ?? []), f = n.label, h = n.size ?? { width: 0, height: 0, x: 0, y: 0 }; + return { + labelStyle: o.labelStyle, + shape: s, + labelText: f, + rx: a, + ry: a, + class: i, + style: o.style, + id: n.id, + directions: n.directions, + width: h.width, + height: h.height, + x: h.x, + y: h.y, + positioned: r, + intersect: void 0, + type: n.type, + padding: l ?? ((E = (m = at()) == null ? void 0 : m.block) == null ? void 0 : E.padding) ?? 0 + }; +} +d(kt, "getNodeFromBlock"); +async function ae(e, t, r) { + const n = kt(t, r, !1); + if (n.type === "group") + return; + const i = at(), a = await re(e, n, { config: i }), s = a.node().getBBox(), l = r.getBlock(n.id); + l.size = { width: s.width, height: s.height, x: 0, y: 0, node: a }, r.setBlock(l), a.remove(); +} +d(ae, "calculateBlockSize"); +async function se(e, t, r) { + const n = kt(t, r, !0); + if (r.getBlock(n.id).type !== "space") { + const a = at(); + await re(e, n, { config: a }), t.intersect = n == null ? void 0 : n.intersect, Xr(n); + } +} +d(se, "insertBlockPositioned"); +async function dt(e, t, r, n) { + for (const i of t) + await n(e, i, r), i.children && await dt(e, i.children, r, n); +} +d(dt, "performOperations"); +async function ie(e, t, r) { + await dt(e, t, r, ae); +} +d(ie, "calculateBlockSizes"); +async function ne(e, t, r) { + await dt(e, t, r, se); +} +d(ne, "insertBlocks"); +async function le(e, t, r, n, i) { + const a = new Se({ + multigraph: !0, + compound: !0 + }); + a.setGraph({ + rankdir: "TB", + nodesep: 10, + ranksep: 10, + marginx: 8, + marginy: 8 + }); + for (const s of r) + s.size && a.setNode(s.id, { + width: s.size.width, + height: s.size.height, + intersect: s.intersect + }); + for (const s of t) + if (s.start && s.end) { + const l = n.getBlock(s.start), o = n.getBlock(s.end); + if (l != null && l.size && (o != null && o.size)) { + const f = l.size, h = o.size, y = [ + { x: f.x, y: f.y }, + { x: f.x + (h.x - f.x) / 2, y: f.y + (h.y - f.y) / 2 }, + { x: h.x, y: h.y } + ]; + gr( + e, + { v: s.start, w: s.end, name: s.id }, + { + ...s, + arrowTypeEnd: s.arrowTypeEnd, + arrowTypeStart: s.arrowTypeStart, + points: y, + classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1" + }, + void 0, + "block", + a, + i + ), s.label && (await cr(e, { + ...s, + label: s.label, + labelStyle: "stroke: #333; stroke-width: 1.5px;fill:none;", + arrowTypeEnd: s.arrowTypeEnd, + arrowTypeStart: s.arrowTypeStart, + points: y, + classes: "edge-thickness-normal edge-pattern-solid flowchart-link LS-a1 LE-b1" + }), or( + { ...s, x: y[1].x, y: y[1].y }, + { + originalPath: y + } + )); + } + } +} +d(le, "insertEdges"); +var Ur = /* @__PURE__ */ d(function(e, t) { + return t.db.getClasses(); +}, "getClasses"), jr = /* @__PURE__ */ d(async function(e, t, r, n) { + const { securityLevel: i, block: a } = at(), s = n.db; + let l; + i === "sandbox" && (l = R("#i" + t)); + const o = i === "sandbox" ? R(l.nodes()[0].contentDocument.body) : R("body"), f = i === "sandbox" ? o.select(`[id="${t}"]`) : R(`[id="${t}"]`); + ar(f, ["point", "circle", "cross"], n.type, t); + const y = s.getBlocks(), b = s.getBlocksFlat(), m = s.getEdges(), E = f.insert("g").attr("class", "block"); + await ie(E, y, s); + const D = Gt(s); + if (await ne(E, y, s), await le(E, m, b, s, t), D) { + const v = D, T = Math.max(1, Math.round(0.125 * (v.width / v.height))), k = v.height + T + 10, N = v.width + 10, { useMaxWidth: x } = a; + fe(f, k, N, !!x), L.debug("Here Bounds", D, v), f.attr( + "viewBox", + `${v.x - 5} ${v.y - 5} ${v.width + 10} ${v.height + 10}` + ); + } +}, "draw"), Vr = { + draw: jr, + getClasses: Ur +}, Qr = { + parser: Ee, + db: Ke, + renderer: Vr, + styles: Ue +}; +export { + Qr as diagram +}; diff --git a/backend/fastrtc/templates/component/c4Diagram-VJAJSXHY-nowPICdC.js b/backend/fastrtc/templates/component/c4Diagram-VJAJSXHY-nowPICdC.js new file mode 100644 index 0000000..8c4cab9 --- /dev/null +++ b/backend/fastrtc/templates/component/c4Diagram-VJAJSXHY-nowPICdC.js @@ -0,0 +1,1581 @@ +import { d as Se, g as De } from "./chunk-D6G4REZN-BlR0637Q.js"; +import { _ as g, a as Pe, s as Be, g as Ie, b as Me, c as Le, d as Bt, w as Ne, e as $t, f as de, h as Tt, i as ge, j as jt, l as fe, k as Ye, m as je } from "./mermaid.core-Cmyps_S7.js"; +var Ft = function() { + var e = /* @__PURE__ */ g(function(_t, x, m, v) { + for (m = m || {}, v = _t.length; v--; m[_t[v]] = x) ; + return m; + }, "o"), t = [1, 24], s = [1, 25], o = [1, 26], l = [1, 27], a = [1, 28], r = [1, 63], n = [1, 64], i = [1, 65], u = [1, 66], d = [1, 67], f = [1, 68], y = [1, 69], E = [1, 29], O = [1, 30], S = [1, 31], P = [1, 32], M = [1, 33], U = [1, 34], H = [1, 35], q = [1, 36], G = [1, 37], K = [1, 38], J = [1, 39], Z = [1, 40], $ = [1, 41], tt = [1, 42], et = [1, 43], at = [1, 44], it = [1, 45], nt = [1, 46], rt = [1, 47], st = [1, 48], lt = [1, 50], ot = [1, 51], ct = [1, 52], ht = [1, 53], ut = [1, 54], dt = [1, 55], ft = [1, 56], pt = [1, 57], yt = [1, 58], gt = [1, 59], bt = [1, 60], Ct = [14, 42], Qt = [14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], St = [12, 14, 34, 36, 37, 38, 39, 40, 41, 42, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], k = [1, 82], A = [1, 83], C = [1, 84], w = [1, 85], T = [12, 14, 42], le = [12, 14, 33, 42], Mt = [12, 14, 33, 42, 76, 77, 79, 80], vt = [12, 33], Ht = [34, 36, 37, 38, 39, 40, 41, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], qt = { + trace: /* @__PURE__ */ g(function() { + }, "trace"), + yy: {}, + symbols_: { error: 2, start: 3, mermaidDoc: 4, direction: 5, direction_tb: 6, direction_bt: 7, direction_rl: 8, direction_lr: 9, graphConfig: 10, C4_CONTEXT: 11, NEWLINE: 12, statements: 13, EOF: 14, C4_CONTAINER: 15, C4_COMPONENT: 16, C4_DYNAMIC: 17, C4_DEPLOYMENT: 18, otherStatements: 19, diagramStatements: 20, otherStatement: 21, title: 22, accDescription: 23, acc_title: 24, acc_title_value: 25, acc_descr: 26, acc_descr_value: 27, acc_descr_multiline_value: 28, boundaryStatement: 29, boundaryStartStatement: 30, boundaryStopStatement: 31, boundaryStart: 32, LBRACE: 33, ENTERPRISE_BOUNDARY: 34, attributes: 35, SYSTEM_BOUNDARY: 36, BOUNDARY: 37, CONTAINER_BOUNDARY: 38, NODE: 39, NODE_L: 40, NODE_R: 41, RBRACE: 42, diagramStatement: 43, PERSON: 44, PERSON_EXT: 45, SYSTEM: 46, SYSTEM_DB: 47, SYSTEM_QUEUE: 48, SYSTEM_EXT: 49, SYSTEM_EXT_DB: 50, SYSTEM_EXT_QUEUE: 51, CONTAINER: 52, CONTAINER_DB: 53, CONTAINER_QUEUE: 54, CONTAINER_EXT: 55, CONTAINER_EXT_DB: 56, CONTAINER_EXT_QUEUE: 57, COMPONENT: 58, COMPONENT_DB: 59, COMPONENT_QUEUE: 60, COMPONENT_EXT: 61, COMPONENT_EXT_DB: 62, COMPONENT_EXT_QUEUE: 63, REL: 64, BIREL: 65, REL_U: 66, REL_D: 67, REL_L: 68, REL_R: 69, REL_B: 70, REL_INDEX: 71, UPDATE_EL_STYLE: 72, UPDATE_REL_STYLE: 73, UPDATE_LAYOUT_CONFIG: 74, attribute: 75, STR: 76, STR_KEY: 77, STR_VALUE: 78, ATTRIBUTE: 79, ATTRIBUTE_EMPTY: 80, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 6: "direction_tb", 7: "direction_bt", 8: "direction_rl", 9: "direction_lr", 11: "C4_CONTEXT", 12: "NEWLINE", 14: "EOF", 15: "C4_CONTAINER", 16: "C4_COMPONENT", 17: "C4_DYNAMIC", 18: "C4_DEPLOYMENT", 22: "title", 23: "accDescription", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "LBRACE", 34: "ENTERPRISE_BOUNDARY", 36: "SYSTEM_BOUNDARY", 37: "BOUNDARY", 38: "CONTAINER_BOUNDARY", 39: "NODE", 40: "NODE_L", 41: "NODE_R", 42: "RBRACE", 44: "PERSON", 45: "PERSON_EXT", 46: "SYSTEM", 47: "SYSTEM_DB", 48: "SYSTEM_QUEUE", 49: "SYSTEM_EXT", 50: "SYSTEM_EXT_DB", 51: "SYSTEM_EXT_QUEUE", 52: "CONTAINER", 53: "CONTAINER_DB", 54: "CONTAINER_QUEUE", 55: "CONTAINER_EXT", 56: "CONTAINER_EXT_DB", 57: "CONTAINER_EXT_QUEUE", 58: "COMPONENT", 59: "COMPONENT_DB", 60: "COMPONENT_QUEUE", 61: "COMPONENT_EXT", 62: "COMPONENT_EXT_DB", 63: "COMPONENT_EXT_QUEUE", 64: "REL", 65: "BIREL", 66: "REL_U", 67: "REL_D", 68: "REL_L", 69: "REL_R", 70: "REL_B", 71: "REL_INDEX", 72: "UPDATE_EL_STYLE", 73: "UPDATE_REL_STYLE", 74: "UPDATE_LAYOUT_CONFIG", 76: "STR", 77: "STR_KEY", 78: "STR_VALUE", 79: "ATTRIBUTE", 80: "ATTRIBUTE_EMPTY" }, + productions_: [0, [3, 1], [3, 1], [5, 1], [5, 1], [5, 1], [5, 1], [4, 1], [10, 4], [10, 4], [10, 4], [10, 4], [10, 4], [13, 1], [13, 1], [13, 2], [19, 1], [19, 2], [19, 3], [21, 1], [21, 1], [21, 2], [21, 2], [21, 1], [29, 3], [30, 3], [30, 3], [30, 4], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [32, 2], [31, 1], [20, 1], [20, 2], [20, 3], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 1], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [43, 2], [35, 1], [35, 2], [75, 1], [75, 2], [75, 1], [75, 1]], + performAction: /* @__PURE__ */ g(function(x, m, v, b, R, h, Dt) { + var p = h.length - 1; + switch (R) { + case 3: + b.setDirection("TB"); + break; + case 4: + b.setDirection("BT"); + break; + case 5: + b.setDirection("RL"); + break; + case 6: + b.setDirection("LR"); + break; + case 8: + case 9: + case 10: + case 11: + case 12: + b.setC4Type(h[p - 3]); + break; + case 19: + b.setTitle(h[p].substring(6)), this.$ = h[p].substring(6); + break; + case 20: + b.setAccDescription(h[p].substring(15)), this.$ = h[p].substring(15); + break; + case 21: + this.$ = h[p].trim(), b.setTitle(this.$); + break; + case 22: + case 23: + this.$ = h[p].trim(), b.setAccDescription(this.$); + break; + case 28: + h[p].splice(2, 0, "ENTERPRISE"), b.addPersonOrSystemBoundary(...h[p]), this.$ = h[p]; + break; + case 29: + h[p].splice(2, 0, "SYSTEM"), b.addPersonOrSystemBoundary(...h[p]), this.$ = h[p]; + break; + case 30: + b.addPersonOrSystemBoundary(...h[p]), this.$ = h[p]; + break; + case 31: + h[p].splice(2, 0, "CONTAINER"), b.addContainerBoundary(...h[p]), this.$ = h[p]; + break; + case 32: + b.addDeploymentNode("node", ...h[p]), this.$ = h[p]; + break; + case 33: + b.addDeploymentNode("nodeL", ...h[p]), this.$ = h[p]; + break; + case 34: + b.addDeploymentNode("nodeR", ...h[p]), this.$ = h[p]; + break; + case 35: + b.popBoundaryParseStack(); + break; + case 39: + b.addPersonOrSystem("person", ...h[p]), this.$ = h[p]; + break; + case 40: + b.addPersonOrSystem("external_person", ...h[p]), this.$ = h[p]; + break; + case 41: + b.addPersonOrSystem("system", ...h[p]), this.$ = h[p]; + break; + case 42: + b.addPersonOrSystem("system_db", ...h[p]), this.$ = h[p]; + break; + case 43: + b.addPersonOrSystem("system_queue", ...h[p]), this.$ = h[p]; + break; + case 44: + b.addPersonOrSystem("external_system", ...h[p]), this.$ = h[p]; + break; + case 45: + b.addPersonOrSystem("external_system_db", ...h[p]), this.$ = h[p]; + break; + case 46: + b.addPersonOrSystem("external_system_queue", ...h[p]), this.$ = h[p]; + break; + case 47: + b.addContainer("container", ...h[p]), this.$ = h[p]; + break; + case 48: + b.addContainer("container_db", ...h[p]), this.$ = h[p]; + break; + case 49: + b.addContainer("container_queue", ...h[p]), this.$ = h[p]; + break; + case 50: + b.addContainer("external_container", ...h[p]), this.$ = h[p]; + break; + case 51: + b.addContainer("external_container_db", ...h[p]), this.$ = h[p]; + break; + case 52: + b.addContainer("external_container_queue", ...h[p]), this.$ = h[p]; + break; + case 53: + b.addComponent("component", ...h[p]), this.$ = h[p]; + break; + case 54: + b.addComponent("component_db", ...h[p]), this.$ = h[p]; + break; + case 55: + b.addComponent("component_queue", ...h[p]), this.$ = h[p]; + break; + case 56: + b.addComponent("external_component", ...h[p]), this.$ = h[p]; + break; + case 57: + b.addComponent("external_component_db", ...h[p]), this.$ = h[p]; + break; + case 58: + b.addComponent("external_component_queue", ...h[p]), this.$ = h[p]; + break; + case 60: + b.addRel("rel", ...h[p]), this.$ = h[p]; + break; + case 61: + b.addRel("birel", ...h[p]), this.$ = h[p]; + break; + case 62: + b.addRel("rel_u", ...h[p]), this.$ = h[p]; + break; + case 63: + b.addRel("rel_d", ...h[p]), this.$ = h[p]; + break; + case 64: + b.addRel("rel_l", ...h[p]), this.$ = h[p]; + break; + case 65: + b.addRel("rel_r", ...h[p]), this.$ = h[p]; + break; + case 66: + b.addRel("rel_b", ...h[p]), this.$ = h[p]; + break; + case 67: + h[p].splice(0, 1), b.addRel("rel", ...h[p]), this.$ = h[p]; + break; + case 68: + b.updateElStyle("update_el_style", ...h[p]), this.$ = h[p]; + break; + case 69: + b.updateRelStyle("update_rel_style", ...h[p]), this.$ = h[p]; + break; + case 70: + b.updateLayoutConfig("update_layout_config", ...h[p]), this.$ = h[p]; + break; + case 71: + this.$ = [h[p]]; + break; + case 72: + h[p].unshift(h[p - 1]), this.$ = h[p]; + break; + case 73: + case 75: + this.$ = h[p].trim(); + break; + case 74: + let Et = {}; + Et[h[p - 1].trim()] = h[p].trim(), this.$ = Et; + break; + case 76: + this.$ = ""; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 5: 3, 6: [1, 5], 7: [1, 6], 8: [1, 7], 9: [1, 8], 10: 4, 11: [1, 9], 15: [1, 10], 16: [1, 11], 17: [1, 12], 18: [1, 13] }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 7] }, { 1: [2, 3] }, { 1: [2, 4] }, { 1: [2, 5] }, { 1: [2, 6] }, { 12: [1, 14] }, { 12: [1, 15] }, { 12: [1, 16] }, { 12: [1, 17] }, { 12: [1, 18] }, { 13: 19, 19: 20, 20: 21, 21: 22, 22: t, 23: s, 24: o, 26: l, 28: a, 29: 49, 30: 61, 32: 62, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 43: 23, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }, { 13: 70, 19: 20, 20: 21, 21: 22, 22: t, 23: s, 24: o, 26: l, 28: a, 29: 49, 30: 61, 32: 62, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 43: 23, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }, { 13: 71, 19: 20, 20: 21, 21: 22, 22: t, 23: s, 24: o, 26: l, 28: a, 29: 49, 30: 61, 32: 62, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 43: 23, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }, { 13: 72, 19: 20, 20: 21, 21: 22, 22: t, 23: s, 24: o, 26: l, 28: a, 29: 49, 30: 61, 32: 62, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 43: 23, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }, { 13: 73, 19: 20, 20: 21, 21: 22, 22: t, 23: s, 24: o, 26: l, 28: a, 29: 49, 30: 61, 32: 62, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 43: 23, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }, { 14: [1, 74] }, e(Ct, [2, 13], { 43: 23, 29: 49, 30: 61, 32: 62, 20: 75, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }), e(Ct, [2, 14]), e(Qt, [2, 16], { 12: [1, 76] }), e(Ct, [2, 36], { 12: [1, 77] }), e(St, [2, 19]), e(St, [2, 20]), { 25: [1, 78] }, { 27: [1, 79] }, e(St, [2, 23]), { 35: 80, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 86, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 87, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 88, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 89, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 90, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 91, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 92, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 93, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 94, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 95, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 96, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 97, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 98, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 99, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 100, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 101, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 102, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 103, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 104, 75: 81, 76: k, 77: A, 79: C, 80: w }, e(T, [2, 59]), { 35: 105, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 106, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 107, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 108, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 109, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 110, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 111, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 112, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 113, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 114, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 115, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 20: 116, 29: 49, 30: 61, 32: 62, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 43: 23, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }, { 12: [1, 118], 33: [1, 117] }, { 35: 119, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 120, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 121, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 122, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 123, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 124, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 35: 125, 75: 81, 76: k, 77: A, 79: C, 80: w }, { 14: [1, 126] }, { 14: [1, 127] }, { 14: [1, 128] }, { 14: [1, 129] }, { 1: [2, 8] }, e(Ct, [2, 15]), e(Qt, [2, 17], { 21: 22, 19: 130, 22: t, 23: s, 24: o, 26: l, 28: a }), e(Ct, [2, 37], { 19: 20, 20: 21, 21: 22, 43: 23, 29: 49, 30: 61, 32: 62, 13: 131, 22: t, 23: s, 24: o, 26: l, 28: a, 34: r, 36: n, 37: i, 38: u, 39: d, 40: f, 41: y, 44: E, 45: O, 46: S, 47: P, 48: M, 49: U, 50: H, 51: q, 52: G, 53: K, 54: J, 55: Z, 56: $, 57: tt, 58: et, 59: at, 60: it, 61: nt, 62: rt, 63: st, 64: lt, 65: ot, 66: ct, 67: ht, 68: ut, 69: dt, 70: ft, 71: pt, 72: yt, 73: gt, 74: bt }), e(St, [2, 21]), e(St, [2, 22]), e(T, [2, 39]), e(le, [2, 71], { 75: 81, 35: 132, 76: k, 77: A, 79: C, 80: w }), e(Mt, [2, 73]), { 78: [1, 133] }, e(Mt, [2, 75]), e(Mt, [2, 76]), e(T, [2, 40]), e(T, [2, 41]), e(T, [2, 42]), e(T, [2, 43]), e(T, [2, 44]), e(T, [2, 45]), e(T, [2, 46]), e(T, [2, 47]), e(T, [2, 48]), e(T, [2, 49]), e(T, [2, 50]), e(T, [2, 51]), e(T, [2, 52]), e(T, [2, 53]), e(T, [2, 54]), e(T, [2, 55]), e(T, [2, 56]), e(T, [2, 57]), e(T, [2, 58]), e(T, [2, 60]), e(T, [2, 61]), e(T, [2, 62]), e(T, [2, 63]), e(T, [2, 64]), e(T, [2, 65]), e(T, [2, 66]), e(T, [2, 67]), e(T, [2, 68]), e(T, [2, 69]), e(T, [2, 70]), { 31: 134, 42: [1, 135] }, { 12: [1, 136] }, { 33: [1, 137] }, e(vt, [2, 28]), e(vt, [2, 29]), e(vt, [2, 30]), e(vt, [2, 31]), e(vt, [2, 32]), e(vt, [2, 33]), e(vt, [2, 34]), { 1: [2, 9] }, { 1: [2, 10] }, { 1: [2, 11] }, { 1: [2, 12] }, e(Qt, [2, 18]), e(Ct, [2, 38]), e(le, [2, 72]), e(Mt, [2, 74]), e(T, [2, 24]), e(T, [2, 35]), e(Ht, [2, 25]), e(Ht, [2, 26], { 12: [1, 138] }), e(Ht, [2, 27])], + defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 7], 5: [2, 3], 6: [2, 4], 7: [2, 5], 8: [2, 6], 74: [2, 8], 126: [2, 9], 127: [2, 10], 128: [2, 11], 129: [2, 12] }, + parseError: /* @__PURE__ */ g(function(x, m) { + if (m.recoverable) + this.trace(x); + else { + var v = new Error(x); + throw v.hash = m, v; + } + }, "parseError"), + parse: /* @__PURE__ */ g(function(x) { + var m = this, v = [0], b = [], R = [null], h = [], Dt = this.table, p = "", Et = 0, oe = 0, we = 2, ce = 1, Te = h.slice.call(arguments, 1), D = Object.create(this.lexer), kt = { yy: {} }; + for (var Gt in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, Gt) && (kt.yy[Gt] = this.yy[Gt]); + D.setInput(x, kt.yy), kt.yy.lexer = D, kt.yy.parser = this, typeof D.yylloc > "u" && (D.yylloc = {}); + var Kt = D.yylloc; + h.push(Kt); + var Oe = D.options && D.options.ranges; + typeof kt.yy.parseError == "function" ? this.parseError = kt.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function Re(L) { + v.length = v.length - 2 * L, R.length = R.length - L, h.length = h.length - L; + } + g(Re, "popStack"); + function he() { + var L; + return L = b.pop() || D.lex() || ce, typeof L != "number" && (L instanceof Array && (b = L, L = b.pop()), L = m.symbols_[L] || L), L; + } + g(he, "lex"); + for (var I, At, N, Jt, wt = {}, Nt, W, ue, Yt; ; ) { + if (At = v[v.length - 1], this.defaultActions[At] ? N = this.defaultActions[At] : ((I === null || typeof I > "u") && (I = he()), N = Dt[At] && Dt[At][I]), typeof N > "u" || !N.length || !N[0]) { + var Zt = ""; + Yt = []; + for (Nt in Dt[At]) + this.terminals_[Nt] && Nt > we && Yt.push("'" + this.terminals_[Nt] + "'"); + D.showPosition ? Zt = "Parse error on line " + (Et + 1) + `: +` + D.showPosition() + ` +Expecting ` + Yt.join(", ") + ", got '" + (this.terminals_[I] || I) + "'" : Zt = "Parse error on line " + (Et + 1) + ": Unexpected " + (I == ce ? "end of input" : "'" + (this.terminals_[I] || I) + "'"), this.parseError(Zt, { + text: D.match, + token: this.terminals_[I] || I, + line: D.yylineno, + loc: Kt, + expected: Yt + }); + } + if (N[0] instanceof Array && N.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + At + ", token: " + I); + switch (N[0]) { + case 1: + v.push(I), R.push(D.yytext), h.push(D.yylloc), v.push(N[1]), I = null, oe = D.yyleng, p = D.yytext, Et = D.yylineno, Kt = D.yylloc; + break; + case 2: + if (W = this.productions_[N[1]][1], wt.$ = R[R.length - W], wt._$ = { + first_line: h[h.length - (W || 1)].first_line, + last_line: h[h.length - 1].last_line, + first_column: h[h.length - (W || 1)].first_column, + last_column: h[h.length - 1].last_column + }, Oe && (wt._$.range = [ + h[h.length - (W || 1)].range[0], + h[h.length - 1].range[1] + ]), Jt = this.performAction.apply(wt, [ + p, + oe, + Et, + kt.yy, + N[1], + R, + h + ].concat(Te)), typeof Jt < "u") + return Jt; + W && (v = v.slice(0, -1 * W * 2), R = R.slice(0, -1 * W), h = h.slice(0, -1 * W)), v.push(this.productions_[N[1]][0]), R.push(wt.$), h.push(wt._$), ue = Dt[v[v.length - 2]][v[v.length - 1]], v.push(ue); + break; + case 3: + return !0; + } + } + return !0; + }, "parse") + }, Ce = /* @__PURE__ */ function() { + var _t = { + EOF: 1, + parseError: /* @__PURE__ */ g(function(m, v) { + if (this.yy.parser) + this.yy.parser.parseError(m, v); + else + throw new Error(m); + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ g(function(x, m) { + return this.yy = m || this.yy || {}, this._input = x, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ g(function() { + var x = this._input[0]; + this.yytext += x, this.yyleng++, this.offset++, this.match += x, this.matched += x; + var m = x.match(/(?:\r\n?|\n).*/g); + return m ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), x; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ g(function(x) { + var m = x.length, v = x.split(/(?:\r\n?|\n)/g); + this._input = x + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - m), this.offset -= m; + var b = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), v.length - 1 && (this.yylineno -= v.length - 1); + var R = this.yylloc.range; + return this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: v ? (v.length === b.length ? this.yylloc.first_column : 0) + b[b.length - v.length].length - v[0].length : this.yylloc.first_column - m + }, this.options.ranges && (this.yylloc.range = [R[0], R[0] + this.yyleng - m]), this.yyleng = this.yytext.length, this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ g(function() { + return this._more = !0, this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ g(function() { + if (this.options.backtrack_lexer) + this._backtrack = !0; + else + return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ g(function(x) { + this.unput(this.match.slice(x)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ g(function() { + var x = this.matched.substr(0, this.matched.length - this.match.length); + return (x.length > 20 ? "..." : "") + x.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ g(function() { + var x = this.match; + return x.length < 20 && (x += this._input.substr(0, 20 - x.length)), (x.substr(0, 20) + (x.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ g(function() { + var x = this.pastInput(), m = new Array(x.length + 1).join("-"); + return x + this.upcomingInput() + ` +` + m + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ g(function(x, m) { + var v, b, R; + if (this.options.backtrack_lexer && (R = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }, this.options.ranges && (R.yylloc.range = this.yylloc.range.slice(0))), b = x[0].match(/(?:\r\n?|\n).*/g), b && (this.yylineno += b.length), this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: b ? b[b.length - 1].length - b[b.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + x[0].length + }, this.yytext += x[0], this.match += x[0], this.matches = x, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(x[0].length), this.matched += x[0], v = this.performAction.call(this, this.yy, this, m, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), v) + return v; + if (this._backtrack) { + for (var h in R) + this[h] = R[h]; + return !1; + } + return !1; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ g(function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var x, m, v, b; + this._more || (this.yytext = "", this.match = ""); + for (var R = this._currentRules(), h = 0; h < R.length; h++) + if (v = this._input.match(this.rules[R[h]]), v && (!m || v[0].length > m[0].length)) { + if (m = v, b = h, this.options.backtrack_lexer) { + if (x = this.test_match(v, R[h]), x !== !1) + return x; + if (this._backtrack) { + m = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return m ? (x = this.test_match(m, R[b]), x !== !1 ? x : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ g(function() { + var m = this.next(); + return m || this.lex(); + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ g(function(m) { + this.conditionStack.push(m); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ g(function() { + var m = this.conditionStack.length - 1; + return m > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ g(function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ g(function(m) { + return m = this.conditionStack.length - 1 - Math.abs(m || 0), m >= 0 ? this.conditionStack[m] : "INITIAL"; + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ g(function(m) { + this.begin(m); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ g(function() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ g(function(m, v, b, R) { + switch (b) { + case 0: + return 6; + case 1: + return 7; + case 2: + return 8; + case 3: + return 9; + case 4: + return 22; + case 5: + return 23; + case 6: + return this.begin("acc_title"), 24; + case 7: + return this.popState(), "acc_title_value"; + case 8: + return this.begin("acc_descr"), 26; + case 9: + return this.popState(), "acc_descr_value"; + case 10: + this.begin("acc_descr_multiline"); + break; + case 11: + this.popState(); + break; + case 12: + return "acc_descr_multiline_value"; + case 13: + break; + case 14: + c; + break; + case 15: + return 12; + case 16: + break; + case 17: + return 11; + case 18: + return 15; + case 19: + return 16; + case 20: + return 17; + case 21: + return 18; + case 22: + return this.begin("person_ext"), 45; + case 23: + return this.begin("person"), 44; + case 24: + return this.begin("system_ext_queue"), 51; + case 25: + return this.begin("system_ext_db"), 50; + case 26: + return this.begin("system_ext"), 49; + case 27: + return this.begin("system_queue"), 48; + case 28: + return this.begin("system_db"), 47; + case 29: + return this.begin("system"), 46; + case 30: + return this.begin("boundary"), 37; + case 31: + return this.begin("enterprise_boundary"), 34; + case 32: + return this.begin("system_boundary"), 36; + case 33: + return this.begin("container_ext_queue"), 57; + case 34: + return this.begin("container_ext_db"), 56; + case 35: + return this.begin("container_ext"), 55; + case 36: + return this.begin("container_queue"), 54; + case 37: + return this.begin("container_db"), 53; + case 38: + return this.begin("container"), 52; + case 39: + return this.begin("container_boundary"), 38; + case 40: + return this.begin("component_ext_queue"), 63; + case 41: + return this.begin("component_ext_db"), 62; + case 42: + return this.begin("component_ext"), 61; + case 43: + return this.begin("component_queue"), 60; + case 44: + return this.begin("component_db"), 59; + case 45: + return this.begin("component"), 58; + case 46: + return this.begin("node"), 39; + case 47: + return this.begin("node"), 39; + case 48: + return this.begin("node_l"), 40; + case 49: + return this.begin("node_r"), 41; + case 50: + return this.begin("rel"), 64; + case 51: + return this.begin("birel"), 65; + case 52: + return this.begin("rel_u"), 66; + case 53: + return this.begin("rel_u"), 66; + case 54: + return this.begin("rel_d"), 67; + case 55: + return this.begin("rel_d"), 67; + case 56: + return this.begin("rel_l"), 68; + case 57: + return this.begin("rel_l"), 68; + case 58: + return this.begin("rel_r"), 69; + case 59: + return this.begin("rel_r"), 69; + case 60: + return this.begin("rel_b"), 70; + case 61: + return this.begin("rel_index"), 71; + case 62: + return this.begin("update_el_style"), 72; + case 63: + return this.begin("update_rel_style"), 73; + case 64: + return this.begin("update_layout_config"), 74; + case 65: + return "EOF_IN_STRUCT"; + case 66: + return this.begin("attribute"), "ATTRIBUTE_EMPTY"; + case 67: + this.begin("attribute"); + break; + case 68: + this.popState(), this.popState(); + break; + case 69: + return 80; + case 70: + break; + case 71: + return 80; + case 72: + this.begin("string"); + break; + case 73: + this.popState(); + break; + case 74: + return "STR"; + case 75: + this.begin("string_kv"); + break; + case 76: + return this.begin("string_kv_key"), "STR_KEY"; + case 77: + this.popState(), this.begin("string_kv_value"); + break; + case 78: + return "STR_VALUE"; + case 79: + this.popState(), this.popState(); + break; + case 80: + return "STR"; + case 81: + return "LBRACE"; + case 82: + return "RBRACE"; + case 83: + return "SPACE"; + case 84: + return "EOL"; + case 85: + return 14; + } + }, "anonymous"), + rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:title\s[^#\n;]+)/, /^(?:accDescription\s[^#\n;]+)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:C4Context\b)/, /^(?:C4Container\b)/, /^(?:C4Component\b)/, /^(?:C4Dynamic\b)/, /^(?:C4Deployment\b)/, /^(?:Person_Ext\b)/, /^(?:Person\b)/, /^(?:SystemQueue_Ext\b)/, /^(?:SystemDb_Ext\b)/, /^(?:System_Ext\b)/, /^(?:SystemQueue\b)/, /^(?:SystemDb\b)/, /^(?:System\b)/, /^(?:Boundary\b)/, /^(?:Enterprise_Boundary\b)/, /^(?:System_Boundary\b)/, /^(?:ContainerQueue_Ext\b)/, /^(?:ContainerDb_Ext\b)/, /^(?:Container_Ext\b)/, /^(?:ContainerQueue\b)/, /^(?:ContainerDb\b)/, /^(?:Container\b)/, /^(?:Container_Boundary\b)/, /^(?:ComponentQueue_Ext\b)/, /^(?:ComponentDb_Ext\b)/, /^(?:Component_Ext\b)/, /^(?:ComponentQueue\b)/, /^(?:ComponentDb\b)/, /^(?:Component\b)/, /^(?:Deployment_Node\b)/, /^(?:Node\b)/, /^(?:Node_L\b)/, /^(?:Node_R\b)/, /^(?:Rel\b)/, /^(?:BiRel\b)/, /^(?:Rel_Up\b)/, /^(?:Rel_U\b)/, /^(?:Rel_Down\b)/, /^(?:Rel_D\b)/, /^(?:Rel_Left\b)/, /^(?:Rel_L\b)/, /^(?:Rel_Right\b)/, /^(?:Rel_R\b)/, /^(?:Rel_Back\b)/, /^(?:RelIndex\b)/, /^(?:UpdateElementStyle\b)/, /^(?:UpdateRelStyle\b)/, /^(?:UpdateLayoutConfig\b)/, /^(?:$)/, /^(?:[(][ ]*[,])/, /^(?:[(])/, /^(?:[)])/, /^(?:,,)/, /^(?:,)/, /^(?:[ ]*["]["])/, /^(?:[ ]*["])/, /^(?:["])/, /^(?:[^"]*)/, /^(?:[ ]*[\$])/, /^(?:[^=]*)/, /^(?:[=][ ]*["])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:[^,]+)/, /^(?:\{)/, /^(?:\})/, /^(?:[\s]+)/, /^(?:[\n\r]+)/, /^(?:$)/], + conditions: { acc_descr_multiline: { rules: [11, 12], inclusive: !1 }, acc_descr: { rules: [9], inclusive: !1 }, acc_title: { rules: [7], inclusive: !1 }, string_kv_value: { rules: [78, 79], inclusive: !1 }, string_kv_key: { rules: [77], inclusive: !1 }, string_kv: { rules: [76], inclusive: !1 }, string: { rules: [73, 74], inclusive: !1 }, attribute: { rules: [68, 69, 70, 71, 72, 75, 80], inclusive: !1 }, update_layout_config: { rules: [65, 66, 67, 68], inclusive: !1 }, update_rel_style: { rules: [65, 66, 67, 68], inclusive: !1 }, update_el_style: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_b: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_r: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_l: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_d: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_u: { rules: [65, 66, 67, 68], inclusive: !1 }, rel_bi: { rules: [], inclusive: !1 }, rel: { rules: [65, 66, 67, 68], inclusive: !1 }, node_r: { rules: [65, 66, 67, 68], inclusive: !1 }, node_l: { rules: [65, 66, 67, 68], inclusive: !1 }, node: { rules: [65, 66, 67, 68], inclusive: !1 }, index: { rules: [], inclusive: !1 }, rel_index: { rules: [65, 66, 67, 68], inclusive: !1 }, component_ext_queue: { rules: [], inclusive: !1 }, component_ext_db: { rules: [65, 66, 67, 68], inclusive: !1 }, component_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, component_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, component_db: { rules: [65, 66, 67, 68], inclusive: !1 }, component: { rules: [65, 66, 67, 68], inclusive: !1 }, container_boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, container_ext_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, container_ext_db: { rules: [65, 66, 67, 68], inclusive: !1 }, container_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, container_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, container_db: { rules: [65, 66, 67, 68], inclusive: !1 }, container: { rules: [65, 66, 67, 68], inclusive: !1 }, birel: { rules: [65, 66, 67, 68], inclusive: !1 }, system_boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, enterprise_boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, boundary: { rules: [65, 66, 67, 68], inclusive: !1 }, system_ext_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, system_ext_db: { rules: [65, 66, 67, 68], inclusive: !1 }, system_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, system_queue: { rules: [65, 66, 67, 68], inclusive: !1 }, system_db: { rules: [65, 66, 67, 68], inclusive: !1 }, system: { rules: [65, 66, 67, 68], inclusive: !1 }, person_ext: { rules: [65, 66, 67, 68], inclusive: !1 }, person: { rules: [65, 66, 67, 68], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 81, 82, 83, 84, 85], inclusive: !0 } } + }; + return _t; + }(); + qt.lexer = Ce; + function Lt() { + this.yy = {}; + } + return g(Lt, "Parser"), Lt.prototype = qt, qt.Parser = Lt, new Lt(); +}(); +Ft.parser = Ft; +var Ue = Ft, V = [], xt = [""], B = "global", F = "", X = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } +], It = [], ie = "", ne = !1, Vt = 4, zt = 2, be, Fe = /* @__PURE__ */ g(function() { + return be; +}, "getC4Type"), Ve = /* @__PURE__ */ g(function(e) { + be = ge(e, Bt()); +}, "setC4Type"), ze = /* @__PURE__ */ g(function(e, t, s, o, l, a, r, n, i) { + if (e == null || t === void 0 || t === null || s === void 0 || s === null || o === void 0 || o === null) + return; + let u = {}; + const d = It.find((f) => f.from === t && f.to === s); + if (d ? u = d : It.push(u), u.type = e, u.from = t, u.to = s, u.label = { text: o }, l == null) + u.techn = { text: "" }; + else if (typeof l == "object") { + let [f, y] = Object.entries(l)[0]; + u[f] = { text: y }; + } else + u.techn = { text: l }; + if (a == null) + u.descr = { text: "" }; + else if (typeof a == "object") { + let [f, y] = Object.entries(a)[0]; + u[f] = { text: y }; + } else + u.descr = { text: a }; + if (typeof r == "object") { + let [f, y] = Object.entries(r)[0]; + u[f] = y; + } else + u.sprite = r; + if (typeof n == "object") { + let [f, y] = Object.entries(n)[0]; + u[f] = y; + } else + u.tags = n; + if (typeof i == "object") { + let [f, y] = Object.entries(i)[0]; + u[f] = y; + } else + u.link = i; + u.wrap = mt(); +}, "addRel"), Xe = /* @__PURE__ */ g(function(e, t, s, o, l, a, r) { + if (t === null || s === null) + return; + let n = {}; + const i = V.find((u) => u.alias === t); + if (i && t === i.alias ? n = i : (n.alias = t, V.push(n)), s == null ? n.label = { text: "" } : n.label = { text: s }, o == null) + n.descr = { text: "" }; + else if (typeof o == "object") { + let [u, d] = Object.entries(o)[0]; + n[u] = { text: d }; + } else + n.descr = { text: o }; + if (typeof l == "object") { + let [u, d] = Object.entries(l)[0]; + n[u] = d; + } else + n.sprite = l; + if (typeof a == "object") { + let [u, d] = Object.entries(a)[0]; + n[u] = d; + } else + n.tags = a; + if (typeof r == "object") { + let [u, d] = Object.entries(r)[0]; + n[u] = d; + } else + n.link = r; + n.typeC4Shape = { text: e }, n.parentBoundary = B, n.wrap = mt(); +}, "addPersonOrSystem"), We = /* @__PURE__ */ g(function(e, t, s, o, l, a, r, n) { + if (t === null || s === null) + return; + let i = {}; + const u = V.find((d) => d.alias === t); + if (u && t === u.alias ? i = u : (i.alias = t, V.push(i)), s == null ? i.label = { text: "" } : i.label = { text: s }, o == null) + i.techn = { text: "" }; + else if (typeof o == "object") { + let [d, f] = Object.entries(o)[0]; + i[d] = { text: f }; + } else + i.techn = { text: o }; + if (l == null) + i.descr = { text: "" }; + else if (typeof l == "object") { + let [d, f] = Object.entries(l)[0]; + i[d] = { text: f }; + } else + i.descr = { text: l }; + if (typeof a == "object") { + let [d, f] = Object.entries(a)[0]; + i[d] = f; + } else + i.sprite = a; + if (typeof r == "object") { + let [d, f] = Object.entries(r)[0]; + i[d] = f; + } else + i.tags = r; + if (typeof n == "object") { + let [d, f] = Object.entries(n)[0]; + i[d] = f; + } else + i.link = n; + i.wrap = mt(), i.typeC4Shape = { text: e }, i.parentBoundary = B; +}, "addContainer"), Qe = /* @__PURE__ */ g(function(e, t, s, o, l, a, r, n) { + if (t === null || s === null) + return; + let i = {}; + const u = V.find((d) => d.alias === t); + if (u && t === u.alias ? i = u : (i.alias = t, V.push(i)), s == null ? i.label = { text: "" } : i.label = { text: s }, o == null) + i.techn = { text: "" }; + else if (typeof o == "object") { + let [d, f] = Object.entries(o)[0]; + i[d] = { text: f }; + } else + i.techn = { text: o }; + if (l == null) + i.descr = { text: "" }; + else if (typeof l == "object") { + let [d, f] = Object.entries(l)[0]; + i[d] = { text: f }; + } else + i.descr = { text: l }; + if (typeof a == "object") { + let [d, f] = Object.entries(a)[0]; + i[d] = f; + } else + i.sprite = a; + if (typeof r == "object") { + let [d, f] = Object.entries(r)[0]; + i[d] = f; + } else + i.tags = r; + if (typeof n == "object") { + let [d, f] = Object.entries(n)[0]; + i[d] = f; + } else + i.link = n; + i.wrap = mt(), i.typeC4Shape = { text: e }, i.parentBoundary = B; +}, "addComponent"), He = /* @__PURE__ */ g(function(e, t, s, o, l) { + if (e === null || t === null) + return; + let a = {}; + const r = X.find((n) => n.alias === e); + if (r && e === r.alias ? a = r : (a.alias = e, X.push(a)), t == null ? a.label = { text: "" } : a.label = { text: t }, s == null) + a.type = { text: "system" }; + else if (typeof s == "object") { + let [n, i] = Object.entries(s)[0]; + a[n] = { text: i }; + } else + a.type = { text: s }; + if (typeof o == "object") { + let [n, i] = Object.entries(o)[0]; + a[n] = i; + } else + a.tags = o; + if (typeof l == "object") { + let [n, i] = Object.entries(l)[0]; + a[n] = i; + } else + a.link = l; + a.parentBoundary = B, a.wrap = mt(), F = B, B = e, xt.push(F); +}, "addPersonOrSystemBoundary"), qe = /* @__PURE__ */ g(function(e, t, s, o, l) { + if (e === null || t === null) + return; + let a = {}; + const r = X.find((n) => n.alias === e); + if (r && e === r.alias ? a = r : (a.alias = e, X.push(a)), t == null ? a.label = { text: "" } : a.label = { text: t }, s == null) + a.type = { text: "container" }; + else if (typeof s == "object") { + let [n, i] = Object.entries(s)[0]; + a[n] = { text: i }; + } else + a.type = { text: s }; + if (typeof o == "object") { + let [n, i] = Object.entries(o)[0]; + a[n] = i; + } else + a.tags = o; + if (typeof l == "object") { + let [n, i] = Object.entries(l)[0]; + a[n] = i; + } else + a.link = l; + a.parentBoundary = B, a.wrap = mt(), F = B, B = e, xt.push(F); +}, "addContainerBoundary"), Ge = /* @__PURE__ */ g(function(e, t, s, o, l, a, r, n) { + if (t === null || s === null) + return; + let i = {}; + const u = X.find((d) => d.alias === t); + if (u && t === u.alias ? i = u : (i.alias = t, X.push(i)), s == null ? i.label = { text: "" } : i.label = { text: s }, o == null) + i.type = { text: "node" }; + else if (typeof o == "object") { + let [d, f] = Object.entries(o)[0]; + i[d] = { text: f }; + } else + i.type = { text: o }; + if (l == null) + i.descr = { text: "" }; + else if (typeof l == "object") { + let [d, f] = Object.entries(l)[0]; + i[d] = { text: f }; + } else + i.descr = { text: l }; + if (typeof r == "object") { + let [d, f] = Object.entries(r)[0]; + i[d] = f; + } else + i.tags = r; + if (typeof n == "object") { + let [d, f] = Object.entries(n)[0]; + i[d] = f; + } else + i.link = n; + i.nodeType = e, i.parentBoundary = B, i.wrap = mt(), F = B, B = t, xt.push(F); +}, "addDeploymentNode"), Ke = /* @__PURE__ */ g(function() { + B = F, xt.pop(), F = xt.pop(), xt.push(F); +}, "popBoundaryParseStack"), Je = /* @__PURE__ */ g(function(e, t, s, o, l, a, r, n, i, u, d) { + let f = V.find((y) => y.alias === t); + if (!(f === void 0 && (f = X.find((y) => y.alias === t), f === void 0))) { + if (s != null) + if (typeof s == "object") { + let [y, E] = Object.entries(s)[0]; + f[y] = E; + } else + f.bgColor = s; + if (o != null) + if (typeof o == "object") { + let [y, E] = Object.entries(o)[0]; + f[y] = E; + } else + f.fontColor = o; + if (l != null) + if (typeof l == "object") { + let [y, E] = Object.entries(l)[0]; + f[y] = E; + } else + f.borderColor = l; + if (a != null) + if (typeof a == "object") { + let [y, E] = Object.entries(a)[0]; + f[y] = E; + } else + f.shadowing = a; + if (r != null) + if (typeof r == "object") { + let [y, E] = Object.entries(r)[0]; + f[y] = E; + } else + f.shape = r; + if (n != null) + if (typeof n == "object") { + let [y, E] = Object.entries(n)[0]; + f[y] = E; + } else + f.sprite = n; + if (i != null) + if (typeof i == "object") { + let [y, E] = Object.entries(i)[0]; + f[y] = E; + } else + f.techn = i; + if (u != null) + if (typeof u == "object") { + let [y, E] = Object.entries(u)[0]; + f[y] = E; + } else + f.legendText = u; + if (d != null) + if (typeof d == "object") { + let [y, E] = Object.entries(d)[0]; + f[y] = E; + } else + f.legendSprite = d; + } +}, "updateElStyle"), Ze = /* @__PURE__ */ g(function(e, t, s, o, l, a, r) { + const n = It.find((i) => i.from === t && i.to === s); + if (n !== void 0) { + if (o != null) + if (typeof o == "object") { + let [i, u] = Object.entries(o)[0]; + n[i] = u; + } else + n.textColor = o; + if (l != null) + if (typeof l == "object") { + let [i, u] = Object.entries(l)[0]; + n[i] = u; + } else + n.lineColor = l; + if (a != null) + if (typeof a == "object") { + let [i, u] = Object.entries(a)[0]; + n[i] = parseInt(u); + } else + n.offsetX = parseInt(a); + if (r != null) + if (typeof r == "object") { + let [i, u] = Object.entries(r)[0]; + n[i] = parseInt(u); + } else + n.offsetY = parseInt(r); + } +}, "updateRelStyle"), $e = /* @__PURE__ */ g(function(e, t, s) { + let o = Vt, l = zt; + if (typeof t == "object") { + const a = Object.values(t)[0]; + o = parseInt(a); + } else + o = parseInt(t); + if (typeof s == "object") { + const a = Object.values(s)[0]; + l = parseInt(a); + } else + l = parseInt(s); + o >= 1 && (Vt = o), l >= 1 && (zt = l); +}, "updateLayoutConfig"), t0 = /* @__PURE__ */ g(function() { + return Vt; +}, "getC4ShapeInRow"), e0 = /* @__PURE__ */ g(function() { + return zt; +}, "getC4BoundaryInRow"), a0 = /* @__PURE__ */ g(function() { + return B; +}, "getCurrentBoundaryParse"), i0 = /* @__PURE__ */ g(function() { + return F; +}, "getParentBoundaryParse"), _e = /* @__PURE__ */ g(function(e) { + return e == null ? V : V.filter((t) => t.parentBoundary === e); +}, "getC4ShapeArray"), n0 = /* @__PURE__ */ g(function(e) { + return V.find((t) => t.alias === e); +}, "getC4Shape"), r0 = /* @__PURE__ */ g(function(e) { + return Object.keys(_e(e)); +}, "getC4ShapeKeys"), xe = /* @__PURE__ */ g(function(e) { + return e == null ? X : X.filter((t) => t.parentBoundary === e); +}, "getBoundaries"), s0 = xe, l0 = /* @__PURE__ */ g(function() { + return It; +}, "getRels"), o0 = /* @__PURE__ */ g(function() { + return ie; +}, "getTitle"), c0 = /* @__PURE__ */ g(function(e) { + ne = e; +}, "setWrap"), mt = /* @__PURE__ */ g(function() { + return ne; +}, "autoWrap"), h0 = /* @__PURE__ */ g(function() { + V = [], X = [ + { + alias: "global", + label: { text: "global" }, + type: { text: "global" }, + tags: null, + link: null, + parentBoundary: "" + } + ], F = "", B = "global", xt = [""], It = [], xt = [""], ie = "", ne = !1, Vt = 4, zt = 2; +}, "clear"), u0 = { + SOLID: 0, + DOTTED: 1, + NOTE: 2, + SOLID_CROSS: 3, + DOTTED_CROSS: 4, + SOLID_OPEN: 5, + DOTTED_OPEN: 6, + LOOP_START: 10, + LOOP_END: 11, + ALT_START: 12, + ALT_ELSE: 13, + ALT_END: 14, + OPT_START: 15, + OPT_END: 16, + ACTIVE_START: 17, + ACTIVE_END: 18, + PAR_START: 19, + PAR_AND: 20, + PAR_END: 21, + RECT_START: 22, + RECT_END: 23, + SOLID_POINT: 24, + DOTTED_POINT: 25 +}, d0 = { + FILLED: 0, + OPEN: 1 +}, f0 = { + LEFTOF: 0, + RIGHTOF: 1, + OVER: 2 +}, p0 = /* @__PURE__ */ g(function(e) { + ie = ge(e, Bt()); +}, "setTitle"), te = { + addPersonOrSystem: Xe, + addPersonOrSystemBoundary: He, + addContainer: We, + addContainerBoundary: qe, + addComponent: Qe, + addDeploymentNode: Ge, + popBoundaryParseStack: Ke, + addRel: ze, + updateElStyle: Je, + updateRelStyle: Ze, + updateLayoutConfig: $e, + autoWrap: mt, + setWrap: c0, + getC4ShapeArray: _e, + getC4Shape: n0, + getC4ShapeKeys: r0, + getBoundaries: xe, + getBoundarys: s0, + getCurrentBoundaryParse: a0, + getParentBoundaryParse: i0, + getRels: l0, + getTitle: o0, + getC4Type: Fe, + getC4ShapeInRow: t0, + getC4BoundaryInRow: e0, + setAccTitle: Be, + getAccTitle: Ie, + getAccDescription: Me, + setAccDescription: Le, + getConfig: /* @__PURE__ */ g(() => Bt().c4, "getConfig"), + clear: h0, + LINETYPE: u0, + ARROWTYPE: d0, + PLACEMENT: f0, + setTitle: p0, + setC4Type: Ve + // apply, +}, re = /* @__PURE__ */ g(function(e, t) { + return Se(e, t); +}, "drawRect"), me = /* @__PURE__ */ g(function(e, t, s, o, l, a) { + const r = e.append("image"); + r.attr("width", t), r.attr("height", s), r.attr("x", o), r.attr("y", l); + let n = a.startsWith("data:image/png;base64") ? a : je(a); + r.attr("xlink:href", n); +}, "drawImage"), y0 = /* @__PURE__ */ g((e, t, s) => { + const o = e.append("g"); + let l = 0; + for (let a of t) { + let r = a.textColor ? a.textColor : "#444444", n = a.lineColor ? a.lineColor : "#444444", i = a.offsetX ? parseInt(a.offsetX) : 0, u = a.offsetY ? parseInt(a.offsetY) : 0, d = ""; + if (l === 0) { + let y = o.append("line"); + y.attr("x1", a.startPoint.x), y.attr("y1", a.startPoint.y), y.attr("x2", a.endPoint.x), y.attr("y2", a.endPoint.y), y.attr("stroke-width", "1"), y.attr("stroke", n), y.style("fill", "none"), a.type !== "rel_b" && y.attr("marker-end", "url(" + d + "#arrowhead)"), (a.type === "birel" || a.type === "rel_b") && y.attr("marker-start", "url(" + d + "#arrowend)"), l = -1; + } else { + let y = o.append("path"); + y.attr("fill", "none").attr("stroke-width", "1").attr("stroke", n).attr( + "d", + "Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx", a.startPoint.x).replaceAll("starty", a.startPoint.y).replaceAll( + "controlx", + a.startPoint.x + (a.endPoint.x - a.startPoint.x) / 2 - (a.endPoint.x - a.startPoint.x) / 4 + ).replaceAll("controly", a.startPoint.y + (a.endPoint.y - a.startPoint.y) / 2).replaceAll("stopx", a.endPoint.x).replaceAll("stopy", a.endPoint.y) + ), a.type !== "rel_b" && y.attr("marker-end", "url(" + d + "#arrowhead)"), (a.type === "birel" || a.type === "rel_b") && y.attr("marker-start", "url(" + d + "#arrowend)"); + } + let f = s.messageFont(); + Q(s)( + a.label.text, + o, + Math.min(a.startPoint.x, a.endPoint.x) + Math.abs(a.endPoint.x - a.startPoint.x) / 2 + i, + Math.min(a.startPoint.y, a.endPoint.y) + Math.abs(a.endPoint.y - a.startPoint.y) / 2 + u, + a.label.width, + a.label.height, + { fill: r }, + f + ), a.techn && a.techn.text !== "" && (f = s.messageFont(), Q(s)( + "[" + a.techn.text + "]", + o, + Math.min(a.startPoint.x, a.endPoint.x) + Math.abs(a.endPoint.x - a.startPoint.x) / 2 + i, + Math.min(a.startPoint.y, a.endPoint.y) + Math.abs(a.endPoint.y - a.startPoint.y) / 2 + s.messageFontSize + 5 + u, + Math.max(a.label.width, a.techn.width), + a.techn.height, + { fill: r, "font-style": "italic" }, + f + )); + } +}, "drawRels"), g0 = /* @__PURE__ */ g(function(e, t, s) { + const o = e.append("g"); + let l = t.bgColor ? t.bgColor : "none", a = t.borderColor ? t.borderColor : "#444444", r = t.fontColor ? t.fontColor : "black", n = { "stroke-width": 1, "stroke-dasharray": "7.0,7.0" }; + t.nodeType && (n = { "stroke-width": 1 }); + let i = { + x: t.x, + y: t.y, + fill: l, + stroke: a, + width: t.width, + height: t.height, + rx: 2.5, + ry: 2.5, + attrs: n + }; + re(o, i); + let u = s.boundaryFont(); + u.fontWeight = "bold", u.fontSize = u.fontSize + 2, u.fontColor = r, Q(s)( + t.label.text, + o, + t.x, + t.y + t.label.Y, + t.width, + t.height, + { fill: "#444444" }, + u + ), t.type && t.type.text !== "" && (u = s.boundaryFont(), u.fontColor = r, Q(s)( + t.type.text, + o, + t.x, + t.y + t.type.Y, + t.width, + t.height, + { fill: "#444444" }, + u + )), t.descr && t.descr.text !== "" && (u = s.boundaryFont(), u.fontSize = u.fontSize - 2, u.fontColor = r, Q(s)( + t.descr.text, + o, + t.x, + t.y + t.descr.Y, + t.width, + t.height, + { fill: "#444444" }, + u + )); +}, "drawBoundary"), b0 = /* @__PURE__ */ g(function(e, t, s) { + var f; + let o = t.bgColor ? t.bgColor : s[t.typeC4Shape.text + "_bg_color"], l = t.borderColor ? t.borderColor : s[t.typeC4Shape.text + "_border_color"], a = t.fontColor ? t.fontColor : "#FFFFFF", r = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII="; + switch (t.typeC4Shape.text) { + case "person": + r = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAACD0lEQVR4Xu2YoU4EMRCGT+4j8Ai8AhaH4QHgAUjQuFMECUgMIUgwJAgMhgQsAYUiJCiQIBBY+EITsjfTdme6V24v4c8vyGbb+ZjOtN0bNcvjQXmkH83WvYBWto6PLm6v7p7uH1/w2fXD+PBycX1Pv2l3IdDm/vn7x+dXQiAubRzoURa7gRZWd0iGRIiJbOnhnfYBQZNJjNbuyY2eJG8fkDE3bbG4ep6MHUAsgYxmE3nVs6VsBWJSGccsOlFPmLIViMzLOB7pCVO2AtHJMohH7Fh6zqitQK7m0rJvAVYgGcEpe//PLdDz65sM4pF9N7ICcXDKIB5Nv6j7tD0NoSdM2QrU9Gg0ewE1LqBhHR3BBdvj2vapnidjHxD/q6vd7Pvhr31AwcY8eXMTXAKECZZJFXuEq27aLgQK5uLMohCenGGuGewOxSjBvYBqeG6B+Nqiblggdjnc+ZXDy+FNFpFzw76O3UBAROuXh6FoiAcf5g9eTvUgzy0nWg6I8cXHRUpg5bOVBCo+KDpFajOf23GgPme7RSQ+lacIENUgJ6gg1k6HjgOlqnLqip4tEuhv0hNEMXUD0clyXE3p6pZA0S2nnvTlXwLJEZWlb7cTQH1+USgTN4VhAenm/wea1OCAOmqo6fE1WCb9WSKBah+rbUWPWAmE2Rvk0ApiB45eOyNAzU8xcTvj8KvkKEoOaIYeHNA3ZuygAvFMUO0AAAAASUVORK5CYII="; + break; + case "external_person": + r = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAIAAADYYG7QAAAB6ElEQVR4Xu2YLY+EMBCG9+dWr0aj0Wg0Go1Go0+j8Xdv2uTCvv1gpt0ebHKPuhDaeW4605Z9mJvx4AdXUyTUdd08z+u6flmWZRnHsWkafk9DptAwDPu+f0eAYtu2PEaGWuj5fCIZrBAC2eLBAnRCsEkkxmeaJp7iDJ2QMDdHsLg8SxKFEJaAo8lAXnmuOFIhTMpxxKATebo4UiFknuNo4OniSIXQyRxEA3YsnjGCVEjVXD7yLUAqxBGUyPv/Y4W2beMgGuS7kVQIBycH0fD+oi5pezQETxdHKmQKGk1eQEYldK+jw5GxPfZ9z7Mk0Qnhf1W1m3w//EUn5BDmSZsbR44QQLBEqrBHqOrmSKaQAxdnLArCrxZcM7A7ZKs4ioRq8LFC+NpC3WCBJsvpVw5edm9iEXFuyNfxXAgSwfrFQ1c0iNda8AdejvUgnktOtJQQxmcfFzGglc5WVCj7oDgFqU18boeFSs52CUh8LE8BIVQDT1ABrB0HtgSEYlX5doJnCwv9TXocKCaKbnwhdDKPq4lf3SwU3HLq4V/+WYhHVMa/3b4IlfyikAduCkcBc7mQ3/z/Qq/cTuikhkzB12Ae/mcJC9U+Vo8Ej1gWAtgbeGgFsAMHr50BIWOLCbezvhpBFUdY6EJuJ/QDW0XoMX60zZ0AAAAASUVORK5CYII="; + break; + } + const n = e.append("g"); + n.attr("class", "person-man"); + const i = De(); + switch (t.typeC4Shape.text) { + case "person": + case "external_person": + case "system": + case "external_system": + case "container": + case "external_container": + case "component": + case "external_component": + i.x = t.x, i.y = t.y, i.fill = o, i.width = t.width, i.height = t.height, i.stroke = l, i.rx = 2.5, i.ry = 2.5, i.attrs = { "stroke-width": 0.5 }, re(n, i); + break; + case "system_db": + case "external_system_db": + case "container_db": + case "external_container_db": + case "component_db": + case "external_component_db": + n.append("path").attr("fill", o).attr("stroke-width", "0.5").attr("stroke", l).attr( + "d", + "Mstartx,startyc0,-10 half,-10 half,-10c0,0 half,0 half,10l0,heightc0,10 -half,10 -half,10c0,0 -half,0 -half,-10l0,-height".replaceAll("startx", t.x).replaceAll("starty", t.y).replaceAll("half", t.width / 2).replaceAll("height", t.height) + ), n.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", l).attr( + "d", + "Mstartx,startyc0,10 half,10 half,10c0,0 half,0 half,-10".replaceAll("startx", t.x).replaceAll("starty", t.y).replaceAll("half", t.width / 2) + ); + break; + case "system_queue": + case "external_system_queue": + case "container_queue": + case "external_container_queue": + case "component_queue": + case "external_component_queue": + n.append("path").attr("fill", o).attr("stroke-width", "0.5").attr("stroke", l).attr( + "d", + "Mstartx,startylwidth,0c5,0 5,half 5,halfc0,0 0,half -5,halfl-width,0c-5,0 -5,-half -5,-halfc0,0 0,-half 5,-half".replaceAll("startx", t.x).replaceAll("starty", t.y).replaceAll("width", t.width).replaceAll("half", t.height / 2) + ), n.append("path").attr("fill", "none").attr("stroke-width", "0.5").attr("stroke", l).attr( + "d", + "Mstartx,startyc-5,0 -5,half -5,halfc0,half 5,half 5,half".replaceAll("startx", t.x + t.width).replaceAll("starty", t.y).replaceAll("half", t.height / 2) + ); + break; + } + let u = w0(s, t.typeC4Shape.text); + switch (n.append("text").attr("fill", a).attr("font-family", u.fontFamily).attr("font-size", u.fontSize - 2).attr("font-style", "italic").attr("lengthAdjust", "spacing").attr("textLength", t.typeC4Shape.width).attr("x", t.x + t.width / 2 - t.typeC4Shape.width / 2).attr("y", t.y + t.typeC4Shape.Y).text("<<" + t.typeC4Shape.text + ">>"), t.typeC4Shape.text) { + case "person": + case "external_person": + me( + n, + 48, + 48, + t.x + t.width / 2 - 24, + t.y + t.image.Y, + r + ); + break; + } + let d = s[t.typeC4Shape.text + "Font"](); + return d.fontWeight = "bold", d.fontSize = d.fontSize + 2, d.fontColor = a, Q(s)( + t.label.text, + n, + t.x, + t.y + t.label.Y, + t.width, + t.height, + { fill: a }, + d + ), d = s[t.typeC4Shape.text + "Font"](), d.fontColor = a, t.techn && ((f = t.techn) == null ? void 0 : f.text) !== "" ? Q(s)( + t.techn.text, + n, + t.x, + t.y + t.techn.Y, + t.width, + t.height, + { fill: a, "font-style": "italic" }, + d + ) : t.type && t.type.text !== "" && Q(s)( + t.type.text, + n, + t.x, + t.y + t.type.Y, + t.width, + t.height, + { fill: a, "font-style": "italic" }, + d + ), t.descr && t.descr.text !== "" && (d = s.personFont(), d.fontColor = a, Q(s)( + t.descr.text, + n, + t.x, + t.y + t.descr.Y, + t.width, + t.height, + { fill: a }, + d + )), t.height; +}, "drawC4Shape"), _0 = /* @__PURE__ */ g(function(e) { + e.append("defs").append("symbol").attr("id", "database").attr("fill-rule", "evenodd").attr("clip-rule", "evenodd").append("path").attr("transform", "scale(.5)").attr( + "d", + "M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z" + ); +}, "insertDatabaseIcon"), x0 = /* @__PURE__ */ g(function(e) { + e.append("defs").append("symbol").attr("id", "computer").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr( + "d", + "M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z" + ); +}, "insertComputerIcon"), m0 = /* @__PURE__ */ g(function(e) { + e.append("defs").append("symbol").attr("id", "clock").attr("width", "24").attr("height", "24").append("path").attr("transform", "scale(.5)").attr( + "d", + "M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z" + ); +}, "insertClockIcon"), v0 = /* @__PURE__ */ g(function(e) { + e.append("defs").append("marker").attr("id", "arrowhead").attr("refX", 9).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 0 0 L 10 5 L 0 10 z"); +}, "insertArrowHead"), E0 = /* @__PURE__ */ g(function(e) { + e.append("defs").append("marker").attr("id", "arrowend").attr("refX", 1).attr("refY", 5).attr("markerUnits", "userSpaceOnUse").attr("markerWidth", 12).attr("markerHeight", 12).attr("orient", "auto").append("path").attr("d", "M 10 0 L 0 5 L 10 10 z"); +}, "insertArrowEnd"), k0 = /* @__PURE__ */ g(function(e) { + e.append("defs").append("marker").attr("id", "filled-head").attr("refX", 18).attr("refY", 7).attr("markerWidth", 20).attr("markerHeight", 28).attr("orient", "auto").append("path").attr("d", "M 18,7 L9,13 L14,7 L9,1 Z"); +}, "insertArrowFilledHead"), A0 = /* @__PURE__ */ g(function(e) { + e.append("defs").append("marker").attr("id", "sequencenumber").attr("refX", 15).attr("refY", 15).attr("markerWidth", 60).attr("markerHeight", 40).attr("orient", "auto").append("circle").attr("cx", 15).attr("cy", 15).attr("r", 6); +}, "insertDynamicNumber"), C0 = /* @__PURE__ */ g(function(e) { + const s = e.append("defs").append("marker").attr("id", "crosshead").attr("markerWidth", 15).attr("markerHeight", 8).attr("orient", "auto").attr("refX", 16).attr("refY", 4); + s.append("path").attr("fill", "black").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 9,2 V 6 L16,4 Z"), s.append("path").attr("fill", "none").attr("stroke", "#000000").style("stroke-dasharray", "0, 0").attr("stroke-width", "1px").attr("d", "M 0,1 L 6,7 M 6,1 L 0,7"); +}, "insertArrowCrossHead"), w0 = /* @__PURE__ */ g((e, t) => ({ + fontFamily: e[t + "FontFamily"], + fontSize: e[t + "FontSize"], + fontWeight: e[t + "FontWeight"] +}), "getC4ShapeFont"), Q = /* @__PURE__ */ function() { + function e(l, a, r, n, i, u, d) { + const f = a.append("text").attr("x", r + i / 2).attr("y", n + u / 2 + 5).style("text-anchor", "middle").text(l); + o(f, d); + } + g(e, "byText"); + function t(l, a, r, n, i, u, d, f) { + const { fontSize: y, fontFamily: E, fontWeight: O } = f, S = l.split($t.lineBreakRegex); + for (let P = 0; P < S.length; P++) { + const M = P * y - y * (S.length - 1) / 2, U = a.append("text").attr("x", r + i / 2).attr("y", n).style("text-anchor", "middle").attr("dominant-baseline", "middle").style("font-size", y).style("font-weight", O).style("font-family", E); + U.append("tspan").attr("dy", M).text(S[P]).attr("alignment-baseline", "mathematical"), o(U, d); + } + } + g(t, "byTspan"); + function s(l, a, r, n, i, u, d, f) { + const y = a.append("switch"), O = y.append("foreignObject").attr("x", r).attr("y", n).attr("width", i).attr("height", u).append("xhtml:div").style("display", "table").style("height", "100%").style("width", "100%"); + O.append("div").style("display", "table-cell").style("text-align", "center").style("vertical-align", "middle").text(l), t(l, y, r, n, i, u, d, f), o(O, d); + } + g(s, "byFo"); + function o(l, a) { + for (const r in a) + a.hasOwnProperty(r) && l.attr(r, a[r]); + } + return g(o, "_setTextAttrs"), function(l) { + return l.textPlacement === "fo" ? s : l.textPlacement === "old" ? e : t; + }; +}(), z = { + drawRect: re, + drawBoundary: g0, + drawC4Shape: b0, + drawRels: y0, + drawImage: me, + insertArrowHead: v0, + insertArrowEnd: E0, + insertArrowFilledHead: k0, + insertDynamicNumber: A0, + insertArrowCrossHead: C0, + insertDatabaseIcon: _0, + insertComputerIcon: x0, + insertClockIcon: m0 +}, Xt = 0, Wt = 0, ve = 4, ee = 2; +Ft.yy = te; +var _ = {}, Ot, Ee = (Ot = class { + constructor(t) { + this.name = "", this.data = {}, this.data.startx = void 0, this.data.stopx = void 0, this.data.starty = void 0, this.data.stopy = void 0, this.data.widthLimit = void 0, this.nextData = {}, this.nextData.startx = void 0, this.nextData.stopx = void 0, this.nextData.starty = void 0, this.nextData.stopy = void 0, this.nextData.cnt = 0, ae(t.db.getConfig()); + } + setData(t, s, o, l) { + this.nextData.startx = this.data.startx = t, this.nextData.stopx = this.data.stopx = s, this.nextData.starty = this.data.starty = o, this.nextData.stopy = this.data.stopy = l; + } + updateVal(t, s, o, l) { + t[s] === void 0 ? t[s] = o : t[s] = l(o, t[s]); + } + insert(t) { + this.nextData.cnt = this.nextData.cnt + 1; + let s = this.nextData.startx === this.nextData.stopx ? this.nextData.stopx + t.margin : this.nextData.stopx + t.margin * 2, o = s + t.width, l = this.nextData.starty + t.margin * 2, a = l + t.height; + (s >= this.data.widthLimit || o >= this.data.widthLimit || this.nextData.cnt > ve) && (s = this.nextData.startx + t.margin + _.nextLinePaddingX, l = this.nextData.stopy + t.margin * 2, this.nextData.stopx = o = s + t.width, this.nextData.starty = this.nextData.stopy, this.nextData.stopy = a = l + t.height, this.nextData.cnt = 1), t.x = s, t.y = l, this.updateVal(this.data, "startx", s, Math.min), this.updateVal(this.data, "starty", l, Math.min), this.updateVal(this.data, "stopx", o, Math.max), this.updateVal(this.data, "stopy", a, Math.max), this.updateVal(this.nextData, "startx", s, Math.min), this.updateVal(this.nextData, "starty", l, Math.min), this.updateVal(this.nextData, "stopx", o, Math.max), this.updateVal(this.nextData, "stopy", a, Math.max); + } + init(t) { + this.name = "", this.data = { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0, + widthLimit: void 0 + }, this.nextData = { + startx: void 0, + stopx: void 0, + starty: void 0, + stopy: void 0, + cnt: 0 + }, ae(t.db.getConfig()); + } + bumpLastMargin(t) { + this.data.stopx += t, this.data.stopy += t; + } +}, g(Ot, "Bounds"), Ot), ae = /* @__PURE__ */ g(function(e) { + Pe(_, e), e.fontFamily && (_.personFontFamily = _.systemFontFamily = _.messageFontFamily = e.fontFamily), e.fontSize && (_.personFontSize = _.systemFontSize = _.messageFontSize = e.fontSize), e.fontWeight && (_.personFontWeight = _.systemFontWeight = _.messageFontWeight = e.fontWeight); +}, "setConf"), Pt = /* @__PURE__ */ g((e, t) => ({ + fontFamily: e[t + "FontFamily"], + fontSize: e[t + "FontSize"], + fontWeight: e[t + "FontWeight"] +}), "c4ShapeFont"), Ut = /* @__PURE__ */ g((e) => ({ + fontFamily: e.boundaryFontFamily, + fontSize: e.boundaryFontSize, + fontWeight: e.boundaryFontWeight +}), "boundaryFont"), T0 = /* @__PURE__ */ g((e) => ({ + fontFamily: e.messageFontFamily, + fontSize: e.messageFontSize, + fontWeight: e.messageFontWeight +}), "messageFont"); +function j(e, t, s, o, l) { + if (!t[e].width) + if (s) + t[e].text = Ne(t[e].text, l, o), t[e].textLines = t[e].text.split($t.lineBreakRegex).length, t[e].width = l, t[e].height = de(t[e].text, o); + else { + let a = t[e].text.split($t.lineBreakRegex); + t[e].textLines = a.length; + let r = 0; + t[e].height = 0, t[e].width = 0; + for (const n of a) + t[e].width = Math.max( + Tt(n, o), + t[e].width + ), r = de(n, o), t[e].height = t[e].height + r; + } +} +g(j, "calcC4ShapeTextWH"); +var ke = /* @__PURE__ */ g(function(e, t, s) { + t.x = s.data.startx, t.y = s.data.starty, t.width = s.data.stopx - s.data.startx, t.height = s.data.stopy - s.data.starty, t.label.y = _.c4ShapeMargin - 35; + let o = t.wrap && _.wrap, l = Ut(_); + l.fontSize = l.fontSize + 2, l.fontWeight = "bold"; + let a = Tt(t.label.text, l); + j("label", t, o, l, a), z.drawBoundary(e, t, _); +}, "drawBoundary"), Ae = /* @__PURE__ */ g(function(e, t, s, o) { + let l = 0; + for (const a of o) { + l = 0; + const r = s[a]; + let n = Pt(_, r.typeC4Shape.text); + switch (n.fontSize = n.fontSize - 2, r.typeC4Shape.width = Tt( + "«" + r.typeC4Shape.text + "»", + n + ), r.typeC4Shape.height = n.fontSize + 2, r.typeC4Shape.Y = _.c4ShapePadding, l = r.typeC4Shape.Y + r.typeC4Shape.height - 4, r.image = { width: 0, height: 0, Y: 0 }, r.typeC4Shape.text) { + case "person": + case "external_person": + r.image.width = 48, r.image.height = 48, r.image.Y = l, l = r.image.Y + r.image.height; + break; + } + r.sprite && (r.image.width = 48, r.image.height = 48, r.image.Y = l, l = r.image.Y + r.image.height); + let i = r.wrap && _.wrap, u = _.width - _.c4ShapePadding * 2, d = Pt(_, r.typeC4Shape.text); + if (d.fontSize = d.fontSize + 2, d.fontWeight = "bold", j("label", r, i, d, u), r.label.Y = l + 8, l = r.label.Y + r.label.height, r.type && r.type.text !== "") { + r.type.text = "[" + r.type.text + "]"; + let E = Pt(_, r.typeC4Shape.text); + j("type", r, i, E, u), r.type.Y = l + 5, l = r.type.Y + r.type.height; + } else if (r.techn && r.techn.text !== "") { + r.techn.text = "[" + r.techn.text + "]"; + let E = Pt(_, r.techn.text); + j("techn", r, i, E, u), r.techn.Y = l + 5, l = r.techn.Y + r.techn.height; + } + let f = l, y = r.label.width; + if (r.descr && r.descr.text !== "") { + let E = Pt(_, r.typeC4Shape.text); + j("descr", r, i, E, u), r.descr.Y = l + 20, l = r.descr.Y + r.descr.height, y = Math.max(r.label.width, r.descr.width), f = l - r.descr.textLines * 5; + } + y = y + _.c4ShapePadding, r.width = Math.max(r.width || _.width, y, _.width), r.height = Math.max(r.height || _.height, f, _.height), r.margin = r.margin || _.c4ShapeMargin, e.insert(r), z.drawC4Shape(t, r, _); + } + e.bumpLastMargin(_.c4ShapeMargin); +}, "drawC4ShapeArray"), Rt, Y = (Rt = class { + constructor(t, s) { + this.x = t, this.y = s; + } +}, g(Rt, "Point"), Rt), pe = /* @__PURE__ */ g(function(e, t) { + let s = e.x, o = e.y, l = t.x, a = t.y, r = s + e.width / 2, n = o + e.height / 2, i = Math.abs(s - l), u = Math.abs(o - a), d = u / i, f = e.height / e.width, y = null; + return o == a && s < l ? y = new Y(s + e.width, n) : o == a && s > l ? y = new Y(s, n) : s == l && o < a ? y = new Y(r, o + e.height) : s == l && o > a && (y = new Y(r, o)), s > l && o < a ? f >= d ? y = new Y(s, n + d * e.width / 2) : y = new Y( + r - i / u * e.height / 2, + o + e.height + ) : s < l && o < a ? f >= d ? y = new Y(s + e.width, n + d * e.width / 2) : y = new Y( + r + i / u * e.height / 2, + o + e.height + ) : s < l && o > a ? f >= d ? y = new Y(s + e.width, n - d * e.width / 2) : y = new Y(r + e.height / 2 * i / u, o) : s > l && o > a && (f >= d ? y = new Y(s, n - e.width / 2 * d) : y = new Y(r - e.height / 2 * i / u, o)), y; +}, "getIntersectPoint"), O0 = /* @__PURE__ */ g(function(e, t) { + let s = { x: 0, y: 0 }; + s.x = t.x + t.width / 2, s.y = t.y + t.height / 2; + let o = pe(e, s); + s.x = e.x + e.width / 2, s.y = e.y + e.height / 2; + let l = pe(t, s); + return { startPoint: o, endPoint: l }; +}, "getIntersectPoints"), R0 = /* @__PURE__ */ g(function(e, t, s, o) { + let l = 0; + for (let a of t) { + l = l + 1; + let r = a.wrap && _.wrap, n = T0(_); + o.db.getC4Type() === "C4Dynamic" && (a.label.text = l + ": " + a.label.text); + let u = Tt(a.label.text, n); + j("label", a, r, n, u), a.techn && a.techn.text !== "" && (u = Tt(a.techn.text, n), j("techn", a, r, n, u)), a.descr && a.descr.text !== "" && (u = Tt(a.descr.text, n), j("descr", a, r, n, u)); + let d = s(a.from), f = s(a.to), y = O0(d, f); + a.startPoint = y.startPoint, a.endPoint = y.endPoint; + } + z.drawRels(e, t, _); +}, "drawRels"); +function se(e, t, s, o, l) { + let a = new Ee(l); + a.data.widthLimit = s.data.widthLimit / Math.min(ee, o.length); + for (let [r, n] of o.entries()) { + let i = 0; + n.image = { width: 0, height: 0, Y: 0 }, n.sprite && (n.image.width = 48, n.image.height = 48, n.image.Y = i, i = n.image.Y + n.image.height); + let u = n.wrap && _.wrap, d = Ut(_); + if (d.fontSize = d.fontSize + 2, d.fontWeight = "bold", j( + "label", + n, + u, + d, + a.data.widthLimit + ), n.label.Y = i + 8, i = n.label.Y + n.label.height, n.type && n.type.text !== "") { + n.type.text = "[" + n.type.text + "]"; + let O = Ut(_); + j( + "type", + n, + u, + O, + a.data.widthLimit + ), n.type.Y = i + 5, i = n.type.Y + n.type.height; + } + if (n.descr && n.descr.text !== "") { + let O = Ut(_); + O.fontSize = O.fontSize - 2, j( + "descr", + n, + u, + O, + a.data.widthLimit + ), n.descr.Y = i + 20, i = n.descr.Y + n.descr.height; + } + if (r == 0 || r % ee === 0) { + let O = s.data.startx + _.diagramMarginX, S = s.data.stopy + _.diagramMarginY + i; + a.setData(O, O, S, S); + } else { + let O = a.data.stopx !== a.data.startx ? a.data.stopx + _.diagramMarginX : a.data.startx, S = a.data.starty; + a.setData(O, O, S, S); + } + a.name = n.alias; + let f = l.db.getC4ShapeArray(n.alias), y = l.db.getC4ShapeKeys(n.alias); + y.length > 0 && Ae( + a, + e, + f, + y + ), t = n.alias; + let E = l.db.getBoundarys(t); + E.length > 0 && se( + e, + t, + a, + E, + l + ), n.alias !== "global" && ke(e, n, a), s.data.stopy = Math.max( + a.data.stopy + _.c4ShapeMargin, + s.data.stopy + ), s.data.stopx = Math.max( + a.data.stopx + _.c4ShapeMargin, + s.data.stopx + ), Xt = Math.max(Xt, s.data.stopx), Wt = Math.max(Wt, s.data.stopy); + } +} +g(se, "drawInsideBoundary"); +var S0 = /* @__PURE__ */ g(function(e, t, s, o) { + _ = Bt().c4; + const l = Bt().securityLevel; + let a; + l === "sandbox" && (a = jt("#i" + t)); + const r = l === "sandbox" ? jt(a.nodes()[0].contentDocument.body) : jt("body"); + let n = o.db; + o.db.setWrap(_.wrap), ve = n.getC4ShapeInRow(), ee = n.getC4BoundaryInRow(), fe.debug(`C:${JSON.stringify(_, null, 2)}`); + const i = l === "sandbox" ? r.select(`[id="${t}"]`) : jt(`[id="${t}"]`); + z.insertComputerIcon(i), z.insertDatabaseIcon(i), z.insertClockIcon(i); + let u = new Ee(o); + u.setData( + _.diagramMarginX, + _.diagramMarginX, + _.diagramMarginY, + _.diagramMarginY + ), u.data.widthLimit = screen.availWidth, Xt = _.diagramMarginX, Wt = _.diagramMarginY; + const d = o.db.getTitle(); + let f = o.db.getBoundarys(""); + se(i, "", u, f, o), z.insertArrowHead(i), z.insertArrowEnd(i), z.insertArrowCrossHead(i), z.insertArrowFilledHead(i), R0(i, o.db.getRels(), o.db.getC4Shape, o), u.data.stopx = Xt, u.data.stopy = Wt; + const y = u.data; + let O = y.stopy - y.starty + 2 * _.diagramMarginY; + const P = y.stopx - y.startx + 2 * _.diagramMarginX; + d && i.append("text").text(d).attr("x", (y.stopx - y.startx) / 2 - 4 * _.diagramMarginX).attr("y", y.starty + _.diagramMarginY), Ye(i, O, P, _.useMaxWidth); + const M = d ? 60 : 0; + i.attr( + "viewBox", + y.startx - _.diagramMarginX + " -" + (_.diagramMarginY + M) + " " + P + " " + (O + M) + ), fe.debug("models:", y); +}, "draw"), ye = { + drawPersonOrSystemArray: Ae, + drawBoundary: ke, + setConf: ae, + draw: S0 +}, D0 = /* @__PURE__ */ g((e) => `.person { + stroke: ${e.personBorder}; + fill: ${e.personBkg}; + } +`, "getStyles"), P0 = D0, M0 = { + parser: Ue, + db: te, + renderer: ye, + styles: P0, + init: /* @__PURE__ */ g(({ c4: e, wrap: t }) => { + ye.setConf(e), te.setWrap(t); + }, "init") +}; +export { + M0 as diagram +}; diff --git a/backend/fastrtc/templates/component/channel-DQMget29.js b/backend/fastrtc/templates/component/channel-DQMget29.js new file mode 100644 index 0000000..630fcac --- /dev/null +++ b/backend/fastrtc/templates/component/channel-DQMget29.js @@ -0,0 +1,5 @@ +import { ao as r, ap as n } from "./mermaid.core-Cmyps_S7.js"; +const t = (a, o) => r.lang.round(n.parse(a)[o]); +export { + t as c +}; diff --git a/backend/fastrtc/templates/component/chunk-4BMEZGHF-skpIwyQ5.js b/backend/fastrtc/templates/component/chunk-4BMEZGHF-skpIwyQ5.js new file mode 100644 index 0000000..92915d5 --- /dev/null +++ b/backend/fastrtc/templates/component/chunk-4BMEZGHF-skpIwyQ5.js @@ -0,0 +1,9 @@ +import { _ as l } from "./mermaid.core-Cmyps_S7.js"; +function m(e, c) { + var i, t, o; + e.accDescr && ((i = c.setAccDescription) == null || i.call(c, e.accDescr)), e.accTitle && ((t = c.setAccTitle) == null || t.call(c, e.accTitle)), e.title && ((o = c.setDiagramTitle) == null || o.call(c, e.title)); +} +l(m, "populateCommonDb"); +export { + m as p +}; diff --git a/backend/fastrtc/templates/component/chunk-A2AXSNBT-zdHOW8wg.js b/backend/fastrtc/templates/component/chunk-A2AXSNBT-zdHOW8wg.js new file mode 100644 index 0000000..b1e7bce --- /dev/null +++ b/backend/fastrtc/templates/component/chunk-A2AXSNBT-zdHOW8wg.js @@ -0,0 +1,1372 @@ +import { g as et, s as tt } from "./chunk-RZ5BOZE2-C6qYYKQn.js"; +import { _ as f, i as st, d as F, P as R, j as $, s as it, g as at, c as nt, b as rt, n as ut, o as lt, e as v, t as ct, l as Oe, u as we, r as ot, y as ht, z as dt } from "./mermaid.core-Cmyps_S7.js"; +var Ve = function() { + var s = /* @__PURE__ */ f(function(I, c, h, p) { + for (h = h || {}, p = I.length; p--; h[I[p]] = c) ; + return h; + }, "o"), i = [1, 18], a = [1, 19], u = [1, 20], l = [1, 41], r = [1, 42], o = [1, 26], A = [1, 24], g = [1, 25], k = [1, 32], L = [1, 33], Ae = [1, 34], m = [1, 45], fe = [1, 35], ge = [1, 36], Ce = [1, 37], me = [1, 38], be = [1, 27], Ee = [1, 28], ye = [1, 29], Te = [1, 30], ke = [1, 31], b = [1, 44], E = [1, 46], y = [1, 43], D = [1, 47], De = [1, 9], d = [1, 8, 9], ee = [1, 58], te = [1, 59], se = [1, 60], ie = [1, 61], ae = [1, 62], Fe = [1, 63], Be = [1, 64], ne = [1, 8, 9, 41], Pe = [1, 76], P = [1, 8, 9, 12, 13, 22, 39, 41, 44, 66, 67, 68, 69, 70, 71, 72, 77, 79], re = [1, 8, 9, 12, 13, 17, 20, 22, 39, 41, 44, 48, 58, 66, 67, 68, 69, 70, 71, 72, 77, 79, 84, 99, 101, 102], ue = [13, 58, 84, 99, 101, 102], z = [13, 58, 71, 72, 84, 99, 101, 102], Me = [13, 58, 66, 67, 68, 69, 70, 84, 99, 101, 102], _e = [1, 98], K = [1, 115], Y = [1, 107], j = [1, 113], Q = [1, 108], W = [1, 109], X = [1, 110], H = [1, 111], q = [1, 112], J = [1, 114], Re = [22, 58, 59, 80, 84, 85, 86, 87, 88, 89], Se = [1, 8, 9, 39, 41, 44], le = [1, 8, 9, 22], Ge = [1, 143], Ue = [1, 8, 9, 59], N = [1, 8, 9, 22, 58, 59, 80, 84, 85, 86, 87, 88, 89], Ne = { + trace: /* @__PURE__ */ f(function() { + }, "trace"), + yy: {}, + symbols_: { error: 2, start: 3, mermaidDoc: 4, statements: 5, graphConfig: 6, CLASS_DIAGRAM: 7, NEWLINE: 8, EOF: 9, statement: 10, classLabel: 11, SQS: 12, STR: 13, SQE: 14, namespaceName: 15, alphaNumToken: 16, DOT: 17, className: 18, classLiteralName: 19, GENERICTYPE: 20, relationStatement: 21, LABEL: 22, namespaceStatement: 23, classStatement: 24, memberStatement: 25, annotationStatement: 26, clickStatement: 27, styleStatement: 28, cssClassStatement: 29, noteStatement: 30, classDefStatement: 31, direction: 32, acc_title: 33, acc_title_value: 34, acc_descr: 35, acc_descr_value: 36, acc_descr_multiline_value: 37, namespaceIdentifier: 38, STRUCT_START: 39, classStatements: 40, STRUCT_STOP: 41, NAMESPACE: 42, classIdentifier: 43, STYLE_SEPARATOR: 44, members: 45, CLASS: 46, ANNOTATION_START: 47, ANNOTATION_END: 48, MEMBER: 49, SEPARATOR: 50, relation: 51, NOTE_FOR: 52, noteText: 53, NOTE: 54, CLASSDEF: 55, classList: 56, stylesOpt: 57, ALPHA: 58, COMMA: 59, direction_tb: 60, direction_bt: 61, direction_rl: 62, direction_lr: 63, relationType: 64, lineType: 65, AGGREGATION: 66, EXTENSION: 67, COMPOSITION: 68, DEPENDENCY: 69, LOLLIPOP: 70, LINE: 71, DOTTED_LINE: 72, CALLBACK: 73, LINK: 74, LINK_TARGET: 75, CLICK: 76, CALLBACK_NAME: 77, CALLBACK_ARGS: 78, HREF: 79, STYLE: 80, CSSCLASS: 81, style: 82, styleComponent: 83, NUM: 84, COLON: 85, UNIT: 86, SPACE: 87, BRKT: 88, PCT: 89, commentToken: 90, textToken: 91, graphCodeTokens: 92, textNoTagsToken: 93, TAGSTART: 94, TAGEND: 95, "==": 96, "--": 97, DEFAULT: 98, MINUS: 99, keywords: 100, UNICODE_TEXT: 101, BQUOTE_STR: 102, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 7: "CLASS_DIAGRAM", 8: "NEWLINE", 9: "EOF", 12: "SQS", 13: "STR", 14: "SQE", 17: "DOT", 20: "GENERICTYPE", 22: "LABEL", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 39: "STRUCT_START", 41: "STRUCT_STOP", 42: "NAMESPACE", 44: "STYLE_SEPARATOR", 46: "CLASS", 47: "ANNOTATION_START", 48: "ANNOTATION_END", 49: "MEMBER", 50: "SEPARATOR", 52: "NOTE_FOR", 54: "NOTE", 55: "CLASSDEF", 58: "ALPHA", 59: "COMMA", 60: "direction_tb", 61: "direction_bt", 62: "direction_rl", 63: "direction_lr", 66: "AGGREGATION", 67: "EXTENSION", 68: "COMPOSITION", 69: "DEPENDENCY", 70: "LOLLIPOP", 71: "LINE", 72: "DOTTED_LINE", 73: "CALLBACK", 74: "LINK", 75: "LINK_TARGET", 76: "CLICK", 77: "CALLBACK_NAME", 78: "CALLBACK_ARGS", 79: "HREF", 80: "STYLE", 81: "CSSCLASS", 84: "NUM", 85: "COLON", 86: "UNIT", 87: "SPACE", 88: "BRKT", 89: "PCT", 92: "graphCodeTokens", 94: "TAGSTART", 95: "TAGEND", 96: "==", 97: "--", 98: "DEFAULT", 99: "MINUS", 100: "keywords", 101: "UNICODE_TEXT", 102: "BQUOTE_STR" }, + productions_: [0, [3, 1], [3, 1], [4, 1], [6, 4], [5, 1], [5, 2], [5, 3], [11, 3], [15, 1], [15, 3], [15, 2], [18, 1], [18, 3], [18, 1], [18, 2], [18, 2], [18, 2], [10, 1], [10, 2], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 1], [10, 2], [10, 2], [10, 1], [23, 4], [23, 5], [38, 2], [40, 1], [40, 2], [40, 3], [24, 1], [24, 3], [24, 4], [24, 6], [43, 2], [43, 3], [26, 4], [45, 1], [45, 2], [25, 1], [25, 2], [25, 1], [25, 1], [21, 3], [21, 4], [21, 4], [21, 5], [30, 3], [30, 2], [31, 3], [56, 1], [56, 3], [32, 1], [32, 1], [32, 1], [32, 1], [51, 3], [51, 2], [51, 2], [51, 1], [64, 1], [64, 1], [64, 1], [64, 1], [64, 1], [65, 1], [65, 1], [27, 3], [27, 4], [27, 3], [27, 4], [27, 4], [27, 5], [27, 3], [27, 4], [27, 4], [27, 5], [27, 4], [27, 5], [27, 5], [27, 6], [28, 3], [29, 3], [57, 1], [57, 3], [82, 1], [82, 2], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [90, 1], [90, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [93, 1], [93, 1], [93, 1], [93, 1], [16, 1], [16, 1], [16, 1], [16, 1], [19, 1], [53, 1]], + performAction: /* @__PURE__ */ f(function(c, h, p, n, C, e, Z) { + var t = e.length - 1; + switch (C) { + case 8: + this.$ = e[t - 1]; + break; + case 9: + case 12: + case 14: + this.$ = e[t]; + break; + case 10: + case 13: + this.$ = e[t - 2] + "." + e[t]; + break; + case 11: + case 15: + this.$ = e[t - 1] + e[t]; + break; + case 16: + case 17: + this.$ = e[t - 1] + "~" + e[t] + "~"; + break; + case 18: + n.addRelation(e[t]); + break; + case 19: + e[t - 1].title = n.cleanupLabel(e[t]), n.addRelation(e[t - 1]); + break; + case 30: + this.$ = e[t].trim(), n.setAccTitle(this.$); + break; + case 31: + case 32: + this.$ = e[t].trim(), n.setAccDescription(this.$); + break; + case 33: + n.addClassesToNamespace(e[t - 3], e[t - 1]); + break; + case 34: + n.addClassesToNamespace(e[t - 4], e[t - 1]); + break; + case 35: + this.$ = e[t], n.addNamespace(e[t]); + break; + case 36: + this.$ = [e[t]]; + break; + case 37: + this.$ = [e[t - 1]]; + break; + case 38: + e[t].unshift(e[t - 2]), this.$ = e[t]; + break; + case 40: + n.setCssClass(e[t - 2], e[t]); + break; + case 41: + n.addMembers(e[t - 3], e[t - 1]); + break; + case 42: + n.setCssClass(e[t - 5], e[t - 3]), n.addMembers(e[t - 5], e[t - 1]); + break; + case 43: + this.$ = e[t], n.addClass(e[t]); + break; + case 44: + this.$ = e[t - 1], n.addClass(e[t - 1]), n.setClassLabel(e[t - 1], e[t]); + break; + case 45: + n.addAnnotation(e[t], e[t - 2]); + break; + case 46: + case 59: + this.$ = [e[t]]; + break; + case 47: + e[t].push(e[t - 1]), this.$ = e[t]; + break; + case 48: + break; + case 49: + n.addMember(e[t - 1], n.cleanupLabel(e[t])); + break; + case 50: + break; + case 51: + break; + case 52: + this.$ = { id1: e[t - 2], id2: e[t], relation: e[t - 1], relationTitle1: "none", relationTitle2: "none" }; + break; + case 53: + this.$ = { id1: e[t - 3], id2: e[t], relation: e[t - 1], relationTitle1: e[t - 2], relationTitle2: "none" }; + break; + case 54: + this.$ = { id1: e[t - 3], id2: e[t], relation: e[t - 2], relationTitle1: "none", relationTitle2: e[t - 1] }; + break; + case 55: + this.$ = { id1: e[t - 4], id2: e[t], relation: e[t - 2], relationTitle1: e[t - 3], relationTitle2: e[t - 1] }; + break; + case 56: + n.addNote(e[t], e[t - 1]); + break; + case 57: + n.addNote(e[t]); + break; + case 58: + this.$ = e[t - 2], n.defineClass(e[t - 1], e[t]); + break; + case 60: + this.$ = e[t - 2].concat([e[t]]); + break; + case 61: + n.setDirection("TB"); + break; + case 62: + n.setDirection("BT"); + break; + case 63: + n.setDirection("RL"); + break; + case 64: + n.setDirection("LR"); + break; + case 65: + this.$ = { type1: e[t - 2], type2: e[t], lineType: e[t - 1] }; + break; + case 66: + this.$ = { type1: "none", type2: e[t], lineType: e[t - 1] }; + break; + case 67: + this.$ = { type1: e[t - 1], type2: "none", lineType: e[t] }; + break; + case 68: + this.$ = { type1: "none", type2: "none", lineType: e[t] }; + break; + case 69: + this.$ = n.relationType.AGGREGATION; + break; + case 70: + this.$ = n.relationType.EXTENSION; + break; + case 71: + this.$ = n.relationType.COMPOSITION; + break; + case 72: + this.$ = n.relationType.DEPENDENCY; + break; + case 73: + this.$ = n.relationType.LOLLIPOP; + break; + case 74: + this.$ = n.lineType.LINE; + break; + case 75: + this.$ = n.lineType.DOTTED_LINE; + break; + case 76: + case 82: + this.$ = e[t - 2], n.setClickEvent(e[t - 1], e[t]); + break; + case 77: + case 83: + this.$ = e[t - 3], n.setClickEvent(e[t - 2], e[t - 1]), n.setTooltip(e[t - 2], e[t]); + break; + case 78: + this.$ = e[t - 2], n.setLink(e[t - 1], e[t]); + break; + case 79: + this.$ = e[t - 3], n.setLink(e[t - 2], e[t - 1], e[t]); + break; + case 80: + this.$ = e[t - 3], n.setLink(e[t - 2], e[t - 1]), n.setTooltip(e[t - 2], e[t]); + break; + case 81: + this.$ = e[t - 4], n.setLink(e[t - 3], e[t - 2], e[t]), n.setTooltip(e[t - 3], e[t - 1]); + break; + case 84: + this.$ = e[t - 3], n.setClickEvent(e[t - 2], e[t - 1], e[t]); + break; + case 85: + this.$ = e[t - 4], n.setClickEvent(e[t - 3], e[t - 2], e[t - 1]), n.setTooltip(e[t - 3], e[t]); + break; + case 86: + this.$ = e[t - 3], n.setLink(e[t - 2], e[t]); + break; + case 87: + this.$ = e[t - 4], n.setLink(e[t - 3], e[t - 1], e[t]); + break; + case 88: + this.$ = e[t - 4], n.setLink(e[t - 3], e[t - 1]), n.setTooltip(e[t - 3], e[t]); + break; + case 89: + this.$ = e[t - 5], n.setLink(e[t - 4], e[t - 2], e[t]), n.setTooltip(e[t - 4], e[t - 1]); + break; + case 90: + this.$ = e[t - 2], n.setCssStyle(e[t - 1], e[t]); + break; + case 91: + n.setCssClass(e[t - 1], e[t]); + break; + case 92: + this.$ = [e[t]]; + break; + case 93: + e[t - 2].push(e[t]), this.$ = e[t - 2]; + break; + case 95: + this.$ = e[t - 1] + e[t]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 5: 3, 6: 4, 7: [1, 6], 10: 5, 16: 39, 18: 21, 19: 40, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: i, 35: a, 37: u, 38: 22, 42: l, 43: 23, 46: r, 47: o, 49: A, 50: g, 52: k, 54: L, 55: Ae, 58: m, 60: fe, 61: ge, 62: Ce, 63: me, 73: be, 74: Ee, 76: ye, 80: Te, 81: ke, 84: b, 99: E, 101: y, 102: D }, { 1: [3] }, { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3] }, s(De, [2, 5], { 8: [1, 48] }), { 8: [1, 49] }, s(d, [2, 18], { 22: [1, 50] }), s(d, [2, 20]), s(d, [2, 21]), s(d, [2, 22]), s(d, [2, 23]), s(d, [2, 24]), s(d, [2, 25]), s(d, [2, 26]), s(d, [2, 27]), s(d, [2, 28]), s(d, [2, 29]), { 34: [1, 51] }, { 36: [1, 52] }, s(d, [2, 32]), s(d, [2, 48], { 51: 53, 64: 56, 65: 57, 13: [1, 54], 22: [1, 55], 66: ee, 67: te, 68: se, 69: ie, 70: ae, 71: Fe, 72: Be }), { 39: [1, 65] }, s(ne, [2, 39], { 39: [1, 67], 44: [1, 66] }), s(d, [2, 50]), s(d, [2, 51]), { 16: 68, 58: m, 84: b, 99: E, 101: y }, { 16: 39, 18: 69, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, { 16: 39, 18: 70, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, { 16: 39, 18: 71, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, { 58: [1, 72] }, { 13: [1, 73] }, { 16: 39, 18: 74, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, { 13: Pe, 53: 75 }, { 56: 77, 58: [1, 78] }, s(d, [2, 61]), s(d, [2, 62]), s(d, [2, 63]), s(d, [2, 64]), s(P, [2, 12], { 16: 39, 19: 40, 18: 80, 17: [1, 79], 20: [1, 81], 58: m, 84: b, 99: E, 101: y, 102: D }), s(P, [2, 14], { 20: [1, 82] }), { 15: 83, 16: 84, 58: m, 84: b, 99: E, 101: y }, { 16: 39, 18: 85, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, s(re, [2, 118]), s(re, [2, 119]), s(re, [2, 120]), s(re, [2, 121]), s([1, 8, 9, 12, 13, 20, 22, 39, 41, 44, 66, 67, 68, 69, 70, 71, 72, 77, 79], [2, 122]), s(De, [2, 6], { 10: 5, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 18: 21, 38: 22, 43: 23, 16: 39, 19: 40, 5: 86, 33: i, 35: a, 37: u, 42: l, 46: r, 47: o, 49: A, 50: g, 52: k, 54: L, 55: Ae, 58: m, 60: fe, 61: ge, 62: Ce, 63: me, 73: be, 74: Ee, 76: ye, 80: Te, 81: ke, 84: b, 99: E, 101: y, 102: D }), { 5: 87, 10: 5, 16: 39, 18: 21, 19: 40, 21: 7, 23: 8, 24: 9, 25: 10, 26: 11, 27: 12, 28: 13, 29: 14, 30: 15, 31: 16, 32: 17, 33: i, 35: a, 37: u, 38: 22, 42: l, 43: 23, 46: r, 47: o, 49: A, 50: g, 52: k, 54: L, 55: Ae, 58: m, 60: fe, 61: ge, 62: Ce, 63: me, 73: be, 74: Ee, 76: ye, 80: Te, 81: ke, 84: b, 99: E, 101: y, 102: D }, s(d, [2, 19]), s(d, [2, 30]), s(d, [2, 31]), { 13: [1, 89], 16: 39, 18: 88, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, { 51: 90, 64: 56, 65: 57, 66: ee, 67: te, 68: se, 69: ie, 70: ae, 71: Fe, 72: Be }, s(d, [2, 49]), { 65: 91, 71: Fe, 72: Be }, s(ue, [2, 68], { 64: 92, 66: ee, 67: te, 68: se, 69: ie, 70: ae }), s(z, [2, 69]), s(z, [2, 70]), s(z, [2, 71]), s(z, [2, 72]), s(z, [2, 73]), s(Me, [2, 74]), s(Me, [2, 75]), { 8: [1, 94], 24: 95, 40: 93, 43: 23, 46: r }, { 16: 96, 58: m, 84: b, 99: E, 101: y }, { 45: 97, 49: _e }, { 48: [1, 99] }, { 13: [1, 100] }, { 13: [1, 101] }, { 77: [1, 102], 79: [1, 103] }, { 22: K, 57: 104, 58: Y, 80: j, 82: 105, 83: 106, 84: Q, 85: W, 86: X, 87: H, 88: q, 89: J }, { 58: [1, 116] }, { 13: Pe, 53: 117 }, s(d, [2, 57]), s(d, [2, 123]), { 22: K, 57: 118, 58: Y, 59: [1, 119], 80: j, 82: 105, 83: 106, 84: Q, 85: W, 86: X, 87: H, 88: q, 89: J }, s(Re, [2, 59]), { 16: 39, 18: 120, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, s(P, [2, 15]), s(P, [2, 16]), s(P, [2, 17]), { 39: [2, 35] }, { 15: 122, 16: 84, 17: [1, 121], 39: [2, 9], 58: m, 84: b, 99: E, 101: y }, s(Se, [2, 43], { 11: 123, 12: [1, 124] }), s(De, [2, 7]), { 9: [1, 125] }, s(le, [2, 52]), { 16: 39, 18: 126, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, { 13: [1, 128], 16: 39, 18: 127, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, s(ue, [2, 67], { 64: 129, 66: ee, 67: te, 68: se, 69: ie, 70: ae }), s(ue, [2, 66]), { 41: [1, 130] }, { 24: 95, 40: 131, 43: 23, 46: r }, { 8: [1, 132], 41: [2, 36] }, s(ne, [2, 40], { 39: [1, 133] }), { 41: [1, 134] }, { 41: [2, 46], 45: 135, 49: _e }, { 16: 39, 18: 136, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, s(d, [2, 76], { 13: [1, 137] }), s(d, [2, 78], { 13: [1, 139], 75: [1, 138] }), s(d, [2, 82], { 13: [1, 140], 78: [1, 141] }), { 13: [1, 142] }, s(d, [2, 90], { 59: Ge }), s(Ue, [2, 92], { 83: 144, 22: K, 58: Y, 80: j, 84: Q, 85: W, 86: X, 87: H, 88: q, 89: J }), s(N, [2, 94]), s(N, [2, 96]), s(N, [2, 97]), s(N, [2, 98]), s(N, [2, 99]), s(N, [2, 100]), s(N, [2, 101]), s(N, [2, 102]), s(N, [2, 103]), s(N, [2, 104]), s(d, [2, 91]), s(d, [2, 56]), s(d, [2, 58], { 59: Ge }), { 58: [1, 145] }, s(P, [2, 13]), { 15: 146, 16: 84, 58: m, 84: b, 99: E, 101: y }, { 39: [2, 11] }, s(Se, [2, 44]), { 13: [1, 147] }, { 1: [2, 4] }, s(le, [2, 54]), s(le, [2, 53]), { 16: 39, 18: 148, 19: 40, 58: m, 84: b, 99: E, 101: y, 102: D }, s(ue, [2, 65]), s(d, [2, 33]), { 41: [1, 149] }, { 24: 95, 40: 150, 41: [2, 37], 43: 23, 46: r }, { 45: 151, 49: _e }, s(ne, [2, 41]), { 41: [2, 47] }, s(d, [2, 45]), s(d, [2, 77]), s(d, [2, 79]), s(d, [2, 80], { 75: [1, 152] }), s(d, [2, 83]), s(d, [2, 84], { 13: [1, 153] }), s(d, [2, 86], { 13: [1, 155], 75: [1, 154] }), { 22: K, 58: Y, 80: j, 82: 156, 83: 106, 84: Q, 85: W, 86: X, 87: H, 88: q, 89: J }, s(N, [2, 95]), s(Re, [2, 60]), { 39: [2, 10] }, { 14: [1, 157] }, s(le, [2, 55]), s(d, [2, 34]), { 41: [2, 38] }, { 41: [1, 158] }, s(d, [2, 81]), s(d, [2, 85]), s(d, [2, 87]), s(d, [2, 88], { 75: [1, 159] }), s(Ue, [2, 93], { 83: 144, 22: K, 58: Y, 80: j, 84: Q, 85: W, 86: X, 87: H, 88: q, 89: J }), s(Se, [2, 8]), s(ne, [2, 42]), s(d, [2, 89])], + defaultActions: { 2: [2, 1], 3: [2, 2], 4: [2, 3], 83: [2, 35], 122: [2, 11], 125: [2, 4], 135: [2, 47], 146: [2, 10], 150: [2, 38] }, + parseError: /* @__PURE__ */ f(function(c, h) { + if (h.recoverable) + this.trace(c); + else { + var p = new Error(c); + throw p.hash = h, p; + } + }, "parseError"), + parse: /* @__PURE__ */ f(function(c) { + var h = this, p = [0], n = [], C = [null], e = [], Z = this.table, t = "", oe = 0, ze = 0, qe = 2, Ke = 1, Je = e.slice.call(arguments, 1), T = Object.create(this.lexer), O = { yy: {} }; + for (var Le in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, Le) && (O.yy[Le] = this.yy[Le]); + T.setInput(c, O.yy), O.yy.lexer = T, O.yy.parser = this, typeof T.yylloc > "u" && (T.yylloc = {}); + var xe = T.yylloc; + e.push(xe); + var Ze = T.options && T.options.ranges; + typeof O.yy.parseError == "function" ? this.parseError = O.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function $e(_) { + p.length = p.length - 2 * _, C.length = C.length - _, e.length = e.length - _; + } + f($e, "popStack"); + function Ye() { + var _; + return _ = n.pop() || T.lex() || Ke, typeof _ != "number" && (_ instanceof Array && (n = _, _ = n.pop()), _ = h.symbols_[_] || _), _; + } + f(Ye, "lex"); + for (var B, w, S, ve, M = {}, he, x, je, de; ; ) { + if (w = p[p.length - 1], this.defaultActions[w] ? S = this.defaultActions[w] : ((B === null || typeof B > "u") && (B = Ye()), S = Z[w] && Z[w][B]), typeof S > "u" || !S.length || !S[0]) { + var Ie = ""; + de = []; + for (he in Z[w]) + this.terminals_[he] && he > qe && de.push("'" + this.terminals_[he] + "'"); + T.showPosition ? Ie = "Parse error on line " + (oe + 1) + `: +` + T.showPosition() + ` +Expecting ` + de.join(", ") + ", got '" + (this.terminals_[B] || B) + "'" : Ie = "Parse error on line " + (oe + 1) + ": Unexpected " + (B == Ke ? "end of input" : "'" + (this.terminals_[B] || B) + "'"), this.parseError(Ie, { + text: T.match, + token: this.terminals_[B] || B, + line: T.yylineno, + loc: xe, + expected: de + }); + } + if (S[0] instanceof Array && S.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + w + ", token: " + B); + switch (S[0]) { + case 1: + p.push(B), C.push(T.yytext), e.push(T.yylloc), p.push(S[1]), B = null, ze = T.yyleng, t = T.yytext, oe = T.yylineno, xe = T.yylloc; + break; + case 2: + if (x = this.productions_[S[1]][1], M.$ = C[C.length - x], M._$ = { + first_line: e[e.length - (x || 1)].first_line, + last_line: e[e.length - 1].last_line, + first_column: e[e.length - (x || 1)].first_column, + last_column: e[e.length - 1].last_column + }, Ze && (M._$.range = [ + e[e.length - (x || 1)].range[0], + e[e.length - 1].range[1] + ]), ve = this.performAction.apply(M, [ + t, + ze, + oe, + O.yy, + S[1], + C, + e + ].concat(Je)), typeof ve < "u") + return ve; + x && (p = p.slice(0, -1 * x * 2), C = C.slice(0, -1 * x), e = e.slice(0, -1 * x)), p.push(this.productions_[S[1]][0]), C.push(M.$), e.push(M._$), je = Z[p[p.length - 2]][p[p.length - 1]], p.push(je); + break; + case 3: + return !0; + } + } + return !0; + }, "parse") + }, He = /* @__PURE__ */ function() { + var I = { + EOF: 1, + parseError: /* @__PURE__ */ f(function(h, p) { + if (this.yy.parser) + this.yy.parser.parseError(h, p); + else + throw new Error(h); + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ f(function(c, h) { + return this.yy = h || this.yy || {}, this._input = c, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ f(function() { + var c = this._input[0]; + this.yytext += c, this.yyleng++, this.offset++, this.match += c, this.matched += c; + var h = c.match(/(?:\r\n?|\n).*/g); + return h ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), c; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ f(function(c) { + var h = c.length, p = c.split(/(?:\r\n?|\n)/g); + this._input = c + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - h), this.offset -= h; + var n = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), p.length - 1 && (this.yylineno -= p.length - 1); + var C = this.yylloc.range; + return this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: p ? (p.length === n.length ? this.yylloc.first_column : 0) + n[n.length - p.length].length - p[0].length : this.yylloc.first_column - h + }, this.options.ranges && (this.yylloc.range = [C[0], C[0] + this.yyleng - h]), this.yyleng = this.yytext.length, this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ f(function() { + return this._more = !0, this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ f(function() { + if (this.options.backtrack_lexer) + this._backtrack = !0; + else + return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ f(function(c) { + this.unput(this.match.slice(c)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ f(function() { + var c = this.matched.substr(0, this.matched.length - this.match.length); + return (c.length > 20 ? "..." : "") + c.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ f(function() { + var c = this.match; + return c.length < 20 && (c += this._input.substr(0, 20 - c.length)), (c.substr(0, 20) + (c.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ f(function() { + var c = this.pastInput(), h = new Array(c.length + 1).join("-"); + return c + this.upcomingInput() + ` +` + h + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ f(function(c, h) { + var p, n, C; + if (this.options.backtrack_lexer && (C = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }, this.options.ranges && (C.yylloc.range = this.yylloc.range.slice(0))), n = c[0].match(/(?:\r\n?|\n).*/g), n && (this.yylineno += n.length), this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: n ? n[n.length - 1].length - n[n.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + c[0].length + }, this.yytext += c[0], this.match += c[0], this.matches = c, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(c[0].length), this.matched += c[0], p = this.performAction.call(this, this.yy, this, h, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), p) + return p; + if (this._backtrack) { + for (var e in C) + this[e] = C[e]; + return !1; + } + return !1; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ f(function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var c, h, p, n; + this._more || (this.yytext = "", this.match = ""); + for (var C = this._currentRules(), e = 0; e < C.length; e++) + if (p = this._input.match(this.rules[C[e]]), p && (!h || p[0].length > h[0].length)) { + if (h = p, n = e, this.options.backtrack_lexer) { + if (c = this.test_match(p, C[e]), c !== !1) + return c; + if (this._backtrack) { + h = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return h ? (c = this.test_match(h, C[n]), c !== !1 ? c : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ f(function() { + var h = this.next(); + return h || this.lex(); + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ f(function(h) { + this.conditionStack.push(h); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ f(function() { + var h = this.conditionStack.length - 1; + return h > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ f(function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ f(function(h) { + return h = this.conditionStack.length - 1 - Math.abs(h || 0), h >= 0 ? this.conditionStack[h] : "INITIAL"; + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ f(function(h) { + this.begin(h); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ f(function() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ f(function(h, p, n, C) { + switch (n) { + case 0: + return 60; + case 1: + return 61; + case 2: + return 62; + case 3: + return 63; + case 4: + break; + case 5: + break; + case 6: + return this.begin("acc_title"), 33; + case 7: + return this.popState(), "acc_title_value"; + case 8: + return this.begin("acc_descr"), 35; + case 9: + return this.popState(), "acc_descr_value"; + case 10: + this.begin("acc_descr_multiline"); + break; + case 11: + this.popState(); + break; + case 12: + return "acc_descr_multiline_value"; + case 13: + return 8; + case 14: + break; + case 15: + return 7; + case 16: + return 7; + case 17: + return "EDGE_STATE"; + case 18: + this.begin("callback_name"); + break; + case 19: + this.popState(); + break; + case 20: + this.popState(), this.begin("callback_args"); + break; + case 21: + return 77; + case 22: + this.popState(); + break; + case 23: + return 78; + case 24: + this.popState(); + break; + case 25: + return "STR"; + case 26: + this.begin("string"); + break; + case 27: + return 80; + case 28: + return 55; + case 29: + return this.begin("namespace"), 42; + case 30: + return this.popState(), 8; + case 31: + break; + case 32: + return this.begin("namespace-body"), 39; + case 33: + return this.popState(), 41; + case 34: + return "EOF_IN_STRUCT"; + case 35: + return 8; + case 36: + break; + case 37: + return "EDGE_STATE"; + case 38: + return this.begin("class"), 46; + case 39: + return this.popState(), 8; + case 40: + break; + case 41: + return this.popState(), this.popState(), 41; + case 42: + return this.begin("class-body"), 39; + case 43: + return this.popState(), 41; + case 44: + return "EOF_IN_STRUCT"; + case 45: + return "EDGE_STATE"; + case 46: + return "OPEN_IN_STRUCT"; + case 47: + break; + case 48: + return "MEMBER"; + case 49: + return 81; + case 50: + return 73; + case 51: + return 74; + case 52: + return 76; + case 53: + return 52; + case 54: + return 54; + case 55: + return 47; + case 56: + return 48; + case 57: + return 79; + case 58: + this.popState(); + break; + case 59: + return "GENERICTYPE"; + case 60: + this.begin("generic"); + break; + case 61: + this.popState(); + break; + case 62: + return "BQUOTE_STR"; + case 63: + this.begin("bqstring"); + break; + case 64: + return 75; + case 65: + return 75; + case 66: + return 75; + case 67: + return 75; + case 68: + return 67; + case 69: + return 67; + case 70: + return 69; + case 71: + return 69; + case 72: + return 68; + case 73: + return 66; + case 74: + return 70; + case 75: + return 71; + case 76: + return 72; + case 77: + return 22; + case 78: + return 44; + case 79: + return 99; + case 80: + return 17; + case 81: + return "PLUS"; + case 82: + return 85; + case 83: + return 59; + case 84: + return 88; + case 85: + return 88; + case 86: + return 89; + case 87: + return "EQUALS"; + case 88: + return "EQUALS"; + case 89: + return 58; + case 90: + return 12; + case 91: + return 14; + case 92: + return "PUNCTUATION"; + case 93: + return 84; + case 94: + return 101; + case 95: + return 87; + case 96: + return 87; + case 97: + return 9; + } + }, "anonymous"), + rules: [/^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/, /^(?:%%[^\n]*(\r?\n)*)/, /^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:classDiagram-v2\b)/, /^(?:classDiagram\b)/, /^(?:\[\*\])/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:["])/, /^(?:[^"]*)/, /^(?:["])/, /^(?:style\b)/, /^(?:classDef\b)/, /^(?:namespace\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[{])/, /^(?:[}])/, /^(?:$)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:\[\*\])/, /^(?:class\b)/, /^(?:\s*(\r?\n)+)/, /^(?:\s+)/, /^(?:[}])/, /^(?:[{])/, /^(?:[}])/, /^(?:$)/, /^(?:\[\*\])/, /^(?:[{])/, /^(?:[\n])/, /^(?:[^{}\n]*)/, /^(?:cssClass\b)/, /^(?:callback\b)/, /^(?:link\b)/, /^(?:click\b)/, /^(?:note for\b)/, /^(?:note\b)/, /^(?:<<)/, /^(?:>>)/, /^(?:href\b)/, /^(?:[~])/, /^(?:[^~]*)/, /^(?:~)/, /^(?:[`])/, /^(?:[^`]+)/, /^(?:[`])/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:\s*<\|)/, /^(?:\s*\|>)/, /^(?:\s*>)/, /^(?:\s*<)/, /^(?:\s*\*)/, /^(?:\s*o\b)/, /^(?:\s*\(\))/, /^(?:--)/, /^(?:\.\.)/, /^(?::{1}[^:\n;]+)/, /^(?::{3})/, /^(?:-)/, /^(?:\.)/, /^(?:\+)/, /^(?::)/, /^(?:,)/, /^(?:#)/, /^(?:#)/, /^(?:%)/, /^(?:=)/, /^(?:=)/, /^(?:\w+)/, /^(?:\[)/, /^(?:\])/, /^(?:[!"#$%&'*+,-.`?\\/])/, /^(?:[0-9]+)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\s)/, /^(?:\s)/, /^(?:$)/], + conditions: { "namespace-body": { rules: [26, 33, 34, 35, 36, 37, 38, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, namespace: { rules: [26, 29, 30, 31, 32, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, "class-body": { rules: [26, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, class: { rules: [26, 39, 40, 41, 42, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, acc_descr_multiline: { rules: [11, 12, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, acc_descr: { rules: [9, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, acc_title: { rules: [7, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, callback_args: { rules: [22, 23, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, callback_name: { rules: [19, 20, 21, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, href: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, struct: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, generic: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, bqstring: { rules: [26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, string: { rules: [24, 25, 26, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 97], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 26, 27, 28, 29, 38, 49, 50, 51, 52, 53, 54, 55, 56, 57, 60, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97], inclusive: !0 } } + }; + return I; + }(); + Ne.lexer = He; + function ce() { + this.yy = {}; + } + return f(ce, "Parser"), ce.prototype = Ne, Ne.Parser = ce, new ce(); +}(); +Ve.parser = Ve; +var bt = Ve, Qe = ["#", "+", "~", "-", ""], G, We = (G = class { + constructor(i, a) { + this.memberType = a, this.visibility = "", this.classifier = "", this.text = ""; + const u = st(i, F()); + this.parseMember(u); + } + getDisplayDetails() { + let i = this.visibility + R(this.id); + this.memberType === "method" && (i += `(${R(this.parameters.trim())})`, this.returnType && (i += " : " + R(this.returnType))), i = i.trim(); + const a = this.parseClassifier(); + return { + displayText: i, + cssStyle: a + }; + } + parseMember(i) { + let a = ""; + if (this.memberType === "method") { + const r = /([#+~-])?(.+)\((.*)\)([\s$*])?(.*)([$*])?/.exec(i); + if (r) { + const o = r[1] ? r[1].trim() : ""; + if (Qe.includes(o) && (this.visibility = o), this.id = r[2], this.parameters = r[3] ? r[3].trim() : "", a = r[4] ? r[4].trim() : "", this.returnType = r[5] ? r[5].trim() : "", a === "") { + const A = this.returnType.substring(this.returnType.length - 1); + /[$*]/.exec(A) && (a = A, this.returnType = this.returnType.substring(0, this.returnType.length - 1)); + } + } + } else { + const l = i.length, r = i.substring(0, 1), o = i.substring(l - 1); + Qe.includes(r) && (this.visibility = r), /[$*]/.exec(o) && (a = o), this.id = i.substring( + this.visibility === "" ? 0 : 1, + a === "" ? l : l - 1 + ); + } + this.classifier = a, this.id = this.id.startsWith(" ") ? " " + this.id.trim() : this.id.trim(); + const u = `${this.visibility ? "\\" + this.visibility : ""}${R(this.id)}${this.memberType === "method" ? `(${R(this.parameters)})${this.returnType ? " : " + R(this.returnType) : ""}` : ""}`; + this.text = u.replaceAll("<", "<").replaceAll(">", ">"), this.text.startsWith("\\<") && (this.text = this.text.replace("\\<", "~")); + } + parseClassifier() { + switch (this.classifier) { + case "*": + return "font-style:italic;"; + case "$": + return "text-decoration:underline;"; + default: + return ""; + } + } +}, f(G, "ClassMember"), G), pe = "classId-", Xe = 0, V = /* @__PURE__ */ f((s) => v.sanitizeText(s, F()), "sanitizeText"), U, Et = (U = class { + constructor() { + this.relations = [], this.classes = /* @__PURE__ */ new Map(), this.styleClasses = /* @__PURE__ */ new Map(), this.notes = [], this.interfaces = [], this.namespaces = /* @__PURE__ */ new Map(), this.namespaceCounter = 0, this.functions = [], this.lineType = { + LINE: 0, + DOTTED_LINE: 1 + }, this.relationType = { + AGGREGATION: 0, + EXTENSION: 1, + COMPOSITION: 2, + DEPENDENCY: 3, + LOLLIPOP: 4 + }, this.setupToolTips = /* @__PURE__ */ f((i) => { + let a = $(".mermaidTooltip"); + (a._groups || a)[0][0] === null && (a = $("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0)), $(i).select("svg").selectAll("g.node").on("mouseover", (r) => { + const o = $(r.currentTarget); + if (o.attr("title") === null) + return; + const g = this.getBoundingClientRect(); + a.transition().duration(200).style("opacity", ".9"), a.text(o.attr("title")).style("left", window.scrollX + g.left + (g.right - g.left) / 2 + "px").style("top", window.scrollY + g.top - 14 + document.body.scrollTop + "px"), a.html(a.html().replace(/<br\/>/g, "
")), o.classed("hover", !0); + }).on("mouseout", (r) => { + a.transition().duration(500).style("opacity", 0), $(r.currentTarget).classed("hover", !1); + }); + }, "setupToolTips"), this.direction = "TB", this.setAccTitle = it, this.getAccTitle = at, this.setAccDescription = nt, this.getAccDescription = rt, this.setDiagramTitle = ut, this.getDiagramTitle = lt, this.getConfig = /* @__PURE__ */ f(() => F().class, "getConfig"), this.functions.push(this.setupToolTips.bind(this)), this.clear(), this.addRelation = this.addRelation.bind(this), this.addClassesToNamespace = this.addClassesToNamespace.bind(this), this.addNamespace = this.addNamespace.bind(this), this.setCssClass = this.setCssClass.bind(this), this.addMembers = this.addMembers.bind(this), this.addClass = this.addClass.bind(this), this.setClassLabel = this.setClassLabel.bind(this), this.addAnnotation = this.addAnnotation.bind(this), this.addMember = this.addMember.bind(this), this.cleanupLabel = this.cleanupLabel.bind(this), this.addNote = this.addNote.bind(this), this.defineClass = this.defineClass.bind(this), this.setDirection = this.setDirection.bind(this), this.setLink = this.setLink.bind(this), this.bindFunctions = this.bindFunctions.bind(this), this.clear = this.clear.bind(this), this.setTooltip = this.setTooltip.bind(this), this.setClickEvent = this.setClickEvent.bind(this), this.setCssStyle = this.setCssStyle.bind(this); + } + splitClassNameAndType(i) { + const a = v.sanitizeText(i, F()); + let u = "", l = a; + if (a.indexOf("~") > 0) { + const r = a.split("~"); + l = V(r[0]), u = V(r[1]); + } + return { className: l, type: u }; + } + setClassLabel(i, a) { + const u = v.sanitizeText(i, F()); + a && (a = V(a)); + const { className: l } = this.splitClassNameAndType(u); + this.classes.get(l).label = a, this.classes.get(l).text = `${a}${this.classes.get(l).type ? `<${this.classes.get(l).type}>` : ""}`; + } + /** + * Function called by parser when a node definition has been found. + * + * @param id - Id of the class to add + * @public + */ + addClass(i) { + const a = v.sanitizeText(i, F()), { className: u, type: l } = this.splitClassNameAndType(a); + if (this.classes.has(u)) + return; + const r = v.sanitizeText(u, F()); + this.classes.set(r, { + id: r, + type: l, + label: r, + text: `${r}${l ? `<${l}>` : ""}`, + shape: "classBox", + cssClasses: "default", + methods: [], + members: [], + annotations: [], + styles: [], + domId: pe + r + "-" + Xe + }), Xe++; + } + addInterface(i, a) { + const u = { + id: `interface${this.interfaces.length}`, + label: i, + classId: a + }; + this.interfaces.push(u); + } + /** + * Function to lookup domId from id in the graph definition. + * + * @param id - class ID to lookup + * @public + */ + lookUpDomId(i) { + const a = v.sanitizeText(i, F()); + if (this.classes.has(a)) + return this.classes.get(a).domId; + throw new Error("Class not found: " + a); + } + clear() { + this.relations = [], this.classes = /* @__PURE__ */ new Map(), this.notes = [], this.interfaces = [], this.functions = [], this.functions.push(this.setupToolTips.bind(this)), this.namespaces = /* @__PURE__ */ new Map(), this.namespaceCounter = 0, this.direction = "TB", ct(); + } + getClass(i) { + return this.classes.get(i); + } + getClasses() { + return this.classes; + } + getRelations() { + return this.relations; + } + getNotes() { + return this.notes; + } + addRelation(i) { + Oe.debug("Adding relation: " + JSON.stringify(i)); + const a = [ + this.relationType.LOLLIPOP, + this.relationType.AGGREGATION, + this.relationType.COMPOSITION, + this.relationType.DEPENDENCY, + this.relationType.EXTENSION + ]; + i.relation.type1 === this.relationType.LOLLIPOP && !a.includes(i.relation.type2) ? (this.addClass(i.id2), this.addInterface(i.id1, i.id2), i.id1 = `interface${this.interfaces.length - 1}`) : i.relation.type2 === this.relationType.LOLLIPOP && !a.includes(i.relation.type1) ? (this.addClass(i.id1), this.addInterface(i.id2, i.id1), i.id2 = `interface${this.interfaces.length - 1}`) : (this.addClass(i.id1), this.addClass(i.id2)), i.id1 = this.splitClassNameAndType(i.id1).className, i.id2 = this.splitClassNameAndType(i.id2).className, i.relationTitle1 = v.sanitizeText( + i.relationTitle1.trim(), + F() + ), i.relationTitle2 = v.sanitizeText( + i.relationTitle2.trim(), + F() + ), this.relations.push(i); + } + /** + * Adds an annotation to the specified class Annotations mark special properties of the given type + * (like 'interface' or 'service') + * + * @param className - The class name + * @param annotation - The name of the annotation without any brackets + * @public + */ + addAnnotation(i, a) { + const u = this.splitClassNameAndType(i).className; + this.classes.get(u).annotations.push(a); + } + /** + * Adds a member to the specified class + * + * @param className - The class name + * @param member - The full name of the member. If the member is enclosed in `<>` it is + * treated as an annotation If the member is ending with a closing bracket ) it is treated as a + * method Otherwise the member will be treated as a normal property + * @public + */ + addMember(i, a) { + this.addClass(i); + const u = this.splitClassNameAndType(i).className, l = this.classes.get(u); + if (typeof a == "string") { + const r = a.trim(); + r.startsWith("<<") && r.endsWith(">>") ? l.annotations.push(V(r.substring(2, r.length - 2))) : r.indexOf(")") > 0 ? l.methods.push(new We(r, "method")) : r && l.members.push(new We(r, "attribute")); + } + } + addMembers(i, a) { + Array.isArray(a) && (a.reverse(), a.forEach((u) => this.addMember(i, u))); + } + addNote(i, a) { + const u = { + id: `note${this.notes.length}`, + class: a, + text: i + }; + this.notes.push(u); + } + cleanupLabel(i) { + return i.startsWith(":") && (i = i.substring(1)), V(i.trim()); + } + /** + * Called by parser when assigning cssClass to a class + * + * @param ids - Comma separated list of ids + * @param className - Class to add + */ + setCssClass(i, a) { + i.split(",").forEach((u) => { + let l = u; + /\d/.exec(u[0]) && (l = pe + l); + const r = this.classes.get(l); + r && (r.cssClasses += " " + a); + }); + } + defineClass(i, a) { + for (const u of i) { + let l = this.styleClasses.get(u); + l === void 0 && (l = { id: u, styles: [], textStyles: [] }, this.styleClasses.set(u, l)), a && a.forEach((r) => { + if (/color/.exec(r)) { + const o = r.replace("fill", "bgFill"); + l.textStyles.push(o); + } + l.styles.push(r); + }), this.classes.forEach((r) => { + r.cssClasses.includes(u) && r.styles.push(...a.flatMap((o) => o.split(","))); + }); + } + } + /** + * Called by parser when a tooltip is found, e.g. a clickable element. + * + * @param ids - Comma separated list of ids + * @param tooltip - Tooltip to add + */ + setTooltip(i, a) { + i.split(",").forEach((u) => { + a !== void 0 && (this.classes.get(u).tooltip = V(a)); + }); + } + getTooltip(i, a) { + return a && this.namespaces.has(a) ? this.namespaces.get(a).classes.get(i).tooltip : this.classes.get(i).tooltip; + } + /** + * Called by parser when a link is found. Adds the URL to the vertex data. + * + * @param ids - Comma separated list of ids + * @param linkStr - URL to create a link for + * @param target - Target of the link, _blank by default as originally defined in the svgDraw.js file + */ + setLink(i, a, u) { + const l = F(); + i.split(",").forEach((r) => { + let o = r; + /\d/.exec(r[0]) && (o = pe + o); + const A = this.classes.get(o); + A && (A.link = we.formatUrl(a, l), l.securityLevel === "sandbox" ? A.linkTarget = "_top" : typeof u == "string" ? A.linkTarget = V(u) : A.linkTarget = "_blank"); + }), this.setCssClass(i, "clickable"); + } + /** + * Called by parser when a click definition is found. Registers an event handler. + * + * @param ids - Comma separated list of ids + * @param functionName - Function to be called on click + * @param functionArgs - Function args the function should be called with + */ + setClickEvent(i, a, u) { + i.split(",").forEach((l) => { + this.setClickFunc(l, a, u), this.classes.get(l).haveCallback = !0; + }), this.setCssClass(i, "clickable"); + } + setClickFunc(i, a, u) { + const l = v.sanitizeText(i, F()); + if (F().securityLevel !== "loose" || a === void 0) + return; + const o = l; + if (this.classes.has(o)) { + const A = this.lookUpDomId(o); + let g = []; + if (typeof u == "string") { + g = u.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); + for (let k = 0; k < g.length; k++) { + let L = g[k].trim(); + L.startsWith('"') && L.endsWith('"') && (L = L.substr(1, L.length - 2)), g[k] = L; + } + } + g.length === 0 && g.push(A), this.functions.push(() => { + const k = document.querySelector(`[id="${A}"]`); + k !== null && k.addEventListener( + "click", + () => { + we.runFunc(a, ...g); + }, + !1 + ); + }); + } + } + bindFunctions(i) { + this.functions.forEach((a) => { + a(i); + }); + } + getDirection() { + return this.direction; + } + setDirection(i) { + this.direction = i; + } + /** + * Function called by parser when a namespace definition has been found. + * + * @param id - Id of the namespace to add + * @public + */ + addNamespace(i) { + this.namespaces.has(i) || (this.namespaces.set(i, { + id: i, + classes: /* @__PURE__ */ new Map(), + children: {}, + domId: pe + i + "-" + this.namespaceCounter + }), this.namespaceCounter++); + } + getNamespace(i) { + return this.namespaces.get(i); + } + getNamespaces() { + return this.namespaces; + } + /** + * Function called by parser when a namespace definition has been found. + * + * @param id - Id of the namespace to add + * @param classNames - Ids of the class to add + * @public + */ + addClassesToNamespace(i, a) { + if (this.namespaces.has(i)) + for (const u of a) { + const { className: l } = this.splitClassNameAndType(u); + this.classes.get(l).parent = i, this.namespaces.get(i).classes.set(l, this.classes.get(l)); + } + } + setCssStyle(i, a) { + const u = this.classes.get(i); + if (!(!a || !u)) + for (const l of a) + l.includes(",") ? u.styles.push(...l.split(",")) : u.styles.push(l); + } + /** + * Gets the arrow marker for a type index + * + * @param type - The type to look for + * @returns The arrow marker + */ + getArrowMarker(i) { + let a; + switch (i) { + case 0: + a = "aggregation"; + break; + case 1: + a = "extension"; + break; + case 2: + a = "composition"; + break; + case 3: + a = "dependency"; + break; + case 4: + a = "lollipop"; + break; + default: + a = "none"; + } + return a; + } + getData() { + var r; + const i = [], a = [], u = F(); + for (const o of this.namespaces.keys()) { + const A = this.namespaces.get(o); + if (A) { + const g = { + id: A.id, + label: A.id, + isGroup: !0, + padding: u.class.padding ?? 16, + // parent node must be one of [rect, roundedWithTitle, noteGroup, divider] + shape: "rect", + cssStyles: ["fill: none", "stroke: black"], + look: u.look + }; + i.push(g); + } + } + for (const o of this.classes.keys()) { + const A = this.classes.get(o); + if (A) { + const g = A; + g.parentId = A.parent, g.look = u.look, i.push(g); + } + } + let l = 0; + for (const o of this.notes) { + l++; + const A = { + id: o.id, + label: o.text, + isGroup: !1, + shape: "note", + padding: u.class.padding ?? 6, + cssStyles: [ + "text-align: left", + "white-space: nowrap", + `fill: ${u.themeVariables.noteBkgColor}`, + `stroke: ${u.themeVariables.noteBorderColor}` + ], + look: u.look + }; + i.push(A); + const g = ((r = this.classes.get(o.class)) == null ? void 0 : r.id) ?? ""; + if (g) { + const k = { + id: `edgeNote${l}`, + start: o.id, + end: g, + type: "normal", + thickness: "normal", + classes: "relation", + arrowTypeStart: "none", + arrowTypeEnd: "none", + arrowheadStyle: "", + labelStyle: [""], + style: ["fill: none"], + pattern: "dotted", + look: u.look + }; + a.push(k); + } + } + for (const o of this.interfaces) { + const A = { + id: o.id, + label: o.label, + isGroup: !1, + shape: "rect", + cssStyles: ["opacity: 0;"], + look: u.look + }; + i.push(A); + } + l = 0; + for (const o of this.relations) { + l++; + const A = { + id: ot(o.id1, o.id2, { + prefix: "id", + counter: l + }), + start: o.id1, + end: o.id2, + type: "normal", + label: o.title, + labelpos: "c", + thickness: "normal", + classes: "relation", + arrowTypeStart: this.getArrowMarker(o.relation.type1), + arrowTypeEnd: this.getArrowMarker(o.relation.type2), + startLabelRight: o.relationTitle1 === "none" ? "" : o.relationTitle1, + endLabelLeft: o.relationTitle2 === "none" ? "" : o.relationTitle2, + arrowheadStyle: "", + labelStyle: ["display: inline-block"], + style: o.style || "", + pattern: o.relation.lineType == 1 ? "dashed" : "solid", + look: u.look + }; + a.push(A); + } + return { nodes: i, edges: a, other: {}, config: u, direction: this.getDirection() }; + } +}, f(U, "ClassDB"), U), pt = /* @__PURE__ */ f((s) => `g.classGroup text { + fill: ${s.nodeBorder || s.classText}; + stroke: none; + font-family: ${s.fontFamily}; + font-size: 10px; + + .title { + font-weight: bolder; + } + +} + +.nodeLabel, .edgeLabel { + color: ${s.classText}; +} +.edgeLabel .label rect { + fill: ${s.mainBkg}; +} +.label text { + fill: ${s.classText}; +} + +.labelBkg { + background: ${s.mainBkg}; +} +.edgeLabel .label span { + background: ${s.mainBkg}; +} + +.classTitle { + font-weight: bolder; +} +.node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; + stroke-width: 1px; + } + + +.divider { + stroke: ${s.nodeBorder}; + stroke-width: 1; +} + +g.clickable { + cursor: pointer; +} + +g.classGroup rect { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; +} + +g.classGroup line { + stroke: ${s.nodeBorder}; + stroke-width: 1; +} + +.classLabel .box { + stroke: none; + stroke-width: 0; + fill: ${s.mainBkg}; + opacity: 0.5; +} + +.classLabel .label { + fill: ${s.nodeBorder}; + font-size: 10px; +} + +.relation { + stroke: ${s.lineColor}; + stroke-width: 1; + fill: none; +} + +.dashed-line{ + stroke-dasharray: 3; +} + +.dotted-line{ + stroke-dasharray: 1 2; +} + +#compositionStart, .composition { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#compositionEnd, .composition { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#dependencyStart, .dependency { + fill: ${s.lineColor} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#extensionStart, .extension { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#extensionEnd, .extension { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#aggregationStart, .aggregation { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#aggregationEnd, .aggregation { + fill: transparent !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#lollipopStart, .lollipop { + fill: ${s.mainBkg} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +#lollipopEnd, .lollipop { + fill: ${s.mainBkg} !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; +} + +.edgeTerminals { + font-size: 11px; + line-height: initial; +} + +.classTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${s.textColor}; +} +`, "getStyles"), yt = pt, At = /* @__PURE__ */ f((s, i = "TB") => { + if (!s.doc) + return i; + let a = i; + for (const u of s.doc) + u.stmt === "dir" && (a = u.value); + return a; +}, "getDir"), ft = /* @__PURE__ */ f(function(s, i) { + return i.db.getClasses(); +}, "getClasses"), gt = /* @__PURE__ */ f(async function(s, i, a, u) { + Oe.info("REF0:"), Oe.info("Drawing class diagram (v3)", i); + const { securityLevel: l, state: r, layout: o } = F(), A = u.db.getData(), g = et(i, l); + A.type = u.type, A.layoutAlgorithm = ht(o), A.nodeSpacing = (r == null ? void 0 : r.nodeSpacing) || 50, A.rankSpacing = (r == null ? void 0 : r.rankSpacing) || 50, A.markers = ["aggregation", "extension", "composition", "dependency", "lollipop"], A.diagramId = i, await dt(A, g); + const k = 8; + we.insertTitle( + g, + "classDiagramTitleText", + (r == null ? void 0 : r.titleTopMargin) ?? 25, + u.db.getDiagramTitle() + ), tt(g, k, "classDiagram", (r == null ? void 0 : r.useMaxWidth) ?? !0); +}, "draw"), Tt = { + getClasses: ft, + draw: gt, + getDir: At +}; +export { + Et as C, + Tt as a, + bt as c, + yt as s +}; diff --git a/backend/fastrtc/templates/component/chunk-AEK57VVT-Bi19bt7P.js b/backend/fastrtc/templates/component/chunk-AEK57VVT-Bi19bt7P.js new file mode 100644 index 0000000..9d866ba --- /dev/null +++ b/backend/fastrtc/templates/component/chunk-AEK57VVT-Bi19bt7P.js @@ -0,0 +1,1415 @@ +var re = Object.defineProperty; +var ae = (e, t, s) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s; +var b = (e, t, s) => ae(e, typeof t != "symbol" ? t + "" : t, s); +import { g as ne, s as le } from "./chunk-RZ5BOZE2-C6qYYKQn.js"; +import { _ as p, l as v, S as oe, d as A, e as j, t as ce, g as he, s as ue, b as de, c as fe, n as pe, o as Se, z as ye, u as ge } from "./mermaid.core-Cmyps_S7.js"; +var bt = function() { + var e = /* @__PURE__ */ p(function(P, l, h, a) { + for (h = h || {}, a = P.length; a--; h[P[a]] = l) ; + return h; + }, "o"), t = [1, 2], s = [1, 3], n = [1, 4], o = [2, 4], c = [1, 9], r = [1, 11], d = [1, 16], f = [1, 17], g = [1, 18], E = [1, 19], m = [1, 32], I = [1, 20], G = [1, 21], R = [1, 22], S = [1, 23], L = [1, 24], O = [1, 26], Y = [1, 27], F = [1, 28], w = [1, 29], $ = [1, 30], et = [1, 31], st = [1, 34], it = [1, 35], rt = [1, 36], at = [1, 37], X = [1, 33], y = [1, 4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], nt = [1, 4, 5, 14, 15, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], At = [4, 5, 16, 17, 19, 21, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], St = { + trace: /* @__PURE__ */ p(function() { + }, "trace"), + yy: {}, + symbols_: { error: 2, start: 3, SPACE: 4, NL: 5, SD: 6, document: 7, line: 8, statement: 9, classDefStatement: 10, styleStatement: 11, cssClassStatement: 12, idStatement: 13, DESCR: 14, "-->": 15, HIDE_EMPTY: 16, scale: 17, WIDTH: 18, COMPOSIT_STATE: 19, STRUCT_START: 20, STRUCT_STOP: 21, STATE_DESCR: 22, AS: 23, ID: 24, FORK: 25, JOIN: 26, CHOICE: 27, CONCURRENT: 28, note: 29, notePosition: 30, NOTE_TEXT: 31, direction: 32, acc_title: 33, acc_title_value: 34, acc_descr: 35, acc_descr_value: 36, acc_descr_multiline_value: 37, classDef: 38, CLASSDEF_ID: 39, CLASSDEF_STYLEOPTS: 40, DEFAULT: 41, style: 42, STYLE_IDS: 43, STYLEDEF_STYLEOPTS: 44, class: 45, CLASSENTITY_IDS: 46, STYLECLASS: 47, direction_tb: 48, direction_bt: 49, direction_rl: 50, direction_lr: 51, eol: 52, ";": 53, EDGE_STATE: 54, STYLE_SEPARATOR: 55, left_of: 56, right_of: 57, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 4: "SPACE", 5: "NL", 6: "SD", 14: "DESCR", 15: "-->", 16: "HIDE_EMPTY", 17: "scale", 18: "WIDTH", 19: "COMPOSIT_STATE", 20: "STRUCT_START", 21: "STRUCT_STOP", 22: "STATE_DESCR", 23: "AS", 24: "ID", 25: "FORK", 26: "JOIN", 27: "CHOICE", 28: "CONCURRENT", 29: "note", 31: "NOTE_TEXT", 33: "acc_title", 34: "acc_title_value", 35: "acc_descr", 36: "acc_descr_value", 37: "acc_descr_multiline_value", 38: "classDef", 39: "CLASSDEF_ID", 40: "CLASSDEF_STYLEOPTS", 41: "DEFAULT", 42: "style", 43: "STYLE_IDS", 44: "STYLEDEF_STYLEOPTS", 45: "class", 46: "CLASSENTITY_IDS", 47: "STYLECLASS", 48: "direction_tb", 49: "direction_bt", 50: "direction_rl", 51: "direction_lr", 53: ";", 54: "EDGE_STATE", 55: "STYLE_SEPARATOR", 56: "left_of", 57: "right_of" }, + productions_: [0, [3, 2], [3, 2], [3, 2], [7, 0], [7, 2], [8, 2], [8, 1], [8, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 3], [9, 4], [9, 1], [9, 2], [9, 1], [9, 4], [9, 3], [9, 6], [9, 1], [9, 1], [9, 1], [9, 1], [9, 4], [9, 4], [9, 1], [9, 2], [9, 2], [9, 1], [10, 3], [10, 3], [11, 3], [12, 3], [32, 1], [32, 1], [32, 1], [32, 1], [52, 1], [52, 1], [13, 1], [13, 1], [13, 3], [13, 3], [30, 1], [30, 1]], + performAction: /* @__PURE__ */ p(function(l, h, a, T, _, i, K) { + var u = i.length - 1; + switch (_) { + case 3: + return T.setRootDoc(i[u]), i[u]; + case 4: + this.$ = []; + break; + case 5: + i[u] != "nl" && (i[u - 1].push(i[u]), this.$ = i[u - 1]); + break; + case 6: + case 7: + this.$ = i[u]; + break; + case 8: + this.$ = "nl"; + break; + case 12: + this.$ = i[u]; + break; + case 13: + const J = i[u - 1]; + J.description = T.trimColon(i[u]), this.$ = J; + break; + case 14: + this.$ = { stmt: "relation", state1: i[u - 2], state2: i[u] }; + break; + case 15: + const yt = T.trimColon(i[u]); + this.$ = { stmt: "relation", state1: i[u - 3], state2: i[u - 1], description: yt }; + break; + case 19: + this.$ = { stmt: "state", id: i[u - 3], type: "default", description: "", doc: i[u - 1] }; + break; + case 20: + var V = i[u], H = i[u - 2].trim(); + if (i[u].match(":")) { + var ot = i[u].split(":"); + V = ot[0], H = [H, ot[1]]; + } + this.$ = { stmt: "state", id: V, type: "default", description: H }; + break; + case 21: + this.$ = { stmt: "state", id: i[u - 3], type: "default", description: i[u - 5], doc: i[u - 1] }; + break; + case 22: + this.$ = { stmt: "state", id: i[u], type: "fork" }; + break; + case 23: + this.$ = { stmt: "state", id: i[u], type: "join" }; + break; + case 24: + this.$ = { stmt: "state", id: i[u], type: "choice" }; + break; + case 25: + this.$ = { stmt: "state", id: T.getDividerId(), type: "divider" }; + break; + case 26: + this.$ = { stmt: "state", id: i[u - 1].trim(), note: { position: i[u - 2].trim(), text: i[u].trim() } }; + break; + case 29: + this.$ = i[u].trim(), T.setAccTitle(this.$); + break; + case 30: + case 31: + this.$ = i[u].trim(), T.setAccDescription(this.$); + break; + case 32: + case 33: + this.$ = { stmt: "classDef", id: i[u - 1].trim(), classes: i[u].trim() }; + break; + case 34: + this.$ = { stmt: "style", id: i[u - 1].trim(), styleClass: i[u].trim() }; + break; + case 35: + this.$ = { stmt: "applyClass", id: i[u - 1].trim(), styleClass: i[u].trim() }; + break; + case 36: + T.setDirection("TB"), this.$ = { stmt: "dir", value: "TB" }; + break; + case 37: + T.setDirection("BT"), this.$ = { stmt: "dir", value: "BT" }; + break; + case 38: + T.setDirection("RL"), this.$ = { stmt: "dir", value: "RL" }; + break; + case 39: + T.setDirection("LR"), this.$ = { stmt: "dir", value: "LR" }; + break; + case 42: + case 43: + this.$ = { stmt: "state", id: i[u].trim(), type: "default", description: "" }; + break; + case 44: + this.$ = { stmt: "state", id: i[u - 2].trim(), classes: [i[u].trim()], type: "default", description: "" }; + break; + case 45: + this.$ = { stmt: "state", id: i[u - 2].trim(), classes: [i[u].trim()], type: "default", description: "" }; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: t, 5: s, 6: n }, { 1: [3] }, { 3: 5, 4: t, 5: s, 6: n }, { 3: 6, 4: t, 5: s, 6: n }, e([1, 4, 5, 16, 17, 19, 22, 24, 25, 26, 27, 28, 29, 33, 35, 37, 38, 42, 45, 48, 49, 50, 51, 54], o, { 7: 7 }), { 1: [2, 1] }, { 1: [2, 2] }, { 1: [2, 3], 4: c, 5: r, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: d, 17: f, 19: g, 22: E, 24: m, 25: I, 26: G, 27: R, 28: S, 29: L, 32: 25, 33: O, 35: Y, 37: F, 38: w, 42: $, 45: et, 48: st, 49: it, 50: rt, 51: at, 54: X }, e(y, [2, 5]), { 9: 38, 10: 12, 11: 13, 12: 14, 13: 15, 16: d, 17: f, 19: g, 22: E, 24: m, 25: I, 26: G, 27: R, 28: S, 29: L, 32: 25, 33: O, 35: Y, 37: F, 38: w, 42: $, 45: et, 48: st, 49: it, 50: rt, 51: at, 54: X }, e(y, [2, 7]), e(y, [2, 8]), e(y, [2, 9]), e(y, [2, 10]), e(y, [2, 11]), e(y, [2, 12], { 14: [1, 39], 15: [1, 40] }), e(y, [2, 16]), { 18: [1, 41] }, e(y, [2, 18], { 20: [1, 42] }), { 23: [1, 43] }, e(y, [2, 22]), e(y, [2, 23]), e(y, [2, 24]), e(y, [2, 25]), { 30: 44, 31: [1, 45], 56: [1, 46], 57: [1, 47] }, e(y, [2, 28]), { 34: [1, 48] }, { 36: [1, 49] }, e(y, [2, 31]), { 39: [1, 50], 41: [1, 51] }, { 43: [1, 52] }, { 46: [1, 53] }, e(nt, [2, 42], { 55: [1, 54] }), e(nt, [2, 43], { 55: [1, 55] }), e(y, [2, 36]), e(y, [2, 37]), e(y, [2, 38]), e(y, [2, 39]), e(y, [2, 6]), e(y, [2, 13]), { 13: 56, 24: m, 54: X }, e(y, [2, 17]), e(At, o, { 7: 57 }), { 24: [1, 58] }, { 24: [1, 59] }, { 23: [1, 60] }, { 24: [2, 46] }, { 24: [2, 47] }, e(y, [2, 29]), e(y, [2, 30]), { 40: [1, 61] }, { 40: [1, 62] }, { 44: [1, 63] }, { 47: [1, 64] }, { 24: [1, 65] }, { 24: [1, 66] }, e(y, [2, 14], { 14: [1, 67] }), { 4: c, 5: r, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: d, 17: f, 19: g, 21: [1, 68], 22: E, 24: m, 25: I, 26: G, 27: R, 28: S, 29: L, 32: 25, 33: O, 35: Y, 37: F, 38: w, 42: $, 45: et, 48: st, 49: it, 50: rt, 51: at, 54: X }, e(y, [2, 20], { 20: [1, 69] }), { 31: [1, 70] }, { 24: [1, 71] }, e(y, [2, 32]), e(y, [2, 33]), e(y, [2, 34]), e(y, [2, 35]), e(nt, [2, 44]), e(nt, [2, 45]), e(y, [2, 15]), e(y, [2, 19]), e(At, o, { 7: 72 }), e(y, [2, 26]), e(y, [2, 27]), { 4: c, 5: r, 8: 8, 9: 10, 10: 12, 11: 13, 12: 14, 13: 15, 16: d, 17: f, 19: g, 21: [1, 73], 22: E, 24: m, 25: I, 26: G, 27: R, 28: S, 29: L, 32: 25, 33: O, 35: Y, 37: F, 38: w, 42: $, 45: et, 48: st, 49: it, 50: rt, 51: at, 54: X }, e(y, [2, 21])], + defaultActions: { 5: [2, 1], 6: [2, 2], 46: [2, 46], 47: [2, 47] }, + parseError: /* @__PURE__ */ p(function(l, h) { + if (h.recoverable) + this.trace(l); + else { + var a = new Error(l); + throw a.hash = h, a; + } + }, "parseError"), + parse: /* @__PURE__ */ p(function(l) { + var h = this, a = [0], T = [], _ = [null], i = [], K = this.table, u = "", V = 0, H = 0, ot = 2, J = 1, yt = i.slice.call(arguments, 1), D = Object.create(this.lexer), M = { yy: {} }; + for (var gt in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, gt) && (M.yy[gt] = this.yy[gt]); + D.setInput(l, M.yy), M.yy.lexer = D, M.yy.parser = this, typeof D.yylloc > "u" && (D.yylloc = {}); + var Tt = D.yylloc; + i.push(Tt); + var se = D.options && D.options.ranges; + typeof M.yy.parseError == "function" ? this.parseError = M.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function ie(C) { + a.length = a.length - 2 * C, _.length = _.length - C, i.length = i.length - C; + } + p(ie, "popStack"); + function Lt() { + var C; + return C = T.pop() || D.lex() || J, typeof C != "number" && (C instanceof Array && (T = C, C = T.pop()), C = h.symbols_[C] || C), C; + } + p(Lt, "lex"); + for (var k, U, x, _t, W = {}, ct, N, It, ht; ; ) { + if (U = a[a.length - 1], this.defaultActions[U] ? x = this.defaultActions[U] : ((k === null || typeof k > "u") && (k = Lt()), x = K[U] && K[U][k]), typeof x > "u" || !x.length || !x[0]) { + var Et = ""; + ht = []; + for (ct in K[U]) + this.terminals_[ct] && ct > ot && ht.push("'" + this.terminals_[ct] + "'"); + D.showPosition ? Et = "Parse error on line " + (V + 1) + `: +` + D.showPosition() + ` +Expecting ` + ht.join(", ") + ", got '" + (this.terminals_[k] || k) + "'" : Et = "Parse error on line " + (V + 1) + ": Unexpected " + (k == J ? "end of input" : "'" + (this.terminals_[k] || k) + "'"), this.parseError(Et, { + text: D.match, + token: this.terminals_[k] || k, + line: D.yylineno, + loc: Tt, + expected: ht + }); + } + if (x[0] instanceof Array && x.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + U + ", token: " + k); + switch (x[0]) { + case 1: + a.push(k), _.push(D.yytext), i.push(D.yylloc), a.push(x[1]), k = null, H = D.yyleng, u = D.yytext, V = D.yylineno, Tt = D.yylloc; + break; + case 2: + if (N = this.productions_[x[1]][1], W.$ = _[_.length - N], W._$ = { + first_line: i[i.length - (N || 1)].first_line, + last_line: i[i.length - 1].last_line, + first_column: i[i.length - (N || 1)].first_column, + last_column: i[i.length - 1].last_column + }, se && (W._$.range = [ + i[i.length - (N || 1)].range[0], + i[i.length - 1].range[1] + ]), _t = this.performAction.apply(W, [ + u, + H, + V, + M.yy, + x[1], + _, + i + ].concat(yt)), typeof _t < "u") + return _t; + N && (a = a.slice(0, -1 * N * 2), _ = _.slice(0, -1 * N), i = i.slice(0, -1 * N)), a.push(this.productions_[x[1]][0]), _.push(W.$), i.push(W._$), It = K[a[a.length - 2]][a[a.length - 1]], a.push(It); + break; + case 3: + return !0; + } + } + return !0; + }, "parse") + }, ee = /* @__PURE__ */ function() { + var P = { + EOF: 1, + parseError: /* @__PURE__ */ p(function(h, a) { + if (this.yy.parser) + this.yy.parser.parseError(h, a); + else + throw new Error(h); + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ p(function(l, h) { + return this.yy = h || this.yy || {}, this._input = l, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ p(function() { + var l = this._input[0]; + this.yytext += l, this.yyleng++, this.offset++, this.match += l, this.matched += l; + var h = l.match(/(?:\r\n?|\n).*/g); + return h ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), l; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ p(function(l) { + var h = l.length, a = l.split(/(?:\r\n?|\n)/g); + this._input = l + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - h), this.offset -= h; + var T = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), a.length - 1 && (this.yylineno -= a.length - 1); + var _ = this.yylloc.range; + return this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: a ? (a.length === T.length ? this.yylloc.first_column : 0) + T[T.length - a.length].length - a[0].length : this.yylloc.first_column - h + }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - h]), this.yyleng = this.yytext.length, this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ p(function() { + return this._more = !0, this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ p(function() { + if (this.options.backtrack_lexer) + this._backtrack = !0; + else + return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ p(function(l) { + this.unput(this.match.slice(l)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ p(function() { + var l = this.matched.substr(0, this.matched.length - this.match.length); + return (l.length > 20 ? "..." : "") + l.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ p(function() { + var l = this.match; + return l.length < 20 && (l += this._input.substr(0, 20 - l.length)), (l.substr(0, 20) + (l.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ p(function() { + var l = this.pastInput(), h = new Array(l.length + 1).join("-"); + return l + this.upcomingInput() + ` +` + h + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ p(function(l, h) { + var a, T, _; + if (this.options.backtrack_lexer && (_ = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), T = l[0].match(/(?:\r\n?|\n).*/g), T && (this.yylineno += T.length), this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: T ? T[T.length - 1].length - T[T.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + l[0].length + }, this.yytext += l[0], this.match += l[0], this.matches = l, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(l[0].length), this.matched += l[0], a = this.performAction.call(this, this.yy, this, h, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), a) + return a; + if (this._backtrack) { + for (var i in _) + this[i] = _[i]; + return !1; + } + return !1; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ p(function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var l, h, a, T; + this._more || (this.yytext = "", this.match = ""); + for (var _ = this._currentRules(), i = 0; i < _.length; i++) + if (a = this._input.match(this.rules[_[i]]), a && (!h || a[0].length > h[0].length)) { + if (h = a, T = i, this.options.backtrack_lexer) { + if (l = this.test_match(a, _[i]), l !== !1) + return l; + if (this._backtrack) { + h = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return h ? (l = this.test_match(h, _[T]), l !== !1 ? l : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ p(function() { + var h = this.next(); + return h || this.lex(); + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ p(function(h) { + this.conditionStack.push(h); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ p(function() { + var h = this.conditionStack.length - 1; + return h > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ p(function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ p(function(h) { + return h = this.conditionStack.length - 1 - Math.abs(h || 0), h >= 0 ? this.conditionStack[h] : "INITIAL"; + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ p(function(h) { + this.begin(h); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ p(function() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": !0 }, + performAction: /* @__PURE__ */ p(function(h, a, T, _) { + switch (T) { + case 0: + return 41; + case 1: + return 48; + case 2: + return 49; + case 3: + return 50; + case 4: + return 51; + case 5: + break; + case 6: + break; + case 7: + return 5; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + break; + case 12: + return this.pushState("SCALE"), 17; + case 13: + return 18; + case 14: + this.popState(); + break; + case 15: + return this.begin("acc_title"), 33; + case 16: + return this.popState(), "acc_title_value"; + case 17: + return this.begin("acc_descr"), 35; + case 18: + return this.popState(), "acc_descr_value"; + case 19: + this.begin("acc_descr_multiline"); + break; + case 20: + this.popState(); + break; + case 21: + return "acc_descr_multiline_value"; + case 22: + return this.pushState("CLASSDEF"), 38; + case 23: + return this.popState(), this.pushState("CLASSDEFID"), "DEFAULT_CLASSDEF_ID"; + case 24: + return this.popState(), this.pushState("CLASSDEFID"), 39; + case 25: + return this.popState(), 40; + case 26: + return this.pushState("CLASS"), 45; + case 27: + return this.popState(), this.pushState("CLASS_STYLE"), 46; + case 28: + return this.popState(), 47; + case 29: + return this.pushState("STYLE"), 42; + case 30: + return this.popState(), this.pushState("STYLEDEF_STYLES"), 43; + case 31: + return this.popState(), 44; + case 32: + return this.pushState("SCALE"), 17; + case 33: + return 18; + case 34: + this.popState(); + break; + case 35: + this.pushState("STATE"); + break; + case 36: + return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 25; + case 37: + return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 26; + case 38: + return this.popState(), a.yytext = a.yytext.slice(0, -10).trim(), 27; + case 39: + return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 25; + case 40: + return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 26; + case 41: + return this.popState(), a.yytext = a.yytext.slice(0, -10).trim(), 27; + case 42: + return 48; + case 43: + return 49; + case 44: + return 50; + case 45: + return 51; + case 46: + this.pushState("STATE_STRING"); + break; + case 47: + return this.pushState("STATE_ID"), "AS"; + case 48: + return this.popState(), "ID"; + case 49: + this.popState(); + break; + case 50: + return "STATE_DESCR"; + case 51: + return 19; + case 52: + this.popState(); + break; + case 53: + return this.popState(), this.pushState("struct"), 20; + case 54: + break; + case 55: + return this.popState(), 21; + case 56: + break; + case 57: + return this.begin("NOTE"), 29; + case 58: + return this.popState(), this.pushState("NOTE_ID"), 56; + case 59: + return this.popState(), this.pushState("NOTE_ID"), 57; + case 60: + this.popState(), this.pushState("FLOATING_NOTE"); + break; + case 61: + return this.popState(), this.pushState("FLOATING_NOTE_ID"), "AS"; + case 62: + break; + case 63: + return "NOTE_TEXT"; + case 64: + return this.popState(), "ID"; + case 65: + return this.popState(), this.pushState("NOTE_TEXT"), 24; + case 66: + return this.popState(), a.yytext = a.yytext.substr(2).trim(), 31; + case 67: + return this.popState(), a.yytext = a.yytext.slice(0, -8).trim(), 31; + case 68: + return 6; + case 69: + return 6; + case 70: + return 16; + case 71: + return 54; + case 72: + return 24; + case 73: + return a.yytext = a.yytext.trim(), 14; + case 74: + return 15; + case 75: + return 28; + case 76: + return 55; + case 77: + return 5; + case 78: + return "INVALID"; + } + }, "anonymous"), + rules: [/^(?:default\b)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:[^\}]%%[^\n]*)/i, /^(?:[\n]+)/i, /^(?:[\s]+)/i, /^(?:((?!\n)\s)+)/i, /^(?:#[^\n]*)/i, /^(?:%[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:classDef\s+)/i, /^(?:DEFAULT\s+)/i, /^(?:\w+\s+)/i, /^(?:[^\n]*)/i, /^(?:class\s+)/i, /^(?:(\w+)+((,\s*\w+)*))/i, /^(?:[^\n]*)/i, /^(?:style\s+)/i, /^(?:[\w,]+\s+)/i, /^(?:[^\n]*)/i, /^(?:scale\s+)/i, /^(?:\d+)/i, /^(?:\s+width\b)/i, /^(?:state\s+)/i, /^(?:.*<>)/i, /^(?:.*<>)/i, /^(?:.*<>)/i, /^(?:.*\[\[fork\]\])/i, /^(?:.*\[\[join\]\])/i, /^(?:.*\[\[choice\]\])/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:["])/i, /^(?:\s*as\s+)/i, /^(?:[^\n\{]*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n\s\{]+)/i, /^(?:\n)/i, /^(?:\{)/i, /^(?:%%(?!\{)[^\n]*)/i, /^(?:\})/i, /^(?:[\n])/i, /^(?:note\s+)/i, /^(?:left of\b)/i, /^(?:right of\b)/i, /^(?:")/i, /^(?:\s*as\s*)/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:[^\n]*)/i, /^(?:\s*[^:\n\s\-]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:[\s\S]*?end note\b)/i, /^(?:stateDiagram\s+)/i, /^(?:stateDiagram-v2\s+)/i, /^(?:hide empty description\b)/i, /^(?:\[\*\])/i, /^(?:[^:\n\s\-\{]+)/i, /^(?:\s*:[^:\n;]+)/i, /^(?:-->)/i, /^(?:--)/i, /^(?::::)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { LINE: { rules: [9, 10], inclusive: !1 }, struct: { rules: [9, 10, 22, 26, 29, 35, 42, 43, 44, 45, 54, 55, 56, 57, 71, 72, 73, 74, 75], inclusive: !1 }, FLOATING_NOTE_ID: { rules: [64], inclusive: !1 }, FLOATING_NOTE: { rules: [61, 62, 63], inclusive: !1 }, NOTE_TEXT: { rules: [66, 67], inclusive: !1 }, NOTE_ID: { rules: [65], inclusive: !1 }, NOTE: { rules: [58, 59, 60], inclusive: !1 }, STYLEDEF_STYLEOPTS: { rules: [], inclusive: !1 }, STYLEDEF_STYLES: { rules: [31], inclusive: !1 }, STYLE_IDS: { rules: [], inclusive: !1 }, STYLE: { rules: [30], inclusive: !1 }, CLASS_STYLE: { rules: [28], inclusive: !1 }, CLASS: { rules: [27], inclusive: !1 }, CLASSDEFID: { rules: [25], inclusive: !1 }, CLASSDEF: { rules: [23, 24], inclusive: !1 }, acc_descr_multiline: { rules: [20, 21], inclusive: !1 }, acc_descr: { rules: [18], inclusive: !1 }, acc_title: { rules: [16], inclusive: !1 }, SCALE: { rules: [13, 14, 33, 34], inclusive: !1 }, ALIAS: { rules: [], inclusive: !1 }, STATE_ID: { rules: [48], inclusive: !1 }, STATE_STRING: { rules: [49, 50], inclusive: !1 }, FORK_STATE: { rules: [], inclusive: !1 }, STATE: { rules: [9, 10, 36, 37, 38, 39, 40, 41, 46, 47, 51, 52, 53], inclusive: !1 }, ID: { rules: [9, 10], inclusive: !1 }, INITIAL: { rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 15, 17, 19, 22, 26, 29, 32, 35, 53, 57, 68, 69, 70, 71, 72, 73, 74, 76, 77, 78], inclusive: !0 } } + }; + return P; + }(); + St.lexer = ee; + function lt() { + this.yy = {}; + } + return p(lt, "Parser"), lt.prototype = St, St.Parser = lt, new lt(); +}(); +bt.parser = bt; +var Xe = bt, Te = "TB", Mt = "TB", Rt = "dir", dt = "state", vt = "relation", _e = "classDef", Ee = "style", me = "applyClass", Z = "default", Ut = "divider", jt = "fill:none", zt = "fill: #333", Ht = "c", Wt = "text", Xt = "normal", mt = "rect", Dt = "rectWithTitle", De = "stateStart", be = "stateEnd", Ot = "divider", Nt = "roundedWithTitle", ve = "note", ke = "noteGroup", tt = "statediagram", Ce = "state", xe = `${tt}-${Ce}`, Kt = "transition", Ae = "note", Le = "note-edge", Ie = `${Kt} ${Le}`, Re = `${tt}-${Ae}`, Oe = "cluster", Ne = `${tt}-${Oe}`, we = "cluster-alt", $e = `${tt}-${we}`, Jt = "parent", qt = "note", Pe = "state", xt = "----", Be = `${xt}${qt}`, wt = `${xt}${Jt}`, Qt = /* @__PURE__ */ p((e, t = Mt) => { + if (!e.doc) + return t; + let s = t; + for (const n of e.doc) + n.stmt === "dir" && (s = n.value); + return s; +}, "getDir"), Ge = /* @__PURE__ */ p(function(e, t) { + return t.db.getClasses(); +}, "getClasses"), Ye = /* @__PURE__ */ p(async function(e, t, s, n) { + v.info("REF0:"), v.info("Drawing state diagram (v2)", t); + const { securityLevel: o, state: c, layout: r } = A(); + n.db.extract(n.db.getRootDocV2()); + const d = n.db.getData(), f = ne(t, o); + d.type = n.type, d.layoutAlgorithm = r, d.nodeSpacing = (c == null ? void 0 : c.nodeSpacing) || 50, d.rankSpacing = (c == null ? void 0 : c.rankSpacing) || 50, d.markers = ["barb"], d.diagramId = t, await ye(d, f); + const g = 8; + ge.insertTitle( + f, + "statediagramTitleText", + (c == null ? void 0 : c.titleTopMargin) ?? 25, + n.db.getDiagramTitle() + ), le(f, g, tt, (c == null ? void 0 : c.useMaxWidth) ?? !0); +}, "draw"), Ke = { + getClasses: Ge, + draw: Ye, + getDir: Qt +}, ft = /* @__PURE__ */ new Map(), B = 0; +function pt(e = "", t = 0, s = "", n = xt) { + const o = s !== null && s.length > 0 ? `${n}${s}` : ""; + return `${Pe}-${e}${o}-${t}`; +} +p(pt, "stateDomId"); +var Fe = /* @__PURE__ */ p((e, t, s, n, o, c, r, d) => { + v.trace("items", t), t.forEach((f) => { + switch (f.stmt) { + case dt: + Q(e, f, s, n, o, c, r, d); + break; + case Z: + Q(e, f, s, n, o, c, r, d); + break; + case vt: + { + Q( + e, + f.state1, + s, + n, + o, + c, + r, + d + ), Q( + e, + f.state2, + s, + n, + o, + c, + r, + d + ); + const g = { + id: "edge" + B, + start: f.state1.id, + end: f.state2.id, + arrowhead: "normal", + arrowTypeEnd: "arrow_barb", + style: jt, + labelStyle: "", + label: j.sanitizeText(f.description, A()), + arrowheadStyle: zt, + labelpos: Ht, + labelType: Wt, + thickness: Xt, + classes: Kt, + look: r + }; + o.push(g), B++; + } + break; + } + }); +}, "setupDoc"), $t = /* @__PURE__ */ p((e, t = Mt) => { + let s = t; + if (e.doc) + for (const n of e.doc) + n.stmt === "dir" && (s = n.value); + return s; +}, "getDir"); +function q(e, t, s) { + if (!t.id || t.id === "" || t.id === "") + return; + t.cssClasses && (Array.isArray(t.cssCompiledStyles) || (t.cssCompiledStyles = []), t.cssClasses.split(" ").forEach((o) => { + if (s.get(o)) { + const c = s.get(o); + t.cssCompiledStyles = [...t.cssCompiledStyles, ...c.styles]; + } + })); + const n = e.find((o) => o.id === t.id); + n ? Object.assign(n, t) : e.push(t); +} +p(q, "insertOrUpdateNode"); +function Zt(e) { + var t; + return ((t = e == null ? void 0 : e.classes) == null ? void 0 : t.join(" ")) ?? ""; +} +p(Zt, "getClassesFromDbInfo"); +function te(e) { + return (e == null ? void 0 : e.styles) ?? []; +} +p(te, "getStylesFromDbInfo"); +var Q = /* @__PURE__ */ p((e, t, s, n, o, c, r, d) => { + var I, G; + const f = t.id, g = s.get(f), E = Zt(g), m = te(g); + if (v.info("dataFetcher parsedItem", t, g, m), f !== "root") { + let R = mt; + t.start === !0 ? R = De : t.start === !1 && (R = be), t.type !== Z && (R = t.type), ft.get(f) || ft.set(f, { + id: f, + shape: R, + description: j.sanitizeText(f, A()), + cssClasses: `${E} ${xe}`, + cssStyles: m + }); + const S = ft.get(f); + t.description && (Array.isArray(S.description) ? (S.shape = Dt, S.description.push(t.description)) : ((I = S.description) == null ? void 0 : I.length) > 0 ? (S.shape = Dt, S.description === f ? S.description = [t.description] : S.description = [S.description, t.description]) : (S.shape = mt, S.description = t.description), S.description = j.sanitizeTextOrArray(S.description, A())), ((G = S.description) == null ? void 0 : G.length) === 1 && S.shape === Dt && (S.type === "group" ? S.shape = Nt : S.shape = mt), !S.type && t.doc && (v.info("Setting cluster for XCX", f, $t(t)), S.type = "group", S.isGroup = !0, S.dir = $t(t), S.shape = t.type === Ut ? Ot : Nt, S.cssClasses = `${S.cssClasses} ${Ne} ${c ? $e : ""}`); + const L = { + labelStyle: "", + shape: S.shape, + label: S.description, + cssClasses: S.cssClasses, + cssCompiledStyles: [], + cssStyles: S.cssStyles, + id: f, + dir: S.dir, + domId: pt(f, B), + type: S.type, + isGroup: S.type === "group", + padding: 8, + rx: 10, + ry: 10, + look: r + }; + if (L.shape === Ot && (L.label = ""), e && e.id !== "root" && (v.trace("Setting node ", f, " to be child of its parent ", e.id), L.parentId = e.id), L.centerLabel = !0, t.note) { + const O = { + labelStyle: "", + shape: ve, + label: t.note.text, + cssClasses: Re, + // useHtmlLabels: false, + cssStyles: [], + cssCompilesStyles: [], + id: f + Be + "-" + B, + domId: pt(f, B, qt), + type: S.type, + isGroup: S.type === "group", + padding: A().flowchart.padding, + look: r, + position: t.note.position + }, Y = f + wt, F = { + labelStyle: "", + shape: ke, + label: t.note.text, + cssClasses: S.cssClasses, + cssStyles: [], + id: f + wt, + domId: pt(f, B, Jt), + type: "group", + isGroup: !0, + padding: 16, + //getConfig().flowchart.padding + look: r, + position: t.note.position + }; + B++, F.id = Y, O.parentId = Y, q(n, F, d), q(n, O, d), q(n, L, d); + let w = f, $ = O.id; + t.note.position === "left of" && (w = O.id, $ = f), o.push({ + id: w + "-" + $, + start: w, + end: $, + arrowhead: "none", + arrowTypeEnd: "", + style: jt, + labelStyle: "", + classes: Ie, + arrowheadStyle: zt, + labelpos: Ht, + labelType: Wt, + thickness: Xt, + look: r + }); + } else + q(n, L, d); + } + t.doc && (v.trace("Adding nodes children "), Fe(t, t.doc, s, n, o, !c, r, d)); +}, "dataFetcher"), Ve = /* @__PURE__ */ p(() => { + ft.clear(), B = 0; +}, "reset"), kt = "[*]", Pt = "start", Bt = kt, Gt = "end", Yt = "color", Ft = "fill", Me = "bgFill", Ue = ","; +function Ct() { + return /* @__PURE__ */ new Map(); +} +p(Ct, "newClassesList"); +var Vt = /* @__PURE__ */ p(() => ({ + /** @type {{ id1: string, id2: string, relationTitle: string }[]} */ + relations: [], + states: /* @__PURE__ */ new Map(), + documents: {} +}), "newDoc"), ut = /* @__PURE__ */ p((e) => JSON.parse(JSON.stringify(e)), "clone"), z, Je = (z = class { + /** + * @param {1 | 2} version - v1 renderer or v2 renderer. + */ + constructor(t) { + /** + * @private + * @type {1 | 2} + */ + b(this, "version"); + /** + * @private + * @type {Array} + */ + b(this, "nodes", []); + /** + * @private + * @type {Array} + */ + b(this, "edges", []); + /** + * @private + * @type {Array} + */ + b(this, "rootDoc", []); + /** + * @private + * @type {Map} + */ + b(this, "classes", Ct()); + // style classes defined by a classDef + /** + * @private + * @type {Object} + */ + b(this, "documents", { + root: Vt() + }); + /** + * @private + * @type {Object} + */ + b(this, "currentDocument", this.documents.root); + /** + * @private + * @type {number} + */ + b(this, "startEndCount", 0); + /** + * @private + * @type {number} + */ + b(this, "dividerCnt", 0); + b(this, "getAccTitle", he); + b(this, "setAccTitle", ue); + b(this, "getAccDescription", de); + b(this, "setAccDescription", fe); + b(this, "setDiagramTitle", pe); + b(this, "getDiagramTitle", Se); + this.clear(), this.version = t, this.setRootDoc = this.setRootDoc.bind(this), this.getDividerId = this.getDividerId.bind(this), this.setDirection = this.setDirection.bind(this), this.trimColon = this.trimColon.bind(this); + } + setRootDoc(t) { + v.info("Setting root doc", t), this.rootDoc = t, this.version === 1 ? this.extract(t) : this.extract(this.getRootDocV2()); + } + getRootDoc() { + return this.rootDoc; + } + /** + * @private + * @param {Object} parent + * @param {Object} node + * @param {boolean} first + */ + docTranslator(t, s, n) { + if (s.stmt === vt) + this.docTranslator(t, s.state1, !0), this.docTranslator(t, s.state2, !1); + else if (s.stmt === dt && (s.id === "[*]" ? (s.id = n ? t.id + "_start" : t.id + "_end", s.start = n) : s.id = s.id.trim()), s.doc) { + const o = []; + let c = [], r; + for (r = 0; r < s.doc.length; r++) + if (s.doc[r].type === Ut) { + const d = ut(s.doc[r]); + d.doc = ut(c), o.push(d), c = []; + } else + c.push(s.doc[r]); + if (o.length > 0 && c.length > 0) { + const d = { + stmt: dt, + id: oe(), + type: "divider", + doc: ut(c) + }; + o.push(ut(d)), s.doc = o; + } + s.doc.forEach((d) => this.docTranslator(s, d, !0)); + } + } + /** + * @private + */ + getRootDocV2() { + return this.docTranslator({ id: "root" }, { id: "root", doc: this.rootDoc }, !0), { id: "root", doc: this.rootDoc }; + } + /** + * Convert all of the statements (stmts) that were parsed into states and relationships. + * This is done because a state diagram may have nested sections, + * where each section is a 'document' and has its own set of statements. + * Ex: the section within a fork has its own statements, and incoming and outgoing statements + * refer to the fork as a whole (document). + * See the parser grammar: the definition of a document is a document then a 'line', where a line can be a statement. + * This will push the statement into the list of statements for the current document. + * @private + * @param _doc + */ + extract(t) { + let s; + t.doc ? s = t.doc : s = t, v.info(s), this.clear(!0), v.info("Extract initial document:", s), s.forEach((r) => { + switch (v.warn("Statement", r.stmt), r.stmt) { + case dt: + this.addState( + r.id.trim(), + r.type, + r.doc, + r.description, + r.note, + r.classes, + r.styles, + r.textStyles + ); + break; + case vt: + this.addRelation(r.state1, r.state2, r.description); + break; + case _e: + this.addStyleClass(r.id.trim(), r.classes); + break; + case Ee: + { + const d = r.id.trim().split(","), f = r.styleClass.split(","); + d.forEach((g) => { + let E = this.getState(g); + if (E === void 0) { + const m = g.trim(); + this.addState(m), E = this.getState(m); + } + E.styles = f.map((m) => { + var I; + return (I = m.replace(/;/g, "")) == null ? void 0 : I.trim(); + }); + }); + } + break; + case me: + this.setCssClass(r.id.trim(), r.styleClass); + break; + } + }); + const n = this.getStates(), c = A().look; + Ve(), Q( + void 0, + this.getRootDocV2(), + n, + this.nodes, + this.edges, + !0, + c, + this.classes + ), this.nodes.forEach((r) => { + if (Array.isArray(r.label)) { + if (r.description = r.label.slice(1), r.isGroup && r.description.length > 0) + throw new Error( + "Group nodes can only have label. Remove the additional description for node [" + r.id + "]" + ); + r.label = r.label[0]; + } + }); + } + /** + * Function called by parser when a node definition has been found. + * + * @param {null | string} id + * @param {null | string} type + * @param {null | string} doc + * @param {null | string | string[]} descr - description for the state. Can be a string or a list or strings + * @param {null | string} note + * @param {null | string | string[]} classes - class styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 class, convert it to an array of that 1 class. + * @param {null | string | string[]} styles - styles to apply to this state. Can be a string (1 style) or an array of styles. If it's just 1 style, convert it to an array of that 1 style. + * @param {null | string | string[]} textStyles - text styles to apply to this state. Can be a string (1 text test) or an array of text styles. If it's just 1 text style, convert it to an array of that 1 text style. + */ + addState(t, s = Z, n = null, o = null, c = null, r = null, d = null, f = null) { + const g = t == null ? void 0 : t.trim(); + if (this.currentDocument.states.has(g) ? (this.currentDocument.states.get(g).doc || (this.currentDocument.states.get(g).doc = n), this.currentDocument.states.get(g).type || (this.currentDocument.states.get(g).type = s)) : (v.info("Adding state ", g, o), this.currentDocument.states.set(g, { + id: g, + descriptions: [], + type: s, + doc: n, + note: c, + classes: [], + styles: [], + textStyles: [] + })), o && (v.info("Setting state description", g, o), typeof o == "string" && this.addDescription(g, o.trim()), typeof o == "object" && o.forEach((E) => this.addDescription(g, E.trim()))), c) { + const E = this.currentDocument.states.get(g); + E.note = c, E.note.text = j.sanitizeText(E.note.text, A()); + } + r && (v.info("Setting state classes", g, r), (typeof r == "string" ? [r] : r).forEach((m) => this.setCssClass(g, m.trim()))), d && (v.info("Setting state styles", g, d), (typeof d == "string" ? [d] : d).forEach((m) => this.setStyle(g, m.trim()))), f && (v.info("Setting state styles", g, d), (typeof f == "string" ? [f] : f).forEach((m) => this.setTextStyle(g, m.trim()))); + } + clear(t) { + this.nodes = [], this.edges = [], this.documents = { + root: Vt() + }, this.currentDocument = this.documents.root, this.startEndCount = 0, this.classes = Ct(), t || ce(); + } + getState(t) { + return this.currentDocument.states.get(t); + } + getStates() { + return this.currentDocument.states; + } + logDocuments() { + v.info("Documents = ", this.documents); + } + getRelations() { + return this.currentDocument.relations; + } + /** + * If the id is a start node ( [*] ), then return a new id constructed from + * the start node name and the current start node count. + * else return the given id + * + * @param {string} id + * @returns {string} - the id (original or constructed) + * @private + */ + startIdIfNeeded(t = "") { + let s = t; + return t === kt && (this.startEndCount++, s = `${Pt}${this.startEndCount}`), s; + } + /** + * If the id is a start node ( [*] ), then return the start type ('start') + * else return the given type + * + * @param {string} id + * @param {string} type + * @returns {string} - the type that should be used + * @private + */ + startTypeIfNeeded(t = "", s = Z) { + return t === kt ? Pt : s; + } + /** + * If the id is an end node ( [*] ), then return a new id constructed from + * the end node name and the current start_end node count. + * else return the given id + * + * @param {string} id + * @returns {string} - the id (original or constructed) + * @private + */ + endIdIfNeeded(t = "") { + let s = t; + return t === Bt && (this.startEndCount++, s = `${Gt}${this.startEndCount}`), s; + } + /** + * If the id is an end node ( [*] ), then return the end type + * else return the given type + * + * @param {string} id + * @param {string} type + * @returns {string} - the type that should be used + * @private + */ + endTypeIfNeeded(t = "", s = Z) { + return t === Bt ? Gt : s; + } + /** + * + * @param item1 + * @param item2 + * @param relationTitle + */ + addRelationObjs(t, s, n) { + let o = this.startIdIfNeeded(t.id.trim()), c = this.startTypeIfNeeded(t.id.trim(), t.type), r = this.startIdIfNeeded(s.id.trim()), d = this.startTypeIfNeeded(s.id.trim(), s.type); + this.addState( + o, + c, + t.doc, + t.description, + t.note, + t.classes, + t.styles, + t.textStyles + ), this.addState( + r, + d, + s.doc, + s.description, + s.note, + s.classes, + s.styles, + s.textStyles + ), this.currentDocument.relations.push({ + id1: o, + id2: r, + relationTitle: j.sanitizeText(n, A()) + }); + } + /** + * Add a relation between two items. The items may be full objects or just the string id of a state. + * + * @param {string | object} item1 + * @param {string | object} item2 + * @param {string} title + */ + addRelation(t, s, n) { + if (typeof t == "object") + this.addRelationObjs(t, s, n); + else { + const o = this.startIdIfNeeded(t.trim()), c = this.startTypeIfNeeded(t), r = this.endIdIfNeeded(s.trim()), d = this.endTypeIfNeeded(s); + this.addState(o, c), this.addState(r, d), this.currentDocument.relations.push({ + id1: o, + id2: r, + title: j.sanitizeText(n, A()) + }); + } + } + addDescription(t, s) { + const n = this.currentDocument.states.get(t), o = s.startsWith(":") ? s.replace(":", "").trim() : s; + n.descriptions.push(j.sanitizeText(o, A())); + } + cleanupLabel(t) { + return t.substring(0, 1) === ":" ? t.substr(2).trim() : t.trim(); + } + getDividerId() { + return this.dividerCnt++, "divider-id-" + this.dividerCnt; + } + /** + * Called when the parser comes across a (style) class definition + * @example classDef my-style fill:#f96; + * + * @param {string} id - the id of this (style) class + * @param {string | null} styleAttributes - the string with 1 or more style attributes (each separated by a comma) + */ + addStyleClass(t, s = "") { + this.classes.has(t) || this.classes.set(t, { id: t, styles: [], textStyles: [] }); + const n = this.classes.get(t); + s != null && s.split(Ue).forEach((o) => { + const c = o.replace(/([^;]*);/, "$1").trim(); + if (RegExp(Yt).exec(o)) { + const d = c.replace(Ft, Me).replace(Yt, Ft); + n.textStyles.push(d); + } + n.styles.push(c); + }); + } + /** + * Return all of the style classes + * @returns {{} | any | classes} + */ + getClasses() { + return this.classes; + } + /** + * Add a (style) class or css class to a state with the given id. + * If the state isn't already in the list of known states, add it. + * Might be called by parser when a style class or CSS class should be applied to a state + * + * @param {string | string[]} itemIds The id or a list of ids of the item(s) to apply the css class to + * @param {string} cssClassName CSS class name + */ + setCssClass(t, s) { + t.split(",").forEach((n) => { + let o = this.getState(n); + if (o === void 0) { + const c = n.trim(); + this.addState(c), o = this.getState(c); + } + o.classes.push(s); + }); + } + /** + * Add a style to a state with the given id. + * @example style stateId fill:#f9f,stroke:#333,stroke-width:4px + * where 'style' is the keyword + * stateId is the id of a state + * the rest of the string is the styleText (all of the attributes to be applied to the state) + * + * @param itemId The id of item to apply the style to + * @param styleText - the text of the attributes for the style + */ + setStyle(t, s) { + const n = this.getState(t); + n !== void 0 && n.styles.push(s); + } + /** + * Add a text style to a state with the given id + * + * @param itemId The id of item to apply the css class to + * @param cssClassName CSS class name + */ + setTextStyle(t, s) { + const n = this.getState(t); + n !== void 0 && n.textStyles.push(s); + } + /** + * Finds the direction statement in the root document. + * @private + * @returns {{ value: string } | undefined} - the direction statement if present + */ + getDirectionStatement() { + return this.rootDoc.find((t) => t.stmt === Rt); + } + getDirection() { + var t; + return ((t = this.getDirectionStatement()) == null ? void 0 : t.value) ?? Te; + } + setDirection(t) { + const s = this.getDirectionStatement(); + s ? s.value = t : this.rootDoc.unshift({ stmt: Rt, value: t }); + } + trimColon(t) { + return t && t[0] === ":" ? t.substr(1).trim() : t.trim(); + } + getData() { + const t = A(); + return { + nodes: this.nodes, + edges: this.edges, + other: {}, + config: t, + direction: Qt(this.getRootDocV2()) + }; + } + getConfig() { + return A().state; + } +}, p(z, "StateDB"), b(z, "relationType", { + AGGREGATION: 0, + EXTENSION: 1, + COMPOSITION: 2, + DEPENDENCY: 3 +}), z), je = /* @__PURE__ */ p((e) => ` +defs #statediagram-barbEnd { + fill: ${e.transitionColor}; + stroke: ${e.transitionColor}; + } +g.stateGroup text { + fill: ${e.nodeBorder}; + stroke: none; + font-size: 10px; +} +g.stateGroup text { + fill: ${e.textColor}; + stroke: none; + font-size: 10px; + +} +g.stateGroup .state-title { + font-weight: bolder; + fill: ${e.stateLabelColor}; +} + +g.stateGroup rect { + fill: ${e.mainBkg}; + stroke: ${e.nodeBorder}; +} + +g.stateGroup line { + stroke: ${e.lineColor}; + stroke-width: 1; +} + +.transition { + stroke: ${e.transitionColor}; + stroke-width: 1; + fill: none; +} + +.stateGroup .composit { + fill: ${e.background}; + border-bottom: 1px +} + +.stateGroup .alt-composit { + fill: #e0e0e0; + border-bottom: 1px +} + +.state-note { + stroke: ${e.noteBorderColor}; + fill: ${e.noteBkgColor}; + + text { + fill: ${e.noteTextColor}; + stroke: none; + font-size: 10px; + } +} + +.stateLabel .box { + stroke: none; + stroke-width: 0; + fill: ${e.mainBkg}; + opacity: 0.5; +} + +.edgeLabel .label rect { + fill: ${e.labelBackgroundColor}; + opacity: 0.5; +} +.edgeLabel { + background-color: ${e.edgeLabelBackground}; + p { + background-color: ${e.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${e.edgeLabelBackground}; + fill: ${e.edgeLabelBackground}; + } + text-align: center; +} +.edgeLabel .label text { + fill: ${e.transitionLabelColor || e.tertiaryTextColor}; +} +.label div .edgeLabel { + color: ${e.transitionLabelColor || e.tertiaryTextColor}; +} + +.stateLabel text { + fill: ${e.stateLabelColor}; + font-size: 10px; + font-weight: bold; +} + +.node circle.state-start { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node .fork-join { + fill: ${e.specialStateColor}; + stroke: ${e.specialStateColor}; +} + +.node circle.state-end { + fill: ${e.innerEndBackground}; + stroke: ${e.background}; + stroke-width: 1.5 +} +.end-state-inner { + fill: ${e.compositeBackground || e.background}; + // stroke: ${e.background}; + stroke-width: 1.5 +} + +.node rect { + fill: ${e.stateBkg || e.mainBkg}; + stroke: ${e.stateBorder || e.nodeBorder}; + stroke-width: 1px; +} +.node polygon { + fill: ${e.mainBkg}; + stroke: ${e.stateBorder || e.nodeBorder};; + stroke-width: 1px; +} +#statediagram-barbEnd { + fill: ${e.lineColor}; +} + +.statediagram-cluster rect { + fill: ${e.compositeTitleBackground}; + stroke: ${e.stateBorder || e.nodeBorder}; + stroke-width: 1px; +} + +.cluster-label, .nodeLabel { + color: ${e.stateLabelColor}; + // line-height: 1; +} + +.statediagram-cluster rect.outer { + rx: 5px; + ry: 5px; +} +.statediagram-state .divider { + stroke: ${e.stateBorder || e.nodeBorder}; +} + +.statediagram-state .title-state { + rx: 5px; + ry: 5px; +} +.statediagram-cluster.statediagram-cluster .inner { + fill: ${e.compositeBackground || e.background}; +} +.statediagram-cluster.statediagram-cluster-alt .inner { + fill: ${e.altBackground ? e.altBackground : "#efefef"}; +} + +.statediagram-cluster .inner { + rx:0; + ry:0; +} + +.statediagram-state rect.basic { + rx: 5px; + ry: 5px; +} +.statediagram-state rect.divider { + stroke-dasharray: 10,10; + fill: ${e.altBackground ? e.altBackground : "#efefef"}; +} + +.note-edge { + stroke-dasharray: 5; +} + +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} +.statediagram-note rect { + fill: ${e.noteBkgColor}; + stroke: ${e.noteBorderColor}; + stroke-width: 1px; + rx: 0; + ry: 0; +} + +.statediagram-note text { + fill: ${e.noteTextColor}; +} + +.statediagram-note .nodeLabel { + color: ${e.noteTextColor}; +} +.statediagram .edgeLabel { + color: red; // ${e.noteTextColor}; +} + +#dependencyStart, #dependencyEnd { + fill: ${e.lineColor}; + stroke: ${e.lineColor}; + stroke-width: 1; +} + +.statediagramTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${e.textColor}; +} +`, "getStyles"), qe = je; +export { + Je as S, + qe as a, + Ke as b, + Xe as s +}; diff --git a/backend/fastrtc/templates/component/chunk-D6G4REZN-BlR0637Q.js b/backend/fastrtc/templates/component/chunk-D6G4REZN-BlR0637Q.js new file mode 100644 index 0000000..d438462 --- /dev/null +++ b/backend/fastrtc/templates/component/chunk-D6G4REZN-BlR0637Q.js @@ -0,0 +1,64 @@ +import { _ as n, T as c, m as l } from "./mermaid.core-Cmyps_S7.js"; +var o = /* @__PURE__ */ n((a, t) => { + const e = a.append("rect"); + if (e.attr("x", t.x), e.attr("y", t.y), e.attr("fill", t.fill), e.attr("stroke", t.stroke), e.attr("width", t.width), e.attr("height", t.height), t.name && e.attr("name", t.name), t.rx && e.attr("rx", t.rx), t.ry && e.attr("ry", t.ry), t.attrs !== void 0) + for (const r in t.attrs) + e.attr(r, t.attrs[r]); + return t.class && e.attr("class", t.class), e; +}, "drawRect"), d = /* @__PURE__ */ n((a, t) => { + const e = { + x: t.startx, + y: t.starty, + width: t.stopx - t.startx, + height: t.stopy - t.starty, + fill: t.fill, + stroke: t.stroke, + class: "rect" + }; + o(a, e).lower(); +}, "drawBackgroundRect"), g = /* @__PURE__ */ n((a, t) => { + const e = t.text.replace(c, " "), r = a.append("text"); + r.attr("x", t.x), r.attr("y", t.y), r.attr("class", "legend"), r.style("text-anchor", t.anchor), t.class && r.attr("class", t.class); + const s = r.append("tspan"); + return s.attr("x", t.x + t.textMargin * 2), s.text(e), r; +}, "drawText"), m = /* @__PURE__ */ n((a, t, e, r) => { + const s = a.append("image"); + s.attr("x", t), s.attr("y", e); + const i = l(r); + s.attr("xlink:href", i); +}, "drawImage"), h = /* @__PURE__ */ n((a, t, e, r) => { + const s = a.append("use"); + s.attr("x", t), s.attr("y", e); + const i = l(r); + s.attr("xlink:href", `#${i}`); +}, "drawEmbeddedImage"), y = /* @__PURE__ */ n(() => ({ + x: 0, + y: 0, + width: 100, + height: 100, + fill: "#EDF2AE", + stroke: "#666", + anchor: "start", + rx: 0, + ry: 0 +}), "getNoteRect"), p = /* @__PURE__ */ n(() => ({ + x: 0, + y: 0, + width: 100, + height: 100, + "text-anchor": "start", + style: "#666", + textMargin: 0, + rx: 0, + ry: 0, + tspan: !0 +}), "getTextObj"); +export { + p as a, + d as b, + h as c, + o as d, + m as e, + g as f, + y as g +}; diff --git a/backend/fastrtc/templates/component/chunk-RZ5BOZE2-C6qYYKQn.js b/backend/fastrtc/templates/component/chunk-RZ5BOZE2-C6qYYKQn.js new file mode 100644 index 0000000..4374c98 --- /dev/null +++ b/backend/fastrtc/templates/component/chunk-RZ5BOZE2-C6qYYKQn.js @@ -0,0 +1,24 @@ +import { _ as n, j as r, k as g, l as d } from "./mermaid.core-Cmyps_S7.js"; +var u = /* @__PURE__ */ n((t, e) => { + let o; + return e === "sandbox" && (o = r("#i" + t)), (e === "sandbox" ? r(o.nodes()[0].contentDocument.body) : r("body")).select(`[id="${t}"]`); +}, "getDiagramElement"), b = /* @__PURE__ */ n((t, e, o, i) => { + t.attr("class", o); + const { width: a, height: s, x: h, y: x } = l(t, e); + g(t, s, a, i); + const c = w(h, x, a, s, e); + t.attr("viewBox", c), d.debug(`viewBox configured: ${c} with padding: ${e}`); +}, "setupViewPortForSVG"), l = /* @__PURE__ */ n((t, e) => { + var i; + const o = ((i = t.node()) == null ? void 0 : i.getBBox()) || { width: 0, height: 0, x: 0, y: 0 }; + return { + width: o.width + e * 2, + height: o.height + e * 2, + x: o.x, + y: o.y + }; +}, "calculateDimensionsWithPadding"), w = /* @__PURE__ */ n((t, e, o, i, a) => `${t - a} ${e - a} ${o} ${i}`, "createViewBox"); +export { + u as g, + b as s +}; diff --git a/backend/fastrtc/templates/component/chunk-XZIHB7SX-BL75jMe6.js b/backend/fastrtc/templates/component/chunk-XZIHB7SX-BL75jMe6.js new file mode 100644 index 0000000..69057b9 --- /dev/null +++ b/backend/fastrtc/templates/component/chunk-XZIHB7SX-BL75jMe6.js @@ -0,0 +1,15 @@ +import { _ as s } from "./mermaid.core-Cmyps_S7.js"; +var t, e = (t = class { + /** + * @param init - Function that creates the default state. + */ + constructor(i) { + this.init = i, this.records = this.init(); + } + reset() { + this.records = this.init(); + } +}, s(t, "ImperativeState"), t); +export { + e as I +}; diff --git a/backend/fastrtc/templates/component/classDiagram-GIVACNV2-DDZHRR0W.js b/backend/fastrtc/templates/component/classDiagram-GIVACNV2-DDZHRR0W.js new file mode 100644 index 0000000..746d874 --- /dev/null +++ b/backend/fastrtc/templates/component/classDiagram-GIVACNV2-DDZHRR0W.js @@ -0,0 +1,16 @@ +import { c as r, C as s, a as e, s as t } from "./chunk-A2AXSNBT-zdHOW8wg.js"; +import { _ as l } from "./mermaid.core-Cmyps_S7.js"; +var d = { + parser: r, + get db() { + return new s(); + }, + renderer: e, + styles: t, + init: /* @__PURE__ */ l((a) => { + a.class || (a.class = {}), a.class.arrowMarkerAbsolute = a.arrowMarkerAbsolute; + }, "init") +}; +export { + d as diagram +}; diff --git a/backend/fastrtc/templates/component/classDiagram-v2-COTLJTTW-DDZHRR0W.js b/backend/fastrtc/templates/component/classDiagram-v2-COTLJTTW-DDZHRR0W.js new file mode 100644 index 0000000..746d874 --- /dev/null +++ b/backend/fastrtc/templates/component/classDiagram-v2-COTLJTTW-DDZHRR0W.js @@ -0,0 +1,16 @@ +import { c as r, C as s, a as e, s as t } from "./chunk-A2AXSNBT-zdHOW8wg.js"; +import { _ as l } from "./mermaid.core-Cmyps_S7.js"; +var d = { + parser: r, + get db() { + return new s(); + }, + renderer: e, + styles: t, + init: /* @__PURE__ */ l((a) => { + a.class || (a.class = {}), a.class.arrowMarkerAbsolute = a.arrowMarkerAbsolute; + }, "init") +}; +export { + d as diagram +}; diff --git a/backend/fastrtc/templates/component/clone-Bt-5RraT.js b/backend/fastrtc/templates/component/clone-Bt-5RraT.js new file mode 100644 index 0000000..1496014 --- /dev/null +++ b/backend/fastrtc/templates/component/clone-Bt-5RraT.js @@ -0,0 +1,8 @@ +import { b as r } from "./_baseUniq-BN26mYqf.js"; +var e = 4; +function a(o) { + return r(o, e); +} +export { + a as c +}; diff --git a/backend/fastrtc/templates/component/cytoscape.esm-C2cgT2B2.js b/backend/fastrtc/templates/component/cytoscape.esm-C2cgT2B2.js new file mode 100644 index 0000000..ed8a2e9 --- /dev/null +++ b/backend/fastrtc/templates/component/cytoscape.esm-C2cgT2B2.js @@ -0,0 +1,18629 @@ +function Ss(r, e) { + (e == null || e > r.length) && (e = r.length); + for (var t = 0, a = Array(e); t < e; t++) a[t] = r[t]; + return a; +} +function Uf(r) { + if (Array.isArray(r)) return r; +} +function $f(r) { + if (Array.isArray(r)) return Ss(r); +} +function vt(r, e) { + if (!(r instanceof e)) throw new TypeError("Cannot call a class as a function"); +} +function Kf(r, e) { + for (var t = 0; t < e.length; t++) { + var a = e[t]; + a.enumerable = a.enumerable || !1, a.configurable = !0, "value" in a && (a.writable = !0), Object.defineProperty(r, Kl(a.key), a); + } +} +function ft(r, e, t) { + return e && Kf(r.prototype, e), Object.defineProperty(r, "prototype", { + writable: !1 + }), r; +} +function Tr(r, e) { + var t = typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"]; + if (!t) { + if (Array.isArray(r) || (t = Us(r)) || e) { + t && (r = t); + var a = 0, n = function() { + }; + return { + s: n, + n: function() { + return a >= r.length ? { + done: !0 + } : { + done: !1, + value: r[a++] + }; + }, + e: function(l) { + throw l; + }, + f: n + }; + } + 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 i, s = !0, o = !1; + return { + s: function() { + t = t.call(r); + }, + n: function() { + var l = t.next(); + return s = l.done, l; + }, + e: function(l) { + o = !0, i = l; + }, + f: function() { + try { + s || t.return == null || t.return(); + } finally { + if (o) throw i; + } + } + }; +} +function $l(r, e, t) { + return (e = Kl(e)) in r ? Object.defineProperty(r, e, { + value: t, + enumerable: !0, + configurable: !0, + writable: !0 + }) : r[e] = t, r; +} +function Yf(r) { + if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r); +} +function Xf(r, e) { + var t = r == null ? null : typeof Symbol < "u" && r[Symbol.iterator] || r["@@iterator"]; + if (t != null) { + var a, n, i, s, o = [], l = !0, u = !1; + try { + if (i = (t = t.call(r)).next, e === 0) { + if (Object(t) !== t) return; + l = !1; + } else for (; !(l = (a = i.call(t)).done) && (o.push(a.value), o.length !== e); l = !0) ; + } catch (v) { + u = !0, n = v; + } finally { + try { + if (!l && t.return != null && (s = t.return(), Object(s) !== s)) return; + } finally { + if (u) throw n; + } + } + return o; + } +} +function Zf() { + throw new TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); +} +function Qf() { + throw new TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`); +} +function je(r, e) { + return Uf(r) || Xf(r, e) || Us(r, e) || Zf(); +} +function pn(r) { + return $f(r) || Yf(r) || Us(r) || Qf(); +} +function Jf(r, e) { + if (typeof r != "object" || !r) return r; + var t = r[Symbol.toPrimitive]; + if (t !== void 0) { + var a = t.call(r, e); + if (typeof a != "object") return a; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return String(r); +} +function Kl(r) { + var e = Jf(r, "string"); + return typeof e == "symbol" ? e : e + ""; +} +function rr(r) { + "@babel/helpers - typeof"; + return rr = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) { + return typeof e; + } : function(e) { + return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e; + }, rr(r); +} +function Us(r, e) { + if (r) { + if (typeof r == "string") return Ss(r, e); + var t = {}.toString.call(r).slice(8, -1); + return t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set" ? Array.from(r) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Ss(r, e) : void 0; + } +} +var Je = typeof window > "u" ? null : window, xo = Je ? Je.navigator : null; +Je && Je.document; +var jf = rr(""), Yl = rr({}), ec = rr(function() { +}), rc = typeof HTMLElement > "u" ? "undefined" : rr(HTMLElement), Aa = function(e) { + return e && e.instanceString && We(e.instanceString) ? e.instanceString() : null; +}, fe = function(e) { + return e != null && rr(e) == jf; +}, We = function(e) { + return e != null && rr(e) === ec; +}, Fe = function(e) { + return !Dr(e) && (Array.isArray ? Array.isArray(e) : e != null && e instanceof Array); +}, Pe = function(e) { + return e != null && rr(e) === Yl && !Fe(e) && e.constructor === Object; +}, tc = function(e) { + return e != null && rr(e) === Yl; +}, te = function(e) { + return e != null && rr(e) === rr(1) && !isNaN(e); +}, ac = function(e) { + return te(e) && Math.floor(e) === e; +}, yn = function(e) { + if (rc !== "undefined") + return e != null && e instanceof HTMLElement; +}, Dr = function(e) { + return Ra(e) || Xl(e); +}, Ra = function(e) { + return Aa(e) === "collection" && e._private.single; +}, Xl = function(e) { + return Aa(e) === "collection" && !e._private.single; +}, $s = function(e) { + return Aa(e) === "core"; +}, Zl = function(e) { + return Aa(e) === "stylesheet"; +}, nc = function(e) { + return Aa(e) === "event"; +}, nt = function(e) { + return e == null ? !0 : !!(e === "" || e.match(/^\s+$/)); +}, ic = function(e) { + return typeof HTMLElement > "u" ? !1 : e instanceof HTMLElement; +}, sc = function(e) { + return Pe(e) && te(e.x1) && te(e.x2) && te(e.y1) && te(e.y2); +}, oc = function(e) { + return tc(e) && We(e.then); +}, uc = function() { + return xo && xo.userAgent.match(/msie|trident|edge/i); +}, Yt = function(e, t) { + t || (t = function() { + if (arguments.length === 1) + return arguments[0]; + if (arguments.length === 0) + return "undefined"; + for (var i = [], s = 0; s < arguments.length; s++) + i.push(arguments[s]); + return i.join("$"); + }); + var a = function() { + var i = this, s = arguments, o, l = t.apply(i, s), u = a.cache; + return (o = u[l]) || (o = u[l] = e.apply(i, s)), o; + }; + return a.cache = {}, a; +}, Ks = Yt(function(r) { + return r.replace(/([A-Z])/g, function(e) { + return "-" + e.toLowerCase(); + }); +}), An = Yt(function(r) { + return r.replace(/(-\w)/g, function(e) { + return e[1].toUpperCase(); + }); +}), Ql = Yt(function(r, e) { + return r + e[0].toUpperCase() + e.substring(1); +}, function(r, e) { + return r + "$" + e; +}), Eo = function(e) { + return nt(e) ? e : e.charAt(0).toUpperCase() + e.substring(1); +}, er = "(?:[-+]?(?:(?:\\d+|\\d*\\.\\d+)(?:[Ee][+-]?\\d+)?))", lc = "rgb[a]?\\((" + er + "[%]?)\\s*,\\s*(" + er + "[%]?)\\s*,\\s*(" + er + "[%]?)(?:\\s*,\\s*(" + er + "))?\\)", vc = "rgb[a]?\\((?:" + er + "[%]?)\\s*,\\s*(?:" + er + "[%]?)\\s*,\\s*(?:" + er + "[%]?)(?:\\s*,\\s*(?:" + er + "))?\\)", fc = "hsl[a]?\\((" + er + ")\\s*,\\s*(" + er + "[%])\\s*,\\s*(" + er + "[%])(?:\\s*,\\s*(" + er + "))?\\)", cc = "hsl[a]?\\((?:" + er + ")\\s*,\\s*(?:" + er + "[%])\\s*,\\s*(?:" + er + "[%])(?:\\s*,\\s*(?:" + er + "))?\\)", dc = "\\#[0-9a-fA-F]{3}", hc = "\\#[0-9a-fA-F]{6}", Jl = function(e, t) { + return e < t ? -1 : e > t ? 1 : 0; +}, gc = function(e, t) { + return -1 * Jl(e, t); +}, he = Object.assign != null ? Object.assign.bind(Object) : function(r) { + for (var e = arguments, t = 1; t < e.length; t++) { + var a = e[t]; + if (a != null) + for (var n = Object.keys(a), i = 0; i < n.length; i++) { + var s = n[i]; + r[s] = a[s]; + } + } + return r; +}, pc = function(e) { + if (!(!(e.length === 4 || e.length === 7) || e[0] !== "#")) { + var t = e.length === 4, a, n, i, s = 16; + return t ? (a = parseInt(e[1] + e[1], s), n = parseInt(e[2] + e[2], s), i = parseInt(e[3] + e[3], s)) : (a = parseInt(e[1] + e[2], s), n = parseInt(e[3] + e[4], s), i = parseInt(e[5] + e[6], s)), [a, n, i]; + } +}, yc = function(e) { + var t, a, n, i, s, o, l, u; + function v(d, y, g) { + return g < 0 && (g += 1), g > 1 && (g -= 1), g < 1 / 6 ? d + (y - d) * 6 * g : g < 1 / 2 ? y : g < 2 / 3 ? d + (y - d) * (2 / 3 - g) * 6 : d; + } + var f = new RegExp("^" + fc + "$").exec(e); + if (f) { + if (a = parseInt(f[1]), a < 0 ? a = (360 - -1 * a % 360) % 360 : a > 360 && (a = a % 360), a /= 360, n = parseFloat(f[2]), n < 0 || n > 100 || (n = n / 100, i = parseFloat(f[3]), i < 0 || i > 100) || (i = i / 100, s = f[4], s !== void 0 && (s = parseFloat(s), s < 0 || s > 1))) + return; + if (n === 0) + o = l = u = Math.round(i * 255); + else { + var c = i < 0.5 ? i * (1 + n) : i + n - i * n, h = 2 * i - c; + o = Math.round(255 * v(h, c, a + 1 / 3)), l = Math.round(255 * v(h, c, a)), u = Math.round(255 * v(h, c, a - 1 / 3)); + } + t = [o, l, u, s]; + } + return t; +}, mc = function(e) { + var t, a = new RegExp("^" + lc + "$").exec(e); + if (a) { + t = []; + for (var n = [], i = 1; i <= 3; i++) { + var s = a[i]; + if (s[s.length - 1] === "%" && (n[i] = !0), s = parseFloat(s), n[i] && (s = s / 100 * 255), s < 0 || s > 255) + return; + t.push(Math.floor(s)); + } + var o = n[1] || n[2] || n[3], l = n[1] && n[2] && n[3]; + if (o && !l) + return; + var u = a[4]; + if (u !== void 0) { + if (u = parseFloat(u), u < 0 || u > 1) + return; + t.push(u); + } + } + return t; +}, bc = function(e) { + return wc[e.toLowerCase()]; +}, jl = function(e) { + return (Fe(e) ? e : null) || bc(e) || pc(e) || mc(e) || yc(e); +}, wc = { + // special colour names + transparent: [0, 0, 0, 0], + // NB alpha === 0 + // regular colours + aliceblue: [240, 248, 255], + antiquewhite: [250, 235, 215], + aqua: [0, 255, 255], + aquamarine: [127, 255, 212], + azure: [240, 255, 255], + beige: [245, 245, 220], + bisque: [255, 228, 196], + black: [0, 0, 0], + blanchedalmond: [255, 235, 205], + blue: [0, 0, 255], + blueviolet: [138, 43, 226], + brown: [165, 42, 42], + burlywood: [222, 184, 135], + cadetblue: [95, 158, 160], + chartreuse: [127, 255, 0], + chocolate: [210, 105, 30], + coral: [255, 127, 80], + cornflowerblue: [100, 149, 237], + cornsilk: [255, 248, 220], + crimson: [220, 20, 60], + cyan: [0, 255, 255], + darkblue: [0, 0, 139], + darkcyan: [0, 139, 139], + darkgoldenrod: [184, 134, 11], + darkgray: [169, 169, 169], + darkgreen: [0, 100, 0], + darkgrey: [169, 169, 169], + darkkhaki: [189, 183, 107], + darkmagenta: [139, 0, 139], + darkolivegreen: [85, 107, 47], + darkorange: [255, 140, 0], + darkorchid: [153, 50, 204], + darkred: [139, 0, 0], + darksalmon: [233, 150, 122], + darkseagreen: [143, 188, 143], + darkslateblue: [72, 61, 139], + darkslategray: [47, 79, 79], + darkslategrey: [47, 79, 79], + darkturquoise: [0, 206, 209], + darkviolet: [148, 0, 211], + deeppink: [255, 20, 147], + deepskyblue: [0, 191, 255], + dimgray: [105, 105, 105], + dimgrey: [105, 105, 105], + dodgerblue: [30, 144, 255], + firebrick: [178, 34, 34], + floralwhite: [255, 250, 240], + forestgreen: [34, 139, 34], + fuchsia: [255, 0, 255], + gainsboro: [220, 220, 220], + ghostwhite: [248, 248, 255], + gold: [255, 215, 0], + goldenrod: [218, 165, 32], + gray: [128, 128, 128], + grey: [128, 128, 128], + green: [0, 128, 0], + greenyellow: [173, 255, 47], + honeydew: [240, 255, 240], + hotpink: [255, 105, 180], + indianred: [205, 92, 92], + indigo: [75, 0, 130], + ivory: [255, 255, 240], + khaki: [240, 230, 140], + lavender: [230, 230, 250], + lavenderblush: [255, 240, 245], + lawngreen: [124, 252, 0], + lemonchiffon: [255, 250, 205], + lightblue: [173, 216, 230], + lightcoral: [240, 128, 128], + lightcyan: [224, 255, 255], + lightgoldenrodyellow: [250, 250, 210], + lightgray: [211, 211, 211], + lightgreen: [144, 238, 144], + lightgrey: [211, 211, 211], + lightpink: [255, 182, 193], + lightsalmon: [255, 160, 122], + lightseagreen: [32, 178, 170], + lightskyblue: [135, 206, 250], + lightslategray: [119, 136, 153], + lightslategrey: [119, 136, 153], + lightsteelblue: [176, 196, 222], + lightyellow: [255, 255, 224], + lime: [0, 255, 0], + limegreen: [50, 205, 50], + linen: [250, 240, 230], + magenta: [255, 0, 255], + maroon: [128, 0, 0], + mediumaquamarine: [102, 205, 170], + mediumblue: [0, 0, 205], + mediumorchid: [186, 85, 211], + mediumpurple: [147, 112, 219], + mediumseagreen: [60, 179, 113], + mediumslateblue: [123, 104, 238], + mediumspringgreen: [0, 250, 154], + mediumturquoise: [72, 209, 204], + mediumvioletred: [199, 21, 133], + midnightblue: [25, 25, 112], + mintcream: [245, 255, 250], + mistyrose: [255, 228, 225], + moccasin: [255, 228, 181], + navajowhite: [255, 222, 173], + navy: [0, 0, 128], + oldlace: [253, 245, 230], + olive: [128, 128, 0], + olivedrab: [107, 142, 35], + orange: [255, 165, 0], + orangered: [255, 69, 0], + orchid: [218, 112, 214], + palegoldenrod: [238, 232, 170], + palegreen: [152, 251, 152], + paleturquoise: [175, 238, 238], + palevioletred: [219, 112, 147], + papayawhip: [255, 239, 213], + peachpuff: [255, 218, 185], + peru: [205, 133, 63], + pink: [255, 192, 203], + plum: [221, 160, 221], + powderblue: [176, 224, 230], + purple: [128, 0, 128], + red: [255, 0, 0], + rosybrown: [188, 143, 143], + royalblue: [65, 105, 225], + saddlebrown: [139, 69, 19], + salmon: [250, 128, 114], + sandybrown: [244, 164, 96], + seagreen: [46, 139, 87], + seashell: [255, 245, 238], + sienna: [160, 82, 45], + silver: [192, 192, 192], + skyblue: [135, 206, 235], + slateblue: [106, 90, 205], + slategray: [112, 128, 144], + slategrey: [112, 128, 144], + snow: [255, 250, 250], + springgreen: [0, 255, 127], + steelblue: [70, 130, 180], + tan: [210, 180, 140], + teal: [0, 128, 128], + thistle: [216, 191, 216], + tomato: [255, 99, 71], + turquoise: [64, 224, 208], + violet: [238, 130, 238], + wheat: [245, 222, 179], + white: [255, 255, 255], + whitesmoke: [245, 245, 245], + yellow: [255, 255, 0], + yellowgreen: [154, 205, 50] +}, ev = function(e) { + for (var t = e.map, a = e.keys, n = a.length, i = 0; i < n; i++) { + var s = a[i]; + if (Pe(s)) + throw Error("Tried to set map with object key"); + i < a.length - 1 ? (t[s] == null && (t[s] = {}), t = t[s]) : t[s] = e.value; + } +}, rv = function(e) { + for (var t = e.map, a = e.keys, n = a.length, i = 0; i < n; i++) { + var s = a[i]; + if (Pe(s)) + throw Error("Tried to get map with object key"); + if (t = t[s], t == null) + return t; + } + return t; +}, Ua = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function Ma(r) { + return r && r.__esModule && Object.prototype.hasOwnProperty.call(r, "default") ? r.default : r; +} +var Zn, Co; +function La() { + if (Co) return Zn; + Co = 1; + function r(e) { + var t = typeof e; + return e != null && (t == "object" || t == "function"); + } + return Zn = r, Zn; +} +var Qn, To; +function xc() { + if (To) return Qn; + To = 1; + var r = typeof Ua == "object" && Ua && Ua.Object === Object && Ua; + return Qn = r, Qn; +} +var Jn, So; +function Rn() { + if (So) return Jn; + So = 1; + var r = xc(), e = typeof self == "object" && self && self.Object === Object && self, t = r || e || Function("return this")(); + return Jn = t, Jn; +} +var jn, Do; +function Ec() { + if (Do) return jn; + Do = 1; + var r = Rn(), e = function() { + return r.Date.now(); + }; + return jn = e, jn; +} +var ei, ko; +function Cc() { + if (ko) return ei; + ko = 1; + var r = /\s/; + function e(t) { + for (var a = t.length; a-- && r.test(t.charAt(a)); ) + ; + return a; + } + return ei = e, ei; +} +var ri, Bo; +function Tc() { + if (Bo) return ri; + Bo = 1; + var r = Cc(), e = /^\s+/; + function t(a) { + return a && a.slice(0, r(a) + 1).replace(e, ""); + } + return ri = t, ri; +} +var ti, Po; +function Ys() { + if (Po) return ti; + Po = 1; + var r = Rn(), e = r.Symbol; + return ti = e, ti; +} +var ai, Ao; +function Sc() { + if (Ao) return ai; + Ao = 1; + var r = Ys(), e = Object.prototype, t = e.hasOwnProperty, a = e.toString, n = r ? r.toStringTag : void 0; + function i(s) { + var o = t.call(s, n), l = s[n]; + try { + s[n] = void 0; + var u = !0; + } catch { + } + var v = a.call(s); + return u && (o ? s[n] = l : delete s[n]), v; + } + return ai = i, ai; +} +var ni, Ro; +function Dc() { + if (Ro) return ni; + Ro = 1; + var r = Object.prototype, e = r.toString; + function t(a) { + return e.call(a); + } + return ni = t, ni; +} +var ii, Mo; +function tv() { + if (Mo) return ii; + Mo = 1; + var r = Ys(), e = Sc(), t = Dc(), a = "[object Null]", n = "[object Undefined]", i = r ? r.toStringTag : void 0; + function s(o) { + return o == null ? o === void 0 ? n : a : i && i in Object(o) ? e(o) : t(o); + } + return ii = s, ii; +} +var si, Lo; +function kc() { + if (Lo) return si; + Lo = 1; + function r(e) { + return e != null && typeof e == "object"; + } + return si = r, si; +} +var oi, Io; +function Ia() { + if (Io) return oi; + Io = 1; + var r = tv(), e = kc(), t = "[object Symbol]"; + function a(n) { + return typeof n == "symbol" || e(n) && r(n) == t; + } + return oi = a, oi; +} +var ui, Oo; +function Bc() { + if (Oo) return ui; + Oo = 1; + var r = Tc(), e = La(), t = Ia(), a = NaN, n = /^[-+]0x[0-9a-f]+$/i, i = /^0b[01]+$/i, s = /^0o[0-7]+$/i, o = parseInt; + function l(u) { + if (typeof u == "number") + return u; + if (t(u)) + return a; + if (e(u)) { + var v = typeof u.valueOf == "function" ? u.valueOf() : u; + u = e(v) ? v + "" : v; + } + if (typeof u != "string") + return u === 0 ? u : +u; + u = r(u); + var f = i.test(u); + return f || s.test(u) ? o(u.slice(2), f ? 2 : 8) : n.test(u) ? a : +u; + } + return ui = l, ui; +} +var li, No; +function Pc() { + if (No) return li; + No = 1; + var r = La(), e = Ec(), t = Bc(), a = "Expected a function", n = Math.max, i = Math.min; + function s(o, l, u) { + var v, f, c, h, d, y, g = 0, p = !1, m = !1, b = !0; + if (typeof o != "function") + throw new TypeError(a); + l = t(l) || 0, r(u) && (p = !!u.leading, m = "maxWait" in u, c = m ? n(t(u.maxWait) || 0, l) : c, b = "trailing" in u ? !!u.trailing : b); + function w(B) { + var R = v, M = f; + return v = f = void 0, g = B, h = o.apply(M, R), h; + } + function E(B) { + return g = B, d = setTimeout(k, l), p ? w(B) : h; + } + function C(B) { + var R = B - y, M = B - g, I = l - R; + return m ? i(I, c - M) : I; + } + function x(B) { + var R = B - y, M = B - g; + return y === void 0 || R >= l || R < 0 || m && M >= c; + } + function k() { + var B = e(); + if (x(B)) + return S(B); + d = setTimeout(k, C(B)); + } + function S(B) { + return d = void 0, b && v ? w(B) : (v = f = void 0, h); + } + function P() { + d !== void 0 && clearTimeout(d), g = 0, v = y = f = d = void 0; + } + function D() { + return d === void 0 ? h : S(e()); + } + function A() { + var B = e(), R = x(B); + if (v = arguments, f = this, y = B, R) { + if (d === void 0) + return E(y); + if (m) + return clearTimeout(d), d = setTimeout(k, l), w(y); + } + return d === void 0 && (d = setTimeout(k, l)), h; + } + return A.cancel = P, A.flush = D, A; + } + return li = s, li; +} +var Ac = Pc(), Oa = /* @__PURE__ */ Ma(Ac), vi = Je ? Je.performance : null, av = vi && vi.now ? function() { + return vi.now(); +} : function() { + return Date.now(); +}, Rc = function() { + if (Je) { + if (Je.requestAnimationFrame) + return function(r) { + Je.requestAnimationFrame(r); + }; + if (Je.mozRequestAnimationFrame) + return function(r) { + Je.mozRequestAnimationFrame(r); + }; + if (Je.webkitRequestAnimationFrame) + return function(r) { + Je.webkitRequestAnimationFrame(r); + }; + if (Je.msRequestAnimationFrame) + return function(r) { + Je.msRequestAnimationFrame(r); + }; + } + return function(r) { + r && setTimeout(function() { + r(av()); + }, 1e3 / 60); + }; +}(), mn = function(e) { + return Rc(e); +}, Yr = av, xt = 9261, nv = 65599, qt = 5381, iv = function(e) { + for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : xt, a = t, n; n = e.next(), !n.done; ) + a = a * nv + n.value | 0; + return a; +}, wa = function(e) { + var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : xt; + return t * nv + e | 0; +}, xa = function(e) { + var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : qt; + return (t << 5) + t + e | 0; +}, Mc = function(e, t) { + return e * 2097152 + t; +}, jr = function(e) { + return e[0] * 2097152 + e[1]; +}, $a = function(e, t) { + return [wa(e[0], t[0]), xa(e[1], t[1])]; +}, zo = function(e, t) { + var a = { + value: 0, + done: !1 + }, n = 0, i = e.length, s = { + next: function() { + return n < i ? a.value = e[n++] : a.done = !0, a; + } + }; + return iv(s, t); +}, Tt = function(e, t) { + var a = { + value: 0, + done: !1 + }, n = 0, i = e.length, s = { + next: function() { + return n < i ? a.value = e.charCodeAt(n++) : a.done = !0, a; + } + }; + return iv(s, t); +}, sv = function() { + return Lc(arguments); +}, Lc = function(e) { + for (var t, a = 0; a < e.length; a++) { + var n = e[a]; + a === 0 ? t = Tt(n) : t = Tt(n, t); + } + return t; +}, Fo = !0, Ic = console.warn != null, Oc = console.trace != null, Xs = Number.MAX_SAFE_INTEGER || 9007199254740991, ov = function() { + return !0; +}, bn = function() { + return !1; +}, Vo = function() { + return 0; +}, Zs = function() { +}, He = function(e) { + throw new Error(e); +}, uv = function(e) { + if (e !== void 0) + Fo = !!e; + else + return Fo; +}, Le = function(e) { + uv() && (Ic ? console.warn(e) : (console.log(e), Oc && console.trace())); +}, Nc = function(e) { + return he({}, e); +}, qr = function(e) { + return e == null ? e : Fe(e) ? e.slice() : Pe(e) ? Nc(e) : e; +}, zc = function(e) { + return e.slice(); +}, lv = function(e, t) { + for ( + // loop :) + t = e = ""; + // b - result , a - numeric letiable + e++ < 36; + // + t += e * 51 & 52 ? ( + // return a random number or 4 + (e ^ 15 ? ( + // generate a random number from 0 to 15 + 8 ^ Math.random() * (e ^ 20 ? 16 : 4) + ) : 4).toString(16) + ) : "-" + ) ; + return t; +}, Fc = {}, vv = function() { + return Fc; +}, fr = function(e) { + var t = Object.keys(e); + return function(a) { + for (var n = {}, i = 0; i < t.length; i++) { + var s = t[i], o = a == null ? void 0 : a[s]; + n[s] = o === void 0 ? e[s] : o; + } + return n; + }; +}, it = function(e, t, a) { + for (var n = e.length - 1; n >= 0; n--) + e[n] === t && e.splice(n, 1); +}, Qs = function(e) { + e.splice(0, e.length); +}, Vc = function(e, t) { + for (var a = 0; a < t.length; a++) { + var n = t[a]; + e.push(n); + } +}, Er = function(e, t, a) { + return a && (t = Ql(a, t)), e[t]; +}, $r = function(e, t, a, n) { + a && (t = Ql(a, t)), e[t] = n; +}, qc = /* @__PURE__ */ function() { + function r() { + vt(this, r), this._obj = {}; + } + return ft(r, [{ + key: "set", + value: function(t, a) { + return this._obj[t] = a, this; + } + }, { + key: "delete", + value: function(t) { + return this._obj[t] = void 0, this; + } + }, { + key: "clear", + value: function() { + this._obj = {}; + } + }, { + key: "has", + value: function(t) { + return this._obj[t] !== void 0; + } + }, { + key: "get", + value: function(t) { + return this._obj[t]; + } + }]); +}(), Kr = typeof Map < "u" ? Map : qc, _c = "undefined", Gc = /* @__PURE__ */ function() { + function r(e) { + if (vt(this, r), this._obj = /* @__PURE__ */ Object.create(null), this.size = 0, e != null) { + var t; + e.instanceString != null && e.instanceString() === this.instanceString() ? t = e.toArray() : t = e; + for (var a = 0; a < t.length; a++) + this.add(t[a]); + } + } + return ft(r, [{ + key: "instanceString", + value: function() { + return "set"; + } + }, { + key: "add", + value: function(t) { + var a = this._obj; + a[t] !== 1 && (a[t] = 1, this.size++); + } + }, { + key: "delete", + value: function(t) { + var a = this._obj; + a[t] === 1 && (a[t] = 0, this.size--); + } + }, { + key: "clear", + value: function() { + this._obj = /* @__PURE__ */ Object.create(null); + } + }, { + key: "has", + value: function(t) { + return this._obj[t] === 1; + } + }, { + key: "toArray", + value: function() { + var t = this; + return Object.keys(this._obj).filter(function(a) { + return t.has(a); + }); + } + }, { + key: "forEach", + value: function(t, a) { + return this.toArray().forEach(t, a); + } + }]); +}(), jt = (typeof Set > "u" ? "undefined" : rr(Set)) !== _c ? Set : Gc, Mn = function(e, t) { + var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0; + if (e === void 0 || t === void 0 || !$s(e)) { + He("An element must have a core reference and parameters set"); + return; + } + var n = t.group; + if (n == null && (t.data && t.data.source != null && t.data.target != null ? n = "edges" : n = "nodes"), n !== "nodes" && n !== "edges") { + He("An element must be of type `nodes` or `edges`; you specified `" + n + "`"); + return; + } + this.length = 1, this[0] = this; + var i = this._private = { + cy: e, + single: !0, + // indicates this is an element + data: t.data || {}, + // data object + position: t.position || { + x: 0, + y: 0 + }, + // (x, y) position pair + autoWidth: void 0, + // width and height of nodes calculated by the renderer when set to special 'auto' value + autoHeight: void 0, + autoPadding: void 0, + compoundBoundsClean: !1, + // whether the compound dimensions need to be recalculated the next time dimensions are read + listeners: [], + // array of bound listeners + group: n, + // string; 'nodes' or 'edges' + style: {}, + // properties as set by the style + rstyle: {}, + // properties for style sent from the renderer to the core + styleCxts: [], + // applied style contexts from the styler + styleKeys: {}, + // per-group keys of style property values + removed: !0, + // whether it's inside the vis; true if removed (set true here since we call restore) + selected: !!t.selected, + // whether it's selected + selectable: t.selectable === void 0 ? !0 : !!t.selectable, + // whether it's selectable + locked: !!t.locked, + // whether the element is locked (cannot be moved) + grabbed: !1, + // whether the element is grabbed by the mouse; renderer sets this privately + grabbable: t.grabbable === void 0 ? !0 : !!t.grabbable, + // whether the element can be grabbed + pannable: t.pannable === void 0 ? n === "edges" : !!t.pannable, + // whether the element has passthrough panning enabled + active: !1, + // whether the element is active from user interaction + classes: new jt(), + // map ( className => true ) + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + rscratch: {}, + // object in which the renderer can store information + scratch: t.scratch || {}, + // scratch objects + edges: [], + // array of connected edges + children: [], + // array of children + parent: t.parent && t.parent.isNode() ? t.parent : null, + // parent ref + traversalCache: {}, + // cache of output of traversal functions + backgrounding: !1, + // whether background images are loading + bbCache: null, + // cache of the current bounding box + bbCacheShift: { + x: 0, + y: 0 + }, + // shift applied to cached bb to be applied on next get + bodyBounds: null, + // bounds cache of element body, w/o overlay + overlayBounds: null, + // bounds cache of element body, including overlay + labelBounds: { + // bounds cache of labels + all: null, + source: null, + target: null, + main: null + }, + arrowBounds: { + // bounds cache of edge arrows + source: null, + target: null, + "mid-source": null, + "mid-target": null + } + }; + if (i.position.x == null && (i.position.x = 0), i.position.y == null && (i.position.y = 0), t.renderedPosition) { + var s = t.renderedPosition, o = e.pan(), l = e.zoom(); + i.position = { + x: (s.x - o.x) / l, + y: (s.y - o.y) / l + }; + } + var u = []; + Fe(t.classes) ? u = t.classes : fe(t.classes) && (u = t.classes.split(/\s+/)); + for (var v = 0, f = u.length; v < f; v++) { + var c = u[v]; + !c || c === "" || i.classes.add(c); + } + this.createEmitter(), (a === void 0 || a) && this.restore(); + var h = t.style || t.css; + h && (Le("Setting a `style` bypass at element creation should be done only when absolutely necessary. Try to use the stylesheet instead."), this.style(h)); +}, qo = function(e) { + return e = { + bfs: e.bfs || !e.dfs, + dfs: e.dfs || !e.bfs + }, function(a, n, i) { + var s; + Pe(a) && !Dr(a) && (s = a, a = s.roots || s.root, n = s.visit, i = s.directed), i = arguments.length === 2 && !We(n) ? n : i, n = We(n) ? n : function() { + }; + for (var o = this._private.cy, l = a = fe(a) ? this.filter(a) : a, u = [], v = [], f = {}, c = {}, h = {}, d = 0, y, g = this.byGroup(), p = g.nodes, m = g.edges, b = 0; b < l.length; b++) { + var w = l[b], E = w.id(); + w.isNode() && (u.unshift(w), e.bfs && (h[E] = !0, v.push(w)), c[E] = 0); + } + for (var C = function() { + var B = e.bfs ? u.shift() : u.pop(), R = B.id(); + if (e.dfs) { + if (h[R]) + return 0; + h[R] = !0, v.push(B); + } + var M = c[R], I = f[R], L = I != null ? I.source() : null, O = I != null ? I.target() : null, V = I == null ? void 0 : B.same(L) ? O[0] : L[0], G; + if (G = n(B, I, V, d++, M), G === !0) + return y = B, 1; + if (G === !1) + return 1; + for (var N = B.connectedEdges().filter(function(Z) { + return (!i || Z.source().same(B)) && m.has(Z); + }), F = 0; F < N.length; F++) { + var K = N[F], X = K.connectedNodes().filter(function(Z) { + return !Z.same(B) && p.has(Z); + }), Q = X.id(); + X.length !== 0 && !h[Q] && (X = X[0], u.push(X), e.bfs && (h[Q] = !0, v.push(X)), f[Q] = K, c[Q] = c[R] + 1); + } + }, x; u.length !== 0 && (x = C(), !(x !== 0 && x === 1)); ) + ; + for (var k = o.collection(), S = 0; S < v.length; S++) { + var P = v[S], D = f[P.id()]; + D != null && k.push(D), k.push(P); + } + return { + path: o.collection(k), + found: o.collection(y) + }; + }; +}, Ea = { + breadthFirstSearch: qo({ + bfs: !0 + }), + depthFirstSearch: qo({ + dfs: !0 + }) +}; +Ea.bfs = Ea.breadthFirstSearch; +Ea.dfs = Ea.depthFirstSearch; +var nn = { exports: {} }, Hc = nn.exports, _o; +function Wc() { + return _o || (_o = 1, function(r, e) { + (function() { + var t, a, n, i, s, o, l, u, v, f, c, h, d, y, g; + n = Math.floor, f = Math.min, a = function(p, m) { + return p < m ? -1 : p > m ? 1 : 0; + }, v = function(p, m, b, w, E) { + var C; + if (b == null && (b = 0), E == null && (E = a), b < 0) + throw new Error("lo must be non-negative"); + for (w == null && (w = p.length); b < w; ) + C = n((b + w) / 2), E(m, p[C]) < 0 ? w = C : b = C + 1; + return [].splice.apply(p, [b, b - b].concat(m)), m; + }, o = function(p, m, b) { + return b == null && (b = a), p.push(m), y(p, 0, p.length - 1, b); + }, s = function(p, m) { + var b, w; + return m == null && (m = a), b = p.pop(), p.length ? (w = p[0], p[0] = b, g(p, 0, m)) : w = b, w; + }, u = function(p, m, b) { + var w; + return b == null && (b = a), w = p[0], p[0] = m, g(p, 0, b), w; + }, l = function(p, m, b) { + var w; + return b == null && (b = a), p.length && b(p[0], m) < 0 && (w = [p[0], m], m = w[0], p[0] = w[1], g(p, 0, b)), m; + }, i = function(p, m) { + var b, w, E, C, x, k; + for (m == null && (m = a), C = (function() { + k = []; + for (var S = 0, P = n(p.length / 2); 0 <= P ? S < P : S > P; 0 <= P ? S++ : S--) + k.push(S); + return k; + }).apply(this).reverse(), x = [], w = 0, E = C.length; w < E; w++) + b = C[w], x.push(g(p, b, m)); + return x; + }, d = function(p, m, b) { + var w; + if (b == null && (b = a), w = p.indexOf(m), w !== -1) + return y(p, 0, w, b), g(p, w, b); + }, c = function(p, m, b) { + var w, E, C, x, k; + if (b == null && (b = a), E = p.slice(0, m), !E.length) + return E; + for (i(E, b), k = p.slice(m), C = 0, x = k.length; C < x; C++) + w = k[C], l(E, w, b); + return E.sort(b).reverse(); + }, h = function(p, m, b) { + var w, E, C, x, k, S, P, D, A; + if (b == null && (b = a), m * 10 <= p.length) { + if (C = p.slice(0, m).sort(b), !C.length) + return C; + for (E = C[C.length - 1], P = p.slice(m), x = 0, S = P.length; x < S; x++) + w = P[x], b(w, E) < 0 && (v(C, w, 0, null, b), C.pop(), E = C[C.length - 1]); + return C; + } + for (i(p, b), A = [], k = 0, D = f(m, p.length); 0 <= D ? k < D : k > D; 0 <= D ? ++k : --k) + A.push(s(p, b)); + return A; + }, y = function(p, m, b, w) { + var E, C, x; + for (w == null && (w = a), E = p[b]; b > m; ) { + if (x = b - 1 >> 1, C = p[x], w(E, C) < 0) { + p[b] = C, b = x; + continue; + } + break; + } + return p[b] = E; + }, g = function(p, m, b) { + var w, E, C, x, k; + for (b == null && (b = a), E = p.length, k = m, C = p[m], w = 2 * m + 1; w < E; ) + x = w + 1, x < E && !(b(p[w], p[x]) < 0) && (w = x), p[m] = p[w], m = w, w = 2 * m + 1; + return p[m] = C, y(p, k, m, b); + }, t = function() { + p.push = o, p.pop = s, p.replace = u, p.pushpop = l, p.heapify = i, p.updateItem = d, p.nlargest = c, p.nsmallest = h; + function p(m) { + this.cmp = m ?? a, this.nodes = []; + } + return p.prototype.push = function(m) { + return o(this.nodes, m, this.cmp); + }, p.prototype.pop = function() { + return s(this.nodes, this.cmp); + }, p.prototype.peek = function() { + return this.nodes[0]; + }, p.prototype.contains = function(m) { + return this.nodes.indexOf(m) !== -1; + }, p.prototype.replace = function(m) { + return u(this.nodes, m, this.cmp); + }, p.prototype.pushpop = function(m) { + return l(this.nodes, m, this.cmp); + }, p.prototype.heapify = function() { + return i(this.nodes, this.cmp); + }, p.prototype.updateItem = function(m) { + return d(this.nodes, m, this.cmp); + }, p.prototype.clear = function() { + return this.nodes = []; + }, p.prototype.empty = function() { + return this.nodes.length === 0; + }, p.prototype.size = function() { + return this.nodes.length; + }, p.prototype.clone = function() { + var m; + return m = new p(), m.nodes = this.nodes.slice(0), m; + }, p.prototype.toArray = function() { + return this.nodes.slice(0); + }, p.prototype.insert = p.prototype.push, p.prototype.top = p.prototype.peek, p.prototype.front = p.prototype.peek, p.prototype.has = p.prototype.contains, p.prototype.copy = p.prototype.clone, p; + }(), function(p, m) { + return r.exports = m(); + }(this, function() { + return t; + }); + }).call(Hc); + }(nn)), nn.exports; +} +var fi, Go; +function Uc() { + return Go || (Go = 1, fi = Wc()), fi; +} +var $c = Uc(), Na = /* @__PURE__ */ Ma($c), Kc = fr({ + root: null, + weight: function(e) { + return 1; + }, + directed: !1 +}), Yc = { + dijkstra: function(e) { + if (!Pe(e)) { + var t = arguments; + e = { + root: t[0], + weight: t[1], + directed: t[2] + }; + } + var a = Kc(e), n = a.root, i = a.weight, s = a.directed, o = this, l = i, u = fe(n) ? this.filter(n)[0] : n[0], v = {}, f = {}, c = {}, h = this.byGroup(), d = h.nodes, y = h.edges; + y.unmergeBy(function(M) { + return M.isLoop(); + }); + for (var g = function(I) { + return v[I.id()]; + }, p = function(I, L) { + v[I.id()] = L, m.updateItem(I); + }, m = new Na(function(M, I) { + return g(M) - g(I); + }), b = 0; b < d.length; b++) { + var w = d[b]; + v[w.id()] = w.same(u) ? 0 : 1 / 0, m.push(w); + } + for (var E = function(I, L) { + for (var O = (s ? I.edgesTo(L) : I.edgesWith(L)).intersect(y), V = 1 / 0, G, N = 0; N < O.length; N++) { + var F = O[N], K = l(F); + (K < V || !G) && (V = K, G = F); + } + return { + edge: G, + dist: V + }; + }; m.size() > 0; ) { + var C = m.pop(), x = g(C), k = C.id(); + if (c[k] = x, x !== 1 / 0) + for (var S = C.neighborhood().intersect(d), P = 0; P < S.length; P++) { + var D = S[P], A = D.id(), B = E(C, D), R = x + B.dist; + R < g(D) && (p(D, R), f[A] = { + node: C, + edge: B.edge + }); + } + } + return { + distanceTo: function(I) { + var L = fe(I) ? d.filter(I)[0] : I[0]; + return c[L.id()]; + }, + pathTo: function(I) { + var L = fe(I) ? d.filter(I)[0] : I[0], O = [], V = L, G = V.id(); + if (L.length > 0) + for (O.unshift(L); f[G]; ) { + var N = f[G]; + O.unshift(N.edge), O.unshift(N.node), V = N.node, G = V.id(); + } + return o.spawn(O); + } + }; + } +}, Xc = { + // kruskal's algorithm (finds min spanning tree, assuming undirected graph) + // implemented from pseudocode from wikipedia + kruskal: function(e) { + e = e || function(b) { + return 1; + }; + for (var t = this.byGroup(), a = t.nodes, n = t.edges, i = a.length, s = new Array(i), o = a, l = function(w) { + for (var E = 0; E < s.length; E++) { + var C = s[E]; + if (C.has(w)) + return E; + } + }, u = 0; u < i; u++) + s[u] = this.spawn(a[u]); + for (var v = n.sort(function(b, w) { + return e(b) - e(w); + }), f = 0; f < v.length; f++) { + var c = v[f], h = c.source()[0], d = c.target()[0], y = l(h), g = l(d), p = s[y], m = s[g]; + y !== g && (o.merge(c), p.merge(m), s.splice(g, 1)); + } + return o; + } +}, Zc = fr({ + root: null, + goal: null, + weight: function(e) { + return 1; + }, + heuristic: function(e) { + return 0; + }, + directed: !1 +}), Qc = { + // Implemented from pseudocode from wikipedia + aStar: function(e) { + var t = this.cy(), a = Zc(e), n = a.root, i = a.goal, s = a.heuristic, o = a.directed, l = a.weight; + n = t.collection(n)[0], i = t.collection(i)[0]; + var u = n.id(), v = i.id(), f = {}, c = {}, h = {}, d = new Na(function(G, N) { + return c[G.id()] - c[N.id()]; + }), y = new jt(), g = {}, p = {}, m = function(N, F) { + d.push(N), y.add(F); + }, b, w, E = function() { + b = d.pop(), w = b.id(), y.delete(w); + }, C = function(N) { + return y.has(N); + }; + m(n, u), f[u] = 0, c[u] = s(n); + for (var x = 0; d.size() > 0; ) { + if (E(), x++, w === v) { + for (var k = [], S = i, P = v, D = p[P]; k.unshift(S), D != null && k.unshift(D), S = g[P], S != null; ) + P = S.id(), D = p[P]; + return { + found: !0, + distance: f[w], + path: this.spawn(k), + steps: x + }; + } + h[w] = !0; + for (var A = b._private.edges, B = 0; B < A.length; B++) { + var R = A[B]; + if (this.hasElementWithId(R.id()) && !(o && R.data("source") !== w)) { + var M = R.source(), I = R.target(), L = M.id() !== w ? M : I, O = L.id(); + if (this.hasElementWithId(O) && !h[O]) { + var V = f[w] + l(R); + if (!C(O)) { + f[O] = V, c[O] = V + s(L), m(L, O), g[O] = b, p[O] = R; + continue; + } + V < f[O] && (f[O] = V, c[O] = V + s(L), g[O] = b, p[O] = R); + } + } + } + } + return { + found: !1, + distance: void 0, + path: void 0, + steps: x + }; + } +}, Jc = fr({ + weight: function(e) { + return 1; + }, + directed: !1 +}), jc = { + // Implemented from pseudocode from wikipedia + floydWarshall: function(e) { + for (var t = this.cy(), a = Jc(e), n = a.weight, i = a.directed, s = n, o = this.byGroup(), l = o.nodes, u = o.edges, v = l.length, f = v * v, c = function(K) { + return l.indexOf(K); + }, h = function(K) { + return l[K]; + }, d = new Array(f), y = 0; y < f; y++) { + var g = y % v, p = (y - g) / v; + p === g ? d[y] = 0 : d[y] = 1 / 0; + } + for (var m = new Array(f), b = new Array(f), w = 0; w < u.length; w++) { + var E = u[w], C = E.source()[0], x = E.target()[0]; + if (C !== x) { + var k = c(C), S = c(x), P = k * v + S, D = s(E); + if (d[P] > D && (d[P] = D, m[P] = S, b[P] = E), !i) { + var A = S * v + k; + !i && d[A] > D && (d[A] = D, m[A] = k, b[A] = E); + } + } + } + for (var B = 0; B < v; B++) + for (var R = 0; R < v; R++) + for (var M = R * v + B, I = 0; I < v; I++) { + var L = R * v + I, O = B * v + I; + d[M] + d[O] < d[L] && (d[L] = d[M] + d[O], m[L] = m[M]); + } + var V = function(K) { + return (fe(K) ? t.filter(K) : K)[0]; + }, G = function(K) { + return c(V(K)); + }, N = { + distance: function(K, X) { + var Q = G(K), Z = G(X); + return d[Q * v + Z]; + }, + path: function(K, X) { + var Q = G(K), Z = G(X), re = h(Q); + if (Q === Z) + return re.collection(); + if (m[Q * v + Z] == null) + return t.collection(); + var ae = t.collection(), J = Q, z; + for (ae.merge(re); Q !== Z; ) + J = Q, Q = m[Q * v + Z], z = b[J * v + Q], ae.merge(z), ae.merge(h(Q)); + return ae; + } + }; + return N; + } + // floydWarshall +}, ed = fr({ + weight: function(e) { + return 1; + }, + directed: !1, + root: null +}), rd = { + // Implemented from pseudocode from wikipedia + bellmanFord: function(e) { + var t = this, a = ed(e), n = a.weight, i = a.directed, s = a.root, o = n, l = this, u = this.cy(), v = this.byGroup(), f = v.edges, c = v.nodes, h = c.length, d = new Kr(), y = !1, g = []; + s = u.collection(s)[0], f.unmergeBy(function(Ie) { + return Ie.isLoop(); + }); + for (var p = f.length, m = function(se) { + var oe = d.get(se.id()); + return oe || (oe = {}, d.set(se.id(), oe)), oe; + }, b = function(se) { + return (fe(se) ? u.$(se) : se)[0]; + }, w = function(se) { + return m(b(se)).dist; + }, E = function(se) { + for (var oe = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : s, ce = b(se), ge = [], de = ce; ; ) { + if (de == null) + return t.spawn(); + var ye = m(de), we = ye.edge, De = ye.pred; + if (ge.unshift(de[0]), de.same(oe) && ge.length > 0) + break; + we != null && ge.unshift(we), de = De; + } + return l.spawn(ge); + }, C = 0; C < h; C++) { + var x = c[C], k = m(x); + x.same(s) ? k.dist = 0 : k.dist = 1 / 0, k.pred = null, k.edge = null; + } + for (var S = !1, P = function(se, oe, ce, ge, de, ye) { + var we = ge.dist + ye; + we < de.dist && !ce.same(ge.edge) && (de.dist = we, de.pred = se, de.edge = ce, S = !0); + }, D = 1; D < h; D++) { + S = !1; + for (var A = 0; A < p; A++) { + var B = f[A], R = B.source(), M = B.target(), I = o(B), L = m(R), O = m(M); + P(R, M, B, L, O, I), i || P(M, R, B, O, L, I); + } + if (!S) + break; + } + if (S) + for (var V = [], G = 0; G < p; G++) { + var N = f[G], F = N.source(), K = N.target(), X = o(N), Q = m(F).dist, Z = m(K).dist; + if (Q + X < Z || !i && Z + X < Q) + if (y || (Le("Graph contains a negative weight cycle for Bellman-Ford"), y = !0), e.findNegativeWeightCycles !== !1) { + var re = []; + Q + X < Z && re.push(F), !i && Z + X < Q && re.push(K); + for (var ae = re.length, J = 0; J < ae; J++) { + var z = re[J], q = [z]; + q.push(m(z).edge); + for (var H = m(z).pred; q.indexOf(H) === -1; ) + q.push(H), q.push(m(H).edge), H = m(H).pred; + q = q.slice(q.indexOf(H)); + for (var ee = q[0].id(), ne = 0, be = 2; be < q.length; be += 2) + q[be].id() < ee && (ee = q[be].id(), ne = be); + q = q.slice(ne).concat(q.slice(0, ne)), q.push(q[0]); + var _e = q.map(function(Ie) { + return Ie.id(); + }).join(","); + V.indexOf(_e) === -1 && (g.push(l.spawn(q)), V.push(_e)); + } + } else + break; + } + return { + distanceTo: w, + pathTo: E, + hasNegativeWeightCycle: y, + negativeWeightCycles: g + }; + } + // bellmanFord +}, td = Math.sqrt(2), ad = function(e, t, a) { + a.length === 0 && He("Karger-Stein must be run on a connected (sub)graph"); + for (var n = a[e], i = n[1], s = n[2], o = t[i], l = t[s], u = a, v = u.length - 1; v >= 0; v--) { + var f = u[v], c = f[1], h = f[2]; + (t[c] === o && t[h] === l || t[c] === l && t[h] === o) && u.splice(v, 1); + } + for (var d = 0; d < u.length; d++) { + var y = u[d]; + y[1] === l ? (u[d] = y.slice(), u[d][1] = o) : y[2] === l && (u[d] = y.slice(), u[d][2] = o); + } + for (var g = 0; g < t.length; g++) + t[g] === l && (t[g] = o); + return u; +}, ci = function(e, t, a, n) { + for (; a > n; ) { + var i = Math.floor(Math.random() * t.length); + t = ad(i, e, t), a--; + } + return t; +}, nd = { + // Computes the minimum cut of an undirected graph + // Returns the correct answer with high probability + kargerStein: function() { + var e = this, t = this.byGroup(), a = t.nodes, n = t.edges; + n.unmergeBy(function(O) { + return O.isLoop(); + }); + var i = a.length, s = n.length, o = Math.ceil(Math.pow(Math.log(i) / Math.LN2, 2)), l = Math.floor(i / td); + if (i < 2) { + He("At least 2 nodes are required for Karger-Stein algorithm"); + return; + } + for (var u = [], v = 0; v < s; v++) { + var f = n[v]; + u.push([v, a.indexOf(f.source()), a.indexOf(f.target())]); + } + for (var c = 1 / 0, h = [], d = new Array(i), y = new Array(i), g = new Array(i), p = function(V, G) { + for (var N = 0; N < i; N++) + G[N] = V[N]; + }, m = 0; m <= o; m++) { + for (var b = 0; b < i; b++) + y[b] = b; + var w = ci(y, u.slice(), i, l), E = w.slice(); + p(y, g); + var C = ci(y, w, l, 2), x = ci(g, E, l, 2); + C.length <= x.length && C.length < c ? (c = C.length, h = C, p(y, d)) : x.length <= C.length && x.length < c && (c = x.length, h = x, p(g, d)); + } + for (var k = this.spawn(h.map(function(O) { + return n[O[0]]; + })), S = this.spawn(), P = this.spawn(), D = d[0], A = 0; A < d.length; A++) { + var B = d[A], R = a[A]; + B === D ? S.merge(R) : P.merge(R); + } + var M = function(V) { + var G = e.spawn(); + return V.forEach(function(N) { + G.merge(N), N.connectedEdges().forEach(function(F) { + e.contains(F) && !k.contains(F) && G.merge(F); + }); + }), G; + }, I = [M(S), M(P)], L = { + cut: k, + components: I, + // n.b. partitions are included to be compatible with the old api spec + // (could be removed in a future major version) + partition1: S, + partition2: P + }; + return L; + } +}, id = function(e) { + return { + x: e.x, + y: e.y + }; +}, Ln = function(e, t, a) { + return { + x: e.x * t + a.x, + y: e.y * t + a.y + }; +}, fv = function(e, t, a) { + return { + x: (e.x - a.x) / t, + y: (e.y - a.y) / t + }; +}, _t = function(e) { + return { + x: e[0], + y: e[1] + }; +}, sd = function(e) { + for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = 1 / 0, i = t; i < a; i++) { + var s = e[i]; + isFinite(s) && (n = Math.min(s, n)); + } + return n; +}, od = function(e) { + for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = -1 / 0, i = t; i < a; i++) { + var s = e[i]; + isFinite(s) && (n = Math.max(s, n)); + } + return n; +}, ud = function(e) { + for (var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = 0, i = 0, s = t; s < a; s++) { + var o = e[s]; + isFinite(o) && (n += o, i++); + } + return n / i; +}, ld = function(e) { + var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : e.length, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, i = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0; + n ? e = e.slice(t, a) : (a < e.length && e.splice(a, e.length - a), t > 0 && e.splice(0, t)); + for (var o = 0, l = e.length - 1; l >= 0; l--) { + var u = e[l]; + s ? isFinite(u) || (e[l] = -1 / 0, o++) : e.splice(l, 1); + } + i && e.sort(function(c, h) { + return c - h; + }); + var v = e.length, f = Math.floor(v / 2); + return v % 2 !== 0 ? e[f + 1 + o] : (e[f - 1 + o] + e[f + o]) / 2; +}, vd = function(e) { + return Math.PI * e / 180; +}, Ka = function(e, t) { + return Math.atan2(t, e) - Math.PI / 2; +}, Js = Math.log2 || function(r) { + return Math.log(r) / Math.log(2); +}, js = function(e) { + return e > 0 ? 1 : e < 0 ? -1 : 0; +}, St = function(e, t) { + return Math.sqrt(mt(e, t)); +}, mt = function(e, t) { + var a = t.x - e.x, n = t.y - e.y; + return a * a + n * n; +}, fd = function(e) { + for (var t = e.length, a = 0, n = 0; n < t; n++) + a += e[n]; + for (var i = 0; i < t; i++) + e[i] = e[i] / a; + return e; +}, nr = function(e, t, a, n) { + return (1 - n) * (1 - n) * e + 2 * (1 - n) * n * t + n * n * a; +}, Wt = function(e, t, a, n) { + return { + x: nr(e.x, t.x, a.x, n), + y: nr(e.y, t.y, a.y, n) + }; +}, cd = function(e, t, a, n) { + var i = { + x: t.x - e.x, + y: t.y - e.y + }, s = St(e, t), o = { + x: i.x / s, + y: i.y / s + }; + return a = a ?? 0, n = n ?? a * s, { + x: e.x + o.x * n, + y: e.y + o.y * n + }; +}, Ca = function(e, t, a) { + return Math.max(e, Math.min(a, t)); +}, Sr = function(e) { + if (e == null) + return { + x1: 1 / 0, + y1: 1 / 0, + x2: -1 / 0, + y2: -1 / 0, + w: 0, + h: 0 + }; + if (e.x1 != null && e.y1 != null) { + if (e.x2 != null && e.y2 != null && e.x2 >= e.x1 && e.y2 >= e.y1) + return { + x1: e.x1, + y1: e.y1, + x2: e.x2, + y2: e.y2, + w: e.x2 - e.x1, + h: e.y2 - e.y1 + }; + if (e.w != null && e.h != null && e.w >= 0 && e.h >= 0) + return { + x1: e.x1, + y1: e.y1, + x2: e.x1 + e.w, + y2: e.y1 + e.h, + w: e.w, + h: e.h + }; + } +}, dd = function(e) { + return { + x1: e.x1, + x2: e.x2, + w: e.w, + y1: e.y1, + y2: e.y2, + h: e.h + }; +}, hd = function(e) { + e.x1 = 1 / 0, e.y1 = 1 / 0, e.x2 = -1 / 0, e.y2 = -1 / 0, e.w = 0, e.h = 0; +}, gd = function(e, t, a) { + return { + x1: e.x1 + t, + x2: e.x2 + t, + y1: e.y1 + a, + y2: e.y2 + a, + w: e.w, + h: e.h + }; +}, cv = function(e, t) { + e.x1 = Math.min(e.x1, t.x1), e.x2 = Math.max(e.x2, t.x2), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, t.y1), e.y2 = Math.max(e.y2, t.y2), e.h = e.y2 - e.y1; +}, pd = function(e, t, a) { + e.x1 = Math.min(e.x1, t), e.x2 = Math.max(e.x2, t), e.w = e.x2 - e.x1, e.y1 = Math.min(e.y1, a), e.y2 = Math.max(e.y2, a), e.h = e.y2 - e.y1; +}, sn = function(e) { + var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0; + return e.x1 -= t, e.x2 += t, e.y1 -= t, e.y2 += t, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e; +}, on = function(e) { + var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0], a, n, i, s; + if (t.length === 1) + a = n = i = s = t[0]; + else if (t.length === 2) + a = i = t[0], s = n = t[1]; + else if (t.length === 4) { + var o = je(t, 4); + a = o[0], n = o[1], i = o[2], s = o[3]; + } + return e.x1 -= s, e.x2 += n, e.y1 -= a, e.y2 += i, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1, e; +}, Ho = function(e, t) { + e.x1 = t.x1, e.y1 = t.y1, e.x2 = t.x2, e.y2 = t.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1; +}, eo = function(e, t) { + return !(e.x1 > t.x2 || t.x1 > e.x2 || e.x2 < t.x1 || t.x2 < e.x1 || e.y2 < t.y1 || t.y2 < e.y1 || e.y1 > t.y2 || t.y1 > e.y2); +}, Xt = function(e, t, a) { + return e.x1 <= t && t <= e.x2 && e.y1 <= a && a <= e.y2; +}, yd = function(e, t) { + return Xt(e, t.x, t.y); +}, md = function(e, t) { + return Xt(e, t.x1, t.y1) && Xt(e, t.x2, t.y2); +}, dv = function(e, t, a, n, i, s, o) { + var l = arguments.length > 7 && arguments[7] !== void 0 ? arguments[7] : "auto", u = l === "auto" ? st(i, s) : l, v = i / 2, f = s / 2; + u = Math.min(u, v, f); + var c = u !== v, h = u !== f, d; + if (c) { + var y = a - v + u - o, g = n - f - o, p = a + v - u + o, m = g; + if (d = rt(e, t, a, n, y, g, p, m, !1), d.length > 0) + return d; + } + if (h) { + var b = a + v + o, w = n - f + u - o, E = b, C = n + f - u + o; + if (d = rt(e, t, a, n, b, w, E, C, !1), d.length > 0) + return d; + } + if (c) { + var x = a - v + u - o, k = n + f + o, S = a + v - u + o, P = k; + if (d = rt(e, t, a, n, x, k, S, P, !1), d.length > 0) + return d; + } + if (h) { + var D = a - v - o, A = n - f + u - o, B = D, R = n + f - u + o; + if (d = rt(e, t, a, n, D, A, B, R, !1), d.length > 0) + return d; + } + var M; + { + var I = a - v + u, L = n - f + u; + if (M = ha(e, t, a, n, I, L, u + o), M.length > 0 && M[0] <= I && M[1] <= L) + return [M[0], M[1]]; + } + { + var O = a + v - u, V = n - f + u; + if (M = ha(e, t, a, n, O, V, u + o), M.length > 0 && M[0] >= O && M[1] <= V) + return [M[0], M[1]]; + } + { + var G = a + v - u, N = n + f - u; + if (M = ha(e, t, a, n, G, N, u + o), M.length > 0 && M[0] >= G && M[1] >= N) + return [M[0], M[1]]; + } + { + var F = a - v + u, K = n + f - u; + if (M = ha(e, t, a, n, F, K, u + o), M.length > 0 && M[0] <= F && M[1] >= K) + return [M[0], M[1]]; + } + return []; +}, bd = function(e, t, a, n, i, s, o) { + var l = o, u = Math.min(a, i), v = Math.max(a, i), f = Math.min(n, s), c = Math.max(n, s); + return u - l <= e && e <= v + l && f - l <= t && t <= c + l; +}, wd = function(e, t, a, n, i, s, o, l, u) { + var v = { + x1: Math.min(a, o, i) - u, + x2: Math.max(a, o, i) + u, + y1: Math.min(n, l, s) - u, + y2: Math.max(n, l, s) + u + }; + return !(e < v.x1 || e > v.x2 || t < v.y1 || t > v.y2); +}, xd = function(e, t, a, n) { + a -= n; + var i = t * t - 4 * e * a; + if (i < 0) + return []; + var s = Math.sqrt(i), o = 2 * e, l = (-t + s) / o, u = (-t - s) / o; + return [l, u]; +}, Ed = function(e, t, a, n, i) { + var s = 1e-5; + e === 0 && (e = s), t /= e, a /= e, n /= e; + var o, l, u, v, f, c, h, d; + if (l = (3 * a - t * t) / 9, u = -(27 * n) + t * (9 * a - 2 * (t * t)), u /= 54, o = l * l * l + u * u, i[1] = 0, h = t / 3, o > 0) { + f = u + Math.sqrt(o), f = f < 0 ? -Math.pow(-f, 1 / 3) : Math.pow(f, 1 / 3), c = u - Math.sqrt(o), c = c < 0 ? -Math.pow(-c, 1 / 3) : Math.pow(c, 1 / 3), i[0] = -h + f + c, h += (f + c) / 2, i[4] = i[2] = -h, h = Math.sqrt(3) * (-c + f) / 2, i[3] = h, i[5] = -h; + return; + } + if (i[5] = i[3] = 0, o === 0) { + d = u < 0 ? -Math.pow(-u, 1 / 3) : Math.pow(u, 1 / 3), i[0] = -h + 2 * d, i[4] = i[2] = -(d + h); + return; + } + l = -l, v = l * l * l, v = Math.acos(u / Math.sqrt(v)), d = 2 * Math.sqrt(l), i[0] = -h + d * Math.cos(v / 3), i[2] = -h + d * Math.cos((v + 2 * Math.PI) / 3), i[4] = -h + d * Math.cos((v + 4 * Math.PI) / 3); +}, Cd = function(e, t, a, n, i, s, o, l) { + var u = 1 * a * a - 4 * a * i + 2 * a * o + 4 * i * i - 4 * i * o + o * o + n * n - 4 * n * s + 2 * n * l + 4 * s * s - 4 * s * l + l * l, v = 1 * 9 * a * i - 3 * a * a - 3 * a * o - 6 * i * i + 3 * i * o + 9 * n * s - 3 * n * n - 3 * n * l - 6 * s * s + 3 * s * l, f = 1 * 3 * a * a - 6 * a * i + a * o - a * e + 2 * i * i + 2 * i * e - o * e + 3 * n * n - 6 * n * s + n * l - n * t + 2 * s * s + 2 * s * t - l * t, c = 1 * a * i - a * a + a * e - i * e + n * s - n * n + n * t - s * t, h = []; + Ed(u, v, f, c, h); + for (var d = 1e-7, y = [], g = 0; g < 6; g += 2) + Math.abs(h[g + 1]) < d && h[g] >= 0 && h[g] <= 1 && y.push(h[g]); + y.push(1), y.push(0); + for (var p = -1, m, b, w, E = 0; E < y.length; E++) + m = Math.pow(1 - y[E], 2) * a + 2 * (1 - y[E]) * y[E] * i + y[E] * y[E] * o, b = Math.pow(1 - y[E], 2) * n + 2 * (1 - y[E]) * y[E] * s + y[E] * y[E] * l, w = Math.pow(m - e, 2) + Math.pow(b - t, 2), p >= 0 ? w < p && (p = w) : p = w; + return p; +}, Td = function(e, t, a, n, i, s) { + var o = [e - a, t - n], l = [i - a, s - n], u = l[0] * l[0] + l[1] * l[1], v = o[0] * o[0] + o[1] * o[1], f = o[0] * l[0] + o[1] * l[1], c = f * f / u; + return f < 0 ? v : c > u ? (e - i) * (e - i) + (t - s) * (t - s) : v - c; +}, Cr = function(e, t, a) { + for (var n, i, s, o, l, u = 0, v = 0; v < a.length / 2; v++) + if (n = a[v * 2], i = a[v * 2 + 1], v + 1 < a.length / 2 ? (s = a[(v + 1) * 2], o = a[(v + 1) * 2 + 1]) : (s = a[(v + 1 - a.length / 2) * 2], o = a[(v + 1 - a.length / 2) * 2 + 1]), !(n == e && s == e)) if (n >= e && e >= s || n <= e && e <= s) + l = (e - n) / (s - n) * (o - i) + i, l > t && u++; + else + continue; + return u % 2 !== 0; +}, Xr = function(e, t, a, n, i, s, o, l, u) { + var v = new Array(a.length), f; + l[0] != null ? (f = Math.atan(l[1] / l[0]), l[0] < 0 ? f = f + Math.PI / 2 : f = -f - Math.PI / 2) : f = l; + for (var c = Math.cos(-f), h = Math.sin(-f), d = 0; d < v.length / 2; d++) + v[d * 2] = s / 2 * (a[d * 2] * c - a[d * 2 + 1] * h), v[d * 2 + 1] = o / 2 * (a[d * 2 + 1] * c + a[d * 2] * h), v[d * 2] += n, v[d * 2 + 1] += i; + var y; + if (u > 0) { + var g = xn(v, -u); + y = wn(g); + } else + y = v; + return Cr(e, t, y); +}, Sd = function(e, t, a, n, i, s, o, l) { + for (var u = new Array(a.length * 2), v = 0; v < l.length; v++) { + var f = l[v]; + u[v * 4 + 0] = f.startX, u[v * 4 + 1] = f.startY, u[v * 4 + 2] = f.stopX, u[v * 4 + 3] = f.stopY; + var c = Math.pow(f.cx - e, 2) + Math.pow(f.cy - t, 2); + if (c <= Math.pow(f.radius, 2)) + return !0; + } + return Cr(e, t, u); +}, wn = function(e) { + for (var t = new Array(e.length / 2), a, n, i, s, o, l, u, v, f = 0; f < e.length / 4; f++) { + a = e[f * 4], n = e[f * 4 + 1], i = e[f * 4 + 2], s = e[f * 4 + 3], f < e.length / 4 - 1 ? (o = e[(f + 1) * 4], l = e[(f + 1) * 4 + 1], u = e[(f + 1) * 4 + 2], v = e[(f + 1) * 4 + 3]) : (o = e[0], l = e[1], u = e[2], v = e[3]); + var c = rt(a, n, i, s, o, l, u, v, !0); + t[f * 2] = c[0], t[f * 2 + 1] = c[1]; + } + return t; +}, xn = function(e, t) { + for (var a = new Array(e.length * 2), n, i, s, o, l = 0; l < e.length / 2; l++) { + n = e[l * 2], i = e[l * 2 + 1], l < e.length / 2 - 1 ? (s = e[(l + 1) * 2], o = e[(l + 1) * 2 + 1]) : (s = e[0], o = e[1]); + var u = o - i, v = -(s - n), f = Math.sqrt(u * u + v * v), c = u / f, h = v / f; + a[l * 4] = n + c * t, a[l * 4 + 1] = i + h * t, a[l * 4 + 2] = s + c * t, a[l * 4 + 3] = o + h * t; + } + return a; +}, Dd = function(e, t, a, n, i, s) { + var o = a - e, l = n - t; + o /= i, l /= s; + var u = Math.sqrt(o * o + l * l), v = u - 1; + if (v < 0) + return []; + var f = v / u; + return [(a - e) * f + e, (n - t) * f + t]; +}, Ct = function(e, t, a, n, i, s, o) { + return e -= i, t -= s, e /= a / 2 + o, t /= n / 2 + o, e * e + t * t <= 1; +}, ha = function(e, t, a, n, i, s, o) { + var l = [a - e, n - t], u = [e - i, t - s], v = l[0] * l[0] + l[1] * l[1], f = 2 * (u[0] * l[0] + u[1] * l[1]), c = u[0] * u[0] + u[1] * u[1] - o * o, h = f * f - 4 * v * c; + if (h < 0) + return []; + var d = (-f + Math.sqrt(h)) / (2 * v), y = (-f - Math.sqrt(h)) / (2 * v), g = Math.min(d, y), p = Math.max(d, y), m = []; + if (g >= 0 && g <= 1 && m.push(g), p >= 0 && p <= 1 && m.push(p), m.length === 0) + return []; + var b = m[0] * l[0] + e, w = m[0] * l[1] + t; + if (m.length > 1) { + if (m[0] == m[1]) + return [b, w]; + var E = m[1] * l[0] + e, C = m[1] * l[1] + t; + return [b, w, E, C]; + } else + return [b, w]; +}, di = function(e, t, a) { + return t <= e && e <= a || a <= e && e <= t ? e : e <= t && t <= a || a <= t && t <= e ? t : a; +}, rt = function(e, t, a, n, i, s, o, l, u) { + var v = e - i, f = a - e, c = o - i, h = t - s, d = n - t, y = l - s, g = c * h - y * v, p = f * h - d * v, m = y * f - c * d; + if (m !== 0) { + var b = g / m, w = p / m, E = 1e-3, C = 0 - E, x = 1 + E; + return C <= b && b <= x && C <= w && w <= x ? [e + b * f, t + b * d] : u ? [e + b * f, t + b * d] : []; + } else + return g === 0 || p === 0 ? di(e, a, o) === o ? [o, l] : di(e, a, i) === i ? [i, s] : di(i, o, a) === a ? [a, n] : [] : []; +}, Ta = function(e, t, a, n, i, s, o, l) { + var u = [], v, f = new Array(a.length), c = !0; + s == null && (c = !1); + var h; + if (c) { + for (var d = 0; d < f.length / 2; d++) + f[d * 2] = a[d * 2] * s + n, f[d * 2 + 1] = a[d * 2 + 1] * o + i; + if (l > 0) { + var y = xn(f, -l); + h = wn(y); + } else + h = f; + } else + h = a; + for (var g, p, m, b, w = 0; w < h.length / 2; w++) + g = h[w * 2], p = h[w * 2 + 1], w < h.length / 2 - 1 ? (m = h[(w + 1) * 2], b = h[(w + 1) * 2 + 1]) : (m = h[0], b = h[1]), v = rt(e, t, n, i, g, p, m, b), v.length !== 0 && u.push(v[0], v[1]); + return u; +}, kd = function(e, t, a, n, i, s, o, l, u) { + var v = [], f, c = new Array(a.length * 2); + u.forEach(function(m, b) { + b === 0 ? (c[c.length - 2] = m.startX, c[c.length - 1] = m.startY) : (c[b * 4 - 2] = m.startX, c[b * 4 - 1] = m.startY), c[b * 4] = m.stopX, c[b * 4 + 1] = m.stopY, f = ha(e, t, n, i, m.cx, m.cy, m.radius), f.length !== 0 && v.push(f[0], f[1]); + }); + for (var h = 0; h < c.length / 4; h++) + f = rt(e, t, n, i, c[h * 4], c[h * 4 + 1], c[h * 4 + 2], c[h * 4 + 3], !1), f.length !== 0 && v.push(f[0], f[1]); + if (v.length > 2) { + for (var d = [v[0], v[1]], y = Math.pow(d[0] - e, 2) + Math.pow(d[1] - t, 2), g = 1; g < v.length / 2; g++) { + var p = Math.pow(v[g * 2] - e, 2) + Math.pow(v[g * 2 + 1] - t, 2); + p <= y && (d[0] = v[g * 2], d[1] = v[g * 2 + 1], y = p); + } + return d; + } + return v; +}, Ya = function(e, t, a) { + var n = [e[0] - t[0], e[1] - t[1]], i = Math.sqrt(n[0] * n[0] + n[1] * n[1]), s = (i - a) / i; + return s < 0 && (s = 1e-5), [t[0] + s * n[0], t[1] + s * n[1]]; +}, yr = function(e, t) { + var a = Ds(e, t); + return a = hv(a), a; +}, hv = function(e) { + for (var t, a, n = e.length / 2, i = 1 / 0, s = 1 / 0, o = -1 / 0, l = -1 / 0, u = 0; u < n; u++) + t = e[2 * u], a = e[2 * u + 1], i = Math.min(i, t), o = Math.max(o, t), s = Math.min(s, a), l = Math.max(l, a); + for (var v = 2 / (o - i), f = 2 / (l - s), c = 0; c < n; c++) + t = e[2 * c] = e[2 * c] * v, a = e[2 * c + 1] = e[2 * c + 1] * f, i = Math.min(i, t), o = Math.max(o, t), s = Math.min(s, a), l = Math.max(l, a); + if (s < -1) + for (var h = 0; h < n; h++) + a = e[2 * h + 1] = e[2 * h + 1] + (-1 - s); + return e; +}, Ds = function(e, t) { + var a = 1 / e * 2 * Math.PI, n = e % 2 === 0 ? Math.PI / 2 + a / 2 : Math.PI / 2; + n += t; + for (var i = new Array(e * 2), s, o = 0; o < e; o++) + s = o * a + n, i[2 * o] = Math.cos(s), i[2 * o + 1] = Math.sin(-s); + return i; +}, st = function(e, t) { + return Math.min(e / 4, t / 4, 8); +}, gv = function(e, t) { + return Math.min(e / 10, t / 10, 8); +}, ro = function() { + return 8; +}, Bd = function(e, t, a) { + return [e - 2 * t + a, 2 * (t - e), e]; +}, ks = function(e, t) { + return { + heightOffset: Math.min(15, 0.05 * t), + widthOffset: Math.min(100, 0.25 * e), + ctrlPtOffsetPct: 0.05 + }; +}; +function Pd(r, e) { + function t(f) { + for (var c = [], h = 0; h < f.length; h++) { + var d = f[h], y = f[(h + 1) % f.length], g = { + x: y.x - d.x, + y: y.y - d.y + }, p = { + x: -g.y, + y: g.x + }, m = Math.sqrt(p.x * p.x + p.y * p.y); + c.push({ + x: p.x / m, + y: p.y / m + }); + } + return c; + } + function a(f, c) { + var h = 1 / 0, d = -1 / 0, y = Tr(f), g; + try { + for (y.s(); !(g = y.n()).done; ) { + var p = g.value, m = p.x * c.x + p.y * c.y; + h = Math.min(h, m), d = Math.max(d, m); + } + } catch (b) { + y.e(b); + } finally { + y.f(); + } + return { + min: h, + max: d + }; + } + function n(f, c) { + return !(f.max < c.min || c.max < f.min); + } + var i = [].concat(pn(t(r)), pn(t(e))), s = Tr(i), o; + try { + for (s.s(); !(o = s.n()).done; ) { + var l = o.value, u = a(r, l), v = a(e, l); + if (!n(u, v)) + return !1; + } + } catch (f) { + s.e(f); + } finally { + s.f(); + } + return !0; +} +var Ad = fr({ + dampingFactor: 0.8, + precision: 1e-6, + iterations: 200, + weight: function(e) { + return 1; + } +}), Rd = { + pageRank: function(e) { + for (var t = Ad(e), a = t.dampingFactor, n = t.precision, i = t.iterations, s = t.weight, o = this._private.cy, l = this.byGroup(), u = l.nodes, v = l.edges, f = u.length, c = f * f, h = v.length, d = new Array(c), y = new Array(f), g = (1 - a) / f, p = 0; p < f; p++) { + for (var m = 0; m < f; m++) { + var b = p * f + m; + d[b] = 0; + } + y[p] = 0; + } + for (var w = 0; w < h; w++) { + var E = v[w], C = E.data("source"), x = E.data("target"); + if (C !== x) { + var k = u.indexOfId(C), S = u.indexOfId(x), P = s(E), D = S * f + k; + d[D] += P, y[k] += P; + } + } + for (var A = 1 / f + g, B = 0; B < f; B++) + if (y[B] === 0) + for (var R = 0; R < f; R++) { + var M = R * f + B; + d[M] = A; + } + else + for (var I = 0; I < f; I++) { + var L = I * f + B; + d[L] = d[L] / y[B] + g; + } + for (var O = new Array(f), V = new Array(f), G, N = 0; N < f; N++) + O[N] = 1; + for (var F = 0; F < i; F++) { + for (var K = 0; K < f; K++) + V[K] = 0; + for (var X = 0; X < f; X++) + for (var Q = 0; Q < f; Q++) { + var Z = X * f + Q; + V[X] += d[Z] * O[Q]; + } + fd(V), G = O, O = V, V = G; + for (var re = 0, ae = 0; ae < f; ae++) { + var J = G[ae] - O[ae]; + re += J * J; + } + if (re < n) + break; + } + var z = { + rank: function(H) { + return H = o.collection(H)[0], O[u.indexOf(H)]; + } + }; + return z; + } + // pageRank +}, Wo = fr({ + root: null, + weight: function(e) { + return 1; + }, + directed: !1, + alpha: 0 +}), Ut = { + degreeCentralityNormalized: function(e) { + e = Wo(e); + var t = this.cy(), a = this.nodes(), n = a.length; + if (e.directed) { + for (var v = {}, f = {}, c = 0, h = 0, d = 0; d < n; d++) { + var y = a[d], g = y.id(); + e.root = y; + var p = this.degreeCentrality(e); + c < p.indegree && (c = p.indegree), h < p.outdegree && (h = p.outdegree), v[g] = p.indegree, f[g] = p.outdegree; + } + return { + indegree: function(b) { + return c == 0 ? 0 : (fe(b) && (b = t.filter(b)), v[b.id()] / c); + }, + outdegree: function(b) { + return h === 0 ? 0 : (fe(b) && (b = t.filter(b)), f[b.id()] / h); + } + }; + } else { + for (var i = {}, s = 0, o = 0; o < n; o++) { + var l = a[o]; + e.root = l; + var u = this.degreeCentrality(e); + s < u.degree && (s = u.degree), i[l.id()] = u.degree; + } + return { + degree: function(b) { + return s === 0 ? 0 : (fe(b) && (b = t.filter(b)), i[b.id()] / s); + } + }; + } + }, + // degreeCentralityNormalized + // Implemented from the algorithm in Opsahl's paper + // "Node centrality in weighted networks: Generalizing degree and shortest paths" + // check the heading 2 "Degree" + degreeCentrality: function(e) { + e = Wo(e); + var t = this.cy(), a = this, n = e, i = n.root, s = n.weight, o = n.directed, l = n.alpha; + if (i = t.collection(i)[0], o) { + for (var h = i.connectedEdges(), d = h.filter(function(C) { + return C.target().same(i) && a.has(C); + }), y = h.filter(function(C) { + return C.source().same(i) && a.has(C); + }), g = d.length, p = y.length, m = 0, b = 0, w = 0; w < d.length; w++) + m += s(d[w]); + for (var E = 0; E < y.length; E++) + b += s(y[E]); + return { + indegree: Math.pow(g, 1 - l) * Math.pow(m, l), + outdegree: Math.pow(p, 1 - l) * Math.pow(b, l) + }; + } else { + for (var u = i.connectedEdges().intersection(a), v = u.length, f = 0, c = 0; c < u.length; c++) + f += s(u[c]); + return { + degree: Math.pow(v, 1 - l) * Math.pow(f, l) + }; + } + } + // degreeCentrality +}; +Ut.dc = Ut.degreeCentrality; +Ut.dcn = Ut.degreeCentralityNormalised = Ut.degreeCentralityNormalized; +var Uo = fr({ + harmonic: !0, + weight: function() { + return 1; + }, + directed: !1, + root: null +}), $t = { + closenessCentralityNormalized: function(e) { + for (var t = Uo(e), a = t.harmonic, n = t.weight, i = t.directed, s = this.cy(), o = {}, l = 0, u = this.nodes(), v = this.floydWarshall({ + weight: n, + directed: i + }), f = 0; f < u.length; f++) { + for (var c = 0, h = u[f], d = 0; d < u.length; d++) + if (f !== d) { + var y = v.distance(h, u[d]); + a ? c += 1 / y : c += y; + } + a || (c = 1 / c), l < c && (l = c), o[h.id()] = c; + } + return { + closeness: function(p) { + return l == 0 ? 0 : (fe(p) ? p = s.filter(p)[0].id() : p = p.id(), o[p] / l); + } + }; + }, + // Implemented from pseudocode from wikipedia + closenessCentrality: function(e) { + var t = Uo(e), a = t.root, n = t.weight, i = t.directed, s = t.harmonic; + a = this.filter(a)[0]; + for (var o = this.dijkstra({ + root: a, + weight: n, + directed: i + }), l = 0, u = this.nodes(), v = 0; v < u.length; v++) { + var f = u[v]; + if (!f.same(a)) { + var c = o.distanceTo(f); + s ? l += 1 / c : l += c; + } + } + return s ? l : 1 / l; + } + // closenessCentrality +}; +$t.cc = $t.closenessCentrality; +$t.ccn = $t.closenessCentralityNormalised = $t.closenessCentralityNormalized; +var Md = fr({ + weight: null, + directed: !1 +}), Bs = { + // Implemented from the algorithm in the paper "On Variants of Shortest-Path Betweenness Centrality and their Generic Computation" by Ulrik Brandes + betweennessCentrality: function(e) { + for (var t = Md(e), a = t.directed, n = t.weight, i = n != null, s = this.cy(), o = this.nodes(), l = {}, u = {}, v = 0, f = { + set: function(b, w) { + u[b] = w, w > v && (v = w); + }, + get: function(b) { + return u[b]; + } + }, c = 0; c < o.length; c++) { + var h = o[c], d = h.id(); + a ? l[d] = h.outgoers().nodes() : l[d] = h.openNeighborhood().nodes(), f.set(d, 0); + } + for (var y = function() { + for (var b = o[g].id(), w = [], E = {}, C = {}, x = {}, k = new Na(function(X, Q) { + return x[X] - x[Q]; + }), S = 0; S < o.length; S++) { + var P = o[S].id(); + E[P] = [], C[P] = 0, x[P] = 1 / 0; + } + for (C[b] = 1, x[b] = 0, k.push(b); !k.empty(); ) { + var D = k.pop(); + if (w.push(D), i) + for (var A = 0; A < l[D].length; A++) { + var B = l[D][A], R = s.getElementById(D), M = void 0; + R.edgesTo(B).length > 0 ? M = R.edgesTo(B)[0] : M = B.edgesTo(R)[0]; + var I = n(M); + B = B.id(), x[B] > x[D] + I && (x[B] = x[D] + I, k.nodes.indexOf(B) < 0 ? k.push(B) : k.updateItem(B), C[B] = 0, E[B] = []), x[B] == x[D] + I && (C[B] = C[B] + C[D], E[B].push(D)); + } + else + for (var L = 0; L < l[D].length; L++) { + var O = l[D][L].id(); + x[O] == 1 / 0 && (k.push(O), x[O] = x[D] + 1), x[O] == x[D] + 1 && (C[O] = C[O] + C[D], E[O].push(D)); + } + } + for (var V = {}, G = 0; G < o.length; G++) + V[o[G].id()] = 0; + for (; w.length > 0; ) { + for (var N = w.pop(), F = 0; F < E[N].length; F++) { + var K = E[N][F]; + V[K] = V[K] + C[K] / C[N] * (1 + V[N]); + } + N != o[g].id() && f.set(N, f.get(N) + V[N]); + } + }, g = 0; g < o.length; g++) + y(); + var p = { + betweenness: function(b) { + var w = s.collection(b).id(); + return f.get(w); + }, + betweennessNormalized: function(b) { + if (v == 0) + return 0; + var w = s.collection(b).id(); + return f.get(w) / v; + } + }; + return p.betweennessNormalised = p.betweennessNormalized, p; + } + // betweennessCentrality +}; +Bs.bc = Bs.betweennessCentrality; +var Ld = fr({ + expandFactor: 2, + // affects time of computation and cluster granularity to some extent: M * M + inflateFactor: 2, + // affects cluster granularity (the greater the value, the more clusters): M(i,j) / E(j) + multFactor: 1, + // optional self loops for each node. Use a neutral value to improve cluster computations. + maxIterations: 20, + // maximum number of iterations of the MCL algorithm in a single run + attributes: [ + // attributes/features used to group nodes, ie. similarity values between nodes + function(r) { + return 1; + } + ] +}), Id = function(e) { + return Ld(e); +}, Od = function(e, t) { + for (var a = 0, n = 0; n < t.length; n++) + a += t[n](e); + return a; +}, Nd = function(e, t, a) { + for (var n = 0; n < t; n++) + e[n * t + n] = a; +}, pv = function(e, t) { + for (var a, n = 0; n < t; n++) { + a = 0; + for (var i = 0; i < t; i++) + a += e[i * t + n]; + for (var s = 0; s < t; s++) + e[s * t + n] = e[s * t + n] / a; + } +}, zd = function(e, t, a) { + for (var n = new Array(a * a), i = 0; i < a; i++) { + for (var s = 0; s < a; s++) + n[i * a + s] = 0; + for (var o = 0; o < a; o++) + for (var l = 0; l < a; l++) + n[i * a + l] += e[i * a + o] * t[o * a + l]; + } + return n; +}, Fd = function(e, t, a) { + for (var n = e.slice(0), i = 1; i < a; i++) + e = zd(e, n, t); + return e; +}, Vd = function(e, t, a) { + for (var n = new Array(t * t), i = 0; i < t * t; i++) + n[i] = Math.pow(e[i], a); + return pv(n, t), n; +}, qd = function(e, t, a, n) { + for (var i = 0; i < a; i++) { + var s = Math.round(e[i] * Math.pow(10, n)) / Math.pow(10, n), o = Math.round(t[i] * Math.pow(10, n)) / Math.pow(10, n); + if (s !== o) + return !1; + } + return !0; +}, _d = function(e, t, a, n) { + for (var i = [], s = 0; s < t; s++) { + for (var o = [], l = 0; l < t; l++) + Math.round(e[s * t + l] * 1e3) / 1e3 > 0 && o.push(a[l]); + o.length !== 0 && i.push(n.collection(o)); + } + return i; +}, Gd = function(e, t) { + for (var a = 0; a < e.length; a++) + if (!t[a] || e[a].id() !== t[a].id()) + return !1; + return !0; +}, Hd = function(e) { + for (var t = 0; t < e.length; t++) + for (var a = 0; a < e.length; a++) + t != a && Gd(e[t], e[a]) && e.splice(a, 1); + return e; +}, $o = function(e) { + for (var t = this.nodes(), a = this.edges(), n = this.cy(), i = Id(e), s = {}, o = 0; o < t.length; o++) + s[t[o].id()] = o; + for (var l = t.length, u = l * l, v = new Array(u), f, c = 0; c < u; c++) + v[c] = 0; + for (var h = 0; h < a.length; h++) { + var d = a[h], y = s[d.source().id()], g = s[d.target().id()], p = Od(d, i.attributes); + v[y * l + g] += p, v[g * l + y] += p; + } + Nd(v, l, i.multFactor), pv(v, l); + for (var m = !0, b = 0; m && b < i.maxIterations; ) + m = !1, f = Fd(v, l, i.expandFactor), v = Vd(f, l, i.inflateFactor), qd(v, f, u, 4) || (m = !0), b++; + var w = _d(v, l, t, n); + return w = Hd(w), w; +}, Wd = { + markovClustering: $o, + mcl: $o +}, Ud = function(e) { + return e; +}, yv = function(e, t) { + return Math.abs(t - e); +}, Ko = function(e, t, a) { + return e + yv(t, a); +}, Yo = function(e, t, a) { + return e + Math.pow(a - t, 2); +}, $d = function(e) { + return Math.sqrt(e); +}, Kd = function(e, t, a) { + return Math.max(e, yv(t, a)); +}, oa = function(e, t, a, n, i) { + for (var s = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : Ud, o = n, l, u, v = 0; v < e; v++) + l = t(v), u = a(v), o = i(o, l, u); + return s(o); +}, Zt = { + euclidean: function(e, t, a) { + return e >= 2 ? oa(e, t, a, 0, Yo, $d) : oa(e, t, a, 0, Ko); + }, + squaredEuclidean: function(e, t, a) { + return oa(e, t, a, 0, Yo); + }, + manhattan: function(e, t, a) { + return oa(e, t, a, 0, Ko); + }, + max: function(e, t, a) { + return oa(e, t, a, -1 / 0, Kd); + } +}; +Zt["squared-euclidean"] = Zt.squaredEuclidean; +Zt.squaredeuclidean = Zt.squaredEuclidean; +function In(r, e, t, a, n, i) { + var s; + return We(r) ? s = r : s = Zt[r] || Zt.euclidean, e === 0 && We(r) ? s(n, i) : s(e, t, a, n, i); +} +var Yd = fr({ + k: 2, + m: 2, + sensitivityThreshold: 1e-4, + distance: "euclidean", + maxIterations: 10, + attributes: [], + testMode: !1, + testCentroids: null +}), to = function(e) { + return Yd(e); +}, En = function(e, t, a, n, i) { + var s = i !== "kMedoids", o = s ? function(f) { + return a[f]; + } : function(f) { + return n[f](a); + }, l = function(c) { + return n[c](t); + }, u = a, v = t; + return In(e, n.length, o, l, u, v); +}, hi = function(e, t, a) { + for (var n = a.length, i = new Array(n), s = new Array(n), o = new Array(t), l = null, u = 0; u < n; u++) + i[u] = e.min(a[u]).value, s[u] = e.max(a[u]).value; + for (var v = 0; v < t; v++) { + l = []; + for (var f = 0; f < n; f++) + l[f] = Math.random() * (s[f] - i[f]) + i[f]; + o[v] = l; + } + return o; +}, mv = function(e, t, a, n, i) { + for (var s = 1 / 0, o = 0, l = 0; l < t.length; l++) { + var u = En(a, e, t[l], n, i); + u < s && (s = u, o = l); + } + return o; +}, bv = function(e, t, a) { + for (var n = [], i = null, s = 0; s < t.length; s++) + i = t[s], a[i.id()] === e && n.push(i); + return n; +}, Xd = function(e, t, a) { + return Math.abs(t - e) <= a; +}, Zd = function(e, t, a) { + for (var n = 0; n < e.length; n++) + for (var i = 0; i < e[n].length; i++) { + var s = Math.abs(e[n][i] - t[n][i]); + if (s > a) + return !1; + } + return !0; +}, Qd = function(e, t, a) { + for (var n = 0; n < a; n++) + if (e === t[n]) return !0; + return !1; +}, Xo = function(e, t) { + var a = new Array(t); + if (e.length < 50) + for (var n = 0; n < t; n++) { + for (var i = e[Math.floor(Math.random() * e.length)]; Qd(i, a, n); ) + i = e[Math.floor(Math.random() * e.length)]; + a[n] = i; + } + else + for (var s = 0; s < t; s++) + a[s] = e[Math.floor(Math.random() * e.length)]; + return a; +}, Zo = function(e, t, a) { + for (var n = 0, i = 0; i < t.length; i++) + n += En("manhattan", t[i], e, a, "kMedoids"); + return n; +}, Jd = function(e) { + var t = this.cy(), a = this.nodes(), n = null, i = to(e), s = new Array(i.k), o = {}, l; + i.testMode ? typeof i.testCentroids == "number" ? (i.testCentroids, l = hi(a, i.k, i.attributes)) : rr(i.testCentroids) === "object" ? l = i.testCentroids : l = hi(a, i.k, i.attributes) : l = hi(a, i.k, i.attributes); + for (var u = !0, v = 0; u && v < i.maxIterations; ) { + for (var f = 0; f < a.length; f++) + n = a[f], o[n.id()] = mv(n, l, i.distance, i.attributes, "kMeans"); + u = !1; + for (var c = 0; c < i.k; c++) { + var h = bv(c, a, o); + if (h.length !== 0) { + for (var d = i.attributes.length, y = l[c], g = new Array(d), p = new Array(d), m = 0; m < d; m++) { + p[m] = 0; + for (var b = 0; b < h.length; b++) + n = h[b], p[m] += i.attributes[m](n); + g[m] = p[m] / h.length, Xd(g[m], y[m], i.sensitivityThreshold) || (u = !0); + } + l[c] = g, s[c] = t.collection(h); + } + } + v++; + } + return s; +}, jd = function(e) { + var t = this.cy(), a = this.nodes(), n = null, i = to(e), s = new Array(i.k), o, l = {}, u, v = new Array(i.k); + i.testMode ? typeof i.testCentroids == "number" || (rr(i.testCentroids) === "object" ? o = i.testCentroids : o = Xo(a, i.k)) : o = Xo(a, i.k); + for (var f = !0, c = 0; f && c < i.maxIterations; ) { + for (var h = 0; h < a.length; h++) + n = a[h], l[n.id()] = mv(n, o, i.distance, i.attributes, "kMedoids"); + f = !1; + for (var d = 0; d < o.length; d++) { + var y = bv(d, a, l); + if (y.length !== 0) { + v[d] = Zo(o[d], y, i.attributes); + for (var g = 0; g < y.length; g++) + u = Zo(y[g], y, i.attributes), u < v[d] && (v[d] = u, o[d] = y[g], f = !0); + s[d] = t.collection(y); + } + } + c++; + } + return s; +}, eh = function(e, t, a, n, i) { + for (var s, o, l = 0; l < t.length; l++) + for (var u = 0; u < e.length; u++) + n[l][u] = Math.pow(a[l][u], i.m); + for (var v = 0; v < e.length; v++) + for (var f = 0; f < i.attributes.length; f++) { + s = 0, o = 0; + for (var c = 0; c < t.length; c++) + s += n[c][v] * i.attributes[f](t[c]), o += n[c][v]; + e[v][f] = s / o; + } +}, rh = function(e, t, a, n, i) { + for (var s = 0; s < e.length; s++) + t[s] = e[s].slice(); + for (var o, l, u, v = 2 / (i.m - 1), f = 0; f < a.length; f++) + for (var c = 0; c < n.length; c++) { + o = 0; + for (var h = 0; h < a.length; h++) + l = En(i.distance, n[c], a[f], i.attributes, "cmeans"), u = En(i.distance, n[c], a[h], i.attributes, "cmeans"), o += Math.pow(l / u, v); + e[c][f] = 1 / o; + } +}, th = function(e, t, a, n) { + for (var i = new Array(a.k), s = 0; s < i.length; s++) + i[s] = []; + for (var o, l, u = 0; u < t.length; u++) { + o = -1 / 0, l = -1; + for (var v = 0; v < t[0].length; v++) + t[u][v] > o && (o = t[u][v], l = v); + i[l].push(e[u]); + } + for (var f = 0; f < i.length; f++) + i[f] = n.collection(i[f]); + return i; +}, Qo = function(e) { + var t = this.cy(), a = this.nodes(), n = to(e), i, s, o, l, u; + l = new Array(a.length); + for (var v = 0; v < a.length; v++) + l[v] = new Array(n.k); + o = new Array(a.length); + for (var f = 0; f < a.length; f++) + o[f] = new Array(n.k); + for (var c = 0; c < a.length; c++) { + for (var h = 0, d = 0; d < n.k; d++) + o[c][d] = Math.random(), h += o[c][d]; + for (var y = 0; y < n.k; y++) + o[c][y] = o[c][y] / h; + } + s = new Array(n.k); + for (var g = 0; g < n.k; g++) + s[g] = new Array(n.attributes.length); + u = new Array(a.length); + for (var p = 0; p < a.length; p++) + u[p] = new Array(n.k); + for (var m = !0, b = 0; m && b < n.maxIterations; ) + m = !1, eh(s, a, o, u, n), rh(o, l, s, a, n), Zd(o, l, n.sensitivityThreshold) || (m = !0), b++; + return i = th(a, o, n, t), { + clusters: i, + degreeOfMembership: o + }; +}, ah = { + kMeans: Jd, + kMedoids: jd, + fuzzyCMeans: Qo, + fcm: Qo +}, nh = fr({ + distance: "euclidean", + // distance metric to compare nodes + linkage: "min", + // linkage criterion : how to determine the distance between clusters of nodes + mode: "threshold", + // mode:'threshold' => clusters must be threshold distance apart + threshold: 1 / 0, + // the distance threshold + // mode:'dendrogram' => the nodes are organised as leaves in a tree (siblings are close), merging makes clusters + addDendrogram: !1, + // whether to add the dendrogram to the graph for viz + dendrogramDepth: 0, + // depth at which dendrogram branches are merged into the returned clusters + attributes: [] + // array of attr functions +}), ih = { + single: "min", + complete: "max" +}, sh = function(e) { + var t = nh(e), a = ih[t.linkage]; + return a != null && (t.linkage = a), t; +}, Jo = function(e, t, a, n, i) { + for (var s = 0, o = 1 / 0, l, u = i.attributes, v = function(S, P) { + return In(i.distance, u.length, function(D) { + return u[D](S); + }, function(D) { + return u[D](P); + }, S, P); + }, f = 0; f < e.length; f++) { + var c = e[f].key, h = a[c][n[c]]; + h < o && (s = c, o = h); + } + if (i.mode === "threshold" && o >= i.threshold || i.mode === "dendrogram" && e.length === 1) + return !1; + var d = t[s], y = t[n[s]], g; + i.mode === "dendrogram" ? g = { + left: d, + right: y, + key: d.key + } : g = { + value: d.value.concat(y.value), + key: d.key + }, e[d.index] = g, e.splice(y.index, 1), t[d.key] = g; + for (var p = 0; p < e.length; p++) { + var m = e[p]; + d.key === m.key ? l = 1 / 0 : i.linkage === "min" ? (l = a[d.key][m.key], a[d.key][m.key] > a[y.key][m.key] && (l = a[y.key][m.key])) : i.linkage === "max" ? (l = a[d.key][m.key], a[d.key][m.key] < a[y.key][m.key] && (l = a[y.key][m.key])) : i.linkage === "mean" ? l = (a[d.key][m.key] * d.size + a[y.key][m.key] * y.size) / (d.size + y.size) : i.mode === "dendrogram" ? l = v(m.value, d.value) : l = v(m.value[0], d.value[0]), a[d.key][m.key] = a[m.key][d.key] = l; + } + for (var b = 0; b < e.length; b++) { + var w = e[b].key; + if (n[w] === d.key || n[w] === y.key) { + for (var E = w, C = 0; C < e.length; C++) { + var x = e[C].key; + a[w][x] < a[w][E] && (E = x); + } + n[w] = E; + } + e[b].index = b; + } + return d.key = y.key = d.index = y.index = null, !0; +}, Gt = function(e, t, a) { + e && (e.value ? t.push(e.value) : (e.left && Gt(e.left, t), e.right && Gt(e.right, t))); +}, Ps = function(e, t) { + if (!e) return ""; + if (e.left && e.right) { + var a = Ps(e.left, t), n = Ps(e.right, t), i = t.add({ + group: "nodes", + data: { + id: a + "," + n + } + }); + return t.add({ + group: "edges", + data: { + source: a, + target: i.id() + } + }), t.add({ + group: "edges", + data: { + source: n, + target: i.id() + } + }), i.id(); + } else if (e.value) + return e.value.id(); +}, As = function(e, t, a) { + if (!e) return []; + var n = [], i = [], s = []; + return t === 0 ? (e.left && Gt(e.left, n), e.right && Gt(e.right, i), s = n.concat(i), [a.collection(s)]) : t === 1 ? e.value ? [a.collection(e.value)] : (e.left && Gt(e.left, n), e.right && Gt(e.right, i), [a.collection(n), a.collection(i)]) : e.value ? [a.collection(e.value)] : (e.left && (n = As(e.left, t - 1, a)), e.right && (i = As(e.right, t - 1, a)), n.concat(i)); +}, jo = function(e) { + for (var t = this.cy(), a = this.nodes(), n = sh(e), i = n.attributes, s = function(b, w) { + return In(n.distance, i.length, function(E) { + return i[E](b); + }, function(E) { + return i[E](w); + }, b, w); + }, o = [], l = [], u = [], v = [], f = 0; f < a.length; f++) { + var c = { + value: n.mode === "dendrogram" ? a[f] : [a[f]], + key: f, + index: f + }; + o[f] = c, v[f] = c, l[f] = [], u[f] = 0; + } + for (var h = 0; h < o.length; h++) + for (var d = 0; d <= h; d++) { + var y = void 0; + n.mode === "dendrogram" ? y = h === d ? 1 / 0 : s(o[h].value, o[d].value) : y = h === d ? 1 / 0 : s(o[h].value[0], o[d].value[0]), l[h][d] = y, l[d][h] = y, y < l[h][u[h]] && (u[h] = d); + } + for (var g = Jo(o, v, l, u, n); g; ) + g = Jo(o, v, l, u, n); + var p; + return n.mode === "dendrogram" ? (p = As(o[0], n.dendrogramDepth, t), n.addDendrogram && Ps(o[0], t)) : (p = new Array(o.length), o.forEach(function(m, b) { + m.key = m.index = null, p[b] = t.collection(m.value); + })), p; +}, oh = { + hierarchicalClustering: jo, + hca: jo +}, uh = fr({ + distance: "euclidean", + // distance metric to compare attributes between two nodes + preference: "median", + // suitability of a data point to serve as an exemplar + damping: 0.8, + // damping factor between [0.5, 1) + maxIterations: 1e3, + // max number of iterations to run + minIterations: 100, + // min number of iterations to run in order for clustering to stop + attributes: [ + // functions to quantify the similarity between any two points + // e.g. node => node.data('weight') + ] +}), lh = function(e) { + var t = e.damping, a = e.preference; + 0.5 <= t && t < 1 || He("Damping must range on [0.5, 1). Got: ".concat(t)); + var n = ["median", "mean", "min", "max"]; + return n.some(function(i) { + return i === a; + }) || te(a) || He("Preference must be one of [".concat(n.map(function(i) { + return "'".concat(i, "'"); + }).join(", "), "] or a number. Got: ").concat(a)), uh(e); +}, vh = function(e, t, a, n) { + var i = function(o, l) { + return n[l](o); + }; + return -In(e, n.length, function(s) { + return i(t, s); + }, function(s) { + return i(a, s); + }, t, a); +}, fh = function(e, t) { + var a = null; + return t === "median" ? a = ld(e) : t === "mean" ? a = ud(e) : t === "min" ? a = sd(e) : t === "max" ? a = od(e) : a = t, a; +}, ch = function(e, t, a) { + for (var n = [], i = 0; i < e; i++) + t[i * e + i] + a[i * e + i] > 0 && n.push(i); + return n; +}, eu = function(e, t, a) { + for (var n = [], i = 0; i < e; i++) { + for (var s = -1, o = -1 / 0, l = 0; l < a.length; l++) { + var u = a[l]; + t[i * e + u] > o && (s = u, o = t[i * e + u]); + } + s > 0 && n.push(s); + } + for (var v = 0; v < a.length; v++) + n[a[v]] = a[v]; + return n; +}, dh = function(e, t, a) { + for (var n = eu(e, t, a), i = 0; i < a.length; i++) { + for (var s = [], o = 0; o < n.length; o++) + n[o] === a[i] && s.push(o); + for (var l = -1, u = -1 / 0, v = 0; v < s.length; v++) { + for (var f = 0, c = 0; c < s.length; c++) + f += t[s[c] * e + s[v]]; + f > u && (l = v, u = f); + } + a[i] = s[l]; + } + return n = eu(e, t, a), n; +}, ru = function(e) { + for (var t = this.cy(), a = this.nodes(), n = lh(e), i = {}, s = 0; s < a.length; s++) + i[a[s].id()] = s; + var o, l, u, v, f, c; + o = a.length, l = o * o, u = new Array(l); + for (var h = 0; h < l; h++) + u[h] = -1 / 0; + for (var d = 0; d < o; d++) + for (var y = 0; y < o; y++) + d !== y && (u[d * o + y] = vh(n.distance, a[d], a[y], n.attributes)); + v = fh(u, n.preference); + for (var g = 0; g < o; g++) + u[g * o + g] = v; + f = new Array(l); + for (var p = 0; p < l; p++) + f[p] = 0; + c = new Array(l); + for (var m = 0; m < l; m++) + c[m] = 0; + for (var b = new Array(o), w = new Array(o), E = new Array(o), C = 0; C < o; C++) + b[C] = 0, w[C] = 0, E[C] = 0; + for (var x = new Array(o * n.minIterations), k = 0; k < x.length; k++) + x[k] = 0; + var S; + for (S = 0; S < n.maxIterations; S++) { + for (var P = 0; P < o; P++) { + for (var D = -1 / 0, A = -1 / 0, B = -1, R = 0, M = 0; M < o; M++) + b[M] = f[P * o + M], R = c[P * o + M] + u[P * o + M], R >= D ? (A = D, D = R, B = M) : R > A && (A = R); + for (var I = 0; I < o; I++) + f[P * o + I] = (1 - n.damping) * (u[P * o + I] - D) + n.damping * b[I]; + f[P * o + B] = (1 - n.damping) * (u[P * o + B] - A) + n.damping * b[B]; + } + for (var L = 0; L < o; L++) { + for (var O = 0, V = 0; V < o; V++) + b[V] = c[V * o + L], w[V] = Math.max(0, f[V * o + L]), O += w[V]; + O -= w[L], w[L] = f[L * o + L], O += w[L]; + for (var G = 0; G < o; G++) + c[G * o + L] = (1 - n.damping) * Math.min(0, O - w[G]) + n.damping * b[G]; + c[L * o + L] = (1 - n.damping) * (O - w[L]) + n.damping * b[L]; + } + for (var N = 0, F = 0; F < o; F++) { + var K = c[F * o + F] + f[F * o + F] > 0 ? 1 : 0; + x[S % n.minIterations * o + F] = K, N += K; + } + if (N > 0 && (S >= n.minIterations - 1 || S == n.maxIterations - 1)) { + for (var X = 0, Q = 0; Q < o; Q++) { + E[Q] = 0; + for (var Z = 0; Z < n.minIterations; Z++) + E[Q] += x[Z * o + Q]; + (E[Q] === 0 || E[Q] === n.minIterations) && X++; + } + if (X === o) + break; + } + } + for (var re = ch(o, f, c), ae = dh(o, u, re), J = {}, z = 0; z < re.length; z++) + J[re[z]] = []; + for (var q = 0; q < a.length; q++) { + var H = i[a[q].id()], ee = ae[H]; + ee != null && J[ee].push(a[q]); + } + for (var ne = new Array(re.length), be = 0; be < re.length; be++) + ne[be] = t.collection(J[re[be]]); + return ne; +}, hh = { + affinityPropagation: ru, + ap: ru +}, gh = fr({ + root: void 0, + directed: !1 +}), ph = { + hierholzer: function(e) { + if (!Pe(e)) { + var t = arguments; + e = { + root: t[0], + directed: t[1] + }; + } + var a = gh(e), n = a.root, i = a.directed, s = this, o = !1, l, u, v; + n && (v = fe(n) ? this.filter(n)[0].id() : n[0].id()); + var f = {}, c = {}; + i ? s.forEach(function(m) { + var b = m.id(); + if (m.isNode()) { + var w = m.indegree(!0), E = m.outdegree(!0), C = w - E, x = E - w; + C == 1 ? l ? o = !0 : l = b : x == 1 ? u ? o = !0 : u = b : (x > 1 || C > 1) && (o = !0), f[b] = [], m.outgoers().forEach(function(k) { + k.isEdge() && f[b].push(k.id()); + }); + } else + c[b] = [void 0, m.target().id()]; + }) : s.forEach(function(m) { + var b = m.id(); + if (m.isNode()) { + var w = m.degree(!0); + w % 2 && (l ? u ? o = !0 : u = b : l = b), f[b] = [], m.connectedEdges().forEach(function(E) { + return f[b].push(E.id()); + }); + } else + c[b] = [m.source().id(), m.target().id()]; + }); + var h = { + found: !1, + trail: void 0 + }; + if (o) return h; + if (u && l) + if (i) { + if (v && u != v) + return h; + v = u; + } else { + if (v && u != v && l != v) + return h; + v || (v = u); + } + else + v || (v = s[0].id()); + var d = function(b) { + for (var w = b, E = [b], C, x, k; f[w].length; ) + C = f[w].shift(), x = c[C][0], k = c[C][1], w != k ? (f[k] = f[k].filter(function(S) { + return S != C; + }), w = k) : !i && w != x && (f[x] = f[x].filter(function(S) { + return S != C; + }), w = x), E.unshift(C), E.unshift(w); + return E; + }, y = [], g = []; + for (g = d(v); g.length != 1; ) + f[g[0]].length == 0 ? (y.unshift(s.getElementById(g.shift())), y.unshift(s.getElementById(g.shift()))) : g = d(g.shift()).concat(g); + y.unshift(s.getElementById(g.shift())); + for (var p in f) + if (f[p].length) + return h; + return h.found = !0, h.trail = this.spawn(y, !0), h; + } +}, Xa = function() { + var e = this, t = {}, a = 0, n = 0, i = [], s = [], o = {}, l = function(c, h) { + for (var d = s.length - 1, y = [], g = e.spawn(); s[d].x != c || s[d].y != h; ) + y.push(s.pop().edge), d--; + y.push(s.pop().edge), y.forEach(function(p) { + var m = p.connectedNodes().intersection(e); + g.merge(p), m.forEach(function(b) { + var w = b.id(), E = b.connectedEdges().intersection(e); + g.merge(b), t[w].cutVertex ? g.merge(E.filter(function(C) { + return C.isLoop(); + })) : g.merge(E); + }); + }), i.push(g); + }, u = function(c, h, d) { + c === d && (n += 1), t[h] = { + id: a, + low: a++, + cutVertex: !1 + }; + var y = e.getElementById(h).connectedEdges().intersection(e); + if (y.size() === 0) + i.push(e.spawn(e.getElementById(h))); + else { + var g, p, m, b; + y.forEach(function(w) { + g = w.source().id(), p = w.target().id(), m = g === h ? p : g, m !== d && (b = w.id(), o[b] || (o[b] = !0, s.push({ + x: h, + y: m, + edge: w + })), m in t ? t[h].low = Math.min(t[h].low, t[m].id) : (u(c, m, h), t[h].low = Math.min(t[h].low, t[m].low), t[h].id <= t[m].low && (t[h].cutVertex = !0, l(h, m)))); + }); + } + }; + e.forEach(function(f) { + if (f.isNode()) { + var c = f.id(); + c in t || (n = 0, u(c, c), t[c].cutVertex = n > 1); + } + }); + var v = Object.keys(t).filter(function(f) { + return t[f].cutVertex; + }).map(function(f) { + return e.getElementById(f); + }); + return { + cut: e.spawn(v), + components: i + }; +}, yh = { + hopcroftTarjanBiconnected: Xa, + htbc: Xa, + htb: Xa, + hopcroftTarjanBiconnectedComponents: Xa +}, Za = function() { + var e = this, t = {}, a = 0, n = [], i = [], s = e.spawn(e), o = function(u) { + i.push(u), t[u] = { + index: a, + low: a++, + explored: !1 + }; + var v = e.getElementById(u).connectedEdges().intersection(e); + if (v.forEach(function(y) { + var g = y.target().id(); + g !== u && (g in t || o(g), t[g].explored || (t[u].low = Math.min(t[u].low, t[g].low))); + }), t[u].index === t[u].low) { + for (var f = e.spawn(); ; ) { + var c = i.pop(); + if (f.merge(e.getElementById(c)), t[c].low = t[u].index, t[c].explored = !0, c === u) + break; + } + var h = f.edgesWith(f), d = f.merge(h); + n.push(d), s = s.difference(d); + } + }; + return e.forEach(function(l) { + if (l.isNode()) { + var u = l.id(); + u in t || o(u); + } + }), { + cut: s, + components: n + }; +}, mh = { + tarjanStronglyConnected: Za, + tsc: Za, + tscc: Za, + tarjanStronglyConnectedComponents: Za +}, wv = {}; +[Ea, Yc, Xc, Qc, jc, rd, nd, Rd, Ut, $t, Bs, Wd, ah, oh, hh, ph, yh, mh].forEach(function(r) { + he(wv, r); +}); +/*! +Embeddable Minimum Strictly-Compliant Promises/A+ 1.1.1 Thenable +Copyright (c) 2013-2014 Ralf S. Engelschall (http://engelschall.com) +Licensed under The MIT License (http://opensource.org/licenses/MIT) +*/ +var xv = 0, Ev = 1, Cv = 2, Ir = function(e) { + if (!(this instanceof Ir)) return new Ir(e); + this.id = "Thenable/1.0.7", this.state = xv, this.fulfillValue = void 0, this.rejectReason = void 0, this.onFulfilled = [], this.onRejected = [], this.proxy = { + then: this.then.bind(this) + }, typeof e == "function" && e.call(this, this.fulfill.bind(this), this.reject.bind(this)); +}; +Ir.prototype = { + /* promise resolving methods */ + fulfill: function(e) { + return tu(this, Ev, "fulfillValue", e); + }, + reject: function(e) { + return tu(this, Cv, "rejectReason", e); + }, + /* "The then Method" [Promises/A+ 1.1, 1.2, 2.2] */ + then: function(e, t) { + var a = this, n = new Ir(); + return a.onFulfilled.push(nu(e, n, "fulfill")), a.onRejected.push(nu(t, n, "reject")), Tv(a), n.proxy; + } +}; +var tu = function(e, t, a, n) { + return e.state === xv && (e.state = t, e[a] = n, Tv(e)), e; +}, Tv = function(e) { + e.state === Ev ? au(e, "onFulfilled", e.fulfillValue) : e.state === Cv && au(e, "onRejected", e.rejectReason); +}, au = function(e, t, a) { + if (e[t].length !== 0) { + var n = e[t]; + e[t] = []; + var i = function() { + for (var o = 0; o < n.length; o++) n[o](a); + }; + typeof setImmediate == "function" ? setImmediate(i) : setTimeout(i, 0); + } +}, nu = function(e, t, a) { + return function(n) { + if (typeof e != "function") + t[a].call(t, n); + else { + var i; + try { + i = e(n); + } catch (s) { + t.reject(s); + return; + } + Sv(t, i); + } + }; +}, Sv = function(e, t) { + if (e === t || e.proxy === t) { + e.reject(new TypeError("cannot resolve promise with itself")); + return; + } + var a; + if (rr(t) === "object" && t !== null || typeof t == "function") + try { + a = t.then; + } catch (i) { + e.reject(i); + return; + } + if (typeof a == "function") { + var n = !1; + try { + a.call( + t, + /* resolvePromise */ + /* [Promises/A+ 2.3.3.3.1] */ + function(i) { + n || (n = !0, i === t ? e.reject(new TypeError("circular thenable chain")) : Sv(e, i)); + }, + /* rejectPromise */ + /* [Promises/A+ 2.3.3.3.2] */ + function(i) { + n || (n = !0, e.reject(i)); + } + ); + } catch (i) { + n || e.reject(i); + } + return; + } + e.fulfill(t); +}; +Ir.all = function(r) { + return new Ir(function(e, t) { + for (var a = new Array(r.length), n = 0, i = function(l, u) { + a[l] = u, n++, n === r.length && e(a); + }, s = 0; s < r.length; s++) + (function(o) { + var l = r[o], u = l != null && l.then != null; + if (u) + l.then(function(f) { + i(o, f); + }, function(f) { + t(f); + }); + else { + var v = l; + i(o, v); + } + })(s); + }); +}; +Ir.resolve = function(r) { + return new Ir(function(e, t) { + e(r); + }); +}; +Ir.reject = function(r) { + return new Ir(function(e, t) { + t(r); + }); +}; +var ea = typeof Promise < "u" ? Promise : Ir, Rs = function(e, t, a) { + var n = $s(e), i = !n, s = this._private = he({ + duration: 1e3 + }, t, a); + if (s.target = e, s.style = s.style || s.css, s.started = !1, s.playing = !1, s.hooked = !1, s.applying = !1, s.progress = 0, s.completes = [], s.frames = [], s.complete && We(s.complete) && s.completes.push(s.complete), i) { + var o = e.position(); + s.startPosition = s.startPosition || { + x: o.x, + y: o.y + }, s.startStyle = s.startStyle || e.cy().style().getAnimationStartStyle(e, s.style); + } + if (n) { + var l = e.pan(); + s.startPan = { + x: l.x, + y: l.y + }, s.startZoom = e.zoom(); + } + this.length = 1, this[0] = this; +}, Dt = Rs.prototype; +he(Dt, { + instanceString: function() { + return "animation"; + }, + hook: function() { + var e = this._private; + if (!e.hooked) { + var t, a = e.target._private.animation; + e.queue ? t = a.queue : t = a.current, t.push(this), Dr(e.target) && e.target.cy().addToAnimationPool(e.target), e.hooked = !0; + } + return this; + }, + play: function() { + var e = this._private; + return e.progress === 1 && (e.progress = 0), e.playing = !0, e.started = !1, e.stopped = !1, this.hook(), this; + }, + playing: function() { + return this._private.playing; + }, + apply: function() { + var e = this._private; + return e.applying = !0, e.started = !1, e.stopped = !1, this.hook(), this; + }, + applying: function() { + return this._private.applying; + }, + pause: function() { + var e = this._private; + return e.playing = !1, e.started = !1, this; + }, + stop: function() { + var e = this._private; + return e.playing = !1, e.started = !1, e.stopped = !0, this; + }, + rewind: function() { + return this.progress(0); + }, + fastforward: function() { + return this.progress(1); + }, + time: function(e) { + var t = this._private; + return e === void 0 ? t.progress * t.duration : this.progress(e / t.duration); + }, + progress: function(e) { + var t = this._private, a = t.playing; + return e === void 0 ? t.progress : (a && this.pause(), t.progress = e, t.started = !1, a && this.play(), this); + }, + completed: function() { + return this._private.progress === 1; + }, + reverse: function() { + var e = this._private, t = e.playing; + t && this.pause(), e.progress = 1 - e.progress, e.started = !1; + var a = function(u, v) { + var f = e[u]; + f != null && (e[u] = e[v], e[v] = f); + }; + if (a("zoom", "startZoom"), a("pan", "startPan"), a("position", "startPosition"), e.style) + for (var n = 0; n < e.style.length; n++) { + var i = e.style[n], s = i.name, o = e.startStyle[s]; + e.startStyle[s] = i, e.style[n] = o; + } + return t && this.play(), this; + }, + promise: function(e) { + var t = this._private, a; + switch (e) { + case "frame": + a = t.frames; + break; + default: + case "complete": + case "completed": + a = t.completes; + } + return new ea(function(n, i) { + a.push(function() { + n(); + }); + }); + } +}); +Dt.complete = Dt.completed; +Dt.run = Dt.play; +Dt.running = Dt.playing; +var bh = { + animated: function() { + return function() { + var t = this, a = t.length !== void 0, n = a ? t : [t], i = this._private.cy || this; + if (!i.styleEnabled()) + return !1; + var s = n[0]; + if (s) + return s._private.animation.current.length > 0; + }; + }, + // animated + clearQueue: function() { + return function() { + var t = this, a = t.length !== void 0, n = a ? t : [t], i = this._private.cy || this; + if (!i.styleEnabled()) + return this; + for (var s = 0; s < n.length; s++) { + var o = n[s]; + o._private.animation.queue = []; + } + return this; + }; + }, + // clearQueue + delay: function() { + return function(t, a) { + var n = this._private.cy || this; + return n.styleEnabled() ? this.animate({ + delay: t, + duration: t, + complete: a + }) : this; + }; + }, + // delay + delayAnimation: function() { + return function(t, a) { + var n = this._private.cy || this; + return n.styleEnabled() ? this.animation({ + delay: t, + duration: t, + complete: a + }) : this; + }; + }, + // delay + animation: function() { + return function(t, a) { + var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this, l = !i, u = !l; + if (!o.styleEnabled()) + return this; + var v = o.style(); + t = he({}, t, a); + var f = Object.keys(t).length === 0; + if (f) + return new Rs(s[0], t); + switch (t.duration === void 0 && (t.duration = 400), t.duration) { + case "slow": + t.duration = 600; + break; + case "fast": + t.duration = 200; + break; + } + if (u && (t.style = v.getPropsList(t.style || t.css), t.css = void 0), u && t.renderedPosition != null) { + var c = t.renderedPosition, h = o.pan(), d = o.zoom(); + t.position = fv(c, d, h); + } + if (l && t.panBy != null) { + var y = t.panBy, g = o.pan(); + t.pan = { + x: g.x + y.x, + y: g.y + y.y + }; + } + var p = t.center || t.centre; + if (l && p != null) { + var m = o.getCenterPan(p.eles, t.zoom); + m != null && (t.pan = m); + } + if (l && t.fit != null) { + var b = t.fit, w = o.getFitViewport(b.eles || b.boundingBox, b.padding); + w != null && (t.pan = w.pan, t.zoom = w.zoom); + } + if (l && Pe(t.zoom)) { + var E = o.getZoomedViewport(t.zoom); + E != null ? (E.zoomed && (t.zoom = E.zoom), E.panned && (t.pan = E.pan)) : t.zoom = null; + } + return new Rs(s[0], t); + }; + }, + // animate + animate: function() { + return function(t, a) { + var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this; + if (!o.styleEnabled()) + return this; + a && (t = he({}, t, a)); + for (var l = 0; l < s.length; l++) { + var u = s[l], v = u.animated() && (t.queue === void 0 || t.queue), f = u.animation(t, v ? { + queue: !0 + } : void 0); + f.play(); + } + return this; + }; + }, + // animate + stop: function() { + return function(t, a) { + var n = this, i = n.length !== void 0, s = i ? n : [n], o = this._private.cy || this; + if (!o.styleEnabled()) + return this; + for (var l = 0; l < s.length; l++) { + for (var u = s[l], v = u._private, f = v.animation.current, c = 0; c < f.length; c++) { + var h = f[c], d = h._private; + a && (d.duration = 0); + } + t && (v.animation.queue = []), a || (v.animation.current = []); + } + return o.notify("draw"), this; + }; + } + // stop +}, gi, iu; +function On() { + if (iu) return gi; + iu = 1; + var r = Array.isArray; + return gi = r, gi; +} +var pi, su; +function wh() { + if (su) return pi; + su = 1; + var r = On(), e = Ia(), t = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, a = /^\w*$/; + function n(i, s) { + if (r(i)) + return !1; + var o = typeof i; + return o == "number" || o == "symbol" || o == "boolean" || i == null || e(i) ? !0 : a.test(i) || !t.test(i) || s != null && i in Object(s); + } + return pi = n, pi; +} +var yi, ou; +function xh() { + if (ou) return yi; + ou = 1; + var r = tv(), e = La(), t = "[object AsyncFunction]", a = "[object Function]", n = "[object GeneratorFunction]", i = "[object Proxy]"; + function s(o) { + if (!e(o)) + return !1; + var l = r(o); + return l == a || l == n || l == t || l == i; + } + return yi = s, yi; +} +var mi, uu; +function Eh() { + if (uu) return mi; + uu = 1; + var r = Rn(), e = r["__core-js_shared__"]; + return mi = e, mi; +} +var bi, lu; +function Ch() { + if (lu) return bi; + lu = 1; + var r = Eh(), e = function() { + var a = /[^.]+$/.exec(r && r.keys && r.keys.IE_PROTO || ""); + return a ? "Symbol(src)_1." + a : ""; + }(); + function t(a) { + return !!e && e in a; + } + return bi = t, bi; +} +var wi, vu; +function Th() { + if (vu) return wi; + vu = 1; + var r = Function.prototype, e = r.toString; + function t(a) { + if (a != null) { + try { + return e.call(a); + } catch { + } + try { + return a + ""; + } catch { + } + } + return ""; + } + return wi = t, wi; +} +var xi, fu; +function Sh() { + if (fu) return xi; + fu = 1; + var r = xh(), e = Ch(), t = La(), a = Th(), n = /[\\^$.*+?()[\]{}|]/g, i = /^\[object .+?Constructor\]$/, s = Function.prototype, o = Object.prototype, l = s.toString, u = o.hasOwnProperty, v = RegExp( + "^" + l.call(u).replace(n, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$" + ); + function f(c) { + if (!t(c) || e(c)) + return !1; + var h = r(c) ? v : i; + return h.test(a(c)); + } + return xi = f, xi; +} +var Ei, cu; +function Dh() { + if (cu) return Ei; + cu = 1; + function r(e, t) { + return e == null ? void 0 : e[t]; + } + return Ei = r, Ei; +} +var Ci, du; +function ao() { + if (du) return Ci; + du = 1; + var r = Sh(), e = Dh(); + function t(a, n) { + var i = e(a, n); + return r(i) ? i : void 0; + } + return Ci = t, Ci; +} +var Ti, hu; +function Nn() { + if (hu) return Ti; + hu = 1; + var r = ao(), e = r(Object, "create"); + return Ti = e, Ti; +} +var Si, gu; +function kh() { + if (gu) return Si; + gu = 1; + var r = Nn(); + function e() { + this.__data__ = r ? r(null) : {}, this.size = 0; + } + return Si = e, Si; +} +var Di, pu; +function Bh() { + if (pu) return Di; + pu = 1; + function r(e) { + var t = this.has(e) && delete this.__data__[e]; + return this.size -= t ? 1 : 0, t; + } + return Di = r, Di; +} +var ki, yu; +function Ph() { + if (yu) return ki; + yu = 1; + var r = Nn(), e = "__lodash_hash_undefined__", t = Object.prototype, a = t.hasOwnProperty; + function n(i) { + var s = this.__data__; + if (r) { + var o = s[i]; + return o === e ? void 0 : o; + } + return a.call(s, i) ? s[i] : void 0; + } + return ki = n, ki; +} +var Bi, mu; +function Ah() { + if (mu) return Bi; + mu = 1; + var r = Nn(), e = Object.prototype, t = e.hasOwnProperty; + function a(n) { + var i = this.__data__; + return r ? i[n] !== void 0 : t.call(i, n); + } + return Bi = a, Bi; +} +var Pi, bu; +function Rh() { + if (bu) return Pi; + bu = 1; + var r = Nn(), e = "__lodash_hash_undefined__"; + function t(a, n) { + var i = this.__data__; + return this.size += this.has(a) ? 0 : 1, i[a] = r && n === void 0 ? e : n, this; + } + return Pi = t, Pi; +} +var Ai, wu; +function Mh() { + if (wu) return Ai; + wu = 1; + var r = kh(), e = Bh(), t = Ph(), a = Ah(), n = Rh(); + function i(s) { + var o = -1, l = s == null ? 0 : s.length; + for (this.clear(); ++o < l; ) { + var u = s[o]; + this.set(u[0], u[1]); + } + } + return i.prototype.clear = r, i.prototype.delete = e, i.prototype.get = t, i.prototype.has = a, i.prototype.set = n, Ai = i, Ai; +} +var Ri, xu; +function Lh() { + if (xu) return Ri; + xu = 1; + function r() { + this.__data__ = [], this.size = 0; + } + return Ri = r, Ri; +} +var Mi, Eu; +function Dv() { + if (Eu) return Mi; + Eu = 1; + function r(e, t) { + return e === t || e !== e && t !== t; + } + return Mi = r, Mi; +} +var Li, Cu; +function zn() { + if (Cu) return Li; + Cu = 1; + var r = Dv(); + function e(t, a) { + for (var n = t.length; n--; ) + if (r(t[n][0], a)) + return n; + return -1; + } + return Li = e, Li; +} +var Ii, Tu; +function Ih() { + if (Tu) return Ii; + Tu = 1; + var r = zn(), e = Array.prototype, t = e.splice; + function a(n) { + var i = this.__data__, s = r(i, n); + if (s < 0) + return !1; + var o = i.length - 1; + return s == o ? i.pop() : t.call(i, s, 1), --this.size, !0; + } + return Ii = a, Ii; +} +var Oi, Su; +function Oh() { + if (Su) return Oi; + Su = 1; + var r = zn(); + function e(t) { + var a = this.__data__, n = r(a, t); + return n < 0 ? void 0 : a[n][1]; + } + return Oi = e, Oi; +} +var Ni, Du; +function Nh() { + if (Du) return Ni; + Du = 1; + var r = zn(); + function e(t) { + return r(this.__data__, t) > -1; + } + return Ni = e, Ni; +} +var zi, ku; +function zh() { + if (ku) return zi; + ku = 1; + var r = zn(); + function e(t, a) { + var n = this.__data__, i = r(n, t); + return i < 0 ? (++this.size, n.push([t, a])) : n[i][1] = a, this; + } + return zi = e, zi; +} +var Fi, Bu; +function Fh() { + if (Bu) return Fi; + Bu = 1; + var r = Lh(), e = Ih(), t = Oh(), a = Nh(), n = zh(); + function i(s) { + var o = -1, l = s == null ? 0 : s.length; + for (this.clear(); ++o < l; ) { + var u = s[o]; + this.set(u[0], u[1]); + } + } + return i.prototype.clear = r, i.prototype.delete = e, i.prototype.get = t, i.prototype.has = a, i.prototype.set = n, Fi = i, Fi; +} +var Vi, Pu; +function Vh() { + if (Pu) return Vi; + Pu = 1; + var r = ao(), e = Rn(), t = r(e, "Map"); + return Vi = t, Vi; +} +var qi, Au; +function qh() { + if (Au) return qi; + Au = 1; + var r = Mh(), e = Fh(), t = Vh(); + function a() { + this.size = 0, this.__data__ = { + hash: new r(), + map: new (t || e)(), + string: new r() + }; + } + return qi = a, qi; +} +var _i, Ru; +function _h() { + if (Ru) return _i; + Ru = 1; + function r(e) { + var t = typeof e; + return t == "string" || t == "number" || t == "symbol" || t == "boolean" ? e !== "__proto__" : e === null; + } + return _i = r, _i; +} +var Gi, Mu; +function Fn() { + if (Mu) return Gi; + Mu = 1; + var r = _h(); + function e(t, a) { + var n = t.__data__; + return r(a) ? n[typeof a == "string" ? "string" : "hash"] : n.map; + } + return Gi = e, Gi; +} +var Hi, Lu; +function Gh() { + if (Lu) return Hi; + Lu = 1; + var r = Fn(); + function e(t) { + var a = r(this, t).delete(t); + return this.size -= a ? 1 : 0, a; + } + return Hi = e, Hi; +} +var Wi, Iu; +function Hh() { + if (Iu) return Wi; + Iu = 1; + var r = Fn(); + function e(t) { + return r(this, t).get(t); + } + return Wi = e, Wi; +} +var Ui, Ou; +function Wh() { + if (Ou) return Ui; + Ou = 1; + var r = Fn(); + function e(t) { + return r(this, t).has(t); + } + return Ui = e, Ui; +} +var $i, Nu; +function Uh() { + if (Nu) return $i; + Nu = 1; + var r = Fn(); + function e(t, a) { + var n = r(this, t), i = n.size; + return n.set(t, a), this.size += n.size == i ? 0 : 1, this; + } + return $i = e, $i; +} +var Ki, zu; +function $h() { + if (zu) return Ki; + zu = 1; + var r = qh(), e = Gh(), t = Hh(), a = Wh(), n = Uh(); + function i(s) { + var o = -1, l = s == null ? 0 : s.length; + for (this.clear(); ++o < l; ) { + var u = s[o]; + this.set(u[0], u[1]); + } + } + return i.prototype.clear = r, i.prototype.delete = e, i.prototype.get = t, i.prototype.has = a, i.prototype.set = n, Ki = i, Ki; +} +var Yi, Fu; +function Kh() { + if (Fu) return Yi; + Fu = 1; + var r = $h(), e = "Expected a function"; + function t(a, n) { + if (typeof a != "function" || n != null && typeof n != "function") + throw new TypeError(e); + var i = function() { + var s = arguments, o = n ? n.apply(this, s) : s[0], l = i.cache; + if (l.has(o)) + return l.get(o); + var u = a.apply(this, s); + return i.cache = l.set(o, u) || l, u; + }; + return i.cache = new (t.Cache || r)(), i; + } + return t.Cache = r, Yi = t, Yi; +} +var Xi, Vu; +function Yh() { + if (Vu) return Xi; + Vu = 1; + var r = Kh(), e = 500; + function t(a) { + var n = r(a, function(s) { + return i.size === e && i.clear(), s; + }), i = n.cache; + return n; + } + return Xi = t, Xi; +} +var Zi, qu; +function kv() { + if (qu) return Zi; + qu = 1; + var r = Yh(), e = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, t = /\\(\\)?/g, a = r(function(n) { + var i = []; + return n.charCodeAt(0) === 46 && i.push(""), n.replace(e, function(s, o, l, u) { + i.push(l ? u.replace(t, "$1") : o || s); + }), i; + }); + return Zi = a, Zi; +} +var Qi, _u; +function Bv() { + if (_u) return Qi; + _u = 1; + function r(e, t) { + for (var a = -1, n = e == null ? 0 : e.length, i = Array(n); ++a < n; ) + i[a] = t(e[a], a, e); + return i; + } + return Qi = r, Qi; +} +var Ji, Gu; +function Xh() { + if (Gu) return Ji; + Gu = 1; + var r = Ys(), e = Bv(), t = On(), a = Ia(), n = r ? r.prototype : void 0, i = n ? n.toString : void 0; + function s(o) { + if (typeof o == "string") + return o; + if (t(o)) + return e(o, s) + ""; + if (a(o)) + return i ? i.call(o) : ""; + var l = o + ""; + return l == "0" && 1 / o == -1 / 0 ? "-0" : l; + } + return Ji = s, Ji; +} +var ji, Hu; +function Pv() { + if (Hu) return ji; + Hu = 1; + var r = Xh(); + function e(t) { + return t == null ? "" : r(t); + } + return ji = e, ji; +} +var es, Wu; +function Av() { + if (Wu) return es; + Wu = 1; + var r = On(), e = wh(), t = kv(), a = Pv(); + function n(i, s) { + return r(i) ? i : e(i, s) ? [i] : t(a(i)); + } + return es = n, es; +} +var rs, Uu; +function no() { + if (Uu) return rs; + Uu = 1; + var r = Ia(); + function e(t) { + if (typeof t == "string" || r(t)) + return t; + var a = t + ""; + return a == "0" && 1 / t == -1 / 0 ? "-0" : a; + } + return rs = e, rs; +} +var ts, $u; +function Zh() { + if ($u) return ts; + $u = 1; + var r = Av(), e = no(); + function t(a, n) { + n = r(n, a); + for (var i = 0, s = n.length; a != null && i < s; ) + a = a[e(n[i++])]; + return i && i == s ? a : void 0; + } + return ts = t, ts; +} +var as, Ku; +function Qh() { + if (Ku) return as; + Ku = 1; + var r = Zh(); + function e(t, a, n) { + var i = t == null ? void 0 : r(t, a); + return i === void 0 ? n : i; + } + return as = e, as; +} +var Jh = Qh(), jh = /* @__PURE__ */ Ma(Jh), ns, Yu; +function eg() { + if (Yu) return ns; + Yu = 1; + var r = ao(), e = function() { + try { + var t = r(Object, "defineProperty"); + return t({}, "", {}), t; + } catch { + } + }(); + return ns = e, ns; +} +var is, Xu; +function rg() { + if (Xu) return is; + Xu = 1; + var r = eg(); + function e(t, a, n) { + a == "__proto__" && r ? r(t, a, { + configurable: !0, + enumerable: !0, + value: n, + writable: !0 + }) : t[a] = n; + } + return is = e, is; +} +var ss, Zu; +function tg() { + if (Zu) return ss; + Zu = 1; + var r = rg(), e = Dv(), t = Object.prototype, a = t.hasOwnProperty; + function n(i, s, o) { + var l = i[s]; + (!(a.call(i, s) && e(l, o)) || o === void 0 && !(s in i)) && r(i, s, o); + } + return ss = n, ss; +} +var os, Qu; +function ag() { + if (Qu) return os; + Qu = 1; + var r = 9007199254740991, e = /^(?:0|[1-9]\d*)$/; + function t(a, n) { + var i = typeof a; + return n = n ?? r, !!n && (i == "number" || i != "symbol" && e.test(a)) && a > -1 && a % 1 == 0 && a < n; + } + return os = t, os; +} +var us, Ju; +function ng() { + if (Ju) return us; + Ju = 1; + var r = tg(), e = Av(), t = ag(), a = La(), n = no(); + function i(s, o, l, u) { + if (!a(s)) + return s; + o = e(o, s); + for (var v = -1, f = o.length, c = f - 1, h = s; h != null && ++v < f; ) { + var d = n(o[v]), y = l; + if (d === "__proto__" || d === "constructor" || d === "prototype") + return s; + if (v != c) { + var g = h[d]; + y = u ? u(g, d, h) : void 0, y === void 0 && (y = a(g) ? g : t(o[v + 1]) ? [] : {}); + } + r(h, d, y), h = h[d]; + } + return s; + } + return us = i, us; +} +var ls, ju; +function ig() { + if (ju) return ls; + ju = 1; + var r = ng(); + function e(t, a, n) { + return t == null ? t : r(t, a, n); + } + return ls = e, ls; +} +var sg = ig(), og = /* @__PURE__ */ Ma(sg), vs, el; +function ug() { + if (el) return vs; + el = 1; + function r(e, t) { + var a = -1, n = e.length; + for (t || (t = Array(n)); ++a < n; ) + t[a] = e[a]; + return t; + } + return vs = r, vs; +} +var fs, rl; +function lg() { + if (rl) return fs; + rl = 1; + var r = Bv(), e = ug(), t = On(), a = Ia(), n = kv(), i = no(), s = Pv(); + function o(l) { + return t(l) ? r(l, i) : a(l) ? [l] : e(n(s(l))); + } + return fs = o, fs; +} +var vg = lg(), fg = /* @__PURE__ */ Ma(vg), cg = { + // access data field + data: function(e) { + var t = { + field: "data", + bindingEvent: "data", + allowBinding: !1, + allowSetting: !1, + allowGetting: !1, + settingEvent: "data", + settingTriggersEvent: !1, + triggerFnName: "trigger", + immutableKeys: {}, + // key => true if immutable + updateStyle: !1, + beforeGet: function(n) { + }, + beforeSet: function(n, i) { + }, + onSet: function(n) { + }, + canSet: function(n) { + return !0; + } + }; + return e = he({}, t, e), function(n, i) { + var s = e, o = this, l = o.length !== void 0, u = l ? o : [o], v = l ? o[0] : o; + if (fe(n)) { + var f = n.indexOf(".") !== -1, c = f && fg(n); + if (s.allowGetting && i === void 0) { + var h; + return v && (s.beforeGet(v), c && v._private[s.field][n] === void 0 ? h = jh(v._private[s.field], c) : h = v._private[s.field][n]), h; + } else if (s.allowSetting && i !== void 0) { + var d = !s.immutableKeys[n]; + if (d) { + var y = $l({}, n, i); + s.beforeSet(o, y); + for (var g = 0, p = u.length; g < p; g++) { + var m = u[g]; + s.canSet(m) && (c && v._private[s.field][n] === void 0 ? og(m._private[s.field], c, i) : m._private[s.field][n] = i); + } + s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent); + } + } + } else if (s.allowSetting && Pe(n)) { + var b = n, w, E, C = Object.keys(b); + s.beforeSet(o, b); + for (var x = 0; x < C.length; x++) { + w = C[x], E = b[w]; + var k = !s.immutableKeys[w]; + if (k) + for (var S = 0; S < u.length; S++) { + var P = u[S]; + s.canSet(P) && (P._private[s.field][w] = E); + } + } + s.updateStyle && o.updateStyle(), s.onSet(o), s.settingTriggersEvent && o[s.triggerFnName](s.settingEvent); + } else if (s.allowBinding && We(n)) { + var D = n; + o.on(s.bindingEvent, D); + } else if (s.allowGetting && n === void 0) { + var A; + return v && (s.beforeGet(v), A = v._private[s.field]), A; + } + return o; + }; + }, + // data + // remove data field + removeData: function(e) { + var t = { + field: "data", + event: "data", + triggerFnName: "trigger", + triggerEvent: !1, + immutableKeys: {} + // key => true if immutable + }; + return e = he({}, t, e), function(n) { + var i = e, s = this, o = s.length !== void 0, l = o ? s : [s]; + if (fe(n)) { + for (var u = n.split(/\s+/), v = u.length, f = 0; f < v; f++) { + var c = u[f]; + if (!nt(c)) { + var h = !i.immutableKeys[c]; + if (h) + for (var d = 0, y = l.length; d < y; d++) + l[d]._private[i.field][c] = void 0; + } + } + i.triggerEvent && s[i.triggerFnName](i.event); + } else if (n === void 0) { + for (var g = 0, p = l.length; g < p; g++) + for (var m = l[g]._private[i.field], b = Object.keys(m), w = 0; w < b.length; w++) { + var E = b[w], C = !i.immutableKeys[E]; + C && (m[E] = void 0); + } + i.triggerEvent && s[i.triggerFnName](i.event); + } + return s; + }; + } + // removeData +}, dg = { + eventAliasesOn: function(e) { + var t = e; + t.addListener = t.listen = t.bind = t.on, t.unlisten = t.unbind = t.off = t.removeListener, t.trigger = t.emit, t.pon = t.promiseOn = function(a, n) { + var i = this, s = Array.prototype.slice.call(arguments, 0); + return new ea(function(o, l) { + var u = function(h) { + i.off.apply(i, f), o(h); + }, v = s.concat([u]), f = v.concat([]); + i.on.apply(i, v); + }); + }; + } +}, Me = {}; +[bh, cg, dg].forEach(function(r) { + he(Me, r); +}); +var hg = { + animate: Me.animate(), + animation: Me.animation(), + animated: Me.animated(), + clearQueue: Me.clearQueue(), + delay: Me.delay(), + delayAnimation: Me.delayAnimation(), + stop: Me.stop() +}, un = { + classes: function(e) { + var t = this; + if (e === void 0) { + var a = []; + return t[0]._private.classes.forEach(function(d) { + return a.push(d); + }), a; + } else Fe(e) || (e = (e || "").match(/\S+/g) || []); + for (var n = [], i = new jt(e), s = 0; s < t.length; s++) { + for (var o = t[s], l = o._private, u = l.classes, v = !1, f = 0; f < e.length; f++) { + var c = e[f], h = u.has(c); + if (!h) { + v = !0; + break; + } + } + v || (v = u.size !== e.length), v && (l.classes = i, n.push(o)); + } + return n.length > 0 && this.spawn(n).updateStyle().emit("class"), t; + }, + addClass: function(e) { + return this.toggleClass(e, !0); + }, + hasClass: function(e) { + var t = this[0]; + return t != null && t._private.classes.has(e); + }, + toggleClass: function(e, t) { + Fe(e) || (e = e.match(/\S+/g) || []); + for (var a = this, n = t === void 0, i = [], s = 0, o = a.length; s < o; s++) + for (var l = a[s], u = l._private.classes, v = !1, f = 0; f < e.length; f++) { + var c = e[f], h = u.has(c), d = !1; + t || n && !h ? (u.add(c), d = !0) : (!t || n && h) && (u.delete(c), d = !0), !v && d && (i.push(l), v = !0); + } + return i.length > 0 && this.spawn(i).updateStyle().emit("class"), a; + }, + removeClass: function(e) { + return this.toggleClass(e, !1); + }, + flashClass: function(e, t) { + var a = this; + if (t == null) + t = 250; + else if (t === 0) + return a; + return a.addClass(e), setTimeout(function() { + a.removeClass(e); + }, t), a; + } +}; +un.className = un.classNames = un.classes; +var Be = { + metaChar: "[\\!\\\"\\#\\$\\%\\&\\'\\(\\)\\*\\+\\,\\.\\/\\:\\;\\<\\=\\>\\?\\@\\[\\]\\^\\`\\{\\|\\}\\~]", + // chars we need to escape in let names, etc + comparatorOp: "=|\\!=|>|>=|<|<=|\\$=|\\^=|\\*=", + // binary comparison op (used in data selectors) + boolOp: "\\?|\\!|\\^", + // boolean (unary) operators (used in data selectors) + string: `"(?:\\\\"|[^"])*"|'(?:\\\\'|[^'])*'`, + // string literals (used in data selectors) -- doublequotes | singlequotes + number: er, + // number literal (used in data selectors) --- e.g. 0.1234, 1234, 12e123 + meta: "degree|indegree|outdegree", + // allowed metadata fields (i.e. allowed functions to use from Collection) + separator: "\\s*,\\s*", + // queries are separated by commas, e.g. edge[foo = 'bar'], node.someClass + descendant: "\\s+", + child: "\\s+>\\s+", + subject: "\\$", + group: "node|edge|\\*", + directedEdge: "\\s+->\\s+", + undirectedEdge: "\\s+<->\\s+" +}; +Be.variable = "(?:[\\w-.]|(?:\\\\" + Be.metaChar + "))+"; +Be.className = "(?:[\\w-]|(?:\\\\" + Be.metaChar + "))+"; +Be.value = Be.string + "|" + Be.number; +Be.id = Be.variable; +(function() { + var r, e, t; + for (r = Be.comparatorOp.split("|"), t = 0; t < r.length; t++) + e = r[t], Be.comparatorOp += "|@" + e; + for (r = Be.comparatorOp.split("|"), t = 0; t < r.length; t++) + e = r[t], !(e.indexOf("!") >= 0) && e !== "=" && (Be.comparatorOp += "|\\!" + e); +})(); +var Ne = function() { + return { + checks: [] + }; +}, ie = { + /** E.g. node */ + GROUP: 0, + /** A collection of elements */ + COLLECTION: 1, + /** A filter(ele) function */ + FILTER: 2, + /** E.g. [foo > 1] */ + DATA_COMPARE: 3, + /** E.g. [foo] */ + DATA_EXIST: 4, + /** E.g. [?foo] */ + DATA_BOOL: 5, + /** E.g. [[degree > 2]] */ + META_COMPARE: 6, + /** E.g. :selected */ + STATE: 7, + /** E.g. #foo */ + ID: 8, + /** E.g. .foo */ + CLASS: 9, + /** E.g. #foo <-> #bar */ + UNDIRECTED_EDGE: 10, + /** E.g. #foo -> #bar */ + DIRECTED_EDGE: 11, + /** E.g. $#foo -> #bar */ + NODE_SOURCE: 12, + /** E.g. #foo -> $#bar */ + NODE_TARGET: 13, + /** E.g. $#foo <-> #bar */ + NODE_NEIGHBOR: 14, + /** E.g. #foo > #bar */ + CHILD: 15, + /** E.g. #foo #bar */ + DESCENDANT: 16, + /** E.g. $#foo > #bar */ + PARENT: 17, + /** E.g. $#foo #bar */ + ANCESTOR: 18, + /** E.g. #foo > $bar > #baz */ + COMPOUND_SPLIT: 19, + /** Always matches, useful placeholder for subject in `COMPOUND_SPLIT` */ + TRUE: 20 +}, Ms = [{ + selector: ":selected", + matches: function(e) { + return e.selected(); + } +}, { + selector: ":unselected", + matches: function(e) { + return !e.selected(); + } +}, { + selector: ":selectable", + matches: function(e) { + return e.selectable(); + } +}, { + selector: ":unselectable", + matches: function(e) { + return !e.selectable(); + } +}, { + selector: ":locked", + matches: function(e) { + return e.locked(); + } +}, { + selector: ":unlocked", + matches: function(e) { + return !e.locked(); + } +}, { + selector: ":visible", + matches: function(e) { + return e.visible(); + } +}, { + selector: ":hidden", + matches: function(e) { + return !e.visible(); + } +}, { + selector: ":transparent", + matches: function(e) { + return e.transparent(); + } +}, { + selector: ":grabbed", + matches: function(e) { + return e.grabbed(); + } +}, { + selector: ":free", + matches: function(e) { + return !e.grabbed(); + } +}, { + selector: ":removed", + matches: function(e) { + return e.removed(); + } +}, { + selector: ":inside", + matches: function(e) { + return !e.removed(); + } +}, { + selector: ":grabbable", + matches: function(e) { + return e.grabbable(); + } +}, { + selector: ":ungrabbable", + matches: function(e) { + return !e.grabbable(); + } +}, { + selector: ":animated", + matches: function(e) { + return e.animated(); + } +}, { + selector: ":unanimated", + matches: function(e) { + return !e.animated(); + } +}, { + selector: ":parent", + matches: function(e) { + return e.isParent(); + } +}, { + selector: ":childless", + matches: function(e) { + return e.isChildless(); + } +}, { + selector: ":child", + matches: function(e) { + return e.isChild(); + } +}, { + selector: ":orphan", + matches: function(e) { + return e.isOrphan(); + } +}, { + selector: ":nonorphan", + matches: function(e) { + return e.isChild(); + } +}, { + selector: ":compound", + matches: function(e) { + return e.isNode() ? e.isParent() : e.source().isParent() || e.target().isParent(); + } +}, { + selector: ":loop", + matches: function(e) { + return e.isLoop(); + } +}, { + selector: ":simple", + matches: function(e) { + return e.isSimple(); + } +}, { + selector: ":active", + matches: function(e) { + return e.active(); + } +}, { + selector: ":inactive", + matches: function(e) { + return !e.active(); + } +}, { + selector: ":backgrounding", + matches: function(e) { + return e.backgrounding(); + } +}, { + selector: ":nonbackgrounding", + matches: function(e) { + return !e.backgrounding(); + } +}].sort(function(r, e) { + return gc(r.selector, e.selector); +}), gg = function() { + for (var r = {}, e, t = 0; t < Ms.length; t++) + e = Ms[t], r[e.selector] = e.matches; + return r; +}(), pg = function(e, t) { + return gg[e](t); +}, yg = "(" + Ms.map(function(r) { + return r.selector; +}).join("|") + ")", Mt = function(e) { + return e.replace(new RegExp("\\\\(" + Be.metaChar + ")", "g"), function(t, a) { + return a; + }); +}, et = function(e, t, a) { + e[e.length - 1] = a; +}, Ls = [{ + name: "group", + // just used for identifying when debugging + query: !0, + regex: "(" + Be.group + ")", + populate: function(e, t, a) { + var n = je(a, 1), i = n[0]; + t.checks.push({ + type: ie.GROUP, + value: i === "*" ? i : i + "s" + }); + } +}, { + name: "state", + query: !0, + regex: yg, + populate: function(e, t, a) { + var n = je(a, 1), i = n[0]; + t.checks.push({ + type: ie.STATE, + value: i + }); + } +}, { + name: "id", + query: !0, + regex: "\\#(" + Be.id + ")", + populate: function(e, t, a) { + var n = je(a, 1), i = n[0]; + t.checks.push({ + type: ie.ID, + value: Mt(i) + }); + } +}, { + name: "className", + query: !0, + regex: "\\.(" + Be.className + ")", + populate: function(e, t, a) { + var n = je(a, 1), i = n[0]; + t.checks.push({ + type: ie.CLASS, + value: Mt(i) + }); + } +}, { + name: "dataExists", + query: !0, + regex: "\\[\\s*(" + Be.variable + ")\\s*\\]", + populate: function(e, t, a) { + var n = je(a, 1), i = n[0]; + t.checks.push({ + type: ie.DATA_EXIST, + field: Mt(i) + }); + } +}, { + name: "dataCompare", + query: !0, + regex: "\\[\\s*(" + Be.variable + ")\\s*(" + Be.comparatorOp + ")\\s*(" + Be.value + ")\\s*\\]", + populate: function(e, t, a) { + var n = je(a, 3), i = n[0], s = n[1], o = n[2], l = new RegExp("^" + Be.string + "$").exec(o) != null; + l ? o = o.substring(1, o.length - 1) : o = parseFloat(o), t.checks.push({ + type: ie.DATA_COMPARE, + field: Mt(i), + operator: s, + value: o + }); + } +}, { + name: "dataBool", + query: !0, + regex: "\\[\\s*(" + Be.boolOp + ")\\s*(" + Be.variable + ")\\s*\\]", + populate: function(e, t, a) { + var n = je(a, 2), i = n[0], s = n[1]; + t.checks.push({ + type: ie.DATA_BOOL, + field: Mt(s), + operator: i + }); + } +}, { + name: "metaCompare", + query: !0, + regex: "\\[\\[\\s*(" + Be.meta + ")\\s*(" + Be.comparatorOp + ")\\s*(" + Be.number + ")\\s*\\]\\]", + populate: function(e, t, a) { + var n = je(a, 3), i = n[0], s = n[1], o = n[2]; + t.checks.push({ + type: ie.META_COMPARE, + field: Mt(i), + operator: s, + value: parseFloat(o) + }); + } +}, { + name: "nextQuery", + separator: !0, + regex: Be.separator, + populate: function(e, t) { + var a = e.currentSubject, n = e.edgeCount, i = e.compoundCount, s = e[e.length - 1]; + a != null && (s.subject = a, e.currentSubject = null), s.edgeCount = n, s.compoundCount = i, e.edgeCount = 0, e.compoundCount = 0; + var o = e[e.length++] = Ne(); + return o; + } +}, { + name: "directedEdge", + separator: !0, + regex: Be.directedEdge, + populate: function(e, t) { + if (e.currentSubject == null) { + var a = Ne(), n = t, i = Ne(); + return a.checks.push({ + type: ie.DIRECTED_EDGE, + source: n, + target: i + }), et(e, t, a), e.edgeCount++, i; + } else { + var s = Ne(), o = t, l = Ne(); + return s.checks.push({ + type: ie.NODE_SOURCE, + source: o, + target: l + }), et(e, t, s), e.edgeCount++, l; + } + } +}, { + name: "undirectedEdge", + separator: !0, + regex: Be.undirectedEdge, + populate: function(e, t) { + if (e.currentSubject == null) { + var a = Ne(), n = t, i = Ne(); + return a.checks.push({ + type: ie.UNDIRECTED_EDGE, + nodes: [n, i] + }), et(e, t, a), e.edgeCount++, i; + } else { + var s = Ne(), o = t, l = Ne(); + return s.checks.push({ + type: ie.NODE_NEIGHBOR, + node: o, + neighbor: l + }), et(e, t, s), l; + } + } +}, { + name: "child", + separator: !0, + regex: Be.child, + populate: function(e, t) { + if (e.currentSubject == null) { + var a = Ne(), n = Ne(), i = e[e.length - 1]; + return a.checks.push({ + type: ie.CHILD, + parent: i, + child: n + }), et(e, t, a), e.compoundCount++, n; + } else if (e.currentSubject === t) { + var s = Ne(), o = e[e.length - 1], l = Ne(), u = Ne(), v = Ne(), f = Ne(); + return s.checks.push({ + type: ie.COMPOUND_SPLIT, + left: o, + right: l, + subject: u + }), u.checks = t.checks, t.checks = [{ + type: ie.TRUE + }], f.checks.push({ + type: ie.TRUE + }), l.checks.push({ + type: ie.PARENT, + // type is swapped on right side queries + parent: f, + child: v + // empty for now + }), et(e, o, s), e.currentSubject = u, e.compoundCount++, v; + } else { + var c = Ne(), h = Ne(), d = [{ + type: ie.PARENT, + parent: c, + child: h + }]; + return c.checks = t.checks, t.checks = d, e.compoundCount++, h; + } + } +}, { + name: "descendant", + separator: !0, + regex: Be.descendant, + populate: function(e, t) { + if (e.currentSubject == null) { + var a = Ne(), n = Ne(), i = e[e.length - 1]; + return a.checks.push({ + type: ie.DESCENDANT, + ancestor: i, + descendant: n + }), et(e, t, a), e.compoundCount++, n; + } else if (e.currentSubject === t) { + var s = Ne(), o = e[e.length - 1], l = Ne(), u = Ne(), v = Ne(), f = Ne(); + return s.checks.push({ + type: ie.COMPOUND_SPLIT, + left: o, + right: l, + subject: u + }), u.checks = t.checks, t.checks = [{ + type: ie.TRUE + }], f.checks.push({ + type: ie.TRUE + }), l.checks.push({ + type: ie.ANCESTOR, + // type is swapped on right side queries + ancestor: f, + descendant: v + // empty for now + }), et(e, o, s), e.currentSubject = u, e.compoundCount++, v; + } else { + var c = Ne(), h = Ne(), d = [{ + type: ie.ANCESTOR, + ancestor: c, + descendant: h + }]; + return c.checks = t.checks, t.checks = d, e.compoundCount++, h; + } + } +}, { + name: "subject", + modifier: !0, + regex: Be.subject, + populate: function(e, t) { + if (e.currentSubject != null && e.currentSubject !== t) + return Le("Redefinition of subject in selector `" + e.toString() + "`"), !1; + e.currentSubject = t; + var a = e[e.length - 1], n = a.checks[0], i = n == null ? null : n.type; + i === ie.DIRECTED_EDGE ? n.type = ie.NODE_TARGET : i === ie.UNDIRECTED_EDGE && (n.type = ie.NODE_NEIGHBOR, n.node = n.nodes[1], n.neighbor = n.nodes[0], n.nodes = null); + } +}]; +Ls.forEach(function(r) { + return r.regexObj = new RegExp("^" + r.regex); +}); +var mg = function(e) { + for (var t, a, n, i = 0; i < Ls.length; i++) { + var s = Ls[i], o = s.name, l = e.match(s.regexObj); + if (l != null) { + a = l, t = s, n = o; + var u = l[0]; + e = e.substring(u.length); + break; + } + } + return { + expr: t, + match: a, + name: n, + remaining: e + }; +}, bg = function(e) { + var t = e.match(/^\s+/); + if (t) { + var a = t[0]; + e = e.substring(a.length); + } + return e; +}, wg = function(e) { + var t = this, a = t.inputText = e, n = t[0] = Ne(); + for (t.length = 1, a = bg(a); ; ) { + var i = mg(a); + if (i.expr == null) + return Le("The selector `" + e + "`is invalid"), !1; + var s = i.match.slice(1), o = i.expr.populate(t, n, s); + if (o === !1) + return !1; + if (o != null && (n = o), a = i.remaining, a.match(/^\s*$/)) + break; + } + var l = t[t.length - 1]; + t.currentSubject != null && (l.subject = t.currentSubject), l.edgeCount = t.edgeCount, l.compoundCount = t.compoundCount; + for (var u = 0; u < t.length; u++) { + var v = t[u]; + if (v.compoundCount > 0 && v.edgeCount > 0) + return Le("The selector `" + e + "` is invalid because it uses both a compound selector and an edge selector"), !1; + if (v.edgeCount > 1) + return Le("The selector `" + e + "` is invalid because it uses multiple edge selectors"), !1; + v.edgeCount === 1 && Le("The selector `" + e + "` is deprecated. Edge selectors do not take effect on changes to source and target nodes after an edge is added, for performance reasons. Use a class or data selector on edges instead, updating the class or data of an edge when your app detects a change in source or target nodes."); + } + return !0; +}, xg = function() { + if (this.toStringCache != null) + return this.toStringCache; + for (var e = function(v) { + return v ?? ""; + }, t = function(v) { + return fe(v) ? '"' + v + '"' : e(v); + }, a = function(v) { + return " " + v + " "; + }, n = function(v, f) { + var c = v.type, h = v.value; + switch (c) { + case ie.GROUP: { + var d = e(h); + return d.substring(0, d.length - 1); + } + case ie.DATA_COMPARE: { + var y = v.field, g = v.operator; + return "[" + y + a(e(g)) + t(h) + "]"; + } + case ie.DATA_BOOL: { + var p = v.operator, m = v.field; + return "[" + e(p) + m + "]"; + } + case ie.DATA_EXIST: { + var b = v.field; + return "[" + b + "]"; + } + case ie.META_COMPARE: { + var w = v.operator, E = v.field; + return "[[" + E + a(e(w)) + t(h) + "]]"; + } + case ie.STATE: + return h; + case ie.ID: + return "#" + h; + case ie.CLASS: + return "." + h; + case ie.PARENT: + case ie.CHILD: + return i(v.parent, f) + a(">") + i(v.child, f); + case ie.ANCESTOR: + case ie.DESCENDANT: + return i(v.ancestor, f) + " " + i(v.descendant, f); + case ie.COMPOUND_SPLIT: { + var C = i(v.left, f), x = i(v.subject, f), k = i(v.right, f); + return C + (C.length > 0 ? " " : "") + x + k; + } + case ie.TRUE: + return ""; + } + }, i = function(v, f) { + return v.checks.reduce(function(c, h, d) { + return c + (f === v && d === 0 ? "$" : "") + n(h, f); + }, ""); + }, s = "", o = 0; o < this.length; o++) { + var l = this[o]; + s += i(l, l.subject), this.length > 1 && o < this.length - 1 && (s += ", "); + } + return this.toStringCache = s, s; +}, Eg = { + parse: wg, + toString: xg +}, Rv = function(e, t, a) { + var n, i = fe(e), s = te(e), o = fe(a), l, u, v = !1, f = !1, c = !1; + switch (t.indexOf("!") >= 0 && (t = t.replace("!", ""), f = !0), t.indexOf("@") >= 0 && (t = t.replace("@", ""), v = !0), (i || o || v) && (l = !i && !s ? "" : "" + e, u = "" + a), v && (e = l = l.toLowerCase(), a = u = u.toLowerCase()), t) { + case "*=": + n = l.indexOf(u) >= 0; + break; + case "$=": + n = l.indexOf(u, l.length - u.length) >= 0; + break; + case "^=": + n = l.indexOf(u) === 0; + break; + case "=": + n = e === a; + break; + case ">": + c = !0, n = e > a; + break; + case ">=": + c = !0, n = e >= a; + break; + case "<": + c = !0, n = e < a; + break; + case "<=": + c = !0, n = e <= a; + break; + default: + n = !1; + break; + } + return f && (e != null || !c) && (n = !n), n; +}, Cg = function(e, t) { + switch (t) { + case "?": + return !!e; + case "!": + return !e; + case "^": + return e === void 0; + } +}, Tg = function(e) { + return e !== void 0; +}, io = function(e, t) { + return e.data(t); +}, Sg = function(e, t) { + return e[t](); +}, $e = [], Ge = function(e, t) { + return e.checks.every(function(a) { + return $e[a.type](a, t); + }); +}; +$e[ie.GROUP] = function(r, e) { + var t = r.value; + return t === "*" || t === e.group(); +}; +$e[ie.STATE] = function(r, e) { + var t = r.value; + return pg(t, e); +}; +$e[ie.ID] = function(r, e) { + var t = r.value; + return e.id() === t; +}; +$e[ie.CLASS] = function(r, e) { + var t = r.value; + return e.hasClass(t); +}; +$e[ie.META_COMPARE] = function(r, e) { + var t = r.field, a = r.operator, n = r.value; + return Rv(Sg(e, t), a, n); +}; +$e[ie.DATA_COMPARE] = function(r, e) { + var t = r.field, a = r.operator, n = r.value; + return Rv(io(e, t), a, n); +}; +$e[ie.DATA_BOOL] = function(r, e) { + var t = r.field, a = r.operator; + return Cg(io(e, t), a); +}; +$e[ie.DATA_EXIST] = function(r, e) { + var t = r.field; + return r.operator, Tg(io(e, t)); +}; +$e[ie.UNDIRECTED_EDGE] = function(r, e) { + var t = r.nodes[0], a = r.nodes[1], n = e.source(), i = e.target(); + return Ge(t, n) && Ge(a, i) || Ge(a, n) && Ge(t, i); +}; +$e[ie.NODE_NEIGHBOR] = function(r, e) { + return Ge(r.node, e) && e.neighborhood().some(function(t) { + return t.isNode() && Ge(r.neighbor, t); + }); +}; +$e[ie.DIRECTED_EDGE] = function(r, e) { + return Ge(r.source, e.source()) && Ge(r.target, e.target()); +}; +$e[ie.NODE_SOURCE] = function(r, e) { + return Ge(r.source, e) && e.outgoers().some(function(t) { + return t.isNode() && Ge(r.target, t); + }); +}; +$e[ie.NODE_TARGET] = function(r, e) { + return Ge(r.target, e) && e.incomers().some(function(t) { + return t.isNode() && Ge(r.source, t); + }); +}; +$e[ie.CHILD] = function(r, e) { + return Ge(r.child, e) && Ge(r.parent, e.parent()); +}; +$e[ie.PARENT] = function(r, e) { + return Ge(r.parent, e) && e.children().some(function(t) { + return Ge(r.child, t); + }); +}; +$e[ie.DESCENDANT] = function(r, e) { + return Ge(r.descendant, e) && e.ancestors().some(function(t) { + return Ge(r.ancestor, t); + }); +}; +$e[ie.ANCESTOR] = function(r, e) { + return Ge(r.ancestor, e) && e.descendants().some(function(t) { + return Ge(r.descendant, t); + }); +}; +$e[ie.COMPOUND_SPLIT] = function(r, e) { + return Ge(r.subject, e) && Ge(r.left, e) && Ge(r.right, e); +}; +$e[ie.TRUE] = function() { + return !0; +}; +$e[ie.COLLECTION] = function(r, e) { + var t = r.value; + return t.has(e); +}; +$e[ie.FILTER] = function(r, e) { + var t = r.value; + return t(e); +}; +var Dg = function(e) { + var t = this; + if (t.length === 1 && t[0].checks.length === 1 && t[0].checks[0].type === ie.ID) + return e.getElementById(t[0].checks[0].value).collection(); + var a = function(i) { + for (var s = 0; s < t.length; s++) { + var o = t[s]; + if (Ge(o, i)) + return !0; + } + return !1; + }; + return t.text() == null && (a = function() { + return !0; + }), e.filter(a); +}, kg = function(e) { + for (var t = this, a = 0; a < t.length; a++) { + var n = t[a]; + if (Ge(n, e)) + return !0; + } + return !1; +}, Bg = { + matches: kg, + filter: Dg +}, ot = function(e) { + this.inputText = e, this.currentSubject = null, this.compoundCount = 0, this.edgeCount = 0, this.length = 0, e == null || fe(e) && e.match(/^\s*$/) || (Dr(e) ? this.addQuery({ + checks: [{ + type: ie.COLLECTION, + value: e.collection() + }] + }) : We(e) ? this.addQuery({ + checks: [{ + type: ie.FILTER, + value: e + }] + }) : fe(e) ? this.parse(e) || (this.invalid = !0) : He("A selector must be created from a string; found ")); +}, ut = ot.prototype; +[Eg, Bg].forEach(function(r) { + return he(ut, r); +}); +ut.text = function() { + return this.inputText; +}; +ut.size = function() { + return this.length; +}; +ut.eq = function(r) { + return this[r]; +}; +ut.sameText = function(r) { + return !this.invalid && !r.invalid && this.text() === r.text(); +}; +ut.addQuery = function(r) { + this[this.length++] = r; +}; +ut.selector = ut.toString; +var tt = { + allAre: function(e) { + var t = new ot(e); + return this.every(function(a) { + return t.matches(a); + }); + }, + is: function(e) { + var t = new ot(e); + return this.some(function(a) { + return t.matches(a); + }); + }, + some: function(e, t) { + for (var a = 0; a < this.length; a++) { + var n = t ? e.apply(t, [this[a], a, this]) : e(this[a], a, this); + if (n) + return !0; + } + return !1; + }, + every: function(e, t) { + for (var a = 0; a < this.length; a++) { + var n = t ? e.apply(t, [this[a], a, this]) : e(this[a], a, this); + if (!n) + return !1; + } + return !0; + }, + same: function(e) { + if (this === e) + return !0; + e = this.cy().collection(e); + var t = this.length, a = e.length; + return t !== a ? !1 : t === 1 ? this[0] === e[0] : this.every(function(n) { + return e.hasElementWithId(n.id()); + }); + }, + anySame: function(e) { + return e = this.cy().collection(e), this.some(function(t) { + return e.hasElementWithId(t.id()); + }); + }, + allAreNeighbors: function(e) { + e = this.cy().collection(e); + var t = this.neighborhood(); + return e.every(function(a) { + return t.hasElementWithId(a.id()); + }); + }, + contains: function(e) { + e = this.cy().collection(e); + var t = this; + return e.every(function(a) { + return t.hasElementWithId(a.id()); + }); + } +}; +tt.allAreNeighbours = tt.allAreNeighbors; +tt.has = tt.contains; +tt.equal = tt.equals = tt.same; +var Pr = function(e, t) { + return function(n, i, s, o) { + var l = n, u = this, v; + if (l == null ? v = "" : Dr(l) && l.length === 1 && (v = l.id()), u.length === 1 && v) { + var f = u[0]._private, c = f.traversalCache = f.traversalCache || {}, h = c[t] = c[t] || [], d = Tt(v), y = h[d]; + return y || (h[d] = e.call(u, n, i, s, o)); + } else + return e.call(u, n, i, s, o); + }; +}, Qt = { + parent: function(e) { + var t = []; + if (this.length === 1) { + var a = this[0]._private.parent; + if (a) + return a; + } + for (var n = 0; n < this.length; n++) { + var i = this[n], s = i._private.parent; + s && t.push(s); + } + return this.spawn(t, !0).filter(e); + }, + parents: function(e) { + for (var t = [], a = this.parent(); a.nonempty(); ) { + for (var n = 0; n < a.length; n++) { + var i = a[n]; + t.push(i); + } + a = a.parent(); + } + return this.spawn(t, !0).filter(e); + }, + commonAncestors: function(e) { + for (var t, a = 0; a < this.length; a++) { + var n = this[a], i = n.parents(); + t = t || i, t = t.intersect(i); + } + return t.filter(e); + }, + orphans: function(e) { + return this.stdFilter(function(t) { + return t.isOrphan(); + }).filter(e); + }, + nonorphans: function(e) { + return this.stdFilter(function(t) { + return t.isChild(); + }).filter(e); + }, + children: Pr(function(r) { + for (var e = [], t = 0; t < this.length; t++) + for (var a = this[t], n = a._private.children, i = 0; i < n.length; i++) + e.push(n[i]); + return this.spawn(e, !0).filter(r); + }, "children"), + siblings: function(e) { + return this.parent().children().not(this).filter(e); + }, + isParent: function() { + var e = this[0]; + if (e) + return e.isNode() && e._private.children.length !== 0; + }, + isChildless: function() { + var e = this[0]; + if (e) + return e.isNode() && e._private.children.length === 0; + }, + isChild: function() { + var e = this[0]; + if (e) + return e.isNode() && e._private.parent != null; + }, + isOrphan: function() { + var e = this[0]; + if (e) + return e.isNode() && e._private.parent == null; + }, + descendants: function(e) { + var t = []; + function a(n) { + for (var i = 0; i < n.length; i++) { + var s = n[i]; + t.push(s), s.children().nonempty() && a(s.children()); + } + } + return a(this.children()), this.spawn(t, !0).filter(e); + } +}; +function so(r, e, t, a) { + for (var n = [], i = new jt(), s = r.cy(), o = s.hasCompoundNodes(), l = 0; l < r.length; l++) { + var u = r[l]; + t ? n.push(u) : o && a(n, i, u); + } + for (; n.length > 0; ) { + var v = n.shift(); + e(v), i.add(v.id()), o && a(n, i, v); + } + return r; +} +function Mv(r, e, t) { + if (t.isParent()) + for (var a = t._private.children, n = 0; n < a.length; n++) { + var i = a[n]; + e.has(i.id()) || r.push(i); + } +} +Qt.forEachDown = function(r) { + var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0; + return so(this, r, e, Mv); +}; +function Lv(r, e, t) { + if (t.isChild()) { + var a = t._private.parent; + e.has(a.id()) || r.push(a); + } +} +Qt.forEachUp = function(r) { + var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0; + return so(this, r, e, Lv); +}; +function Pg(r, e, t) { + Lv(r, e, t), Mv(r, e, t); +} +Qt.forEachUpAndDown = function(r) { + var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0; + return so(this, r, e, Pg); +}; +Qt.ancestors = Qt.parents; +var Sa, Iv; +Sa = Iv = { + data: Me.data({ + field: "data", + bindingEvent: "data", + allowBinding: !0, + allowSetting: !0, + settingEvent: "data", + settingTriggersEvent: !0, + triggerFnName: "trigger", + allowGetting: !0, + immutableKeys: { + id: !0, + source: !0, + target: !0, + parent: !0 + }, + updateStyle: !0 + }), + removeData: Me.removeData({ + field: "data", + event: "data", + triggerFnName: "trigger", + triggerEvent: !0, + immutableKeys: { + id: !0, + source: !0, + target: !0, + parent: !0 + }, + updateStyle: !0 + }), + scratch: Me.data({ + field: "scratch", + bindingEvent: "scratch", + allowBinding: !0, + allowSetting: !0, + settingEvent: "scratch", + settingTriggersEvent: !0, + triggerFnName: "trigger", + allowGetting: !0, + updateStyle: !0 + }), + removeScratch: Me.removeData({ + field: "scratch", + event: "scratch", + triggerFnName: "trigger", + triggerEvent: !0, + updateStyle: !0 + }), + rscratch: Me.data({ + field: "rscratch", + allowBinding: !1, + allowSetting: !0, + settingTriggersEvent: !1, + allowGetting: !0 + }), + removeRscratch: Me.removeData({ + field: "rscratch", + triggerEvent: !1 + }), + id: function() { + var e = this[0]; + if (e) + return e._private.data.id; + } +}; +Sa.attr = Sa.data; +Sa.removeAttr = Sa.removeData; +var Ag = Iv, Vn = {}; +function cs(r) { + return function(e) { + var t = this; + if (e === void 0 && (e = !0), t.length !== 0) + if (t.isNode() && !t.removed()) { + for (var a = 0, n = t[0], i = n._private.edges, s = 0; s < i.length; s++) { + var o = i[s]; + !e && o.isLoop() || (a += r(n, o)); + } + return a; + } else + return; + }; +} +he(Vn, { + degree: cs(function(r, e) { + return e.source().same(e.target()) ? 2 : 1; + }), + indegree: cs(function(r, e) { + return e.target().same(r) ? 1 : 0; + }), + outdegree: cs(function(r, e) { + return e.source().same(r) ? 1 : 0; + }) +}); +function Lt(r, e) { + return function(t) { + for (var a, n = this.nodes(), i = 0; i < n.length; i++) { + var s = n[i], o = s[r](t); + o !== void 0 && (a === void 0 || e(o, a)) && (a = o); + } + return a; + }; +} +he(Vn, { + minDegree: Lt("degree", function(r, e) { + return r < e; + }), + maxDegree: Lt("degree", function(r, e) { + return r > e; + }), + minIndegree: Lt("indegree", function(r, e) { + return r < e; + }), + maxIndegree: Lt("indegree", function(r, e) { + return r > e; + }), + minOutdegree: Lt("outdegree", function(r, e) { + return r < e; + }), + maxOutdegree: Lt("outdegree", function(r, e) { + return r > e; + }) +}); +he(Vn, { + totalDegree: function(e) { + for (var t = 0, a = this.nodes(), n = 0; n < a.length; n++) + t += a[n].degree(e); + return t; + } +}); +var Lr, Ov, Nv = function(e, t, a) { + for (var n = 0; n < e.length; n++) { + var i = e[n]; + if (!i.locked()) { + var s = i._private.position, o = { + x: t.x != null ? t.x - s.x : 0, + y: t.y != null ? t.y - s.y : 0 + }; + i.isParent() && !(o.x === 0 && o.y === 0) && i.children().shift(o, a), i.dirtyBoundingBoxCache(); + } + } +}, tl = { + field: "position", + bindingEvent: "position", + allowBinding: !0, + allowSetting: !0, + settingEvent: "position", + settingTriggersEvent: !0, + triggerFnName: "emitAndNotify", + allowGetting: !0, + validKeys: ["x", "y"], + beforeGet: function(e) { + e.updateCompoundBounds(); + }, + beforeSet: function(e, t) { + Nv(e, t, !1); + }, + onSet: function(e) { + e.dirtyCompoundBoundsCache(); + }, + canSet: function(e) { + return !e.locked(); + } +}; +Lr = Ov = { + position: Me.data(tl), + // position but no notification to renderer + silentPosition: Me.data(he({}, tl, { + allowBinding: !1, + allowSetting: !0, + settingTriggersEvent: !1, + allowGetting: !1, + beforeSet: function(e, t) { + Nv(e, t, !0); + }, + onSet: function(e) { + e.dirtyCompoundBoundsCache(); + } + })), + positions: function(e, t) { + if (Pe(e)) + t ? this.silentPosition(e) : this.position(e); + else if (We(e)) { + var a = e, n = this.cy(); + n.startBatch(); + for (var i = 0; i < this.length; i++) { + var s = this[i], o = void 0; + (o = a(s, i)) && (t ? s.silentPosition(o) : s.position(o)); + } + n.endBatch(); + } + return this; + }, + silentPositions: function(e) { + return this.positions(e, !0); + }, + shift: function(e, t, a) { + var n; + if (Pe(e) ? (n = { + x: te(e.x) ? e.x : 0, + y: te(e.y) ? e.y : 0 + }, a = t) : fe(e) && te(t) && (n = { + x: 0, + y: 0 + }, n[e] = t), n != null) { + var i = this.cy(); + i.startBatch(); + for (var s = 0; s < this.length; s++) { + var o = this[s]; + if (!(i.hasCompoundNodes() && o.isChild() && o.ancestors().anySame(this))) { + var l = o.position(), u = { + x: l.x + n.x, + y: l.y + n.y + }; + a ? o.silentPosition(u) : o.position(u); + } + } + i.endBatch(); + } + return this; + }, + silentShift: function(e, t) { + return Pe(e) ? this.shift(e, !0) : fe(e) && te(t) && this.shift(e, t, !0), this; + }, + // get/set the rendered (i.e. on screen) positon of the element + renderedPosition: function(e, t) { + var a = this[0], n = this.cy(), i = n.zoom(), s = n.pan(), o = Pe(e) ? e : void 0, l = o !== void 0 || t !== void 0 && fe(e); + if (a && a.isNode()) + if (l) + for (var u = 0; u < this.length; u++) { + var v = this[u]; + t !== void 0 ? v.position(e, (t - s[e]) / i) : o !== void 0 && v.position(fv(o, i, s)); + } + else { + var f = a.position(); + return o = Ln(f, i, s), e === void 0 ? o : o[e]; + } + else if (!l) + return; + return this; + }, + // get/set the position relative to the parent + relativePosition: function(e, t) { + var a = this[0], n = this.cy(), i = Pe(e) ? e : void 0, s = i !== void 0 || t !== void 0 && fe(e), o = n.hasCompoundNodes(); + if (a && a.isNode()) + if (s) + for (var l = 0; l < this.length; l++) { + var u = this[l], v = o ? u.parent() : null, f = v && v.length > 0, c = f; + f && (v = v[0]); + var h = c ? v.position() : { + x: 0, + y: 0 + }; + t !== void 0 ? u.position(e, t + h[e]) : i !== void 0 && u.position({ + x: i.x + h.x, + y: i.y + h.y + }); + } + else { + var d = a.position(), y = o ? a.parent() : null, g = y && y.length > 0, p = g; + g && (y = y[0]); + var m = p ? y.position() : { + x: 0, + y: 0 + }; + return i = { + x: d.x - m.x, + y: d.y - m.y + }, e === void 0 ? i : i[e]; + } + else if (!s) + return; + return this; + } +}; +Lr.modelPosition = Lr.point = Lr.position; +Lr.modelPositions = Lr.points = Lr.positions; +Lr.renderedPoint = Lr.renderedPosition; +Lr.relativePoint = Lr.relativePosition; +var Rg = Ov, Kt, ct; +Kt = ct = {}; +ct.renderedBoundingBox = function(r) { + var e = this.boundingBox(r), t = this.cy(), a = t.zoom(), n = t.pan(), i = e.x1 * a + n.x, s = e.x2 * a + n.x, o = e.y1 * a + n.y, l = e.y2 * a + n.y; + return { + x1: i, + x2: s, + y1: o, + y2: l, + w: s - i, + h: l - o + }; +}; +ct.dirtyCompoundBoundsCache = function() { + var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy(); + return !e.styleEnabled() || !e.hasCompoundNodes() ? this : (this.forEachUp(function(t) { + if (t.isParent()) { + var a = t._private; + a.compoundBoundsClean = !1, a.bbCache = null, r || t.emitAndNotify("bounds"); + } + }), this); +}; +ct.updateCompoundBounds = function() { + var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, e = this.cy(); + if (!e.styleEnabled() || !e.hasCompoundNodes()) + return this; + if (!r && e.batching()) + return this; + function t(s) { + if (!s.isParent()) + return; + var o = s._private, l = s.children(), u = s.pstyle("compound-sizing-wrt-labels").value === "include", v = { + width: { + val: s.pstyle("min-width").pfValue, + left: s.pstyle("min-width-bias-left"), + right: s.pstyle("min-width-bias-right") + }, + height: { + val: s.pstyle("min-height").pfValue, + top: s.pstyle("min-height-bias-top"), + bottom: s.pstyle("min-height-bias-bottom") + } + }, f = l.boundingBox({ + includeLabels: u, + includeOverlays: !1, + // updating the compound bounds happens outside of the regular + // cache cycle (i.e. before fired events) + useCache: !1 + }), c = o.position; + (f.w === 0 || f.h === 0) && (f = { + w: s.pstyle("width").pfValue, + h: s.pstyle("height").pfValue + }, f.x1 = c.x - f.w / 2, f.x2 = c.x + f.w / 2, f.y1 = c.y - f.h / 2, f.y2 = c.y + f.h / 2); + function h(S, P, D) { + var A = 0, B = 0, R = P + D; + return S > 0 && R > 0 && (A = P / R * S, B = D / R * S), { + biasDiff: A, + biasComplementDiff: B + }; + } + function d(S, P, D, A) { + if (D.units === "%") + switch (A) { + case "width": + return S > 0 ? D.pfValue * S : 0; + case "height": + return P > 0 ? D.pfValue * P : 0; + case "average": + return S > 0 && P > 0 ? D.pfValue * (S + P) / 2 : 0; + case "min": + return S > 0 && P > 0 ? S > P ? D.pfValue * P : D.pfValue * S : 0; + case "max": + return S > 0 && P > 0 ? S > P ? D.pfValue * S : D.pfValue * P : 0; + default: + return 0; + } + else return D.units === "px" ? D.pfValue : 0; + } + var y = v.width.left.value; + v.width.left.units === "px" && v.width.val > 0 && (y = y * 100 / v.width.val); + var g = v.width.right.value; + v.width.right.units === "px" && v.width.val > 0 && (g = g * 100 / v.width.val); + var p = v.height.top.value; + v.height.top.units === "px" && v.height.val > 0 && (p = p * 100 / v.height.val); + var m = v.height.bottom.value; + v.height.bottom.units === "px" && v.height.val > 0 && (m = m * 100 / v.height.val); + var b = h(v.width.val - f.w, y, g), w = b.biasDiff, E = b.biasComplementDiff, C = h(v.height.val - f.h, p, m), x = C.biasDiff, k = C.biasComplementDiff; + o.autoPadding = d(f.w, f.h, s.pstyle("padding"), s.pstyle("padding-relative-to").value), o.autoWidth = Math.max(f.w, v.width.val), c.x = (-w + f.x1 + f.x2 + E) / 2, o.autoHeight = Math.max(f.h, v.height.val), c.y = (-x + f.y1 + f.y2 + k) / 2; + } + for (var a = 0; a < this.length; a++) { + var n = this[a], i = n._private; + (!i.compoundBoundsClean || r) && (t(n), e.batching() || (i.compoundBoundsClean = !0)); + } + return this; +}; +var Br = function(e) { + return e === 1 / 0 || e === -1 / 0 ? 0 : e; +}, Mr = function(e, t, a, n, i) { + n - t === 0 || i - a === 0 || t == null || a == null || n == null || i == null || (e.x1 = t < e.x1 ? t : e.x1, e.x2 = n > e.x2 ? n : e.x2, e.y1 = a < e.y1 ? a : e.y1, e.y2 = i > e.y2 ? i : e.y2, e.w = e.x2 - e.x1, e.h = e.y2 - e.y1); +}, bt = function(e, t) { + return t == null ? e : Mr(e, t.x1, t.y1, t.x2, t.y2); +}, ua = function(e, t, a) { + return Er(e, t, a); +}, Qa = function(e, t, a) { + if (!t.cy().headless()) { + var n = t._private, i = n.rstyle, s = i.arrowWidth / 2, o = t.pstyle(a + "-arrow-shape").value, l, u; + if (o !== "none") { + a === "source" ? (l = i.srcX, u = i.srcY) : a === "target" ? (l = i.tgtX, u = i.tgtY) : (l = i.midX, u = i.midY); + var v = n.arrowBounds = n.arrowBounds || {}, f = v[a] = v[a] || {}; + f.x1 = l - s, f.y1 = u - s, f.x2 = l + s, f.y2 = u + s, f.w = f.x2 - f.x1, f.h = f.y2 - f.y1, sn(f, 1), Mr(e, f.x1, f.y1, f.x2, f.y2); + } + } +}, ds = function(e, t, a) { + if (!t.cy().headless()) { + var n; + a ? n = a + "-" : n = ""; + var i = t._private, s = i.rstyle, o = t.pstyle(n + "label").strValue; + if (o) { + var l = t.pstyle("text-halign"), u = t.pstyle("text-valign"), v = ua(s, "labelWidth", a), f = ua(s, "labelHeight", a), c = ua(s, "labelX", a), h = ua(s, "labelY", a), d = t.pstyle(n + "text-margin-x").pfValue, y = t.pstyle(n + "text-margin-y").pfValue, g = t.isEdge(), p = t.pstyle(n + "text-rotation"), m = t.pstyle("text-outline-width").pfValue, b = t.pstyle("text-border-width").pfValue, w = b / 2, E = t.pstyle("text-background-padding").pfValue, C = 2, x = f, k = v, S = k / 2, P = x / 2, D, A, B, R; + if (g) + D = c - S, A = c + S, B = h - P, R = h + P; + else { + switch (l.value) { + case "left": + D = c - k, A = c; + break; + case "center": + D = c - S, A = c + S; + break; + case "right": + D = c, A = c + k; + break; + } + switch (u.value) { + case "top": + B = h - x, R = h; + break; + case "center": + B = h - P, R = h + P; + break; + case "bottom": + B = h, R = h + x; + break; + } + } + var M = d - Math.max(m, w) - E - C, I = d + Math.max(m, w) + E + C, L = y - Math.max(m, w) - E - C, O = y + Math.max(m, w) + E + C; + D += M, A += I, B += L, R += O; + var V = a || "main", G = i.labelBounds, N = G[V] = G[V] || {}; + N.x1 = D, N.y1 = B, N.x2 = A, N.y2 = R, N.w = A - D, N.h = R - B, N.leftPad = M, N.rightPad = I, N.topPad = L, N.botPad = O; + var F = g && p.strValue === "autorotate", K = p.pfValue != null && p.pfValue !== 0; + if (F || K) { + var X = F ? ua(i.rstyle, "labelAngle", a) : p.pfValue, Q = Math.cos(X), Z = Math.sin(X), re = (D + A) / 2, ae = (B + R) / 2; + if (!g) { + switch (l.value) { + case "left": + re = A; + break; + case "right": + re = D; + break; + } + switch (u.value) { + case "top": + ae = R; + break; + case "bottom": + ae = B; + break; + } + } + var J = function(Ie, se) { + return Ie = Ie - re, se = se - ae, { + x: Ie * Q - se * Z + re, + y: Ie * Z + se * Q + ae + }; + }, z = J(D, B), q = J(D, R), H = J(A, B), ee = J(A, R); + D = Math.min(z.x, q.x, H.x, ee.x), A = Math.max(z.x, q.x, H.x, ee.x), B = Math.min(z.y, q.y, H.y, ee.y), R = Math.max(z.y, q.y, H.y, ee.y); + } + var ne = V + "Rot", be = G[ne] = G[ne] || {}; + be.x1 = D, be.y1 = B, be.x2 = A, be.y2 = R, be.w = A - D, be.h = R - B, Mr(e, D, B, A, R), Mr(i.labelBounds.all, D, B, A, R); + } + return e; + } +}, Mg = function(e, t) { + if (!t.cy().headless()) { + var a = t.pstyle("outline-opacity").value, n = t.pstyle("outline-width").value; + if (a > 0 && n > 0) { + var i = t.pstyle("outline-offset").value, s = t.pstyle("shape").value, o = n + i, l = (e.w + o * 2) / e.w, u = (e.h + o * 2) / e.h, v = 0, f = 0; + ["diamond", "pentagon", "round-triangle"].includes(s) ? (l = (e.w + o * 2.4) / e.w, f = -o / 3.6) : ["concave-hexagon", "rhomboid", "right-rhomboid"].includes(s) ? l = (e.w + o * 2.4) / e.w : s === "star" ? (l = (e.w + o * 2.8) / e.w, u = (e.h + o * 2.6) / e.h, f = -o / 3.8) : s === "triangle" ? (l = (e.w + o * 2.8) / e.w, u = (e.h + o * 2.4) / e.h, f = -o / 1.4) : s === "vee" && (l = (e.w + o * 4.4) / e.w, u = (e.h + o * 3.8) / e.h, f = -o * 0.5); + var c = e.h * u - e.h, h = e.w * l - e.w; + if (on(e, [Math.ceil(c / 2), Math.ceil(h / 2)]), v != 0 || f !== 0) { + var d = gd(e, v, f); + cv(e, d); + } + } + } +}, Lg = function(e, t) { + var a = e._private.cy, n = a.styleEnabled(), i = a.headless(), s = Sr(), o = e._private, l = e.isNode(), u = e.isEdge(), v, f, c, h, d, y, g = o.rstyle, p = l && n ? e.pstyle("bounds-expansion").pfValue : [0], m = function(_e) { + return _e.pstyle("display").value !== "none"; + }, b = !n || m(e) && (!u || m(e.source()) && m(e.target())); + if (b) { + var w = 0, E = 0; + n && t.includeOverlays && (w = e.pstyle("overlay-opacity").value, w !== 0 && (E = e.pstyle("overlay-padding").value)); + var C = 0, x = 0; + n && t.includeUnderlays && (C = e.pstyle("underlay-opacity").value, C !== 0 && (x = e.pstyle("underlay-padding").value)); + var k = Math.max(E, x), S = 0, P = 0; + if (n && (S = e.pstyle("width").pfValue, P = S / 2), l && t.includeNodes) { + var D = e.position(); + d = D.x, y = D.y; + var A = e.outerWidth(), B = A / 2, R = e.outerHeight(), M = R / 2; + v = d - B, f = d + B, c = y - M, h = y + M, Mr(s, v, c, f, h), n && t.includeOutlines && Mg(s, e); + } else if (u && t.includeEdges) + if (n && !i) { + var I = e.pstyle("curve-style").strValue; + if (v = Math.min(g.srcX, g.midX, g.tgtX), f = Math.max(g.srcX, g.midX, g.tgtX), c = Math.min(g.srcY, g.midY, g.tgtY), h = Math.max(g.srcY, g.midY, g.tgtY), v -= P, f += P, c -= P, h += P, Mr(s, v, c, f, h), I === "haystack") { + var L = g.haystackPts; + if (L && L.length === 2) { + if (v = L[0].x, c = L[0].y, f = L[1].x, h = L[1].y, v > f) { + var O = v; + v = f, f = O; + } + if (c > h) { + var V = c; + c = h, h = V; + } + Mr(s, v - P, c - P, f + P, h + P); + } + } else if (I === "bezier" || I === "unbundled-bezier" || I.endsWith("segments") || I.endsWith("taxi")) { + var G; + switch (I) { + case "bezier": + case "unbundled-bezier": + G = g.bezierPts; + break; + case "segments": + case "taxi": + case "round-segments": + case "round-taxi": + G = g.linePts; + break; + } + if (G != null) + for (var N = 0; N < G.length; N++) { + var F = G[N]; + v = F.x - P, f = F.x + P, c = F.y - P, h = F.y + P, Mr(s, v, c, f, h); + } + } + } else { + var K = e.source(), X = K.position(), Q = e.target(), Z = Q.position(); + if (v = X.x, f = Z.x, c = X.y, h = Z.y, v > f) { + var re = v; + v = f, f = re; + } + if (c > h) { + var ae = c; + c = h, h = ae; + } + v -= P, f += P, c -= P, h += P, Mr(s, v, c, f, h); + } + if (n && t.includeEdges && u && (Qa(s, e, "mid-source"), Qa(s, e, "mid-target"), Qa(s, e, "source"), Qa(s, e, "target")), n) { + var J = e.pstyle("ghost").value === "yes"; + if (J) { + var z = e.pstyle("ghost-offset-x").pfValue, q = e.pstyle("ghost-offset-y").pfValue; + Mr(s, s.x1 + z, s.y1 + q, s.x2 + z, s.y2 + q); + } + } + var H = o.bodyBounds = o.bodyBounds || {}; + Ho(H, s), on(H, p), sn(H, 1), n && (v = s.x1, f = s.x2, c = s.y1, h = s.y2, Mr(s, v - k, c - k, f + k, h + k)); + var ee = o.overlayBounds = o.overlayBounds || {}; + Ho(ee, s), on(ee, p), sn(ee, 1); + var ne = o.labelBounds = o.labelBounds || {}; + ne.all != null ? hd(ne.all) : ne.all = Sr(), n && t.includeLabels && (t.includeMainLabels && ds(s, e, null), u && (t.includeSourceLabels && ds(s, e, "source"), t.includeTargetLabels && ds(s, e, "target"))); + } + return s.x1 = Br(s.x1), s.y1 = Br(s.y1), s.x2 = Br(s.x2), s.y2 = Br(s.y2), s.w = Br(s.x2 - s.x1), s.h = Br(s.y2 - s.y1), s.w > 0 && s.h > 0 && b && (on(s, p), sn(s, 1)), s; +}, zv = function(e) { + var t = 0, a = function(s) { + return (s ? 1 : 0) << t++; + }, n = 0; + return n += a(e.incudeNodes), n += a(e.includeEdges), n += a(e.includeLabels), n += a(e.includeMainLabels), n += a(e.includeSourceLabels), n += a(e.includeTargetLabels), n += a(e.includeOverlays), n += a(e.includeOutlines), n; +}, Fv = function(e) { + var t = function(o) { + return Math.round(o); + }; + if (e.isEdge()) { + var a = e.source().position(), n = e.target().position(); + return zo([t(a.x), t(a.y), t(n.x), t(n.y)]); + } else { + var i = e.position(); + return zo([t(i.x), t(i.y)]); + } +}, al = function(e, t) { + var a = e._private, n, i = e.isEdge(), s = t == null ? nl : zv(t), o = s === nl; + if (a.bbCache == null ? (n = Lg(e, Da), a.bbCache = n, a.bbCachePosKey = Fv(e)) : n = a.bbCache, !o) { + var l = e.isNode(); + n = Sr(), (t.includeNodes && l || t.includeEdges && !l) && (t.includeOverlays ? bt(n, a.overlayBounds) : bt(n, a.bodyBounds)), t.includeLabels && (t.includeMainLabels && (!i || t.includeSourceLabels && t.includeTargetLabels) ? bt(n, a.labelBounds.all) : (t.includeMainLabels && bt(n, a.labelBounds.mainRot), t.includeSourceLabels && bt(n, a.labelBounds.sourceRot), t.includeTargetLabels && bt(n, a.labelBounds.targetRot))), n.w = n.x2 - n.x1, n.h = n.y2 - n.y1; + } + return n; +}, Da = { + includeNodes: !0, + includeEdges: !0, + includeLabels: !0, + includeMainLabels: !0, + includeSourceLabels: !0, + includeTargetLabels: !0, + includeOverlays: !0, + includeUnderlays: !0, + includeOutlines: !0, + useCache: !0 +}, nl = zv(Da), il = fr(Da); +ct.boundingBox = function(r) { + var e, t = r === void 0 || r.useCache === void 0 || r.useCache === !0, a = Yt(function(v) { + var f = v._private; + return f.bbCache == null || f.styleDirty || f.bbCachePosKey !== Fv(v); + }, function(v) { + return v.id(); + }); + if (t && this.length === 1 && !a(this[0])) + r === void 0 ? r = Da : r = il(r), e = al(this[0], r); + else { + e = Sr(), r = r || Da; + var n = il(r), i = this, s = i.cy(), o = s.styleEnabled(); + this.edges().forEach(a), this.nodes().forEach(a), o && this.recalculateRenderedStyle(t), this.updateCompoundBounds(!t); + for (var l = 0; l < i.length; l++) { + var u = i[l]; + a(u) && u.dirtyBoundingBoxCache(), bt(e, al(u, n)); + } + } + return e.x1 = Br(e.x1), e.y1 = Br(e.y1), e.x2 = Br(e.x2), e.y2 = Br(e.y2), e.w = Br(e.x2 - e.x1), e.h = Br(e.y2 - e.y1), e; +}; +ct.dirtyBoundingBoxCache = function() { + for (var r = 0; r < this.length; r++) { + var e = this[r]._private; + e.bbCache = null, e.bbCachePosKey = null, e.bodyBounds = null, e.overlayBounds = null, e.labelBounds.all = null, e.labelBounds.source = null, e.labelBounds.target = null, e.labelBounds.main = null, e.labelBounds.sourceRot = null, e.labelBounds.targetRot = null, e.labelBounds.mainRot = null, e.arrowBounds.source = null, e.arrowBounds.target = null, e.arrowBounds["mid-source"] = null, e.arrowBounds["mid-target"] = null; + } + return this.emitAndNotify("bounds"), this; +}; +ct.boundingBoxAt = function(r) { + var e = this.nodes(), t = this.cy(), a = t.hasCompoundNodes(), n = t.collection(); + if (a && (n = e.filter(function(u) { + return u.isParent(); + }), e = e.not(n)), Pe(r)) { + var i = r; + r = function() { + return i; + }; + } + var s = function(v, f) { + return v._private.bbAtOldPos = r(v, f); + }, o = function(v) { + return v._private.bbAtOldPos; + }; + t.startBatch(), e.forEach(s).silentPositions(r), a && (n.dirtyCompoundBoundsCache(), n.dirtyBoundingBoxCache(), n.updateCompoundBounds(!0)); + var l = dd(this.boundingBox({ + useCache: !1 + })); + return e.silentPositions(o), a && (n.dirtyCompoundBoundsCache(), n.dirtyBoundingBoxCache(), n.updateCompoundBounds(!0)), t.endBatch(), l; +}; +Kt.boundingbox = Kt.bb = Kt.boundingBox; +Kt.renderedBoundingbox = Kt.renderedBoundingBox; +var Ig = ct, ga, za; +ga = za = {}; +var Vv = function(e) { + e.uppercaseName = Eo(e.name), e.autoName = "auto" + e.uppercaseName, e.labelName = "label" + e.uppercaseName, e.outerName = "outer" + e.uppercaseName, e.uppercaseOuterName = Eo(e.outerName), ga[e.name] = function() { + var a = this[0], n = a._private, i = n.cy, s = i._private.styleEnabled; + if (a) + if (s) { + if (a.isParent()) + return a.updateCompoundBounds(), n[e.autoName] || 0; + var o = a.pstyle(e.name); + switch (o.strValue) { + case "label": + return a.recalculateRenderedStyle(), n.rstyle[e.labelName] || 0; + default: + return o.pfValue; + } + } else + return 1; + }, ga["outer" + e.uppercaseName] = function() { + var a = this[0], n = a._private, i = n.cy, s = i._private.styleEnabled; + if (a) + if (s) { + var o = a[e.name](), l = a.pstyle("border-position").value, u; + l === "center" ? u = a.pstyle("border-width").pfValue : l === "outside" ? u = 2 * a.pstyle("border-width").pfValue : u = 0; + var v = 2 * a.padding(); + return o + u + v; + } else + return 1; + }, ga["rendered" + e.uppercaseName] = function() { + var a = this[0]; + if (a) { + var n = a[e.name](); + return n * this.cy().zoom(); + } + }, ga["rendered" + e.uppercaseOuterName] = function() { + var a = this[0]; + if (a) { + var n = a[e.outerName](); + return n * this.cy().zoom(); + } + }; +}; +Vv({ + name: "width" +}); +Vv({ + name: "height" +}); +za.padding = function() { + var r = this[0], e = r._private; + return r.isParent() ? (r.updateCompoundBounds(), e.autoPadding !== void 0 ? e.autoPadding : r.pstyle("padding").pfValue) : r.pstyle("padding").pfValue; +}; +za.paddedHeight = function() { + var r = this[0]; + return r.height() + 2 * r.padding(); +}; +za.paddedWidth = function() { + var r = this[0]; + return r.width() + 2 * r.padding(); +}; +var Og = za, Ng = function(e, t) { + if (e.isEdge() && e.takesUpSpace()) + return t(e); +}, zg = function(e, t) { + if (e.isEdge() && e.takesUpSpace()) { + var a = e.cy(); + return Ln(t(e), a.zoom(), a.pan()); + } +}, Fg = function(e, t) { + if (e.isEdge() && e.takesUpSpace()) { + var a = e.cy(), n = a.pan(), i = a.zoom(); + return t(e).map(function(s) { + return Ln(s, i, n); + }); + } +}, Vg = function(e) { + return e.renderer().getControlPoints(e); +}, qg = function(e) { + return e.renderer().getSegmentPoints(e); +}, _g = function(e) { + return e.renderer().getSourceEndpoint(e); +}, Gg = function(e) { + return e.renderer().getTargetEndpoint(e); +}, Hg = function(e) { + return e.renderer().getEdgeMidpoint(e); +}, sl = { + controlPoints: { + get: Vg, + mult: !0 + }, + segmentPoints: { + get: qg, + mult: !0 + }, + sourceEndpoint: { + get: _g + }, + targetEndpoint: { + get: Gg + }, + midpoint: { + get: Hg + } +}, Wg = function(e) { + return "rendered" + e[0].toUpperCase() + e.substr(1); +}, Ug = Object.keys(sl).reduce(function(r, e) { + var t = sl[e], a = Wg(e); + return r[e] = function() { + return Ng(this, t.get); + }, t.mult ? r[a] = function() { + return Fg(this, t.get); + } : r[a] = function() { + return zg(this, t.get); + }, r; +}, {}), $g = he({}, Rg, Ig, Og, Ug); +/*! +Event object based on jQuery events, MIT license + +https://jquery.org/license/ +https://tldrlegal.com/license/mit-license +https://github.com/jquery/jquery/blob/master/src/event.js +*/ +var qv = function(e, t) { + this.recycle(e, t); +}; +function la() { + return !1; +} +function Ja() { + return !0; +} +qv.prototype = { + instanceString: function() { + return "event"; + }, + recycle: function(e, t) { + if (this.isImmediatePropagationStopped = this.isPropagationStopped = this.isDefaultPrevented = la, e != null && e.preventDefault ? (this.type = e.type, this.isDefaultPrevented = e.defaultPrevented ? Ja : la) : e != null && e.type ? t = e : this.type = e, t != null && (this.originalEvent = t.originalEvent, this.type = t.type != null ? t.type : this.type, this.cy = t.cy, this.target = t.target, this.position = t.position, this.renderedPosition = t.renderedPosition, this.namespace = t.namespace, this.layout = t.layout), this.cy != null && this.position != null && this.renderedPosition == null) { + var a = this.position, n = this.cy.zoom(), i = this.cy.pan(); + this.renderedPosition = { + x: a.x * n + i.x, + y: a.y * n + i.y + }; + } + this.timeStamp = e && e.timeStamp || Date.now(); + }, + preventDefault: function() { + this.isDefaultPrevented = Ja; + var e = this.originalEvent; + e && e.preventDefault && e.preventDefault(); + }, + stopPropagation: function() { + this.isPropagationStopped = Ja; + var e = this.originalEvent; + e && e.stopPropagation && e.stopPropagation(); + }, + stopImmediatePropagation: function() { + this.isImmediatePropagationStopped = Ja, this.stopPropagation(); + }, + isDefaultPrevented: la, + isPropagationStopped: la, + isImmediatePropagationStopped: la +}; +var _v = /^([^.]+)(\.(?:[^.]+))?$/, Kg = ".*", Gv = { + qualifierCompare: function(e, t) { + return e === t; + }, + eventMatches: function() { + return !0; + }, + addEventFields: function() { + }, + callbackContext: function(e) { + return e; + }, + beforeEmit: function() { + }, + afterEmit: function() { + }, + bubble: function() { + return !1; + }, + parent: function() { + return null; + }, + context: null +}, ol = Object.keys(Gv), Yg = {}; +function qn() { + for (var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Yg, e = arguments.length > 1 ? arguments[1] : void 0, t = 0; t < ol.length; t++) { + var a = ol[t]; + this[a] = r[a] || Gv[a]; + } + this.context = e || this.context, this.listeners = [], this.emitting = 0; +} +var lt = qn.prototype, Hv = function(e, t, a, n, i, s, o) { + We(n) && (i = n, n = null), o && (s == null ? s = o : s = he({}, s, o)); + for (var l = Fe(a) ? a : a.split(/\s+/), u = 0; u < l.length; u++) { + var v = l[u]; + if (!nt(v)) { + var f = v.match(_v); + if (f) { + var c = f[1], h = f[2] ? f[2] : null, d = t(e, v, c, h, n, i, s); + if (d === !1) + break; + } + } + } +}, ul = function(e, t) { + return e.addEventFields(e.context, t), new qv(t.type, t); +}, Xg = function(e, t, a) { + if (nc(a)) { + t(e, a); + return; + } else if (Pe(a)) { + t(e, ul(e, a)); + return; + } + for (var n = Fe(a) ? a : a.split(/\s+/), i = 0; i < n.length; i++) { + var s = n[i]; + if (!nt(s)) { + var o = s.match(_v); + if (o) { + var l = o[1], u = o[2] ? o[2] : null, v = ul(e, { + type: l, + namespace: u, + target: e.context + }); + t(e, v); + } + } + } +}; +lt.on = lt.addListener = function(r, e, t, a, n) { + return Hv(this, function(i, s, o, l, u, v, f) { + We(v) && i.listeners.push({ + event: s, + // full event string + callback: v, + // callback to run + type: o, + // the event type (e.g. 'click') + namespace: l, + // the event namespace (e.g. ".foo") + qualifier: u, + // a restriction on whether to match this emitter + conf: f + // additional configuration + }); + }, r, e, t, a, n), this; +}; +lt.one = function(r, e, t, a) { + return this.on(r, e, t, a, { + one: !0 + }); +}; +lt.removeListener = lt.off = function(r, e, t, a) { + var n = this; + this.emitting !== 0 && (this.listeners = zc(this.listeners)); + for (var i = this.listeners, s = function(u) { + var v = i[u]; + Hv(n, function(f, c, h, d, y, g) { + if ((v.type === h || r === "*") && (!d && v.namespace !== ".*" || v.namespace === d) && (!y || f.qualifierCompare(v.qualifier, y)) && (!g || v.callback === g)) + return i.splice(u, 1), !1; + }, r, e, t, a); + }, o = i.length - 1; o >= 0; o--) + s(o); + return this; +}; +lt.removeAllListeners = function() { + return this.removeListener("*"); +}; +lt.emit = lt.trigger = function(r, e, t) { + var a = this.listeners, n = a.length; + return this.emitting++, Fe(e) || (e = [e]), Xg(this, function(i, s) { + t != null && (a = [{ + event: s.event, + type: s.type, + namespace: s.namespace, + callback: t + }], n = a.length); + for (var o = function() { + var v = a[l]; + if (v.type === s.type && (!v.namespace || v.namespace === s.namespace || v.namespace === Kg) && i.eventMatches(i.context, v, s)) { + var f = [s]; + e != null && Vc(f, e), i.beforeEmit(i.context, v, s), v.conf && v.conf.one && (i.listeners = i.listeners.filter(function(d) { + return d !== v; + })); + var c = i.callbackContext(i.context, v, s), h = v.callback.apply(c, f); + i.afterEmit(i.context, v, s), h === !1 && (s.stopPropagation(), s.preventDefault()); + } + }, l = 0; l < n; l++) + o(); + i.bubble(i.context) && !s.isPropagationStopped() && i.parent(i.context).emit(s, e); + }, r), this.emitting--, this; +}; +var Zg = { + qualifierCompare: function(e, t) { + return e == null || t == null ? e == null && t == null : e.sameText(t); + }, + eventMatches: function(e, t, a) { + var n = t.qualifier; + return n != null ? e !== a.target && Ra(a.target) && n.matches(a.target) : !0; + }, + addEventFields: function(e, t) { + t.cy = e.cy(), t.target = e; + }, + callbackContext: function(e, t, a) { + return t.qualifier != null ? a.target : e; + }, + beforeEmit: function(e, t) { + t.conf && t.conf.once && t.conf.onceCollection.removeListener(t.event, t.qualifier, t.callback); + }, + bubble: function() { + return !0; + }, + parent: function(e) { + return e.isChild() ? e.parent() : e.cy(); + } +}, ja = function(e) { + return fe(e) ? new ot(e) : e; +}, Wv = { + createEmitter: function() { + for (var e = 0; e < this.length; e++) { + var t = this[e], a = t._private; + a.emitter || (a.emitter = new qn(Zg, t)); + } + return this; + }, + emitter: function() { + return this._private.emitter; + }, + on: function(e, t, a) { + for (var n = ja(t), i = 0; i < this.length; i++) { + var s = this[i]; + s.emitter().on(e, n, a); + } + return this; + }, + removeListener: function(e, t, a) { + for (var n = ja(t), i = 0; i < this.length; i++) { + var s = this[i]; + s.emitter().removeListener(e, n, a); + } + return this; + }, + removeAllListeners: function() { + for (var e = 0; e < this.length; e++) { + var t = this[e]; + t.emitter().removeAllListeners(); + } + return this; + }, + one: function(e, t, a) { + for (var n = ja(t), i = 0; i < this.length; i++) { + var s = this[i]; + s.emitter().one(e, n, a); + } + return this; + }, + once: function(e, t, a) { + for (var n = ja(t), i = 0; i < this.length; i++) { + var s = this[i]; + s.emitter().on(e, n, a, { + once: !0, + onceCollection: this + }); + } + }, + emit: function(e, t) { + for (var a = 0; a < this.length; a++) { + var n = this[a]; + n.emitter().emit(e, t); + } + return this; + }, + emitAndNotify: function(e, t) { + if (this.length !== 0) + return this.cy().notify(e, this), this.emit(e, t), this; + } +}; +Me.eventAliasesOn(Wv); +var Uv = { + nodes: function(e) { + return this.filter(function(t) { + return t.isNode(); + }).filter(e); + }, + edges: function(e) { + return this.filter(function(t) { + return t.isEdge(); + }).filter(e); + }, + // internal helper to get nodes and edges as separate collections with single iteration over elements + byGroup: function() { + for (var e = this.spawn(), t = this.spawn(), a = 0; a < this.length; a++) { + var n = this[a]; + n.isNode() ? e.push(n) : t.push(n); + } + return { + nodes: e, + edges: t + }; + }, + filter: function(e, t) { + if (e === void 0) + return this; + if (fe(e) || Dr(e)) + return new ot(e).filter(this); + if (We(e)) { + for (var a = this.spawn(), n = this, i = 0; i < n.length; i++) { + var s = n[i], o = t ? e.apply(t, [s, i, n]) : e(s, i, n); + o && a.push(s); + } + return a; + } + return this.spawn(); + }, + not: function(e) { + if (e) { + fe(e) && (e = this.filter(e)); + for (var t = this.spawn(), a = 0; a < this.length; a++) { + var n = this[a], i = e.has(n); + i || t.push(n); + } + return t; + } else + return this; + }, + absoluteComplement: function() { + var e = this.cy(); + return e.mutableElements().not(this); + }, + intersect: function(e) { + if (fe(e)) { + var t = e; + return this.filter(t); + } + for (var a = this.spawn(), n = this, i = e, s = this.length < e.length, o = s ? n : i, l = s ? i : n, u = 0; u < o.length; u++) { + var v = o[u]; + l.has(v) && a.push(v); + } + return a; + }, + xor: function(e) { + var t = this._private.cy; + fe(e) && (e = t.$(e)); + var a = this.spawn(), n = this, i = e, s = function(l, u) { + for (var v = 0; v < l.length; v++) { + var f = l[v], c = f._private.data.id, h = u.hasElementWithId(c); + h || a.push(f); + } + }; + return s(n, i), s(i, n), a; + }, + diff: function(e) { + var t = this._private.cy; + fe(e) && (e = t.$(e)); + var a = this.spawn(), n = this.spawn(), i = this.spawn(), s = this, o = e, l = function(v, f, c) { + for (var h = 0; h < v.length; h++) { + var d = v[h], y = d._private.data.id, g = f.hasElementWithId(y); + g ? i.merge(d) : c.push(d); + } + }; + return l(s, o, a), l(o, s, n), { + left: a, + right: n, + both: i + }; + }, + add: function(e) { + var t = this._private.cy; + if (!e) + return this; + if (fe(e)) { + var a = e; + e = t.mutableElements().filter(a); + } + for (var n = this.spawnSelf(), i = 0; i < e.length; i++) { + var s = e[i], o = !this.has(s); + o && n.push(s); + } + return n; + }, + // in place merge on calling collection + merge: function(e) { + var t = this._private, a = t.cy; + if (!e) + return this; + if (e && fe(e)) { + var n = e; + e = a.mutableElements().filter(n); + } + for (var i = t.map, s = 0; s < e.length; s++) { + var o = e[s], l = o._private.data.id, u = !i.has(l); + if (u) { + var v = this.length++; + this[v] = o, i.set(l, { + ele: o, + index: v + }); + } + } + return this; + }, + unmergeAt: function(e) { + var t = this[e], a = t.id(), n = this._private, i = n.map; + this[e] = void 0, i.delete(a); + var s = e === this.length - 1; + if (this.length > 1 && !s) { + var o = this.length - 1, l = this[o], u = l._private.data.id; + this[o] = void 0, this[e] = l, i.set(u, { + ele: l, + index: e + }); + } + return this.length--, this; + }, + // remove single ele in place in calling collection + unmergeOne: function(e) { + e = e[0]; + var t = this._private, a = e._private.data.id, n = t.map, i = n.get(a); + if (!i) + return this; + var s = i.index; + return this.unmergeAt(s), this; + }, + // remove eles in place on calling collection + unmerge: function(e) { + var t = this._private.cy; + if (!e) + return this; + if (e && fe(e)) { + var a = e; + e = t.mutableElements().filter(a); + } + for (var n = 0; n < e.length; n++) + this.unmergeOne(e[n]); + return this; + }, + unmergeBy: function(e) { + for (var t = this.length - 1; t >= 0; t--) { + var a = this[t]; + e(a) && this.unmergeAt(t); + } + return this; + }, + map: function(e, t) { + for (var a = [], n = this, i = 0; i < n.length; i++) { + var s = n[i], o = t ? e.apply(t, [s, i, n]) : e(s, i, n); + a.push(o); + } + return a; + }, + reduce: function(e, t) { + for (var a = t, n = this, i = 0; i < n.length; i++) + a = e(a, n[i], i, n); + return a; + }, + max: function(e, t) { + for (var a = -1 / 0, n, i = this, s = 0; s < i.length; s++) { + var o = i[s], l = t ? e.apply(t, [o, s, i]) : e(o, s, i); + l > a && (a = l, n = o); + } + return { + value: a, + ele: n + }; + }, + min: function(e, t) { + for (var a = 1 / 0, n, i = this, s = 0; s < i.length; s++) { + var o = i[s], l = t ? e.apply(t, [o, s, i]) : e(o, s, i); + l < a && (a = l, n = o); + } + return { + value: a, + ele: n + }; + } +}, Re = Uv; +Re.u = Re["|"] = Re["+"] = Re.union = Re.or = Re.add; +Re["\\"] = Re["!"] = Re["-"] = Re.difference = Re.relativeComplement = Re.subtract = Re.not; +Re.n = Re["&"] = Re["."] = Re.and = Re.intersection = Re.intersect; +Re["^"] = Re["(+)"] = Re["(-)"] = Re.symmetricDifference = Re.symdiff = Re.xor; +Re.fnFilter = Re.filterFn = Re.stdFilter = Re.filter; +Re.complement = Re.abscomp = Re.absoluteComplement; +var Qg = { + isNode: function() { + return this.group() === "nodes"; + }, + isEdge: function() { + return this.group() === "edges"; + }, + isLoop: function() { + return this.isEdge() && this.source()[0] === this.target()[0]; + }, + isSimple: function() { + return this.isEdge() && this.source()[0] !== this.target()[0]; + }, + group: function() { + var e = this[0]; + if (e) + return e._private.group; + } +}, $v = function(e, t) { + var a = e.cy(), n = a.hasCompoundNodes(); + function i(v) { + var f = v.pstyle("z-compound-depth"); + return f.value === "auto" ? n ? v.zDepth() : 0 : f.value === "bottom" ? -1 : f.value === "top" ? Xs : 0; + } + var s = i(e) - i(t); + if (s !== 0) + return s; + function o(v) { + var f = v.pstyle("z-index-compare"); + return f.value === "auto" && v.isNode() ? 1 : 0; + } + var l = o(e) - o(t); + if (l !== 0) + return l; + var u = e.pstyle("z-index").value - t.pstyle("z-index").value; + return u !== 0 ? u : e.poolIndex() - t.poolIndex(); +}, Cn = { + forEach: function(e, t) { + if (We(e)) + for (var a = this.length, n = 0; n < a; n++) { + var i = this[n], s = t ? e.apply(t, [i, n, this]) : e(i, n, this); + if (s === !1) + break; + } + return this; + }, + toArray: function() { + for (var e = [], t = 0; t < this.length; t++) + e.push(this[t]); + return e; + }, + slice: function(e, t) { + var a = [], n = this.length; + t == null && (t = n), e == null && (e = 0), e < 0 && (e = n + e), t < 0 && (t = n + t); + for (var i = e; i >= 0 && i < t && i < n; i++) + a.push(this[i]); + return this.spawn(a); + }, + size: function() { + return this.length; + }, + eq: function(e) { + return this[e] || this.spawn(); + }, + first: function() { + return this[0] || this.spawn(); + }, + last: function() { + return this[this.length - 1] || this.spawn(); + }, + empty: function() { + return this.length === 0; + }, + nonempty: function() { + return !this.empty(); + }, + sort: function(e) { + if (!We(e)) + return this; + var t = this.toArray().sort(e); + return this.spawn(t); + }, + sortByZIndex: function() { + return this.sort($v); + }, + zDepth: function() { + var e = this[0]; + if (e) { + var t = e._private, a = t.group; + if (a === "nodes") { + var n = t.data.parent ? e.parents().size() : 0; + return e.isParent() ? n : Xs - 1; + } else { + var i = t.source, s = t.target, o = i.zDepth(), l = s.zDepth(); + return Math.max(o, l, 0); + } + } + } +}; +Cn.each = Cn.forEach; +var Jg = function() { + var e = "undefined", t = (typeof Symbol > "u" ? "undefined" : rr(Symbol)) != e && rr(Symbol.iterator) != e; + t && (Cn[Symbol.iterator] = function() { + var a = this, n = { + value: void 0, + done: !1 + }, i = 0, s = this.length; + return $l({ + next: function() { + return i < s ? n.value = a[i++] : (n.value = void 0, n.done = !0), n; + } + }, Symbol.iterator, function() { + return this; + }); + }); +}; +Jg(); +var jg = fr({ + nodeDimensionsIncludeLabels: !1 +}), ln = { + // Calculates and returns node dimensions { x, y } based on options given + layoutDimensions: function(e) { + e = jg(e); + var t; + if (!this.takesUpSpace()) + t = { + w: 0, + h: 0 + }; + else if (e.nodeDimensionsIncludeLabels) { + var a = this.boundingBox(); + t = { + w: a.w, + h: a.h + }; + } else + t = { + w: this.outerWidth(), + h: this.outerHeight() + }; + return (t.w === 0 || t.h === 0) && (t.w = t.h = 1), t; + }, + // using standard layout options, apply position function (w/ or w/o animation) + layoutPositions: function(e, t, a) { + var n = this.nodes().filter(function(E) { + return !E.isParent(); + }), i = this.cy(), s = t.eles, o = function(C) { + return C.id(); + }, l = Yt(a, o); + e.emit({ + type: "layoutstart", + layout: e + }), e.animations = []; + var u = function(C, x, k) { + var S = { + x: x.x1 + x.w / 2, + y: x.y1 + x.h / 2 + }, P = { + // scale from center of bounding box (not necessarily 0,0) + x: (k.x - S.x) * C, + y: (k.y - S.y) * C + }; + return { + x: S.x + P.x, + y: S.y + P.y + }; + }, v = t.spacingFactor && t.spacingFactor !== 1, f = function() { + if (!v) + return null; + for (var C = Sr(), x = 0; x < n.length; x++) { + var k = n[x], S = l(k, x); + pd(C, S.x, S.y); + } + return C; + }, c = f(), h = Yt(function(E, C) { + var x = l(E, C); + if (v) { + var k = Math.abs(t.spacingFactor); + x = u(k, c, x); + } + return t.transform != null && (x = t.transform(E, x)), x; + }, o); + if (t.animate) { + for (var d = 0; d < n.length; d++) { + var y = n[d], g = h(y, d), p = t.animateFilter == null || t.animateFilter(y, d); + if (p) { + var m = y.animation({ + position: g, + duration: t.animationDuration, + easing: t.animationEasing + }); + e.animations.push(m); + } else + y.position(g); + } + if (t.fit) { + var b = i.animation({ + fit: { + boundingBox: s.boundingBoxAt(h), + padding: t.padding + }, + duration: t.animationDuration, + easing: t.animationEasing + }); + e.animations.push(b); + } else if (t.zoom !== void 0 && t.pan !== void 0) { + var w = i.animation({ + zoom: t.zoom, + pan: t.pan, + duration: t.animationDuration, + easing: t.animationEasing + }); + e.animations.push(w); + } + e.animations.forEach(function(E) { + return E.play(); + }), e.one("layoutready", t.ready), e.emit({ + type: "layoutready", + layout: e + }), ea.all(e.animations.map(function(E) { + return E.promise(); + })).then(function() { + e.one("layoutstop", t.stop), e.emit({ + type: "layoutstop", + layout: e + }); + }); + } else + n.positions(h), t.fit && i.fit(t.eles, t.padding), t.zoom != null && i.zoom(t.zoom), t.pan && i.pan(t.pan), e.one("layoutready", t.ready), e.emit({ + type: "layoutready", + layout: e + }), e.one("layoutstop", t.stop), e.emit({ + type: "layoutstop", + layout: e + }); + return this; + }, + layout: function(e) { + var t = this.cy(); + return t.makeLayout(he({}, e, { + eles: this + })); + } +}; +ln.createLayout = ln.makeLayout = ln.layout; +function Kv(r, e, t) { + var a = t._private, n = a.styleCache = a.styleCache || [], i; + return (i = n[r]) != null || (i = n[r] = e(t)), i; +} +function _n(r, e) { + return r = Tt(r), function(a) { + return Kv(r, e, a); + }; +} +function Gn(r, e) { + r = Tt(r); + var t = function(n) { + return e.call(n); + }; + return function() { + var n = this[0]; + if (n) + return Kv(r, t, n); + }; +} +var lr = { + recalculateRenderedStyle: function(e) { + var t = this.cy(), a = t.renderer(), n = t.styleEnabled(); + return a && n && a.recalculateRenderedStyle(this, e), this; + }, + dirtyStyleCache: function() { + var e = this.cy(), t = function(i) { + return i._private.styleCache = null; + }; + if (e.hasCompoundNodes()) { + var a; + a = this.spawnSelf().merge(this.descendants()).merge(this.parents()), a.merge(a.connectedEdges()), a.forEach(t); + } else + this.forEach(function(n) { + t(n), n.connectedEdges().forEach(t); + }); + return this; + }, + // fully updates (recalculates) the style for the elements + updateStyle: function(e) { + var t = this._private.cy; + if (!t.styleEnabled()) + return this; + if (t.batching()) { + var a = t._private.batchStyleEles; + return a.merge(this), this; + } + var n = t.hasCompoundNodes(), i = this; + e = !!(e || e === void 0), n && (i = this.spawnSelf().merge(this.descendants()).merge(this.parents())); + var s = i; + return e ? s.emitAndNotify("style") : s.emit("style"), i.forEach(function(o) { + return o._private.styleDirty = !0; + }), this; + }, + // private: clears dirty flag and recalculates style + cleanStyle: function() { + var e = this.cy(); + if (e.styleEnabled()) + for (var t = 0; t < this.length; t++) { + var a = this[t]; + a._private.styleDirty && (a._private.styleDirty = !1, e.style().apply(a)); + } + }, + // get the internal parsed style object for the specified property + parsedStyle: function(e) { + var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, a = this[0], n = a.cy(); + if (n.styleEnabled() && a) { + a._private.styleDirty && (a._private.styleDirty = !1, n.style().apply(a)); + var i = a._private.style[e]; + return i ?? (t ? n.style().getDefaultProperty(e) : null); + } + }, + numericStyle: function(e) { + var t = this[0]; + if (t.cy().styleEnabled() && t) { + var a = t.pstyle(e); + return a.pfValue !== void 0 ? a.pfValue : a.value; + } + }, + numericStyleUnits: function(e) { + var t = this[0]; + if (t.cy().styleEnabled() && t) + return t.pstyle(e).units; + }, + // get the specified css property as a rendered value (i.e. on-screen value) + // or get the whole rendered style if no property specified (NB doesn't allow setting) + renderedStyle: function(e) { + var t = this.cy(); + if (!t.styleEnabled()) + return this; + var a = this[0]; + if (a) + return t.style().getRenderedStyle(a, e); + }, + // read the calculated css style of the element or override the style (via a bypass) + style: function(e, t) { + var a = this.cy(); + if (!a.styleEnabled()) + return this; + var n = !1, i = a.style(); + if (Pe(e)) { + var s = e; + i.applyBypass(this, s, n), this.emitAndNotify("style"); + } else if (fe(e)) + if (t === void 0) { + var o = this[0]; + return o ? i.getStylePropertyValue(o, e) : void 0; + } else + i.applyBypass(this, e, t, n), this.emitAndNotify("style"); + else if (e === void 0) { + var l = this[0]; + return l ? i.getRawStyle(l) : void 0; + } + return this; + }, + removeStyle: function(e) { + var t = this.cy(); + if (!t.styleEnabled()) + return this; + var a = !1, n = t.style(), i = this; + if (e === void 0) + for (var s = 0; s < i.length; s++) { + var o = i[s]; + n.removeAllBypasses(o, a); + } + else { + e = e.split(/\s+/); + for (var l = 0; l < i.length; l++) { + var u = i[l]; + n.removeBypasses(u, e, a); + } + } + return this.emitAndNotify("style"), this; + }, + show: function() { + return this.css("display", "element"), this; + }, + hide: function() { + return this.css("display", "none"), this; + }, + effectiveOpacity: function() { + var e = this.cy(); + if (!e.styleEnabled()) + return 1; + var t = e.hasCompoundNodes(), a = this[0]; + if (a) { + var n = a._private, i = a.pstyle("opacity").value; + if (!t) + return i; + var s = n.data.parent ? a.parents() : null; + if (s) + for (var o = 0; o < s.length; o++) { + var l = s[o], u = l.pstyle("opacity").value; + i = u * i; + } + return i; + } + }, + transparent: function() { + var e = this.cy(); + if (!e.styleEnabled()) + return !1; + var t = this[0], a = t.cy().hasCompoundNodes(); + if (t) + return a ? t.effectiveOpacity() === 0 : t.pstyle("opacity").value === 0; + }, + backgrounding: function() { + var e = this.cy(); + if (!e.styleEnabled()) + return !1; + var t = this[0]; + return !!t._private.backgrounding; + } +}; +function hs(r, e) { + var t = r._private, a = t.data.parent ? r.parents() : null; + if (a) + for (var n = 0; n < a.length; n++) { + var i = a[n]; + if (!e(i)) + return !1; + } + return !0; +} +function oo(r) { + var e = r.ok, t = r.edgeOkViaNode || r.ok, a = r.parentOk || r.ok; + return function() { + var n = this.cy(); + if (!n.styleEnabled()) + return !0; + var i = this[0], s = n.hasCompoundNodes(); + if (i) { + var o = i._private; + if (!e(i)) + return !1; + if (i.isNode()) + return !s || hs(i, a); + var l = o.source, u = o.target; + return t(l) && (!s || hs(l, t)) && (l === u || t(u) && (!s || hs(u, t))); + } + }; +} +var ra = _n("eleTakesUpSpace", function(r) { + return r.pstyle("display").value === "element" && r.width() !== 0 && (r.isNode() ? r.height() !== 0 : !0); +}); +lr.takesUpSpace = Gn("takesUpSpace", oo({ + ok: ra +})); +var ep = _n("eleInteractive", function(r) { + return r.pstyle("events").value === "yes" && r.pstyle("visibility").value === "visible" && ra(r); +}), rp = _n("parentInteractive", function(r) { + return r.pstyle("visibility").value === "visible" && ra(r); +}); +lr.interactive = Gn("interactive", oo({ + ok: ep, + parentOk: rp, + edgeOkViaNode: ra +})); +lr.noninteractive = function() { + var r = this[0]; + if (r) + return !r.interactive(); +}; +var tp = _n("eleVisible", function(r) { + return r.pstyle("visibility").value === "visible" && r.pstyle("opacity").pfValue !== 0 && ra(r); +}), ap = ra; +lr.visible = Gn("visible", oo({ + ok: tp, + edgeOkViaNode: ap +})); +lr.hidden = function() { + var r = this[0]; + if (r) + return !r.visible(); +}; +lr.isBundledBezier = Gn("isBundledBezier", function() { + return this.cy().styleEnabled() ? !this.removed() && this.pstyle("curve-style").value === "bezier" && this.takesUpSpace() : !1; +}); +lr.bypass = lr.css = lr.style; +lr.renderedCss = lr.renderedStyle; +lr.removeBypass = lr.removeCss = lr.removeStyle; +lr.pstyle = lr.parsedStyle; +var at = {}; +function ll(r) { + return function() { + var e = arguments, t = []; + if (e.length === 2) { + var a = e[0], n = e[1]; + this.on(r.event, a, n); + } else if (e.length === 1 && We(e[0])) { + var i = e[0]; + this.on(r.event, i); + } else if (e.length === 0 || e.length === 1 && Fe(e[0])) { + for (var s = e.length === 1 ? e[0] : null, o = 0; o < this.length; o++) { + var l = this[o], u = !r.ableField || l._private[r.ableField], v = l._private[r.field] != r.value; + if (r.overrideAble) { + var f = r.overrideAble(l); + if (f !== void 0 && (u = f, !f)) + return this; + } + u && (l._private[r.field] = r.value, v && t.push(l)); + } + var c = this.spawn(t); + c.updateStyle(), c.emit(r.event), s && c.emit(s); + } + return this; + }; +} +function ta(r) { + at[r.field] = function() { + var e = this[0]; + if (e) { + if (r.overrideField) { + var t = r.overrideField(e); + if (t !== void 0) + return t; + } + return e._private[r.field]; + } + }, at[r.on] = ll({ + event: r.on, + field: r.field, + ableField: r.ableField, + overrideAble: r.overrideAble, + value: !0 + }), at[r.off] = ll({ + event: r.off, + field: r.field, + ableField: r.ableField, + overrideAble: r.overrideAble, + value: !1 + }); +} +ta({ + field: "locked", + overrideField: function(e) { + return e.cy().autolock() ? !0 : void 0; + }, + on: "lock", + off: "unlock" +}); +ta({ + field: "grabbable", + overrideField: function(e) { + return e.cy().autoungrabify() || e.pannable() ? !1 : void 0; + }, + on: "grabify", + off: "ungrabify" +}); +ta({ + field: "selected", + ableField: "selectable", + overrideAble: function(e) { + return e.cy().autounselectify() ? !1 : void 0; + }, + on: "select", + off: "unselect" +}); +ta({ + field: "selectable", + overrideField: function(e) { + return e.cy().autounselectify() ? !1 : void 0; + }, + on: "selectify", + off: "unselectify" +}); +at.deselect = at.unselect; +at.grabbed = function() { + var r = this[0]; + if (r) + return r._private.grabbed; +}; +ta({ + field: "active", + on: "activate", + off: "unactivate" +}); +ta({ + field: "pannable", + on: "panify", + off: "unpanify" +}); +at.inactive = function() { + var r = this[0]; + if (r) + return !r._private.active; +}; +var hr = {}, vl = function(e) { + return function(a) { + for (var n = this, i = [], s = 0; s < n.length; s++) { + var o = n[s]; + if (o.isNode()) { + for (var l = !1, u = o.connectedEdges(), v = 0; v < u.length; v++) { + var f = u[v], c = f.source(), h = f.target(); + if (e.noIncomingEdges && h === o && c !== o || e.noOutgoingEdges && c === o && h !== o) { + l = !0; + break; + } + } + l || i.push(o); + } + } + return this.spawn(i, !0).filter(a); + }; +}, fl = function(e) { + return function(t) { + for (var a = this, n = [], i = 0; i < a.length; i++) { + var s = a[i]; + if (s.isNode()) + for (var o = s.connectedEdges(), l = 0; l < o.length; l++) { + var u = o[l], v = u.source(), f = u.target(); + e.outgoing && v === s ? (n.push(u), n.push(f)) : e.incoming && f === s && (n.push(u), n.push(v)); + } + } + return this.spawn(n, !0).filter(t); + }; +}, cl = function(e) { + return function(t) { + for (var a = this, n = [], i = {}; ; ) { + var s = e.outgoing ? a.outgoers() : a.incomers(); + if (s.length === 0) + break; + for (var o = !1, l = 0; l < s.length; l++) { + var u = s[l], v = u.id(); + i[v] || (i[v] = !0, n.push(u), o = !0); + } + if (!o) + break; + a = s; + } + return this.spawn(n, !0).filter(t); + }; +}; +hr.clearTraversalCache = function() { + for (var r = 0; r < this.length; r++) + this[r]._private.traversalCache = null; +}; +he(hr, { + // get the root nodes in the DAG + roots: vl({ + noIncomingEdges: !0 + }), + // get the leaf nodes in the DAG + leaves: vl({ + noOutgoingEdges: !0 + }), + // normally called children in graph theory + // these nodes =edges=> outgoing nodes + outgoers: Pr(fl({ + outgoing: !0 + }), "outgoers"), + // aka DAG descendants + successors: cl({ + outgoing: !0 + }), + // normally called parents in graph theory + // these nodes <=edges= incoming nodes + incomers: Pr(fl({ + incoming: !0 + }), "incomers"), + // aka DAG ancestors + predecessors: cl({}) +}); +he(hr, { + neighborhood: Pr(function(r) { + for (var e = [], t = this.nodes(), a = 0; a < t.length; a++) + for (var n = t[a], i = n.connectedEdges(), s = 0; s < i.length; s++) { + var o = i[s], l = o.source(), u = o.target(), v = n === l ? u : l; + v.length > 0 && e.push(v[0]), e.push(o[0]); + } + return this.spawn(e, !0).filter(r); + }, "neighborhood"), + closedNeighborhood: function(e) { + return this.neighborhood().add(this).filter(e); + }, + openNeighborhood: function(e) { + return this.neighborhood(e); + } +}); +hr.neighbourhood = hr.neighborhood; +hr.closedNeighbourhood = hr.closedNeighborhood; +hr.openNeighbourhood = hr.openNeighborhood; +he(hr, { + source: Pr(function(e) { + var t = this[0], a; + return t && (a = t._private.source || t.cy().collection()), a && e ? a.filter(e) : a; + }, "source"), + target: Pr(function(e) { + var t = this[0], a; + return t && (a = t._private.target || t.cy().collection()), a && e ? a.filter(e) : a; + }, "target"), + sources: dl({ + attr: "source" + }), + targets: dl({ + attr: "target" + }) +}); +function dl(r) { + return function(t) { + for (var a = [], n = 0; n < this.length; n++) { + var i = this[n], s = i._private[r.attr]; + s && a.push(s); + } + return this.spawn(a, !0).filter(t); + }; +} +he(hr, { + edgesWith: Pr(hl(), "edgesWith"), + edgesTo: Pr(hl({ + thisIsSrc: !0 + }), "edgesTo") +}); +function hl(r) { + return function(t) { + var a = [], n = this._private.cy, i = r || {}; + fe(t) && (t = n.$(t)); + for (var s = 0; s < t.length; s++) + for (var o = t[s]._private.edges, l = 0; l < o.length; l++) { + var u = o[l], v = u._private.data, f = this.hasElementWithId(v.source) && t.hasElementWithId(v.target), c = t.hasElementWithId(v.source) && this.hasElementWithId(v.target), h = f || c; + h && ((i.thisIsSrc || i.thisIsTgt) && (i.thisIsSrc && !f || i.thisIsTgt && !c) || a.push(u)); + } + return this.spawn(a, !0); + }; +} +he(hr, { + connectedEdges: Pr(function(r) { + for (var e = [], t = this, a = 0; a < t.length; a++) { + var n = t[a]; + if (n.isNode()) + for (var i = n._private.edges, s = 0; s < i.length; s++) { + var o = i[s]; + e.push(o); + } + } + return this.spawn(e, !0).filter(r); + }, "connectedEdges"), + connectedNodes: Pr(function(r) { + for (var e = [], t = this, a = 0; a < t.length; a++) { + var n = t[a]; + n.isEdge() && (e.push(n.source()[0]), e.push(n.target()[0])); + } + return this.spawn(e, !0).filter(r); + }, "connectedNodes"), + parallelEdges: Pr(gl(), "parallelEdges"), + codirectedEdges: Pr(gl({ + codirected: !0 + }), "codirectedEdges") +}); +function gl(r) { + var e = { + codirected: !1 + }; + return r = he({}, e, r), function(a) { + for (var n = [], i = this.edges(), s = r, o = 0; o < i.length; o++) + for (var l = i[o], u = l._private, v = u.source, f = v._private.data.id, c = u.data.target, h = v._private.edges, d = 0; d < h.length; d++) { + var y = h[d], g = y._private.data, p = g.target, m = g.source, b = p === c && m === f, w = f === p && c === m; + (s.codirected && b || !s.codirected && (b || w)) && n.push(y); + } + return this.spawn(n, !0).filter(a); + }; +} +he(hr, { + components: function(e) { + var t = this, a = t.cy(), n = a.collection(), i = e == null ? t.nodes() : e.nodes(), s = []; + e != null && i.empty() && (i = e.sources()); + var o = function(v, f) { + n.merge(v), i.unmerge(v), f.merge(v); + }; + if (i.empty()) + return t.spawn(); + var l = function() { + var v = a.collection(); + s.push(v); + var f = i[0]; + o(f, v), t.bfs({ + directed: !1, + roots: f, + visit: function(h) { + return o(h, v); + } + }), v.forEach(function(c) { + c.connectedEdges().forEach(function(h) { + t.has(h) && v.has(h.source()) && v.has(h.target()) && v.merge(h); + }); + }); + }; + do + l(); + while (i.length > 0); + return s; + }, + component: function() { + var e = this[0]; + return e.cy().mutableElements().components(e)[0]; + } +}); +hr.componentsOf = hr.components; +var vr = function(e, t) { + var a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1; + if (e === void 0) { + He("A collection must have a reference to the core"); + return; + } + var i = new Kr(), s = !1; + if (!t) + t = []; + else if (t.length > 0 && Pe(t[0]) && !Ra(t[0])) { + s = !0; + for (var o = [], l = new jt(), u = 0, v = t.length; u < v; u++) { + var f = t[u]; + f.data == null && (f.data = {}); + var c = f.data; + if (c.id == null) + c.id = lv(); + else if (e.hasElementWithId(c.id) || l.has(c.id)) + continue; + var h = new Mn(e, f, !1); + o.push(h), l.add(c.id); + } + t = o; + } + this.length = 0; + for (var d = 0, y = t.length; d < y; d++) { + var g = t[d][0]; + if (g != null) { + var p = g._private.data.id; + (!a || !i.has(p)) && (a && i.set(p, { + index: this.length, + ele: g + }), this[this.length] = g, this.length++); + } + } + this._private = { + eles: this, + cy: e, + get map() { + return this.lazyMap == null && this.rebuildMap(), this.lazyMap; + }, + set map(m) { + this.lazyMap = m; + }, + rebuildMap: function() { + for (var b = this.lazyMap = new Kr(), w = this.eles, E = 0; E < w.length; E++) { + var C = w[E]; + b.set(C.id(), { + index: E, + ele: C + }); + } + } + }, a && (this._private.map = i), s && !n && this.restore(); +}, qe = Mn.prototype = vr.prototype = Object.create(Array.prototype); +qe.instanceString = function() { + return "collection"; +}; +qe.spawn = function(r, e) { + return new vr(this.cy(), r, e); +}; +qe.spawnSelf = function() { + return this.spawn(this); +}; +qe.cy = function() { + return this._private.cy; +}; +qe.renderer = function() { + return this._private.cy.renderer(); +}; +qe.element = function() { + return this[0]; +}; +qe.collection = function() { + return Xl(this) ? this : new vr(this._private.cy, [this]); +}; +qe.unique = function() { + return new vr(this._private.cy, this, !0); +}; +qe.hasElementWithId = function(r) { + return r = "" + r, this._private.map.has(r); +}; +qe.getElementById = function(r) { + r = "" + r; + var e = this._private.cy, t = this._private.map.get(r); + return t ? t.ele : new vr(e); +}; +qe.$id = qe.getElementById; +qe.poolIndex = function() { + var r = this._private.cy, e = r._private.elements, t = this[0]._private.data.id; + return e._private.map.get(t).index; +}; +qe.indexOf = function(r) { + var e = r[0]._private.data.id; + return this._private.map.get(e).index; +}; +qe.indexOfId = function(r) { + return r = "" + r, this._private.map.get(r).index; +}; +qe.json = function(r) { + var e = this.element(), t = this.cy(); + if (e == null && r) + return this; + if (e != null) { + var a = e._private; + if (Pe(r)) { + if (t.startBatch(), r.data) { + e.data(r.data); + var n = a.data; + if (e.isEdge()) { + var i = !1, s = {}, o = r.data.source, l = r.data.target; + o != null && o != n.source && (s.source = "" + o, i = !0), l != null && l != n.target && (s.target = "" + l, i = !0), i && (e = e.move(s)); + } else { + var u = "parent" in r.data, v = r.data.parent; + u && (v != null || n.parent != null) && v != n.parent && (v === void 0 && (v = null), v != null && (v = "" + v), e = e.move({ + parent: v + })); + } + } + r.position && e.position(r.position); + var f = function(y, g, p) { + var m = r[y]; + m != null && m !== a[y] && (m ? e[g]() : e[p]()); + }; + return f("removed", "remove", "restore"), f("selected", "select", "unselect"), f("selectable", "selectify", "unselectify"), f("locked", "lock", "unlock"), f("grabbable", "grabify", "ungrabify"), f("pannable", "panify", "unpanify"), r.classes != null && e.classes(r.classes), t.endBatch(), this; + } else if (r === void 0) { + var c = { + data: qr(a.data), + position: qr(a.position), + group: a.group, + removed: a.removed, + selected: a.selected, + selectable: a.selectable, + locked: a.locked, + grabbable: a.grabbable, + pannable: a.pannable, + classes: null + }; + c.classes = ""; + var h = 0; + return a.classes.forEach(function(d) { + return c.classes += h++ === 0 ? d : " " + d; + }), c; + } + } +}; +qe.jsons = function() { + for (var r = [], e = 0; e < this.length; e++) { + var t = this[e], a = t.json(); + r.push(a); + } + return r; +}; +qe.clone = function() { + for (var r = this.cy(), e = [], t = 0; t < this.length; t++) { + var a = this[t], n = a.json(), i = new Mn(r, n, !1); + e.push(i); + } + return new vr(r, e); +}; +qe.copy = qe.clone; +qe.restore = function() { + for (var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, t = this, a = t.cy(), n = a._private, i = [], s = [], o, l = 0, u = t.length; l < u; l++) { + var v = t[l]; + e && !v.removed() || (v.isNode() ? i.push(v) : s.push(v)); + } + o = i.concat(s); + var f, c = function() { + o.splice(f, 1), f--; + }; + for (f = 0; f < o.length; f++) { + var h = o[f], d = h._private, y = d.data; + if (h.clearTraversalCache(), !(!e && !d.removed)) { + if (y.id === void 0) + y.id = lv(); + else if (te(y.id)) + y.id = "" + y.id; + else if (nt(y.id) || !fe(y.id)) { + He("Can not create element with invalid string ID `" + y.id + "`"), c(); + continue; + } else if (a.hasElementWithId(y.id)) { + He("Can not create second element with ID `" + y.id + "`"), c(); + continue; + } + } + var g = y.id; + if (h.isNode()) { + var p = d.position; + p.x == null && (p.x = 0), p.y == null && (p.y = 0); + } + if (h.isEdge()) { + for (var m = h, b = ["source", "target"], w = b.length, E = !1, C = 0; C < w; C++) { + var x = b[C], k = y[x]; + te(k) && (k = y[x] = "" + y[x]), k == null || k === "" ? (He("Can not create edge `" + g + "` with unspecified " + x), E = !0) : a.hasElementWithId(k) || (He("Can not create edge `" + g + "` with nonexistant " + x + " `" + k + "`"), E = !0); + } + if (E) { + c(); + continue; + } + var S = a.getElementById(y.source), P = a.getElementById(y.target); + S.same(P) ? S._private.edges.push(m) : (S._private.edges.push(m), P._private.edges.push(m)), m._private.source = S, m._private.target = P; + } + d.map = new Kr(), d.map.set(g, { + ele: h, + index: 0 + }), d.removed = !1, e && a.addToPool(h); + } + for (var D = 0; D < i.length; D++) { + var A = i[D], B = A._private.data; + te(B.parent) && (B.parent = "" + B.parent); + var R = B.parent, M = R != null; + if (M || A._private.parent) { + var I = A._private.parent ? a.collection().merge(A._private.parent) : a.getElementById(R); + if (I.empty()) + B.parent = void 0; + else if (I[0].removed()) + Le("Node added with missing parent, reference to parent removed"), B.parent = void 0, A._private.parent = null; + else { + for (var L = !1, O = I; !O.empty(); ) { + if (A.same(O)) { + L = !0, B.parent = void 0; + break; + } + O = O.parent(); + } + L || (I[0]._private.children.push(A), A._private.parent = I[0], n.hasCompoundNodes = !0); + } + } + } + if (o.length > 0) { + for (var V = o.length === t.length ? t : new vr(a, o), G = 0; G < V.length; G++) { + var N = V[G]; + N.isNode() || (N.parallelEdges().clearTraversalCache(), N.source().clearTraversalCache(), N.target().clearTraversalCache()); + } + var F; + n.hasCompoundNodes ? F = a.collection().merge(V).merge(V.connectedNodes()).merge(V.parent()) : F = V, F.dirtyCompoundBoundsCache().dirtyBoundingBoxCache().updateStyle(r), r ? V.emitAndNotify("add") : e && V.emit("add"); + } + return t; +}; +qe.removed = function() { + var r = this[0]; + return r && r._private.removed; +}; +qe.inside = function() { + var r = this[0]; + return r && !r._private.removed; +}; +qe.remove = function() { + var r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !0, e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, t = this, a = [], n = {}, i = t._private.cy; + function s(R) { + for (var M = R._private.edges, I = 0; I < M.length; I++) + l(M[I]); + } + function o(R) { + for (var M = R._private.children, I = 0; I < M.length; I++) + l(M[I]); + } + function l(R) { + var M = n[R.id()]; + e && R.removed() || M || (n[R.id()] = !0, R.isNode() ? (a.push(R), s(R), o(R)) : a.unshift(R)); + } + for (var u = 0, v = t.length; u < v; u++) { + var f = t[u]; + l(f); + } + function c(R, M) { + var I = R._private.edges; + it(I, M), R.clearTraversalCache(); + } + function h(R) { + R.clearTraversalCache(); + } + var d = []; + d.ids = {}; + function y(R, M) { + M = M[0], R = R[0]; + var I = R._private.children, L = R.id(); + it(I, M), M._private.parent = null, d.ids[L] || (d.ids[L] = !0, d.push(R)); + } + t.dirtyCompoundBoundsCache(), e && i.removeFromPool(a); + for (var g = 0; g < a.length; g++) { + var p = a[g]; + if (p.isEdge()) { + var m = p.source()[0], b = p.target()[0]; + c(m, p), c(b, p); + for (var w = p.parallelEdges(), E = 0; E < w.length; E++) { + var C = w[E]; + h(C), C.isBundledBezier() && C.dirtyBoundingBoxCache(); + } + } else { + var x = p.parent(); + x.length !== 0 && y(x, p); + } + e && (p._private.removed = !0); + } + var k = i._private.elements; + i._private.hasCompoundNodes = !1; + for (var S = 0; S < k.length; S++) { + var P = k[S]; + if (P.isParent()) { + i._private.hasCompoundNodes = !0; + break; + } + } + var D = new vr(this.cy(), a); + D.size() > 0 && (r ? D.emitAndNotify("remove") : e && D.emit("remove")); + for (var A = 0; A < d.length; A++) { + var B = d[A]; + (!e || !B.removed()) && B.updateStyle(); + } + return D; +}; +qe.move = function(r) { + var e = this._private.cy, t = this, a = !1, n = !1, i = function(d) { + return d == null ? d : "" + d; + }; + if (r.source !== void 0 || r.target !== void 0) { + var s = i(r.source), o = i(r.target), l = s != null && e.hasElementWithId(s), u = o != null && e.hasElementWithId(o); + (l || u) && (e.batch(function() { + t.remove(a, n), t.emitAndNotify("moveout"); + for (var h = 0; h < t.length; h++) { + var d = t[h], y = d._private.data; + d.isEdge() && (l && (y.source = s), u && (y.target = o)); + } + t.restore(a, n); + }), t.emitAndNotify("move")); + } else if (r.parent !== void 0) { + var v = i(r.parent), f = v === null || e.hasElementWithId(v); + if (f) { + var c = v === null ? void 0 : v; + e.batch(function() { + var h = t.remove(a, n); + h.emitAndNotify("moveout"); + for (var d = 0; d < t.length; d++) { + var y = t[d], g = y._private.data; + y.isNode() && (g.parent = c); + } + h.restore(a, n); + }), t.emitAndNotify("move"); + } + } + return this; +}; +[wv, hg, un, tt, Qt, Ag, Vn, $g, Wv, Uv, Qg, Cn, ln, lr, at, hr].forEach(function(r) { + he(qe, r); +}); +var np = { + add: function(e) { + var t, a = this; + if (Dr(e)) { + var n = e; + if (n._private.cy === a) + t = n.restore(); + else { + for (var i = [], s = 0; s < n.length; s++) { + var o = n[s]; + i.push(o.json()); + } + t = new vr(a, i); + } + } else if (Fe(e)) { + var l = e; + t = new vr(a, l); + } else if (Pe(e) && (Fe(e.nodes) || Fe(e.edges))) { + for (var u = e, v = [], f = ["nodes", "edges"], c = 0, h = f.length; c < h; c++) { + var d = f[c], y = u[d]; + if (Fe(y)) + for (var g = 0, p = y.length; g < p; g++) { + var m = he({ + group: d + }, y[g]); + v.push(m); + } + } + t = new vr(a, v); + } else { + var b = e; + t = new Mn(a, b).collection(); + } + return t; + }, + remove: function(e) { + if (!Dr(e)) { + if (fe(e)) { + var t = e; + e = this.$(t); + } + } + return e.remove(); + } +}; +/*! Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ +function ip(r, e, t, a) { + var n = 4, i = 1e-3, s = 1e-7, o = 10, l = 11, u = 1 / (l - 1), v = typeof Float32Array < "u"; + if (arguments.length !== 4) + return !1; + for (var f = 0; f < 4; ++f) + if (typeof arguments[f] != "number" || isNaN(arguments[f]) || !isFinite(arguments[f])) + return !1; + r = Math.min(r, 1), t = Math.min(t, 1), r = Math.max(r, 0), t = Math.max(t, 0); + var c = v ? new Float32Array(l) : new Array(l); + function h(P, D) { + return 1 - 3 * D + 3 * P; + } + function d(P, D) { + return 3 * D - 6 * P; + } + function y(P) { + return 3 * P; + } + function g(P, D, A) { + return ((h(D, A) * P + d(D, A)) * P + y(D)) * P; + } + function p(P, D, A) { + return 3 * h(D, A) * P * P + 2 * d(D, A) * P + y(D); + } + function m(P, D) { + for (var A = 0; A < n; ++A) { + var B = p(D, r, t); + if (B === 0) + return D; + var R = g(D, r, t) - P; + D -= R / B; + } + return D; + } + function b() { + for (var P = 0; P < l; ++P) + c[P] = g(P * u, r, t); + } + function w(P, D, A) { + var B, R, M = 0; + do + R = D + (A - D) / 2, B = g(R, r, t) - P, B > 0 ? A = R : D = R; + while (Math.abs(B) > s && ++M < o); + return R; + } + function E(P) { + for (var D = 0, A = 1, B = l - 1; A !== B && c[A] <= P; ++A) + D += u; + --A; + var R = (P - c[A]) / (c[A + 1] - c[A]), M = D + R * u, I = p(M, r, t); + return I >= i ? m(P, M) : I === 0 ? M : w(P, D, D + u); + } + var C = !1; + function x() { + C = !0, (r !== e || t !== a) && b(); + } + var k = function(D) { + return C || x(), r === e && t === a ? D : D === 0 ? 0 : D === 1 ? 1 : g(E(D), e, a); + }; + k.getControlPoints = function() { + return [{ + x: r, + y: e + }, { + x: t, + y: a + }]; + }; + var S = "generateBezier(" + [r, e, t, a] + ")"; + return k.toString = function() { + return S; + }, k; +} +/*! Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ +var sp = /* @__PURE__ */ function() { + function r(a) { + return -a.tension * a.x - a.friction * a.v; + } + function e(a, n, i) { + var s = { + x: a.x + i.dx * n, + v: a.v + i.dv * n, + tension: a.tension, + friction: a.friction + }; + return { + dx: s.v, + dv: r(s) + }; + } + function t(a, n) { + var i = { + dx: a.v, + dv: r(a) + }, s = e(a, n * 0.5, i), o = e(a, n * 0.5, s), l = e(a, n, o), u = 1 / 6 * (i.dx + 2 * (s.dx + o.dx) + l.dx), v = 1 / 6 * (i.dv + 2 * (s.dv + o.dv) + l.dv); + return a.x = a.x + u * n, a.v = a.v + v * n, a; + } + return function a(n, i, s) { + var o = { + x: -1, + v: 0, + tension: null, + friction: null + }, l = [0], u = 0, v = 1 / 1e4, f = 16 / 1e3, c, h, d; + for (n = parseFloat(n) || 500, i = parseFloat(i) || 20, s = s || null, o.tension = n, o.friction = i, c = s !== null, c ? (u = a(n, i), h = u / s * f) : h = f; d = t(d || o, h), l.push(1 + d.x), u += 16, Math.abs(d.x) > v && Math.abs(d.v) > v; ) + ; + return c ? function(y) { + return l[y * (l.length - 1) | 0]; + } : u; + }; +}(), Ve = function(e, t, a, n) { + var i = ip(e, t, a, n); + return function(s, o, l) { + return s + (o - s) * i(l); + }; +}, vn = { + linear: function(e, t, a) { + return e + (t - e) * a; + }, + // default easings + ease: Ve(0.25, 0.1, 0.25, 1), + "ease-in": Ve(0.42, 0, 1, 1), + "ease-out": Ve(0, 0, 0.58, 1), + "ease-in-out": Ve(0.42, 0, 0.58, 1), + // sine + "ease-in-sine": Ve(0.47, 0, 0.745, 0.715), + "ease-out-sine": Ve(0.39, 0.575, 0.565, 1), + "ease-in-out-sine": Ve(0.445, 0.05, 0.55, 0.95), + // quad + "ease-in-quad": Ve(0.55, 0.085, 0.68, 0.53), + "ease-out-quad": Ve(0.25, 0.46, 0.45, 0.94), + "ease-in-out-quad": Ve(0.455, 0.03, 0.515, 0.955), + // cubic + "ease-in-cubic": Ve(0.55, 0.055, 0.675, 0.19), + "ease-out-cubic": Ve(0.215, 0.61, 0.355, 1), + "ease-in-out-cubic": Ve(0.645, 0.045, 0.355, 1), + // quart + "ease-in-quart": Ve(0.895, 0.03, 0.685, 0.22), + "ease-out-quart": Ve(0.165, 0.84, 0.44, 1), + "ease-in-out-quart": Ve(0.77, 0, 0.175, 1), + // quint + "ease-in-quint": Ve(0.755, 0.05, 0.855, 0.06), + "ease-out-quint": Ve(0.23, 1, 0.32, 1), + "ease-in-out-quint": Ve(0.86, 0, 0.07, 1), + // expo + "ease-in-expo": Ve(0.95, 0.05, 0.795, 0.035), + "ease-out-expo": Ve(0.19, 1, 0.22, 1), + "ease-in-out-expo": Ve(1, 0, 0, 1), + // circ + "ease-in-circ": Ve(0.6, 0.04, 0.98, 0.335), + "ease-out-circ": Ve(0.075, 0.82, 0.165, 1), + "ease-in-out-circ": Ve(0.785, 0.135, 0.15, 0.86), + // user param easings... + spring: function(e, t, a) { + if (a === 0) + return vn.linear; + var n = sp(e, t, a); + return function(i, s, o) { + return i + (s - i) * n(o); + }; + }, + "cubic-bezier": Ve +}; +function pl(r, e, t, a, n) { + if (a === 1 || e === t) + return t; + var i = n(e, t, a); + return r == null || ((r.roundValue || r.color) && (i = Math.round(i)), r.min !== void 0 && (i = Math.max(i, r.min)), r.max !== void 0 && (i = Math.min(i, r.max))), i; +} +function yl(r, e) { + return r.pfValue != null || r.value != null ? r.pfValue != null && (e == null || e.type.units !== "%") ? r.pfValue : r.value : r; +} +function It(r, e, t, a, n) { + var i = n != null ? n.type : null; + t < 0 ? t = 0 : t > 1 && (t = 1); + var s = yl(r, n), o = yl(e, n); + if (te(s) && te(o)) + return pl(i, s, o, t, a); + if (Fe(s) && Fe(o)) { + for (var l = [], u = 0; u < o.length; u++) { + var v = s[u], f = o[u]; + if (v != null && f != null) { + var c = pl(i, v, f, t, a); + l.push(c); + } else + l.push(f); + } + return l; + } +} +function op(r, e, t, a) { + var n = !a, i = r._private, s = e._private, o = s.easing, l = s.startTime, u = a ? r : r.cy(), v = u.style(); + if (!s.easingImpl) + if (o == null) + s.easingImpl = vn.linear; + else { + var f; + if (fe(o)) { + var c = v.parse("transition-timing-function", o); + f = c.value; + } else + f = o; + var h, d; + fe(f) ? (h = f, d = []) : (h = f[1], d = f.slice(2).map(function(V) { + return +V; + })), d.length > 0 ? (h === "spring" && d.push(s.duration), s.easingImpl = vn[h].apply(null, d)) : s.easingImpl = vn[h]; + } + var y = s.easingImpl, g; + if (s.duration === 0 ? g = 1 : g = (t - l) / s.duration, s.applying && (g = s.progress), g < 0 ? g = 0 : g > 1 && (g = 1), s.delay == null) { + var p = s.startPosition, m = s.position; + if (m && n && !r.locked()) { + var b = {}; + va(p.x, m.x) && (b.x = It(p.x, m.x, g, y)), va(p.y, m.y) && (b.y = It(p.y, m.y, g, y)), r.position(b); + } + var w = s.startPan, E = s.pan, C = i.pan, x = E != null && a; + x && (va(w.x, E.x) && (C.x = It(w.x, E.x, g, y)), va(w.y, E.y) && (C.y = It(w.y, E.y, g, y)), r.emit("pan")); + var k = s.startZoom, S = s.zoom, P = S != null && a; + P && (va(k, S) && (i.zoom = Ca(i.minZoom, It(k, S, g, y), i.maxZoom)), r.emit("zoom")), (x || P) && r.emit("viewport"); + var D = s.style; + if (D && D.length > 0 && n) { + for (var A = 0; A < D.length; A++) { + var B = D[A], R = B.name, M = B, I = s.startStyle[R], L = v.properties[I.name], O = It(I, M, g, y, L); + v.overrideBypass(r, R, O); + } + r.emit("style"); + } + } + return s.progress = g, g; +} +function va(r, e) { + return r == null || e == null ? !1 : te(r) && te(e) ? !0 : !!(r && e); +} +function up(r, e, t, a) { + var n = e._private; + n.started = !0, n.startTime = t - n.progress * n.duration; +} +function ml(r, e) { + var t = e._private.aniEles, a = []; + function n(v, f) { + var c = v._private, h = c.animation.current, d = c.animation.queue, y = !1; + if (h.length === 0) { + var g = d.shift(); + g && h.push(g); + } + for (var p = function(C) { + for (var x = C.length - 1; x >= 0; x--) { + var k = C[x]; + k(); + } + C.splice(0, C.length); + }, m = h.length - 1; m >= 0; m--) { + var b = h[m], w = b._private; + if (w.stopped) { + h.splice(m, 1), w.hooked = !1, w.playing = !1, w.started = !1, p(w.frames); + continue; + } + !w.playing && !w.applying || (w.playing && w.applying && (w.applying = !1), w.started || up(v, b, r), op(v, b, r, f), w.applying && (w.applying = !1), p(w.frames), w.step != null && w.step(r), b.completed() && (h.splice(m, 1), w.hooked = !1, w.playing = !1, w.started = !1, p(w.completes)), y = !0); + } + return !f && h.length === 0 && d.length === 0 && a.push(v), y; + } + for (var i = !1, s = 0; s < t.length; s++) { + var o = t[s], l = n(o); + i = i || l; + } + var u = n(e, !0); + (i || u) && (t.length > 0 ? e.notify("draw", t) : e.notify("draw")), t.unmerge(a), e.emit("step"); +} +var lp = { + // pull in animation functions + animate: Me.animate(), + animation: Me.animation(), + animated: Me.animated(), + clearQueue: Me.clearQueue(), + delay: Me.delay(), + delayAnimation: Me.delayAnimation(), + stop: Me.stop(), + addToAnimationPool: function(e) { + var t = this; + t.styleEnabled() && t._private.aniEles.merge(e); + }, + stopAnimationLoop: function() { + this._private.animationsRunning = !1; + }, + startAnimationLoop: function() { + var e = this; + if (e._private.animationsRunning = !0, !e.styleEnabled()) + return; + function t() { + e._private.animationsRunning && mn(function(i) { + ml(i, e), t(); + }); + } + var a = e.renderer(); + a && a.beforeRender ? a.beforeRender(function(i, s) { + ml(s, e); + }, a.beforeRenderPriorities.animations) : t(); + } +}, vp = { + qualifierCompare: function(e, t) { + return e == null || t == null ? e == null && t == null : e.sameText(t); + }, + eventMatches: function(e, t, a) { + var n = t.qualifier; + return n != null ? e !== a.target && Ra(a.target) && n.matches(a.target) : !0; + }, + addEventFields: function(e, t) { + t.cy = e, t.target = e; + }, + callbackContext: function(e, t, a) { + return t.qualifier != null ? a.target : e; + } +}, en = function(e) { + return fe(e) ? new ot(e) : e; +}, Yv = { + createEmitter: function() { + var e = this._private; + return e.emitter || (e.emitter = new qn(vp, this)), this; + }, + emitter: function() { + return this._private.emitter; + }, + on: function(e, t, a) { + return this.emitter().on(e, en(t), a), this; + }, + removeListener: function(e, t, a) { + return this.emitter().removeListener(e, en(t), a), this; + }, + removeAllListeners: function() { + return this.emitter().removeAllListeners(), this; + }, + one: function(e, t, a) { + return this.emitter().one(e, en(t), a), this; + }, + once: function(e, t, a) { + return this.emitter().one(e, en(t), a), this; + }, + emit: function(e, t) { + return this.emitter().emit(e, t), this; + }, + emitAndNotify: function(e, t) { + return this.emit(e), this.notify(e, t), this; + } +}; +Me.eventAliasesOn(Yv); +var Is = { + png: function(e) { + var t = this._private.renderer; + return e = e || {}, t.png(e); + }, + jpg: function(e) { + var t = this._private.renderer; + return e = e || {}, e.bg = e.bg || "#fff", t.jpg(e); + } +}; +Is.jpeg = Is.jpg; +var fn = { + layout: function(e) { + var t = this; + if (e == null) { + He("Layout options must be specified to make a layout"); + return; + } + if (e.name == null) { + He("A `name` must be specified to make a layout"); + return; + } + var a = e.name, n = t.extension("layout", a); + if (n == null) { + He("No such layout `" + a + "` found. Did you forget to import it and `cytoscape.use()` it?"); + return; + } + var i; + fe(e.eles) ? i = t.$(e.eles) : i = e.eles != null ? e.eles : t.$(); + var s = new n(he({}, e, { + cy: t, + eles: i + })); + return s; + } +}; +fn.createLayout = fn.makeLayout = fn.layout; +var fp = { + notify: function(e, t) { + var a = this._private; + if (this.batching()) { + a.batchNotifications = a.batchNotifications || {}; + var n = a.batchNotifications[e] = a.batchNotifications[e] || this.collection(); + t != null && n.merge(t); + return; + } + if (a.notificationsEnabled) { + var i = this.renderer(); + this.destroyed() || !i || i.notify(e, t); + } + }, + notifications: function(e) { + var t = this._private; + return e === void 0 ? t.notificationsEnabled : (t.notificationsEnabled = !!e, this); + }, + noNotifications: function(e) { + this.notifications(!1), e(), this.notifications(!0); + }, + batching: function() { + return this._private.batchCount > 0; + }, + startBatch: function() { + var e = this._private; + return e.batchCount == null && (e.batchCount = 0), e.batchCount === 0 && (e.batchStyleEles = this.collection(), e.batchNotifications = {}), e.batchCount++, this; + }, + endBatch: function() { + var e = this._private; + if (e.batchCount === 0) + return this; + if (e.batchCount--, e.batchCount === 0) { + e.batchStyleEles.updateStyle(); + var t = this.renderer(); + Object.keys(e.batchNotifications).forEach(function(a) { + var n = e.batchNotifications[a]; + n.empty() ? t.notify(a) : t.notify(a, n); + }); + } + return this; + }, + batch: function(e) { + return this.startBatch(), e(), this.endBatch(), this; + }, + // for backwards compatibility + batchData: function(e) { + var t = this; + return this.batch(function() { + for (var a = Object.keys(e), n = 0; n < a.length; n++) { + var i = a[n], s = e[i], o = t.getElementById(i); + o.data(s); + } + }); + } +}, cp = fr({ + hideEdgesOnViewport: !1, + textureOnViewport: !1, + motionBlur: !1, + motionBlurOpacity: 0.05, + pixelRatio: void 0, + desktopTapThreshold: 4, + touchTapThreshold: 8, + wheelSensitivity: 1, + debug: !1, + showFps: !1, + // webgl options + webgl: !1, + webglDebug: !1, + webglDebugShowAtlases: !1, + // defaults good for mobile + webglTexSize: 2048, + webglTexRows: 36, + webglTexRowsNodes: 18, + webglBatchSize: 2048, + webglTexPerBatch: 14, + webglBgColor: [255, 255, 255] +}), Os = { + renderTo: function(e, t, a, n) { + var i = this._private.renderer; + return i.renderTo(e, t, a, n), this; + }, + renderer: function() { + return this._private.renderer; + }, + forceRender: function() { + return this.notify("draw"), this; + }, + resize: function() { + return this.invalidateSize(), this.emitAndNotify("resize"), this; + }, + initRenderer: function(e) { + var t = this, a = t.extension("renderer", e.name); + if (a == null) { + He("Can not initialise: No such renderer `".concat(e.name, "` found. Did you forget to import it and `cytoscape.use()` it?")); + return; + } + e.wheelSensitivity !== void 0 && Le("You have set a custom wheel sensitivity. This will make your app zoom unnaturally when using mainstream mice. You should change this value from the default only if you can guarantee that all your users will use the same hardware and OS configuration as your current machine."); + var n = cp(e); + n.cy = t, t._private.renderer = new a(n), this.notify("init"); + }, + destroyRenderer: function() { + var e = this; + e.notify("destroy"); + var t = e.container(); + if (t) + for (t._cyreg = null; t.childNodes.length > 0; ) + t.removeChild(t.childNodes[0]); + e._private.renderer = null, e.mutableElements().forEach(function(a) { + var n = a._private; + n.rscratch = {}, n.rstyle = {}, n.animation.current = [], n.animation.queue = []; + }); + }, + onRender: function(e) { + return this.on("render", e); + }, + offRender: function(e) { + return this.off("render", e); + } +}; +Os.invalidateDimensions = Os.resize; +var cn = { + // get a collection + // - empty collection on no args + // - collection of elements in the graph on selector arg + // - guarantee a returned collection when elements or collection specified + collection: function(e, t) { + return fe(e) ? this.$(e) : Dr(e) ? e.collection() : Fe(e) ? (t || (t = {}), new vr(this, e, t.unique, t.removed)) : new vr(this); + }, + nodes: function(e) { + var t = this.$(function(a) { + return a.isNode(); + }); + return e ? t.filter(e) : t; + }, + edges: function(e) { + var t = this.$(function(a) { + return a.isEdge(); + }); + return e ? t.filter(e) : t; + }, + // search the graph like jQuery + $: function(e) { + var t = this._private.elements; + return e ? t.filter(e) : t.spawnSelf(); + }, + mutableElements: function() { + return this._private.elements; + } +}; +cn.elements = cn.filter = cn.$; +var sr = {}, ya = "t", dp = "f"; +sr.apply = function(r) { + for (var e = this, t = e._private, a = t.cy, n = a.collection(), i = 0; i < r.length; i++) { + var s = r[i], o = e.getContextMeta(s); + if (!o.empty) { + var l = e.getContextStyle(o), u = e.applyContextStyle(o, l, s); + s._private.appliedInitStyle ? e.updateTransitions(s, u.diffProps) : s._private.appliedInitStyle = !0; + var v = e.updateStyleHints(s); + v && n.push(s); + } + } + return n; +}; +sr.getPropertiesDiff = function(r, e) { + var t = this, a = t._private.propDiffs = t._private.propDiffs || {}, n = r + "-" + e, i = a[n]; + if (i) + return i; + for (var s = [], o = {}, l = 0; l < t.length; l++) { + var u = t[l], v = r[l] === ya, f = e[l] === ya, c = v !== f, h = u.mappedProperties.length > 0; + if (c || f && h) { + var d = void 0; + c && h || c ? d = u.properties : h && (d = u.mappedProperties); + for (var y = 0; y < d.length; y++) { + for (var g = d[y], p = g.name, m = !1, b = l + 1; b < t.length; b++) { + var w = t[b], E = e[b] === ya; + if (E && (m = w.properties[g.name] != null, m)) + break; + } + !o[p] && !m && (o[p] = !0, s.push(p)); + } + } + } + return a[n] = s, s; +}; +sr.getContextMeta = function(r) { + for (var e = this, t = "", a, n = r._private.styleCxtKey || "", i = 0; i < e.length; i++) { + var s = e[i], o = s.selector && s.selector.matches(r); + o ? t += ya : t += dp; + } + return a = e.getPropertiesDiff(n, t), r._private.styleCxtKey = t, { + key: t, + diffPropNames: a, + empty: a.length === 0 + }; +}; +sr.getContextStyle = function(r) { + var e = r.key, t = this, a = this._private.contextStyles = this._private.contextStyles || {}; + if (a[e]) + return a[e]; + for (var n = { + _private: { + key: e + } + }, i = 0; i < t.length; i++) { + var s = t[i], o = e[i] === ya; + if (o) + for (var l = 0; l < s.properties.length; l++) { + var u = s.properties[l]; + n[u.name] = u; + } + } + return a[e] = n, n; +}; +sr.applyContextStyle = function(r, e, t) { + for (var a = this, n = r.diffPropNames, i = {}, s = a.types, o = 0; o < n.length; o++) { + var l = n[o], u = e[l], v = t.pstyle(l); + if (!u) + if (v) + v.bypass ? u = { + name: l, + deleteBypassed: !0 + } : u = { + name: l, + delete: !0 + }; + else continue; + if (v !== u) { + if (u.mapped === s.fn && v != null && v.mapping != null && v.mapping.value === u.value) { + var f = v.mapping, c = f.fnValue = u.value(t); + if (c === f.prevFnValue) + continue; + } + var h = i[l] = { + prev: v + }; + a.applyParsedProperty(t, u), h.next = t.pstyle(l), h.next && h.next.bypass && (h.next = h.next.bypassed); + } + } + return { + diffProps: i + }; +}; +sr.updateStyleHints = function(r) { + var e = r._private, t = this, a = t.propertyGroupNames, n = t.propertyGroupKeys, i = function(H, ee, ne) { + return t.getPropertiesHash(H, ee, ne); + }, s = e.styleKey; + if (r.removed()) + return !1; + var o = e.group === "nodes", l = r._private.style; + a = Object.keys(l); + for (var u = 0; u < n.length; u++) { + var v = n[u]; + e.styleKeys[v] = [xt, qt]; + } + for (var f = function(H, ee) { + return e.styleKeys[ee][0] = wa(H, e.styleKeys[ee][0]); + }, c = function(H, ee) { + return e.styleKeys[ee][1] = xa(H, e.styleKeys[ee][1]); + }, h = function(H, ee) { + f(H, ee), c(H, ee); + }, d = function(H, ee) { + for (var ne = 0; ne < H.length; ne++) { + var be = H.charCodeAt(ne); + f(be, ee), c(be, ee); + } + }, y = 2e9, g = function(H) { + return -128 < H && H < 128 && Math.floor(H) !== H ? y - (H * 1024 | 0) : H; + }, p = 0; p < a.length; p++) { + var m = a[p], b = l[m]; + if (b != null) { + var w = this.properties[m], E = w.type, C = w.groupKey, x = void 0; + w.hashOverride != null ? x = w.hashOverride(r, b) : b.pfValue != null && (x = b.pfValue); + var k = w.enums == null ? b.value : null, S = x != null, P = k != null, D = S || P, A = b.units; + if (E.number && D && !E.multiple) { + var B = S ? x : k; + h(g(B), C), !S && A != null && d(A, C); + } else + d(b.strValue, C); + } + } + for (var R = [xt, qt], M = 0; M < n.length; M++) { + var I = n[M], L = e.styleKeys[I]; + R[0] = wa(L[0], R[0]), R[1] = xa(L[1], R[1]); + } + e.styleKey = Mc(R[0], R[1]); + var O = e.styleKeys; + e.labelDimsKey = jr(O.labelDimensions); + var V = i(r, ["label"], O.labelDimensions); + if (e.labelKey = jr(V), e.labelStyleKey = jr($a(O.commonLabel, V)), !o) { + var G = i(r, ["source-label"], O.labelDimensions); + e.sourceLabelKey = jr(G), e.sourceLabelStyleKey = jr($a(O.commonLabel, G)); + var N = i(r, ["target-label"], O.labelDimensions); + e.targetLabelKey = jr(N), e.targetLabelStyleKey = jr($a(O.commonLabel, N)); + } + if (o) { + var F = e.styleKeys, K = F.nodeBody, X = F.nodeBorder, Q = F.nodeOutline, Z = F.backgroundImage, re = F.compound, ae = F.pie, J = F.stripe, z = [K, X, Q, Z, re, ae, J].filter(function(q) { + return q != null; + }).reduce($a, [xt, qt]); + e.nodeKey = jr(z), e.hasPie = ae != null && ae[0] !== xt && ae[1] !== qt, e.hasStripe = J != null && J[0] !== xt && J[1] !== qt; + } + return s !== e.styleKey; +}; +sr.clearStyleHints = function(r) { + var e = r._private; + e.styleCxtKey = "", e.styleKeys = {}, e.styleKey = null, e.labelKey = null, e.labelStyleKey = null, e.sourceLabelKey = null, e.sourceLabelStyleKey = null, e.targetLabelKey = null, e.targetLabelStyleKey = null, e.nodeKey = null, e.hasPie = null, e.hasStripe = null; +}; +sr.applyParsedProperty = function(r, e) { + var t = this, a = e, n = r._private.style, i, s = t.types, o = t.properties[a.name].type, l = a.bypass, u = n[a.name], v = u && u.bypass, f = r._private, c = "mapping", h = function(K) { + return K == null ? null : K.pfValue != null ? K.pfValue : K.value; + }, d = function() { + var K = h(u), X = h(a); + t.checkTriggers(r, a.name, K, X); + }; + if (e.name === "curve-style" && r.isEdge() && // loops must be bundled beziers + (e.value !== "bezier" && r.isLoop() || // edges connected to compound nodes can not be haystacks + e.value === "haystack" && (r.source().isParent() || r.target().isParent())) && (a = e = this.parse(e.name, "bezier", l)), a.delete) + return n[a.name] = void 0, d(), !0; + if (a.deleteBypassed) + return u ? u.bypass ? (u.bypassed = void 0, d(), !0) : !1 : (d(), !0); + if (a.deleteBypass) + return u ? u.bypass ? (n[a.name] = u.bypassed, d(), !0) : !1 : (d(), !0); + var y = function() { + Le("Do not assign mappings to elements without corresponding data (i.e. ele `" + r.id() + "` has no mapping for property `" + a.name + "` with data field `" + a.field + "`); try a `[" + a.field + "]` selector to limit scope to elements with `" + a.field + "` defined"); + }; + switch (a.mapped) { + case s.mapData: { + for (var g = a.field.split("."), p = f.data, m = 0; m < g.length && p; m++) { + var b = g[m]; + p = p[b]; + } + if (p == null) + return y(), !1; + var w; + if (te(p)) { + var E = a.fieldMax - a.fieldMin; + E === 0 ? w = 0 : w = (p - a.fieldMin) / E; + } else + return Le("Do not use continuous mappers without specifying numeric data (i.e. `" + a.field + ": " + p + "` for `" + r.id() + "` is non-numeric)"), !1; + if (w < 0 ? w = 0 : w > 1 && (w = 1), o.color) { + var C = a.valueMin[0], x = a.valueMax[0], k = a.valueMin[1], S = a.valueMax[1], P = a.valueMin[2], D = a.valueMax[2], A = a.valueMin[3] == null ? 1 : a.valueMin[3], B = a.valueMax[3] == null ? 1 : a.valueMax[3], R = [Math.round(C + (x - C) * w), Math.round(k + (S - k) * w), Math.round(P + (D - P) * w), Math.round(A + (B - A) * w)]; + i = { + // colours are simple, so just create the flat property instead of expensive string parsing + bypass: a.bypass, + // we're a bypass if the mapping property is a bypass + name: a.name, + value: R, + strValue: "rgb(" + R[0] + ", " + R[1] + ", " + R[2] + ")" + }; + } else if (o.number) { + var M = a.valueMin + (a.valueMax - a.valueMin) * w; + i = this.parse(a.name, M, a.bypass, c); + } else + return !1; + if (!i) + return y(), !1; + i.mapping = a, a = i; + break; + } + case s.data: { + for (var I = a.field.split("."), L = f.data, O = 0; O < I.length && L; O++) { + var V = I[O]; + L = L[V]; + } + if (L != null && (i = this.parse(a.name, L, a.bypass, c)), !i) + return y(), !1; + i.mapping = a, a = i; + break; + } + case s.fn: { + var G = a.value, N = a.fnValue != null ? a.fnValue : G(r); + if (a.prevFnValue = N, N == null) + return Le("Custom function mappers may not return null (i.e. `" + a.name + "` for ele `" + r.id() + "` is null)"), !1; + if (i = this.parse(a.name, N, a.bypass, c), !i) + return Le("Custom function mappers may not return invalid values for the property type (i.e. `" + a.name + "` for ele `" + r.id() + "` is invalid)"), !1; + i.mapping = qr(a), a = i; + break; + } + case void 0: + break; + default: + return !1; + } + return l ? (v ? a.bypassed = u.bypassed : a.bypassed = u, n[a.name] = a) : v ? u.bypassed = a : n[a.name] = a, d(), !0; +}; +sr.cleanElements = function(r, e) { + for (var t = 0; t < r.length; t++) { + var a = r[t]; + if (this.clearStyleHints(a), a.dirtyCompoundBoundsCache(), a.dirtyBoundingBoxCache(), !e) + a._private.style = {}; + else + for (var n = a._private.style, i = Object.keys(n), s = 0; s < i.length; s++) { + var o = i[s], l = n[o]; + l != null && (l.bypass ? l.bypassed = null : n[o] = null); + } + } +}; +sr.update = function() { + var r = this._private.cy, e = r.mutableElements(); + e.updateStyle(); +}; +sr.updateTransitions = function(r, e) { + var t = this, a = r._private, n = r.pstyle("transition-property").value, i = r.pstyle("transition-duration").pfValue, s = r.pstyle("transition-delay").pfValue; + if (n.length > 0 && i > 0) { + for (var o = {}, l = !1, u = 0; u < n.length; u++) { + var v = n[u], f = r.pstyle(v), c = e[v]; + if (c) { + var h = c.prev, d = h, y = c.next != null ? c.next : f, g = !1, p = void 0, m = 1e-6; + d && (te(d.pfValue) && te(y.pfValue) ? (g = y.pfValue - d.pfValue, p = d.pfValue + m * g) : te(d.value) && te(y.value) ? (g = y.value - d.value, p = d.value + m * g) : Fe(d.value) && Fe(y.value) && (g = d.value[0] !== y.value[0] || d.value[1] !== y.value[1] || d.value[2] !== y.value[2], p = d.strValue), g && (o[v] = y.strValue, this.applyBypass(r, v, p), l = !0)); + } + } + if (!l) + return; + a.transitioning = !0, new ea(function(b) { + s > 0 ? r.delayAnimation(s).play().promise().then(b) : b(); + }).then(function() { + return r.animation({ + style: o, + duration: i, + easing: r.pstyle("transition-timing-function").value, + queue: !1 + }).play().promise(); + }).then(function() { + t.removeBypasses(r, n), r.emitAndNotify("style"), a.transitioning = !1; + }); + } else a.transitioning && (this.removeBypasses(r, n), r.emitAndNotify("style"), a.transitioning = !1); +}; +sr.checkTrigger = function(r, e, t, a, n, i) { + var s = this.properties[e], o = n(s); + r.removed() || o != null && o(t, a, r) && i(s); +}; +sr.checkZOrderTrigger = function(r, e, t, a) { + var n = this; + this.checkTrigger(r, e, t, a, function(i) { + return i.triggersZOrder; + }, function() { + n._private.cy.notify("zorder", r); + }); +}; +sr.checkBoundsTrigger = function(r, e, t, a) { + this.checkTrigger(r, e, t, a, function(n) { + return n.triggersBounds; + }, function(n) { + r.dirtyCompoundBoundsCache(), r.dirtyBoundingBoxCache(); + }); +}; +sr.checkConnectedEdgesBoundsTrigger = function(r, e, t, a) { + this.checkTrigger(r, e, t, a, function(n) { + return n.triggersBoundsOfConnectedEdges; + }, function(n) { + r.connectedEdges().forEach(function(i) { + i.dirtyBoundingBoxCache(); + }); + }); +}; +sr.checkParallelEdgesBoundsTrigger = function(r, e, t, a) { + this.checkTrigger(r, e, t, a, function(n) { + return n.triggersBoundsOfParallelEdges; + }, function(n) { + r.parallelEdges().forEach(function(i) { + i.dirtyBoundingBoxCache(); + }); + }); +}; +sr.checkTriggers = function(r, e, t, a) { + r.dirtyStyleCache(), this.checkZOrderTrigger(r, e, t, a), this.checkBoundsTrigger(r, e, t, a), this.checkConnectedEdgesBoundsTrigger(r, e, t, a), this.checkParallelEdgesBoundsTrigger(r, e, t, a); +}; +var Fa = {}; +Fa.applyBypass = function(r, e, t, a) { + var n = this, i = [], s = !0; + if (e === "*" || e === "**") { + if (t !== void 0) + for (var o = 0; o < n.properties.length; o++) { + var l = n.properties[o], u = l.name, v = this.parse(u, t, !0); + v && i.push(v); + } + } else if (fe(e)) { + var f = this.parse(e, t, !0); + f && i.push(f); + } else if (Pe(e)) { + var c = e; + a = t; + for (var h = Object.keys(c), d = 0; d < h.length; d++) { + var y = h[d], g = c[y]; + if (g === void 0 && (g = c[An(y)]), g !== void 0) { + var p = this.parse(y, g, !0); + p && i.push(p); + } + } + } else + return !1; + if (i.length === 0) + return !1; + for (var m = !1, b = 0; b < r.length; b++) { + for (var w = r[b], E = {}, C = void 0, x = 0; x < i.length; x++) { + var k = i[x]; + if (a) { + var S = w.pstyle(k.name); + C = E[k.name] = { + prev: S + }; + } + m = this.applyParsedProperty(w, qr(k)) || m, a && (C.next = w.pstyle(k.name)); + } + m && this.updateStyleHints(w), a && this.updateTransitions(w, E, s); + } + return m; +}; +Fa.overrideBypass = function(r, e, t) { + e = Ks(e); + for (var a = 0; a < r.length; a++) { + var n = r[a], i = n._private.style[e], s = this.properties[e].type, o = s.color, l = s.mutiple, u = i ? i.pfValue != null ? i.pfValue : i.value : null; + !i || !i.bypass ? this.applyBypass(n, e, t) : (i.value = t, i.pfValue != null && (i.pfValue = t), o ? i.strValue = "rgb(" + t.join(",") + ")" : l ? i.strValue = t.join(" ") : i.strValue = "" + t, this.updateStyleHints(n)), this.checkTriggers(n, e, u, t); + } +}; +Fa.removeAllBypasses = function(r, e) { + return this.removeBypasses(r, this.propertyNames, e); +}; +Fa.removeBypasses = function(r, e, t) { + for (var a = !0, n = 0; n < r.length; n++) { + for (var i = r[n], s = {}, o = 0; o < e.length; o++) { + var l = e[o], u = this.properties[l], v = i.pstyle(u.name); + if (!(!v || !v.bypass)) { + var f = "", c = this.parse(l, f, !0), h = s[u.name] = { + prev: v + }; + this.applyParsedProperty(i, c), h.next = i.pstyle(u.name); + } + } + this.updateStyleHints(i), t && this.updateTransitions(i, s, a); + } +}; +var uo = {}; +uo.getEmSizeInPixels = function() { + var r = this.containerCss("font-size"); + return r != null ? parseFloat(r) : 1; +}; +uo.containerCss = function(r) { + var e = this._private.cy, t = e.container(), a = e.window(); + if (a && t && a.getComputedStyle) + return a.getComputedStyle(t).getPropertyValue(r); +}; +var _r = {}; +_r.getRenderedStyle = function(r, e) { + return e ? this.getStylePropertyValue(r, e, !0) : this.getRawStyle(r, !0); +}; +_r.getRawStyle = function(r, e) { + var t = this; + if (r = r[0], r) { + for (var a = {}, n = 0; n < t.properties.length; n++) { + var i = t.properties[n], s = t.getStylePropertyValue(r, i.name, e); + s != null && (a[i.name] = s, a[An(i.name)] = s); + } + return a; + } +}; +_r.getIndexedStyle = function(r, e, t, a) { + var n = r.pstyle(e)[t][a]; + return n ?? r.cy().style().getDefaultProperty(e)[t][0]; +}; +_r.getStylePropertyValue = function(r, e, t) { + var a = this; + if (r = r[0], r) { + var n = a.properties[e]; + n.alias && (n = n.pointsTo); + var i = n.type, s = r.pstyle(n.name); + if (s) { + var o = s.value, l = s.units, u = s.strValue; + if (t && i.number && o != null && te(o)) { + var v = r.cy().zoom(), f = function(g) { + return g * v; + }, c = function(g, p) { + return f(g) + p; + }, h = Fe(o), d = h ? l.every(function(y) { + return y != null; + }) : l != null; + return d ? h ? o.map(function(y, g) { + return c(y, l[g]); + }).join(" ") : c(o, l) : h ? o.map(function(y) { + return fe(y) ? y : "" + f(y); + }).join(" ") : "" + f(o); + } else if (u != null) + return u; + } + return null; + } +}; +_r.getAnimationStartStyle = function(r, e) { + for (var t = {}, a = 0; a < e.length; a++) { + var n = e[a], i = n.name, s = r.pstyle(i); + s !== void 0 && (Pe(s) ? s = this.parse(i, s.strValue) : s = this.parse(i, s)), s && (t[i] = s); + } + return t; +}; +_r.getPropsList = function(r) { + var e = this, t = [], a = r, n = e.properties; + if (a) + for (var i = Object.keys(a), s = 0; s < i.length; s++) { + var o = i[s], l = a[o], u = n[o] || n[Ks(o)], v = this.parse(u.name, l); + v && t.push(v); + } + return t; +}; +_r.getNonDefaultPropertiesHash = function(r, e, t) { + var a = t.slice(), n, i, s, o, l, u; + for (l = 0; l < e.length; l++) + if (n = e[l], i = r.pstyle(n, !1), i != null) + if (i.pfValue != null) + a[0] = wa(o, a[0]), a[1] = xa(o, a[1]); + else + for (s = i.strValue, u = 0; u < s.length; u++) + o = s.charCodeAt(u), a[0] = wa(o, a[0]), a[1] = xa(o, a[1]); + return a; +}; +_r.getPropertiesHash = _r.getNonDefaultPropertiesHash; +var Hn = {}; +Hn.appendFromJson = function(r) { + for (var e = this, t = 0; t < r.length; t++) { + var a = r[t], n = a.selector, i = a.style || a.css, s = Object.keys(i); + e.selector(n); + for (var o = 0; o < s.length; o++) { + var l = s[o], u = i[l]; + e.css(l, u); + } + } + return e; +}; +Hn.fromJson = function(r) { + var e = this; + return e.resetToDefault(), e.appendFromJson(r), e; +}; +Hn.json = function() { + for (var r = [], e = this.defaultLength; e < this.length; e++) { + for (var t = this[e], a = t.selector, n = t.properties, i = {}, s = 0; s < n.length; s++) { + var o = n[s]; + i[o.name] = o.strValue; + } + r.push({ + selector: a ? a.toString() : "core", + style: i + }); + } + return r; +}; +var lo = {}; +lo.appendFromString = function(r) { + var e = this, t = this, a = "" + r, n, i, s; + a = a.replace(/[/][*](\s|.)+?[*][/]/g, ""); + function o() { + a.length > n.length ? a = a.substr(n.length) : a = ""; + } + function l() { + i.length > s.length ? i = i.substr(s.length) : i = ""; + } + for (; ; ) { + var u = a.match(/^\s*$/); + if (u) + break; + var v = a.match(/^\s*((?:.|\s)+?)\s*\{((?:.|\s)+?)\}/); + if (!v) { + Le("Halting stylesheet parsing: String stylesheet contains more to parse but no selector and block found in: " + a); + break; + } + n = v[0]; + var f = v[1]; + if (f !== "core") { + var c = new ot(f); + if (c.invalid) { + Le("Skipping parsing of block: Invalid selector found in string stylesheet: " + f), o(); + continue; + } + } + var h = v[2], d = !1; + i = h; + for (var y = []; ; ) { + var g = i.match(/^\s*$/); + if (g) + break; + var p = i.match(/^\s*(.+?)\s*:\s*(.+?)(?:\s*;|\s*$)/); + if (!p) { + Le("Skipping parsing of block: Invalid formatting of style property and value definitions found in:" + h), d = !0; + break; + } + s = p[0]; + var m = p[1], b = p[2], w = e.properties[m]; + if (!w) { + Le("Skipping property: Invalid property name in: " + s), l(); + continue; + } + var E = t.parse(m, b); + if (!E) { + Le("Skipping property: Invalid property definition in: " + s), l(); + continue; + } + y.push({ + name: m, + val: b + }), l(); + } + if (d) { + o(); + break; + } + t.selector(f); + for (var C = 0; C < y.length; C++) { + var x = y[C]; + t.css(x.name, x.val); + } + o(); + } + return t; +}; +lo.fromString = function(r) { + var e = this; + return e.resetToDefault(), e.appendFromString(r), e; +}; +var Ze = {}; +(function() { + var r = er, e = vc, t = cc, a = dc, n = hc, i = function(q) { + return "^" + q + "\\s*\\(\\s*([\\w\\.]+)\\s*\\)$"; + }, s = function(q) { + var H = r + "|\\w+|" + e + "|" + t + "|" + a + "|" + n; + return "^" + q + "\\s*\\(([\\w\\.]+)\\s*\\,\\s*(" + r + ")\\s*\\,\\s*(" + r + ")\\s*,\\s*(" + H + ")\\s*\\,\\s*(" + H + ")\\)$"; + }, o = [`^url\\s*\\(\\s*['"]?(.+?)['"]?\\s*\\)$`, "^(none)$", "^(.+)$"]; + Ze.types = { + time: { + number: !0, + min: 0, + units: "s|ms", + implicitUnits: "ms" + }, + percent: { + number: !0, + min: 0, + max: 100, + units: "%", + implicitUnits: "%" + }, + percentages: { + number: !0, + min: 0, + max: 100, + units: "%", + implicitUnits: "%", + multiple: !0 + }, + zeroOneNumber: { + number: !0, + min: 0, + max: 1, + unitless: !0 + }, + zeroOneNumbers: { + number: !0, + min: 0, + max: 1, + unitless: !0, + multiple: !0 + }, + nOneOneNumber: { + number: !0, + min: -1, + max: 1, + unitless: !0 + }, + nonNegativeInt: { + number: !0, + min: 0, + integer: !0, + unitless: !0 + }, + nonNegativeNumber: { + number: !0, + min: 0, + unitless: !0 + }, + position: { + enums: ["parent", "origin"] + }, + nodeSize: { + number: !0, + min: 0, + enums: ["label"] + }, + number: { + number: !0, + unitless: !0 + }, + numbers: { + number: !0, + unitless: !0, + multiple: !0 + }, + positiveNumber: { + number: !0, + unitless: !0, + min: 0, + strictMin: !0 + }, + size: { + number: !0, + min: 0 + }, + bidirectionalSize: { + number: !0 + }, + // allows negative + bidirectionalSizeMaybePercent: { + number: !0, + allowPercent: !0 + }, + // allows negative + bidirectionalSizes: { + number: !0, + multiple: !0 + }, + // allows negative + sizeMaybePercent: { + number: !0, + min: 0, + allowPercent: !0 + }, + axisDirection: { + enums: ["horizontal", "leftward", "rightward", "vertical", "upward", "downward", "auto"] + }, + axisDirectionExplicit: { + enums: ["leftward", "rightward", "upward", "downward"] + }, + axisDirectionPrimary: { + enums: ["horizontal", "vertical"] + }, + paddingRelativeTo: { + enums: ["width", "height", "average", "min", "max"] + }, + bgWH: { + number: !0, + min: 0, + allowPercent: !0, + enums: ["auto"], + multiple: !0 + }, + bgPos: { + number: !0, + allowPercent: !0, + multiple: !0 + }, + bgRelativeTo: { + enums: ["inner", "include-padding"], + multiple: !0 + }, + bgRepeat: { + enums: ["repeat", "repeat-x", "repeat-y", "no-repeat"], + multiple: !0 + }, + bgFit: { + enums: ["none", "contain", "cover"], + multiple: !0 + }, + bgCrossOrigin: { + enums: ["anonymous", "use-credentials", "null"], + multiple: !0 + }, + bgClip: { + enums: ["none", "node"], + multiple: !0 + }, + bgContainment: { + enums: ["inside", "over"], + multiple: !0 + }, + color: { + color: !0 + }, + colors: { + color: !0, + multiple: !0 + }, + fill: { + enums: ["solid", "linear-gradient", "radial-gradient"] + }, + bool: { + enums: ["yes", "no"] + }, + bools: { + enums: ["yes", "no"], + multiple: !0 + }, + lineStyle: { + enums: ["solid", "dotted", "dashed"] + }, + lineCap: { + enums: ["butt", "round", "square"] + }, + linePosition: { + enums: ["center", "inside", "outside"] + }, + lineJoin: { + enums: ["round", "bevel", "miter"] + }, + borderStyle: { + enums: ["solid", "dotted", "dashed", "double"] + }, + curveStyle: { + enums: ["bezier", "unbundled-bezier", "haystack", "segments", "straight", "straight-triangle", "taxi", "round-segments", "round-taxi"] + }, + radiusType: { + enums: ["arc-radius", "influence-radius"], + multiple: !0 + }, + fontFamily: { + regex: '^([\\w- \\"]+(?:\\s*,\\s*[\\w- \\"]+)*)$' + }, + fontStyle: { + enums: ["italic", "normal", "oblique"] + }, + fontWeight: { + enums: ["normal", "bold", "bolder", "lighter", "100", "200", "300", "400", "500", "600", "800", "900", 100, 200, 300, 400, 500, 600, 700, 800, 900] + }, + textDecoration: { + enums: ["none", "underline", "overline", "line-through"] + }, + textTransform: { + enums: ["none", "uppercase", "lowercase"] + }, + textWrap: { + enums: ["none", "wrap", "ellipsis"] + }, + textOverflowWrap: { + enums: ["whitespace", "anywhere"] + }, + textBackgroundShape: { + enums: ["rectangle", "roundrectangle", "round-rectangle"] + }, + nodeShape: { + enums: ["rectangle", "roundrectangle", "round-rectangle", "cutrectangle", "cut-rectangle", "bottomroundrectangle", "bottom-round-rectangle", "barrel", "ellipse", "triangle", "round-triangle", "square", "pentagon", "round-pentagon", "hexagon", "round-hexagon", "concavehexagon", "concave-hexagon", "heptagon", "round-heptagon", "octagon", "round-octagon", "tag", "round-tag", "star", "diamond", "round-diamond", "vee", "rhomboid", "right-rhomboid", "polygon"] + }, + overlayShape: { + enums: ["roundrectangle", "round-rectangle", "ellipse"] + }, + cornerRadius: { + number: !0, + min: 0, + units: "px|em", + implicitUnits: "px", + enums: ["auto"] + }, + compoundIncludeLabels: { + enums: ["include", "exclude"] + }, + arrowShape: { + enums: ["tee", "triangle", "triangle-tee", "circle-triangle", "triangle-cross", "triangle-backcurve", "vee", "square", "circle", "diamond", "chevron", "none"] + }, + arrowFill: { + enums: ["filled", "hollow"] + }, + arrowWidth: { + number: !0, + units: "%|px|em", + implicitUnits: "px", + enums: ["match-line"] + }, + display: { + enums: ["element", "none"] + }, + visibility: { + enums: ["hidden", "visible"] + }, + zCompoundDepth: { + enums: ["bottom", "orphan", "auto", "top"] + }, + zIndexCompare: { + enums: ["auto", "manual"] + }, + valign: { + enums: ["top", "center", "bottom"] + }, + halign: { + enums: ["left", "center", "right"] + }, + justification: { + enums: ["left", "center", "right", "auto"] + }, + text: { + string: !0 + }, + data: { + mapping: !0, + regex: i("data") + }, + layoutData: { + mapping: !0, + regex: i("layoutData") + }, + scratch: { + mapping: !0, + regex: i("scratch") + }, + mapData: { + mapping: !0, + regex: s("mapData") + }, + mapLayoutData: { + mapping: !0, + regex: s("mapLayoutData") + }, + mapScratch: { + mapping: !0, + regex: s("mapScratch") + }, + fn: { + mapping: !0, + fn: !0 + }, + url: { + regexes: o, + singleRegexMatchValue: !0 + }, + urls: { + regexes: o, + singleRegexMatchValue: !0, + multiple: !0 + }, + propList: { + propList: !0 + }, + angle: { + number: !0, + units: "deg|rad", + implicitUnits: "rad" + }, + textRotation: { + number: !0, + units: "deg|rad", + implicitUnits: "rad", + enums: ["none", "autorotate"] + }, + polygonPointList: { + number: !0, + multiple: !0, + evenMultiple: !0, + min: -1, + max: 1, + unitless: !0 + }, + edgeDistances: { + enums: ["intersection", "node-position", "endpoints"] + }, + edgeEndpoint: { + number: !0, + multiple: !0, + units: "%|px|em|deg|rad", + implicitUnits: "px", + enums: ["inside-to-node", "outside-to-node", "outside-to-node-or-label", "outside-to-line", "outside-to-line-or-label"], + singleEnum: !0, + validate: function(q, H) { + switch (q.length) { + case 2: + return H[0] !== "deg" && H[0] !== "rad" && H[1] !== "deg" && H[1] !== "rad"; + case 1: + return fe(q[0]) || H[0] === "deg" || H[0] === "rad"; + default: + return !1; + } + } + }, + easing: { + regexes: ["^(spring)\\s*\\(\\s*(" + r + ")\\s*,\\s*(" + r + ")\\s*\\)$", "^(cubic-bezier)\\s*\\(\\s*(" + r + ")\\s*,\\s*(" + r + ")\\s*,\\s*(" + r + ")\\s*,\\s*(" + r + ")\\s*\\)$"], + enums: ["linear", "ease", "ease-in", "ease-out", "ease-in-out", "ease-in-sine", "ease-out-sine", "ease-in-out-sine", "ease-in-quad", "ease-out-quad", "ease-in-out-quad", "ease-in-cubic", "ease-out-cubic", "ease-in-out-cubic", "ease-in-quart", "ease-out-quart", "ease-in-out-quart", "ease-in-quint", "ease-out-quint", "ease-in-out-quint", "ease-in-expo", "ease-out-expo", "ease-in-out-expo", "ease-in-circ", "ease-out-circ", "ease-in-out-circ"] + }, + gradientDirection: { + enums: [ + "to-bottom", + "to-top", + "to-left", + "to-right", + "to-bottom-right", + "to-bottom-left", + "to-top-right", + "to-top-left", + "to-right-bottom", + "to-left-bottom", + "to-right-top", + "to-left-top" + // different order + ] + }, + boundsExpansion: { + number: !0, + multiple: !0, + min: 0, + validate: function(q) { + var H = q.length; + return H === 1 || H === 2 || H === 4; + } + } + }; + var l = { + zeroNonZero: function(q, H) { + return (q == null || H == null) && q !== H || q == 0 && H != 0 ? !0 : q != 0 && H == 0; + }, + any: function(q, H) { + return q != H; + }, + emptyNonEmpty: function(q, H) { + var ee = nt(q), ne = nt(H); + return ee && !ne || !ee && ne; + } + }, u = Ze.types, v = [{ + name: "label", + type: u.text, + triggersBounds: l.any, + triggersZOrder: l.emptyNonEmpty + }, { + name: "text-rotation", + type: u.textRotation, + triggersBounds: l.any + }, { + name: "text-margin-x", + type: u.bidirectionalSize, + triggersBounds: l.any + }, { + name: "text-margin-y", + type: u.bidirectionalSize, + triggersBounds: l.any + }], f = [{ + name: "source-label", + type: u.text, + triggersBounds: l.any + }, { + name: "source-text-rotation", + type: u.textRotation, + triggersBounds: l.any + }, { + name: "source-text-margin-x", + type: u.bidirectionalSize, + triggersBounds: l.any + }, { + name: "source-text-margin-y", + type: u.bidirectionalSize, + triggersBounds: l.any + }, { + name: "source-text-offset", + type: u.size, + triggersBounds: l.any + }], c = [{ + name: "target-label", + type: u.text, + triggersBounds: l.any + }, { + name: "target-text-rotation", + type: u.textRotation, + triggersBounds: l.any + }, { + name: "target-text-margin-x", + type: u.bidirectionalSize, + triggersBounds: l.any + }, { + name: "target-text-margin-y", + type: u.bidirectionalSize, + triggersBounds: l.any + }, { + name: "target-text-offset", + type: u.size, + triggersBounds: l.any + }], h = [{ + name: "font-family", + type: u.fontFamily, + triggersBounds: l.any + }, { + name: "font-style", + type: u.fontStyle, + triggersBounds: l.any + }, { + name: "font-weight", + type: u.fontWeight, + triggersBounds: l.any + }, { + name: "font-size", + type: u.size, + triggersBounds: l.any + }, { + name: "text-transform", + type: u.textTransform, + triggersBounds: l.any + }, { + name: "text-wrap", + type: u.textWrap, + triggersBounds: l.any + }, { + name: "text-overflow-wrap", + type: u.textOverflowWrap, + triggersBounds: l.any + }, { + name: "text-max-width", + type: u.size, + triggersBounds: l.any + }, { + name: "text-outline-width", + type: u.size, + triggersBounds: l.any + }, { + name: "line-height", + type: u.positiveNumber, + triggersBounds: l.any + }], d = [{ + name: "text-valign", + type: u.valign, + triggersBounds: l.any + }, { + name: "text-halign", + type: u.halign, + triggersBounds: l.any + }, { + name: "color", + type: u.color + }, { + name: "text-outline-color", + type: u.color + }, { + name: "text-outline-opacity", + type: u.zeroOneNumber + }, { + name: "text-background-color", + type: u.color + }, { + name: "text-background-opacity", + type: u.zeroOneNumber + }, { + name: "text-background-padding", + type: u.size, + triggersBounds: l.any + }, { + name: "text-border-opacity", + type: u.zeroOneNumber + }, { + name: "text-border-color", + type: u.color + }, { + name: "text-border-width", + type: u.size, + triggersBounds: l.any + }, { + name: "text-border-style", + type: u.borderStyle, + triggersBounds: l.any + }, { + name: "text-background-shape", + type: u.textBackgroundShape, + triggersBounds: l.any + }, { + name: "text-justification", + type: u.justification + }, { + name: "box-select-labels", + type: u.bool, + triggersBounds: l.any + }], y = [{ + name: "events", + type: u.bool, + triggersZOrder: l.any + }, { + name: "text-events", + type: u.bool, + triggersZOrder: l.any + }], g = [{ + name: "display", + type: u.display, + triggersZOrder: l.any, + triggersBounds: l.any, + triggersBoundsOfConnectedEdges: l.any, + triggersBoundsOfParallelEdges: function(q, H, ee) { + return q === H ? !1 : ee.pstyle("curve-style").value === "bezier"; + } + }, { + name: "visibility", + type: u.visibility, + triggersZOrder: l.any + }, { + name: "opacity", + type: u.zeroOneNumber, + triggersZOrder: l.zeroNonZero + }, { + name: "text-opacity", + type: u.zeroOneNumber + }, { + name: "min-zoomed-font-size", + type: u.size + }, { + name: "z-compound-depth", + type: u.zCompoundDepth, + triggersZOrder: l.any + }, { + name: "z-index-compare", + type: u.zIndexCompare, + triggersZOrder: l.any + }, { + name: "z-index", + type: u.number, + triggersZOrder: l.any + }], p = [{ + name: "overlay-padding", + type: u.size, + triggersBounds: l.any + }, { + name: "overlay-color", + type: u.color + }, { + name: "overlay-opacity", + type: u.zeroOneNumber, + triggersBounds: l.zeroNonZero + }, { + name: "overlay-shape", + type: u.overlayShape, + triggersBounds: l.any + }, { + name: "overlay-corner-radius", + type: u.cornerRadius + }], m = [{ + name: "underlay-padding", + type: u.size, + triggersBounds: l.any + }, { + name: "underlay-color", + type: u.color + }, { + name: "underlay-opacity", + type: u.zeroOneNumber, + triggersBounds: l.zeroNonZero + }, { + name: "underlay-shape", + type: u.overlayShape, + triggersBounds: l.any + }, { + name: "underlay-corner-radius", + type: u.cornerRadius + }], b = [{ + name: "transition-property", + type: u.propList + }, { + name: "transition-duration", + type: u.time + }, { + name: "transition-delay", + type: u.time + }, { + name: "transition-timing-function", + type: u.easing + }], w = function(q, H) { + return H.value === "label" ? -q.poolIndex() : H.pfValue; + }, E = [{ + name: "height", + type: u.nodeSize, + triggersBounds: l.any, + hashOverride: w + }, { + name: "width", + type: u.nodeSize, + triggersBounds: l.any, + hashOverride: w + }, { + name: "shape", + type: u.nodeShape, + triggersBounds: l.any + }, { + name: "shape-polygon-points", + type: u.polygonPointList, + triggersBounds: l.any + }, { + name: "corner-radius", + type: u.cornerRadius + }, { + name: "background-color", + type: u.color + }, { + name: "background-fill", + type: u.fill + }, { + name: "background-opacity", + type: u.zeroOneNumber + }, { + name: "background-blacken", + type: u.nOneOneNumber + }, { + name: "background-gradient-stop-colors", + type: u.colors + }, { + name: "background-gradient-stop-positions", + type: u.percentages + }, { + name: "background-gradient-direction", + type: u.gradientDirection + }, { + name: "padding", + type: u.sizeMaybePercent, + triggersBounds: l.any + }, { + name: "padding-relative-to", + type: u.paddingRelativeTo, + triggersBounds: l.any + }, { + name: "bounds-expansion", + type: u.boundsExpansion, + triggersBounds: l.any + }], C = [{ + name: "border-color", + type: u.color + }, { + name: "border-opacity", + type: u.zeroOneNumber + }, { + name: "border-width", + type: u.size, + triggersBounds: l.any + }, { + name: "border-style", + type: u.borderStyle + }, { + name: "border-cap", + type: u.lineCap + }, { + name: "border-join", + type: u.lineJoin + }, { + name: "border-dash-pattern", + type: u.numbers + }, { + name: "border-dash-offset", + type: u.number + }, { + name: "border-position", + type: u.linePosition + }], x = [{ + name: "outline-color", + type: u.color + }, { + name: "outline-opacity", + type: u.zeroOneNumber + }, { + name: "outline-width", + type: u.size, + triggersBounds: l.any + }, { + name: "outline-style", + type: u.borderStyle + }, { + name: "outline-offset", + type: u.size, + triggersBounds: l.any + }], k = [{ + name: "background-image", + type: u.urls + }, { + name: "background-image-crossorigin", + type: u.bgCrossOrigin + }, { + name: "background-image-opacity", + type: u.zeroOneNumbers + }, { + name: "background-image-containment", + type: u.bgContainment + }, { + name: "background-image-smoothing", + type: u.bools + }, { + name: "background-position-x", + type: u.bgPos + }, { + name: "background-position-y", + type: u.bgPos + }, { + name: "background-width-relative-to", + type: u.bgRelativeTo + }, { + name: "background-height-relative-to", + type: u.bgRelativeTo + }, { + name: "background-repeat", + type: u.bgRepeat + }, { + name: "background-fit", + type: u.bgFit + }, { + name: "background-clip", + type: u.bgClip + }, { + name: "background-width", + type: u.bgWH + }, { + name: "background-height", + type: u.bgWH + }, { + name: "background-offset-x", + type: u.bgPos + }, { + name: "background-offset-y", + type: u.bgPos + }], S = [{ + name: "position", + type: u.position, + triggersBounds: l.any + }, { + name: "compound-sizing-wrt-labels", + type: u.compoundIncludeLabels, + triggersBounds: l.any + }, { + name: "min-width", + type: u.size, + triggersBounds: l.any + }, { + name: "min-width-bias-left", + type: u.sizeMaybePercent, + triggersBounds: l.any + }, { + name: "min-width-bias-right", + type: u.sizeMaybePercent, + triggersBounds: l.any + }, { + name: "min-height", + type: u.size, + triggersBounds: l.any + }, { + name: "min-height-bias-top", + type: u.sizeMaybePercent, + triggersBounds: l.any + }, { + name: "min-height-bias-bottom", + type: u.sizeMaybePercent, + triggersBounds: l.any + }], P = [{ + name: "line-style", + type: u.lineStyle + }, { + name: "line-color", + type: u.color + }, { + name: "line-fill", + type: u.fill + }, { + name: "line-cap", + type: u.lineCap + }, { + name: "line-opacity", + type: u.zeroOneNumber + }, { + name: "line-dash-pattern", + type: u.numbers + }, { + name: "line-dash-offset", + type: u.number + }, { + name: "line-outline-width", + type: u.size + }, { + name: "line-outline-color", + type: u.color + }, { + name: "line-gradient-stop-colors", + type: u.colors + }, { + name: "line-gradient-stop-positions", + type: u.percentages + }, { + name: "curve-style", + type: u.curveStyle, + triggersBounds: l.any, + triggersBoundsOfParallelEdges: function(q, H) { + return q === H ? !1 : q === "bezier" || // remove from bundle + H === "bezier"; + } + }, { + name: "haystack-radius", + type: u.zeroOneNumber, + triggersBounds: l.any + }, { + name: "source-endpoint", + type: u.edgeEndpoint, + triggersBounds: l.any + }, { + name: "target-endpoint", + type: u.edgeEndpoint, + triggersBounds: l.any + }, { + name: "control-point-step-size", + type: u.size, + triggersBounds: l.any + }, { + name: "control-point-distances", + type: u.bidirectionalSizes, + triggersBounds: l.any + }, { + name: "control-point-weights", + type: u.numbers, + triggersBounds: l.any + }, { + name: "segment-distances", + type: u.bidirectionalSizes, + triggersBounds: l.any + }, { + name: "segment-weights", + type: u.numbers, + triggersBounds: l.any + }, { + name: "segment-radii", + type: u.numbers, + triggersBounds: l.any + }, { + name: "radius-type", + type: u.radiusType, + triggersBounds: l.any + }, { + name: "taxi-turn", + type: u.bidirectionalSizeMaybePercent, + triggersBounds: l.any + }, { + name: "taxi-turn-min-distance", + type: u.size, + triggersBounds: l.any + }, { + name: "taxi-direction", + type: u.axisDirection, + triggersBounds: l.any + }, { + name: "taxi-radius", + type: u.number, + triggersBounds: l.any + }, { + name: "edge-distances", + type: u.edgeDistances, + triggersBounds: l.any + }, { + name: "arrow-scale", + type: u.positiveNumber, + triggersBounds: l.any + }, { + name: "loop-direction", + type: u.angle, + triggersBounds: l.any + }, { + name: "loop-sweep", + type: u.angle, + triggersBounds: l.any + }, { + name: "source-distance-from-node", + type: u.size, + triggersBounds: l.any + }, { + name: "target-distance-from-node", + type: u.size, + triggersBounds: l.any + }], D = [{ + name: "ghost", + type: u.bool, + triggersBounds: l.any + }, { + name: "ghost-offset-x", + type: u.bidirectionalSize, + triggersBounds: l.any + }, { + name: "ghost-offset-y", + type: u.bidirectionalSize, + triggersBounds: l.any + }, { + name: "ghost-opacity", + type: u.zeroOneNumber + }], A = [{ + name: "selection-box-color", + type: u.color + }, { + name: "selection-box-opacity", + type: u.zeroOneNumber + }, { + name: "selection-box-border-color", + type: u.color + }, { + name: "selection-box-border-width", + type: u.size + }, { + name: "active-bg-color", + type: u.color + }, { + name: "active-bg-opacity", + type: u.zeroOneNumber + }, { + name: "active-bg-size", + type: u.size + }, { + name: "outside-texture-bg-color", + type: u.color + }, { + name: "outside-texture-bg-opacity", + type: u.zeroOneNumber + }], B = []; + Ze.pieBackgroundN = 16, B.push({ + name: "pie-size", + type: u.sizeMaybePercent + }), B.push({ + name: "pie-hole", + type: u.sizeMaybePercent + }), B.push({ + name: "pie-start-angle", + type: u.angle + }); + for (var R = 1; R <= Ze.pieBackgroundN; R++) + B.push({ + name: "pie-" + R + "-background-color", + type: u.color + }), B.push({ + name: "pie-" + R + "-background-size", + type: u.percent + }), B.push({ + name: "pie-" + R + "-background-opacity", + type: u.zeroOneNumber + }); + var M = []; + Ze.stripeBackgroundN = 16, M.push({ + name: "stripe-size", + type: u.sizeMaybePercent + }), M.push({ + name: "stripe-direction", + type: u.axisDirectionPrimary + }); + for (var I = 1; I <= Ze.stripeBackgroundN; I++) + M.push({ + name: "stripe-" + I + "-background-color", + type: u.color + }), M.push({ + name: "stripe-" + I + "-background-size", + type: u.percent + }), M.push({ + name: "stripe-" + I + "-background-opacity", + type: u.zeroOneNumber + }); + var L = [], O = Ze.arrowPrefixes = ["source", "mid-source", "target", "mid-target"]; + [{ + name: "arrow-shape", + type: u.arrowShape, + triggersBounds: l.any + }, { + name: "arrow-color", + type: u.color + }, { + name: "arrow-fill", + type: u.arrowFill + }, { + name: "arrow-width", + type: u.arrowWidth + }].forEach(function(z) { + O.forEach(function(q) { + var H = q + "-" + z.name, ee = z.type, ne = z.triggersBounds; + L.push({ + name: H, + type: ee, + triggersBounds: ne + }); + }); + }, {}); + var V = Ze.properties = [].concat(y, b, g, p, m, D, d, h, v, f, c, E, C, x, k, B, M, S, P, L, A), G = Ze.propertyGroups = { + // common to all eles + behavior: y, + transition: b, + visibility: g, + overlay: p, + underlay: m, + ghost: D, + // labels + commonLabel: d, + labelDimensions: h, + mainLabel: v, + sourceLabel: f, + targetLabel: c, + // node props + nodeBody: E, + nodeBorder: C, + nodeOutline: x, + backgroundImage: k, + pie: B, + stripe: M, + compound: S, + // edge props + edgeLine: P, + edgeArrow: L, + core: A + }, N = Ze.propertyGroupNames = {}, F = Ze.propertyGroupKeys = Object.keys(G); + F.forEach(function(z) { + N[z] = G[z].map(function(q) { + return q.name; + }), G[z].forEach(function(q) { + return q.groupKey = z; + }); + }); + var K = Ze.aliases = [{ + name: "content", + pointsTo: "label" + }, { + name: "control-point-distance", + pointsTo: "control-point-distances" + }, { + name: "control-point-weight", + pointsTo: "control-point-weights" + }, { + name: "segment-distance", + pointsTo: "segment-distances" + }, { + name: "segment-weight", + pointsTo: "segment-weights" + }, { + name: "segment-radius", + pointsTo: "segment-radii" + }, { + name: "edge-text-rotation", + pointsTo: "text-rotation" + }, { + name: "padding-left", + pointsTo: "padding" + }, { + name: "padding-right", + pointsTo: "padding" + }, { + name: "padding-top", + pointsTo: "padding" + }, { + name: "padding-bottom", + pointsTo: "padding" + }]; + Ze.propertyNames = V.map(function(z) { + return z.name; + }); + for (var X = 0; X < V.length; X++) { + var Q = V[X]; + V[Q.name] = Q; + } + for (var Z = 0; Z < K.length; Z++) { + var re = K[Z], ae = V[re.pointsTo], J = { + name: re.name, + alias: !0, + pointsTo: ae + }; + V.push(J), V[re.name] = J; + } +})(); +Ze.getDefaultProperty = function(r) { + return this.getDefaultProperties()[r]; +}; +Ze.getDefaultProperties = function() { + var r = this._private; + if (r.defaultProperties != null) + return r.defaultProperties; + for (var e = he({ + // core props + "selection-box-color": "#ddd", + "selection-box-opacity": 0.65, + "selection-box-border-color": "#aaa", + "selection-box-border-width": 1, + "active-bg-color": "black", + "active-bg-opacity": 0.15, + "active-bg-size": 30, + "outside-texture-bg-color": "#000", + "outside-texture-bg-opacity": 0.125, + // common node/edge props + events: "yes", + "text-events": "no", + "text-valign": "top", + "text-halign": "center", + "text-justification": "auto", + "line-height": 1, + color: "#000", + "text-outline-color": "#000", + "text-outline-width": 0, + "text-outline-opacity": 1, + "text-opacity": 1, + "text-decoration": "none", + "text-transform": "none", + "text-wrap": "none", + "text-overflow-wrap": "whitespace", + "text-max-width": 9999, + "text-background-color": "#000", + "text-background-opacity": 0, + "text-background-shape": "rectangle", + "text-background-padding": 0, + "text-border-opacity": 0, + "text-border-width": 0, + "text-border-style": "solid", + "text-border-color": "#000", + "font-family": "Helvetica Neue, Helvetica, sans-serif", + "font-style": "normal", + "font-weight": "normal", + "font-size": 16, + "min-zoomed-font-size": 0, + "text-rotation": "none", + "source-text-rotation": "none", + "target-text-rotation": "none", + visibility: "visible", + display: "element", + opacity: 1, + "z-compound-depth": "auto", + "z-index-compare": "auto", + "z-index": 0, + label: "", + "text-margin-x": 0, + "text-margin-y": 0, + "source-label": "", + "source-text-offset": 0, + "source-text-margin-x": 0, + "source-text-margin-y": 0, + "target-label": "", + "target-text-offset": 0, + "target-text-margin-x": 0, + "target-text-margin-y": 0, + "overlay-opacity": 0, + "overlay-color": "#000", + "overlay-padding": 10, + "overlay-shape": "round-rectangle", + "overlay-corner-radius": "auto", + "underlay-opacity": 0, + "underlay-color": "#000", + "underlay-padding": 10, + "underlay-shape": "round-rectangle", + "underlay-corner-radius": "auto", + "transition-property": "none", + "transition-duration": 0, + "transition-delay": 0, + "transition-timing-function": "linear", + "box-select-labels": "no", + // node props + "background-blacken": 0, + "background-color": "#999", + "background-fill": "solid", + "background-opacity": 1, + "background-image": "none", + "background-image-crossorigin": "anonymous", + "background-image-opacity": 1, + "background-image-containment": "inside", + "background-image-smoothing": "yes", + "background-position-x": "50%", + "background-position-y": "50%", + "background-offset-x": 0, + "background-offset-y": 0, + "background-width-relative-to": "include-padding", + "background-height-relative-to": "include-padding", + "background-repeat": "no-repeat", + "background-fit": "none", + "background-clip": "node", + "background-width": "auto", + "background-height": "auto", + "border-color": "#000", + "border-opacity": 1, + "border-width": 0, + "border-style": "solid", + "border-dash-pattern": [4, 2], + "border-dash-offset": 0, + "border-cap": "butt", + "border-join": "miter", + "border-position": "center", + "outline-color": "#999", + "outline-opacity": 1, + "outline-width": 0, + "outline-offset": 0, + "outline-style": "solid", + height: 30, + width: 30, + shape: "ellipse", + "shape-polygon-points": "-1, -1, 1, -1, 1, 1, -1, 1", + "corner-radius": "auto", + "bounds-expansion": 0, + // node gradient + "background-gradient-direction": "to-bottom", + "background-gradient-stop-colors": "#999", + "background-gradient-stop-positions": "0%", + // ghost props + ghost: "no", + "ghost-offset-y": 0, + "ghost-offset-x": 0, + "ghost-opacity": 0, + // compound props + padding: 0, + "padding-relative-to": "width", + position: "origin", + "compound-sizing-wrt-labels": "include", + "min-width": 0, + "min-width-bias-left": 0, + "min-width-bias-right": 0, + "min-height": 0, + "min-height-bias-top": 0, + "min-height-bias-bottom": 0 + }, { + // node pie bg + "pie-size": "100%", + "pie-hole": 0, + "pie-start-angle": "0deg" + }, [{ + name: "pie-{{i}}-background-color", + value: "black" + }, { + name: "pie-{{i}}-background-size", + value: "0%" + }, { + name: "pie-{{i}}-background-opacity", + value: 1 + }].reduce(function(l, u) { + for (var v = 1; v <= Ze.pieBackgroundN; v++) { + var f = u.name.replace("{{i}}", v), c = u.value; + l[f] = c; + } + return l; + }, {}), { + // node stripes bg + "stripe-size": "100%", + "stripe-direction": "horizontal" + }, [{ + name: "stripe-{{i}}-background-color", + value: "black" + }, { + name: "stripe-{{i}}-background-size", + value: "0%" + }, { + name: "stripe-{{i}}-background-opacity", + value: 1 + }].reduce(function(l, u) { + for (var v = 1; v <= Ze.stripeBackgroundN; v++) { + var f = u.name.replace("{{i}}", v), c = u.value; + l[f] = c; + } + return l; + }, {}), { + // edge props + "line-style": "solid", + "line-color": "#999", + "line-fill": "solid", + "line-cap": "butt", + "line-opacity": 1, + "line-outline-width": 0, + "line-outline-color": "#000", + "line-gradient-stop-colors": "#999", + "line-gradient-stop-positions": "0%", + "control-point-step-size": 40, + "control-point-weights": 0.5, + "segment-weights": 0.5, + "segment-distances": 20, + "segment-radii": 15, + "radius-type": "arc-radius", + "taxi-turn": "50%", + "taxi-radius": 15, + "taxi-turn-min-distance": 10, + "taxi-direction": "auto", + "edge-distances": "intersection", + "curve-style": "haystack", + "haystack-radius": 0, + "arrow-scale": 1, + "loop-direction": "-45deg", + "loop-sweep": "-90deg", + "source-distance-from-node": 0, + "target-distance-from-node": 0, + "source-endpoint": "outside-to-node", + "target-endpoint": "outside-to-node", + "line-dash-pattern": [6, 3], + "line-dash-offset": 0 + }, [{ + name: "arrow-shape", + value: "none" + }, { + name: "arrow-color", + value: "#999" + }, { + name: "arrow-fill", + value: "filled" + }, { + name: "arrow-width", + value: 1 + }].reduce(function(l, u) { + return Ze.arrowPrefixes.forEach(function(v) { + var f = v + "-" + u.name, c = u.value; + l[f] = c; + }), l; + }, {})), t = {}, a = 0; a < this.properties.length; a++) { + var n = this.properties[a]; + if (!n.pointsTo) { + var i = n.name, s = e[i], o = this.parse(i, s); + t[i] = o; + } + } + return r.defaultProperties = t, r.defaultProperties; +}; +Ze.addDefaultStylesheet = function() { + this.selector(":parent").css({ + shape: "rectangle", + padding: 10, + "background-color": "#eee", + "border-color": "#ccc", + "border-width": 1 + }).selector("edge").css({ + width: 3 + }).selector(":loop").css({ + "curve-style": "bezier" + }).selector("edge:compound").css({ + "curve-style": "bezier", + "source-endpoint": "outside-to-line", + "target-endpoint": "outside-to-line" + }).selector(":selected").css({ + "background-color": "#0169D9", + "line-color": "#0169D9", + "source-arrow-color": "#0169D9", + "target-arrow-color": "#0169D9", + "mid-source-arrow-color": "#0169D9", + "mid-target-arrow-color": "#0169D9" + }).selector(":parent:selected").css({ + "background-color": "#CCE1F9", + "border-color": "#aec8e5" + }).selector(":active").css({ + "overlay-color": "black", + "overlay-padding": 10, + "overlay-opacity": 0.25 + }), this.defaultLength = this.length; +}; +var Wn = {}; +Wn.parse = function(r, e, t, a) { + var n = this; + if (We(e)) + return n.parseImplWarn(r, e, t, a); + var i = a === "mapping" || a === !0 || a === !1 || a == null ? "dontcare" : a, s = t ? "t" : "f", o = "" + e, l = sv(r, o, s, i), u = n.propCache = n.propCache || [], v; + return (v = u[l]) || (v = u[l] = n.parseImplWarn(r, e, t, a)), (t || a === "mapping") && (v = qr(v), v && (v.value = qr(v.value))), v; +}; +Wn.parseImplWarn = function(r, e, t, a) { + var n = this.parseImpl(r, e, t, a); + return !n && e != null && Le("The style property `".concat(r, ": ").concat(e, "` is invalid")), n && (n.name === "width" || n.name === "height") && e === "label" && Le("The style value of `label` is deprecated for `" + n.name + "`"), n; +}; +Wn.parseImpl = function(r, e, t, a) { + var n = this; + r = Ks(r); + var i = n.properties[r], s = e, o = n.types; + if (!i || e === void 0) + return null; + i.alias && (i = i.pointsTo, r = i.name); + var l = fe(e); + l && (e = e.trim()); + var u = i.type; + if (!u) + return null; + if (t && (e === "" || e === null)) + return { + name: r, + value: e, + bypass: !0, + deleteBypass: !0 + }; + if (We(e)) + return { + name: r, + value: e, + strValue: "fn", + mapped: o.fn, + bypass: t + }; + var v, f; + if (!(!l || a || e.length < 7 || e[1] !== "a")) { + if (e.length >= 7 && e[0] === "d" && (v = new RegExp(o.data.regex).exec(e))) { + if (t) + return !1; + var c = o.data; + return { + name: r, + value: v, + strValue: "" + e, + mapped: c, + field: v[1], + bypass: t + }; + } else if (e.length >= 10 && e[0] === "m" && (f = new RegExp(o.mapData.regex).exec(e))) { + if (t || u.multiple) + return !1; + var h = o.mapData; + if (!(u.color || u.number)) + return !1; + var d = this.parse(r, f[4]); + if (!d || d.mapped) + return !1; + var y = this.parse(r, f[5]); + if (!y || y.mapped) + return !1; + if (d.pfValue === y.pfValue || d.strValue === y.strValue) + return Le("`" + r + ": " + e + "` is not a valid mapper because the output range is zero; converting to `" + r + ": " + d.strValue + "`"), this.parse(r, d.strValue); + if (u.color) { + var g = d.value, p = y.value, m = g[0] === p[0] && g[1] === p[1] && g[2] === p[2] && // optional alpha + (g[3] === p[3] || (g[3] == null || g[3] === 1) && (p[3] == null || p[3] === 1)); + if (m) + return !1; + } + return { + name: r, + value: f, + strValue: "" + e, + mapped: h, + field: f[1], + fieldMin: parseFloat(f[2]), + // min & max are numeric + fieldMax: parseFloat(f[3]), + valueMin: d.value, + valueMax: y.value, + bypass: t + }; + } + } + if (u.multiple && a !== "multiple") { + var b; + if (l ? b = e.split(/\s+/) : Fe(e) ? b = e : b = [e], u.evenMultiple && b.length % 2 !== 0) + return null; + for (var w = [], E = [], C = [], x = "", k = !1, S = 0; S < b.length; S++) { + var P = n.parse(r, b[S], t, "multiple"); + k = k || fe(P.value), w.push(P.value), C.push(P.pfValue != null ? P.pfValue : P.value), E.push(P.units), x += (S > 0 ? " " : "") + P.strValue; + } + return u.validate && !u.validate(w, E) ? null : u.singleEnum && k ? w.length === 1 && fe(w[0]) ? { + name: r, + value: w[0], + strValue: w[0], + bypass: t + } : null : { + name: r, + value: w, + pfValue: C, + strValue: x, + bypass: t, + units: E + }; + } + var D = function() { + for (var J = 0; J < u.enums.length; J++) { + var z = u.enums[J]; + if (z === e) + return { + name: r, + value: e, + strValue: "" + e, + bypass: t + }; + } + return null; + }; + if (u.number) { + var A, B = "px"; + if (u.units && (A = u.units), u.implicitUnits && (B = u.implicitUnits), !u.unitless) + if (l) { + var R = "px|em" + (u.allowPercent ? "|\\%" : ""); + A && (R = A); + var M = e.match("^(" + er + ")(" + R + ")?$"); + M && (e = M[1], A = M[2] || B); + } else (!A || u.implicitUnits) && (A = B); + if (e = parseFloat(e), isNaN(e) && u.enums === void 0) + return null; + if (isNaN(e) && u.enums !== void 0) + return e = s, D(); + if (u.integer && !ac(e) || u.min !== void 0 && (e < u.min || u.strictMin && e === u.min) || u.max !== void 0 && (e > u.max || u.strictMax && e === u.max)) + return null; + var I = { + name: r, + value: e, + strValue: "" + e + (A || ""), + units: A, + bypass: t + }; + return u.unitless || A !== "px" && A !== "em" ? I.pfValue = e : I.pfValue = A === "px" || !A ? e : this.getEmSizeInPixels() * e, (A === "ms" || A === "s") && (I.pfValue = A === "ms" ? e : 1e3 * e), (A === "deg" || A === "rad") && (I.pfValue = A === "rad" ? e : vd(e)), A === "%" && (I.pfValue = e / 100), I; + } else if (u.propList) { + var L = [], O = "" + e; + if (O !== "none") { + for (var V = O.split(/\s*,\s*|\s+/), G = 0; G < V.length; G++) { + var N = V[G].trim(); + n.properties[N] ? L.push(N) : Le("`" + N + "` is not a valid property name"); + } + if (L.length === 0) + return null; + } + return { + name: r, + value: L, + strValue: L.length === 0 ? "none" : L.join(" "), + bypass: t + }; + } else if (u.color) { + var F = jl(e); + return F ? { + name: r, + value: F, + pfValue: F, + strValue: "rgb(" + F[0] + "," + F[1] + "," + F[2] + ")", + // n.b. no spaces b/c of multiple support + bypass: t + } : null; + } else if (u.regex || u.regexes) { + if (u.enums) { + var K = D(); + if (K) + return K; + } + for (var X = u.regexes ? u.regexes : [u.regex], Q = 0; Q < X.length; Q++) { + var Z = new RegExp(X[Q]), re = Z.exec(e); + if (re) + return { + name: r, + value: u.singleRegexMatchValue ? re[1] : re, + strValue: "" + e, + bypass: t + }; + } + return null; + } else return u.string ? { + name: r, + value: "" + e, + strValue: "" + e, + bypass: t + } : u.enums ? D() : null; +}; +var ir = function(e) { + if (!(this instanceof ir)) + return new ir(e); + if (!$s(e)) { + He("A style must have a core reference"); + return; + } + this._private = { + cy: e, + coreStyle: {} + }, this.length = 0, this.resetToDefault(); +}, gr = ir.prototype; +gr.instanceString = function() { + return "style"; +}; +gr.clear = function() { + for (var r = this._private, e = r.cy, t = e.elements(), a = 0; a < this.length; a++) + this[a] = void 0; + return this.length = 0, r.contextStyles = {}, r.propDiffs = {}, this.cleanElements(t, !0), t.forEach(function(n) { + var i = n[0]._private; + i.styleDirty = !0, i.appliedInitStyle = !1; + }), this; +}; +gr.resetToDefault = function() { + return this.clear(), this.addDefaultStylesheet(), this; +}; +gr.core = function(r) { + return this._private.coreStyle[r] || this.getDefaultProperty(r); +}; +gr.selector = function(r) { + var e = r === "core" ? null : new ot(r), t = this.length++; + return this[t] = { + selector: e, + properties: [], + mappedProperties: [], + index: t + }, this; +}; +gr.css = function() { + var r = this, e = arguments; + if (e.length === 1) + for (var t = e[0], a = 0; a < r.properties.length; a++) { + var n = r.properties[a], i = t[n.name]; + i === void 0 && (i = t[An(n.name)]), i !== void 0 && this.cssRule(n.name, i); + } + else e.length === 2 && this.cssRule(e[0], e[1]); + return this; +}; +gr.style = gr.css; +gr.cssRule = function(r, e) { + var t = this.parse(r, e); + if (t) { + var a = this.length - 1; + this[a].properties.push(t), this[a].properties[t.name] = t, t.name.match(/pie-(\d+)-background-size/) && t.value && (this._private.hasPie = !0), t.name.match(/stripe-(\d+)-background-size/) && t.value && (this._private.hasStripe = !0), t.mapped && this[a].mappedProperties.push(t); + var n = !this[a].selector; + n && (this._private.coreStyle[t.name] = t); + } + return this; +}; +gr.append = function(r) { + return Zl(r) ? r.appendToStyle(this) : Fe(r) ? this.appendFromJson(r) : fe(r) && this.appendFromString(r), this; +}; +ir.fromJson = function(r, e) { + var t = new ir(r); + return t.fromJson(e), t; +}; +ir.fromString = function(r, e) { + return new ir(r).fromString(e); +}; +[sr, Fa, uo, _r, Hn, lo, Ze, Wn].forEach(function(r) { + he(gr, r); +}); +ir.types = gr.types; +ir.properties = gr.properties; +ir.propertyGroups = gr.propertyGroups; +ir.propertyGroupNames = gr.propertyGroupNames; +ir.propertyGroupKeys = gr.propertyGroupKeys; +var hp = { + style: function(e) { + if (e) { + var t = this.setStyle(e); + t.update(); + } + return this._private.style; + }, + setStyle: function(e) { + var t = this._private; + return Zl(e) ? t.style = e.generateStyle(this) : Fe(e) ? t.style = ir.fromJson(this, e) : fe(e) ? t.style = ir.fromString(this, e) : t.style = ir(this), t.style; + }, + // e.g. cy.data() changed => recalc ele mappers + updateStyle: function() { + this.mutableElements().updateStyle(); + } +}, gp = "single", kt = { + autolock: function(e) { + if (e !== void 0) + this._private.autolock = !!e; + else + return this._private.autolock; + return this; + }, + autoungrabify: function(e) { + if (e !== void 0) + this._private.autoungrabify = !!e; + else + return this._private.autoungrabify; + return this; + }, + autounselectify: function(e) { + if (e !== void 0) + this._private.autounselectify = !!e; + else + return this._private.autounselectify; + return this; + }, + selectionType: function(e) { + var t = this._private; + if (t.selectionType == null && (t.selectionType = gp), e !== void 0) + (e === "additive" || e === "single") && (t.selectionType = e); + else + return t.selectionType; + return this; + }, + panningEnabled: function(e) { + if (e !== void 0) + this._private.panningEnabled = !!e; + else + return this._private.panningEnabled; + return this; + }, + userPanningEnabled: function(e) { + if (e !== void 0) + this._private.userPanningEnabled = !!e; + else + return this._private.userPanningEnabled; + return this; + }, + zoomingEnabled: function(e) { + if (e !== void 0) + this._private.zoomingEnabled = !!e; + else + return this._private.zoomingEnabled; + return this; + }, + userZoomingEnabled: function(e) { + if (e !== void 0) + this._private.userZoomingEnabled = !!e; + else + return this._private.userZoomingEnabled; + return this; + }, + boxSelectionEnabled: function(e) { + if (e !== void 0) + this._private.boxSelectionEnabled = !!e; + else + return this._private.boxSelectionEnabled; + return this; + }, + pan: function() { + var e = arguments, t = this._private.pan, a, n, i, s, o; + switch (e.length) { + case 0: + return t; + case 1: + if (fe(e[0])) + return a = e[0], t[a]; + if (Pe(e[0])) { + if (!this._private.panningEnabled) + return this; + i = e[0], s = i.x, o = i.y, te(s) && (t.x = s), te(o) && (t.y = o), this.emit("pan viewport"); + } + break; + case 2: + if (!this._private.panningEnabled) + return this; + a = e[0], n = e[1], (a === "x" || a === "y") && te(n) && (t[a] = n), this.emit("pan viewport"); + break; + } + return this.notify("viewport"), this; + }, + panBy: function(e, t) { + var a = arguments, n = this._private.pan, i, s, o, l, u; + if (!this._private.panningEnabled) + return this; + switch (a.length) { + case 1: + Pe(e) && (o = a[0], l = o.x, u = o.y, te(l) && (n.x += l), te(u) && (n.y += u), this.emit("pan viewport")); + break; + case 2: + i = e, s = t, (i === "x" || i === "y") && te(s) && (n[i] += s), this.emit("pan viewport"); + break; + } + return this.notify("viewport"), this; + }, + gc: function() { + this.notify("gc"); + }, + fit: function(e, t) { + var a = this.getFitViewport(e, t); + if (a) { + var n = this._private; + n.zoom = a.zoom, n.pan = a.pan, this.emit("pan zoom viewport"), this.notify("viewport"); + } + return this; + }, + getFitViewport: function(e, t) { + if (te(e) && t === void 0 && (t = e, e = void 0), !(!this._private.panningEnabled || !this._private.zoomingEnabled)) { + var a; + if (fe(e)) { + var n = e; + e = this.$(n); + } else if (sc(e)) { + var i = e; + a = { + x1: i.x1, + y1: i.y1, + x2: i.x2, + y2: i.y2 + }, a.w = a.x2 - a.x1, a.h = a.y2 - a.y1; + } else Dr(e) || (e = this.mutableElements()); + if (!(Dr(e) && e.empty())) { + a = a || e.boundingBox(); + var s = this.width(), o = this.height(), l; + if (t = te(t) ? t : 0, !isNaN(s) && !isNaN(o) && s > 0 && o > 0 && !isNaN(a.w) && !isNaN(a.h) && a.w > 0 && a.h > 0) { + l = Math.min((s - 2 * t) / a.w, (o - 2 * t) / a.h), l = l > this._private.maxZoom ? this._private.maxZoom : l, l = l < this._private.minZoom ? this._private.minZoom : l; + var u = { + // now pan to middle + x: (s - l * (a.x1 + a.x2)) / 2, + y: (o - l * (a.y1 + a.y2)) / 2 + }; + return { + zoom: l, + pan: u + }; + } + } + } + }, + zoomRange: function(e, t) { + var a = this._private; + if (t == null) { + var n = e; + e = n.min, t = n.max; + } + return te(e) && te(t) && e <= t ? (a.minZoom = e, a.maxZoom = t) : te(e) && t === void 0 && e <= a.maxZoom ? a.minZoom = e : te(t) && e === void 0 && t >= a.minZoom && (a.maxZoom = t), this; + }, + minZoom: function(e) { + return e === void 0 ? this._private.minZoom : this.zoomRange({ + min: e + }); + }, + maxZoom: function(e) { + return e === void 0 ? this._private.maxZoom : this.zoomRange({ + max: e + }); + }, + getZoomedViewport: function(e) { + var t = this._private, a = t.pan, n = t.zoom, i, s, o = !1; + if (t.zoomingEnabled || (o = !0), te(e) ? s = e : Pe(e) && (s = e.level, e.position != null ? i = Ln(e.position, n, a) : e.renderedPosition != null && (i = e.renderedPosition), i != null && !t.panningEnabled && (o = !0)), s = s > t.maxZoom ? t.maxZoom : s, s = s < t.minZoom ? t.minZoom : s, o || !te(s) || s === n || i != null && (!te(i.x) || !te(i.y))) + return null; + if (i != null) { + var l = a, u = n, v = s, f = { + x: -v / u * (i.x - l.x) + i.x, + y: -v / u * (i.y - l.y) + i.y + }; + return { + zoomed: !0, + panned: !0, + zoom: v, + pan: f + }; + } else + return { + zoomed: !0, + panned: !1, + zoom: s, + pan: a + }; + }, + zoom: function(e) { + if (e === void 0) + return this._private.zoom; + var t = this.getZoomedViewport(e), a = this._private; + return t == null || !t.zoomed ? this : (a.zoom = t.zoom, t.panned && (a.pan.x = t.pan.x, a.pan.y = t.pan.y), this.emit("zoom" + (t.panned ? " pan" : "") + " viewport"), this.notify("viewport"), this); + }, + viewport: function(e) { + var t = this._private, a = !0, n = !0, i = [], s = !1, o = !1; + if (!e) + return this; + if (te(e.zoom) || (a = !1), Pe(e.pan) || (n = !1), !a && !n) + return this; + if (a) { + var l = e.zoom; + l < t.minZoom || l > t.maxZoom || !t.zoomingEnabled ? s = !0 : (t.zoom = l, i.push("zoom")); + } + if (n && (!s || !e.cancelOnFailedZoom) && t.panningEnabled) { + var u = e.pan; + te(u.x) && (t.pan.x = u.x, o = !1), te(u.y) && (t.pan.y = u.y, o = !1), o || i.push("pan"); + } + return i.length > 0 && (i.push("viewport"), this.emit(i.join(" ")), this.notify("viewport")), this; + }, + center: function(e) { + var t = this.getCenterPan(e); + return t && (this._private.pan = t, this.emit("pan viewport"), this.notify("viewport")), this; + }, + getCenterPan: function(e, t) { + if (this._private.panningEnabled) { + if (fe(e)) { + var a = e; + e = this.mutableElements().filter(a); + } else Dr(e) || (e = this.mutableElements()); + if (e.length !== 0) { + var n = e.boundingBox(), i = this.width(), s = this.height(); + t = t === void 0 ? this._private.zoom : t; + var o = { + // middle + x: (i - t * (n.x1 + n.x2)) / 2, + y: (s - t * (n.y1 + n.y2)) / 2 + }; + return o; + } + } + }, + reset: function() { + return !this._private.panningEnabled || !this._private.zoomingEnabled ? this : (this.viewport({ + pan: { + x: 0, + y: 0 + }, + zoom: 1 + }), this); + }, + invalidateSize: function() { + this._private.sizeCache = null; + }, + size: function() { + var e = this._private, t = e.container, a = this; + return e.sizeCache = e.sizeCache || (t ? function() { + var n = a.window().getComputedStyle(t), i = function(o) { + return parseFloat(n.getPropertyValue(o)); + }; + return { + width: t.clientWidth - i("padding-left") - i("padding-right"), + height: t.clientHeight - i("padding-top") - i("padding-bottom") + }; + }() : { + // fallback if no container (not 0 b/c can be used for dividing etc) + width: 1, + height: 1 + }); + }, + width: function() { + return this.size().width; + }, + height: function() { + return this.size().height; + }, + extent: function() { + var e = this._private.pan, t = this._private.zoom, a = this.renderedExtent(), n = { + x1: (a.x1 - e.x) / t, + x2: (a.x2 - e.x) / t, + y1: (a.y1 - e.y) / t, + y2: (a.y2 - e.y) / t + }; + return n.w = n.x2 - n.x1, n.h = n.y2 - n.y1, n; + }, + renderedExtent: function() { + var e = this.width(), t = this.height(); + return { + x1: 0, + y1: 0, + x2: e, + y2: t, + w: e, + h: t + }; + }, + multiClickDebounceTime: function(e) { + if (e) this._private.multiClickDebounceTime = e; + else return this._private.multiClickDebounceTime; + return this; + } +}; +kt.centre = kt.center; +kt.autolockNodes = kt.autolock; +kt.autoungrabifyNodes = kt.autoungrabify; +var ka = { + data: Me.data({ + field: "data", + bindingEvent: "data", + allowBinding: !0, + allowSetting: !0, + settingEvent: "data", + settingTriggersEvent: !0, + triggerFnName: "trigger", + allowGetting: !0, + updateStyle: !0 + }), + removeData: Me.removeData({ + field: "data", + event: "data", + triggerFnName: "trigger", + triggerEvent: !0, + updateStyle: !0 + }), + scratch: Me.data({ + field: "scratch", + bindingEvent: "scratch", + allowBinding: !0, + allowSetting: !0, + settingEvent: "scratch", + settingTriggersEvent: !0, + triggerFnName: "trigger", + allowGetting: !0, + updateStyle: !0 + }), + removeScratch: Me.removeData({ + field: "scratch", + event: "scratch", + triggerFnName: "trigger", + triggerEvent: !0, + updateStyle: !0 + }) +}; +ka.attr = ka.data; +ka.removeAttr = ka.removeData; +var Ba = function(e) { + var t = this; + e = he({}, e); + var a = e.container; + a && !yn(a) && yn(a[0]) && (a = a[0]); + var n = a ? a._cyreg : null; + n = n || {}, n && n.cy && (n.cy.destroy(), n = {}); + var i = n.readies = n.readies || []; + a && (a._cyreg = n), n.cy = t; + var s = Je !== void 0 && a !== void 0 && !e.headless, o = e; + o.layout = he({ + name: s ? "grid" : "null" + }, o.layout), o.renderer = he({ + name: s ? "canvas" : "null" + }, o.renderer); + var l = function(d, y, g) { + return y !== void 0 ? y : g !== void 0 ? g : d; + }, u = this._private = { + container: a, + // html dom ele container + ready: !1, + // whether ready has been triggered + options: o, + // cached options + elements: new vr(this), + // elements in the graph + listeners: [], + // list of listeners + aniEles: new vr(this), + // elements being animated + data: o.data || {}, + // data for the core + scratch: {}, + // scratch object for core + layout: null, + renderer: null, + destroyed: !1, + // whether destroy was called + notificationsEnabled: !0, + // whether notifications are sent to the renderer + minZoom: 1e-50, + maxZoom: 1e50, + zoomingEnabled: l(!0, o.zoomingEnabled), + userZoomingEnabled: l(!0, o.userZoomingEnabled), + panningEnabled: l(!0, o.panningEnabled), + userPanningEnabled: l(!0, o.userPanningEnabled), + boxSelectionEnabled: l(!0, o.boxSelectionEnabled), + autolock: l(!1, o.autolock, o.autolockNodes), + autoungrabify: l(!1, o.autoungrabify, o.autoungrabifyNodes), + autounselectify: l(!1, o.autounselectify), + styleEnabled: o.styleEnabled === void 0 ? s : o.styleEnabled, + zoom: te(o.zoom) ? o.zoom : 1, + pan: { + x: Pe(o.pan) && te(o.pan.x) ? o.pan.x : 0, + y: Pe(o.pan) && te(o.pan.y) ? o.pan.y : 0 + }, + animation: { + // object for currently-running animations + current: [], + queue: [] + }, + hasCompoundNodes: !1, + multiClickDebounceTime: l(250, o.multiClickDebounceTime) + }; + this.createEmitter(), this.selectionType(o.selectionType), this.zoomRange({ + min: o.minZoom, + max: o.maxZoom + }); + var v = function(d, y) { + var g = d.some(oc); + if (g) + return ea.all(d).then(y); + y(d); + }; + u.styleEnabled && t.setStyle([]); + var f = he({}, o, o.renderer); + t.initRenderer(f); + var c = function(d, y, g) { + t.notifications(!1); + var p = t.mutableElements(); + p.length > 0 && p.remove(), d != null && (Pe(d) || Fe(d)) && t.add(d), t.one("layoutready", function(b) { + t.notifications(!0), t.emit(b), t.one("load", y), t.emitAndNotify("load"); + }).one("layoutstop", function() { + t.one("done", g), t.emit("done"); + }); + var m = he({}, t._private.options.layout); + m.eles = t.elements(), t.layout(m).run(); + }; + v([o.style, o.elements], function(h) { + var d = h[0], y = h[1]; + u.styleEnabled && t.style().append(d), c(y, function() { + t.startAnimationLoop(), u.ready = !0, We(o.ready) && t.on("ready", o.ready); + for (var g = 0; g < i.length; g++) { + var p = i[g]; + t.on("ready", p); + } + n && (n.readies = []), t.emit("ready"); + }, o.done); + }); +}, Tn = Ba.prototype; +he(Tn, { + instanceString: function() { + return "core"; + }, + isReady: function() { + return this._private.ready; + }, + destroyed: function() { + return this._private.destroyed; + }, + ready: function(e) { + return this.isReady() ? this.emitter().emit("ready", [], e) : this.on("ready", e), this; + }, + destroy: function() { + var e = this; + if (!e.destroyed()) + return e.stopAnimationLoop(), e.destroyRenderer(), this.emit("destroy"), e._private.destroyed = !0, e; + }, + hasElementWithId: function(e) { + return this._private.elements.hasElementWithId(e); + }, + getElementById: function(e) { + return this._private.elements.getElementById(e); + }, + hasCompoundNodes: function() { + return this._private.hasCompoundNodes; + }, + headless: function() { + return this._private.renderer.isHeadless(); + }, + styleEnabled: function() { + return this._private.styleEnabled; + }, + addToPool: function(e) { + return this._private.elements.merge(e), this; + }, + removeFromPool: function(e) { + return this._private.elements.unmerge(e), this; + }, + container: function() { + return this._private.container || null; + }, + window: function() { + var e = this._private.container; + if (e == null) return Je; + var t = this._private.container.ownerDocument; + return t === void 0 || t == null ? Je : t.defaultView || Je; + }, + mount: function(e) { + if (e != null) { + var t = this, a = t._private, n = a.options; + return !yn(e) && yn(e[0]) && (e = e[0]), t.stopAnimationLoop(), t.destroyRenderer(), a.container = e, a.styleEnabled = !0, t.invalidateSize(), t.initRenderer(he({}, n, n.renderer, { + // allow custom renderer name to be re-used, otherwise use canvas + name: n.renderer.name === "null" ? "canvas" : n.renderer.name + })), t.startAnimationLoop(), t.style(n.style), t.emit("mount"), t; + } + }, + unmount: function() { + var e = this; + return e.stopAnimationLoop(), e.destroyRenderer(), e.initRenderer({ + name: "null" + }), e.emit("unmount"), e; + }, + options: function() { + return qr(this._private.options); + }, + json: function(e) { + var t = this, a = t._private, n = t.mutableElements(), i = function(w) { + return t.getElementById(w.id()); + }; + if (Pe(e)) { + if (t.startBatch(), e.elements) { + var s = {}, o = function(w, E) { + for (var C = [], x = [], k = 0; k < w.length; k++) { + var S = w[k]; + if (!S.data.id) { + Le("cy.json() cannot handle elements without an ID attribute"); + continue; + } + var P = "" + S.data.id, D = t.getElementById(P); + s[P] = !0, D.length !== 0 ? x.push({ + ele: D, + json: S + }) : (E && (S.group = E), C.push(S)); + } + t.add(C); + for (var A = 0; A < x.length; A++) { + var B = x[A], R = B.ele, M = B.json; + R.json(M); + } + }; + if (Fe(e.elements)) + o(e.elements); + else + for (var l = ["nodes", "edges"], u = 0; u < l.length; u++) { + var v = l[u], f = e.elements[v]; + Fe(f) && o(f, v); + } + var c = t.collection(); + n.filter(function(b) { + return !s[b.id()]; + }).forEach(function(b) { + b.isParent() ? c.merge(b) : b.remove(); + }), c.forEach(function(b) { + return b.children().move({ + parent: null + }); + }), c.forEach(function(b) { + return i(b).remove(); + }); + } + e.style && t.style(e.style), e.zoom != null && e.zoom !== a.zoom && t.zoom(e.zoom), e.pan && (e.pan.x !== a.pan.x || e.pan.y !== a.pan.y) && t.pan(e.pan), e.data && t.data(e.data); + for (var h = ["minZoom", "maxZoom", "zoomingEnabled", "userZoomingEnabled", "panningEnabled", "userPanningEnabled", "boxSelectionEnabled", "autolock", "autoungrabify", "autounselectify", "multiClickDebounceTime"], d = 0; d < h.length; d++) { + var y = h[d]; + e[y] != null && t[y](e[y]); + } + return t.endBatch(), this; + } else { + var g = !!e, p = {}; + g ? p.elements = this.elements().map(function(b) { + return b.json(); + }) : (p.elements = {}, n.forEach(function(b) { + var w = b.group(); + p.elements[w] || (p.elements[w] = []), p.elements[w].push(b.json()); + })), this._private.styleEnabled && (p.style = t.style().json()), p.data = qr(t.data()); + var m = a.options; + return p.zoomingEnabled = a.zoomingEnabled, p.userZoomingEnabled = a.userZoomingEnabled, p.zoom = a.zoom, p.minZoom = a.minZoom, p.maxZoom = a.maxZoom, p.panningEnabled = a.panningEnabled, p.userPanningEnabled = a.userPanningEnabled, p.pan = qr(a.pan), p.boxSelectionEnabled = a.boxSelectionEnabled, p.renderer = qr(m.renderer), p.hideEdgesOnViewport = m.hideEdgesOnViewport, p.textureOnViewport = m.textureOnViewport, p.wheelSensitivity = m.wheelSensitivity, p.motionBlur = m.motionBlur, p.multiClickDebounceTime = m.multiClickDebounceTime, p; + } + } +}); +Tn.$id = Tn.getElementById; +[np, lp, Yv, Is, fn, fp, Os, cn, hp, kt, ka].forEach(function(r) { + he(Tn, r); +}); +var pp = { + fit: !0, + // whether to fit the viewport to the graph + directed: !1, + // whether the tree is directed downwards (or edges can point in any direction if false) + padding: 30, + // padding on fit + circle: !1, + // put depths in concentric circles if true, put depths top down if false + grid: !1, + // whether to create an even grid into which the DAG is placed (circle:false only) + spacingFactor: 1.75, + // positive spacing factor, larger => more space between nodes (N.B. n/a if causes overlap) + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: !0, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: !1, + // Excludes the label when calculating node bounding boxes for the layout algorithm + roots: void 0, + // the roots of the trees + depthSort: void 0, + // a sorting function to order nodes at equal depth. e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: !1, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled, + animateFilter: function(e, t) { + return !0; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: function(e, t) { + return t; + } + // transform a given node position. Useful for changing flow direction in discrete layouts +}, yp = { + maximal: !1, + // whether to shift nodes down their natural BFS depths in order to avoid upwards edges (DAGS only); setting acyclic to true sets maximal to true also + acyclic: !1 + // whether the tree is acyclic and thus a node could be shifted (due to the maximal option) multiple times without causing an infinite loop; setting to true sets maximal to true also; if you are uncertain whether a tree is acyclic, set to false to avoid potential infinite loops +}, Ot = function(e) { + return e.scratch("breadthfirst"); +}, bl = function(e, t) { + return e.scratch("breadthfirst", t); +}; +function Xv(r) { + this.options = he({}, pp, yp, r); +} +Xv.prototype.run = function() { + var r = this.options, e = r.cy, t = r.eles, a = t.nodes().filter(function(se) { + return se.isChildless(); + }), n = t, i = r.directed, s = r.acyclic || r.maximal || r.maximalAdjustments > 0, o = !!r.boundingBox, l = e.extent(), u = Sr(o ? r.boundingBox : { + x1: l.x1, + y1: l.y1, + w: l.w, + h: l.h + }), v; + if (Dr(r.roots)) + v = r.roots; + else if (Fe(r.roots)) { + for (var f = [], c = 0; c < r.roots.length; c++) { + var h = r.roots[c], d = e.getElementById(h); + f.push(d); + } + v = e.collection(f); + } else if (fe(r.roots)) + v = e.$(r.roots); + else if (i) + v = a.roots(); + else { + var y = t.components(); + v = e.collection(); + for (var g = function() { + var oe = y[p], ce = oe.maxDegree(!1), ge = oe.filter(function(de) { + return de.degree(!1) === ce; + }); + v = v.add(ge); + }, p = 0; p < y.length; p++) + g(); + } + var m = [], b = {}, w = function(oe, ce) { + m[ce] == null && (m[ce] = []); + var ge = m[ce].length; + m[ce].push(oe), bl(oe, { + index: ge, + depth: ce + }); + }, E = function(oe, ce) { + var ge = Ot(oe), de = ge.depth, ye = ge.index; + m[de][ye] = null, oe.isChildless() && w(oe, ce); + }; + n.bfs({ + roots: v, + directed: r.directed, + visit: function(oe, ce, ge, de, ye) { + var we = oe[0], De = we.id(); + we.isChildless() && w(we, ye), b[De] = !0; + } + }); + for (var C = [], x = 0; x < a.length; x++) { + var k = a[x]; + b[k.id()] || C.push(k); + } + var S = function(oe) { + for (var ce = m[oe], ge = 0; ge < ce.length; ge++) { + var de = ce[ge]; + if (de == null) { + ce.splice(ge, 1), ge--; + continue; + } + bl(de, { + depth: oe, + index: ge + }); + } + }, P = function(oe, ce) { + for (var ge = Ot(oe), de = oe.incomers().filter(function(Ye) { + return Ye.isNode() && t.has(Ye); + }), ye = -1, we = oe.id(), De = 0; De < de.length; De++) { + var ze = de[De], Ue = Ot(ze); + ye = Math.max(ye, Ue.depth); + } + if (ge.depth <= ye) { + if (!r.acyclic && ce[we]) + return null; + var Ae = ye + 1; + return E(oe, Ae), ce[we] = Ae, !0; + } + return !1; + }; + if (i && s) { + var D = [], A = {}, B = function(oe) { + return D.push(oe); + }, R = function() { + return D.shift(); + }; + for (a.forEach(function(se) { + return D.push(se); + }); D.length > 0; ) { + var M = R(), I = P(M, A); + if (I) + M.outgoers().filter(function(se) { + return se.isNode() && t.has(se); + }).forEach(B); + else if (I === null) { + Le("Detected double maximal shift for node `" + M.id() + "`. Bailing maximal adjustment due to cycle. Use `options.maximal: true` only on DAGs."); + break; + } + } + } + var L = 0; + if (r.avoidOverlap) + for (var O = 0; O < a.length; O++) { + var V = a[O], G = V.layoutDimensions(r), N = G.w, F = G.h; + L = Math.max(L, N, F); + } + var K = {}, X = function(oe) { + if (K[oe.id()]) + return K[oe.id()]; + for (var ce = Ot(oe).depth, ge = oe.neighborhood(), de = 0, ye = 0, we = 0; we < ge.length; we++) { + var De = ge[we]; + if (!(De.isEdge() || De.isParent() || !a.has(De))) { + var ze = Ot(De); + if (ze != null) { + var Ue = ze.index, Ae = ze.depth; + if (!(Ue == null || Ae == null)) { + var Ye = m[Ae].length; + Ae < ce && (de += Ue / Ye, ye++); + } + } + } + } + return ye = Math.max(1, ye), de = de / ye, ye === 0 && (de = 0), K[oe.id()] = de, de; + }, Q = function(oe, ce) { + var ge = X(oe), de = X(ce), ye = ge - de; + return ye === 0 ? Jl(oe.id(), ce.id()) : ye; + }; + r.depthSort !== void 0 && (Q = r.depthSort); + for (var Z = m.length, re = 0; re < Z; re++) + m[re].sort(Q), S(re); + for (var ae = [], J = 0; J < C.length; J++) + ae.push(C[J]); + var z = function() { + for (var oe = 0; oe < Z; oe++) + S(oe); + }; + ae.length && (m.unshift(ae), Z = m.length, z()); + for (var q = 0, H = 0; H < Z; H++) + q = Math.max(m[H].length, q); + var ee = { + x: u.x1 + u.w / 2, + y: u.y1 + u.h / 2 + }, ne = a.reduce(function(se, oe) { + return function(ce) { + return { + w: se.w === -1 ? ce.w : (se.w + ce.w) / 2, + h: se.h === -1 ? ce.h : (se.h + ce.h) / 2 + }; + }(oe.boundingBox({ + includeLabels: r.nodeDimensionsIncludeLabels + })); + }, { + w: -1, + h: -1 + }), be = Math.max( + // only one depth + Z === 1 ? 0 : ( + // inside a bounding box, no need for top & bottom padding + o ? (u.h - r.padding * 2 - ne.h) / (Z - 1) : (u.h - r.padding * 2 - ne.h) / (Z + 1) + ), + L + ), _e = m.reduce(function(se, oe) { + return Math.max(se, oe.length); + }, 0), Ie = function(oe) { + var ce = Ot(oe), ge = ce.depth, de = ce.index; + if (r.circle) { + var ye = Math.min(u.w / 2 / Z, u.h / 2 / Z); + ye = Math.max(ye, L); + var we = ye * ge + ye - (Z > 0 && m[0].length <= 3 ? ye / 2 : 0), De = 2 * Math.PI / m[ge].length * de; + return ge === 0 && m[0].length === 1 && (we = 1), { + x: ee.x + we * Math.cos(De), + y: ee.y + we * Math.sin(De) + }; + } else { + var ze = m[ge].length, Ue = Math.max( + // only one depth + ze === 1 ? 0 : ( + // inside a bounding box, no need for left & right padding + o ? (u.w - r.padding * 2 - ne.w) / ((r.grid ? _e : ze) - 1) : (u.w - r.padding * 2 - ne.w) / ((r.grid ? _e : ze) + 1) + ), + L + ), Ae = { + x: ee.x + (de + 1 - (ze + 1) / 2) * Ue, + y: ee.y + (ge + 1 - (Z + 1) / 2) * be + }; + return Ae; + } + }; + return t.nodes().layoutPositions(this, r, Ie), this; +}; +var mp = { + fit: !0, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: !0, + // prevents node overlap, may overflow boundingBox and radius if not enough space + nodeDimensionsIncludeLabels: !1, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + radius: void 0, + // the radius of the circle + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: void 0, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: !0, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + sort: void 0, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: !1, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: function(e, t) { + return !0; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: function(e, t) { + return t; + } + // transform a given node position. Useful for changing flow direction in discrete layouts +}; +function Zv(r) { + this.options = he({}, mp, r); +} +Zv.prototype.run = function() { + var r = this.options, e = r, t = r.cy, a = e.eles, n = e.counterclockwise !== void 0 ? !e.counterclockwise : e.clockwise, i = a.nodes().not(":parent"); + e.sort && (i = i.sort(e.sort)); + for (var s = Sr(e.boundingBox ? e.boundingBox : { + x1: 0, + y1: 0, + w: t.width(), + h: t.height() + }), o = { + x: s.x1 + s.w / 2, + y: s.y1 + s.h / 2 + }, l = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / i.length : e.sweep, u = l / Math.max(1, i.length - 1), v, f = 0, c = 0; c < i.length; c++) { + var h = i[c], d = h.layoutDimensions(e), y = d.w, g = d.h; + f = Math.max(f, y, g); + } + if (te(e.radius) ? v = e.radius : i.length <= 1 ? v = 0 : v = Math.min(s.h, s.w) / 2 - f, i.length > 1 && e.avoidOverlap) { + f *= 1.75; + var p = Math.cos(u) - Math.cos(0), m = Math.sin(u) - Math.sin(0), b = Math.sqrt(f * f / (p * p + m * m)); + v = Math.max(b, v); + } + var w = function(C, x) { + var k = e.startAngle + x * u * (n ? 1 : -1), S = v * Math.cos(k), P = v * Math.sin(k), D = { + x: o.x + S, + y: o.y + P + }; + return D; + }; + return a.nodes().layoutPositions(this, e, w), this; +}; +var bp = { + fit: !0, + // whether to fit the viewport to the graph + padding: 30, + // the padding on fit + startAngle: 3 / 2 * Math.PI, + // where nodes start in radians + sweep: void 0, + // how many radians should be between the first and last node (defaults to full circle) + clockwise: !0, + // whether the layout should go clockwise (true) or counterclockwise/anticlockwise (false) + equidistant: !1, + // whether levels have an equal radial distance betwen them, may cause bounding box overflow + minNodeSpacing: 10, + // min spacing between outside of nodes (used for radius adjustment) + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: !0, + // prevents node overlap, may overflow boundingBox if not enough space + nodeDimensionsIncludeLabels: !1, + // Excludes the label when calculating node bounding boxes for the layout algorithm + height: void 0, + // height of layout area (overrides container height) + width: void 0, + // width of layout area (overrides container width) + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + concentric: function(e) { + return e.degree(); + }, + levelWidth: function(e) { + return e.maxDegree() / 4; + }, + animate: !1, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: function(e, t) { + return !0; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: function(e, t) { + return t; + } + // transform a given node position. Useful for changing flow direction in discrete layouts +}; +function Qv(r) { + this.options = he({}, bp, r); +} +Qv.prototype.run = function() { + for (var r = this.options, e = r, t = e.counterclockwise !== void 0 ? !e.counterclockwise : e.clockwise, a = r.cy, n = e.eles, i = n.nodes().not(":parent"), s = Sr(e.boundingBox ? e.boundingBox : { + x1: 0, + y1: 0, + w: a.width(), + h: a.height() + }), o = { + x: s.x1 + s.w / 2, + y: s.y1 + s.h / 2 + }, l = [], u = 0, v = 0; v < i.length; v++) { + var f = i[v], c = void 0; + c = e.concentric(f), l.push({ + value: c, + node: f + }), f._private.scratch.concentric = c; + } + i.updateStyle(); + for (var h = 0; h < i.length; h++) { + var d = i[h], y = d.layoutDimensions(e); + u = Math.max(u, y.w, y.h); + } + l.sort(function(ne, be) { + return be.value - ne.value; + }); + for (var g = e.levelWidth(i), p = [[]], m = p[0], b = 0; b < l.length; b++) { + var w = l[b]; + if (m.length > 0) { + var E = Math.abs(m[0].value - w.value); + E >= g && (m = [], p.push(m)); + } + m.push(w); + } + var C = u + e.minNodeSpacing; + if (!e.avoidOverlap) { + var x = p.length > 0 && p[0].length > 1, k = Math.min(s.w, s.h) / 2 - C, S = k / (p.length + x ? 1 : 0); + C = Math.min(C, S); + } + for (var P = 0, D = 0; D < p.length; D++) { + var A = p[D], B = e.sweep === void 0 ? 2 * Math.PI - 2 * Math.PI / A.length : e.sweep, R = A.dTheta = B / Math.max(1, A.length - 1); + if (A.length > 1 && e.avoidOverlap) { + var M = Math.cos(R) - Math.cos(0), I = Math.sin(R) - Math.sin(0), L = Math.sqrt(C * C / (M * M + I * I)); + P = Math.max(L, P); + } + A.r = P, P += C; + } + if (e.equidistant) { + for (var O = 0, V = 0, G = 0; G < p.length; G++) { + var N = p[G], F = N.r - V; + O = Math.max(O, F); + } + V = 0; + for (var K = 0; K < p.length; K++) { + var X = p[K]; + K === 0 && (V = X.r), X.r = V, V += O; + } + } + for (var Q = {}, Z = 0; Z < p.length; Z++) + for (var re = p[Z], ae = re.dTheta, J = re.r, z = 0; z < re.length; z++) { + var q = re[z], H = e.startAngle + (t ? 1 : -1) * ae * z, ee = { + x: o.x + J * Math.cos(H), + y: o.y + J * Math.sin(H) + }; + Q[q.node.id()] = ee; + } + return n.nodes().layoutPositions(this, e, function(ne) { + var be = ne.id(); + return Q[be]; + }), this; +}; +var gs, wp = { + // Called on `layoutready` + ready: function() { + }, + // Called on `layoutstop` + stop: function() { + }, + // Whether to animate while running the layout + // true : Animate continuously as the layout is running + // false : Just show the end result + // 'end' : Animate with the end result, from the initial positions to the end positions + animate: !0, + // Easing of the animation for animate:'end' + animationEasing: void 0, + // The duration of the animation for animate:'end' + animationDuration: void 0, + // A function that determines whether the node should be animated + // All nodes animated by default on animate enabled + // Non-animated nodes are positioned immediately when the layout starts + animateFilter: function(e, t) { + return !0; + }, + // The layout animates only after this many milliseconds for animate:true + // (prevents flashing on fast runs) + animationThreshold: 250, + // Number of iterations between consecutive screen positions update + refresh: 20, + // Whether to fit the network view after when done + fit: !0, + // Padding on fit + padding: 30, + // Constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + boundingBox: void 0, + // Excludes the label when calculating node bounding boxes for the layout algorithm + nodeDimensionsIncludeLabels: !1, + // Randomize the initial positions of the nodes (true) or use existing positions (false) + randomize: !1, + // Extra spacing between components in non-compound graphs + componentSpacing: 40, + // Node repulsion (non overlapping) multiplier + nodeRepulsion: function(e) { + return 2048; + }, + // Node repulsion (overlapping) multiplier + nodeOverlap: 4, + // Ideal edge (non nested) length + idealEdgeLength: function(e) { + return 32; + }, + // Divisor to compute edge forces + edgeElasticity: function(e) { + return 32; + }, + // Nesting factor (multiplier) to compute ideal edge length for nested edges + nestingFactor: 1.2, + // Gravity force (constant) + gravity: 1, + // Maximum number of iterations to perform + numIter: 1e3, + // Initial temperature (maximum node displacement) + initialTemp: 1e3, + // Cooling factor (how the temperature is reduced between consecutive iterations + coolingFactor: 0.99, + // Lower temperature threshold (below this point the layout will end) + minTemp: 1 +}; +function Un(r) { + this.options = he({}, wp, r), this.options.layout = this; + var e = this.options.eles.nodes(), t = this.options.eles.edges(), a = t.filter(function(n) { + var i = n.source().data("id"), s = n.target().data("id"), o = e.some(function(u) { + return u.data("id") === i; + }), l = e.some(function(u) { + return u.data("id") === s; + }); + return !o || !l; + }); + this.options.eles = this.options.eles.not(a); +} +Un.prototype.run = function() { + var r = this.options, e = r.cy, t = this; + t.stopped = !1, (r.animate === !0 || r.animate === !1) && t.emit({ + type: "layoutstart", + layout: t + }), r.debug === !0 ? gs = !0 : gs = !1; + var a = xp(e, t, r); + gs && Cp(a), r.randomize && Tp(a); + var n = Yr(), i = function() { + Sp(a, e, r), r.fit === !0 && e.fit(r.padding); + }, s = function(c) { + return !(t.stopped || c >= r.numIter || (Dp(a, r), a.temperature = a.temperature * r.coolingFactor, a.temperature < r.minTemp)); + }, o = function() { + if (r.animate === !0 || r.animate === !1) + i(), t.one("layoutstop", r.stop), t.emit({ + type: "layoutstop", + layout: t + }); + else { + var c = r.eles.nodes(), h = jv(a, r, c); + c.layoutPositions(t, r, h); + } + }, l = 0, u = !0; + if (r.animate === !0) { + var v = function() { + for (var c = 0; u && c < r.refresh; ) + u = s(l), l++, c++; + if (!u) + xl(a, r), o(); + else { + var h = Yr(); + h - n >= r.animationThreshold && i(), mn(v); + } + }; + v(); + } else { + for (; u; ) + u = s(l), l++; + xl(a, r), o(); + } + return this; +}; +Un.prototype.stop = function() { + return this.stopped = !0, this.thread && this.thread.stop(), this.emit("layoutstop"), this; +}; +Un.prototype.destroy = function() { + return this.thread && this.thread.stop(), this; +}; +var xp = function(e, t, a) { + for (var n = a.eles.edges(), i = a.eles.nodes(), s = Sr(a.boundingBox ? a.boundingBox : { + x1: 0, + y1: 0, + w: e.width(), + h: e.height() + }), o = { + isCompound: e.hasCompoundNodes(), + layoutNodes: [], + idToIndex: {}, + nodeSize: i.size(), + graphSet: [], + indexToGraph: [], + layoutEdges: [], + edgeSize: n.size(), + temperature: a.initialTemp, + clientWidth: s.w, + clientHeight: s.h, + boundingBox: s + }, l = a.eles.components(), u = {}, v = 0; v < l.length; v++) + for (var f = l[v], c = 0; c < f.length; c++) { + var h = f[c]; + u[h.id()] = v; + } + for (var v = 0; v < o.nodeSize; v++) { + var d = i[v], y = d.layoutDimensions(a), g = {}; + g.isLocked = d.locked(), g.id = d.data("id"), g.parentId = d.data("parent"), g.cmptId = u[d.id()], g.children = [], g.positionX = d.position("x"), g.positionY = d.position("y"), g.offsetX = 0, g.offsetY = 0, g.height = y.w, g.width = y.h, g.maxX = g.positionX + g.width / 2, g.minX = g.positionX - g.width / 2, g.maxY = g.positionY + g.height / 2, g.minY = g.positionY - g.height / 2, g.padLeft = parseFloat(d.style("padding")), g.padRight = parseFloat(d.style("padding")), g.padTop = parseFloat(d.style("padding")), g.padBottom = parseFloat(d.style("padding")), g.nodeRepulsion = We(a.nodeRepulsion) ? a.nodeRepulsion(d) : a.nodeRepulsion, o.layoutNodes.push(g), o.idToIndex[g.id] = v; + } + for (var p = [], m = 0, b = -1, w = [], v = 0; v < o.nodeSize; v++) { + var d = o.layoutNodes[v], E = d.parentId; + E != null ? o.layoutNodes[o.idToIndex[E]].children.push(d.id) : (p[++b] = d.id, w.push(d.id)); + } + for (o.graphSet.push(w); m <= b; ) { + var C = p[m++], x = o.idToIndex[C], h = o.layoutNodes[x], k = h.children; + if (k.length > 0) { + o.graphSet.push(k); + for (var v = 0; v < k.length; v++) + p[++b] = k[v]; + } + } + for (var v = 0; v < o.graphSet.length; v++) + for (var S = o.graphSet[v], c = 0; c < S.length; c++) { + var P = o.idToIndex[S[c]]; + o.indexToGraph[P] = v; + } + for (var v = 0; v < o.edgeSize; v++) { + var D = n[v], A = {}; + A.id = D.data("id"), A.sourceId = D.data("source"), A.targetId = D.data("target"); + var B = We(a.idealEdgeLength) ? a.idealEdgeLength(D) : a.idealEdgeLength, R = We(a.edgeElasticity) ? a.edgeElasticity(D) : a.edgeElasticity, M = o.idToIndex[A.sourceId], I = o.idToIndex[A.targetId], L = o.indexToGraph[M], O = o.indexToGraph[I]; + if (L != O) { + for (var V = Ep(A.sourceId, A.targetId, o), G = o.graphSet[V], N = 0, g = o.layoutNodes[M]; G.indexOf(g.id) === -1; ) + g = o.layoutNodes[o.idToIndex[g.parentId]], N++; + for (g = o.layoutNodes[I]; G.indexOf(g.id) === -1; ) + g = o.layoutNodes[o.idToIndex[g.parentId]], N++; + B *= N * a.nestingFactor; + } + A.idealLength = B, A.elasticity = R, o.layoutEdges.push(A); + } + return o; +}, Ep = function(e, t, a) { + var n = Jv(e, t, 0, a); + return 2 > n.count ? 0 : n.graph; +}, Jv = function(e, t, a, n) { + var i = n.graphSet[a]; + if (-1 < i.indexOf(e) && -1 < i.indexOf(t)) + return { + count: 2, + graph: a + }; + for (var s = 0, o = 0; o < i.length; o++) { + var l = i[o], u = n.idToIndex[l], v = n.layoutNodes[u].children; + if (v.length !== 0) { + var f = n.indexToGraph[n.idToIndex[v[0]]], c = Jv(e, t, f, n); + if (c.count !== 0) + if (c.count === 1) { + if (s++, s === 2) + break; + } else + return c; + } + } + return { + count: s, + graph: a + }; +}, Cp, Tp = function(e, t) { + for (var a = e.clientWidth, n = e.clientHeight, i = 0; i < e.nodeSize; i++) { + var s = e.layoutNodes[i]; + s.children.length === 0 && !s.isLocked && (s.positionX = Math.random() * a, s.positionY = Math.random() * n); + } +}, jv = function(e, t, a) { + var n = e.boundingBox, i = { + x1: 1 / 0, + x2: -1 / 0, + y1: 1 / 0, + y2: -1 / 0 + }; + return t.boundingBox && (a.forEach(function(s) { + var o = e.layoutNodes[e.idToIndex[s.data("id")]]; + i.x1 = Math.min(i.x1, o.positionX), i.x2 = Math.max(i.x2, o.positionX), i.y1 = Math.min(i.y1, o.positionY), i.y2 = Math.max(i.y2, o.positionY); + }), i.w = i.x2 - i.x1, i.h = i.y2 - i.y1), function(s, o) { + var l = e.layoutNodes[e.idToIndex[s.data("id")]]; + if (t.boundingBox) { + var u = (l.positionX - i.x1) / i.w, v = (l.positionY - i.y1) / i.h; + return { + x: n.x1 + u * n.w, + y: n.y1 + v * n.h + }; + } else + return { + x: l.positionX, + y: l.positionY + }; + }; +}, Sp = function(e, t, a) { + var n = a.layout, i = a.eles.nodes(), s = jv(e, a, i); + i.positions(s), e.ready !== !0 && (e.ready = !0, n.one("layoutready", a.ready), n.emit({ + type: "layoutready", + layout: this + })); +}, Dp = function(e, t, a) { + kp(e, t), Ap(e), Rp(e, t), Mp(e), Lp(e); +}, kp = function(e, t) { + for (var a = 0; a < e.graphSet.length; a++) + for (var n = e.graphSet[a], i = n.length, s = 0; s < i; s++) + for (var o = e.layoutNodes[e.idToIndex[n[s]]], l = s + 1; l < i; l++) { + var u = e.layoutNodes[e.idToIndex[n[l]]]; + Bp(o, u, e, t); + } +}, wl = function(e) { + return -1 + 2 * e * Math.random(); +}, Bp = function(e, t, a, n) { + var i = e.cmptId, s = t.cmptId; + if (!(i !== s && !a.isCompound)) { + var o = t.positionX - e.positionX, l = t.positionY - e.positionY, u = 1; + o === 0 && l === 0 && (o = wl(u), l = wl(u)); + var v = Pp(e, t, o, l); + if (v > 0) + var f = n.nodeOverlap * v, c = Math.sqrt(o * o + l * l), h = f * o / c, d = f * l / c; + else + var y = Sn(e, o, l), g = Sn(t, -1 * o, -1 * l), p = g.x - y.x, m = g.y - y.y, b = p * p + m * m, c = Math.sqrt(b), f = (e.nodeRepulsion + t.nodeRepulsion) / b, h = f * p / c, d = f * m / c; + e.isLocked || (e.offsetX -= h, e.offsetY -= d), t.isLocked || (t.offsetX += h, t.offsetY += d); + } +}, Pp = function(e, t, a, n) { + if (a > 0) + var i = e.maxX - t.minX; + else + var i = t.maxX - e.minX; + if (n > 0) + var s = e.maxY - t.minY; + else + var s = t.maxY - e.minY; + return i >= 0 && s >= 0 ? Math.sqrt(i * i + s * s) : 0; +}, Sn = function(e, t, a) { + var n = e.positionX, i = e.positionY, s = e.height || 1, o = e.width || 1, l = a / t, u = s / o, v = {}; + return t === 0 && 0 < a || t === 0 && 0 > a ? (v.x = n, v.y = i + s / 2, v) : 0 < t && -1 * u <= l && l <= u ? (v.x = n + o / 2, v.y = i + o * a / 2 / t, v) : 0 > t && -1 * u <= l && l <= u ? (v.x = n - o / 2, v.y = i - o * a / 2 / t, v) : 0 < a && (l <= -1 * u || l >= u) ? (v.x = n + s * t / 2 / a, v.y = i + s / 2, v) : (0 > a && (l <= -1 * u || l >= u) && (v.x = n - s * t / 2 / a, v.y = i - s / 2), v); +}, Ap = function(e, t) { + for (var a = 0; a < e.edgeSize; a++) { + var n = e.layoutEdges[a], i = e.idToIndex[n.sourceId], s = e.layoutNodes[i], o = e.idToIndex[n.targetId], l = e.layoutNodes[o], u = l.positionX - s.positionX, v = l.positionY - s.positionY; + if (!(u === 0 && v === 0)) { + var f = Sn(s, u, v), c = Sn(l, -1 * u, -1 * v), h = c.x - f.x, d = c.y - f.y, y = Math.sqrt(h * h + d * d), g = Math.pow(n.idealLength - y, 2) / n.elasticity; + if (y !== 0) + var p = g * h / y, m = g * d / y; + else + var p = 0, m = 0; + s.isLocked || (s.offsetX += p, s.offsetY += m), l.isLocked || (l.offsetX -= p, l.offsetY -= m); + } + } +}, Rp = function(e, t) { + if (t.gravity !== 0) + for (var a = 1, n = 0; n < e.graphSet.length; n++) { + var i = e.graphSet[n], s = i.length; + if (n === 0) + var o = e.clientHeight / 2, l = e.clientWidth / 2; + else + var u = e.layoutNodes[e.idToIndex[i[0]]], v = e.layoutNodes[e.idToIndex[u.parentId]], o = v.positionX, l = v.positionY; + for (var f = 0; f < s; f++) { + var c = e.layoutNodes[e.idToIndex[i[f]]]; + if (!c.isLocked) { + var h = o - c.positionX, d = l - c.positionY, y = Math.sqrt(h * h + d * d); + if (y > a) { + var g = t.gravity * h / y, p = t.gravity * d / y; + c.offsetX += g, c.offsetY += p; + } + } + } + } +}, Mp = function(e, t) { + var a = [], n = 0, i = -1; + for (a.push.apply(a, e.graphSet[0]), i += e.graphSet[0].length; n <= i; ) { + var s = a[n++], o = e.idToIndex[s], l = e.layoutNodes[o], u = l.children; + if (0 < u.length && !l.isLocked) { + for (var v = l.offsetX, f = l.offsetY, c = 0; c < u.length; c++) { + var h = e.layoutNodes[e.idToIndex[u[c]]]; + h.offsetX += v, h.offsetY += f, a[++i] = u[c]; + } + l.offsetX = 0, l.offsetY = 0; + } + } +}, Lp = function(e, t) { + for (var a = 0; a < e.nodeSize; a++) { + var n = e.layoutNodes[a]; + 0 < n.children.length && (n.maxX = void 0, n.minX = void 0, n.maxY = void 0, n.minY = void 0); + } + for (var a = 0; a < e.nodeSize; a++) { + var n = e.layoutNodes[a]; + if (!(0 < n.children.length || n.isLocked)) { + var i = Ip(n.offsetX, n.offsetY, e.temperature); + n.positionX += i.x, n.positionY += i.y, n.offsetX = 0, n.offsetY = 0, n.minX = n.positionX - n.width, n.maxX = n.positionX + n.width, n.minY = n.positionY - n.height, n.maxY = n.positionY + n.height, ef(n, e); + } + } + for (var a = 0; a < e.nodeSize; a++) { + var n = e.layoutNodes[a]; + 0 < n.children.length && !n.isLocked && (n.positionX = (n.maxX + n.minX) / 2, n.positionY = (n.maxY + n.minY) / 2, n.width = n.maxX - n.minX, n.height = n.maxY - n.minY); + } +}, Ip = function(e, t, a) { + var n = Math.sqrt(e * e + t * t); + if (n > a) + var i = { + x: a * e / n, + y: a * t / n + }; + else + var i = { + x: e, + y: t + }; + return i; +}, ef = function(e, t) { + var a = e.parentId; + if (a != null) { + var n = t.layoutNodes[t.idToIndex[a]], i = !1; + if ((n.maxX == null || e.maxX + n.padRight > n.maxX) && (n.maxX = e.maxX + n.padRight, i = !0), (n.minX == null || e.minX - n.padLeft < n.minX) && (n.minX = e.minX - n.padLeft, i = !0), (n.maxY == null || e.maxY + n.padBottom > n.maxY) && (n.maxY = e.maxY + n.padBottom, i = !0), (n.minY == null || e.minY - n.padTop < n.minY) && (n.minY = e.minY - n.padTop, i = !0), i) + return ef(n, t); + } +}, xl = function(e, t) { + for (var a = e.layoutNodes, n = [], i = 0; i < a.length; i++) { + var s = a[i], o = s.cmptId, l = n[o] = n[o] || []; + l.push(s); + } + for (var u = 0, i = 0; i < n.length; i++) { + var v = n[i]; + if (v) { + v.x1 = 1 / 0, v.x2 = -1 / 0, v.y1 = 1 / 0, v.y2 = -1 / 0; + for (var f = 0; f < v.length; f++) { + var c = v[f]; + v.x1 = Math.min(v.x1, c.positionX - c.width / 2), v.x2 = Math.max(v.x2, c.positionX + c.width / 2), v.y1 = Math.min(v.y1, c.positionY - c.height / 2), v.y2 = Math.max(v.y2, c.positionY + c.height / 2); + } + v.w = v.x2 - v.x1, v.h = v.y2 - v.y1, u += v.w * v.h; + } + } + n.sort(function(m, b) { + return b.w * b.h - m.w * m.h; + }); + for (var h = 0, d = 0, y = 0, g = 0, p = Math.sqrt(u) * e.clientWidth / e.clientHeight, i = 0; i < n.length; i++) { + var v = n[i]; + if (v) { + for (var f = 0; f < v.length; f++) { + var c = v[f]; + c.isLocked || (c.positionX += h - v.x1, c.positionY += d - v.y1); + } + h += v.w + t.componentSpacing, y += v.w + t.componentSpacing, g = Math.max(g, v.h), y > p && (d += g + t.componentSpacing, h = 0, y = 0, g = 0); + } + } +}, Op = { + fit: !0, + // whether to fit the viewport to the graph + padding: 30, + // padding used on fit + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + avoidOverlap: !0, + // prevents node overlap, may overflow boundingBox if not enough space + avoidOverlapPadding: 10, + // extra spacing around nodes when avoidOverlap: true + nodeDimensionsIncludeLabels: !1, + // Excludes the label when calculating node bounding boxes for the layout algorithm + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + condense: !1, + // uses all available space on false, uses minimal space on true + rows: void 0, + // force num of rows in the grid + cols: void 0, + // force num of columns in the grid + position: function(e) { + }, + // returns { row, col } for element + sort: void 0, + // a sorting function to order the nodes; e.g. function(a, b){ return a.data('weight') - b.data('weight') } + animate: !1, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: function(e, t) { + return !0; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: function(e, t) { + return t; + } + // transform a given node position. Useful for changing flow direction in discrete layouts +}; +function rf(r) { + this.options = he({}, Op, r); +} +rf.prototype.run = function() { + var r = this.options, e = r, t = r.cy, a = e.eles, n = a.nodes().not(":parent"); + e.sort && (n = n.sort(e.sort)); + var i = Sr(e.boundingBox ? e.boundingBox : { + x1: 0, + y1: 0, + w: t.width(), + h: t.height() + }); + if (i.h === 0 || i.w === 0) + a.nodes().layoutPositions(this, e, function(K) { + return { + x: i.x1, + y: i.y1 + }; + }); + else { + var s = n.size(), o = Math.sqrt(s * i.h / i.w), l = Math.round(o), u = Math.round(i.w / i.h * o), v = function(X) { + if (X == null) + return Math.min(l, u); + var Q = Math.min(l, u); + Q == l ? l = X : u = X; + }, f = function(X) { + if (X == null) + return Math.max(l, u); + var Q = Math.max(l, u); + Q == l ? l = X : u = X; + }, c = e.rows, h = e.cols != null ? e.cols : e.columns; + if (c != null && h != null) + l = c, u = h; + else if (c != null && h == null) + l = c, u = Math.ceil(s / l); + else if (c == null && h != null) + u = h, l = Math.ceil(s / u); + else if (u * l > s) { + var d = v(), y = f(); + (d - 1) * y >= s ? v(d - 1) : (y - 1) * d >= s && f(y - 1); + } else + for (; u * l < s; ) { + var g = v(), p = f(); + (p + 1) * g >= s ? f(p + 1) : v(g + 1); + } + var m = i.w / u, b = i.h / l; + if (e.condense && (m = 0, b = 0), e.avoidOverlap) + for (var w = 0; w < n.length; w++) { + var E = n[w], C = E._private.position; + (C.x == null || C.y == null) && (C.x = 0, C.y = 0); + var x = E.layoutDimensions(e), k = e.avoidOverlapPadding, S = x.w + k, P = x.h + k; + m = Math.max(m, S), b = Math.max(b, P); + } + for (var D = {}, A = function(X, Q) { + return !!D["c-" + X + "-" + Q]; + }, B = function(X, Q) { + D["c-" + X + "-" + Q] = !0; + }, R = 0, M = 0, I = function() { + M++, M >= u && (M = 0, R++); + }, L = {}, O = 0; O < n.length; O++) { + var V = n[O], G = e.position(V); + if (G && (G.row !== void 0 || G.col !== void 0)) { + var N = { + row: G.row, + col: G.col + }; + if (N.col === void 0) + for (N.col = 0; A(N.row, N.col); ) + N.col++; + else if (N.row === void 0) + for (N.row = 0; A(N.row, N.col); ) + N.row++; + L[V.id()] = N, B(N.row, N.col); + } + } + var F = function(X, Q) { + var Z, re; + if (X.locked() || X.isParent()) + return !1; + var ae = L[X.id()]; + if (ae) + Z = ae.col * m + m / 2 + i.x1, re = ae.row * b + b / 2 + i.y1; + else { + for (; A(R, M); ) + I(); + Z = M * m + m / 2 + i.x1, re = R * b + b / 2 + i.y1, B(R, M), I(); + } + return { + x: Z, + y: re + }; + }; + n.layoutPositions(this, e, F); + } + return this; +}; +var Np = { + ready: function() { + }, + // on layoutready + stop: function() { + } + // on layoutstop +}; +function vo(r) { + this.options = he({}, Np, r); +} +vo.prototype.run = function() { + var r = this.options, e = r.eles, t = this; + return r.cy, t.emit("layoutstart"), e.nodes().positions(function() { + return { + x: 0, + y: 0 + }; + }), t.one("layoutready", r.ready), t.emit("layoutready"), t.one("layoutstop", r.stop), t.emit("layoutstop"), this; +}; +vo.prototype.stop = function() { + return this; +}; +var zp = { + positions: void 0, + // map of (node id) => (position obj); or function(node){ return somPos; } + zoom: void 0, + // the zoom level to set (prob want fit = false if set) + pan: void 0, + // the pan level to set (prob want fit = false if set) + fit: !0, + // whether to fit to viewport + padding: 30, + // padding on fit + spacingFactor: void 0, + // Applies a multiplicative factor (>0) to expand or compress the overall area that the nodes take up + animate: !1, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: function(e, t) { + return !0; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: function(e, t) { + return t; + } + // transform a given node position. Useful for changing flow direction in discrete layouts +}; +function tf(r) { + this.options = he({}, zp, r); +} +tf.prototype.run = function() { + var r = this.options, e = r.eles, t = e.nodes(), a = We(r.positions); + function n(i) { + if (r.positions == null) + return id(i.position()); + if (a) + return r.positions(i); + var s = r.positions[i._private.data.id]; + return s ?? null; + } + return t.layoutPositions(this, r, function(i, s) { + var o = n(i); + return i.locked() || o == null ? !1 : o; + }), this; +}; +var Fp = { + fit: !0, + // whether to fit to viewport + padding: 30, + // fit padding + boundingBox: void 0, + // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h } + animate: !1, + // whether to transition the node positions + animationDuration: 500, + // duration of animation in ms if enabled + animationEasing: void 0, + // easing of animation if enabled + animateFilter: function(e, t) { + return !0; + }, + // a function that determines whether the node should be animated. All nodes animated by default on animate enabled. Non-animated nodes are positioned immediately when the layout starts + ready: void 0, + // callback on layoutready + stop: void 0, + // callback on layoutstop + transform: function(e, t) { + return t; + } + // transform a given node position. Useful for changing flow direction in discrete layouts +}; +function af(r) { + this.options = he({}, Fp, r); +} +af.prototype.run = function() { + var r = this.options, e = r.cy, t = r.eles, a = Sr(r.boundingBox ? r.boundingBox : { + x1: 0, + y1: 0, + w: e.width(), + h: e.height() + }), n = function(s, o) { + return { + x: a.x1 + Math.round(Math.random() * a.w), + y: a.y1 + Math.round(Math.random() * a.h) + }; + }; + return t.nodes().layoutPositions(this, r, n), this; +}; +var Vp = [{ + name: "breadthfirst", + impl: Xv +}, { + name: "circle", + impl: Zv +}, { + name: "concentric", + impl: Qv +}, { + name: "cose", + impl: Un +}, { + name: "grid", + impl: rf +}, { + name: "null", + impl: vo +}, { + name: "preset", + impl: tf +}, { + name: "random", + impl: af +}]; +function nf(r) { + this.options = r, this.notifications = 0; +} +var El = function() { +}, Cl = function() { + throw new Error("A headless instance can not render images"); +}; +nf.prototype = { + recalculateRenderedStyle: El, + notify: function() { + this.notifications++; + }, + init: El, + isHeadless: function() { + return !0; + }, + png: Cl, + jpg: Cl +}; +var fo = {}; +fo.arrowShapeWidth = 0.3; +fo.registerArrowShapes = function() { + var r = this.arrowShapes = {}, e = this, t = function(u, v, f, c, h, d, y) { + var g = h.x - f / 2 - y, p = h.x + f / 2 + y, m = h.y - f / 2 - y, b = h.y + f / 2 + y, w = g <= u && u <= p && m <= v && v <= b; + return w; + }, a = function(u, v, f, c, h) { + var d = u * Math.cos(c) - v * Math.sin(c), y = u * Math.sin(c) + v * Math.cos(c), g = d * f, p = y * f, m = g + h.x, b = p + h.y; + return { + x: m, + y: b + }; + }, n = function(u, v, f, c) { + for (var h = [], d = 0; d < u.length; d += 2) { + var y = u[d], g = u[d + 1]; + h.push(a(y, g, v, f, c)); + } + return h; + }, i = function(u) { + for (var v = [], f = 0; f < u.length; f++) { + var c = u[f]; + v.push(c.x, c.y); + } + return v; + }, s = function(u) { + return u.pstyle("width").pfValue * u.pstyle("arrow-scale").pfValue * 2; + }, o = function(u, v) { + fe(v) && (v = r[v]), r[u] = he({ + name: u, + points: [-0.15, -0.3, 0.15, -0.3, 0.15, 0.3, -0.15, 0.3], + collide: function(c, h, d, y, g, p) { + var m = i(n(this.points, d + 2 * p, y, g)), b = Cr(c, h, m); + return b; + }, + roughCollide: t, + draw: function(c, h, d, y) { + var g = n(this.points, h, d, y); + e.arrowShapeImpl("polygon")(c, g); + }, + spacing: function(c) { + return 0; + }, + gap: s + }, v); + }; + o("none", { + collide: bn, + roughCollide: bn, + draw: Zs, + spacing: Vo, + gap: Vo + }), o("triangle", { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3] + }), o("arrow", "triangle"), o("triangle-backcurve", { + points: r.triangle.points, + controlPoint: [0, -0.15], + roughCollide: t, + draw: function(u, v, f, c, h) { + var d = n(this.points, v, f, c), y = this.controlPoint, g = a(y[0], y[1], v, f, c); + e.arrowShapeImpl(this.name)(u, d, g); + }, + gap: function(u) { + return s(u) * 0.8; + } + }), o("triangle-tee", { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + pointsTee: [-0.15, -0.4, -0.15, -0.5, 0.15, -0.5, 0.15, -0.4], + collide: function(u, v, f, c, h, d, y) { + var g = i(n(this.points, f + 2 * y, c, h)), p = i(n(this.pointsTee, f + 2 * y, c, h)), m = Cr(u, v, g) || Cr(u, v, p); + return m; + }, + draw: function(u, v, f, c, h) { + var d = n(this.points, v, f, c), y = n(this.pointsTee, v, f, c); + e.arrowShapeImpl(this.name)(u, d, y); + } + }), o("circle-triangle", { + radius: 0.15, + pointsTr: [0, -0.15, 0.15, -0.45, -0.15, -0.45, 0, -0.15], + collide: function(u, v, f, c, h, d, y) { + var g = h, p = Math.pow(g.x - u, 2) + Math.pow(g.y - v, 2) <= Math.pow((f + 2 * y) * this.radius, 2), m = i(n(this.points, f + 2 * y, c, h)); + return Cr(u, v, m) || p; + }, + draw: function(u, v, f, c, h) { + var d = n(this.pointsTr, v, f, c); + e.arrowShapeImpl(this.name)(u, d, c.x, c.y, this.radius * v); + }, + spacing: function(u) { + return e.getArrowWidth(u.pstyle("width").pfValue, u.pstyle("arrow-scale").value) * this.radius; + } + }), o("triangle-cross", { + points: [0, 0, 0.15, -0.3, -0.15, -0.3, 0, 0], + baseCrossLinePts: [ + -0.15, + -0.4, + // first half of the rectangle + -0.15, + -0.4, + 0.15, + -0.4, + // second half of the rectangle + 0.15, + -0.4 + ], + crossLinePts: function(u, v) { + var f = this.baseCrossLinePts.slice(), c = v / u, h = 3, d = 5; + return f[h] = f[h] - c, f[d] = f[d] - c, f; + }, + collide: function(u, v, f, c, h, d, y) { + var g = i(n(this.points, f + 2 * y, c, h)), p = i(n(this.crossLinePts(f, d), f + 2 * y, c, h)), m = Cr(u, v, g) || Cr(u, v, p); + return m; + }, + draw: function(u, v, f, c, h) { + var d = n(this.points, v, f, c), y = n(this.crossLinePts(v, h), v, f, c); + e.arrowShapeImpl(this.name)(u, d, y); + } + }), o("vee", { + points: [-0.15, -0.3, 0, 0, 0.15, -0.3, 0, -0.15], + gap: function(u) { + return s(u) * 0.525; + } + }), o("circle", { + radius: 0.15, + collide: function(u, v, f, c, h, d, y) { + var g = h, p = Math.pow(g.x - u, 2) + Math.pow(g.y - v, 2) <= Math.pow((f + 2 * y) * this.radius, 2); + return p; + }, + draw: function(u, v, f, c, h) { + e.arrowShapeImpl(this.name)(u, c.x, c.y, this.radius * v); + }, + spacing: function(u) { + return e.getArrowWidth(u.pstyle("width").pfValue, u.pstyle("arrow-scale").value) * this.radius; + } + }), o("tee", { + points: [-0.15, 0, -0.15, -0.1, 0.15, -0.1, 0.15, 0], + spacing: function(u) { + return 1; + }, + gap: function(u) { + return 1; + } + }), o("square", { + points: [-0.15, 0, 0.15, 0, 0.15, -0.3, -0.15, -0.3] + }), o("diamond", { + points: [-0.15, -0.15, 0, -0.3, 0.15, -0.15, 0, 0], + gap: function(u) { + return u.pstyle("width").pfValue * u.pstyle("arrow-scale").value; + } + }), o("chevron", { + points: [0, 0, -0.15, -0.15, -0.1, -0.2, 0, -0.1, 0.1, -0.2, 0.15, -0.15], + gap: function(u) { + return 0.95 * u.pstyle("width").pfValue * u.pstyle("arrow-scale").value; + } + }); +}; +var Pt = {}; +Pt.projectIntoViewport = function(r, e) { + var t = this.cy, a = this.findContainerClientCoords(), n = a[0], i = a[1], s = a[4], o = t.pan(), l = t.zoom(), u = ((r - n) / s - o.x) / l, v = ((e - i) / s - o.y) / l; + return [u, v]; +}; +Pt.findContainerClientCoords = function() { + if (this.containerBB) + return this.containerBB; + var r = this.container, e = r.getBoundingClientRect(), t = this.cy.window().getComputedStyle(r), a = function(p) { + return parseFloat(t.getPropertyValue(p)); + }, n = { + left: a("padding-left"), + right: a("padding-right"), + top: a("padding-top"), + bottom: a("padding-bottom") + }, i = { + left: a("border-left-width"), + right: a("border-right-width"), + top: a("border-top-width"), + bottom: a("border-bottom-width") + }, s = r.clientWidth, o = r.clientHeight, l = n.left + n.right, u = n.top + n.bottom, v = i.left + i.right, f = e.width / (s + v), c = s - l, h = o - u, d = e.left + n.left + i.left, y = e.top + n.top + i.top; + return this.containerBB = [d, y, c, h, f]; +}; +Pt.invalidateContainerClientCoordsCache = function() { + this.containerBB = null; +}; +Pt.findNearestElement = function(r, e, t, a) { + return this.findNearestElements(r, e, t, a)[0]; +}; +Pt.findNearestElements = function(r, e, t, a) { + var n = this, i = this, s = i.getCachedZSortedEles(), o = [], l = i.cy.zoom(), u = i.cy.hasCompoundNodes(), v = (a ? 24 : 8) / l, f = (a ? 8 : 2) / l, c = (a ? 8 : 2) / l, h = 1 / 0, d, y; + t && (s = s.interactive); + function g(x, k) { + if (x.isNode()) { + if (y) + return; + y = x, o.push(x); + } + if (x.isEdge() && (k == null || k < h)) + if (d) { + if (d.pstyle("z-compound-depth").value === x.pstyle("z-compound-depth").value && d.pstyle("z-compound-depth").value === x.pstyle("z-compound-depth").value) { + for (var S = 0; S < o.length; S++) + if (o[S].isEdge()) { + o[S] = x, d = x, h = k ?? h; + break; + } + } + } else + o.push(x), d = x, h = k ?? h; + } + function p(x) { + var k = x.outerWidth() + 2 * f, S = x.outerHeight() + 2 * f, P = k / 2, D = S / 2, A = x.position(), B = x.pstyle("corner-radius").value === "auto" ? "auto" : x.pstyle("corner-radius").pfValue, R = x._private.rscratch; + if (A.x - P <= r && r <= A.x + P && A.y - D <= e && e <= A.y + D) { + var M = i.nodeShapes[n.getNodeShape(x)]; + if (M.checkPoint(r, e, 0, k, S, A.x, A.y, B, R)) + return g(x, 0), !0; + } + } + function m(x) { + var k = x._private, S = k.rscratch, P = x.pstyle("width").pfValue, D = x.pstyle("arrow-scale").value, A = P / 2 + v, B = A * A, R = A * 2, O = k.source, V = k.target, M; + if (S.edgeType === "segments" || S.edgeType === "straight" || S.edgeType === "haystack") { + for (var I = S.allpts, L = 0; L + 3 < I.length; L += 2) + if (bd(r, e, I[L], I[L + 1], I[L + 2], I[L + 3], R) && B > (M = Td(r, e, I[L], I[L + 1], I[L + 2], I[L + 3]))) + return g(x, M), !0; + } else if (S.edgeType === "bezier" || S.edgeType === "multibezier" || S.edgeType === "self" || S.edgeType === "compound") { + for (var I = S.allpts, L = 0; L + 5 < S.allpts.length; L += 4) + if (wd(r, e, I[L], I[L + 1], I[L + 2], I[L + 3], I[L + 4], I[L + 5], R) && B > (M = Cd(r, e, I[L], I[L + 1], I[L + 2], I[L + 3], I[L + 4], I[L + 5]))) + return g(x, M), !0; + } + for (var O = O || k.source, V = V || k.target, G = n.getArrowWidth(P, D), N = [{ + name: "source", + x: S.arrowStartX, + y: S.arrowStartY, + angle: S.srcArrowAngle + }, { + name: "target", + x: S.arrowEndX, + y: S.arrowEndY, + angle: S.tgtArrowAngle + }, { + name: "mid-source", + x: S.midX, + y: S.midY, + angle: S.midsrcArrowAngle + }, { + name: "mid-target", + x: S.midX, + y: S.midY, + angle: S.midtgtArrowAngle + }], L = 0; L < N.length; L++) { + var F = N[L], K = i.arrowShapes[x.pstyle(F.name + "-arrow-shape").value], X = x.pstyle("width").pfValue; + if (K.roughCollide(r, e, G, F.angle, { + x: F.x, + y: F.y + }, X, v) && K.collide(r, e, G, F.angle, { + x: F.x, + y: F.y + }, X, v)) + return g(x), !0; + } + u && o.length > 0 && (p(O), p(V)); + } + function b(x, k, S) { + return Er(x, k, S); + } + function w(x, k) { + var S = x._private, P = c, D; + k ? D = k + "-" : D = "", x.boundingBox(); + var A = S.labelBounds[k || "main"], B = x.pstyle(D + "label").value, R = x.pstyle("text-events").strValue === "yes"; + if (!(!R || !B)) { + var M = b(S.rscratch, "labelX", k), I = b(S.rscratch, "labelY", k), L = b(S.rscratch, "labelAngle", k), O = x.pstyle(D + "text-margin-x").pfValue, V = x.pstyle(D + "text-margin-y").pfValue, G = A.x1 - P - O, N = A.x2 + P - O, F = A.y1 - P - V, K = A.y2 + P - V; + if (L) { + var X = Math.cos(L), Q = Math.sin(L), Z = function(ee, ne) { + return ee = ee - M, ne = ne - I, { + x: ee * X - ne * Q + M, + y: ee * Q + ne * X + I + }; + }, re = Z(G, F), ae = Z(G, K), J = Z(N, F), z = Z(N, K), q = [ + // with the margin added after the rotation is applied + re.x + O, + re.y + V, + J.x + O, + J.y + V, + z.x + O, + z.y + V, + ae.x + O, + ae.y + V + ]; + if (Cr(r, e, q)) + return g(x), !0; + } else if (Xt(A, r, e)) + return g(x), !0; + } + } + for (var E = s.length - 1; E >= 0; E--) { + var C = s[E]; + C.isNode() ? p(C) || w(C) : m(C) || w(C) || w(C, "source") || w(C, "target"); + } + return o; +}; +Pt.getAllInBox = function(r, e, t, a) { + var n = this.getCachedZSortedEles().interactive, i = this.cy.zoom(), s = 2 / i, o = [], l = Math.min(r, t), u = Math.max(r, t), v = Math.min(e, a), f = Math.max(e, a); + r = l, t = u, e = v, a = f; + var c = Sr({ + x1: r, + y1: e, + x2: t, + y2: a + }); + function h(B, R, M) { + return Er(B, R, M); + } + function d(B, R) { + var M = B._private, I = s, L = ""; + B.boundingBox(); + var O = M.labelBounds.main, V = h(M.rscratch, "labelX", R), G = h(M.rscratch, "labelY", R), N = h(M.rscratch, "labelAngle", R), F = B.pstyle(L + "text-margin-x").pfValue, K = B.pstyle(L + "text-margin-y").pfValue, X = O.x1 - I - F, Q = O.x2 + I - F, Z = O.y1 - I - K, re = O.y2 + I - K; + if (N) { + var ae = Math.cos(N), J = Math.sin(N), z = function(H, ee) { + return H = H - V, ee = ee - G, { + x: H * ae - ee * J + V, + y: H * J + ee * ae + G + }; + }; + return [z(X, Z), z(Q, Z), z(Q, re), z(X, re)]; + } else + return [{ + x: X, + y: Z + }, { + x: Q, + y: Z + }, { + x: Q, + y: re + }, { + x: X, + y: re + }]; + } + for (var y = 0; y < n.length; y++) { + var g = n[y]; + if (g.isNode()) { + var p = g, m = p.pstyle("text-events").strValue === "yes", b = p.pstyle("box-select-labels").strValue === "yes", w = p.boundingBox({ + includeNodes: !0, + includeEdges: !1, + includeLabels: b && m + }); + if (eo(c, w)) { + var E = d(p), C = [{ + x: c.x1, + y: c.y1 + }, { + x: c.x2, + y: c.y1 + }, { + x: c.x2, + y: c.y2 + }, { + x: c.x1, + y: c.y2 + }]; + Pd(E, C) && o.push(p); + } + } else { + var x = g, k = x._private, S = k.rscratch; + if (S.startX != null && S.startY != null && !Xt(c, S.startX, S.startY) || S.endX != null && S.endY != null && !Xt(c, S.endX, S.endY)) + continue; + if (S.edgeType === "bezier" || S.edgeType === "multibezier" || S.edgeType === "self" || S.edgeType === "compound" || S.edgeType === "segments" || S.edgeType === "haystack") { + for (var P = k.rstyle.bezierPts || k.rstyle.linePts || k.rstyle.haystackPts, D = !0, A = 0; A < P.length; A++) + if (!yd(c, P[A])) { + D = !1; + break; + } + D && o.push(x); + } else (S.edgeType === "haystack" || S.edgeType === "straight") && o.push(x); + } + } + return o; +}; +var Dn = {}; +Dn.calculateArrowAngles = function(r) { + var e = r._private.rscratch, t = e.edgeType === "haystack", a = e.edgeType === "bezier", n = e.edgeType === "multibezier", i = e.edgeType === "segments", s = e.edgeType === "compound", o = e.edgeType === "self", l, u, v, f, c, h, p, m; + if (t ? (v = e.haystackPts[0], f = e.haystackPts[1], c = e.haystackPts[2], h = e.haystackPts[3]) : (v = e.arrowStartX, f = e.arrowStartY, c = e.arrowEndX, h = e.arrowEndY), p = e.midX, m = e.midY, i) + l = v - e.segpts[0], u = f - e.segpts[1]; + else if (n || s || o || a) { + var d = e.allpts, y = nr(d[0], d[2], d[4], 0.1), g = nr(d[1], d[3], d[5], 0.1); + l = v - y, u = f - g; + } else + l = v - p, u = f - m; + e.srcArrowAngle = Ka(l, u); + var p = e.midX, m = e.midY; + if (t && (p = (v + c) / 2, m = (f + h) / 2), l = c - v, u = h - f, i) { + var d = e.allpts; + if (d.length / 2 % 2 === 0) { + var b = d.length / 2, w = b - 2; + l = d[b] - d[w], u = d[b + 1] - d[w + 1]; + } else if (e.isRound) + l = e.midVector[1], u = -e.midVector[0]; + else { + var b = d.length / 2 - 1, w = b - 2; + l = d[b] - d[w], u = d[b + 1] - d[w + 1]; + } + } else if (n || s || o) { + var d = e.allpts, E = e.ctrlpts, C, x, k, S; + if (E.length / 2 % 2 === 0) { + var P = d.length / 2 - 1, D = P + 2, A = D + 2; + C = nr(d[P], d[D], d[A], 0), x = nr(d[P + 1], d[D + 1], d[A + 1], 0), k = nr(d[P], d[D], d[A], 1e-4), S = nr(d[P + 1], d[D + 1], d[A + 1], 1e-4); + } else { + var D = d.length / 2 - 1, P = D - 2, A = D + 2; + C = nr(d[P], d[D], d[A], 0.4999), x = nr(d[P + 1], d[D + 1], d[A + 1], 0.4999), k = nr(d[P], d[D], d[A], 0.5), S = nr(d[P + 1], d[D + 1], d[A + 1], 0.5); + } + l = k - C, u = S - x; + } + if (e.midtgtArrowAngle = Ka(l, u), e.midDispX = l, e.midDispY = u, l *= -1, u *= -1, i) { + var d = e.allpts; + if (d.length / 2 % 2 !== 0) { + if (!e.isRound) { + var b = d.length / 2 - 1, B = b + 2; + l = -(d[B] - d[b]), u = -(d[B + 1] - d[b + 1]); + } + } + } + if (e.midsrcArrowAngle = Ka(l, u), i) + l = c - e.segpts[e.segpts.length - 2], u = h - e.segpts[e.segpts.length - 1]; + else if (n || s || o || a) { + var d = e.allpts, R = d.length, y = nr(d[R - 6], d[R - 4], d[R - 2], 0.9), g = nr(d[R - 5], d[R - 3], d[R - 1], 0.9); + l = c - y, u = h - g; + } else + l = c - p, u = h - m; + e.tgtArrowAngle = Ka(l, u); +}; +Dn.getArrowWidth = Dn.getArrowHeight = function(r, e) { + var t = this.arrowWidthCache = this.arrowWidthCache || {}, a = t[r + ", " + e]; + return a || (a = Math.max(Math.pow(r * 13.37, 0.9), 29) * e, t[r + ", " + e] = a, a); +}; +var Ns, zs, Vr = {}, kr = {}, Tl, Sl, Et, dn, Ur, pt, wt, zr, Nt, rn, sf, of, Fs, Vs, Dl, kl = function(e, t, a) { + a.x = t.x - e.x, a.y = t.y - e.y, a.len = Math.sqrt(a.x * a.x + a.y * a.y), a.nx = a.x / a.len, a.ny = a.y / a.len, a.ang = Math.atan2(a.ny, a.nx); +}, qp = function(e, t) { + t.x = e.x * -1, t.y = e.y * -1, t.nx = e.nx * -1, t.ny = e.ny * -1, t.ang = e.ang > 0 ? -(Math.PI - e.ang) : Math.PI + e.ang; +}, _p = function(e, t, a, n, i) { + if (e !== Dl ? kl(t, e, Vr) : qp(kr, Vr), kl(t, a, kr), Tl = Vr.nx * kr.ny - Vr.ny * kr.nx, Sl = Vr.nx * kr.nx - Vr.ny * -kr.ny, Ur = Math.asin(Math.max(-1, Math.min(1, Tl))), Math.abs(Ur) < 1e-6) { + Ns = t.x, zs = t.y, wt = Nt = 0; + return; + } + Et = 1, dn = !1, Sl < 0 ? Ur < 0 ? Ur = Math.PI + Ur : (Ur = Math.PI - Ur, Et = -1, dn = !0) : Ur > 0 && (Et = -1, dn = !0), t.radius !== void 0 ? Nt = t.radius : Nt = n, pt = Ur / 2, rn = Math.min(Vr.len / 2, kr.len / 2), i ? (zr = Math.abs(Math.cos(pt) * Nt / Math.sin(pt)), zr > rn ? (zr = rn, wt = Math.abs(zr * Math.sin(pt) / Math.cos(pt))) : wt = Nt) : (zr = Math.min(rn, Nt), wt = Math.abs(zr * Math.sin(pt) / Math.cos(pt))), Fs = t.x + kr.nx * zr, Vs = t.y + kr.ny * zr, Ns = Fs - kr.ny * wt * Et, zs = Vs + kr.nx * wt * Et, sf = t.x + Vr.nx * zr, of = t.y + Vr.ny * zr, Dl = t; +}; +function uf(r, e) { + e.radius === 0 ? r.lineTo(e.cx, e.cy) : r.arc(e.cx, e.cy, e.radius, e.startAngle, e.endAngle, e.counterClockwise); +} +function co(r, e, t, a) { + var n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0; + return a === 0 || e.radius === 0 ? { + cx: e.x, + cy: e.y, + radius: 0, + startX: e.x, + startY: e.y, + stopX: e.x, + stopY: e.y, + startAngle: void 0, + endAngle: void 0, + counterClockwise: void 0 + } : (_p(r, e, t, a, n), { + cx: Ns, + cy: zs, + radius: wt, + startX: sf, + startY: of, + stopX: Fs, + stopY: Vs, + startAngle: Vr.ang + Math.PI / 2 * Et, + endAngle: kr.ang - Math.PI / 2 * Et, + counterClockwise: dn + }); +} +var Pa = 0.01, Gp = Math.sqrt(2 * Pa), pr = {}; +pr.findMidptPtsEtc = function(r, e) { + var t = e.posPts, a = e.intersectionPts, n = e.vectorNormInverse, i, s = r.pstyle("source-endpoint"), o = r.pstyle("target-endpoint"), l = s.units != null && o.units != null, u = function(E, C, x, k) { + var S = k - C, P = x - E, D = Math.sqrt(P * P + S * S); + return { + x: -S / D, + y: P / D + }; + }, v = r.pstyle("edge-distances").value; + switch (v) { + case "node-position": + i = t; + break; + case "intersection": + i = a; + break; + case "endpoints": { + if (l) { + var f = this.manualEndptToPx(r.source()[0], s), c = je(f, 2), h = c[0], d = c[1], y = this.manualEndptToPx(r.target()[0], o), g = je(y, 2), p = g[0], m = g[1], b = { + x1: h, + y1: d, + x2: p, + y2: m + }; + n = u(h, d, p, m), i = b; + } else + Le("Edge ".concat(r.id(), " has edge-distances:endpoints specified without manual endpoints specified via source-endpoint and target-endpoint. Falling back on edge-distances:intersection (default).")), i = a; + break; + } + } + return { + midptPts: i, + vectorNormInverse: n + }; +}; +pr.findHaystackPoints = function(r) { + for (var e = 0; e < r.length; e++) { + var t = r[e], a = t._private, n = a.rscratch; + if (!n.haystack) { + var i = Math.random() * 2 * Math.PI; + n.source = { + x: Math.cos(i), + y: Math.sin(i) + }, i = Math.random() * 2 * Math.PI, n.target = { + x: Math.cos(i), + y: Math.sin(i) + }; + } + var s = a.source, o = a.target, l = s.position(), u = o.position(), v = s.width(), f = o.width(), c = s.height(), h = o.height(), d = t.pstyle("haystack-radius").value, y = d / 2; + n.haystackPts = n.allpts = [n.source.x * v * y + l.x, n.source.y * c * y + l.y, n.target.x * f * y + u.x, n.target.y * h * y + u.y], n.midX = (n.allpts[0] + n.allpts[2]) / 2, n.midY = (n.allpts[1] + n.allpts[3]) / 2, n.edgeType = "haystack", n.haystack = !0, this.storeEdgeProjections(t), this.calculateArrowAngles(t), this.recalculateEdgeLabelProjections(t), this.calculateLabelAngles(t); + } +}; +pr.findSegmentsPoints = function(r, e) { + var t = r._private.rscratch, a = r.pstyle("segment-weights"), n = r.pstyle("segment-distances"), i = r.pstyle("segment-radii"), s = r.pstyle("radius-type"), o = Math.min(a.pfValue.length, n.pfValue.length), l = i.pfValue[i.pfValue.length - 1], u = s.pfValue[s.pfValue.length - 1]; + t.edgeType = "segments", t.segpts = [], t.radii = [], t.isArcRadius = []; + for (var v = 0; v < o; v++) { + var f = a.pfValue[v], c = n.pfValue[v], h = 1 - f, d = f, y = this.findMidptPtsEtc(r, e), g = y.midptPts, p = y.vectorNormInverse, m = { + x: g.x1 * h + g.x2 * d, + y: g.y1 * h + g.y2 * d + }; + t.segpts.push(m.x + p.x * c, m.y + p.y * c), t.radii.push(i.pfValue[v] !== void 0 ? i.pfValue[v] : l), t.isArcRadius.push((s.pfValue[v] !== void 0 ? s.pfValue[v] : u) === "arc-radius"); + } +}; +pr.findLoopPoints = function(r, e, t, a) { + var n = r._private.rscratch, i = e.dirCounts, s = e.srcPos, o = r.pstyle("control-point-distances"), l = o ? o.pfValue[0] : void 0, u = r.pstyle("loop-direction").pfValue, v = r.pstyle("loop-sweep").pfValue, f = r.pstyle("control-point-step-size").pfValue; + n.edgeType = "self"; + var c = t, h = f; + a && (c = 0, h = l); + var d = u - Math.PI / 2, y = d - v / 2, g = d + v / 2, p = u + "_" + v; + c = i[p] === void 0 ? i[p] = 0 : ++i[p], n.ctrlpts = [s.x + Math.cos(y) * 1.4 * h * (c / 3 + 1), s.y + Math.sin(y) * 1.4 * h * (c / 3 + 1), s.x + Math.cos(g) * 1.4 * h * (c / 3 + 1), s.y + Math.sin(g) * 1.4 * h * (c / 3 + 1)]; +}; +pr.findCompoundLoopPoints = function(r, e, t, a) { + var n = r._private.rscratch; + n.edgeType = "compound"; + var i = e.srcPos, s = e.tgtPos, o = e.srcW, l = e.srcH, u = e.tgtW, v = e.tgtH, f = r.pstyle("control-point-step-size").pfValue, c = r.pstyle("control-point-distances"), h = c ? c.pfValue[0] : void 0, d = t, y = f; + a && (d = 0, y = h); + var g = 50, p = { + x: i.x - o / 2, + y: i.y - l / 2 + }, m = { + x: s.x - u / 2, + y: s.y - v / 2 + }, b = { + x: Math.min(p.x, m.x), + y: Math.min(p.y, m.y) + }, w = 0.5, E = Math.max(w, Math.log(o * Pa)), C = Math.max(w, Math.log(u * Pa)); + n.ctrlpts = [b.x, b.y - (1 + Math.pow(g, 1.12) / 100) * y * (d / 3 + 1) * E, b.x - (1 + Math.pow(g, 1.12) / 100) * y * (d / 3 + 1) * C, b.y]; +}; +pr.findStraightEdgePoints = function(r) { + r._private.rscratch.edgeType = "straight"; +}; +pr.findBezierPoints = function(r, e, t, a, n) { + var i = r._private.rscratch, s = r.pstyle("control-point-step-size").pfValue, o = r.pstyle("control-point-distances"), l = r.pstyle("control-point-weights"), u = o && l ? Math.min(o.value.length, l.value.length) : 1, v = o ? o.pfValue[0] : void 0, f = l.value[0], c = a; + i.edgeType = c ? "multibezier" : "bezier", i.ctrlpts = []; + for (var h = 0; h < u; h++) { + var d = (0.5 - e.eles.length / 2 + t) * s * (n ? -1 : 1), y = void 0, g = js(d); + c && (v = o ? o.pfValue[h] : s, f = l.value[h]), a ? y = v : y = v !== void 0 ? g * v : void 0; + var p = y !== void 0 ? y : d, m = 1 - f, b = f, w = this.findMidptPtsEtc(r, e), E = w.midptPts, C = w.vectorNormInverse, x = { + x: E.x1 * m + E.x2 * b, + y: E.y1 * m + E.y2 * b + }; + i.ctrlpts.push(x.x + C.x * p, x.y + C.y * p); + } +}; +pr.findTaxiPoints = function(r, e) { + var t = r._private.rscratch; + t.edgeType = "segments"; + var a = "vertical", n = "horizontal", i = "leftward", s = "rightward", o = "downward", l = "upward", u = "auto", v = e.posPts, f = e.srcW, c = e.srcH, h = e.tgtW, d = e.tgtH, y = r.pstyle("edge-distances").value, g = y !== "node-position", p = r.pstyle("taxi-direction").value, m = p, b = r.pstyle("taxi-turn"), w = b.units === "%", E = b.pfValue, C = E < 0, x = r.pstyle("taxi-turn-min-distance").pfValue, k = g ? (f + h) / 2 : 0, S = g ? (c + d) / 2 : 0, P = v.x2 - v.x1, D = v.y2 - v.y1, A = function(T, _) { + return T > 0 ? Math.max(T - _, 0) : Math.min(T + _, 0); + }, B = A(P, k), R = A(D, S), M = !1; + m === u ? p = Math.abs(B) > Math.abs(R) ? n : a : m === l || m === o ? (p = a, M = !0) : (m === i || m === s) && (p = n, M = !0); + var I = p === a, L = I ? R : B, O = I ? D : P, V = js(O), G = !1; + !(M && (w || C)) && (m === o && O < 0 || m === l && O > 0 || m === i && O > 0 || m === s && O < 0) && (V *= -1, L = V * Math.abs(L), G = !0); + var N; + if (w) { + var F = E < 0 ? 1 + E : E; + N = F * L; + } else { + var K = E < 0 ? L : 0; + N = K + E * V; + } + var X = function(T) { + return Math.abs(T) < x || Math.abs(T) >= Math.abs(L); + }, Q = X(N), Z = X(Math.abs(L) - Math.abs(N)), re = Q || Z; + if (re && !G) + if (I) { + var ae = Math.abs(O) <= c / 2, J = Math.abs(P) <= h / 2; + if (ae) { + var z = (v.x1 + v.x2) / 2, q = v.y1, H = v.y2; + t.segpts = [z, q, z, H]; + } else if (J) { + var ee = (v.y1 + v.y2) / 2, ne = v.x1, be = v.x2; + t.segpts = [ne, ee, be, ee]; + } else + t.segpts = [v.x1, v.y2]; + } else { + var _e = Math.abs(O) <= f / 2, Ie = Math.abs(D) <= d / 2; + if (_e) { + var se = (v.y1 + v.y2) / 2, oe = v.x1, ce = v.x2; + t.segpts = [oe, se, ce, se]; + } else if (Ie) { + var ge = (v.x1 + v.x2) / 2, de = v.y1, ye = v.y2; + t.segpts = [ge, de, ge, ye]; + } else + t.segpts = [v.x2, v.y1]; + } + else if (I) { + var we = v.y1 + N + (g ? c / 2 * V : 0), De = v.x1, ze = v.x2; + t.segpts = [De, we, ze, we]; + } else { + var Ue = v.x1 + N + (g ? f / 2 * V : 0), Ae = v.y1, Ye = v.y2; + t.segpts = [Ue, Ae, Ue, Ye]; + } + if (t.isRound) { + var ke = r.pstyle("taxi-radius").value, le = r.pstyle("radius-type").value[0] === "arc-radius"; + t.radii = new Array(t.segpts.length / 2).fill(ke), t.isArcRadius = new Array(t.segpts.length / 2).fill(le); + } +}; +pr.tryToCorrectInvalidPoints = function(r, e) { + var t = r._private.rscratch; + if (t.edgeType === "bezier") { + var a = e.srcPos, n = e.tgtPos, i = e.srcW, s = e.srcH, o = e.tgtW, l = e.tgtH, u = e.srcShape, v = e.tgtShape, f = e.srcCornerRadius, c = e.tgtCornerRadius, h = e.srcRs, d = e.tgtRs, y = !te(t.startX) || !te(t.startY), g = !te(t.arrowStartX) || !te(t.arrowStartY), p = !te(t.endX) || !te(t.endY), m = !te(t.arrowEndX) || !te(t.arrowEndY), b = 3, w = this.getArrowWidth(r.pstyle("width").pfValue, r.pstyle("arrow-scale").value) * this.arrowShapeWidth, E = b * w, C = St({ + x: t.ctrlpts[0], + y: t.ctrlpts[1] + }, { + x: t.startX, + y: t.startY + }), x = C < E, k = St({ + x: t.ctrlpts[0], + y: t.ctrlpts[1] + }, { + x: t.endX, + y: t.endY + }), S = k < E, P = !1; + if (y || g || x) { + P = !0; + var D = { + // delta + x: t.ctrlpts[0] - a.x, + y: t.ctrlpts[1] - a.y + }, A = Math.sqrt(D.x * D.x + D.y * D.y), B = { + // normalised delta + x: D.x / A, + y: D.y / A + }, R = Math.max(i, s), M = { + // *2 radius guarantees outside shape + x: t.ctrlpts[0] + B.x * 2 * R, + y: t.ctrlpts[1] + B.y * 2 * R + }, I = u.intersectLine(a.x, a.y, i, s, M.x, M.y, 0, f, h); + x ? (t.ctrlpts[0] = t.ctrlpts[0] + B.x * (E - C), t.ctrlpts[1] = t.ctrlpts[1] + B.y * (E - C)) : (t.ctrlpts[0] = I[0] + B.x * E, t.ctrlpts[1] = I[1] + B.y * E); + } + if (p || m || S) { + P = !0; + var L = { + // delta + x: t.ctrlpts[0] - n.x, + y: t.ctrlpts[1] - n.y + }, O = Math.sqrt(L.x * L.x + L.y * L.y), V = { + // normalised delta + x: L.x / O, + y: L.y / O + }, G = Math.max(i, s), N = { + // *2 radius guarantees outside shape + x: t.ctrlpts[0] + V.x * 2 * G, + y: t.ctrlpts[1] + V.y * 2 * G + }, F = v.intersectLine(n.x, n.y, o, l, N.x, N.y, 0, c, d); + S ? (t.ctrlpts[0] = t.ctrlpts[0] + V.x * (E - k), t.ctrlpts[1] = t.ctrlpts[1] + V.y * (E - k)) : (t.ctrlpts[0] = F[0] + V.x * E, t.ctrlpts[1] = F[1] + V.y * E); + } + P && this.findEndpoints(r); + } +}; +pr.storeAllpts = function(r) { + var e = r._private.rscratch; + if (e.edgeType === "multibezier" || e.edgeType === "bezier" || e.edgeType === "self" || e.edgeType === "compound") { + e.allpts = [], e.allpts.push(e.startX, e.startY); + for (var t = 0; t + 1 < e.ctrlpts.length; t += 2) + e.allpts.push(e.ctrlpts[t], e.ctrlpts[t + 1]), t + 3 < e.ctrlpts.length && e.allpts.push((e.ctrlpts[t] + e.ctrlpts[t + 2]) / 2, (e.ctrlpts[t + 1] + e.ctrlpts[t + 3]) / 2); + e.allpts.push(e.endX, e.endY); + var a, n; + e.ctrlpts.length / 2 % 2 === 0 ? (a = e.allpts.length / 2 - 1, e.midX = e.allpts[a], e.midY = e.allpts[a + 1]) : (a = e.allpts.length / 2 - 3, n = 0.5, e.midX = nr(e.allpts[a], e.allpts[a + 2], e.allpts[a + 4], n), e.midY = nr(e.allpts[a + 1], e.allpts[a + 3], e.allpts[a + 5], n)); + } else if (e.edgeType === "straight") + e.allpts = [e.startX, e.startY, e.endX, e.endY], e.midX = (e.startX + e.endX + e.arrowStartX + e.arrowEndX) / 4, e.midY = (e.startY + e.endY + e.arrowStartY + e.arrowEndY) / 4; + else if (e.edgeType === "segments") { + if (e.allpts = [], e.allpts.push(e.startX, e.startY), e.allpts.push.apply(e.allpts, e.segpts), e.allpts.push(e.endX, e.endY), e.isRound) { + e.roundCorners = []; + for (var i = 2; i + 3 < e.allpts.length; i += 2) { + var s = e.radii[i / 2 - 1], o = e.isArcRadius[i / 2 - 1]; + e.roundCorners.push(co({ + x: e.allpts[i - 2], + y: e.allpts[i - 1] + }, { + x: e.allpts[i], + y: e.allpts[i + 1], + radius: s + }, { + x: e.allpts[i + 2], + y: e.allpts[i + 3] + }, s, o)); + } + } + if (e.segpts.length % 4 === 0) { + var l = e.segpts.length / 2, u = l - 2; + e.midX = (e.segpts[u] + e.segpts[l]) / 2, e.midY = (e.segpts[u + 1] + e.segpts[l + 1]) / 2; + } else { + var v = e.segpts.length / 2 - 1; + if (!e.isRound) + e.midX = e.segpts[v], e.midY = e.segpts[v + 1]; + else { + var f = { + x: e.segpts[v], + y: e.segpts[v + 1] + }, c = e.roundCorners[v / 2]; + if (c.radius === 0) { + var h = { + x: e.segpts[v + 2], + y: e.segpts[v + 3] + }; + e.midX = f.x, e.midY = f.y, e.midVector = [f.y - h.y, h.x - f.x]; + } else { + var d = [f.x - c.cx, f.y - c.cy], y = c.radius / Math.sqrt(Math.pow(d[0], 2) + Math.pow(d[1], 2)); + d = d.map(function(g) { + return g * y; + }), e.midX = c.cx + d[0], e.midY = c.cy + d[1], e.midVector = d; + } + } + } + } +}; +pr.checkForInvalidEdgeWarning = function(r) { + var e = r[0]._private.rscratch; + e.nodesOverlap || te(e.startX) && te(e.startY) && te(e.endX) && te(e.endY) ? e.loggedErr = !1 : e.loggedErr || (e.loggedErr = !0, Le("Edge `" + r.id() + "` has invalid endpoints and so it is impossible to draw. Adjust your edge style (e.g. control points) accordingly or use an alternative edge type. This is expected behaviour when the source node and the target node overlap.")); +}; +pr.findEdgeControlPoints = function(r) { + var e = this; + if (!(!r || r.length === 0)) { + for (var t = this, a = t.cy, n = a.hasCompoundNodes(), i = new Kr(), s = function(S, P) { + return [].concat(pn(S), [P ? 1 : 0]).join("-"); + }, o = [], l = [], u = 0; u < r.length; u++) { + var v = r[u], f = v._private, c = v.pstyle("curve-style").value; + if (!(v.removed() || !v.takesUpSpace())) { + if (c === "haystack") { + l.push(v); + continue; + } + var h = c === "unbundled-bezier" || c.endsWith("segments") || c === "straight" || c === "straight-triangle" || c.endsWith("taxi"), d = c === "unbundled-bezier" || c === "bezier", y = f.source, g = f.target, p = y.poolIndex(), m = g.poolIndex(), b = [p, m].sort(), w = s(b, h), E = i.get(w); + E == null && (E = { + eles: [] + }, o.push({ + pairId: b, + edgeIsUnbundled: h + }), i.set(w, E)), E.eles.push(v), h && (E.hasUnbundled = !0), d && (E.hasBezier = !0); + } + } + for (var C = function() { + var S = o[x], P = S.pairId, D = S.edgeIsUnbundled, A = s(P, D), B = i.get(A), R; + if (!B.hasUnbundled) { + var M = B.eles[0].parallelEdges().filter(function(le) { + return le.isBundledBezier(); + }); + Qs(B.eles), M.forEach(function(le) { + return B.eles.push(le); + }), B.eles.sort(function(le, Y) { + return le.poolIndex() - Y.poolIndex(); + }); + } + var I = B.eles[0], L = I.source(), O = I.target(); + if (L.poolIndex() > O.poolIndex()) { + var V = L; + L = O, O = V; + } + var G = B.srcPos = L.position(), N = B.tgtPos = O.position(), F = B.srcW = L.outerWidth(), K = B.srcH = L.outerHeight(), X = B.tgtW = O.outerWidth(), Q = B.tgtH = O.outerHeight(), Z = B.srcShape = t.nodeShapes[e.getNodeShape(L)], re = B.tgtShape = t.nodeShapes[e.getNodeShape(O)], ae = B.srcCornerRadius = L.pstyle("corner-radius").value === "auto" ? "auto" : L.pstyle("corner-radius").pfValue, J = B.tgtCornerRadius = O.pstyle("corner-radius").value === "auto" ? "auto" : O.pstyle("corner-radius").pfValue, z = B.tgtRs = O._private.rscratch, q = B.srcRs = L._private.rscratch; + B.dirCounts = { + north: 0, + west: 0, + south: 0, + east: 0, + northwest: 0, + southwest: 0, + northeast: 0, + southeast: 0 + }; + for (var H = 0; H < B.eles.length; H++) { + var ee = B.eles[H], ne = ee[0]._private.rscratch, be = ee.pstyle("curve-style").value, _e = be === "unbundled-bezier" || be.endsWith("segments") || be.endsWith("taxi"), Ie = !L.same(ee.source()); + if (!B.calculatedIntersection && L !== O && (B.hasBezier || B.hasUnbundled)) { + B.calculatedIntersection = !0; + var se = Z.intersectLine(G.x, G.y, F, K, N.x, N.y, 0, ae, q), oe = B.srcIntn = se, ce = re.intersectLine(N.x, N.y, X, Q, G.x, G.y, 0, J, z), ge = B.tgtIntn = ce, de = B.intersectionPts = { + x1: se[0], + x2: ce[0], + y1: se[1], + y2: ce[1] + }, ye = B.posPts = { + x1: G.x, + x2: N.x, + y1: G.y, + y2: N.y + }, we = ce[1] - se[1], De = ce[0] - se[0], ze = Math.sqrt(De * De + we * we); + te(ze) && ze >= Gp || (ze = Math.sqrt(Math.max(De * De, Pa) + Math.max(we * we, Pa))); + var Ue = B.vector = { + x: De, + y: we + }, Ae = B.vectorNorm = { + x: Ue.x / ze, + y: Ue.y / ze + }, Ye = { + x: -Ae.y, + y: Ae.x + }; + B.nodesOverlap = !te(ze) || re.checkPoint(se[0], se[1], 0, X, Q, N.x, N.y, J, z) || Z.checkPoint(ce[0], ce[1], 0, F, K, G.x, G.y, ae, q), B.vectorNormInverse = Ye, R = { + nodesOverlap: B.nodesOverlap, + dirCounts: B.dirCounts, + calculatedIntersection: !0, + hasBezier: B.hasBezier, + hasUnbundled: B.hasUnbundled, + eles: B.eles, + srcPos: N, + srcRs: z, + tgtPos: G, + tgtRs: q, + srcW: X, + srcH: Q, + tgtW: F, + tgtH: K, + srcIntn: ge, + tgtIntn: oe, + srcShape: re, + tgtShape: Z, + posPts: { + x1: ye.x2, + y1: ye.y2, + x2: ye.x1, + y2: ye.y1 + }, + intersectionPts: { + x1: de.x2, + y1: de.y2, + x2: de.x1, + y2: de.y1 + }, + vector: { + x: -Ue.x, + y: -Ue.y + }, + vectorNorm: { + x: -Ae.x, + y: -Ae.y + }, + vectorNormInverse: { + x: -Ye.x, + y: -Ye.y + } + }; + } + var ke = Ie ? R : B; + ne.nodesOverlap = ke.nodesOverlap, ne.srcIntn = ke.srcIntn, ne.tgtIntn = ke.tgtIntn, ne.isRound = be.startsWith("round"), n && (L.isParent() || L.isChild() || O.isParent() || O.isChild()) && (L.parents().anySame(O) || O.parents().anySame(L) || L.same(O) && L.isParent()) ? e.findCompoundLoopPoints(ee, ke, H, _e) : L === O ? e.findLoopPoints(ee, ke, H, _e) : be.endsWith("segments") ? e.findSegmentsPoints(ee, ke) : be.endsWith("taxi") ? e.findTaxiPoints(ee, ke) : be === "straight" || !_e && B.eles.length % 2 === 1 && H === Math.floor(B.eles.length / 2) ? e.findStraightEdgePoints(ee) : e.findBezierPoints(ee, ke, H, _e, Ie), e.findEndpoints(ee), e.tryToCorrectInvalidPoints(ee, ke), e.checkForInvalidEdgeWarning(ee), e.storeAllpts(ee), e.storeEdgeProjections(ee), e.calculateArrowAngles(ee), e.recalculateEdgeLabelProjections(ee), e.calculateLabelAngles(ee); + } + }, x = 0; x < o.length; x++) + C(); + this.findHaystackPoints(l); + } +}; +function lf(r) { + var e = []; + if (r != null) { + for (var t = 0; t < r.length; t += 2) { + var a = r[t], n = r[t + 1]; + e.push({ + x: a, + y: n + }); + } + return e; + } +} +pr.getSegmentPoints = function(r) { + var e = r[0]._private.rscratch; + this.recalculateRenderedStyle(r); + var t = e.edgeType; + if (t === "segments") + return lf(e.segpts); +}; +pr.getControlPoints = function(r) { + var e = r[0]._private.rscratch; + this.recalculateRenderedStyle(r); + var t = e.edgeType; + if (t === "bezier" || t === "multibezier" || t === "self" || t === "compound") + return lf(e.ctrlpts); +}; +pr.getEdgeMidpoint = function(r) { + var e = r[0]._private.rscratch; + return this.recalculateRenderedStyle(r), { + x: e.midX, + y: e.midY + }; +}; +var Va = {}; +Va.manualEndptToPx = function(r, e) { + var t = this, a = r.position(), n = r.outerWidth(), i = r.outerHeight(), s = r._private.rscratch; + if (e.value.length === 2) { + var o = [e.pfValue[0], e.pfValue[1]]; + return e.units[0] === "%" && (o[0] = o[0] * n), e.units[1] === "%" && (o[1] = o[1] * i), o[0] += a.x, o[1] += a.y, o; + } else { + var l = e.pfValue[0]; + l = -Math.PI / 2 + l; + var u = 2 * Math.max(n, i), v = [a.x + Math.cos(l) * u, a.y + Math.sin(l) * u]; + return t.nodeShapes[this.getNodeShape(r)].intersectLine(a.x, a.y, n, i, v[0], v[1], 0, r.pstyle("corner-radius").value === "auto" ? "auto" : r.pstyle("corner-radius").pfValue, s); + } +}; +Va.findEndpoints = function(r) { + var e = this, t, a = r.source()[0], n = r.target()[0], i = a.position(), s = n.position(), o = r.pstyle("target-arrow-shape").value, l = r.pstyle("source-arrow-shape").value, u = r.pstyle("target-distance-from-node").pfValue, v = r.pstyle("source-distance-from-node").pfValue, f = a._private.rscratch, c = n._private.rscratch, h = r.pstyle("curve-style").value, d = r._private.rscratch, y = d.edgeType, g = h === "taxi", p = y === "self" || y === "compound", m = y === "bezier" || y === "multibezier" || p, b = y !== "bezier", w = y === "straight" || y === "segments", E = y === "segments", C = m || b || w, x = p || g, k = r.pstyle("source-endpoint"), S = x ? "outside-to-node" : k.value, P = a.pstyle("corner-radius").value === "auto" ? "auto" : a.pstyle("corner-radius").pfValue, D = r.pstyle("target-endpoint"), A = x ? "outside-to-node" : D.value, B = n.pstyle("corner-radius").value === "auto" ? "auto" : n.pstyle("corner-radius").pfValue; + d.srcManEndpt = k, d.tgtManEndpt = D; + var R, M, I, L; + if (m) { + var O = [d.ctrlpts[0], d.ctrlpts[1]], V = b ? [d.ctrlpts[d.ctrlpts.length - 2], d.ctrlpts[d.ctrlpts.length - 1]] : O; + R = V, M = O; + } else if (w) { + var G = E ? d.segpts.slice(0, 2) : [s.x, s.y], N = E ? d.segpts.slice(d.segpts.length - 2) : [i.x, i.y]; + R = N, M = G; + } + if (A === "inside-to-node") + t = [s.x, s.y]; + else if (D.units) + t = this.manualEndptToPx(n, D); + else if (A === "outside-to-line") + t = d.tgtIntn; + else if (A === "outside-to-node" || A === "outside-to-node-or-label" ? I = R : (A === "outside-to-line" || A === "outside-to-line-or-label") && (I = [i.x, i.y]), t = e.nodeShapes[this.getNodeShape(n)].intersectLine(s.x, s.y, n.outerWidth(), n.outerHeight(), I[0], I[1], 0, B, c), A === "outside-to-node-or-label" || A === "outside-to-line-or-label") { + var F = n._private.rscratch, K = F.labelWidth, X = F.labelHeight, Q = F.labelX, Z = F.labelY, re = K / 2, ae = X / 2, J = n.pstyle("text-valign").value; + J === "top" ? Z -= ae : J === "bottom" && (Z += ae); + var z = n.pstyle("text-halign").value; + z === "left" ? Q -= re : z === "right" && (Q += re); + var q = Ta(I[0], I[1], [Q - re, Z - ae, Q + re, Z - ae, Q + re, Z + ae, Q - re, Z + ae], s.x, s.y); + if (q.length > 0) { + var H = i, ee = mt(H, _t(t)), ne = mt(H, _t(q)), be = ee; + if (ne < ee && (t = q, be = ne), q.length > 2) { + var _e = mt(H, { + x: q[2], + y: q[3] + }); + _e < be && (t = [q[2], q[3]]); + } + } + } + var Ie = Ya(t, R, e.arrowShapes[o].spacing(r) + u), se = Ya(t, R, e.arrowShapes[o].gap(r) + u); + if (d.endX = se[0], d.endY = se[1], d.arrowEndX = Ie[0], d.arrowEndY = Ie[1], S === "inside-to-node") + t = [i.x, i.y]; + else if (k.units) + t = this.manualEndptToPx(a, k); + else if (S === "outside-to-line") + t = d.srcIntn; + else if (S === "outside-to-node" || S === "outside-to-node-or-label" ? L = M : (S === "outside-to-line" || S === "outside-to-line-or-label") && (L = [s.x, s.y]), t = e.nodeShapes[this.getNodeShape(a)].intersectLine(i.x, i.y, a.outerWidth(), a.outerHeight(), L[0], L[1], 0, P, f), S === "outside-to-node-or-label" || S === "outside-to-line-or-label") { + var oe = a._private.rscratch, ce = oe.labelWidth, ge = oe.labelHeight, de = oe.labelX, ye = oe.labelY, we = ce / 2, De = ge / 2, ze = a.pstyle("text-valign").value; + ze === "top" ? ye -= De : ze === "bottom" && (ye += De); + var Ue = a.pstyle("text-halign").value; + Ue === "left" ? de -= we : Ue === "right" && (de += we); + var Ae = Ta(L[0], L[1], [de - we, ye - De, de + we, ye - De, de + we, ye + De, de - we, ye + De], i.x, i.y); + if (Ae.length > 0) { + var Ye = s, ke = mt(Ye, _t(t)), le = mt(Ye, _t(Ae)), Y = ke; + if (le < ke && (t = [Ae[0], Ae[1]], Y = le), Ae.length > 2) { + var T = mt(Ye, { + x: Ae[2], + y: Ae[3] + }); + T < Y && (t = [Ae[2], Ae[3]]); + } + } + } + var _ = Ya(t, M, e.arrowShapes[l].spacing(r) + v), W = Ya(t, M, e.arrowShapes[l].gap(r) + v); + d.startX = W[0], d.startY = W[1], d.arrowStartX = _[0], d.arrowStartY = _[1], C && (!te(d.startX) || !te(d.startY) || !te(d.endX) || !te(d.endY) ? d.badLine = !0 : d.badLine = !1); +}; +Va.getSourceEndpoint = function(r) { + var e = r[0]._private.rscratch; + switch (this.recalculateRenderedStyle(r), e.edgeType) { + case "haystack": + return { + x: e.haystackPts[0], + y: e.haystackPts[1] + }; + default: + return { + x: e.arrowStartX, + y: e.arrowStartY + }; + } +}; +Va.getTargetEndpoint = function(r) { + var e = r[0]._private.rscratch; + switch (this.recalculateRenderedStyle(r), e.edgeType) { + case "haystack": + return { + x: e.haystackPts[2], + y: e.haystackPts[3] + }; + default: + return { + x: e.arrowEndX, + y: e.arrowEndY + }; + } +}; +var ho = {}; +function Hp(r, e, t) { + for (var a = function(u, v, f, c) { + return nr(u, v, f, c); + }, n = e._private, i = n.rstyle.bezierPts, s = 0; s < r.bezierProjPcts.length; s++) { + var o = r.bezierProjPcts[s]; + i.push({ + x: a(t[0], t[2], t[4], o), + y: a(t[1], t[3], t[5], o) + }); + } +} +ho.storeEdgeProjections = function(r) { + var e = r._private, t = e.rscratch, a = t.edgeType; + if (e.rstyle.bezierPts = null, e.rstyle.linePts = null, e.rstyle.haystackPts = null, a === "multibezier" || a === "bezier" || a === "self" || a === "compound") { + e.rstyle.bezierPts = []; + for (var n = 0; n + 5 < t.allpts.length; n += 4) + Hp(this, r, t.allpts.slice(n, n + 6)); + } else if (a === "segments") + for (var i = e.rstyle.linePts = [], n = 0; n + 1 < t.allpts.length; n += 2) + i.push({ + x: t.allpts[n], + y: t.allpts[n + 1] + }); + else if (a === "haystack") { + var s = t.haystackPts; + e.rstyle.haystackPts = [{ + x: s[0], + y: s[1] + }, { + x: s[2], + y: s[3] + }]; + } + e.rstyle.arrowWidth = this.getArrowWidth(r.pstyle("width").pfValue, r.pstyle("arrow-scale").value) * this.arrowShapeWidth; +}; +ho.recalculateEdgeProjections = function(r) { + this.findEdgeControlPoints(r); +}; +var Gr = {}; +Gr.recalculateNodeLabelProjection = function(r) { + var e = r.pstyle("label").strValue; + if (!nt(e)) { + var t, a, n = r._private, i = r.width(), s = r.height(), o = r.padding(), l = r.position(), u = r.pstyle("text-halign").strValue, v = r.pstyle("text-valign").strValue, f = n.rscratch, c = n.rstyle; + switch (u) { + case "left": + t = l.x - i / 2 - o; + break; + case "right": + t = l.x + i / 2 + o; + break; + default: + t = l.x; + } + switch (v) { + case "top": + a = l.y - s / 2 - o; + break; + case "bottom": + a = l.y + s / 2 + o; + break; + default: + a = l.y; + } + f.labelX = t, f.labelY = a, c.labelX = t, c.labelY = a, this.calculateLabelAngles(r), this.applyLabelDimensions(r); + } +}; +var vf = function(e, t) { + var a = Math.atan(t / e); + return e === 0 && a < 0 && (a = a * -1), a; +}, ff = function(e, t) { + var a = t.x - e.x, n = t.y - e.y; + return vf(a, n); +}, Wp = function(e, t, a, n) { + var i = Ca(0, n - 1e-3, 1), s = Ca(0, n + 1e-3, 1), o = Wt(e, t, a, i), l = Wt(e, t, a, s); + return ff(o, l); +}; +Gr.recalculateEdgeLabelProjections = function(r) { + var e, t = r._private, a = t.rscratch, n = this, i = { + mid: r.pstyle("label").strValue, + source: r.pstyle("source-label").strValue, + target: r.pstyle("target-label").strValue + }; + if (i.mid || i.source || i.target) { + e = { + x: a.midX, + y: a.midY + }; + var s = function(f, c, h) { + $r(t.rscratch, f, c, h), $r(t.rstyle, f, c, h); + }; + s("labelX", null, e.x), s("labelY", null, e.y); + var o = vf(a.midDispX, a.midDispY); + s("labelAutoAngle", null, o); + var l = function() { + if (l.cache) + return l.cache; + for (var f = [], c = 0; c + 5 < a.allpts.length; c += 4) { + var h = { + x: a.allpts[c], + y: a.allpts[c + 1] + }, d = { + x: a.allpts[c + 2], + y: a.allpts[c + 3] + }, y = { + x: a.allpts[c + 4], + y: a.allpts[c + 5] + }; + f.push({ + p0: h, + p1: d, + p2: y, + startDist: 0, + length: 0, + segments: [] + }); + } + var g = t.rstyle.bezierPts, p = n.bezierProjPcts.length; + function m(x, k, S, P, D) { + var A = St(k, S), B = x.segments[x.segments.length - 1], R = { + p0: k, + p1: S, + t0: P, + t1: D, + startDist: B ? B.startDist + B.length : 0, + length: A + }; + x.segments.push(R), x.length += A; + } + for (var b = 0; b < f.length; b++) { + var w = f[b], E = f[b - 1]; + E && (w.startDist = E.startDist + E.length), m(w, w.p0, g[b * p], 0, n.bezierProjPcts[0]); + for (var C = 0; C < p - 1; C++) + m(w, g[b * p + C], g[b * p + C + 1], n.bezierProjPcts[C], n.bezierProjPcts[C + 1]); + m(w, g[b * p + p - 1], w.p2, n.bezierProjPcts[p - 1], 1); + } + return l.cache = f; + }, u = function(f) { + var c, h = f === "source"; + if (i[f]) { + var d = r.pstyle(f + "-text-offset").pfValue; + switch (a.edgeType) { + case "self": + case "compound": + case "bezier": + case "multibezier": { + for (var y = l(), g, p = 0, m = 0, b = 0; b < y.length; b++) { + for (var w = y[h ? b : y.length - 1 - b], E = 0; E < w.segments.length; E++) { + var C = w.segments[h ? E : w.segments.length - 1 - E], x = b === y.length - 1 && E === w.segments.length - 1; + if (p = m, m += C.length, m >= d || x) { + g = { + cp: w, + segment: C + }; + break; + } + } + if (g) + break; + } + var k = g.cp, S = g.segment, P = (d - p) / S.length, D = S.t1 - S.t0, A = h ? S.t0 + D * P : S.t1 - D * P; + A = Ca(0, A, 1), e = Wt(k.p0, k.p1, k.p2, A), c = Wp(k.p0, k.p1, k.p2, A); + break; + } + case "straight": + case "segments": + case "haystack": { + for (var B = 0, R, M, I, L, O = a.allpts.length, V = 0; V + 3 < O && (h ? (I = { + x: a.allpts[V], + y: a.allpts[V + 1] + }, L = { + x: a.allpts[V + 2], + y: a.allpts[V + 3] + }) : (I = { + x: a.allpts[O - 2 - V], + y: a.allpts[O - 1 - V] + }, L = { + x: a.allpts[O - 4 - V], + y: a.allpts[O - 3 - V] + }), R = St(I, L), M = B, B += R, !(B >= d)); V += 2) + ; + var G = d - M, N = G / R; + N = Ca(0, N, 1), e = cd(I, L, N), c = ff(I, L); + break; + } + } + s("labelX", f, e.x), s("labelY", f, e.y), s("labelAutoAngle", f, c); + } + }; + u("source"), u("target"), this.applyLabelDimensions(r); + } +}; +Gr.applyLabelDimensions = function(r) { + this.applyPrefixedLabelDimensions(r), r.isEdge() && (this.applyPrefixedLabelDimensions(r, "source"), this.applyPrefixedLabelDimensions(r, "target")); +}; +Gr.applyPrefixedLabelDimensions = function(r, e) { + var t = r._private, a = this.getLabelText(r, e), n = Tt(a, r._private.labelDimsKey); + if (Er(t.rscratch, "prefixedLabelDimsKey", e) !== n) { + $r(t.rscratch, "prefixedLabelDimsKey", e, n); + var i = this.calculateLabelDimensions(r, a), s = r.pstyle("line-height").pfValue, o = r.pstyle("text-wrap").strValue, l = Er(t.rscratch, "labelWrapCachedLines", e) || [], u = o !== "wrap" ? 1 : Math.max(l.length, 1), v = i.height / u, f = v * s, c = i.width, h = i.height + (u - 1) * (s - 1) * v; + $r(t.rstyle, "labelWidth", e, c), $r(t.rscratch, "labelWidth", e, c), $r(t.rstyle, "labelHeight", e, h), $r(t.rscratch, "labelHeight", e, h), $r(t.rscratch, "labelLineHeight", e, f); + } +}; +Gr.getLabelText = function(r, e) { + var t = r._private, a = e ? e + "-" : "", n = r.pstyle(a + "label").strValue, i = r.pstyle("text-transform").value, s = function(K, X) { + return X ? ($r(t.rscratch, K, e, X), X) : Er(t.rscratch, K, e); + }; + if (!n) + return ""; + i == "none" || (i == "uppercase" ? n = n.toUpperCase() : i == "lowercase" && (n = n.toLowerCase())); + var o = r.pstyle("text-wrap").value; + if (o === "wrap") { + var l = s("labelKey"); + if (l != null && s("labelWrapKey") === l) + return s("labelWrapCachedText"); + for (var u = "​", v = n.split(` +`), f = r.pstyle("text-max-width").pfValue, c = r.pstyle("text-overflow-wrap").value, h = c === "anywhere", d = [], y = /[\s\u200b]+|$/g, g = 0; g < v.length; g++) { + var p = v[g], m = this.calculateLabelDimensions(r, p), b = m.width; + if (h) { + var w = p.split("").join(u); + p = w; + } + if (b > f) { + var E = p.matchAll(y), C = "", x = 0, k = Tr(E), S; + try { + for (k.s(); !(S = k.n()).done; ) { + var P = S.value, D = P[0], A = p.substring(x, P.index); + x = P.index + D.length; + var B = C.length === 0 ? A : C + A + D, R = this.calculateLabelDimensions(r, B), M = R.width; + M <= f ? C += A + D : (C && d.push(C), C = A + D); + } + } catch (F) { + k.e(F); + } finally { + k.f(); + } + C.match(/^[\s\u200b]+$/) || d.push(C); + } else + d.push(p); + } + s("labelWrapCachedLines", d), n = s("labelWrapCachedText", d.join(` +`)), s("labelWrapKey", l); + } else if (o === "ellipsis") { + var I = r.pstyle("text-max-width").pfValue, L = "", O = "…", V = !1; + if (this.calculateLabelDimensions(r, n).width < I) + return n; + for (var G = 0; G < n.length; G++) { + var N = this.calculateLabelDimensions(r, L + n[G] + O).width; + if (N > I) + break; + L += n[G], G === n.length - 1 && (V = !0); + } + return V || (L += O), L; + } + return n; +}; +Gr.getLabelJustification = function(r) { + var e = r.pstyle("text-justification").strValue, t = r.pstyle("text-halign").strValue; + if (e === "auto") + if (r.isNode()) + switch (t) { + case "left": + return "right"; + case "right": + return "left"; + default: + return "center"; + } + else + return "center"; + else + return e; +}; +Gr.calculateLabelDimensions = function(r, e) { + var t = this, a = t.cy.window(), n = a.document, i = 0, s = r.pstyle("font-style").strValue, o = r.pstyle("font-size").pfValue, l = r.pstyle("font-family").strValue, u = r.pstyle("font-weight").strValue, v = this.labelCalcCanvas, f = this.labelCalcCanvasContext; + if (!v) { + v = this.labelCalcCanvas = n.createElement("canvas"), f = this.labelCalcCanvasContext = v.getContext("2d"); + var c = v.style; + c.position = "absolute", c.left = "-9999px", c.top = "-9999px", c.zIndex = "-1", c.visibility = "hidden", c.pointerEvents = "none"; + } + f.font = "".concat(s, " ").concat(u, " ").concat(o, "px ").concat(l); + for (var h = 0, d = 0, y = e.split(` +`), g = 0; g < y.length; g++) { + var p = y[g], m = f.measureText(p), b = Math.ceil(m.width), w = o; + h = Math.max(b, h), d += w; + } + return h += i, d += i, { + width: h, + height: d + }; +}; +Gr.calculateLabelAngle = function(r, e) { + var t = r._private, a = t.rscratch, n = r.isEdge(), i = e ? e + "-" : "", s = r.pstyle(i + "text-rotation"), o = s.strValue; + return o === "none" ? 0 : n && o === "autorotate" ? a.labelAutoAngle : o === "autorotate" ? 0 : s.pfValue; +}; +Gr.calculateLabelAngles = function(r) { + var e = this, t = r.isEdge(), a = r._private, n = a.rscratch; + n.labelAngle = e.calculateLabelAngle(r), t && (n.sourceLabelAngle = e.calculateLabelAngle(r, "source"), n.targetLabelAngle = e.calculateLabelAngle(r, "target")); +}; +var cf = {}, Bl = 28, Pl = !1; +cf.getNodeShape = function(r) { + var e = this, t = r.pstyle("shape").value; + if (t === "cutrectangle" && (r.width() < Bl || r.height() < Bl)) + return Pl || (Le("The `cutrectangle` node shape can not be used at small sizes so `rectangle` is used instead"), Pl = !0), "rectangle"; + if (r.isParent()) + return t === "rectangle" || t === "roundrectangle" || t === "round-rectangle" || t === "cutrectangle" || t === "cut-rectangle" || t === "barrel" ? t : "rectangle"; + if (t === "polygon") { + var a = r.pstyle("shape-polygon-points").value; + return e.nodeShapes.makePolygon(a).name; + } + return t; +}; +var $n = {}; +$n.registerCalculationListeners = function() { + var r = this.cy, e = r.collection(), t = this, a = function(s) { + var o = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0; + if (e.merge(s), o) + for (var l = 0; l < s.length; l++) { + var u = s[l], v = u._private, f = v.rstyle; + f.clean = !1, f.cleanConnected = !1; + } + }; + t.binder(r).on("bounds.* dirty.*", function(s) { + var o = s.target; + a(o); + }).on("style.* background.*", function(s) { + var o = s.target; + a(o, !1); + }); + var n = function(s) { + if (s) { + var o = t.onUpdateEleCalcsFns; + e.cleanStyle(); + for (var l = 0; l < e.length; l++) { + var u = e[l], v = u._private.rstyle; + u.isNode() && !v.cleanConnected && (a(u.connectedEdges()), v.cleanConnected = !0); + } + if (o) + for (var f = 0; f < o.length; f++) { + var c = o[f]; + c(s, e); + } + t.recalculateRenderedStyle(e), e = r.collection(); + } + }; + t.flushRenderedStyleQueue = function() { + n(!0); + }, t.beforeRender(n, t.beforeRenderPriorities.eleCalcs); +}; +$n.onUpdateEleCalcs = function(r) { + var e = this.onUpdateEleCalcsFns = this.onUpdateEleCalcsFns || []; + e.push(r); +}; +$n.recalculateRenderedStyle = function(r, e) { + var t = function(w) { + return w._private.rstyle.cleanConnected; + }; + if (r.length !== 0) { + var a = [], n = []; + if (!this.destroyed) { + e === void 0 && (e = !0); + for (var i = 0; i < r.length; i++) { + var s = r[i], o = s._private, l = o.rstyle; + s.isEdge() && (!t(s.source()) || !t(s.target())) && (l.clean = !1), s.isEdge() && s.isBundledBezier() && s.parallelEdges().some(function(b) { + return !b._private.rstyle.clean && b.isBundledBezier(); + }) && (l.clean = !1), !(e && l.clean || s.removed()) && s.pstyle("display").value !== "none" && (o.group === "nodes" ? n.push(s) : a.push(s), l.clean = !0); + } + for (var u = 0; u < n.length; u++) { + var v = n[u], f = v._private, c = f.rstyle, h = v.position(); + this.recalculateNodeLabelProjection(v), c.nodeX = h.x, c.nodeY = h.y, c.nodeW = v.pstyle("width").pfValue, c.nodeH = v.pstyle("height").pfValue; + } + this.recalculateEdgeProjections(a); + for (var d = 0; d < a.length; d++) { + var y = a[d], g = y._private, p = g.rstyle, m = g.rscratch; + p.srcX = m.arrowStartX, p.srcY = m.arrowStartY, p.tgtX = m.arrowEndX, p.tgtY = m.arrowEndY, p.midX = m.midX, p.midY = m.midY, p.labelAngle = m.labelAngle, p.sourceLabelAngle = m.sourceLabelAngle, p.targetLabelAngle = m.targetLabelAngle; + } + } + } +}; +var Kn = {}; +Kn.updateCachedGrabbedEles = function() { + var r = this.cachedZSortedEles; + if (r) { + r.drag = [], r.nondrag = []; + for (var e = [], t = 0; t < r.length; t++) { + var a = r[t], n = a._private.rscratch; + a.grabbed() && !a.isParent() ? e.push(a) : n.inDragLayer ? r.drag.push(a) : r.nondrag.push(a); + } + for (var t = 0; t < e.length; t++) { + var a = e[t]; + r.drag.push(a); + } + } +}; +Kn.invalidateCachedZSortedEles = function() { + this.cachedZSortedEles = null; +}; +Kn.getCachedZSortedEles = function(r) { + if (r || !this.cachedZSortedEles) { + var e = this.cy.mutableElements().toArray(); + e.sort($v), e.interactive = e.filter(function(t) { + return t.interactive(); + }), this.cachedZSortedEles = e, this.updateCachedGrabbedEles(); + } else + e = this.cachedZSortedEles; + return e; +}; +var df = {}; +[Pt, Dn, pr, Va, ho, Gr, cf, $n, Kn].forEach(function(r) { + he(df, r); +}); +var hf = {}; +hf.getCachedImage = function(r, e, t) { + var a = this, n = a.imageCache = a.imageCache || {}, i = n[r]; + if (i) + return i.image.complete || i.image.addEventListener("load", t), i.image; + i = n[r] = n[r] || {}; + var s = i.image = new Image(); + s.addEventListener("load", t), s.addEventListener("error", function() { + s.error = !0; + }); + var o = "data:", l = r.substring(0, o.length).toLowerCase() === o; + return l || (e = e === "null" ? null : e, s.crossOrigin = e), s.src = r, s; +}; +var aa = {}; +aa.registerBinding = function(r, e, t, a) { + var n = Array.prototype.slice.apply(arguments, [1]); + if (Array.isArray(r)) { + for (var i = [], s = 0; s < r.length; s++) { + var o = r[s]; + if (o !== void 0) { + var l = this.binder(o); + i.push(l.on.apply(l, n)); + } + } + return i; + } + var l = this.binder(r); + return l.on.apply(l, n); +}; +aa.binder = function(r) { + var e = this, t = e.cy.window(), a = r === t || r === t.document || r === t.document.body || ic(r); + if (e.supportsPassiveEvents == null) { + var n = !1; + try { + var i = Object.defineProperty({}, "passive", { + get: function() { + return n = !0, !0; + } + }); + t.addEventListener("test", null, i); + } catch { + } + e.supportsPassiveEvents = n; + } + var s = function(l, u, v) { + var f = Array.prototype.slice.call(arguments); + return a && e.supportsPassiveEvents && (f[2] = { + capture: v ?? !1, + passive: !1, + once: !1 + }), e.bindings.push({ + target: r, + args: f + }), (r.addEventListener || r.on).apply(r, f), this; + }; + return { + on: s, + addEventListener: s, + addListener: s, + bind: s + }; +}; +aa.nodeIsDraggable = function(r) { + return r && r.isNode() && !r.locked() && r.grabbable(); +}; +aa.nodeIsGrabbable = function(r) { + return this.nodeIsDraggable(r) && r.interactive(); +}; +aa.load = function() { + var r = this, e = r.cy.window(), t = function(T) { + return T.selected(); + }, a = function(T) { + var _ = T.getRootNode(); + if (_ && _.nodeType === 11 && _.host !== void 0) + return _; + }, n = function(T, _, W, U) { + T == null && (T = r.cy); + for (var $ = 0; $ < _.length; $++) { + var ue = _[$]; + T.emit({ + originalEvent: W, + type: ue, + position: U + }); + } + }, i = function(T) { + return T.shiftKey || T.metaKey || T.ctrlKey; + }, s = function(T, _) { + var W = !0; + if (r.cy.hasCompoundNodes() && T && T.pannable()) + for (var U = 0; _ && U < _.length; U++) { + var T = _[U]; + if (T.isNode() && T.isParent() && !T.pannable()) { + W = !1; + break; + } + } + else + W = !0; + return W; + }, o = function(T) { + T[0]._private.grabbed = !0; + }, l = function(T) { + T[0]._private.grabbed = !1; + }, u = function(T) { + T[0]._private.rscratch.inDragLayer = !0; + }, v = function(T) { + T[0]._private.rscratch.inDragLayer = !1; + }, f = function(T) { + T[0]._private.rscratch.isGrabTarget = !0; + }, c = function(T) { + T[0]._private.rscratch.isGrabTarget = !1; + }, h = function(T, _) { + var W = _.addToList, U = W.has(T); + !U && T.grabbable() && !T.locked() && (W.merge(T), o(T)); + }, d = function(T, _) { + if (T.cy().hasCompoundNodes() && !(_.inDragLayer == null && _.addToList == null)) { + var W = T.descendants(); + _.inDragLayer && (W.forEach(u), W.connectedEdges().forEach(u)), _.addToList && h(W, _); + } + }, y = function(T, _) { + _ = _ || {}; + var W = T.cy().hasCompoundNodes(); + _.inDragLayer && (T.forEach(u), T.neighborhood().stdFilter(function(U) { + return !W || U.isEdge(); + }).forEach(u)), _.addToList && T.forEach(function(U) { + h(U, _); + }), d(T, _), m(T, { + inDragLayer: _.inDragLayer + }), r.updateCachedGrabbedEles(); + }, g = y, p = function(T) { + T && (r.getCachedZSortedEles().forEach(function(_) { + l(_), v(_), c(_); + }), r.updateCachedGrabbedEles()); + }, m = function(T, _) { + if (!(_.inDragLayer == null && _.addToList == null) && T.cy().hasCompoundNodes()) { + var W = T.ancestors().orphans(); + if (!W.same(T)) { + var U = W.descendants().spawnSelf().merge(W).unmerge(T).unmerge(T.descendants()), $ = U.connectedEdges(); + _.inDragLayer && ($.forEach(u), U.forEach(u)), _.addToList && U.forEach(function(ue) { + h(ue, _); + }); + } + } + }, b = function() { + document.activeElement != null && document.activeElement.blur != null && document.activeElement.blur(); + }, w = typeof MutationObserver < "u", E = typeof ResizeObserver < "u"; + w ? (r.removeObserver = new MutationObserver(function(Y) { + for (var T = 0; T < Y.length; T++) { + var _ = Y[T], W = _.removedNodes; + if (W) + for (var U = 0; U < W.length; U++) { + var $ = W[U]; + if ($ === r.container) { + r.destroy(); + break; + } + } + } + }), r.container.parentNode && r.removeObserver.observe(r.container.parentNode, { + childList: !0 + })) : r.registerBinding(r.container, "DOMNodeRemoved", function(Y) { + r.destroy(); + }); + var C = Oa(function() { + r.cy.resize(); + }, 100); + w && (r.styleObserver = new MutationObserver(C), r.styleObserver.observe(r.container, { + attributes: !0 + })), r.registerBinding(e, "resize", C), E && (r.resizeObserver = new ResizeObserver(C), r.resizeObserver.observe(r.container)); + var x = function(T, _) { + for (; T != null; ) + _(T), T = T.parentNode; + }, k = function() { + r.invalidateContainerClientCoordsCache(); + }; + x(r.container, function(Y) { + r.registerBinding(Y, "transitionend", k), r.registerBinding(Y, "animationend", k), r.registerBinding(Y, "scroll", k); + }), r.registerBinding(r.container, "contextmenu", function(Y) { + Y.preventDefault(); + }); + var S = function() { + return r.selection[4] !== 0; + }, P = function(T) { + for (var _ = r.findContainerClientCoords(), W = _[0], U = _[1], $ = _[2], ue = _[3], j = T.touches ? T.touches : [T], ve = !1, Ee = 0; Ee < j.length; Ee++) { + var Se = j[Ee]; + if (W <= Se.clientX && Se.clientX <= W + $ && U <= Se.clientY && Se.clientY <= U + ue) { + ve = !0; + break; + } + } + if (!ve) + return !1; + for (var pe = r.container, Ce = T.target, me = Ce.parentNode, xe = !1; me; ) { + if (me === pe) { + xe = !0; + break; + } + me = me.parentNode; + } + return !!xe; + }; + r.registerBinding(r.container, "mousedown", function(T) { + if (P(T) && !(r.hoverData.which === 1 && T.which !== 1)) { + T.preventDefault(), b(), r.hoverData.capture = !0, r.hoverData.which = T.which; + var _ = r.cy, W = [T.clientX, T.clientY], U = r.projectIntoViewport(W[0], W[1]), $ = r.selection, ue = r.findNearestElements(U[0], U[1], !0, !1), j = ue[0], ve = r.dragData.possibleDragElements; + r.hoverData.mdownPos = U, r.hoverData.mdownGPos = W; + var Ee = function() { + r.hoverData.tapholdCancelled = !1, clearTimeout(r.hoverData.tapholdTimeout), r.hoverData.tapholdTimeout = setTimeout(function() { + if (!r.hoverData.tapholdCancelled) { + var Oe = r.hoverData.down; + Oe ? Oe.emit({ + originalEvent: T, + type: "taphold", + position: { + x: U[0], + y: U[1] + } + }) : _.emit({ + originalEvent: T, + type: "taphold", + position: { + x: U[0], + y: U[1] + } + }); + } + }, r.tapholdDuration); + }; + if (T.which == 3) { + r.hoverData.cxtStarted = !0; + var Se = { + originalEvent: T, + type: "cxttapstart", + position: { + x: U[0], + y: U[1] + } + }; + j ? (j.activate(), j.emit(Se), r.hoverData.down = j) : _.emit(Se), r.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(), r.hoverData.cxtDragged = !1; + } else if (T.which == 1) { + j && j.activate(); + { + if (j != null && r.nodeIsGrabbable(j)) { + var pe = function(Oe) { + return { + originalEvent: T, + type: Oe, + position: { + x: U[0], + y: U[1] + } + }; + }, Ce = function(Oe) { + Oe.emit(pe("grab")); + }; + if (f(j), !j.selected()) + ve = r.dragData.possibleDragElements = _.collection(), g(j, { + addToList: ve + }), j.emit(pe("grabon")).emit(pe("grab")); + else { + ve = r.dragData.possibleDragElements = _.collection(); + var me = _.$(function(xe) { + return xe.isNode() && xe.selected() && r.nodeIsGrabbable(xe); + }); + y(me, { + addToList: ve + }), j.emit(pe("grabon")), me.forEach(Ce); + } + r.redrawHint("eles", !0), r.redrawHint("drag", !0); + } + r.hoverData.down = j, r.hoverData.downs = ue, r.hoverData.downTime = (/* @__PURE__ */ new Date()).getTime(); + } + n(j, ["mousedown", "tapstart", "vmousedown"], T, { + x: U[0], + y: U[1] + }), j == null ? ($[4] = 1, r.data.bgActivePosistion = { + x: U[0], + y: U[1] + }, r.redrawHint("select", !0), r.redraw()) : j.pannable() && ($[4] = 1), Ee(); + } + $[0] = $[2] = U[0], $[1] = $[3] = U[1]; + } + }, !1); + var D = a(r.container); + r.registerBinding([e, D], "mousemove", function(T) { + var _ = r.hoverData.capture; + if (!(!_ && !P(T))) { + var W = !1, U = r.cy, $ = U.zoom(), ue = [T.clientX, T.clientY], j = r.projectIntoViewport(ue[0], ue[1]), ve = r.hoverData.mdownPos, Ee = r.hoverData.mdownGPos, Se = r.selection, pe = null; + !r.hoverData.draggingEles && !r.hoverData.dragging && !r.hoverData.selecting && (pe = r.findNearestElement(j[0], j[1], !0, !1)); + var Ce = r.hoverData.last, me = r.hoverData.down, xe = [j[0] - Se[2], j[1] - Se[3]], Oe = r.dragData.possibleDragElements, Xe; + if (Ee) { + var or = ue[0] - Ee[0], ar = or * or, Ke = ue[1] - Ee[1], ur = Ke * Ke, Qe = ar + ur; + r.hoverData.isOverThresholdDrag = Xe = Qe >= r.desktopTapThreshold2; + } + var br = i(T); + Xe && (r.hoverData.tapholdCancelled = !0); + var Or = function() { + var Nr = r.hoverData.dragDelta = r.hoverData.dragDelta || []; + Nr.length === 0 ? (Nr.push(xe[0]), Nr.push(xe[1])) : (Nr[0] += xe[0], Nr[1] += xe[1]); + }; + W = !0, n(pe, ["mousemove", "vmousemove", "tapdrag"], T, { + x: j[0], + y: j[1] + }); + var Jr = function() { + r.data.bgActivePosistion = void 0, r.hoverData.selecting || U.emit({ + originalEvent: T, + type: "boxstart", + position: { + x: j[0], + y: j[1] + } + }), Se[4] = 1, r.hoverData.selecting = !0, r.redrawHint("select", !0), r.redraw(); + }; + if (r.hoverData.which === 3) { + if (Xe) { + var Wr = { + originalEvent: T, + type: "cxtdrag", + position: { + x: j[0], + y: j[1] + } + }; + me ? me.emit(Wr) : U.emit(Wr), r.hoverData.cxtDragged = !0, (!r.hoverData.cxtOver || pe !== r.hoverData.cxtOver) && (r.hoverData.cxtOver && r.hoverData.cxtOver.emit({ + originalEvent: T, + type: "cxtdragout", + position: { + x: j[0], + y: j[1] + } + }), r.hoverData.cxtOver = pe, pe && pe.emit({ + originalEvent: T, + type: "cxtdragover", + position: { + x: j[0], + y: j[1] + } + })); + } + } else if (r.hoverData.dragging) { + if (W = !0, U.panningEnabled() && U.userPanningEnabled()) { + var Rt; + if (r.hoverData.justStartedPan) { + var Ga = r.hoverData.mdownPos; + Rt = { + x: (j[0] - Ga[0]) * $, + y: (j[1] - Ga[1]) * $ + }, r.hoverData.justStartedPan = !1; + } else + Rt = { + x: xe[0] * $, + y: xe[1] * $ + }; + U.panBy(Rt), U.emit("dragpan"), r.hoverData.dragged = !0; + } + j = r.projectIntoViewport(T.clientX, T.clientY); + } else if (Se[4] == 1 && (me == null || me.pannable())) { + if (Xe) { + if (!r.hoverData.dragging && U.boxSelectionEnabled() && (br || !U.panningEnabled() || !U.userPanningEnabled())) + Jr(); + else if (!r.hoverData.selecting && U.panningEnabled() && U.userPanningEnabled()) { + var gt = s(me, r.hoverData.downs); + gt && (r.hoverData.dragging = !0, r.hoverData.justStartedPan = !0, Se[4] = 0, r.data.bgActivePosistion = _t(ve), r.redrawHint("select", !0), r.redraw()); + } + me && me.pannable() && me.active() && me.unactivate(); + } + } else { + if (me && me.pannable() && me.active() && me.unactivate(), (!me || !me.grabbed()) && pe != Ce && (Ce && n(Ce, ["mouseout", "tapdragout"], T, { + x: j[0], + y: j[1] + }), pe && n(pe, ["mouseover", "tapdragover"], T, { + x: j[0], + y: j[1] + }), r.hoverData.last = pe), me) + if (Xe) { + if (U.boxSelectionEnabled() && br) + me && me.grabbed() && (p(Oe), me.emit("freeon"), Oe.emit("free"), r.dragData.didDrag && (me.emit("dragfreeon"), Oe.emit("dragfree"))), Jr(); + else if (me && me.grabbed() && r.nodeIsDraggable(me)) { + var wr = !r.dragData.didDrag; + wr && r.redrawHint("eles", !0), r.dragData.didDrag = !0, r.hoverData.draggingEles || y(Oe, { + inDragLayer: !0 + }); + var dr = { + x: 0, + y: 0 + }; + if (te(xe[0]) && te(xe[1]) && (dr.x += xe[0], dr.y += xe[1], wr)) { + var xr = r.hoverData.dragDelta; + xr && te(xr[0]) && te(xr[1]) && (dr.x += xr[0], dr.y += xr[1]); + } + r.hoverData.draggingEles = !0, Oe.silentShift(dr).emit("position drag"), r.redrawHint("drag", !0), r.redraw(); + } + } else + Or(); + W = !0; + } + if (Se[2] = j[0], Se[3] = j[1], W) + return T.stopPropagation && T.stopPropagation(), T.preventDefault && T.preventDefault(), !1; + } + }, !1); + var A, B, R; + r.registerBinding(e, "mouseup", function(T) { + if (!(r.hoverData.which === 1 && T.which !== 1 && r.hoverData.capture)) { + var _ = r.hoverData.capture; + if (_) { + r.hoverData.capture = !1; + var W = r.cy, U = r.projectIntoViewport(T.clientX, T.clientY), $ = r.selection, ue = r.findNearestElement(U[0], U[1], !0, !1), j = r.dragData.possibleDragElements, ve = r.hoverData.down, Ee = i(T); + if (r.data.bgActivePosistion && (r.redrawHint("select", !0), r.redraw()), r.hoverData.tapholdCancelled = !0, r.data.bgActivePosistion = void 0, ve && ve.unactivate(), r.hoverData.which === 3) { + var Se = { + originalEvent: T, + type: "cxttapend", + position: { + x: U[0], + y: U[1] + } + }; + if (ve ? ve.emit(Se) : W.emit(Se), !r.hoverData.cxtDragged) { + var pe = { + originalEvent: T, + type: "cxttap", + position: { + x: U[0], + y: U[1] + } + }; + ve ? ve.emit(pe) : W.emit(pe); + } + r.hoverData.cxtDragged = !1, r.hoverData.which = null; + } else if (r.hoverData.which === 1) { + if (n(ue, ["mouseup", "tapend", "vmouseup"], T, { + x: U[0], + y: U[1] + }), !r.dragData.didDrag && // didn't move a node around + !r.hoverData.dragged && // didn't pan + !r.hoverData.selecting && // not box selection + !r.hoverData.isOverThresholdDrag && (n(ve, ["click", "tap", "vclick"], T, { + x: U[0], + y: U[1] + }), B = !1, T.timeStamp - R <= W.multiClickDebounceTime() ? (A && clearTimeout(A), B = !0, R = null, n(ve, ["dblclick", "dbltap", "vdblclick"], T, { + x: U[0], + y: U[1] + })) : (A = setTimeout(function() { + B || n(ve, ["oneclick", "onetap", "voneclick"], T, { + x: U[0], + y: U[1] + }); + }, W.multiClickDebounceTime()), R = T.timeStamp)), ve == null && !r.dragData.didDrag && !r.hoverData.selecting && !r.hoverData.dragged && !i(T) && (W.$(t).unselect(["tapunselect"]), j.length > 0 && r.redrawHint("eles", !0), r.dragData.possibleDragElements = j = W.collection()), ue == ve && !r.dragData.didDrag && !r.hoverData.selecting && ue != null && ue._private.selectable && (r.hoverData.dragging || (W.selectionType() === "additive" || Ee ? ue.selected() ? ue.unselect(["tapunselect"]) : ue.select(["tapselect"]) : Ee || (W.$(t).unmerge(ue).unselect(["tapunselect"]), ue.select(["tapselect"]))), r.redrawHint("eles", !0)), r.hoverData.selecting) { + var Ce = W.collection(r.getAllInBox($[0], $[1], $[2], $[3])); + r.redrawHint("select", !0), Ce.length > 0 && r.redrawHint("eles", !0), W.emit({ + type: "boxend", + originalEvent: T, + position: { + x: U[0], + y: U[1] + } + }); + var me = function(Xe) { + return Xe.selectable() && !Xe.selected(); + }; + W.selectionType() === "additive" || Ee || W.$(t).unmerge(Ce).unselect(), Ce.emit("box").stdFilter(me).select().emit("boxselect"), r.redraw(); + } + if (r.hoverData.dragging && (r.hoverData.dragging = !1, r.redrawHint("select", !0), r.redrawHint("eles", !0), r.redraw()), !$[4]) { + r.redrawHint("drag", !0), r.redrawHint("eles", !0); + var xe = ve && ve.grabbed(); + p(j), xe && (ve.emit("freeon"), j.emit("free"), r.dragData.didDrag && (ve.emit("dragfreeon"), j.emit("dragfree"))); + } + } + $[4] = 0, r.hoverData.down = null, r.hoverData.cxtStarted = !1, r.hoverData.draggingEles = !1, r.hoverData.selecting = !1, r.hoverData.isOverThresholdDrag = !1, r.dragData.didDrag = !1, r.hoverData.dragged = !1, r.hoverData.dragDelta = [], r.hoverData.mdownPos = null, r.hoverData.mdownGPos = null, r.hoverData.which = null; + } + } + }, !1); + var M = [], I = 4, L, O = 1e5, V = function(T, _) { + for (var W = 0; W < T.length; W++) + if (T[W] % _ !== 0) + return !1; + return !0; + }, G = function(T) { + for (var _ = Math.abs(T[0]), W = 1; W < T.length; W++) + if (Math.abs(T[W]) !== _) + return !1; + return !0; + }, N = function(T) { + var _ = !1, W = T.deltaY; + if (W == null && (T.wheelDeltaY != null ? W = T.wheelDeltaY / 4 : T.wheelDelta != null && (W = T.wheelDelta / 4)), L == null) + if (M.length >= I) { + var U = M; + if (L = V(U, 5), !L) { + var $ = Math.abs(U[0]); + L = G(U) && $ > 5; + } + if (L) + for (var ue = 0; ue < U.length; ue++) + O = Math.min(Math.abs(U[ue]), O); + } else + M.push(W), _ = !0; + else L && (O = Math.min(Math.abs(W), O)); + if (!r.scrollingPage) { + var j = r.cy, ve = j.zoom(), Ee = j.pan(), Se = r.projectIntoViewport(T.clientX, T.clientY), pe = [Se[0] * ve + Ee.x, Se[1] * ve + Ee.y]; + if (r.hoverData.draggingEles || r.hoverData.dragging || r.hoverData.cxtStarted || S()) { + T.preventDefault(); + return; + } + if (j.panningEnabled() && j.userPanningEnabled() && j.zoomingEnabled() && j.userZoomingEnabled()) { + T.preventDefault(), r.data.wheelZooming = !0, clearTimeout(r.data.wheelTimeout), r.data.wheelTimeout = setTimeout(function() { + r.data.wheelZooming = !1, r.redrawHint("eles", !0), r.redraw(); + }, 150); + var Ce; + _ && Math.abs(W) > 5 && (W = js(W) * 5), Ce = W / -250, L && (Ce /= O, Ce *= 3), Ce = Ce * r.wheelSensitivity; + var me = T.deltaMode === 1; + me && (Ce *= 33); + var xe = j.zoom() * Math.pow(10, Ce); + T.type === "gesturechange" && (xe = r.gestureStartZoom * T.scale), j.zoom({ + level: xe, + renderedPosition: { + x: pe[0], + y: pe[1] + } + }), j.emit(T.type === "gesturechange" ? "pinchzoom" : "scrollzoom"); + } + } + }; + r.registerBinding(r.container, "wheel", N, !0), r.registerBinding(e, "scroll", function(T) { + r.scrollingPage = !0, clearTimeout(r.scrollingPageTimeout), r.scrollingPageTimeout = setTimeout(function() { + r.scrollingPage = !1; + }, 250); + }, !0), r.registerBinding(r.container, "gesturestart", function(T) { + r.gestureStartZoom = r.cy.zoom(), r.hasTouchStarted || T.preventDefault(); + }, !0), r.registerBinding(r.container, "gesturechange", function(Y) { + r.hasTouchStarted || N(Y); + }, !0), r.registerBinding(r.container, "mouseout", function(T) { + var _ = r.projectIntoViewport(T.clientX, T.clientY); + r.cy.emit({ + originalEvent: T, + type: "mouseout", + position: { + x: _[0], + y: _[1] + } + }); + }, !1), r.registerBinding(r.container, "mouseover", function(T) { + var _ = r.projectIntoViewport(T.clientX, T.clientY); + r.cy.emit({ + originalEvent: T, + type: "mouseover", + position: { + x: _[0], + y: _[1] + } + }); + }, !1); + var F, K, X, Q, Z, re, ae, J, z, q, H, ee, ne, be = function(T, _, W, U) { + return Math.sqrt((W - T) * (W - T) + (U - _) * (U - _)); + }, _e = function(T, _, W, U) { + return (W - T) * (W - T) + (U - _) * (U - _); + }, Ie; + r.registerBinding(r.container, "touchstart", Ie = function(T) { + if (r.hasTouchStarted = !0, !!P(T)) { + b(), r.touchData.capture = !0, r.data.bgActivePosistion = void 0; + var _ = r.cy, W = r.touchData.now, U = r.touchData.earlier; + if (T.touches[0]) { + var $ = r.projectIntoViewport(T.touches[0].clientX, T.touches[0].clientY); + W[0] = $[0], W[1] = $[1]; + } + if (T.touches[1]) { + var $ = r.projectIntoViewport(T.touches[1].clientX, T.touches[1].clientY); + W[2] = $[0], W[3] = $[1]; + } + if (T.touches[2]) { + var $ = r.projectIntoViewport(T.touches[2].clientX, T.touches[2].clientY); + W[4] = $[0], W[5] = $[1]; + } + if (T.touches[1]) { + r.touchData.singleTouchMoved = !0, p(r.dragData.touchDragEles); + var ue = r.findContainerClientCoords(); + z = ue[0], q = ue[1], H = ue[2], ee = ue[3], F = T.touches[0].clientX - z, K = T.touches[0].clientY - q, X = T.touches[1].clientX - z, Q = T.touches[1].clientY - q, ne = 0 <= F && F <= H && 0 <= X && X <= H && 0 <= K && K <= ee && 0 <= Q && Q <= ee; + var j = _.pan(), ve = _.zoom(); + Z = be(F, K, X, Q), re = _e(F, K, X, Q), ae = [(F + X) / 2, (K + Q) / 2], J = [(ae[0] - j.x) / ve, (ae[1] - j.y) / ve]; + var Ee = 200, Se = Ee * Ee; + if (re < Se && !T.touches[2]) { + var pe = r.findNearestElement(W[0], W[1], !0, !0), Ce = r.findNearestElement(W[2], W[3], !0, !0); + pe && pe.isNode() ? (pe.activate().emit({ + originalEvent: T, + type: "cxttapstart", + position: { + x: W[0], + y: W[1] + } + }), r.touchData.start = pe) : Ce && Ce.isNode() ? (Ce.activate().emit({ + originalEvent: T, + type: "cxttapstart", + position: { + x: W[0], + y: W[1] + } + }), r.touchData.start = Ce) : _.emit({ + originalEvent: T, + type: "cxttapstart", + position: { + x: W[0], + y: W[1] + } + }), r.touchData.start && (r.touchData.start._private.grabbed = !1), r.touchData.cxt = !0, r.touchData.cxtDragged = !1, r.data.bgActivePosistion = void 0, r.redraw(); + return; + } + } + if (T.touches[2]) + _.boxSelectionEnabled() && T.preventDefault(); + else if (!T.touches[1]) { + if (T.touches[0]) { + var me = r.findNearestElements(W[0], W[1], !0, !0), xe = me[0]; + if (xe != null && (xe.activate(), r.touchData.start = xe, r.touchData.starts = me, r.nodeIsGrabbable(xe))) { + var Oe = r.dragData.touchDragEles = _.collection(), Xe = null; + r.redrawHint("eles", !0), r.redrawHint("drag", !0), xe.selected() ? (Xe = _.$(function(Qe) { + return Qe.selected() && r.nodeIsGrabbable(Qe); + }), y(Xe, { + addToList: Oe + })) : g(xe, { + addToList: Oe + }), f(xe); + var or = function(br) { + return { + originalEvent: T, + type: br, + position: { + x: W[0], + y: W[1] + } + }; + }; + xe.emit(or("grabon")), Xe ? Xe.forEach(function(Qe) { + Qe.emit(or("grab")); + }) : xe.emit(or("grab")); + } + n(xe, ["touchstart", "tapstart", "vmousedown"], T, { + x: W[0], + y: W[1] + }), xe == null && (r.data.bgActivePosistion = { + x: $[0], + y: $[1] + }, r.redrawHint("select", !0), r.redraw()), r.touchData.singleTouchMoved = !1, r.touchData.singleTouchStartTime = +/* @__PURE__ */ new Date(), clearTimeout(r.touchData.tapholdTimeout), r.touchData.tapholdTimeout = setTimeout(function() { + r.touchData.singleTouchMoved === !1 && !r.pinching && !r.touchData.selecting && n(r.touchData.start, ["taphold"], T, { + x: W[0], + y: W[1] + }); + }, r.tapholdDuration); + } + } + if (T.touches.length >= 1) { + for (var ar = r.touchData.startPosition = [null, null, null, null, null, null], Ke = 0; Ke < W.length; Ke++) + ar[Ke] = U[Ke] = W[Ke]; + var ur = T.touches[0]; + r.touchData.startGPosition = [ur.clientX, ur.clientY]; + } + } + }, !1); + var se; + r.registerBinding(e, "touchmove", se = function(T) { + var _ = r.touchData.capture; + if (!(!_ && !P(T))) { + var W = r.selection, U = r.cy, $ = r.touchData.now, ue = r.touchData.earlier, j = U.zoom(); + if (T.touches[0]) { + var ve = r.projectIntoViewport(T.touches[0].clientX, T.touches[0].clientY); + $[0] = ve[0], $[1] = ve[1]; + } + if (T.touches[1]) { + var ve = r.projectIntoViewport(T.touches[1].clientX, T.touches[1].clientY); + $[2] = ve[0], $[3] = ve[1]; + } + if (T.touches[2]) { + var ve = r.projectIntoViewport(T.touches[2].clientX, T.touches[2].clientY); + $[4] = ve[0], $[5] = ve[1]; + } + var Ee = r.touchData.startGPosition, Se; + if (_ && T.touches[0] && Ee) { + for (var pe = [], Ce = 0; Ce < $.length; Ce++) + pe[Ce] = $[Ce] - ue[Ce]; + var me = T.touches[0].clientX - Ee[0], xe = me * me, Oe = T.touches[0].clientY - Ee[1], Xe = Oe * Oe, or = xe + Xe; + Se = or >= r.touchTapThreshold2; + } + if (_ && r.touchData.cxt) { + T.preventDefault(); + var ar = T.touches[0].clientX - z, Ke = T.touches[0].clientY - q, ur = T.touches[1].clientX - z, Qe = T.touches[1].clientY - q, br = _e(ar, Ke, ur, Qe), Or = br / re, Jr = 150, Wr = Jr * Jr, Rt = 1.5, Ga = Rt * Rt; + if (Or >= Ga || br >= Wr) { + r.touchData.cxt = !1, r.data.bgActivePosistion = void 0, r.redrawHint("select", !0); + var gt = { + originalEvent: T, + type: "cxttapend", + position: { + x: $[0], + y: $[1] + } + }; + r.touchData.start ? (r.touchData.start.unactivate().emit(gt), r.touchData.start = null) : U.emit(gt); + } + } + if (_ && r.touchData.cxt) { + var gt = { + originalEvent: T, + type: "cxtdrag", + position: { + x: $[0], + y: $[1] + } + }; + r.data.bgActivePosistion = void 0, r.redrawHint("select", !0), r.touchData.start ? r.touchData.start.emit(gt) : U.emit(gt), r.touchData.start && (r.touchData.start._private.grabbed = !1), r.touchData.cxtDragged = !0; + var wr = r.findNearestElement($[0], $[1], !0, !0); + (!r.touchData.cxtOver || wr !== r.touchData.cxtOver) && (r.touchData.cxtOver && r.touchData.cxtOver.emit({ + originalEvent: T, + type: "cxtdragout", + position: { + x: $[0], + y: $[1] + } + }), r.touchData.cxtOver = wr, wr && wr.emit({ + originalEvent: T, + type: "cxtdragover", + position: { + x: $[0], + y: $[1] + } + })); + } else if (_ && T.touches[2] && U.boxSelectionEnabled()) + T.preventDefault(), r.data.bgActivePosistion = void 0, this.lastThreeTouch = +/* @__PURE__ */ new Date(), r.touchData.selecting || U.emit({ + originalEvent: T, + type: "boxstart", + position: { + x: $[0], + y: $[1] + } + }), r.touchData.selecting = !0, r.touchData.didSelect = !0, W[4] = 1, !W || W.length === 0 || W[0] === void 0 ? (W[0] = ($[0] + $[2] + $[4]) / 3, W[1] = ($[1] + $[3] + $[5]) / 3, W[2] = ($[0] + $[2] + $[4]) / 3 + 1, W[3] = ($[1] + $[3] + $[5]) / 3 + 1) : (W[2] = ($[0] + $[2] + $[4]) / 3, W[3] = ($[1] + $[3] + $[5]) / 3), r.redrawHint("select", !0), r.redraw(); + else if (_ && T.touches[1] && !r.touchData.didSelect && U.zoomingEnabled() && U.panningEnabled() && U.userZoomingEnabled() && U.userPanningEnabled()) { + T.preventDefault(), r.data.bgActivePosistion = void 0, r.redrawHint("select", !0); + var dr = r.dragData.touchDragEles; + if (dr) { + r.redrawHint("drag", !0); + for (var xr = 0; xr < dr.length; xr++) { + var Ha = dr[xr]._private; + Ha.grabbed = !1, Ha.rscratch.inDragLayer = !1; + } + } + var Nr = r.touchData.start, ar = T.touches[0].clientX - z, Ke = T.touches[0].clientY - q, ur = T.touches[1].clientX - z, Qe = T.touches[1].clientY - q, yo = be(ar, Ke, ur, Qe), Nf = yo / Z; + if (ne) { + var zf = ar - F, Ff = Ke - K, Vf = ur - X, qf = Qe - Q, _f = (zf + Vf) / 2, Gf = (Ff + qf) / 2, ia = U.zoom(), Yn = ia * Nf, Wa = U.pan(), mo = J[0] * ia + Wa.x, bo = J[1] * ia + Wa.y, Hf = { + x: -Yn / ia * (mo - Wa.x - _f) + mo, + y: -Yn / ia * (bo - Wa.y - Gf) + bo + }; + if (Nr && Nr.active()) { + var dr = r.dragData.touchDragEles; + p(dr), r.redrawHint("drag", !0), r.redrawHint("eles", !0), Nr.unactivate().emit("freeon"), dr.emit("free"), r.dragData.didDrag && (Nr.emit("dragfreeon"), dr.emit("dragfree")); + } + U.viewport({ + zoom: Yn, + pan: Hf, + cancelOnFailedZoom: !0 + }), U.emit("pinchzoom"), Z = yo, F = ar, K = Ke, X = ur, Q = Qe, r.pinching = !0; + } + if (T.touches[0]) { + var ve = r.projectIntoViewport(T.touches[0].clientX, T.touches[0].clientY); + $[0] = ve[0], $[1] = ve[1]; + } + if (T.touches[1]) { + var ve = r.projectIntoViewport(T.touches[1].clientX, T.touches[1].clientY); + $[2] = ve[0], $[3] = ve[1]; + } + if (T.touches[2]) { + var ve = r.projectIntoViewport(T.touches[2].clientX, T.touches[2].clientY); + $[4] = ve[0], $[5] = ve[1]; + } + } else if (T.touches[0] && !r.touchData.didSelect) { + var Ar = r.touchData.start, Xn = r.touchData.last, wr; + if (!r.hoverData.draggingEles && !r.swipePanning && (wr = r.findNearestElement($[0], $[1], !0, !0)), _ && Ar != null && T.preventDefault(), _ && Ar != null && r.nodeIsDraggable(Ar)) + if (Se) { + var dr = r.dragData.touchDragEles, wo = !r.dragData.didDrag; + wo && y(dr, { + inDragLayer: !0 + }), r.dragData.didDrag = !0; + var sa = { + x: 0, + y: 0 + }; + if (te(pe[0]) && te(pe[1]) && (sa.x += pe[0], sa.y += pe[1], wo)) { + r.redrawHint("eles", !0); + var Rr = r.touchData.dragDelta; + Rr && te(Rr[0]) && te(Rr[1]) && (sa.x += Rr[0], sa.y += Rr[1]); + } + r.hoverData.draggingEles = !0, dr.silentShift(sa).emit("position drag"), r.redrawHint("drag", !0), r.touchData.startPosition[0] == ue[0] && r.touchData.startPosition[1] == ue[1] && r.redrawHint("eles", !0), r.redraw(); + } else { + var Rr = r.touchData.dragDelta = r.touchData.dragDelta || []; + Rr.length === 0 ? (Rr.push(pe[0]), Rr.push(pe[1])) : (Rr[0] += pe[0], Rr[1] += pe[1]); + } + if (n(Ar || wr, ["touchmove", "tapdrag", "vmousemove"], T, { + x: $[0], + y: $[1] + }), (!Ar || !Ar.grabbed()) && wr != Xn && (Xn && Xn.emit({ + originalEvent: T, + type: "tapdragout", + position: { + x: $[0], + y: $[1] + } + }), wr && wr.emit({ + originalEvent: T, + type: "tapdragover", + position: { + x: $[0], + y: $[1] + } + })), r.touchData.last = wr, _) + for (var xr = 0; xr < $.length; xr++) + $[xr] && r.touchData.startPosition[xr] && Se && (r.touchData.singleTouchMoved = !0); + if (_ && (Ar == null || Ar.pannable()) && U.panningEnabled() && U.userPanningEnabled()) { + var Wf = s(Ar, r.touchData.starts); + Wf && (T.preventDefault(), r.data.bgActivePosistion || (r.data.bgActivePosistion = _t(r.touchData.startPosition)), r.swipePanning ? (U.panBy({ + x: pe[0] * j, + y: pe[1] * j + }), U.emit("dragpan")) : Se && (r.swipePanning = !0, U.panBy({ + x: me * j, + y: Oe * j + }), U.emit("dragpan"), Ar && (Ar.unactivate(), r.redrawHint("select", !0), r.touchData.start = null))); + var ve = r.projectIntoViewport(T.touches[0].clientX, T.touches[0].clientY); + $[0] = ve[0], $[1] = ve[1]; + } + } + for (var Ce = 0; Ce < $.length; Ce++) + ue[Ce] = $[Ce]; + _ && T.touches.length > 0 && !r.hoverData.draggingEles && !r.swipePanning && r.data.bgActivePosistion != null && (r.data.bgActivePosistion = void 0, r.redrawHint("select", !0), r.redraw()); + } + }, !1); + var oe; + r.registerBinding(e, "touchcancel", oe = function(T) { + var _ = r.touchData.start; + r.touchData.capture = !1, _ && _.unactivate(); + }); + var ce, ge, de, ye; + if (r.registerBinding(e, "touchend", ce = function(T) { + var _ = r.touchData.start, W = r.touchData.capture; + if (W) + T.touches.length === 0 && (r.touchData.capture = !1), T.preventDefault(); + else + return; + var U = r.selection; + r.swipePanning = !1, r.hoverData.draggingEles = !1; + var $ = r.cy, ue = $.zoom(), j = r.touchData.now, ve = r.touchData.earlier; + if (T.touches[0]) { + var Ee = r.projectIntoViewport(T.touches[0].clientX, T.touches[0].clientY); + j[0] = Ee[0], j[1] = Ee[1]; + } + if (T.touches[1]) { + var Ee = r.projectIntoViewport(T.touches[1].clientX, T.touches[1].clientY); + j[2] = Ee[0], j[3] = Ee[1]; + } + if (T.touches[2]) { + var Ee = r.projectIntoViewport(T.touches[2].clientX, T.touches[2].clientY); + j[4] = Ee[0], j[5] = Ee[1]; + } + _ && _.unactivate(); + var Se; + if (r.touchData.cxt) { + if (Se = { + originalEvent: T, + type: "cxttapend", + position: { + x: j[0], + y: j[1] + } + }, _ ? _.emit(Se) : $.emit(Se), !r.touchData.cxtDragged) { + var pe = { + originalEvent: T, + type: "cxttap", + position: { + x: j[0], + y: j[1] + } + }; + _ ? _.emit(pe) : $.emit(pe); + } + r.touchData.start && (r.touchData.start._private.grabbed = !1), r.touchData.cxt = !1, r.touchData.start = null, r.redraw(); + return; + } + if (!T.touches[2] && $.boxSelectionEnabled() && r.touchData.selecting) { + r.touchData.selecting = !1; + var Ce = $.collection(r.getAllInBox(U[0], U[1], U[2], U[3])); + U[0] = void 0, U[1] = void 0, U[2] = void 0, U[3] = void 0, U[4] = 0, r.redrawHint("select", !0), $.emit({ + type: "boxend", + originalEvent: T, + position: { + x: j[0], + y: j[1] + } + }); + var me = function(Wr) { + return Wr.selectable() && !Wr.selected(); + }; + Ce.emit("box").stdFilter(me).select().emit("boxselect"), Ce.nonempty() && r.redrawHint("eles", !0), r.redraw(); + } + if (_ != null && _.unactivate(), T.touches[2]) + r.data.bgActivePosistion = void 0, r.redrawHint("select", !0); + else if (!T.touches[1]) { + if (!T.touches[0]) { + if (!T.touches[0]) { + r.data.bgActivePosistion = void 0, r.redrawHint("select", !0); + var xe = r.dragData.touchDragEles; + if (_ != null) { + var Oe = _._private.grabbed; + p(xe), r.redrawHint("drag", !0), r.redrawHint("eles", !0), Oe && (_.emit("freeon"), xe.emit("free"), r.dragData.didDrag && (_.emit("dragfreeon"), xe.emit("dragfree"))), n(_, ["touchend", "tapend", "vmouseup", "tapdragout"], T, { + x: j[0], + y: j[1] + }), _.unactivate(), r.touchData.start = null; + } else { + var Xe = r.findNearestElement(j[0], j[1], !0, !0); + n(Xe, ["touchend", "tapend", "vmouseup", "tapdragout"], T, { + x: j[0], + y: j[1] + }); + } + var or = r.touchData.startPosition[0] - j[0], ar = or * or, Ke = r.touchData.startPosition[1] - j[1], ur = Ke * Ke, Qe = ar + ur, br = Qe * ue * ue; + r.touchData.singleTouchMoved || (_ || $.$(":selected").unselect(["tapunselect"]), n(_, ["tap", "vclick"], T, { + x: j[0], + y: j[1] + }), ge = !1, T.timeStamp - ye <= $.multiClickDebounceTime() ? (de && clearTimeout(de), ge = !0, ye = null, n(_, ["dbltap", "vdblclick"], T, { + x: j[0], + y: j[1] + })) : (de = setTimeout(function() { + ge || n(_, ["onetap", "voneclick"], T, { + x: j[0], + y: j[1] + }); + }, $.multiClickDebounceTime()), ye = T.timeStamp)), _ != null && !r.dragData.didDrag && _._private.selectable && br < r.touchTapThreshold2 && !r.pinching && ($.selectionType() === "single" ? ($.$(t).unmerge(_).unselect(["tapunselect"]), _.select(["tapselect"])) : _.selected() ? _.unselect(["tapunselect"]) : _.select(["tapselect"]), r.redrawHint("eles", !0)), r.touchData.singleTouchMoved = !0; + } + } + } + for (var Or = 0; Or < j.length; Or++) + ve[Or] = j[Or]; + r.dragData.didDrag = !1, T.touches.length === 0 && (r.touchData.dragDelta = [], r.touchData.startPosition = [null, null, null, null, null, null], r.touchData.startGPosition = null, r.touchData.didSelect = !1), T.touches.length < 2 && (T.touches.length === 1 && (r.touchData.startGPosition = [T.touches[0].clientX, T.touches[0].clientY]), r.pinching = !1, r.redrawHint("eles", !0), r.redraw()); + }, !1), typeof TouchEvent > "u") { + var we = [], De = function(T) { + return { + clientX: T.clientX, + clientY: T.clientY, + force: 1, + identifier: T.pointerId, + pageX: T.pageX, + pageY: T.pageY, + radiusX: T.width / 2, + radiusY: T.height / 2, + screenX: T.screenX, + screenY: T.screenY, + target: T.target + }; + }, ze = function(T) { + return { + event: T, + touch: De(T) + }; + }, Ue = function(T) { + we.push(ze(T)); + }, Ae = function(T) { + for (var _ = 0; _ < we.length; _++) { + var W = we[_]; + if (W.event.pointerId === T.pointerId) { + we.splice(_, 1); + return; + } + } + }, Ye = function(T) { + var _ = we.filter(function(W) { + return W.event.pointerId === T.pointerId; + })[0]; + _.event = T, _.touch = De(T); + }, ke = function(T) { + T.touches = we.map(function(_) { + return _.touch; + }); + }, le = function(T) { + return T.pointerType === "mouse" || T.pointerType === 4; + }; + r.registerBinding(r.container, "pointerdown", function(Y) { + le(Y) || (Y.preventDefault(), Ue(Y), ke(Y), Ie(Y)); + }), r.registerBinding(r.container, "pointerup", function(Y) { + le(Y) || (Ae(Y), ke(Y), ce(Y)); + }), r.registerBinding(r.container, "pointercancel", function(Y) { + le(Y) || (Ae(Y), ke(Y), oe(Y)); + }), r.registerBinding(r.container, "pointermove", function(Y) { + le(Y) || (Y.preventDefault(), Ye(Y), ke(Y), se(Y)); + }); + } +}; +var Zr = {}; +Zr.generatePolygon = function(r, e) { + return this.nodeShapes[r] = { + renderer: this, + name: r, + points: e, + draw: function(a, n, i, s, o, l) { + this.renderer.nodeShapeImpl("polygon", a, n, i, s, o, this.points); + }, + intersectLine: function(a, n, i, s, o, l, u, v) { + return Ta(o, l, this.points, a, n, i / 2, s / 2, u); + }, + checkPoint: function(a, n, i, s, o, l, u, v) { + return Xr(a, n, this.points, l, u, s, o, [0, -1], i); + } + }; +}; +Zr.generateEllipse = function() { + return this.nodeShapes.ellipse = { + renderer: this, + name: "ellipse", + draw: function(e, t, a, n, i, s) { + this.renderer.nodeShapeImpl(this.name, e, t, a, n, i); + }, + intersectLine: function(e, t, a, n, i, s, o, l) { + return Dd(i, s, e, t, a / 2 + o, n / 2 + o); + }, + checkPoint: function(e, t, a, n, i, s, o, l) { + return Ct(e, t, n, i, s, o, a); + } + }; +}; +Zr.generateRoundPolygon = function(r, e) { + return this.nodeShapes[r] = { + renderer: this, + name: r, + points: e, + getOrCreateCorners: function(a, n, i, s, o, l, u) { + if (l[u] !== void 0 && l[u + "-cx"] === a && l[u + "-cy"] === n) + return l[u]; + l[u] = new Array(e.length / 2), l[u + "-cx"] = a, l[u + "-cy"] = n; + var v = i / 2, f = s / 2; + o = o === "auto" ? gv(i, s) : o; + for (var c = new Array(e.length / 2), h = 0; h < e.length / 2; h++) + c[h] = { + x: a + v * e[h * 2], + y: n + f * e[h * 2 + 1] + }; + var d, y, g, p, m = c.length; + for (y = c[m - 1], d = 0; d < m; d++) + g = c[d % m], p = c[(d + 1) % m], l[u][d] = co(y, g, p, o), y = g, g = p; + return l[u]; + }, + draw: function(a, n, i, s, o, l, u) { + this.renderer.nodeShapeImpl("round-polygon", a, n, i, s, o, this.points, this.getOrCreateCorners(n, i, s, o, l, u, "drawCorners")); + }, + intersectLine: function(a, n, i, s, o, l, u, v, f) { + return kd(o, l, this.points, a, n, i, s, u, this.getOrCreateCorners(a, n, i, s, v, f, "corners")); + }, + checkPoint: function(a, n, i, s, o, l, u, v, f) { + return Sd(a, n, this.points, l, u, s, o, this.getOrCreateCorners(l, u, s, o, v, f, "corners")); + } + }; +}; +Zr.generateRoundRectangle = function() { + return this.nodeShapes["round-rectangle"] = this.nodeShapes.roundrectangle = { + renderer: this, + name: "round-rectangle", + points: yr(4, 0), + draw: function(e, t, a, n, i, s) { + this.renderer.nodeShapeImpl(this.name, e, t, a, n, i, this.points, s); + }, + intersectLine: function(e, t, a, n, i, s, o, l) { + return dv(i, s, e, t, a, n, o, l); + }, + checkPoint: function(e, t, a, n, i, s, o, l) { + var u = n / 2, v = i / 2; + l = l === "auto" ? st(n, i) : l, l = Math.min(u, v, l); + var f = l * 2; + return !!(Xr(e, t, this.points, s, o, n, i - f, [0, -1], a) || Xr(e, t, this.points, s, o, n - f, i, [0, -1], a) || Ct(e, t, f, f, s - u + l, o - v + l, a) || Ct(e, t, f, f, s + u - l, o - v + l, a) || Ct(e, t, f, f, s + u - l, o + v - l, a) || Ct(e, t, f, f, s - u + l, o + v - l, a)); + } + }; +}; +Zr.generateCutRectangle = function() { + return this.nodeShapes["cut-rectangle"] = this.nodeShapes.cutrectangle = { + renderer: this, + name: "cut-rectangle", + cornerLength: ro(), + points: yr(4, 0), + draw: function(e, t, a, n, i, s) { + this.renderer.nodeShapeImpl(this.name, e, t, a, n, i, null, s); + }, + generateCutTrianglePts: function(e, t, a, n, i) { + var s = i === "auto" ? this.cornerLength : i, o = t / 2, l = e / 2, u = a - l, v = a + l, f = n - o, c = n + o; + return { + topLeft: [u, f + s, u + s, f, u + s, f + s], + topRight: [v - s, f, v, f + s, v - s, f + s], + bottomRight: [v, c - s, v - s, c, v - s, c - s], + bottomLeft: [u + s, c, u, c - s, u + s, c - s] + }; + }, + intersectLine: function(e, t, a, n, i, s, o, l) { + var u = this.generateCutTrianglePts(a + 2 * o, n + 2 * o, e, t, l), v = [].concat.apply([], [u.topLeft.splice(0, 4), u.topRight.splice(0, 4), u.bottomRight.splice(0, 4), u.bottomLeft.splice(0, 4)]); + return Ta(i, s, v, e, t); + }, + checkPoint: function(e, t, a, n, i, s, o, l) { + var u = l === "auto" ? this.cornerLength : l; + if (Xr(e, t, this.points, s, o, n, i - 2 * u, [0, -1], a) || Xr(e, t, this.points, s, o, n - 2 * u, i, [0, -1], a)) + return !0; + var v = this.generateCutTrianglePts(n, i, s, o); + return Cr(e, t, v.topLeft) || Cr(e, t, v.topRight) || Cr(e, t, v.bottomRight) || Cr(e, t, v.bottomLeft); + } + }; +}; +Zr.generateBarrel = function() { + return this.nodeShapes.barrel = { + renderer: this, + name: "barrel", + points: yr(4, 0), + draw: function(e, t, a, n, i, s) { + this.renderer.nodeShapeImpl(this.name, e, t, a, n, i); + }, + intersectLine: function(e, t, a, n, i, s, o, l) { + var u = 0.15, v = 0.5, f = 0.85, c = this.generateBarrelBezierPts(a + 2 * o, n + 2 * o, e, t), h = function(g) { + var p = Wt({ + x: g[0], + y: g[1] + }, { + x: g[2], + y: g[3] + }, { + x: g[4], + y: g[5] + }, u), m = Wt({ + x: g[0], + y: g[1] + }, { + x: g[2], + y: g[3] + }, { + x: g[4], + y: g[5] + }, v), b = Wt({ + x: g[0], + y: g[1] + }, { + x: g[2], + y: g[3] + }, { + x: g[4], + y: g[5] + }, f); + return [g[0], g[1], p.x, p.y, m.x, m.y, b.x, b.y, g[4], g[5]]; + }, d = [].concat(h(c.topLeft), h(c.topRight), h(c.bottomRight), h(c.bottomLeft)); + return Ta(i, s, d, e, t); + }, + generateBarrelBezierPts: function(e, t, a, n) { + var i = t / 2, s = e / 2, o = a - s, l = a + s, u = n - i, v = n + i, f = ks(e, t), c = f.heightOffset, h = f.widthOffset, d = f.ctrlPtOffsetPct * e, y = { + topLeft: [o, u + c, o + d, u, o + h, u], + topRight: [l - h, u, l - d, u, l, u + c], + bottomRight: [l, v - c, l - d, v, l - h, v], + bottomLeft: [o + h, v, o + d, v, o, v - c] + }; + return y.topLeft.isTop = !0, y.topRight.isTop = !0, y.bottomLeft.isBottom = !0, y.bottomRight.isBottom = !0, y; + }, + checkPoint: function(e, t, a, n, i, s, o, l) { + var u = ks(n, i), v = u.heightOffset, f = u.widthOffset; + if (Xr(e, t, this.points, s, o, n, i - 2 * v, [0, -1], a) || Xr(e, t, this.points, s, o, n - 2 * f, i, [0, -1], a)) + return !0; + for (var c = this.generateBarrelBezierPts(n, i, s, o), h = function(k, S, P) { + var D = P[4], A = P[2], B = P[0], R = P[5], M = P[1], I = Math.min(D, B), L = Math.max(D, B), O = Math.min(R, M), V = Math.max(R, M); + if (I <= k && k <= L && O <= S && S <= V) { + var G = Bd(D, A, B), N = xd(G[0], G[1], G[2], k), F = N.filter(function(K) { + return 0 <= K && K <= 1; + }); + if (F.length > 0) + return F[0]; + } + return null; + }, d = Object.keys(c), y = 0; y < d.length; y++) { + var g = d[y], p = c[g], m = h(e, t, p); + if (m != null) { + var b = p[5], w = p[3], E = p[1], C = nr(b, w, E, m); + if (p.isTop && C <= t || p.isBottom && t <= C) + return !0; + } + } + return !1; + } + }; +}; +Zr.generateBottomRoundrectangle = function() { + return this.nodeShapes["bottom-round-rectangle"] = this.nodeShapes.bottomroundrectangle = { + renderer: this, + name: "bottom-round-rectangle", + points: yr(4, 0), + draw: function(e, t, a, n, i, s) { + this.renderer.nodeShapeImpl(this.name, e, t, a, n, i, this.points, s); + }, + intersectLine: function(e, t, a, n, i, s, o, l) { + var u = e - (a / 2 + o), v = t - (n / 2 + o), f = v, c = e + (a / 2 + o), h = rt(i, s, e, t, u, v, c, f, !1); + return h.length > 0 ? h : dv(i, s, e, t, a, n, o, l); + }, + checkPoint: function(e, t, a, n, i, s, o, l) { + l = l === "auto" ? st(n, i) : l; + var u = 2 * l; + if (Xr(e, t, this.points, s, o, n, i - u, [0, -1], a) || Xr(e, t, this.points, s, o, n - u, i, [0, -1], a)) + return !0; + var v = n / 2 + 2 * a, f = i / 2 + 2 * a, c = [s - v, o - f, s - v, o, s + v, o, s + v, o - f]; + return !!(Cr(e, t, c) || Ct(e, t, u, u, s + n / 2 - l, o + i / 2 - l, a) || Ct(e, t, u, u, s - n / 2 + l, o + i / 2 - l, a)); + } + }; +}; +Zr.registerNodeShapes = function() { + var r = this.nodeShapes = {}, e = this; + this.generateEllipse(), this.generatePolygon("triangle", yr(3, 0)), this.generateRoundPolygon("round-triangle", yr(3, 0)), this.generatePolygon("rectangle", yr(4, 0)), r.square = r.rectangle, this.generateRoundRectangle(), this.generateCutRectangle(), this.generateBarrel(), this.generateBottomRoundrectangle(); + { + var t = [0, 1, 1, 0, 0, -1, -1, 0]; + this.generatePolygon("diamond", t), this.generateRoundPolygon("round-diamond", t); + } + this.generatePolygon("pentagon", yr(5, 0)), this.generateRoundPolygon("round-pentagon", yr(5, 0)), this.generatePolygon("hexagon", yr(6, 0)), this.generateRoundPolygon("round-hexagon", yr(6, 0)), this.generatePolygon("heptagon", yr(7, 0)), this.generateRoundPolygon("round-heptagon", yr(7, 0)), this.generatePolygon("octagon", yr(8, 0)), this.generateRoundPolygon("round-octagon", yr(8, 0)); + var a = new Array(20); + { + var n = Ds(5, 0), i = Ds(5, Math.PI / 5), s = 0.5 * (3 - Math.sqrt(5)); + s *= 1.57; + for (var o = 0; o < i.length / 2; o++) + i[o * 2] *= s, i[o * 2 + 1] *= s; + for (var o = 0; o < 20 / 4; o++) + a[o * 4] = n[o * 2], a[o * 4 + 1] = n[o * 2 + 1], a[o * 4 + 2] = i[o * 2], a[o * 4 + 3] = i[o * 2 + 1]; + } + a = hv(a), this.generatePolygon("star", a), this.generatePolygon("vee", [-1, -1, 0, -0.333, 1, -1, 0, 1]), this.generatePolygon("rhomboid", [-1, -1, 0.333, -1, 1, 1, -0.333, 1]), this.generatePolygon("right-rhomboid", [-0.333, -1, 1, -1, 0.333, 1, -1, 1]), this.nodeShapes.concavehexagon = this.generatePolygon("concave-hexagon", [-1, -0.95, -0.75, 0, -1, 0.95, 1, 0.95, 0.75, 0, 1, -0.95]); + { + var l = [-1, -1, 0.25, -1, 1, 0, 0.25, 1, -1, 1]; + this.generatePolygon("tag", l), this.generateRoundPolygon("round-tag", l); + } + r.makePolygon = function(u) { + var v = u.join("$"), f = "polygon-" + v, c; + return (c = this[f]) ? c : e.generatePolygon(f, u); + }; +}; +var qa = {}; +qa.timeToRender = function() { + return this.redrawTotalTime / this.redrawCount; +}; +qa.redraw = function(r) { + r = r || vv(); + var e = this; + e.averageRedrawTime === void 0 && (e.averageRedrawTime = 0), e.lastRedrawTime === void 0 && (e.lastRedrawTime = 0), e.lastDrawTime === void 0 && (e.lastDrawTime = 0), e.requestedFrame = !0, e.renderOptions = r; +}; +qa.beforeRender = function(r, e) { + if (!this.destroyed) { + e == null && He("Priority is not optional for beforeRender"); + var t = this.beforeRenderCallbacks; + t.push({ + fn: r, + priority: e + }), t.sort(function(a, n) { + return n.priority - a.priority; + }); + } +}; +var Al = function(e, t, a) { + for (var n = e.beforeRenderCallbacks, i = 0; i < n.length; i++) + n[i].fn(t, a); +}; +qa.startRenderLoop = function() { + var r = this, e = r.cy; + if (!r.renderLoopStarted) { + r.renderLoopStarted = !0; + var t = function(n) { + if (!r.destroyed) { + if (!e.batching()) if (r.requestedFrame && !r.skipFrame) { + Al(r, !0, n); + var i = Yr(); + r.render(r.renderOptions); + var s = r.lastDrawTime = Yr(); + r.averageRedrawTime === void 0 && (r.averageRedrawTime = s - i), r.redrawCount === void 0 && (r.redrawCount = 0), r.redrawCount++, r.redrawTotalTime === void 0 && (r.redrawTotalTime = 0); + var o = s - i; + r.redrawTotalTime += o, r.lastRedrawTime = o, r.averageRedrawTime = r.averageRedrawTime / 2 + o / 2, r.requestedFrame = !1; + } else + Al(r, !1, n); + r.skipFrame = !1, mn(t); + } + }; + mn(t); + } +}; +var Up = function(e) { + this.init(e); +}, gf = Up, na = gf.prototype; +na.clientFunctions = ["redrawHint", "render", "renderTo", "matchCanvasSize", "nodeShapeImpl", "arrowShapeImpl"]; +na.init = function(r) { + var e = this; + e.options = r, e.cy = r.cy; + var t = e.container = r.cy.container(), a = e.cy.window(); + if (a) { + var n = a.document, i = n.head, s = "__________cytoscape_stylesheet", o = "__________cytoscape_container", l = n.getElementById(s) != null; + if (t.className.indexOf(o) < 0 && (t.className = (t.className || "") + " " + o), !l) { + var u = n.createElement("style"); + u.id = s, u.textContent = "." + o + " { position: relative; }", i.insertBefore(u, i.children[0]); + } + var v = a.getComputedStyle(t), f = v.getPropertyValue("position"); + f === "static" && Le("A Cytoscape container has style position:static and so can not use UI extensions properly"); + } + e.selection = [void 0, void 0, void 0, void 0, 0], e.bezierProjPcts = [0.05, 0.225, 0.4, 0.5, 0.6, 0.775, 0.95], e.hoverData = { + down: null, + last: null, + downTime: null, + triggerMode: null, + dragging: !1, + initialPan: [null, null], + capture: !1 + }, e.dragData = { + possibleDragElements: [] + }, e.touchData = { + start: null, + capture: !1, + // These 3 fields related to tap, taphold events + startPosition: [null, null, null, null, null, null], + singleTouchStartTime: null, + singleTouchMoved: !0, + now: [null, null, null, null, null, null], + earlier: [null, null, null, null, null, null] + }, e.redraws = 0, e.showFps = r.showFps, e.debug = r.debug, e.webgl = r.webgl, e.hideEdgesOnViewport = r.hideEdgesOnViewport, e.textureOnViewport = r.textureOnViewport, e.wheelSensitivity = r.wheelSensitivity, e.motionBlurEnabled = r.motionBlur, e.forcedPixelRatio = te(r.pixelRatio) ? r.pixelRatio : null, e.motionBlur = r.motionBlur, e.motionBlurOpacity = r.motionBlurOpacity, e.motionBlurTransparency = 1 - e.motionBlurOpacity, e.motionBlurPxRatio = 1, e.mbPxRBlurry = 1, e.minMbLowQualFrames = 4, e.fullQualityMb = !1, e.clearedForMotionBlur = [], e.desktopTapThreshold = r.desktopTapThreshold, e.desktopTapThreshold2 = r.desktopTapThreshold * r.desktopTapThreshold, e.touchTapThreshold = r.touchTapThreshold, e.touchTapThreshold2 = r.touchTapThreshold * r.touchTapThreshold, e.tapholdDuration = 500, e.bindings = [], e.beforeRenderCallbacks = [], e.beforeRenderPriorities = { + // higher priority execs before lower one + animations: 400, + eleCalcs: 300, + eleTxrDeq: 200, + lyrTxrDeq: 150, + lyrTxrSkip: 100 + }, e.registerNodeShapes(), e.registerArrowShapes(), e.registerCalculationListeners(); +}; +na.notify = function(r, e) { + var t = this, a = t.cy; + if (!this.destroyed) { + if (r === "init") { + t.load(); + return; + } + if (r === "destroy") { + t.destroy(); + return; + } + (r === "add" || r === "remove" || r === "move" && a.hasCompoundNodes() || r === "load" || r === "zorder" || r === "mount") && t.invalidateCachedZSortedEles(), r === "viewport" && t.redrawHint("select", !0), r === "gc" && t.redrawHint("gc", !0), (r === "load" || r === "resize" || r === "mount") && (t.invalidateContainerClientCoordsCache(), t.matchCanvasSize(t.container)), t.redrawHint("eles", !0), t.redrawHint("drag", !0), this.startRenderLoop(), this.redraw(); + } +}; +na.destroy = function() { + var r = this; + r.destroyed = !0, r.cy.stopAnimationLoop(); + for (var e = 0; e < r.bindings.length; e++) { + var t = r.bindings[e], a = t, n = a.target; + (n.off || n.removeEventListener).apply(n, a.args); + } + if (r.bindings = [], r.beforeRenderCallbacks = [], r.onUpdateEleCalcsFns = [], r.removeObserver && r.removeObserver.disconnect(), r.styleObserver && r.styleObserver.disconnect(), r.resizeObserver && r.resizeObserver.disconnect(), r.labelCalcDiv) + try { + document.body.removeChild(r.labelCalcDiv); + } catch { + } +}; +na.isHeadless = function() { + return !1; +}; +[fo, df, hf, aa, Zr, qa].forEach(function(r) { + he(na, r); +}); +var ps = 1e3 / 60, pf = { + setupDequeueing: function(e) { + return function() { + var a = this, n = this.renderer; + if (!a.dequeueingSetup) { + a.dequeueingSetup = !0; + var i = Oa(function() { + n.redrawHint("eles", !0), n.redrawHint("drag", !0), n.redraw(); + }, e.deqRedrawThreshold), s = function(u, v) { + var f = Yr(), c = n.averageRedrawTime, h = n.lastRedrawTime, d = [], y = n.cy.extent(), g = n.getPixelRatio(); + for (u || n.flushRenderedStyleQueue(); ; ) { + var p = Yr(), m = p - f, b = p - v; + if (h < ps) { + var w = ps - (u ? c : 0); + if (b >= e.deqFastCost * w) + break; + } else if (u) { + if (m >= e.deqCost * h || m >= e.deqAvgCost * c) + break; + } else if (b >= e.deqNoDrawCost * ps) + break; + var E = e.deq(a, g, y); + if (E.length > 0) + for (var C = 0; C < E.length; C++) + d.push(E[C]); + else + break; + } + d.length > 0 && (e.onDeqd(a, d), !u && e.shouldRedraw(a, d, g, y) && i()); + }, o = e.priority || Zs; + n.beforeRender(s, o(a)); + } + }; + } +}, $p = /* @__PURE__ */ function() { + function r(e) { + var t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : bn; + vt(this, r), this.idsByKey = new Kr(), this.keyForId = new Kr(), this.cachesByLvl = new Kr(), this.lvls = [], this.getKey = e, this.doesEleInvalidateKey = t; + } + return ft(r, [{ + key: "getIdsFor", + value: function(t) { + t == null && He("Can not get id list for null key"); + var a = this.idsByKey, n = this.idsByKey.get(t); + return n || (n = new jt(), a.set(t, n)), n; + } + }, { + key: "addIdForKey", + value: function(t, a) { + t != null && this.getIdsFor(t).add(a); + } + }, { + key: "deleteIdForKey", + value: function(t, a) { + t != null && this.getIdsFor(t).delete(a); + } + }, { + key: "getNumberOfIdsForKey", + value: function(t) { + return t == null ? 0 : this.getIdsFor(t).size; + } + }, { + key: "updateKeyMappingFor", + value: function(t) { + var a = t.id(), n = this.keyForId.get(a), i = this.getKey(t); + this.deleteIdForKey(n, a), this.addIdForKey(i, a), this.keyForId.set(a, i); + } + }, { + key: "deleteKeyMappingFor", + value: function(t) { + var a = t.id(), n = this.keyForId.get(a); + this.deleteIdForKey(n, a), this.keyForId.delete(a); + } + }, { + key: "keyHasChangedFor", + value: function(t) { + var a = t.id(), n = this.keyForId.get(a), i = this.getKey(t); + return n !== i; + } + }, { + key: "isInvalid", + value: function(t) { + return this.keyHasChangedFor(t) || this.doesEleInvalidateKey(t); + } + }, { + key: "getCachesAt", + value: function(t) { + var a = this.cachesByLvl, n = this.lvls, i = a.get(t); + return i || (i = new Kr(), a.set(t, i), n.push(t)), i; + } + }, { + key: "getCache", + value: function(t, a) { + return this.getCachesAt(a).get(t); + } + }, { + key: "get", + value: function(t, a) { + var n = this.getKey(t), i = this.getCache(n, a); + return i != null && this.updateKeyMappingFor(t), i; + } + }, { + key: "getForCachedKey", + value: function(t, a) { + var n = this.keyForId.get(t.id()), i = this.getCache(n, a); + return i; + } + }, { + key: "hasCache", + value: function(t, a) { + return this.getCachesAt(a).has(t); + } + }, { + key: "has", + value: function(t, a) { + var n = this.getKey(t); + return this.hasCache(n, a); + } + }, { + key: "setCache", + value: function(t, a, n) { + n.key = t, this.getCachesAt(a).set(t, n); + } + }, { + key: "set", + value: function(t, a, n) { + var i = this.getKey(t); + this.setCache(i, a, n), this.updateKeyMappingFor(t); + } + }, { + key: "deleteCache", + value: function(t, a) { + this.getCachesAt(a).delete(t); + } + }, { + key: "delete", + value: function(t, a) { + var n = this.getKey(t); + this.deleteCache(n, a); + } + }, { + key: "invalidateKey", + value: function(t) { + var a = this; + this.lvls.forEach(function(n) { + return a.deleteCache(t, n); + }); + } + // returns true if no other eles reference the invalidated cache (n.b. other eles may need the cache with the same key) + }, { + key: "invalidate", + value: function(t) { + var a = t.id(), n = this.keyForId.get(a); + this.deleteKeyMappingFor(t); + var i = this.doesEleInvalidateKey(t); + return i && this.invalidateKey(n), i || this.getNumberOfIdsForKey(n) === 0; + } + }]); +}(), Rl = 25, tn = 50, hn = -4, qs = 3, yf = 7.99, Kp = 8, Yp = 1024, Xp = 1024, Zp = 1024, Qp = 0.2, Jp = 0.8, jp = 10, ey = 0.15, ry = 0.1, ty = 0.9, ay = 0.9, ny = 100, iy = 1, Ht = { + dequeue: "dequeue", + downscale: "downscale", + highQuality: "highQuality" +}, sy = fr({ + getKey: null, + doesEleInvalidateKey: bn, + drawElement: null, + getBoundingBox: null, + getRotationPoint: null, + getRotationOffset: null, + isVisible: ov, + allowEdgeTxrCaching: !0, + allowParentTxrCaching: !0 +}), pa = function(e, t) { + var a = this; + a.renderer = e, a.onDequeues = []; + var n = sy(t); + he(a, n), a.lookup = new $p(n.getKey, n.doesEleInvalidateKey), a.setupDequeueing(); +}, tr = pa.prototype; +tr.reasons = Ht; +tr.getTextureQueue = function(r) { + var e = this; + return e.eleImgCaches = e.eleImgCaches || {}, e.eleImgCaches[r] = e.eleImgCaches[r] || []; +}; +tr.getRetiredTextureQueue = function(r) { + var e = this, t = e.eleImgCaches.retired = e.eleImgCaches.retired || {}, a = t[r] = t[r] || []; + return a; +}; +tr.getElementQueue = function() { + var r = this, e = r.eleCacheQueue = r.eleCacheQueue || new Na(function(t, a) { + return a.reqs - t.reqs; + }); + return e; +}; +tr.getElementKeyToQueue = function() { + var r = this, e = r.eleKeyToCacheQueue = r.eleKeyToCacheQueue || {}; + return e; +}; +tr.getElement = function(r, e, t, a, n) { + var i = this, s = this.renderer, o = s.cy.zoom(), l = this.lookup; + if (!e || e.w === 0 || e.h === 0 || isNaN(e.w) || isNaN(e.h) || !r.visible() || r.removed() || !i.allowEdgeTxrCaching && r.isEdge() || !i.allowParentTxrCaching && r.isParent()) + return null; + if (a == null && (a = Math.ceil(Js(o * t))), a < hn) + a = hn; + else if (o >= yf || a > qs) + return null; + var u = Math.pow(2, a), v = e.h * u, f = e.w * u, c = s.eleTextBiggerThanMin(r, u); + if (!this.isVisible(r, c)) + return null; + var h = l.get(r, a); + if (h && h.invalidated && (h.invalidated = !1, h.texture.invalidatedWidth -= h.width), h) + return h; + var d; + if (v <= Rl ? d = Rl : v <= tn ? d = tn : d = Math.ceil(v / tn) * tn, v > Zp || f > Xp) + return null; + var y = i.getTextureQueue(d), g = y[y.length - 2], p = function() { + return i.recycleTexture(d, f) || i.addTexture(d, f); + }; + g || (g = y[y.length - 1]), g || (g = p()), g.width - g.usedWidth < f && (g = p()); + for (var m = function(I) { + return I && I.scaledLabelShown === c; + }, b = n && n === Ht.dequeue, w = n && n === Ht.highQuality, E = n && n === Ht.downscale, C, x = a + 1; x <= qs; x++) { + var k = l.get(r, x); + if (k) { + C = k; + break; + } + } + var S = C && C.level === a + 1 ? C : null, P = function() { + g.context.drawImage(S.texture.canvas, S.x, 0, S.width, S.height, g.usedWidth, 0, f, v); + }; + if (g.context.setTransform(1, 0, 0, 1, 0, 0), g.context.clearRect(g.usedWidth, 0, f, d), m(S)) + P(); + else if (m(C)) + if (w) { + for (var D = C.level; D > a; D--) + S = i.getElement(r, e, t, D, Ht.downscale); + P(); + } else + return i.queueElement(r, C.level - 1), C; + else { + var A; + if (!b && !w && !E) + for (var B = a - 1; B >= hn; B--) { + var R = l.get(r, B); + if (R) { + A = R; + break; + } + } + if (m(A)) + return i.queueElement(r, a), A; + g.context.translate(g.usedWidth, 0), g.context.scale(u, u), this.drawElement(g.context, r, e, c, !1), g.context.scale(1 / u, 1 / u), g.context.translate(-g.usedWidth, 0); + } + return h = { + x: g.usedWidth, + texture: g, + level: a, + scale: u, + width: f, + height: v, + scaledLabelShown: c + }, g.usedWidth += Math.ceil(f + Kp), g.eleCaches.push(h), l.set(r, a, h), i.checkTextureFullness(g), h; +}; +tr.invalidateElements = function(r) { + for (var e = 0; e < r.length; e++) + this.invalidateElement(r[e]); +}; +tr.invalidateElement = function(r) { + var e = this, t = e.lookup, a = [], n = t.isInvalid(r); + if (n) { + for (var i = hn; i <= qs; i++) { + var s = t.getForCachedKey(r, i); + s && a.push(s); + } + var o = t.invalidate(r); + if (o) + for (var l = 0; l < a.length; l++) { + var u = a[l], v = u.texture; + v.invalidatedWidth += u.width, u.invalidated = !0, e.checkTextureUtility(v); + } + e.removeFromQueue(r); + } +}; +tr.checkTextureUtility = function(r) { + r.invalidatedWidth >= Qp * r.width && this.retireTexture(r); +}; +tr.checkTextureFullness = function(r) { + var e = this, t = e.getTextureQueue(r.height); + r.usedWidth / r.width > Jp && r.fullnessChecks >= jp ? it(t, r) : r.fullnessChecks++; +}; +tr.retireTexture = function(r) { + var e = this, t = r.height, a = e.getTextureQueue(t), n = this.lookup; + it(a, r), r.retired = !0; + for (var i = r.eleCaches, s = 0; s < i.length; s++) { + var o = i[s]; + n.deleteCache(o.key, o.level); + } + Qs(i); + var l = e.getRetiredTextureQueue(t); + l.push(r); +}; +tr.addTexture = function(r, e) { + var t = this, a = t.getTextureQueue(r), n = {}; + return a.push(n), n.eleCaches = [], n.height = r, n.width = Math.max(Yp, e), n.usedWidth = 0, n.invalidatedWidth = 0, n.fullnessChecks = 0, n.canvas = t.renderer.makeOffscreenCanvas(n.width, n.height), n.context = n.canvas.getContext("2d"), n; +}; +tr.recycleTexture = function(r, e) { + for (var t = this, a = t.getTextureQueue(r), n = t.getRetiredTextureQueue(r), i = 0; i < n.length; i++) { + var s = n[i]; + if (s.width >= e) + return s.retired = !1, s.usedWidth = 0, s.invalidatedWidth = 0, s.fullnessChecks = 0, Qs(s.eleCaches), s.context.setTransform(1, 0, 0, 1, 0, 0), s.context.clearRect(0, 0, s.width, s.height), it(n, s), a.push(s), s; + } +}; +tr.queueElement = function(r, e) { + var t = this, a = t.getElementQueue(), n = t.getElementKeyToQueue(), i = this.getKey(r), s = n[i]; + if (s) + s.level = Math.max(s.level, e), s.eles.merge(r), s.reqs++, a.updateItem(s); + else { + var o = { + eles: r.spawn().merge(r), + level: e, + reqs: 1, + key: i + }; + a.push(o), n[i] = o; + } +}; +tr.dequeue = function(r) { + for (var e = this, t = e.getElementQueue(), a = e.getElementKeyToQueue(), n = [], i = e.lookup, s = 0; s < iy && t.size() > 0; s++) { + var o = t.pop(), l = o.key, u = o.eles[0], v = i.hasCache(u, o.level); + if (a[l] = null, v) + continue; + n.push(o); + var f = e.getBoundingBox(u); + e.getElement(u, f, r, o.level, Ht.dequeue); + } + return n; +}; +tr.removeFromQueue = function(r) { + var e = this, t = e.getElementQueue(), a = e.getElementKeyToQueue(), n = this.getKey(r), i = a[n]; + i != null && (i.eles.length === 1 ? (i.reqs = Xs, t.updateItem(i), t.pop(), a[n] = null) : i.eles.unmerge(r)); +}; +tr.onDequeue = function(r) { + this.onDequeues.push(r); +}; +tr.offDequeue = function(r) { + it(this.onDequeues, r); +}; +tr.setupDequeueing = pf.setupDequeueing({ + deqRedrawThreshold: ny, + deqCost: ey, + deqAvgCost: ry, + deqNoDrawCost: ty, + deqFastCost: ay, + deq: function(e, t, a) { + return e.dequeue(t, a); + }, + onDeqd: function(e, t) { + for (var a = 0; a < e.onDequeues.length; a++) { + var n = e.onDequeues[a]; + n(t); + } + }, + shouldRedraw: function(e, t, a, n) { + for (var i = 0; i < t.length; i++) + for (var s = t[i].eles, o = 0; o < s.length; o++) { + var l = s[o].boundingBox(); + if (eo(l, n)) + return !0; + } + return !1; + }, + priority: function(e) { + return e.renderer.beforeRenderPriorities.eleTxrDeq; + } +}); +var oy = 1, ma = -4, kn = 2, uy = 3.99, ly = 50, vy = 50, fy = 0.15, cy = 0.1, dy = 0.9, hy = 0.9, gy = 1, Ml = 250, py = 4e3 * 4e3, Ll = 32767, yy = !0, mf = function(e) { + var t = this, a = t.renderer = e, n = a.cy; + t.layersByLevel = {}, t.firstGet = !0, t.lastInvalidationTime = Yr() - 2 * Ml, t.skipping = !1, t.eleTxrDeqs = n.collection(), t.scheduleElementRefinement = Oa(function() { + t.refineElementTextures(t.eleTxrDeqs), t.eleTxrDeqs.unmerge(t.eleTxrDeqs); + }, vy), a.beforeRender(function(s, o) { + o - t.lastInvalidationTime <= Ml ? t.skipping = !0 : t.skipping = !1; + }, a.beforeRenderPriorities.lyrTxrSkip); + var i = function(o, l) { + return l.reqs - o.reqs; + }; + t.layersQueue = new Na(i), t.setupDequeueing(); +}, cr = mf.prototype, Il = 0, my = Math.pow(2, 53) - 1; +cr.makeLayer = function(r, e) { + var t = Math.pow(2, e), a = Math.ceil(r.w * t), n = Math.ceil(r.h * t), i = this.renderer.makeOffscreenCanvas(a, n), s = { + id: Il = ++Il % my, + bb: r, + level: e, + width: a, + height: n, + canvas: i, + context: i.getContext("2d"), + eles: [], + elesQueue: [], + reqs: 0 + }, o = s.context, l = -s.bb.x1, u = -s.bb.y1; + return o.scale(t, t), o.translate(l, u), s; +}; +cr.getLayers = function(r, e, t) { + var a = this, n = a.renderer, i = n.cy, s = i.zoom(), o = a.firstGet; + if (a.firstGet = !1, t == null) { + if (t = Math.ceil(Js(s * e)), t < ma) + t = ma; + else if (s >= uy || t > kn) + return null; + } + a.validateLayersElesOrdering(t, r); + var l = a.layersByLevel, u = Math.pow(2, t), v = l[t] = l[t] || [], f, c = a.levelIsComplete(t, r), h, d = function() { + var P = function(M) { + if (a.validateLayersElesOrdering(M, r), a.levelIsComplete(M, r)) + return h = l[M], !0; + }, D = function(M) { + if (!h) + for (var I = t + M; ma <= I && I <= kn && !P(I); I += M) + ; + }; + D(1), D(-1); + for (var A = v.length - 1; A >= 0; A--) { + var B = v[A]; + B.invalid && it(v, B); + } + }; + if (!c) + d(); + else + return v; + var y = function() { + if (!f) { + f = Sr(); + for (var P = 0; P < r.length; P++) + cv(f, r[P].boundingBox()); + } + return f; + }, g = function(P) { + P = P || {}; + var D = P.after; + y(); + var A = Math.ceil(f.w * u), B = Math.ceil(f.h * u); + if (A > Ll || B > Ll) + return null; + var R = A * B; + if (R > py) + return null; + var M = a.makeLayer(f, t); + if (D != null) { + var I = v.indexOf(D) + 1; + v.splice(I, 0, M); + } else (P.insert === void 0 || P.insert) && v.unshift(M); + return M; + }; + if (a.skipping && !o) + return null; + for (var p = null, m = r.length / oy, b = !o, w = 0; w < r.length; w++) { + var E = r[w], C = E._private.rscratch, x = C.imgLayerCaches = C.imgLayerCaches || {}, k = x[t]; + if (k) { + p = k; + continue; + } + if ((!p || p.eles.length >= m || !md(p.bb, E.boundingBox())) && (p = g({ + insert: !0, + after: p + }), !p)) + return null; + h || b ? a.queueLayer(p, E) : a.drawEleInLayer(p, E, t, e), p.eles.push(E), x[t] = p; + } + return h || (b ? null : v); +}; +cr.getEleLevelForLayerLevel = function(r, e) { + return r; +}; +cr.drawEleInLayer = function(r, e, t, a) { + var n = this, i = this.renderer, s = r.context, o = e.boundingBox(); + o.w === 0 || o.h === 0 || !e.visible() || (t = n.getEleLevelForLayerLevel(t, a), i.setImgSmoothing(s, !1), i.drawCachedElement(s, e, null, null, t, yy), i.setImgSmoothing(s, !0)); +}; +cr.levelIsComplete = function(r, e) { + var t = this, a = t.layersByLevel[r]; + if (!a || a.length === 0) + return !1; + for (var n = 0, i = 0; i < a.length; i++) { + var s = a[i]; + if (s.reqs > 0 || s.invalid) + return !1; + n += s.eles.length; + } + return n === e.length; +}; +cr.validateLayersElesOrdering = function(r, e) { + var t = this.layersByLevel[r]; + if (t) + for (var a = 0; a < t.length; a++) { + for (var n = t[a], i = -1, s = 0; s < e.length; s++) + if (n.eles[0] === e[s]) { + i = s; + break; + } + if (i < 0) { + this.invalidateLayer(n); + continue; + } + for (var o = i, s = 0; s < n.eles.length; s++) + if (n.eles[s] !== e[o + s]) { + this.invalidateLayer(n); + break; + } + } +}; +cr.updateElementsInLayers = function(r, e) { + for (var t = this, a = Ra(r[0]), n = 0; n < r.length; n++) + for (var i = a ? null : r[n], s = a ? r[n] : r[n].ele, o = s._private.rscratch, l = o.imgLayerCaches = o.imgLayerCaches || {}, u = ma; u <= kn; u++) { + var v = l[u]; + v && (i && t.getEleLevelForLayerLevel(v.level) !== i.level || e(v, s, i)); + } +}; +cr.haveLayers = function() { + for (var r = this, e = !1, t = ma; t <= kn; t++) { + var a = r.layersByLevel[t]; + if (a && a.length > 0) { + e = !0; + break; + } + } + return e; +}; +cr.invalidateElements = function(r) { + var e = this; + r.length !== 0 && (e.lastInvalidationTime = Yr(), !(r.length === 0 || !e.haveLayers()) && e.updateElementsInLayers(r, function(a, n, i) { + e.invalidateLayer(a); + })); +}; +cr.invalidateLayer = function(r) { + if (this.lastInvalidationTime = Yr(), !r.invalid) { + var e = r.level, t = r.eles, a = this.layersByLevel[e]; + it(a, r), r.elesQueue = [], r.invalid = !0, r.replacement && (r.replacement.invalid = !0); + for (var n = 0; n < t.length; n++) { + var i = t[n]._private.rscratch.imgLayerCaches; + i && (i[e] = null); + } + } +}; +cr.refineElementTextures = function(r) { + var e = this; + e.updateElementsInLayers(r, function(a, n, i) { + var s = a.replacement; + if (s || (s = a.replacement = e.makeLayer(a.bb, a.level), s.replaces = a, s.eles = a.eles), !s.reqs) + for (var o = 0; o < s.eles.length; o++) + e.queueLayer(s, s.eles[o]); + }); +}; +cr.enqueueElementRefinement = function(r) { + this.eleTxrDeqs.merge(r), this.scheduleElementRefinement(); +}; +cr.queueLayer = function(r, e) { + var t = this, a = t.layersQueue, n = r.elesQueue, i = n.hasId = n.hasId || {}; + if (!r.replacement) { + if (e) { + if (i[e.id()]) + return; + n.push(e), i[e.id()] = !0; + } + r.reqs ? (r.reqs++, a.updateItem(r)) : (r.reqs = 1, a.push(r)); + } +}; +cr.dequeue = function(r) { + for (var e = this, t = e.layersQueue, a = [], n = 0; n < gy && t.size() !== 0; ) { + var i = t.peek(); + if (i.replacement) { + t.pop(); + continue; + } + if (i.replaces && i !== i.replaces.replacement) { + t.pop(); + continue; + } + if (i.invalid) { + t.pop(); + continue; + } + var s = i.elesQueue.shift(); + s && (e.drawEleInLayer(i, s, i.level, r), n++), a.length === 0 && a.push(!0), i.elesQueue.length === 0 && (t.pop(), i.reqs = 0, i.replaces && e.applyLayerReplacement(i), e.requestRedraw()); + } + return a; +}; +cr.applyLayerReplacement = function(r) { + var e = this, t = e.layersByLevel[r.level], a = r.replaces, n = t.indexOf(a); + if (!(n < 0 || a.invalid)) { + t[n] = r; + for (var i = 0; i < r.eles.length; i++) { + var s = r.eles[i]._private, o = s.imgLayerCaches = s.imgLayerCaches || {}; + o && (o[r.level] = r); + } + e.requestRedraw(); + } +}; +cr.requestRedraw = Oa(function() { + var r = this.renderer; + r.redrawHint("eles", !0), r.redrawHint("drag", !0), r.redraw(); +}, 100); +cr.setupDequeueing = pf.setupDequeueing({ + deqRedrawThreshold: ly, + deqCost: fy, + deqAvgCost: cy, + deqNoDrawCost: dy, + deqFastCost: hy, + deq: function(e, t) { + return e.dequeue(t); + }, + onDeqd: Zs, + shouldRedraw: ov, + priority: function(e) { + return e.renderer.beforeRenderPriorities.lyrTxrDeq; + } +}); +var bf = {}, Ol; +function by(r, e) { + for (var t = 0; t < e.length; t++) { + var a = e[t]; + r.lineTo(a.x, a.y); + } +} +function wy(r, e, t) { + for (var a, n = 0; n < e.length; n++) { + var i = e[n]; + n === 0 && (a = i), r.lineTo(i.x, i.y); + } + r.quadraticCurveTo(t.x, t.y, a.x, a.y); +} +function Nl(r, e, t) { + r.beginPath && r.beginPath(); + for (var a = e, n = 0; n < a.length; n++) { + var i = a[n]; + r.lineTo(i.x, i.y); + } + var s = t, o = t[0]; + r.moveTo(o.x, o.y); + for (var n = 1; n < s.length; n++) { + var i = s[n]; + r.lineTo(i.x, i.y); + } + r.closePath && r.closePath(); +} +function xy(r, e, t, a, n) { + r.beginPath && r.beginPath(), r.arc(t, a, n, 0, Math.PI * 2, !1); + var i = e, s = i[0]; + r.moveTo(s.x, s.y); + for (var o = 0; o < i.length; o++) { + var l = i[o]; + r.lineTo(l.x, l.y); + } + r.closePath && r.closePath(); +} +function Ey(r, e, t, a) { + r.arc(e, t, a, 0, Math.PI * 2, !1); +} +bf.arrowShapeImpl = function(r) { + return (Ol || (Ol = { + polygon: by, + "triangle-backcurve": wy, + "triangle-tee": Nl, + "circle-triangle": xy, + "triangle-cross": Nl, + circle: Ey + }))[r]; +}; +var Hr = {}; +Hr.drawElement = function(r, e, t, a, n, i) { + var s = this; + e.isNode() ? s.drawNode(r, e, t, a, n, i) : s.drawEdge(r, e, t, a, n, i); +}; +Hr.drawElementOverlay = function(r, e) { + var t = this; + e.isNode() ? t.drawNodeOverlay(r, e) : t.drawEdgeOverlay(r, e); +}; +Hr.drawElementUnderlay = function(r, e) { + var t = this; + e.isNode() ? t.drawNodeUnderlay(r, e) : t.drawEdgeUnderlay(r, e); +}; +Hr.drawCachedElementPortion = function(r, e, t, a, n, i, s, o) { + var l = this, u = t.getBoundingBox(e); + if (!(u.w === 0 || u.h === 0)) { + var v = t.getElement(e, u, a, n, i); + if (v != null) { + var f = o(l, e); + if (f === 0) + return; + var c = s(l, e), h = u.x1, d = u.y1, y = u.w, g = u.h, p, m, b, w, E; + if (c !== 0) { + var C = t.getRotationPoint(e); + b = C.x, w = C.y, r.translate(b, w), r.rotate(c), E = l.getImgSmoothing(r), E || l.setImgSmoothing(r, !0); + var x = t.getRotationOffset(e); + p = x.x, m = x.y; + } else + p = h, m = d; + var k; + f !== 1 && (k = r.globalAlpha, r.globalAlpha = k * f), r.drawImage(v.texture.canvas, v.x, 0, v.width, v.height, p, m, y, g), f !== 1 && (r.globalAlpha = k), c !== 0 && (r.rotate(-c), r.translate(-b, -w), E || l.setImgSmoothing(r, !1)); + } else + t.drawElement(r, e); + } +}; +var Cy = function() { + return 0; +}, Ty = function(e, t) { + return e.getTextAngle(t, null); +}, Sy = function(e, t) { + return e.getTextAngle(t, "source"); +}, Dy = function(e, t) { + return e.getTextAngle(t, "target"); +}, ky = function(e, t) { + return t.effectiveOpacity(); +}, ys = function(e, t) { + return t.pstyle("text-opacity").pfValue * t.effectiveOpacity(); +}; +Hr.drawCachedElement = function(r, e, t, a, n, i) { + var s = this, o = s.data, l = o.eleTxrCache, u = o.lblTxrCache, v = o.slbTxrCache, f = o.tlbTxrCache, c = e.boundingBox(), h = i === !0 ? l.reasons.highQuality : null; + if (!(c.w === 0 || c.h === 0 || !e.visible()) && (!a || eo(c, a))) { + var d = e.isEdge(), y = e.element()._private.rscratch.badLine; + s.drawElementUnderlay(r, e), s.drawCachedElementPortion(r, e, l, t, n, h, Cy, ky), (!d || !y) && s.drawCachedElementPortion(r, e, u, t, n, h, Ty, ys), d && !y && (s.drawCachedElementPortion(r, e, v, t, n, h, Sy, ys), s.drawCachedElementPortion(r, e, f, t, n, h, Dy, ys)), s.drawElementOverlay(r, e); + } +}; +Hr.drawElements = function(r, e) { + for (var t = this, a = 0; a < e.length; a++) { + var n = e[a]; + t.drawElement(r, n); + } +}; +Hr.drawCachedElements = function(r, e, t, a) { + for (var n = this, i = 0; i < e.length; i++) { + var s = e[i]; + n.drawCachedElement(r, s, t, a); + } +}; +Hr.drawCachedNodes = function(r, e, t, a) { + for (var n = this, i = 0; i < e.length; i++) { + var s = e[i]; + s.isNode() && n.drawCachedElement(r, s, t, a); + } +}; +Hr.drawLayeredElements = function(r, e, t, a) { + var n = this, i = n.data.lyrTxrCache.getLayers(e, t); + if (i) + for (var s = 0; s < i.length; s++) { + var o = i[s], l = o.bb; + l.w === 0 || l.h === 0 || r.drawImage(o.canvas, l.x1, l.y1, l.w, l.h); + } + else + n.drawCachedElements(r, e, t, a); +}; +var Qr = {}; +Qr.drawEdge = function(r, e, t) { + var a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this, o = e._private.rscratch; + if (!(i && !e.visible()) && !(o.badLine || o.allpts == null || isNaN(o.allpts[0]))) { + var l; + t && (l = t, r.translate(-l.x1, -l.y1)); + var u = i ? e.pstyle("opacity").value : 1, v = i ? e.pstyle("line-opacity").value : 1, f = e.pstyle("curve-style").value, c = e.pstyle("line-style").value, h = e.pstyle("width").pfValue, d = e.pstyle("line-cap").value, y = e.pstyle("line-outline-width").value, g = e.pstyle("line-outline-color").value, p = u * v, m = u * v, b = function() { + var M = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : p; + f === "straight-triangle" ? (s.eleStrokeStyle(r, e, M), s.drawEdgeTrianglePath(e, r, o.allpts)) : (r.lineWidth = h, r.lineCap = d, s.eleStrokeStyle(r, e, M), s.drawEdgePath(e, r, o.allpts, c), r.lineCap = "butt"); + }, w = function() { + var M = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : p; + if (r.lineWidth = h + y, r.lineCap = d, y > 0) + s.colorStrokeStyle(r, g[0], g[1], g[2], M); + else { + r.lineCap = "butt"; + return; + } + f === "straight-triangle" ? s.drawEdgeTrianglePath(e, r, o.allpts) : (s.drawEdgePath(e, r, o.allpts, c), r.lineCap = "butt"); + }, E = function() { + n && s.drawEdgeOverlay(r, e); + }, C = function() { + n && s.drawEdgeUnderlay(r, e); + }, x = function() { + var M = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : m; + s.drawArrowheads(r, e, M); + }, k = function() { + s.drawElementText(r, e, null, a); + }; + r.lineJoin = "round"; + var S = e.pstyle("ghost").value === "yes"; + if (S) { + var P = e.pstyle("ghost-offset-x").pfValue, D = e.pstyle("ghost-offset-y").pfValue, A = e.pstyle("ghost-opacity").value, B = p * A; + r.translate(P, D), b(B), x(B), r.translate(-P, -D); + } else + w(); + C(), b(), x(), E(), k(), t && r.translate(l.x1, l.y1); + } +}; +var wf = function(e) { + if (!["overlay", "underlay"].includes(e)) + throw new Error("Invalid state"); + return function(t, a) { + if (a.visible()) { + var n = a.pstyle("".concat(e, "-opacity")).value; + if (n !== 0) { + var i = this, s = i.usePaths(), o = a._private.rscratch, l = a.pstyle("".concat(e, "-padding")).pfValue, u = 2 * l, v = a.pstyle("".concat(e, "-color")).value; + t.lineWidth = u, o.edgeType === "self" && !s ? t.lineCap = "butt" : t.lineCap = "round", i.colorStrokeStyle(t, v[0], v[1], v[2], n), i.drawEdgePath(a, t, o.allpts, "solid"); + } + } + }; +}; +Qr.drawEdgeOverlay = wf("overlay"); +Qr.drawEdgeUnderlay = wf("underlay"); +Qr.drawEdgePath = function(r, e, t, a) { + var n = r._private.rscratch, i = e, s, o = !1, l = this.usePaths(), u = r.pstyle("line-dash-pattern").pfValue, v = r.pstyle("line-dash-offset").pfValue; + if (l) { + var f = t.join("$"), c = n.pathCacheKey && n.pathCacheKey === f; + c ? (s = e = n.pathCache, o = !0) : (s = e = new Path2D(), n.pathCacheKey = f, n.pathCache = s); + } + if (i.setLineDash) + switch (a) { + case "dotted": + i.setLineDash([1, 1]); + break; + case "dashed": + i.setLineDash(u), i.lineDashOffset = v; + break; + case "solid": + i.setLineDash([]); + break; + } + if (!o && !n.badLine) + switch (e.beginPath && e.beginPath(), e.moveTo(t[0], t[1]), n.edgeType) { + case "bezier": + case "self": + case "compound": + case "multibezier": + for (var h = 2; h + 3 < t.length; h += 4) + e.quadraticCurveTo(t[h], t[h + 1], t[h + 2], t[h + 3]); + break; + case "straight": + case "haystack": + for (var d = 2; d + 1 < t.length; d += 2) + e.lineTo(t[d], t[d + 1]); + break; + case "segments": + if (n.isRound) { + var y = Tr(n.roundCorners), g; + try { + for (y.s(); !(g = y.n()).done; ) { + var p = g.value; + uf(e, p); + } + } catch (b) { + y.e(b); + } finally { + y.f(); + } + e.lineTo(t[t.length - 2], t[t.length - 1]); + } else + for (var m = 2; m + 1 < t.length; m += 2) + e.lineTo(t[m], t[m + 1]); + break; + } + e = i, l ? e.stroke(s) : e.stroke(), e.setLineDash && e.setLineDash([]); +}; +Qr.drawEdgeTrianglePath = function(r, e, t) { + e.fillStyle = e.strokeStyle; + for (var a = r.pstyle("width").pfValue, n = 0; n + 1 < t.length; n += 2) { + var i = [t[n + 2] - t[n], t[n + 3] - t[n + 1]], s = Math.sqrt(i[0] * i[0] + i[1] * i[1]), o = [i[1] / s, -i[0] / s], l = [o[0] * a / 2, o[1] * a / 2]; + e.beginPath(), e.moveTo(t[n] - l[0], t[n + 1] - l[1]), e.lineTo(t[n] + l[0], t[n + 1] + l[1]), e.lineTo(t[n + 2], t[n + 3]), e.closePath(), e.fill(); + } +}; +Qr.drawArrowheads = function(r, e, t) { + var a = e._private.rscratch, n = a.edgeType === "haystack"; + n || this.drawArrowhead(r, e, "source", a.arrowStartX, a.arrowStartY, a.srcArrowAngle, t), this.drawArrowhead(r, e, "mid-target", a.midX, a.midY, a.midtgtArrowAngle, t), this.drawArrowhead(r, e, "mid-source", a.midX, a.midY, a.midsrcArrowAngle, t), n || this.drawArrowhead(r, e, "target", a.arrowEndX, a.arrowEndY, a.tgtArrowAngle, t); +}; +Qr.drawArrowhead = function(r, e, t, a, n, i, s) { + if (!(isNaN(a) || a == null || isNaN(n) || n == null || isNaN(i) || i == null)) { + var o = this, l = e.pstyle(t + "-arrow-shape").value; + if (l !== "none") { + var u = e.pstyle(t + "-arrow-fill").value === "hollow" ? "both" : "filled", v = e.pstyle(t + "-arrow-fill").value, f = e.pstyle("width").pfValue, c = e.pstyle(t + "-arrow-width"), h = c.value === "match-line" ? f : c.pfValue; + c.units === "%" && (h *= f); + var d = e.pstyle("opacity").value; + s === void 0 && (s = d); + var y = r.globalCompositeOperation; + (s !== 1 || v === "hollow") && (r.globalCompositeOperation = "destination-out", o.colorFillStyle(r, 255, 255, 255, 1), o.colorStrokeStyle(r, 255, 255, 255, 1), o.drawArrowShape(e, r, u, f, l, h, a, n, i), r.globalCompositeOperation = y); + var g = e.pstyle(t + "-arrow-color").value; + o.colorFillStyle(r, g[0], g[1], g[2], s), o.colorStrokeStyle(r, g[0], g[1], g[2], s), o.drawArrowShape(e, r, v, f, l, h, a, n, i); + } + } +}; +Qr.drawArrowShape = function(r, e, t, a, n, i, s, o, l) { + var u = this, v = this.usePaths() && n !== "triangle-cross", f = !1, c, h = e, d = { + x: s, + y: o + }, y = r.pstyle("arrow-scale").value, g = this.getArrowWidth(a, y), p = u.arrowShapes[n]; + if (v) { + var m = u.arrowPathCache = u.arrowPathCache || [], b = Tt(n), w = m[b]; + w != null ? (c = e = w, f = !0) : (c = e = new Path2D(), m[b] = c); + } + f || (e.beginPath && e.beginPath(), v ? p.draw(e, 1, 0, { + x: 0, + y: 0 + }, 1) : p.draw(e, g, l, d, a), e.closePath && e.closePath()), e = h, v && (e.translate(s, o), e.rotate(l), e.scale(g, g)), (t === "filled" || t === "both") && (v ? e.fill(c) : e.fill()), (t === "hollow" || t === "both") && (e.lineWidth = i / (v ? g : 1), e.lineJoin = "miter", v ? e.stroke(c) : e.stroke()), v && (e.scale(1 / g, 1 / g), e.rotate(-l), e.translate(-s, -o)); +}; +var go = {}; +go.safeDrawImage = function(r, e, t, a, n, i, s, o, l, u) { + if (!(n <= 0 || i <= 0 || l <= 0 || u <= 0)) + try { + r.drawImage(e, t, a, n, i, s, o, l, u); + } catch (v) { + Le(v); + } +}; +go.drawInscribedImage = function(r, e, t, a, n) { + var i = this, s = t.position(), o = s.x, l = s.y, u = t.cy().style(), v = u.getIndexedStyle.bind(u), f = v(t, "background-fit", "value", a), c = v(t, "background-repeat", "value", a), h = t.width(), d = t.height(), y = t.padding() * 2, g = h + (v(t, "background-width-relative-to", "value", a) === "inner" ? 0 : y), p = d + (v(t, "background-height-relative-to", "value", a) === "inner" ? 0 : y), m = t._private.rscratch, b = v(t, "background-clip", "value", a), w = b === "node", E = v(t, "background-image-opacity", "value", a) * n, C = v(t, "background-image-smoothing", "value", a), x = t.pstyle("corner-radius").value; + x !== "auto" && (x = t.pstyle("corner-radius").pfValue); + var k = e.width || e.cachedW, S = e.height || e.cachedH; + (k == null || S == null) && (document.body.appendChild(e), k = e.cachedW = e.width || e.offsetWidth, S = e.cachedH = e.height || e.offsetHeight, document.body.removeChild(e)); + var P = k, D = S; + if (v(t, "background-width", "value", a) !== "auto" && (v(t, "background-width", "units", a) === "%" ? P = v(t, "background-width", "pfValue", a) * g : P = v(t, "background-width", "pfValue", a)), v(t, "background-height", "value", a) !== "auto" && (v(t, "background-height", "units", a) === "%" ? D = v(t, "background-height", "pfValue", a) * p : D = v(t, "background-height", "pfValue", a)), !(P === 0 || D === 0)) { + if (f === "contain") { + var A = Math.min(g / P, p / D); + P *= A, D *= A; + } else if (f === "cover") { + var A = Math.max(g / P, p / D); + P *= A, D *= A; + } + var B = o - g / 2, R = v(t, "background-position-x", "units", a), M = v(t, "background-position-x", "pfValue", a); + R === "%" ? B += (g - P) * M : B += M; + var I = v(t, "background-offset-x", "units", a), L = v(t, "background-offset-x", "pfValue", a); + I === "%" ? B += (g - P) * L : B += L; + var O = l - p / 2, V = v(t, "background-position-y", "units", a), G = v(t, "background-position-y", "pfValue", a); + V === "%" ? O += (p - D) * G : O += G; + var N = v(t, "background-offset-y", "units", a), F = v(t, "background-offset-y", "pfValue", a); + N === "%" ? O += (p - D) * F : O += F, m.pathCache && (B -= o, O -= l, o = 0, l = 0); + var K = r.globalAlpha; + r.globalAlpha = E; + var X = i.getImgSmoothing(r), Q = !1; + if (C === "no" && X ? (i.setImgSmoothing(r, !1), Q = !0) : C === "yes" && !X && (i.setImgSmoothing(r, !0), Q = !0), c === "no-repeat") + w && (r.save(), m.pathCache ? r.clip(m.pathCache) : (i.nodeShapes[i.getNodeShape(t)].draw(r, o, l, g, p, x, m), r.clip())), i.safeDrawImage(r, e, 0, 0, k, S, B, O, P, D), w && r.restore(); + else { + var Z = r.createPattern(e, c); + r.fillStyle = Z, i.nodeShapes[i.getNodeShape(t)].draw(r, o, l, g, p, x, m), r.translate(B, O), r.fill(), r.translate(-B, -O); + } + r.globalAlpha = K, Q && i.setImgSmoothing(r, X); + } +}; +var At = {}; +At.eleTextBiggerThanMin = function(r, e) { + if (!e) { + var t = r.cy().zoom(), a = this.getPixelRatio(), n = Math.ceil(Js(t * a)); + e = Math.pow(2, n); + } + var i = r.pstyle("font-size").pfValue * e, s = r.pstyle("min-zoomed-font-size").pfValue; + return !(i < s); +}; +At.drawElementText = function(r, e, t, a, n) { + var i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this; + if (a == null) { + if (i && !s.eleTextBiggerThanMin(e)) + return; + } else if (a === !1) + return; + if (e.isNode()) { + var o = e.pstyle("label"); + if (!o || !o.value) + return; + var l = s.getLabelJustification(e); + r.textAlign = l, r.textBaseline = "bottom"; + } else { + var u = e.element()._private.rscratch.badLine, v = e.pstyle("label"), f = e.pstyle("source-label"), c = e.pstyle("target-label"); + if (u || (!v || !v.value) && (!f || !f.value) && (!c || !c.value)) + return; + r.textAlign = "center", r.textBaseline = "bottom"; + } + var h = !t, d; + t && (d = t, r.translate(-d.x1, -d.y1)), n == null ? (s.drawText(r, e, null, h, i), e.isEdge() && (s.drawText(r, e, "source", h, i), s.drawText(r, e, "target", h, i))) : s.drawText(r, e, n, h, i), t && r.translate(d.x1, d.y1); +}; +At.getFontCache = function(r) { + var e; + this.fontCaches = this.fontCaches || []; + for (var t = 0; t < this.fontCaches.length; t++) + if (e = this.fontCaches[t], e.context === r) + return e; + return e = { + context: r + }, this.fontCaches.push(e), e; +}; +At.setupTextStyle = function(r, e) { + var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !0, a = e.pstyle("font-style").strValue, n = e.pstyle("font-size").pfValue + "px", i = e.pstyle("font-family").strValue, s = e.pstyle("font-weight").strValue, o = t ? e.effectiveOpacity() * e.pstyle("text-opacity").value : 1, l = e.pstyle("text-outline-opacity").value * o, u = e.pstyle("color").value, v = e.pstyle("text-outline-color").value; + r.font = a + " " + s + " " + n + " " + i, r.lineJoin = "round", this.colorFillStyle(r, u[0], u[1], u[2], o), this.colorStrokeStyle(r, v[0], v[1], v[2], l); +}; +function ms(r, e, t, a, n) { + var i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : 5, s = arguments.length > 6 ? arguments[6] : void 0; + r.beginPath(), r.moveTo(e + i, t), r.lineTo(e + a - i, t), r.quadraticCurveTo(e + a, t, e + a, t + i), r.lineTo(e + a, t + n - i), r.quadraticCurveTo(e + a, t + n, e + a - i, t + n), r.lineTo(e + i, t + n), r.quadraticCurveTo(e, t + n, e, t + n - i), r.lineTo(e, t + i), r.quadraticCurveTo(e, t, e + i, t), r.closePath(), s ? r.stroke() : r.fill(); +} +At.getTextAngle = function(r, e) { + var t, a = r._private, n = a.rscratch, i = e ? e + "-" : "", s = r.pstyle(i + "text-rotation"); + if (s.strValue === "autorotate") { + var o = Er(n, "labelAngle", e); + t = r.isEdge() ? o : 0; + } else s.strValue === "none" ? t = 0 : t = s.pfValue; + return t; +}; +At.drawText = function(r, e, t) { + var a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = e._private, s = i.rscratch, o = n ? e.effectiveOpacity() : 1; + if (!(n && (o === 0 || e.pstyle("text-opacity").value === 0))) { + t === "main" && (t = null); + var l = Er(s, "labelX", t), u = Er(s, "labelY", t), v, f, c = this.getLabelText(e, t); + if (c != null && c !== "" && !isNaN(l) && !isNaN(u)) { + this.setupTextStyle(r, e, n); + var h = t ? t + "-" : "", d = Er(s, "labelWidth", t), y = Er(s, "labelHeight", t), g = e.pstyle(h + "text-margin-x").pfValue, p = e.pstyle(h + "text-margin-y").pfValue, m = e.isEdge(), b = e.pstyle("text-halign").value, w = e.pstyle("text-valign").value; + m && (b = "center", w = "center"), l += g, u += p; + var E; + switch (a ? E = this.getTextAngle(e, t) : E = 0, E !== 0 && (v = l, f = u, r.translate(v, f), r.rotate(E), l = 0, u = 0), w) { + case "top": + break; + case "center": + u += y / 2; + break; + case "bottom": + u += y; + break; + } + var C = e.pstyle("text-background-opacity").value, x = e.pstyle("text-border-opacity").value, k = e.pstyle("text-border-width").pfValue, S = e.pstyle("text-background-padding").pfValue, P = e.pstyle("text-background-shape").strValue, D = P.indexOf("round") === 0, A = 2; + if (C > 0 || k > 0 && x > 0) { + var B = l - S; + switch (b) { + case "left": + B -= d; + break; + case "center": + B -= d / 2; + break; + } + var R = u - y - S, M = d + 2 * S, I = y + 2 * S; + if (C > 0) { + var L = r.fillStyle, O = e.pstyle("text-background-color").value; + r.fillStyle = "rgba(" + O[0] + "," + O[1] + "," + O[2] + "," + C * o + ")", D ? ms(r, B, R, M, I, A) : r.fillRect(B, R, M, I), r.fillStyle = L; + } + if (k > 0 && x > 0) { + var V = r.strokeStyle, G = r.lineWidth, N = e.pstyle("text-border-color").value, F = e.pstyle("text-border-style").value; + if (r.strokeStyle = "rgba(" + N[0] + "," + N[1] + "," + N[2] + "," + x * o + ")", r.lineWidth = k, r.setLineDash) + switch (F) { + case "dotted": + r.setLineDash([1, 1]); + break; + case "dashed": + r.setLineDash([4, 2]); + break; + case "double": + r.lineWidth = k / 4, r.setLineDash([]); + break; + case "solid": + r.setLineDash([]); + break; + } + if (D ? ms(r, B, R, M, I, A, "stroke") : r.strokeRect(B, R, M, I), F === "double") { + var K = k / 2; + D ? ms(r, B + K, R + K, M - K * 2, I - K * 2, A, "stroke") : r.strokeRect(B + K, R + K, M - K * 2, I - K * 2); + } + r.setLineDash && r.setLineDash([]), r.lineWidth = G, r.strokeStyle = V; + } + } + var X = 2 * e.pstyle("text-outline-width").pfValue; + if (X > 0 && (r.lineWidth = X), e.pstyle("text-wrap").value === "wrap") { + var Q = Er(s, "labelWrapCachedLines", t), Z = Er(s, "labelLineHeight", t), re = d / 2, ae = this.getLabelJustification(e); + switch (ae === "auto" || (b === "left" ? ae === "left" ? l += -d : ae === "center" && (l += -re) : b === "center" ? ae === "left" ? l += -re : ae === "right" && (l += re) : b === "right" && (ae === "center" ? l += re : ae === "right" && (l += d))), w) { + case "top": + u -= (Q.length - 1) * Z; + break; + case "center": + case "bottom": + u -= (Q.length - 1) * Z; + break; + } + for (var J = 0; J < Q.length; J++) + X > 0 && r.strokeText(Q[J], l, u), r.fillText(Q[J], l, u), u += Z; + } else + X > 0 && r.strokeText(c, l, u), r.fillText(c, l, u); + E !== 0 && (r.rotate(-E), r.translate(-v, -f)); + } + } +}; +var dt = {}; +dt.drawNode = function(r, e, t) { + var a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !0, n = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, i = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : !0, s = this, o, l, u = e._private, v = u.rscratch, f = e.position(); + if (!(!te(f.x) || !te(f.y)) && !(i && !e.visible())) { + var c = i ? e.effectiveOpacity() : 1, h = s.usePaths(), d, y = !1, g = e.padding(); + o = e.width() + 2 * g, l = e.height() + 2 * g; + var p; + t && (p = t, r.translate(-p.x1, -p.y1)); + for (var m = e.pstyle("background-image"), b = m.value, w = new Array(b.length), E = new Array(b.length), C = 0, x = 0; x < b.length; x++) { + var k = b[x], S = w[x] = k != null && k !== "none"; + if (S) { + var P = e.cy().style().getIndexedStyle(e, "background-image-crossorigin", "value", x); + C++, E[x] = s.getCachedImage(k, P, function() { + u.backgroundTimestamp = Date.now(), e.emitAndNotify("background"); + }); + } + } + var D = e.pstyle("background-blacken").value, A = e.pstyle("border-width").pfValue, B = e.pstyle("background-opacity").value * c, R = e.pstyle("border-color").value, M = e.pstyle("border-style").value, I = e.pstyle("border-join").value, L = e.pstyle("border-cap").value, O = e.pstyle("border-position").value, V = e.pstyle("border-dash-pattern").pfValue, G = e.pstyle("border-dash-offset").pfValue, N = e.pstyle("border-opacity").value * c, F = e.pstyle("outline-width").pfValue, K = e.pstyle("outline-color").value, X = e.pstyle("outline-style").value, Q = e.pstyle("outline-opacity").value * c, Z = e.pstyle("outline-offset").value, re = e.pstyle("corner-radius").value; + re !== "auto" && (re = e.pstyle("corner-radius").pfValue); + var ae = function() { + var le = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : B; + s.eleFillStyle(r, e, le); + }, J = function() { + var le = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : N; + s.colorStrokeStyle(r, R[0], R[1], R[2], le); + }, z = function() { + var le = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : Q; + s.colorStrokeStyle(r, K[0], K[1], K[2], le); + }, q = function(le, Y, T, _) { + var W = s.nodePathCache = s.nodePathCache || [], U = sv(T === "polygon" ? T + "," + _.join(",") : T, "" + Y, "" + le, "" + re), $ = W[U], ue, j = !1; + return $ != null ? (ue = $, j = !0, v.pathCache = ue) : (ue = new Path2D(), W[U] = v.pathCache = ue), { + path: ue, + cacheHit: j + }; + }, H = e.pstyle("shape").strValue, ee = e.pstyle("shape-polygon-points").pfValue; + if (h) { + r.translate(f.x, f.y); + var ne = q(o, l, H, ee); + d = ne.path, y = ne.cacheHit; + } + var be = function() { + if (!y) { + var le = f; + h && (le = { + x: 0, + y: 0 + }), s.nodeShapes[s.getNodeShape(e)].draw(d || r, le.x, le.y, o, l, re, v); + } + h ? r.fill(d) : r.fill(); + }, _e = function() { + for (var le = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : c, Y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !0, T = u.backgrounding, _ = 0, W = 0; W < E.length; W++) { + var U = e.cy().style().getIndexedStyle(e, "background-image-containment", "value", W); + if (Y && U === "over" || !Y && U === "inside") { + _++; + continue; + } + w[W] && E[W].complete && !E[W].error && (_++, s.drawInscribedImage(r, E[W], e, W, le)); + } + u.backgrounding = _ !== C, T !== u.backgrounding && e.updateStyle(!1); + }, Ie = function() { + var le = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, Y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : c; + s.hasPie(e) && (s.drawPie(r, e, Y), le && (h || s.nodeShapes[s.getNodeShape(e)].draw(r, f.x, f.y, o, l, re, v))); + }, se = function() { + var le = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : !1, Y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : c; + s.hasStripe(e) && (r.save(), h ? r.clip(v.pathCache) : (s.nodeShapes[s.getNodeShape(e)].draw(r, f.x, f.y, o, l, re, v), r.clip()), s.drawStripe(r, e, Y), r.restore(), le && (h || s.nodeShapes[s.getNodeShape(e)].draw(r, f.x, f.y, o, l, re, v))); + }, oe = function() { + var le = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : c, Y = (D > 0 ? D : -D) * le, T = D > 0 ? 0 : 255; + D !== 0 && (s.colorFillStyle(r, T, T, T, Y), h ? r.fill(d) : r.fill()); + }, ce = function() { + if (A > 0) { + if (r.lineWidth = A, r.lineCap = L, r.lineJoin = I, r.setLineDash) + switch (M) { + case "dotted": + r.setLineDash([1, 1]); + break; + case "dashed": + r.setLineDash(V), r.lineDashOffset = G; + break; + case "solid": + case "double": + r.setLineDash([]); + break; + } + if (O !== "center") { + if (r.save(), r.lineWidth *= 2, O === "inside") + h ? r.clip(d) : r.clip(); + else { + var le = new Path2D(); + le.rect(-o / 2 - A, -l / 2 - A, o + 2 * A, l + 2 * A), le.addPath(d), r.clip(le, "evenodd"); + } + h ? r.stroke(d) : r.stroke(), r.restore(); + } else + h ? r.stroke(d) : r.stroke(); + if (M === "double") { + r.lineWidth = A / 3; + var Y = r.globalCompositeOperation; + r.globalCompositeOperation = "destination-out", h ? r.stroke(d) : r.stroke(), r.globalCompositeOperation = Y; + } + r.setLineDash && r.setLineDash([]); + } + }, ge = function() { + if (F > 0) { + if (r.lineWidth = F, r.lineCap = "butt", r.setLineDash) + switch (X) { + case "dotted": + r.setLineDash([1, 1]); + break; + case "dashed": + r.setLineDash([4, 2]); + break; + case "solid": + case "double": + r.setLineDash([]); + break; + } + var le = f; + h && (le = { + x: 0, + y: 0 + }); + var Y = s.getNodeShape(e), T = A; + O === "inside" && (T = 0), O === "outside" && (T *= 2); + var _ = (o + T + (F + Z)) / o, W = (l + T + (F + Z)) / l, U = o * _, $ = l * W, ue = s.nodeShapes[Y].points, j; + if (h) { + var ve = q(U, $, Y, ue); + j = ve.path; + } + if (Y === "ellipse") + s.drawEllipsePath(j || r, le.x, le.y, U, $); + else if (["round-diamond", "round-heptagon", "round-hexagon", "round-octagon", "round-pentagon", "round-polygon", "round-triangle", "round-tag"].includes(Y)) { + var Ee = 0, Se = 0, pe = 0; + Y === "round-diamond" ? Ee = (T + Z + F) * 1.4 : Y === "round-heptagon" ? (Ee = (T + Z + F) * 1.075, pe = -(T / 2 + Z + F) / 35) : Y === "round-hexagon" ? Ee = (T + Z + F) * 1.12 : Y === "round-pentagon" ? (Ee = (T + Z + F) * 1.13, pe = -(T / 2 + Z + F) / 15) : Y === "round-tag" ? (Ee = (T + Z + F) * 1.12, Se = (T / 2 + F + Z) * 0.07) : Y === "round-triangle" && (Ee = (T + Z + F) * (Math.PI / 2), pe = -(T + Z / 2 + F) / Math.PI), Ee !== 0 && (_ = (o + Ee) / o, U = o * _, ["round-hexagon", "round-tag"].includes(Y) || (W = (l + Ee) / l, $ = l * W)), re = re === "auto" ? gv(U, $) : re; + for (var Ce = U / 2, me = $ / 2, xe = re + (T + F + Z) / 2, Oe = new Array(ue.length / 2), Xe = new Array(ue.length / 2), or = 0; or < ue.length / 2; or++) + Oe[or] = { + x: le.x + Se + Ce * ue[or * 2], + y: le.y + pe + me * ue[or * 2 + 1] + }; + var ar, Ke, ur, Qe, br = Oe.length; + for (Ke = Oe[br - 1], ar = 0; ar < br; ar++) + ur = Oe[ar % br], Qe = Oe[(ar + 1) % br], Xe[ar] = co(Ke, ur, Qe, xe), Ke = ur, ur = Qe; + s.drawRoundPolygonPath(j || r, le.x + Se, le.y + pe, o * _, l * W, ue, Xe); + } else if (["roundrectangle", "round-rectangle"].includes(Y)) + re = re === "auto" ? st(U, $) : re, s.drawRoundRectanglePath(j || r, le.x, le.y, U, $, re + (T + F + Z) / 2); + else if (["cutrectangle", "cut-rectangle"].includes(Y)) + re = re === "auto" ? ro() : re, s.drawCutRectanglePath(j || r, le.x, le.y, U, $, null, re + (T + F + Z) / 4); + else if (["bottomroundrectangle", "bottom-round-rectangle"].includes(Y)) + re = re === "auto" ? st(U, $) : re, s.drawBottomRoundRectanglePath(j || r, le.x, le.y, U, $, re + (T + F + Z) / 2); + else if (Y === "barrel") + s.drawBarrelPath(j || r, le.x, le.y, U, $); + else if (Y.startsWith("polygon") || ["rhomboid", "right-rhomboid", "round-tag", "tag", "vee"].includes(Y)) { + var Or = (T + F + Z) / o; + ue = wn(xn(ue, Or)), s.drawPolygonPath(j || r, le.x, le.y, o, l, ue); + } else { + var Jr = (T + F + Z) / o; + ue = wn(xn(ue, -Jr)), s.drawPolygonPath(j || r, le.x, le.y, o, l, ue); + } + if (h ? r.stroke(j) : r.stroke(), X === "double") { + r.lineWidth = T / 3; + var Wr = r.globalCompositeOperation; + r.globalCompositeOperation = "destination-out", h ? r.stroke(j) : r.stroke(), r.globalCompositeOperation = Wr; + } + r.setLineDash && r.setLineDash([]); + } + }, de = function() { + n && s.drawNodeOverlay(r, e, f, o, l); + }, ye = function() { + n && s.drawNodeUnderlay(r, e, f, o, l); + }, we = function() { + s.drawElementText(r, e, null, a); + }, De = e.pstyle("ghost").value === "yes"; + if (De) { + var ze = e.pstyle("ghost-offset-x").pfValue, Ue = e.pstyle("ghost-offset-y").pfValue, Ae = e.pstyle("ghost-opacity").value, Ye = Ae * c; + r.translate(ze, Ue), z(), ge(), ae(Ae * B), be(), _e(Ye, !0), J(Ae * N), ce(), Ie(D !== 0 || A !== 0), se(D !== 0 || A !== 0), _e(Ye, !1), oe(Ye), r.translate(-ze, -Ue); + } + h && r.translate(-f.x, -f.y), ye(), h && r.translate(f.x, f.y), z(), ge(), ae(), be(), _e(c, !0), J(), ce(), Ie(D !== 0 || A !== 0), se(D !== 0 || A !== 0), _e(c, !1), oe(), h && r.translate(-f.x, -f.y), we(), de(), t && r.translate(p.x1, p.y1); + } +}; +var xf = function(e) { + if (!["overlay", "underlay"].includes(e)) + throw new Error("Invalid state"); + return function(t, a, n, i, s) { + var o = this; + if (a.visible()) { + var l = a.pstyle("".concat(e, "-padding")).pfValue, u = a.pstyle("".concat(e, "-opacity")).value, v = a.pstyle("".concat(e, "-color")).value, f = a.pstyle("".concat(e, "-shape")).value, c = a.pstyle("".concat(e, "-corner-radius")).value; + if (u > 0) { + if (n = n || a.position(), i == null || s == null) { + var h = a.padding(); + i = a.width() + 2 * h, s = a.height() + 2 * h; + } + o.colorFillStyle(t, v[0], v[1], v[2], u), o.nodeShapes[f].draw(t, n.x, n.y, i + l * 2, s + l * 2, c), t.fill(); + } + } + }; +}; +dt.drawNodeOverlay = xf("overlay"); +dt.drawNodeUnderlay = xf("underlay"); +dt.hasPie = function(r) { + return r = r[0], r._private.hasPie; +}; +dt.hasStripe = function(r) { + return r = r[0], r._private.hasStripe; +}; +dt.drawPie = function(r, e, t, a) { + e = e[0], a = a || e.position(); + var n = e.cy().style(), i = e.pstyle("pie-size"), s = e.pstyle("pie-hole"), o = e.pstyle("pie-start-angle").pfValue, l = a.x, u = a.y, v = e.width(), f = e.height(), c = Math.min(v, f) / 2, h, d = 0, y = this.usePaths(); + if (y && (l = 0, u = 0), i.units === "%" ? c = c * i.pfValue : i.pfValue !== void 0 && (c = i.pfValue / 2), s.units === "%" ? h = c * s.pfValue : s.pfValue !== void 0 && (h = s.pfValue / 2), !(h >= c)) + for (var g = 1; g <= n.pieBackgroundN; g++) { + var p = e.pstyle("pie-" + g + "-background-size").value, m = e.pstyle("pie-" + g + "-background-color").value, b = e.pstyle("pie-" + g + "-background-opacity").value * t, w = p / 100; + w + d > 1 && (w = 1 - d); + var E = 1.5 * Math.PI + 2 * Math.PI * d; + E += o; + var C = 2 * Math.PI * w, x = E + C; + p === 0 || d >= 1 || d + w > 1 || (h === 0 ? (r.beginPath(), r.moveTo(l, u), r.arc(l, u, c, E, x), r.closePath()) : (r.beginPath(), r.arc(l, u, c, E, x), r.arc(l, u, h, x, E, !0), r.closePath()), this.colorFillStyle(r, m[0], m[1], m[2], b), r.fill(), d += w); + } +}; +dt.drawStripe = function(r, e, t, a) { + e = e[0], a = a || e.position(); + var n = e.cy().style(), i = a.x, s = a.y, o = e.width(), l = e.height(), u = 0, v = this.usePaths(); + r.save(); + var f = e.pstyle("stripe-direction").value, c = e.pstyle("stripe-size"); + switch (f) { + case "vertical": + break; + case "righward": + r.rotate(-Math.PI / 2); + break; + } + var h = o, d = l; + c.units === "%" ? (h = h * c.pfValue, d = d * c.pfValue) : c.pfValue !== void 0 && (h = c.pfValue, d = c.pfValue), v && (i = 0, s = 0), s -= h / 2, i -= d / 2; + for (var y = 1; y <= n.stripeBackgroundN; y++) { + var g = e.pstyle("stripe-" + y + "-background-size").value, p = e.pstyle("stripe-" + y + "-background-color").value, m = e.pstyle("stripe-" + y + "-background-opacity").value * t, b = g / 100; + b + u > 1 && (b = 1 - u), !(g === 0 || u >= 1 || u + b > 1) && (r.beginPath(), r.rect(i, s + d * u, h, d * b), r.closePath(), this.colorFillStyle(r, p[0], p[1], p[2], m), r.fill(), u += b); + } + r.restore(); +}; +var mr = {}, By = 100; +mr.getPixelRatio = function() { + var r = this.data.contexts[0]; + if (this.forcedPixelRatio != null) + return this.forcedPixelRatio; + var e = this.cy.window(), t = r.backingStorePixelRatio || r.webkitBackingStorePixelRatio || r.mozBackingStorePixelRatio || r.msBackingStorePixelRatio || r.oBackingStorePixelRatio || r.backingStorePixelRatio || 1; + return (e.devicePixelRatio || 1) / t; +}; +mr.paintCache = function(r) { + for (var e = this.paintCaches = this.paintCaches || [], t = !0, a, n = 0; n < e.length; n++) + if (a = e[n], a.context === r) { + t = !1; + break; + } + return t && (a = { + context: r + }, e.push(a)), a; +}; +mr.createGradientStyleFor = function(r, e, t, a, n) { + var i, s = this.usePaths(), o = t.pstyle(e + "-gradient-stop-colors").value, l = t.pstyle(e + "-gradient-stop-positions").pfValue; + if (a === "radial-gradient") + if (t.isEdge()) { + var u = t.sourceEndpoint(), v = t.targetEndpoint(), f = t.midpoint(), c = St(u, f), h = St(v, f); + i = r.createRadialGradient(f.x, f.y, 0, f.x, f.y, Math.max(c, h)); + } else { + var d = s ? { + x: 0, + y: 0 + } : t.position(), y = t.paddedWidth(), g = t.paddedHeight(); + i = r.createRadialGradient(d.x, d.y, 0, d.x, d.y, Math.max(y, g)); + } + else if (t.isEdge()) { + var p = t.sourceEndpoint(), m = t.targetEndpoint(); + i = r.createLinearGradient(p.x, p.y, m.x, m.y); + } else { + var b = s ? { + x: 0, + y: 0 + } : t.position(), w = t.paddedWidth(), E = t.paddedHeight(), C = w / 2, x = E / 2, k = t.pstyle("background-gradient-direction").value; + switch (k) { + case "to-bottom": + i = r.createLinearGradient(b.x, b.y - x, b.x, b.y + x); + break; + case "to-top": + i = r.createLinearGradient(b.x, b.y + x, b.x, b.y - x); + break; + case "to-left": + i = r.createLinearGradient(b.x + C, b.y, b.x - C, b.y); + break; + case "to-right": + i = r.createLinearGradient(b.x - C, b.y, b.x + C, b.y); + break; + case "to-bottom-right": + case "to-right-bottom": + i = r.createLinearGradient(b.x - C, b.y - x, b.x + C, b.y + x); + break; + case "to-top-right": + case "to-right-top": + i = r.createLinearGradient(b.x - C, b.y + x, b.x + C, b.y - x); + break; + case "to-bottom-left": + case "to-left-bottom": + i = r.createLinearGradient(b.x + C, b.y - x, b.x - C, b.y + x); + break; + case "to-top-left": + case "to-left-top": + i = r.createLinearGradient(b.x + C, b.y + x, b.x - C, b.y - x); + break; + } + } + if (!i) return null; + for (var S = l.length === o.length, P = o.length, D = 0; D < P; D++) + i.addColorStop(S ? l[D] : D / (P - 1), "rgba(" + o[D][0] + "," + o[D][1] + "," + o[D][2] + "," + n + ")"); + return i; +}; +mr.gradientFillStyle = function(r, e, t, a) { + var n = this.createGradientStyleFor(r, "background", e, t, a); + if (!n) return null; + r.fillStyle = n; +}; +mr.colorFillStyle = function(r, e, t, a, n) { + r.fillStyle = "rgba(" + e + "," + t + "," + a + "," + n + ")"; +}; +mr.eleFillStyle = function(r, e, t) { + var a = e.pstyle("background-fill").value; + if (a === "linear-gradient" || a === "radial-gradient") + this.gradientFillStyle(r, e, a, t); + else { + var n = e.pstyle("background-color").value; + this.colorFillStyle(r, n[0], n[1], n[2], t); + } +}; +mr.gradientStrokeStyle = function(r, e, t, a) { + var n = this.createGradientStyleFor(r, "line", e, t, a); + if (!n) return null; + r.strokeStyle = n; +}; +mr.colorStrokeStyle = function(r, e, t, a, n) { + r.strokeStyle = "rgba(" + e + "," + t + "," + a + "," + n + ")"; +}; +mr.eleStrokeStyle = function(r, e, t) { + var a = e.pstyle("line-fill").value; + if (a === "linear-gradient" || a === "radial-gradient") + this.gradientStrokeStyle(r, e, a, t); + else { + var n = e.pstyle("line-color").value; + this.colorStrokeStyle(r, n[0], n[1], n[2], t); + } +}; +mr.matchCanvasSize = function(r) { + var e = this, t = e.data, a = e.findContainerClientCoords(), n = a[2], i = a[3], s = e.getPixelRatio(), o = e.motionBlurPxRatio; + (r === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE] || r === e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG]) && (s = o); + var l = n * s, u = i * s, v; + if (!(l === e.canvasWidth && u === e.canvasHeight)) { + e.fontCaches = null; + var f = t.canvasContainer; + f.style.width = n + "px", f.style.height = i + "px"; + for (var c = 0; c < e.CANVAS_LAYERS; c++) + v = t.canvases[c], v.width = l, v.height = u, v.style.width = n + "px", v.style.height = i + "px"; + for (var c = 0; c < e.BUFFER_COUNT; c++) + v = t.bufferCanvases[c], v.width = l, v.height = u, v.style.width = n + "px", v.style.height = i + "px"; + e.textureMult = 1, s <= 1 && (v = t.bufferCanvases[e.TEXTURE_BUFFER], e.textureMult = 2, v.width = l * e.textureMult, v.height = u * e.textureMult), e.canvasWidth = l, e.canvasHeight = u, e.pixelRatio = s; + } +}; +mr.renderTo = function(r, e, t, a) { + this.render({ + forcedContext: r, + forcedZoom: e, + forcedPan: t, + drawAllLayers: !0, + forcedPxRatio: a + }); +}; +mr.clearCanvas = function() { + var r = this, e = r.data; + function t(a) { + a.clearRect(0, 0, r.canvasWidth, r.canvasHeight); + } + t(e.contexts[r.NODE]), t(e.contexts[r.DRAG]); +}; +mr.render = function(r) { + var e = this; + r = r || vv(); + var t = e.cy, a = r.forcedContext, n = r.drawAllLayers, i = r.drawOnlyNodeLayer, s = r.forcedZoom, o = r.forcedPan, l = r.forcedPxRatio === void 0 ? this.getPixelRatio() : r.forcedPxRatio, u = e.data, v = u.canvasNeedsRedraw, f = e.textureOnViewport && !a && (e.pinching || e.hoverData.dragging || e.swipePanning || e.data.wheelZooming), c = r.motionBlur !== void 0 ? r.motionBlur : e.motionBlur, h = e.motionBlurPxRatio, d = t.hasCompoundNodes(), y = e.hoverData.draggingEles, g = !!(e.hoverData.selecting || e.touchData.selecting); + c = c && !a && e.motionBlurEnabled && !g; + var p = c; + a || (e.prevPxRatio !== l && (e.invalidateContainerClientCoordsCache(), e.matchCanvasSize(e.container), e.redrawHint("eles", !0), e.redrawHint("drag", !0)), e.prevPxRatio = l), !a && e.motionBlurTimeout && clearTimeout(e.motionBlurTimeout), c && (e.mbFrames == null && (e.mbFrames = 0), e.mbFrames++, e.mbFrames < 3 && (p = !1), e.mbFrames > e.minMbLowQualFrames && (e.motionBlurPxRatio = e.mbPxRBlurry)), e.clearingMotionBlur && (e.motionBlurPxRatio = 1), e.textureDrawLastFrame && !f && (v[e.NODE] = !0, v[e.SELECT_BOX] = !0); + var m = t.style(), b = t.zoom(), w = s !== void 0 ? s : b, E = t.pan(), C = { + x: E.x, + y: E.y + }, x = { + zoom: b, + pan: { + x: E.x, + y: E.y + } + }, k = e.prevViewport, S = k === void 0 || x.zoom !== k.zoom || x.pan.x !== k.pan.x || x.pan.y !== k.pan.y; + !S && !(y && !d) && (e.motionBlurPxRatio = 1), o && (C = o), w *= l, C.x *= l, C.y *= l; + var P = e.getCachedZSortedEles(); + function D(J, z, q, H, ee) { + var ne = J.globalCompositeOperation; + J.globalCompositeOperation = "destination-out", e.colorFillStyle(J, 255, 255, 255, e.motionBlurTransparency), J.fillRect(z, q, H, ee), J.globalCompositeOperation = ne; + } + function A(J, z) { + var q, H, ee, ne; + !e.clearingMotionBlur && (J === u.bufferContexts[e.MOTIONBLUR_BUFFER_NODE] || J === u.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG]) ? (q = { + x: E.x * h, + y: E.y * h + }, H = b * h, ee = e.canvasWidth * h, ne = e.canvasHeight * h) : (q = C, H = w, ee = e.canvasWidth, ne = e.canvasHeight), J.setTransform(1, 0, 0, 1, 0, 0), z === "motionBlur" ? D(J, 0, 0, ee, ne) : !a && (z === void 0 || z) && J.clearRect(0, 0, ee, ne), n || (J.translate(q.x, q.y), J.scale(H, H)), o && J.translate(o.x, o.y), s && J.scale(s, s); + } + if (f || (e.textureDrawLastFrame = !1), f) { + if (e.textureDrawLastFrame = !0, !e.textureCache) { + e.textureCache = {}, e.textureCache.bb = t.mutableElements().boundingBox(), e.textureCache.texture = e.data.bufferCanvases[e.TEXTURE_BUFFER]; + var B = e.data.bufferContexts[e.TEXTURE_BUFFER]; + B.setTransform(1, 0, 0, 1, 0, 0), B.clearRect(0, 0, e.canvasWidth * e.textureMult, e.canvasHeight * e.textureMult), e.render({ + forcedContext: B, + drawOnlyNodeLayer: !0, + forcedPxRatio: l * e.textureMult + }); + var x = e.textureCache.viewport = { + zoom: t.zoom(), + pan: t.pan(), + width: e.canvasWidth, + height: e.canvasHeight + }; + x.mpan = { + x: (0 - x.pan.x) / x.zoom, + y: (0 - x.pan.y) / x.zoom + }; + } + v[e.DRAG] = !1, v[e.NODE] = !1; + var R = u.contexts[e.NODE], M = e.textureCache.texture, x = e.textureCache.viewport; + R.setTransform(1, 0, 0, 1, 0, 0), c ? D(R, 0, 0, x.width, x.height) : R.clearRect(0, 0, x.width, x.height); + var I = m.core("outside-texture-bg-color").value, L = m.core("outside-texture-bg-opacity").value; + e.colorFillStyle(R, I[0], I[1], I[2], L), R.fillRect(0, 0, x.width, x.height); + var b = t.zoom(); + A(R, !1), R.clearRect(x.mpan.x, x.mpan.y, x.width / x.zoom / l, x.height / x.zoom / l), R.drawImage(M, x.mpan.x, x.mpan.y, x.width / x.zoom / l, x.height / x.zoom / l); + } else e.textureOnViewport && !a && (e.textureCache = null); + var O = t.extent(), V = e.pinching || e.hoverData.dragging || e.swipePanning || e.data.wheelZooming || e.hoverData.draggingEles || e.cy.animated(), G = e.hideEdgesOnViewport && V, N = []; + if (N[e.NODE] = !v[e.NODE] && c && !e.clearedForMotionBlur[e.NODE] || e.clearingMotionBlur, N[e.NODE] && (e.clearedForMotionBlur[e.NODE] = !0), N[e.DRAG] = !v[e.DRAG] && c && !e.clearedForMotionBlur[e.DRAG] || e.clearingMotionBlur, N[e.DRAG] && (e.clearedForMotionBlur[e.DRAG] = !0), v[e.NODE] || n || i || N[e.NODE]) { + var F = c && !N[e.NODE] && h !== 1, R = a || (F ? e.data.bufferContexts[e.MOTIONBLUR_BUFFER_NODE] : u.contexts[e.NODE]), K = c && !F ? "motionBlur" : void 0; + A(R, K), G ? e.drawCachedNodes(R, P.nondrag, l, O) : e.drawLayeredElements(R, P.nondrag, l, O), e.debug && e.drawDebugPoints(R, P.nondrag), !n && !c && (v[e.NODE] = !1); + } + if (!i && (v[e.DRAG] || n || N[e.DRAG])) { + var F = c && !N[e.DRAG] && h !== 1, R = a || (F ? e.data.bufferContexts[e.MOTIONBLUR_BUFFER_DRAG] : u.contexts[e.DRAG]); + A(R, c && !F ? "motionBlur" : void 0), G ? e.drawCachedNodes(R, P.drag, l, O) : e.drawCachedElements(R, P.drag, l, O), e.debug && e.drawDebugPoints(R, P.drag), !n && !c && (v[e.DRAG] = !1); + } + if (this.drawSelectionRectangle(r, A), c && h !== 1) { + var X = u.contexts[e.NODE], Q = e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_NODE], Z = u.contexts[e.DRAG], re = e.data.bufferCanvases[e.MOTIONBLUR_BUFFER_DRAG], ae = function(z, q, H) { + z.setTransform(1, 0, 0, 1, 0, 0), H || !p ? z.clearRect(0, 0, e.canvasWidth, e.canvasHeight) : D(z, 0, 0, e.canvasWidth, e.canvasHeight); + var ee = h; + z.drawImage( + q, + // img + 0, + 0, + // sx, sy + e.canvasWidth * ee, + e.canvasHeight * ee, + // sw, sh + 0, + 0, + // x, y + e.canvasWidth, + e.canvasHeight + // w, h + ); + }; + (v[e.NODE] || N[e.NODE]) && (ae(X, Q, N[e.NODE]), v[e.NODE] = !1), (v[e.DRAG] || N[e.DRAG]) && (ae(Z, re, N[e.DRAG]), v[e.DRAG] = !1); + } + e.prevViewport = x, e.clearingMotionBlur && (e.clearingMotionBlur = !1, e.motionBlurCleared = !0, e.motionBlur = !0), c && (e.motionBlurTimeout = setTimeout(function() { + e.motionBlurTimeout = null, e.clearedForMotionBlur[e.NODE] = !1, e.clearedForMotionBlur[e.DRAG] = !1, e.motionBlur = !1, e.clearingMotionBlur = !f, e.mbFrames = 0, v[e.NODE] = !0, v[e.DRAG] = !0, e.redraw(); + }, By)), a || t.emit("render"); +}; +var fa; +mr.drawSelectionRectangle = function(r, e) { + var t = this, a = t.cy, n = t.data, i = a.style(), s = r.drawOnlyNodeLayer, o = r.drawAllLayers, l = n.canvasNeedsRedraw, u = r.forcedContext; + if (t.showFps || !s && l[t.SELECT_BOX] && !o) { + var v = u || n.contexts[t.SELECT_BOX]; + if (e(v), t.selection[4] == 1 && (t.hoverData.selecting || t.touchData.selecting)) { + var f = t.cy.zoom(), c = i.core("selection-box-border-width").value / f; + v.lineWidth = c, v.fillStyle = "rgba(" + i.core("selection-box-color").value[0] + "," + i.core("selection-box-color").value[1] + "," + i.core("selection-box-color").value[2] + "," + i.core("selection-box-opacity").value + ")", v.fillRect(t.selection[0], t.selection[1], t.selection[2] - t.selection[0], t.selection[3] - t.selection[1]), c > 0 && (v.strokeStyle = "rgba(" + i.core("selection-box-border-color").value[0] + "," + i.core("selection-box-border-color").value[1] + "," + i.core("selection-box-border-color").value[2] + "," + i.core("selection-box-opacity").value + ")", v.strokeRect(t.selection[0], t.selection[1], t.selection[2] - t.selection[0], t.selection[3] - t.selection[1])); + } + if (n.bgActivePosistion && !t.hoverData.selecting) { + var f = t.cy.zoom(), h = n.bgActivePosistion; + v.fillStyle = "rgba(" + i.core("active-bg-color").value[0] + "," + i.core("active-bg-color").value[1] + "," + i.core("active-bg-color").value[2] + "," + i.core("active-bg-opacity").value + ")", v.beginPath(), v.arc(h.x, h.y, i.core("active-bg-size").pfValue / f, 0, 2 * Math.PI), v.fill(); + } + var d = t.lastRedrawTime; + if (t.showFps && d) { + d = Math.round(d); + var y = Math.round(1e3 / d), g = "1 frame = " + d + " ms = " + y + " fps"; + if (v.setTransform(1, 0, 0, 1, 0, 0), v.fillStyle = "rgba(255, 0, 0, 0.75)", v.strokeStyle = "rgba(255, 0, 0, 0.75)", v.font = "30px Arial", !fa) { + var p = v.measureText(g); + fa = p.actualBoundingBoxAscent; + } + v.fillText(g, 0, fa); + var m = 60; + v.strokeRect(0, fa + 10, 250, 20), v.fillRect(0, fa + 10, 250 * Math.min(y / m, 1), 20); + } + o || (l[t.SELECT_BOX] = !1); + } +}; +function zl(r, e, t) { + var a = r.createShader(e); + if (r.shaderSource(a, t), r.compileShader(a), !r.getShaderParameter(a, r.COMPILE_STATUS)) + throw new Error(r.getShaderInfoLog(a)); + return a; +} +function Py(r, e, t) { + var a = zl(r, r.VERTEX_SHADER, e), n = zl(r, r.FRAGMENT_SHADER, t), i = r.createProgram(); + if (r.attachShader(i, a), r.attachShader(i, n), r.linkProgram(i), !r.getProgramParameter(i, r.LINK_STATUS)) + throw new Error("Could not initialize shaders"); + return i; +} +function Ay(r, e, t) { + t === void 0 && (t = e); + var a = r.makeOffscreenCanvas(e, t), n = a.context = a.getContext("2d"); + return a.clear = function() { + return n.clearRect(0, 0, a.width, a.height); + }, a.clear(), a; +} +function po(r) { + var e = r.pixelRatio, t = r.cy.zoom(), a = r.cy.pan(); + return { + zoom: t * e, + pan: { + x: a.x * e, + y: a.y * e + } + }; +} +function Ry(r) { + var e = r.pixelRatio, t = r.cy.zoom(); + return t * e; +} +function My(r, e, t, a, n) { + var i = a * t + e.x, s = n * t + e.y; + return s = Math.round(r.canvasHeight - s), [i, s]; +} +function Ly(r) { + return r.pstyle("background-fill").value !== "solid" || r.pstyle("background-image").strValue !== "none" ? !1 : r.pstyle("border-width").value === 0 || r.pstyle("border-opacity").value === 0 ? !0 : r.pstyle("border-style").value === "solid"; +} +function Iy(r, e) { + if (r.length !== e.length) + return !1; + for (var t = 0; t < r.length; t++) + if (r[t] !== e[t]) + return !1; + return !0; +} +function yt(r, e, t) { + var a = r[0] / 255, n = r[1] / 255, i = r[2] / 255, s = e, o = t || new Array(4); + return o[0] = a * s, o[1] = n * s, o[2] = i * s, o[3] = s, o; +} +function zt(r, e) { + var t = e || new Array(4); + return t[0] = (r >> 0 & 255) / 255, t[1] = (r >> 8 & 255) / 255, t[2] = (r >> 16 & 255) / 255, t[3] = (r >> 24 & 255) / 255, t; +} +function Oy(r) { + return r[0] + (r[1] << 8) + (r[2] << 16) + (r[3] << 24); +} +function Ny(r, e) { + var t = r.createTexture(); + return t.buffer = function(a) { + r.bindTexture(r.TEXTURE_2D, t), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MAG_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR_MIPMAP_NEAREST), r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL, !0), r.texImage2D(r.TEXTURE_2D, 0, r.RGBA, r.RGBA, r.UNSIGNED_BYTE, a), r.generateMipmap(r.TEXTURE_2D), r.bindTexture(r.TEXTURE_2D, null); + }, t.deleteTexture = function() { + r.deleteTexture(t); + }, t; +} +function Ef(r, e) { + switch (e) { + case "float": + return [1, r.FLOAT, 4]; + case "vec2": + return [2, r.FLOAT, 4]; + case "vec3": + return [3, r.FLOAT, 4]; + case "vec4": + return [4, r.FLOAT, 4]; + case "int": + return [1, r.INT, 4]; + case "ivec2": + return [2, r.INT, 4]; + } +} +function Cf(r, e, t) { + switch (e) { + case r.FLOAT: + return new Float32Array(t); + case r.INT: + return new Int32Array(t); + } +} +function zy(r, e, t, a, n, i) { + switch (e) { + case r.FLOAT: + return new Float32Array(t.buffer, i * a, n); + case r.INT: + return new Int32Array(t.buffer, i * a, n); + } +} +function Fy(r, e, t, a) { + var n = Ef(r, e), i = je(n, 2), s = i[0], o = i[1], l = Cf(r, o, a), u = r.createBuffer(); + return r.bindBuffer(r.ARRAY_BUFFER, u), r.bufferData(r.ARRAY_BUFFER, l, r.STATIC_DRAW), o === r.FLOAT ? r.vertexAttribPointer(t, s, o, !1, 0, 0) : o === r.INT && r.vertexAttribIPointer(t, s, o, 0, 0), r.enableVertexAttribArray(t), r.bindBuffer(r.ARRAY_BUFFER, null), u; +} +function Fr(r, e, t, a) { + var n = Ef(r, t), i = je(n, 3), s = i[0], o = i[1], l = i[2], u = Cf(r, o, e * s), v = s * l, f = r.createBuffer(); + r.bindBuffer(r.ARRAY_BUFFER, f), r.bufferData(r.ARRAY_BUFFER, e * v, r.DYNAMIC_DRAW), r.enableVertexAttribArray(a), o === r.FLOAT ? r.vertexAttribPointer(a, s, o, !1, v, 0) : o === r.INT && r.vertexAttribIPointer(a, s, o, v, 0), r.vertexAttribDivisor(a, 1), r.bindBuffer(r.ARRAY_BUFFER, null); + for (var c = new Array(e), h = 0; h < e; h++) + c[h] = zy(r, o, u, v, s, h); + return f.dataArray = u, f.stride = v, f.size = s, f.getView = function(d) { + return c[d]; + }, f.setPoint = function(d, y, g) { + var p = c[d]; + p[0] = y, p[1] = g; + }, f.bufferSubData = function(d) { + r.bindBuffer(r.ARRAY_BUFFER, f), d ? r.bufferSubData(r.ARRAY_BUFFER, 0, u, 0, d * s) : r.bufferSubData(r.ARRAY_BUFFER, 0, u); + }, f; +} +function Vy(r, e, t) { + for (var a = 9, n = new Float32Array(e * a), i = new Array(e), s = 0; s < e; s++) { + var o = s * a * 4; + i[s] = new Float32Array(n.buffer, o, a); + } + var l = r.createBuffer(); + r.bindBuffer(r.ARRAY_BUFFER, l), r.bufferData(r.ARRAY_BUFFER, n.byteLength, r.DYNAMIC_DRAW); + for (var u = 0; u < 3; u++) { + var v = t + u; + r.enableVertexAttribArray(v), r.vertexAttribPointer(v, 3, r.FLOAT, !1, 3 * 12, u * 12), r.vertexAttribDivisor(v, 1); + } + return r.bindBuffer(r.ARRAY_BUFFER, null), l.getMatrixView = function(f) { + return i[f]; + }, l.setData = function(f, c) { + i[c].set(f, 0); + }, l.bufferSubData = function() { + r.bindBuffer(r.ARRAY_BUFFER, l), r.bufferSubData(r.ARRAY_BUFFER, 0, n); + }, l; +} +function qy(r) { + var e = r.createFramebuffer(); + r.bindFramebuffer(r.FRAMEBUFFER, e); + var t = r.createTexture(); + return r.bindTexture(r.TEXTURE_2D, t), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_MIN_FILTER, r.LINEAR), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_S, r.CLAMP_TO_EDGE), r.texParameteri(r.TEXTURE_2D, r.TEXTURE_WRAP_T, r.CLAMP_TO_EDGE), r.framebufferTexture2D(r.FRAMEBUFFER, r.COLOR_ATTACHMENT0, r.TEXTURE_2D, t, 0), r.bindFramebuffer(r.FRAMEBUFFER, null), e.setFramebufferAttachmentSizes = function(a, n) { + r.bindTexture(r.TEXTURE_2D, t), r.texImage2D(r.TEXTURE_2D, 0, r.RGBA, a, n, 0, r.RGBA, r.UNSIGNED_BYTE, null); + }, e; +} +var Fl = typeof Float32Array < "u" ? Float32Array : Array; +Math.hypot || (Math.hypot = function() { + for (var r = 0, e = arguments.length; e--; ) + r += arguments[e] * arguments[e]; + return Math.sqrt(r); +}); +function bs() { + var r = new Fl(9); + return Fl != Float32Array && (r[1] = 0, r[2] = 0, r[3] = 0, r[5] = 0, r[6] = 0, r[7] = 0), r[0] = 1, r[4] = 1, r[8] = 1, r; +} +function Vl(r) { + return r[0] = 1, r[1] = 0, r[2] = 0, r[3] = 0, r[4] = 1, r[5] = 0, r[6] = 0, r[7] = 0, r[8] = 1, r; +} +function _y(r, e, t) { + var a = e[0], n = e[1], i = e[2], s = e[3], o = e[4], l = e[5], u = e[6], v = e[7], f = e[8], c = t[0], h = t[1], d = t[2], y = t[3], g = t[4], p = t[5], m = t[6], b = t[7], w = t[8]; + return r[0] = c * a + h * s + d * u, r[1] = c * n + h * o + d * v, r[2] = c * i + h * l + d * f, r[3] = y * a + g * s + p * u, r[4] = y * n + g * o + p * v, r[5] = y * i + g * l + p * f, r[6] = m * a + b * s + w * u, r[7] = m * n + b * o + w * v, r[8] = m * i + b * l + w * f, r; +} +function gn(r, e, t) { + var a = e[0], n = e[1], i = e[2], s = e[3], o = e[4], l = e[5], u = e[6], v = e[7], f = e[8], c = t[0], h = t[1]; + return r[0] = a, r[1] = n, r[2] = i, r[3] = s, r[4] = o, r[5] = l, r[6] = c * a + h * s + u, r[7] = c * n + h * o + v, r[8] = c * i + h * l + f, r; +} +function ql(r, e, t) { + var a = e[0], n = e[1], i = e[2], s = e[3], o = e[4], l = e[5], u = e[6], v = e[7], f = e[8], c = Math.sin(t), h = Math.cos(t); + return r[0] = h * a + c * s, r[1] = h * n + c * o, r[2] = h * i + c * l, r[3] = h * s - c * a, r[4] = h * o - c * n, r[5] = h * l - c * i, r[6] = u, r[7] = v, r[8] = f, r; +} +function _s(r, e, t) { + var a = t[0], n = t[1]; + return r[0] = a * e[0], r[1] = a * e[1], r[2] = a * e[2], r[3] = n * e[3], r[4] = n * e[4], r[5] = n * e[5], r[6] = e[6], r[7] = e[7], r[8] = e[8], r; +} +function Gy(r, e, t) { + return r[0] = 2 / e, r[1] = 0, r[2] = 0, r[3] = 0, r[4] = -2 / t, r[5] = 0, r[6] = -1, r[7] = 1, r[8] = 1, r; +} +var Hy = /* @__PURE__ */ function() { + function r(e, t, a, n) { + vt(this, r), this.debugID = Math.floor(Math.random() * 1e4), this.r = e, this.texSize = t, this.texRows = a, this.texHeight = Math.floor(t / a), this.enableWrapping = !0, this.locked = !1, this.texture = null, this.needsBuffer = !0, this.freePointer = { + x: 0, + row: 0 + }, this.keyToLocation = /* @__PURE__ */ new Map(), this.canvas = n(e, t, t), this.scratch = n(e, t, this.texHeight, "scratch"); + } + return ft(r, [{ + key: "lock", + value: function() { + this.locked = !0; + } + }, { + key: "getKeys", + value: function() { + return new Set(this.keyToLocation.keys()); + } + }, { + key: "getScale", + value: function(t) { + var a = t.w, n = t.h, i = this.texHeight, s = this.texSize, o = i / n, l = a * o, u = n * o; + return l > s && (o = s / a, l = a * o, u = n * o), { + scale: o, + texW: l, + texH: u + }; + } + }, { + key: "draw", + value: function(t, a, n) { + var i = this; + if (this.locked) throw new Error("can't draw, atlas is locked"); + var s = this.texSize, o = this.texRows, l = this.texHeight, u = this.getScale(a), v = u.scale, f = u.texW, c = u.texH, h = function(b, w) { + if (n && w) { + var E = w.context, C = b.x, x = b.row, k = C, S = l * x; + E.save(), E.translate(k, S), E.scale(v, v), n(E, a), E.restore(); + } + }, d = [null, null], y = function() { + h(i.freePointer, i.canvas), d[0] = { + x: i.freePointer.x, + y: i.freePointer.row * l, + w: f, + h: c + }, d[1] = { + // create a second location with a width of 0, for convenience + x: i.freePointer.x + f, + y: i.freePointer.row * l, + w: 0, + h: c + }, i.freePointer.x += f, i.freePointer.x == s && (i.freePointer.x = 0, i.freePointer.row++); + }, g = function() { + var b = i.scratch, w = i.canvas; + b.clear(), h({ + x: 0, + row: 0 + }, b); + var E = s - i.freePointer.x, C = f - E, x = l; + { + var k = i.freePointer.x, S = i.freePointer.row * l, P = E; + w.context.drawImage(b, 0, 0, P, x, k, S, P, x), d[0] = { + x: k, + y: S, + w: P, + h: c + }; + } + { + var D = E, A = (i.freePointer.row + 1) * l, B = C; + w && w.context.drawImage(b, D, 0, B, x, 0, A, B, x), d[1] = { + x: 0, + y: A, + w: B, + h: c + }; + } + i.freePointer.x = C, i.freePointer.row++; + }, p = function() { + i.freePointer.x = 0, i.freePointer.row++; + }; + if (this.freePointer.x + f <= s) + y(); + else { + if (this.freePointer.row >= o - 1) + return !1; + this.freePointer.x === s ? (p(), y()) : this.enableWrapping ? g() : (p(), y()); + } + return this.keyToLocation.set(t, d), this.needsBuffer = !0, d; + } + }, { + key: "getOffsets", + value: function(t) { + return this.keyToLocation.get(t); + } + }, { + key: "isEmpty", + value: function() { + return this.freePointer.x === 0 && this.freePointer.row === 0; + } + }, { + key: "canFit", + value: function(t) { + if (this.locked) return !1; + var a = this.texSize, n = this.texRows, i = this.getScale(t), s = i.texW; + return this.freePointer.x + s > a ? this.freePointer.row < n - 1 : !0; + } + // called on every frame + }, { + key: "bufferIfNeeded", + value: function(t) { + this.texture || (this.texture = Ny(t, this.debugID)), this.needsBuffer && (this.texture.buffer(this.canvas), this.needsBuffer = !1, this.locked && (this.canvas = null, this.scratch = null)); + } + }, { + key: "dispose", + value: function() { + this.texture && (this.texture.deleteTexture(), this.texture = null), this.canvas = null, this.scratch = null, this.locked = !0; + } + }]); +}(), Wy = /* @__PURE__ */ function() { + function r(e, t, a, n) { + vt(this, r), this.r = e, this.texSize = t, this.texRows = a, this.createTextureCanvas = n, this.atlases = [], this.styleKeyToAtlas = /* @__PURE__ */ new Map(), this.markedKeys = /* @__PURE__ */ new Set(); + } + return ft(r, [{ + key: "getKeys", + value: function() { + return new Set(this.styleKeyToAtlas.keys()); + } + }, { + key: "_createAtlas", + value: function() { + var t = this.r, a = this.texSize, n = this.texRows, i = this.createTextureCanvas; + return new Hy(t, a, n, i); + } + }, { + key: "_getScratchCanvas", + value: function() { + if (!this.scratch) { + var t = this.r, a = this.texSize, n = this.texRows, i = this.createTextureCanvas, s = Math.floor(a / n); + this.scratch = i(t, a, s, "scratch"); + } + return this.scratch; + } + }, { + key: "draw", + value: function(t, a, n) { + var i = this.styleKeyToAtlas.get(t); + return i || (i = this.atlases[this.atlases.length - 1], (!i || !i.canFit(a)) && (i && i.lock(), i = this._createAtlas(), this.atlases.push(i)), i.draw(t, a, n), this.styleKeyToAtlas.set(t, i)), i; + } + }, { + key: "getAtlas", + value: function(t) { + return this.styleKeyToAtlas.get(t); + } + }, { + key: "hasAtlas", + value: function(t) { + return this.styleKeyToAtlas.has(t); + } + }, { + key: "markKeyForGC", + value: function(t) { + this.markedKeys.add(t); + } + }, { + key: "gc", + value: function() { + var t = this, a = this.markedKeys; + if (a.size === 0) { + console.log("nothing to garbage collect"); + return; + } + var n = [], i = /* @__PURE__ */ new Map(), s = null, o = Tr(this.atlases), l; + try { + var u = function() { + var f = l.value, c = f.getKeys(), h = Uy(a, c); + if (h.size === 0) + return n.push(f), c.forEach(function(E) { + return i.set(E, f); + }), 1; + s || (s = t._createAtlas(), n.push(s)); + var d = Tr(c), y; + try { + for (d.s(); !(y = d.n()).done; ) { + var g = y.value; + if (!h.has(g)) { + var p = f.getOffsets(g), m = je(p, 2), b = m[0], w = m[1]; + s.canFit({ + w: b.w + w.w, + h: b.h + }) || (s.lock(), s = t._createAtlas(), n.push(s)), f.canvas && (t._copyTextureToNewAtlas(g, f, s), i.set(g, s)); + } + } + } catch (E) { + d.e(E); + } finally { + d.f(); + } + f.dispose(); + }; + for (o.s(); !(l = o.n()).done; ) + u(); + } catch (v) { + o.e(v); + } finally { + o.f(); + } + this.atlases = n, this.styleKeyToAtlas = i, this.markedKeys = /* @__PURE__ */ new Set(); + } + }, { + key: "_copyTextureToNewAtlas", + value: function(t, a, n) { + var i = a.getOffsets(t), s = je(i, 2), o = s[0], l = s[1]; + if (l.w === 0) + n.draw(t, o, function(c) { + c.drawImage(a.canvas, o.x, o.y, o.w, o.h, 0, 0, o.w, o.h); + }); + else { + var u = this._getScratchCanvas(); + u.clear(), u.context.drawImage(a.canvas, o.x, o.y, o.w, o.h, 0, 0, o.w, o.h), u.context.drawImage(a.canvas, l.x, l.y, l.w, l.h, o.w, 0, l.w, l.h); + var v = o.w + l.w, f = o.h; + n.draw(t, { + w: v, + h: f + }, function(c) { + c.drawImage( + u, + 0, + 0, + v, + f, + 0, + 0, + v, + f + // the destination context has already been translated to the correct position + ); + }); + } + } + }, { + key: "getCounts", + value: function() { + return { + keyCount: this.styleKeyToAtlas.size, + atlasCount: new Set(this.styleKeyToAtlas.values()).size + }; + } + }]); +}(); +function Uy(r, e) { + return r.intersection ? r.intersection(e) : new Set(pn(r).filter(function(t) { + return e.has(t); + })); +} +var $y = /* @__PURE__ */ function() { + function r(e, t) { + vt(this, r), this.r = e, this.globalOptions = t, this.atlasSize = t.webglTexSize, this.maxAtlasesPerBatch = t.webglTexPerBatch, this.renderTypes = /* @__PURE__ */ new Map(), this.collections = /* @__PURE__ */ new Map(), this.typeAndIdToKey = /* @__PURE__ */ new Map(); + } + return ft(r, [{ + key: "getAtlasSize", + value: function() { + return this.atlasSize; + } + }, { + key: "addAtlasCollection", + value: function(t, a) { + var n = this.globalOptions, i = n.webglTexSize, s = n.createTextureCanvas, o = a.texRows, l = this._cacheScratchCanvas(s), u = new Wy(this.r, i, o, l); + this.collections.set(t, u); + } + }, { + key: "addRenderType", + value: function(t, a) { + var n = a.collection; + if (!this.collections.has(n)) throw new Error("invalid atlas collection name '".concat(n, "'")); + var i = this.collections.get(n), s = he({ + type: t, + atlasCollection: i + }, a); + this.renderTypes.set(t, s); + } + }, { + key: "getRenderTypeOpts", + value: function(t) { + return this.renderTypes.get(t); + } + }, { + key: "getAtlasCollection", + value: function(t) { + return this.collections.get(t); + } + }, { + key: "_cacheScratchCanvas", + value: function(t) { + var a = -1, n = -1, i = null; + return function(s, o, l, u) { + return u ? ((!i || o != a || l != n) && (a = o, n = l, i = t(s, o, l)), i) : t(s, o, l); + }; + } + }, { + key: "_key", + value: function(t, a) { + return "".concat(t, "-").concat(a); + } + /** Marks textues associated with the element for garbage collection. */ + }, { + key: "invalidate", + value: function(t) { + var a = this, n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = n.forceRedraw, s = i === void 0 ? !1 : i, o = n.filterEle, l = o === void 0 ? function() { + return !0; + } : o, u = n.filterType, v = u === void 0 ? function() { + return !0; + } : u, f = !1, c = !1, h = Tr(t), d; + try { + for (h.s(); !(d = h.n()).done; ) { + var y = d.value; + if (l(y)) { + var g = Tr(this.renderTypes.values()), p; + try { + var m = function() { + var w = p.value, E = w.type; + if (v(E)) { + var C = a.collections.get(w.collection), x = w.getKey(y), k = Array.isArray(x) ? x : [x]; + if (s) + k.forEach(function(A) { + return C.markKeyForGC(A); + }), c = !0; + else { + var S = w.getID ? w.getID(y) : y.id(), P = a._key(E, S), D = a.typeAndIdToKey.get(P); + D !== void 0 && !Iy(k, D) && (f = !0, a.typeAndIdToKey.delete(P), D.forEach(function(A) { + return C.markKeyForGC(A); + })); + } + } + }; + for (g.s(); !(p = g.n()).done; ) + m(); + } catch (b) { + g.e(b); + } finally { + g.f(); + } + } + } + } catch (b) { + h.e(b); + } finally { + h.f(); + } + return c && (this.gc(), f = !1), f; + } + /** Garbage collect */ + }, { + key: "gc", + value: function() { + var t = Tr(this.collections.values()), a; + try { + for (t.s(); !(a = t.n()).done; ) { + var n = a.value; + n.gc(); + } + } catch (i) { + t.e(i); + } finally { + t.f(); + } + } + }, { + key: "getOrCreateAtlas", + value: function(t, a, n, i) { + var s = this.renderTypes.get(a), o = this.collections.get(s.collection), l = !1, u = o.draw(i, n, function(c) { + s.drawClipped ? (c.save(), c.beginPath(), c.rect(0, 0, n.w, n.h), c.clip(), s.drawElement(c, t, n, !0, !0), c.restore()) : s.drawElement(c, t, n, !0, !0), l = !0; + }); + if (l) { + var v = s.getID ? s.getID(t) : t.id(), f = this._key(a, v); + this.typeAndIdToKey.has(f) ? this.typeAndIdToKey.get(f).push(i) : this.typeAndIdToKey.set(f, [i]); + } + return u; + } + }, { + key: "getAtlasInfo", + value: function(t, a) { + var n = this, i = this.renderTypes.get(a), s = i.getKey(t), o = Array.isArray(s) ? s : [s]; + return o.map(function(l) { + var u = i.getBoundingBox(t, l), v = n.getOrCreateAtlas(t, a, u, l), f = v.getOffsets(l), c = je(f, 2), h = c[0], d = c[1]; + return { + atlas: v, + tex: h, + tex1: h, + tex2: d, + bb: u + }; + }); + } + }, { + key: "getDebugInfo", + value: function() { + var t = [], a = Tr(this.collections), n; + try { + for (a.s(); !(n = a.n()).done; ) { + var i = je(n.value, 2), s = i[0], o = i[1], l = o.getCounts(), u = l.keyCount, v = l.atlasCount; + t.push({ + type: s, + keyCount: u, + atlasCount: v + }); + } + } catch (f) { + a.e(f); + } finally { + a.f(); + } + return t; + } + }]); +}(), Ky = /* @__PURE__ */ function() { + function r(e) { + vt(this, r), this.globalOptions = e, this.atlasSize = e.webglTexSize, this.maxAtlasesPerBatch = e.webglTexPerBatch, this.batchAtlases = []; + } + return ft(r, [{ + key: "getMaxAtlasesPerBatch", + value: function() { + return this.maxAtlasesPerBatch; + } + }, { + key: "getAtlasSize", + value: function() { + return this.atlasSize; + } + }, { + key: "getIndexArray", + value: function() { + return Array.from({ + length: this.maxAtlasesPerBatch + }, function(t, a) { + return a; + }); + } + }, { + key: "startBatch", + value: function() { + this.batchAtlases = []; + } + }, { + key: "getAtlasCount", + value: function() { + return this.batchAtlases.length; + } + }, { + key: "getAtlases", + value: function() { + return this.batchAtlases; + } + }, { + key: "canAddToCurrentBatch", + value: function(t) { + return this.batchAtlases.length === this.maxAtlasesPerBatch ? this.batchAtlases.includes(t) : !0; + } + }, { + key: "getAtlasIndexForBatch", + value: function(t) { + var a = this.batchAtlases.indexOf(t); + if (a < 0) { + if (this.batchAtlases.length === this.maxAtlasesPerBatch) + throw new Error("cannot add more atlases to batch"); + this.batchAtlases.push(t), a = this.batchAtlases.length - 1; + } + return a; + } + }]); +}(), Yy = ` + float circleSD(vec2 p, float r) { + return distance(vec2(0), p) - r; // signed distance + } +`, Xy = ` + float rectangleSD(vec2 p, vec2 b) { + vec2 d = abs(p)-b; + return distance(vec2(0),max(d,0.0)) + min(max(d.x,d.y),0.0); + } +`, Zy = ` + float roundRectangleSD(vec2 p, vec2 b, vec4 cr) { + cr.xy = (p.x > 0.0) ? cr.xy : cr.zw; + cr.x = (p.y > 0.0) ? cr.x : cr.y; + vec2 q = abs(p) - b + cr.x; + return min(max(q.x, q.y), 0.0) + distance(vec2(0), max(q, 0.0)) - cr.x; + } +`, Qy = ` + float ellipseSD(vec2 p, vec2 ab) { + p = abs( p ); // symmetry + + // find root with Newton solver + vec2 q = ab*(p-ab); + float w = (q.x1.0) ? d : -d; + } +`, ba = { + SCREEN: { + name: "screen", + screen: !0 + }, + PICKING: { + name: "picking", + picking: !0 + } +}, Bn = { + // render the texture just like in RENDER_TARGET.SCREEN mode + IGNORE: 1, + // don't render the texture at all + USE_BB: 2 + // render the bounding box as an opaque rectangle +}, ws = 0, _l = 1, Gl = 2, xs = 3, Ft = 4, an = 5, ca = 6, da = 7, Jy = /* @__PURE__ */ function() { + function r(e, t, a) { + vt(this, r), this.r = e, this.gl = t, this.maxInstances = a.webglBatchSize, this.atlasSize = a.webglTexSize, this.bgColor = a.bgColor, this.debug = a.webglDebug, this.batchDebugInfo = [], a.enableWrapping = !0, a.createTextureCanvas = Ay, this.atlasManager = new $y(e, a), this.batchManager = new Ky(a), this.simpleShapeOptions = /* @__PURE__ */ new Map(), this.program = this._createShaderProgram(ba.SCREEN), this.pickingProgram = this._createShaderProgram(ba.PICKING), this.vao = this._createVAO(); + } + return ft(r, [{ + key: "addAtlasCollection", + value: function(t, a) { + this.atlasManager.addAtlasCollection(t, a); + } + /** + * @typedef { Object } TextureRenderTypeOpts + * @property { string } collection - name of atlas collection to render textures to + * @property { function } getKey - returns the "style key" for an element, may be a single value or an array for multi-line lables + * @property { function } drawElement - uses a canvas renderer to draw the element to the texture atlas + * @property { boolean } drawClipped - if true the context will be clipped to the bounding box before drawElement() is called, may affect performance + * @property { function } getBoundingBox - returns the bounding box for an element + * @property { function } getRotation + * @property { function } getRotationPoint + * @property { function } getRotationOffset + * @property { function } isVisible - an extra check for visibility in addition to ele.visible() + * @property { function } getTexPickingMode - returns a value from the TEX_PICKING_MODE enum + */ + /** + * @param { string } typeName + * @param { TextureRenderTypeOpts } opts + */ + }, { + key: "addTextureAtlasRenderType", + value: function(t, a) { + this.atlasManager.addRenderType(t, a); + } + /** + * @typedef { Object } SimpleShapeRenderTypeOpts + * @property { function } getBoundingBox - returns the bounding box for an element + * @property { function } isVisible - this is an extra check for visibility in addition to ele.visible() + * @property { function } isSimple - check if element is a simple shape, or if it needs to fall back to texture rendering + * @property { ShapeVisualProperties } shapeProps + */ + /** + * @typedef { Object } ShapeVisualProperties + * @property { string } shape + * @property { string } color + * @property { string } opacity + * @property { string } padding + * @property { string } radius + * @property { boolean } border + */ + /** + * @param { string } typeName + * @param { SimpleShapeRenderTypeOpts } opts + */ + }, { + key: "addSimpleShapeRenderType", + value: function(t, a) { + this.simpleShapeOptions.set(t, a); + } + /** + * Inform the atlasManager when element style keys may have changed. + * The atlasManager can then mark unused textures for "garbage collection". + */ + }, { + key: "invalidate", + value: function(t) { + var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, n = a.type, i = this.atlasManager; + return n ? i.invalidate(t, { + filterType: function(o) { + return o === n; + }, + forceRedraw: !0 + }) : i.invalidate(t); + } + /** + * Run texture garbage collection. + */ + }, { + key: "gc", + value: function() { + this.atlasManager.gc(); + } + }, { + key: "_createShaderProgram", + value: function(t) { + var a = this.gl, n = `#version 300 es + precision highp float; + + uniform mat3 uPanZoomMatrix; + uniform int uAtlasSize; + + // instanced + in vec2 aPosition; // a vertex from the unit square + + in mat3 aTransform; // used to transform verticies, eg into a bounding box + in int aVertType; // the type of thing we are rendering + + // the z-index that is output when using picking mode + in vec4 aIndex; + + // For textures + in int aAtlasId; // which shader unit/atlas to use + in vec4 aTex; // x/y/w/h of texture in atlas + + // for edges + in vec4 aPointAPointB; + in vec4 aPointCPointD; + in vec2 aLineWidth; // also used for node border width + + // simple shapes + in vec4 aCornerRadius; // for round-rectangle [top-right, bottom-right, top-left, bottom-left] + in vec4 aColor; // also used for edges + in vec4 aBorderColor; // aLineWidth is used for border width + + // output values passed to the fragment shader + out vec2 vTexCoord; + out vec4 vColor; + out vec2 vPosition; + // flat values are not interpolated + flat out int vAtlasId; + flat out int vVertType; + flat out vec2 vTopRight; + flat out vec2 vBotLeft; + flat out vec4 vCornerRadius; + flat out vec4 vBorderColor; + flat out vec2 vBorderWidth; + flat out vec4 vIndex; + + void main(void) { + int vid = gl_VertexID; + vec2 position = aPosition; // TODO make this a vec3, simplifies some code below + + if(aVertType == `.concat(ws, `) { + float texX = aTex.x; // texture coordinates + float texY = aTex.y; + float texW = aTex.z; + float texH = aTex.w; + + if(vid == 1 || vid == 2 || vid == 4) { + texX += texW; + } + if(vid == 2 || vid == 4 || vid == 5) { + texY += texH; + } + + float d = float(uAtlasSize); + vTexCoord = vec2(texX / d, texY / d); // tex coords must be between 0 and 1 + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat(Ft, " || aVertType == ").concat(da, ` + || aVertType == `).concat(an, " || aVertType == ").concat(ca, `) { // simple shapes + + // the bounding box is needed by the fragment shader + vBotLeft = (aTransform * vec3(0, 0, 1)).xy; // flat + vTopRight = (aTransform * vec3(1, 1, 1)).xy; // flat + vPosition = (aTransform * vec3(position, 1)).xy; // will be interpolated + + // calculations are done in the fragment shader, just pass these along + vColor = aColor; + vCornerRadius = aCornerRadius; + vBorderColor = aBorderColor; + vBorderWidth = aLineWidth; + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + } + else if(aVertType == `).concat(_l, `) { + vec2 source = aPointAPointB.xy; + vec2 target = aPointAPointB.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + // stretch the unit square into a long skinny rectangle + vec2 xBasis = target - source; + vec2 yBasis = normalize(vec2(-xBasis.y, xBasis.x)); + vec2 point = source + xBasis * position.x + yBasis * aLineWidth[0] * position.y; + + gl_Position = vec4(uPanZoomMatrix * vec3(point, 1.0), 1.0); + vColor = aColor; + } + else if(aVertType == `).concat(Gl, `) { + vec2 pointA = aPointAPointB.xy; + vec2 pointB = aPointAPointB.zw; + vec2 pointC = aPointCPointD.xy; + vec2 pointD = aPointCPointD.zw; + + // adjust the geometry so that the line is centered on the edge + position.y = position.y - 0.5; + + vec2 p0, p1, p2, pos; + if(position.x == 0.0) { // The left side of the unit square + p0 = pointA; + p1 = pointB; + p2 = pointC; + pos = position; + } else { // The right side of the unit square, use same approach but flip the geometry upside down + p0 = pointD; + p1 = pointC; + p2 = pointB; + pos = vec2(0.0, -position.y); + } + + vec2 p01 = p1 - p0; + vec2 p12 = p2 - p1; + vec2 p21 = p1 - p2; + + // Find the normal vector. + vec2 tangent = normalize(normalize(p12) + normalize(p01)); + vec2 normal = vec2(-tangent.y, tangent.x); + + // Find the vector perpendicular to p0 -> p1. + vec2 p01Norm = normalize(vec2(-p01.y, p01.x)); + + // Determine the bend direction. + float sigma = sign(dot(p01 + p21, normal)); + float width = aLineWidth[0]; + + if(sign(pos.y) == -sigma) { + // This is an intersecting vertex. Adjust the position so that there's no overlap. + vec2 point = 0.5 * width * normal * -sigma / dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } else { + // This is a non-intersecting vertex. Treat it like a mitre join. + vec2 point = 0.5 * width * normal * sigma * dot(normal, p01Norm); + gl_Position = vec4(uPanZoomMatrix * vec3(p1 + point, 1.0), 1.0); + } + + vColor = aColor; + } + else if(aVertType == `).concat(xs, ` && vid < 3) { + // massage the first triangle into an edge arrow + if(vid == 0) + position = vec2(-0.15, -0.3); + if(vid == 1) + position = vec2( 0.0, 0.0); + if(vid == 2) + position = vec2( 0.15, -0.3); + + gl_Position = vec4(uPanZoomMatrix * aTransform * vec3(position, 1.0), 1.0); + vColor = aColor; + } + else { + gl_Position = vec4(2.0, 0.0, 0.0, 1.0); // discard vertex by putting it outside webgl clip space + } + + vAtlasId = aAtlasId; + vVertType = aVertType; + vIndex = aIndex; + } + `), i = this.batchManager.getIndexArray(), s = `#version 300 es + precision highp float; + + // declare texture unit for each texture atlas in the batch + `.concat(i.map(function(u) { + return "uniform sampler2D uTexture".concat(u, ";"); + }).join(` + `), ` + + uniform vec4 uBGColor; + uniform float uZoom; + + in vec2 vTexCoord; + in vec4 vColor; + in vec2 vPosition; // model coordinates + + flat in int vAtlasId; + flat in vec4 vIndex; + flat in int vVertType; + flat in vec2 vTopRight; + flat in vec2 vBotLeft; + flat in vec4 vCornerRadius; + flat in vec4 vBorderColor; + flat in vec2 vBorderWidth; + + out vec4 outColor; + + `).concat(Yy, ` + `).concat(Xy, ` + `).concat(Zy, ` + `).concat(Qy, ` + + vec4 blend(vec4 top, vec4 bot) { // blend colors with premultiplied alpha + return vec4( + top.rgb + (bot.rgb * (1.0 - top.a)), + top.a + (bot.a * (1.0 - top.a)) + ); + } + + vec4 distInterp(vec4 cA, vec4 cB, float d) { // interpolate color using Signed Distance + // scale to the zoom level so that borders don't look blurry when zoomed in + // note 1.5 is an aribitrary value chosen because it looks good + return mix(cA, cB, 1.0 - smoothstep(0.0, 1.5 / uZoom, abs(d))); + } + + void main(void) { + if(vVertType == `).concat(ws, `) { + // look up the texel from the texture unit + `).concat(i.map(function(u) { + return "if(vAtlasId == ".concat(u, ") outColor = texture(uTexture").concat(u, ", vTexCoord);"); + }).join(` + else `), ` + } + else if(vVertType == `).concat(xs, `) { + // mimics how canvas renderer uses context.globalCompositeOperation = 'destination-out'; + outColor = blend(vColor, uBGColor); + outColor.a = 1.0; // make opaque, masks out line under arrow + } + else if(vVertType == `).concat(Ft, ` && vBorderWidth == vec2(0.0)) { // simple rectangle with no border + outColor = vColor; // unit square is already transformed to the rectangle, nothing else needs to be done + } + else if(vVertType == `).concat(Ft, " || vVertType == ").concat(da, ` + || vVertType == `).concat(an, " || vVertType == ").concat(ca, `) { // use SDF + + float outerBorder = vBorderWidth[0]; + float innerBorder = vBorderWidth[1]; + float borderPadding = outerBorder * 2.0; + float w = vTopRight.x - vBotLeft.x - borderPadding; + float h = vTopRight.y - vBotLeft.y - borderPadding; + vec2 b = vec2(w/2.0, h/2.0); // half width, half height + vec2 p = vPosition - vec2(vTopRight.x - b[0] - outerBorder, vTopRight.y - b[1] - outerBorder); // translate to center + + float d; // signed distance + if(vVertType == `).concat(Ft, `) { + d = rectangleSD(p, b); + } else if(vVertType == `).concat(da, ` && w == h) { + d = circleSD(p, b.x); // faster than ellipse + } else if(vVertType == `).concat(da, `) { + d = ellipseSD(p, b); + } else { + d = roundRectangleSD(p, b, vCornerRadius.wzyx); + } + + // use the distance to interpolate a color to smooth the edges of the shape, doesn't need multisampling + // we must smooth colors inwards, because we can't change pixels outside the shape's bounding box + if(d > 0.0) { + if(d > outerBorder) { + discard; + } else { + outColor = distInterp(vBorderColor, vec4(0), d - outerBorder); + } + } else { + if(d > innerBorder) { + vec4 outerColor = outerBorder == 0.0 ? vec4(0) : vBorderColor; + vec4 innerBorderColor = blend(vBorderColor, vColor); + outColor = distInterp(innerBorderColor, outerColor, d); + } + else { + vec4 outerColor; + if(innerBorder == 0.0 && outerBorder == 0.0) { + outerColor = vec4(0); + } else if(innerBorder == 0.0) { + outerColor = vBorderColor; + } else { + outerColor = blend(vBorderColor, vColor); + } + outColor = distInterp(vColor, outerColor, d - innerBorder); + } + } + } + else { + outColor = vColor; + } + + `).concat(t.picking ? `if(outColor.a == 0.0) discard; + else outColor = vIndex;` : "", ` + } + `), o = Py(a, n, s); + o.aPosition = a.getAttribLocation(o, "aPosition"), o.aIndex = a.getAttribLocation(o, "aIndex"), o.aVertType = a.getAttribLocation(o, "aVertType"), o.aTransform = a.getAttribLocation(o, "aTransform"), o.aAtlasId = a.getAttribLocation(o, "aAtlasId"), o.aTex = a.getAttribLocation(o, "aTex"), o.aPointAPointB = a.getAttribLocation(o, "aPointAPointB"), o.aPointCPointD = a.getAttribLocation(o, "aPointCPointD"), o.aLineWidth = a.getAttribLocation(o, "aLineWidth"), o.aColor = a.getAttribLocation(o, "aColor"), o.aCornerRadius = a.getAttribLocation(o, "aCornerRadius"), o.aBorderColor = a.getAttribLocation(o, "aBorderColor"), o.uPanZoomMatrix = a.getUniformLocation(o, "uPanZoomMatrix"), o.uAtlasSize = a.getUniformLocation(o, "uAtlasSize"), o.uBGColor = a.getUniformLocation(o, "uBGColor"), o.uZoom = a.getUniformLocation(o, "uZoom"), o.uTextures = []; + for (var l = 0; l < this.batchManager.getMaxAtlasesPerBatch(); l++) + o.uTextures.push(a.getUniformLocation(o, "uTexture".concat(l))); + return o; + } + }, { + key: "_createVAO", + value: function() { + var t = [0, 0, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1]; + this.vertexCount = t.length / 2; + var a = this.maxInstances, n = this.gl, i = this.program, s = n.createVertexArray(); + return n.bindVertexArray(s), Fy(n, "vec2", i.aPosition, t), this.transformBuffer = Vy(n, a, i.aTransform), this.indexBuffer = Fr(n, a, "vec4", i.aIndex), this.vertTypeBuffer = Fr(n, a, "int", i.aVertType), this.atlasIdBuffer = Fr(n, a, "int", i.aAtlasId), this.texBuffer = Fr(n, a, "vec4", i.aTex), this.pointAPointBBuffer = Fr(n, a, "vec4", i.aPointAPointB), this.pointCPointDBuffer = Fr(n, a, "vec4", i.aPointCPointD), this.lineWidthBuffer = Fr(n, a, "vec2", i.aLineWidth), this.colorBuffer = Fr(n, a, "vec4", i.aColor), this.cornerRadiusBuffer = Fr(n, a, "vec4", i.aCornerRadius), this.borderColorBuffer = Fr(n, a, "vec4", i.aBorderColor), n.bindVertexArray(null), s; + } + }, { + key: "buffers", + get: function() { + var t = this; + return this._buffers || (this._buffers = Object.keys(this).filter(function(a) { + return a.endsWith("Buffer"); + }).map(function(a) { + return t[a]; + })), this._buffers; + } + }, { + key: "startFrame", + value: function(t) { + var a = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ba.SCREEN; + this.panZoomMatrix = t, this.renderTarget = a, this.batchDebugInfo = [], this.wrappedCount = 0, this.simpleCount = 0, this.startBatch(); + } + }, { + key: "startBatch", + value: function() { + this.instanceCount = 0, this.batchManager.startBatch(); + } + }, { + key: "endFrame", + value: function() { + this.endBatch(); + } + }, { + key: "_isVisible", + value: function(t, a) { + return t.visible() ? a && a.isVisible ? a.isVisible(t) : !0 : !1; + } + /** + * Draws a texture using the texture atlas. + */ + }, { + key: "drawTexture", + value: function(t, a, n) { + var i = this.atlasManager, s = this.batchManager, o = i.getRenderTypeOpts(n); + if (this._isVisible(t, o)) { + if (this.renderTarget.picking && o.getTexPickingMode) { + var l = o.getTexPickingMode(t); + if (l === Bn.IGNORE) + return; + if (l == Bn.USE_BB) { + this.drawPickingRectangle(t, a, n); + return; + } + } + var u = i.getAtlasInfo(t, n), v = Tr(u), f; + try { + for (v.s(); !(f = v.n()).done; ) { + var c = f.value, h = c.atlas, d = c.tex1, y = c.tex2; + s.canAddToCurrentBatch(h) || this.endBatch(); + for (var g = s.getAtlasIndexForBatch(h), p = 0, m = [[d, !0], [y, !1]]; p < m.length; p++) { + var b = je(m[p], 2), w = b[0], E = b[1]; + if (w.w != 0) { + var C = this.instanceCount; + this.vertTypeBuffer.getView(C)[0] = ws; + var x = this.indexBuffer.getView(C); + zt(a, x); + var k = this.atlasIdBuffer.getView(C); + k[0] = g; + var S = this.texBuffer.getView(C); + S[0] = w.x, S[1] = w.y, S[2] = w.w, S[3] = w.h; + var P = this.transformBuffer.getMatrixView(C); + this.setTransformMatrix(t, P, o, c, E), this.instanceCount++, E || this.wrappedCount++, this.instanceCount >= this.maxInstances && this.endBatch(); + } + } + } + } catch (D) { + v.e(D); + } finally { + v.f(); + } + } + } + /** + * matrix is expected to be a 9 element array + * this function follows same pattern as CRp.drawCachedElementPortion(...) + */ + }, { + key: "setTransformMatrix", + value: function(t, a, n, i) { + var s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, o = 0; + if (n.shapeProps && n.shapeProps.padding && (o = t.pstyle(n.shapeProps.padding).pfValue), i) { + var l = i.bb, u = i.tex1, v = i.tex2, f = u.w / (u.w + v.w); + s || (f = 1 - f); + var c = this._getAdjustedBB(l, o, s, f); + this._applyTransformMatrix(a, c, n, t); + } else { + var h = n.getBoundingBox(t), d = this._getAdjustedBB(h, o, !0, 1); + this._applyTransformMatrix(a, d, n, t); + } + } + }, { + key: "_applyTransformMatrix", + value: function(t, a, n, i) { + var s, o; + Vl(t); + var l = n.getRotation ? n.getRotation(i) : 0; + if (l !== 0) { + var u = n.getRotationPoint(i), v = u.x, f = u.y; + gn(t, t, [v, f]), ql(t, t, l); + var c = n.getRotationOffset(i); + s = c.x + (a.xOffset || 0), o = c.y + (a.yOffset || 0); + } else + s = a.x1, o = a.y1; + gn(t, t, [s, o]), _s(t, t, [a.w, a.h]); + } + /** + * Adjusts a node or label BB to accomodate padding and split for wrapped textures. + * @param bb - the original bounding box + * @param padding - the padding to add to the bounding box + * @param first - whether this is the first part of a wrapped texture + * @param ratio - the ratio of the texture width of part of the text to the entire texture + */ + }, { + key: "_getAdjustedBB", + value: function(t, a, n, i) { + var s = t.x1, o = t.y1, l = t.w, u = t.h, v = t.yOffset; + a && (s -= a, o -= a, l += 2 * a, u += 2 * a); + var f = 0, c = l * i; + return n && i < 1 ? l = c : !n && i < 1 && (f = l - c, s += f, l = c), { + x1: s, + y1: o, + w: l, + h: u, + xOffset: f, + yOffset: v + }; + } + /** + * Draw a solid opaque rectangle matching the element's Bounding Box. + * Used by the PICKING mode to make the entire BB of a label clickable. + */ + }, { + key: "drawPickingRectangle", + value: function(t, a, n) { + var i = this.atlasManager.getRenderTypeOpts(n), s = this.instanceCount; + this.vertTypeBuffer.getView(s)[0] = Ft; + var o = this.indexBuffer.getView(s); + zt(a, o); + var l = this.colorBuffer.getView(s); + yt([0, 0, 0], 1, l); + var u = this.transformBuffer.getMatrixView(s); + this.setTransformMatrix(t, u, i), this.simpleCount++, this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch(); + } + /** + * Draw a node using either a texture or a "simple shape". + */ + }, { + key: "drawNode", + value: function(t, a, n) { + var i = this.simpleShapeOptions.get(n); + if (this._isVisible(t, i)) { + var s = i.shapeProps, o = this._getVertTypeForShape(t, s.shape); + if (o === void 0 || i.isSimple && !i.isSimple(t)) { + this.drawTexture(t, a, n); + return; + } + var l = this.instanceCount; + if (this.vertTypeBuffer.getView(l)[0] = o, o === an || o === ca) { + var u = i.getBoundingBox(t), v = this._getCornerRadius(t, s.radius, u), f = this.cornerRadiusBuffer.getView(l); + f[0] = v, f[1] = v, f[2] = v, f[3] = v, o === ca && (f[0] = 0, f[2] = 0); + } + var c = this.indexBuffer.getView(l); + zt(a, c); + var h = t.pstyle(s.color).value, d = t.pstyle(s.opacity).value, y = this.colorBuffer.getView(l); + yt(h, d, y); + var g = this.lineWidthBuffer.getView(l); + if (g[0] = 0, g[1] = 0, s.border) { + var p = t.pstyle("border-width").value; + if (p > 0) { + var m = t.pstyle("border-color").value, b = t.pstyle("border-opacity").value, w = this.borderColorBuffer.getView(l); + yt(m, b, w); + var E = t.pstyle("border-position").value; + if (E === "inside") + g[0] = 0, g[1] = -p; + else if (E === "outside") + g[0] = p, g[1] = 0; + else { + var C = p / 2; + g[0] = C, g[1] = -C; + } + } + } + var x = this.transformBuffer.getMatrixView(l); + this.setTransformMatrix(t, x, i), this.simpleCount++, this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch(); + } + } + }, { + key: "_getVertTypeForShape", + value: function(t, a) { + var n = t.pstyle(a).value; + switch (n) { + case "rectangle": + return Ft; + case "ellipse": + return da; + case "roundrectangle": + case "round-rectangle": + return an; + case "bottom-round-rectangle": + return ca; + default: + return; + } + } + }, { + key: "_getCornerRadius", + value: function(t, a, n) { + var i = n.w, s = n.h; + if (t.pstyle(a).value === "auto") + return st(i, s); + var o = t.pstyle(a).pfValue, l = i / 2, u = s / 2; + return Math.min(o, u, l); + } + /** + * Only supports drawing triangles at the moment. + */ + }, { + key: "drawEdgeArrow", + value: function(t, a, n) { + if (t.visible()) { + var i = t._private.rscratch, s, o, l; + if (n === "source" ? (s = i.arrowStartX, o = i.arrowStartY, l = i.srcArrowAngle) : (s = i.arrowEndX, o = i.arrowEndY, l = i.tgtArrowAngle), !(isNaN(s) || s == null || isNaN(o) || o == null || isNaN(l) || l == null)) { + var u = t.pstyle(n + "-arrow-shape").value; + if (u !== "none") { + var v = t.pstyle(n + "-arrow-color").value, f = t.pstyle("opacity").value, c = t.pstyle("line-opacity").value, h = f * c, d = t.pstyle("width").pfValue, y = t.pstyle("arrow-scale").value, g = this.r.getArrowWidth(d, y), p = this.instanceCount, m = this.transformBuffer.getMatrixView(p); + Vl(m), gn(m, m, [s, o]), _s(m, m, [g, g]), ql(m, m, l), this.vertTypeBuffer.getView(p)[0] = xs; + var b = this.indexBuffer.getView(p); + zt(a, b); + var w = this.colorBuffer.getView(p); + yt(v, h, w), this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch(); + } + } + } + } + /** + * Draw straight-line or bezier curve edges. + */ + }, { + key: "drawEdgeLine", + value: function(t, a) { + if (t.visible()) { + var n = this._getEdgePoints(t); + if (n) { + var i = t.pstyle("opacity").value, s = t.pstyle("line-opacity").value, o = t.pstyle("width").pfValue, l = t.pstyle("line-color").value, u = i * s; + if (n.length / 2 + this.instanceCount > this.maxInstances && this.endBatch(), n.length == 4) { + var v = this.instanceCount; + this.vertTypeBuffer.getView(v)[0] = _l; + var f = this.indexBuffer.getView(v); + zt(a, f); + var c = this.colorBuffer.getView(v); + yt(l, u, c); + var h = this.lineWidthBuffer.getView(v); + h[0] = o; + var d = this.pointAPointBBuffer.getView(v); + d[0] = n[0], d[1] = n[1], d[2] = n[2], d[3] = n[3], this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch(); + } else + for (var y = 0; y < n.length - 2; y += 2) { + var g = this.instanceCount; + this.vertTypeBuffer.getView(g)[0] = Gl; + var p = this.indexBuffer.getView(g); + zt(a, p); + var m = this.colorBuffer.getView(g); + yt(l, u, m); + var b = this.lineWidthBuffer.getView(g); + b[0] = o; + var w = n[y - 2], E = n[y - 1], C = n[y], x = n[y + 1], k = n[y + 2], S = n[y + 3], P = n[y + 4], D = n[y + 5]; + y == 0 && (w = 2 * C - k + 1e-3, E = 2 * x - S + 1e-3), y == n.length - 4 && (P = 2 * k - C + 1e-3, D = 2 * S - x + 1e-3); + var A = this.pointAPointBBuffer.getView(g); + A[0] = w, A[1] = E, A[2] = C, A[3] = x; + var B = this.pointCPointDBuffer.getView(g); + B[0] = k, B[1] = S, B[2] = P, B[3] = D, this.instanceCount++, this.instanceCount >= this.maxInstances && this.endBatch(); + } + } + } + } + }, { + key: "_getEdgePoints", + value: function(t) { + var a = t._private.rscratch; + if (!(a.badLine || a.allpts == null || isNaN(a.allpts[0]))) { + var n = a.allpts; + if (n.length == 4) + return n; + var i = this._getNumSegments(t); + return this._getCurveSegmentPoints(n, i); + } + } + }, { + key: "_getNumSegments", + value: function(t) { + var a = 15; + return Math.min(Math.max(a, 5), this.maxInstances); + } + }, { + key: "_getCurveSegmentPoints", + value: function(t, a) { + if (t.length == 4) + return t; + for (var n = Array((a + 1) * 2), i = 0; i <= a; i++) + if (i == 0) + n[0] = t[0], n[1] = t[1]; + else if (i == a) + n[i * 2] = t[t.length - 2], n[i * 2 + 1] = t[t.length - 1]; + else { + var s = i / a; + this._setCurvePoint(t, s, n, i * 2); + } + return n; + } + }, { + key: "_setCurvePoint", + value: function(t, a, n, i) { + if (t.length <= 2) + n[i] = t[0], n[i + 1] = t[1]; + else { + for (var s = Array(t.length - 2), o = 0; o < s.length; o += 2) { + var l = (1 - a) * t[o] + a * t[o + 2], u = (1 - a) * t[o + 1] + a * t[o + 3]; + s[o] = l, s[o + 1] = u; + } + return this._setCurvePoint(s, a, n, i); + } + } + }, { + key: "endBatch", + value: function() { + var t = this.gl, a = this.vao, n = this.vertexCount, i = this.instanceCount; + if (i !== 0) { + var s = this.renderTarget.picking ? this.pickingProgram : this.program; + t.useProgram(s), t.bindVertexArray(a); + var o = Tr(this.buffers), l; + try { + for (o.s(); !(l = o.n()).done; ) { + var u = l.value; + u.bufferSubData(i); + } + } catch (d) { + o.e(d); + } finally { + o.f(); + } + for (var v = this.batchManager.getAtlases(), f = 0; f < v.length; f++) + v[f].bufferIfNeeded(t); + for (var c = 0; c < v.length; c++) + t.activeTexture(t.TEXTURE0 + c), t.bindTexture(t.TEXTURE_2D, v[c].texture), t.uniform1i(s.uTextures[c], c); + t.uniform1f(s.uZoom, Ry(this.r)), t.uniformMatrix3fv(s.uPanZoomMatrix, !1, this.panZoomMatrix), t.uniform1i(s.uAtlasSize, this.batchManager.getAtlasSize()); + var h = yt(this.bgColor, 1); + t.uniform4fv(s.uBGColor, h), t.drawArraysInstanced(t.TRIANGLES, 0, n, i), t.bindVertexArray(null), t.bindTexture(t.TEXTURE_2D, null), this.debug && this.batchDebugInfo.push({ + count: i, + // instance count + atlasCount: v.length + }), this.startBatch(); + } + } + }, { + key: "getDebugInfo", + value: function() { + var t = this.atlasManager.getDebugInfo(), a = t.reduce(function(s, o) { + return s + o.atlasCount; + }, 0), n = this.batchDebugInfo, i = n.reduce(function(s, o) { + return s + o.count; + }, 0); + return { + atlasInfo: t, + totalAtlases: a, + wrappedCount: this.wrappedCount, + simpleCount: this.simpleCount, + batchCount: n.length, + batchInfo: n, + totalInstances: i + }; + } + }]); +}(), Tf = {}; +Tf.initWebgl = function(r, e) { + var t = this, a = t.data.contexts[t.WEBGL]; + r.bgColor = jy(t), r.webglTexSize = Math.min(r.webglTexSize, a.getParameter(a.MAX_TEXTURE_SIZE)), r.webglTexRows = Math.min(r.webglTexRows, 54), r.webglTexRowsNodes = Math.min(r.webglTexRowsNodes, 54), r.webglBatchSize = Math.min(r.webglBatchSize, 16384), r.webglTexPerBatch = Math.min(r.webglTexPerBatch, a.getParameter(a.MAX_TEXTURE_IMAGE_UNITS)), t.webglDebug = r.webglDebug, t.webglDebugShowAtlases = r.webglDebugShowAtlases, t.pickingFrameBuffer = qy(a), t.pickingFrameBuffer.needsDraw = !0, t.drawing = new Jy(t, a, r); + var n = function(f) { + return function(c) { + return t.getTextAngle(c, f); + }; + }, i = function(f) { + return function(c) { + var h = c.pstyle(f); + return h && h.value; + }; + }, s = function(f) { + return function(c) { + return c.pstyle("".concat(f, "-opacity")).value > 0; + }; + }, o = function(f) { + var c = f.pstyle("text-events").strValue === "yes"; + return c ? Bn.USE_BB : Bn.IGNORE; + }, l = function(f) { + var c = f.position(), h = c.x, d = c.y, y = f.outerWidth(), g = f.outerHeight(); + return { + w: y, + h: g, + x1: h - y / 2, + y1: d - g / 2 + }; + }; + t.drawing.addAtlasCollection("node", { + texRows: r.webglTexRowsNodes + }), t.drawing.addAtlasCollection("label", { + texRows: r.webglTexRows + }), t.drawing.addTextureAtlasRenderType("node-body", { + collection: "node", + getKey: e.getStyleKey, + getBoundingBox: e.getElementBox, + drawElement: e.drawElement + }), t.drawing.addSimpleShapeRenderType("node-body", { + getBoundingBox: l, + isSimple: Ly, + shapeProps: { + shape: "shape", + color: "background-color", + opacity: "background-opacity", + radius: "corner-radius", + border: !0 + } + }), t.drawing.addSimpleShapeRenderType("node-overlay", { + getBoundingBox: l, + isVisible: s("overlay"), + shapeProps: { + shape: "overlay-shape", + color: "overlay-color", + opacity: "overlay-opacity", + padding: "overlay-padding", + radius: "overlay-corner-radius" + } + }), t.drawing.addSimpleShapeRenderType("node-underlay", { + getBoundingBox: l, + isVisible: s("underlay"), + shapeProps: { + shape: "underlay-shape", + color: "underlay-color", + opacity: "underlay-opacity", + padding: "underlay-padding", + radius: "underlay-corner-radius" + } + }), t.drawing.addTextureAtlasRenderType("label", { + // node label or edge mid label + collection: "label", + getTexPickingMode: o, + getKey: Es(e.getLabelKey, null), + getBoundingBox: Cs(e.getLabelBox, null), + drawClipped: !0, + drawElement: e.drawLabel, + getRotation: n(null), + getRotationPoint: e.getLabelRotationPoint, + getRotationOffset: e.getLabelRotationOffset, + isVisible: i("label") + }), t.drawing.addTextureAtlasRenderType("edge-source-label", { + collection: "label", + getTexPickingMode: o, + getKey: Es(e.getSourceLabelKey, "source"), + getBoundingBox: Cs(e.getSourceLabelBox, "source"), + drawClipped: !0, + drawElement: e.drawSourceLabel, + getRotation: n("source"), + getRotationPoint: e.getSourceLabelRotationPoint, + getRotationOffset: e.getSourceLabelRotationOffset, + isVisible: i("source-label") + }), t.drawing.addTextureAtlasRenderType("edge-target-label", { + collection: "label", + getTexPickingMode: o, + getKey: Es(e.getTargetLabelKey, "target"), + getBoundingBox: Cs(e.getTargetLabelBox, "target"), + drawClipped: !0, + drawElement: e.drawTargetLabel, + getRotation: n("target"), + getRotationPoint: e.getTargetLabelRotationPoint, + getRotationOffset: e.getTargetLabelRotationOffset, + isVisible: i("target-label") + }); + var u = Oa(function() { + console.log("garbage collect flag set"), t.data.gc = !0; + }, 1e4); + t.onUpdateEleCalcs(function(v, f) { + var c = !1; + f && f.length > 0 && (c |= t.drawing.invalidate(f)), c && u(); + }), em(t); +}; +function jy(r) { + var e = r.cy.container(), t = e && e.style && e.style.backgroundColor || "white"; + return jl(t); +} +function Sf(r, e) { + var t = r._private.rscratch; + return Er(t, "labelWrapCachedLines", e) || []; +} +var Es = function(e, t) { + return function(a) { + var n = e(a), i = Sf(a, t); + return i.length > 1 ? i.map(function(s, o) { + return "".concat(n, "_").concat(o); + }) : n; + }; +}, Cs = function(e, t) { + return function(a, n) { + var i = e(a); + if (typeof n == "string") { + var s = n.indexOf("_"); + if (s > 0) { + var o = Number(n.substring(s + 1)), l = Sf(a, t), u = i.h / l.length, v = u * o, f = i.y1 + v; + return { + x1: i.x1, + w: i.w, + y1: f, + h: u, + yOffset: v + }; + } + } + return i; + }; +}; +function em(r) { + { + var e = r.render; + r.render = function(i) { + i = i || {}; + var s = r.cy; + r.webgl && (s.zoom() > yf ? (rm(r), e.call(r, i)) : (tm(r), kf(r, i, ba.SCREEN))); + }; + } + { + var t = r.matchCanvasSize; + r.matchCanvasSize = function(i) { + t.call(r, i), r.pickingFrameBuffer.setFramebufferAttachmentSizes(r.canvasWidth, r.canvasHeight), r.pickingFrameBuffer.needsDraw = !0; + }; + } + r.findNearestElements = function(i, s, o, l) { + return um(r, i, s); + }; + { + var a = r.invalidateCachedZSortedEles; + r.invalidateCachedZSortedEles = function() { + a.call(r), r.pickingFrameBuffer.needsDraw = !0; + }; + } + { + var n = r.notify; + r.notify = function(i, s) { + n.call(r, i, s), i === "viewport" || i === "bounds" ? r.pickingFrameBuffer.needsDraw = !0 : i === "background" && r.drawing.invalidate(s, { + type: "node-body" + }); + }; + } +} +function rm(r) { + var e = r.data.contexts[r.WEBGL]; + e.clear(e.COLOR_BUFFER_BIT | e.DEPTH_BUFFER_BIT); +} +function tm(r) { + var e = function(a) { + a.save(), a.setTransform(1, 0, 0, 1, 0, 0), a.clearRect(0, 0, r.canvasWidth, r.canvasHeight), a.restore(); + }; + e(r.data.contexts[r.NODE]), e(r.data.contexts[r.DRAG]); +} +function am(r) { + var e = r.canvasWidth, t = r.canvasHeight, a = po(r), n = a.pan, i = a.zoom, s = bs(); + gn(s, s, [n.x, n.y]), _s(s, s, [i, i]); + var o = bs(); + Gy(o, e, t); + var l = bs(); + return _y(l, o, s), l; +} +function Df(r, e) { + var t = r.canvasWidth, a = r.canvasHeight, n = po(r), i = n.pan, s = n.zoom; + e.setTransform(1, 0, 0, 1, 0, 0), e.clearRect(0, 0, t, a), e.translate(i.x, i.y), e.scale(s, s); +} +function nm(r, e) { + r.drawSelectionRectangle(e, function(t) { + return Df(r, t); + }); +} +function im(r) { + var e = r.data.contexts[r.NODE]; + e.save(), Df(r, e), e.strokeStyle = "rgba(0, 0, 0, 0.3)", e.beginPath(), e.moveTo(-1e3, 0), e.lineTo(1e3, 0), e.stroke(), e.beginPath(), e.moveTo(0, -1e3), e.lineTo(0, 1e3), e.stroke(), e.restore(); +} +function sm(r) { + var e = function(n, i, s) { + for (var o = n.atlasManager.getAtlasCollection(i), l = r.data.contexts[r.NODE], u = o.atlases, v = 0; v < u.length; v++) { + var f = u[v], c = f.canvas; + if (c) { + var h = c.width, d = c.height, y = h * v, g = c.height * s, p = 0.4; + l.save(), l.scale(p, p), l.drawImage(c, y, g), l.strokeStyle = "black", l.rect(y, g, h, d), l.stroke(), l.restore(); + } + } + }, t = 0; + e(r.drawing, "node", t++), e(r.drawing, "label", t++); +} +function om(r, e, t, a, n) { + var i, s, o, l, u = po(r), v = u.pan, f = u.zoom; + { + var c = My(r, v, f, e, t), h = je(c, 2), d = h[0], y = h[1], g = 6; + i = d - g / 2, s = y - g / 2, o = g, l = g; + } + if (o === 0 || l === 0) + return []; + var p = r.data.contexts[r.WEBGL]; + p.bindFramebuffer(p.FRAMEBUFFER, r.pickingFrameBuffer), r.pickingFrameBuffer.needsDraw && (p.viewport(0, 0, p.canvas.width, p.canvas.height), kf(r, null, ba.PICKING), r.pickingFrameBuffer.needsDraw = !1); + var m = o * l, b = new Uint8Array(m * 4); + p.readPixels(i, s, o, l, p.RGBA, p.UNSIGNED_BYTE, b), p.bindFramebuffer(p.FRAMEBUFFER, null); + for (var w = /* @__PURE__ */ new Set(), E = 0; E < m; E++) { + var C = b.slice(E * 4, E * 4 + 4), x = Oy(C) - 1; + x >= 0 && w.add(x); + } + return w; +} +function um(r, e, t) { + var a = om(r, e, t), n = r.getCachedZSortedEles(), i, s, o = Tr(a), l; + try { + for (o.s(); !(l = o.n()).done; ) { + var u = l.value, v = n[u]; + if (!i && v.isNode() && (i = v), !s && v.isEdge() && (s = v), i && s) + break; + } + } catch (f) { + o.e(f); + } finally { + o.f(); + } + return [i, s].filter(Boolean); +} +function Ts(r, e, t) { + var a = r.drawing; + e += 1, t.isNode() ? (a.drawNode(t, e, "node-underlay"), a.drawNode(t, e, "node-body"), a.drawTexture(t, e, "label"), a.drawNode(t, e, "node-overlay")) : (a.drawEdgeLine(t, e), a.drawEdgeArrow(t, e, "source"), a.drawEdgeArrow(t, e, "target"), a.drawTexture(t, e, "label"), a.drawTexture(t, e, "edge-source-label"), a.drawTexture(t, e, "edge-target-label")); +} +function kf(r, e, t) { + var a; + r.webglDebug && (a = performance.now()); + var n = r.drawing, i = 0; + if (t.screen && r.data.canvasNeedsRedraw[r.SELECT_BOX] && nm(r, e), r.data.canvasNeedsRedraw[r.NODE] || t.picking) { + var s = r.data.contexts[r.WEBGL]; + t.screen ? (s.clearColor(0, 0, 0, 0), s.enable(s.BLEND), s.blendFunc(s.ONE, s.ONE_MINUS_SRC_ALPHA)) : s.disable(s.BLEND), s.clear(s.COLOR_BUFFER_BIT | s.DEPTH_BUFFER_BIT), s.viewport(0, 0, s.canvas.width, s.canvas.height); + var o = am(r), l = r.getCachedZSortedEles(); + if (i = l.length, n.startFrame(o, t), t.screen) { + for (var u = 0; u < l.nondrag.length; u++) + Ts(r, u, l.nondrag[u]); + for (var v = 0; v < l.drag.length; v++) + Ts(r, v, l.drag[v]); + } else if (t.picking) + for (var f = 0; f < l.length; f++) + Ts(r, f, l[f]); + n.endFrame(), t.screen && r.webglDebugShowAtlases && (im(r), sm(r)), r.data.canvasNeedsRedraw[r.NODE] = !1, r.data.canvasNeedsRedraw[r.DRAG] = !1; + } + if (r.webglDebug) { + var c = performance.now(), h = !1, d = Math.ceil(c - a), y = n.getDebugInfo(), g = ["".concat(i, " elements"), "".concat(y.totalInstances, " instances"), "".concat(y.batchCount, " batches"), "".concat(y.totalAtlases, " atlases"), "".concat(y.wrappedCount, " wrapped textures"), "".concat(y.simpleCount, " simple shapes")].join(", "); + if (h) + console.log("WebGL (".concat(t.name, ") - time ").concat(d, "ms, ").concat(g)); + else { + console.log("WebGL (".concat(t.name, ") - frame time ").concat(d, "ms")), console.log("Totals:"), console.log(" ".concat(g)), console.log("Texture Atlases Used:"); + var p = y.atlasInfo, m = Tr(p), b; + try { + for (m.s(); !(b = m.n()).done; ) { + var w = b.value; + console.log(" ".concat(w.type, ": ").concat(w.keyCount, " keys, ").concat(w.atlasCount, " atlases")); + } + } catch (E) { + m.e(E); + } finally { + m.f(); + } + console.log(""); + } + } + r.data.gc && (console.log("Garbage Collect!"), r.data.gc = !1, n.gc()); +} +var ht = {}; +ht.drawPolygonPath = function(r, e, t, a, n, i) { + var s = a / 2, o = n / 2; + r.beginPath && r.beginPath(), r.moveTo(e + s * i[0], t + o * i[1]); + for (var l = 1; l < i.length / 2; l++) + r.lineTo(e + s * i[l * 2], t + o * i[l * 2 + 1]); + r.closePath(); +}; +ht.drawRoundPolygonPath = function(r, e, t, a, n, i, s) { + s.forEach(function(o) { + return uf(r, o); + }), r.closePath(); +}; +ht.drawRoundRectanglePath = function(r, e, t, a, n, i) { + var s = a / 2, o = n / 2, l = i === "auto" ? st(a, n) : Math.min(i, o, s); + r.beginPath && r.beginPath(), r.moveTo(e, t - o), r.arcTo(e + s, t - o, e + s, t, l), r.arcTo(e + s, t + o, e, t + o, l), r.arcTo(e - s, t + o, e - s, t, l), r.arcTo(e - s, t - o, e, t - o, l), r.lineTo(e, t - o), r.closePath(); +}; +ht.drawBottomRoundRectanglePath = function(r, e, t, a, n, i) { + var s = a / 2, o = n / 2, l = i === "auto" ? st(a, n) : i; + r.beginPath && r.beginPath(), r.moveTo(e, t - o), r.lineTo(e + s, t - o), r.lineTo(e + s, t), r.arcTo(e + s, t + o, e, t + o, l), r.arcTo(e - s, t + o, e - s, t, l), r.lineTo(e - s, t - o), r.lineTo(e, t - o), r.closePath(); +}; +ht.drawCutRectanglePath = function(r, e, t, a, n, i, s) { + var o = a / 2, l = n / 2, u = s === "auto" ? ro() : s; + r.beginPath && r.beginPath(), r.moveTo(e - o + u, t - l), r.lineTo(e + o - u, t - l), r.lineTo(e + o, t - l + u), r.lineTo(e + o, t + l - u), r.lineTo(e + o - u, t + l), r.lineTo(e - o + u, t + l), r.lineTo(e - o, t + l - u), r.lineTo(e - o, t - l + u), r.closePath(); +}; +ht.drawBarrelPath = function(r, e, t, a, n) { + var i = a / 2, s = n / 2, o = e - i, l = e + i, u = t - s, v = t + s, f = ks(a, n), c = f.widthOffset, h = f.heightOffset, d = f.ctrlPtOffsetPct * c; + r.beginPath && r.beginPath(), r.moveTo(o, u + h), r.lineTo(o, v - h), r.quadraticCurveTo(o + d, v, o + c, v), r.lineTo(l - c, v), r.quadraticCurveTo(l - d, v, l, v - h), r.lineTo(l, u + h), r.quadraticCurveTo(l - d, u, l - c, u), r.lineTo(o + c, u), r.quadraticCurveTo(o + d, u, o, u + h), r.closePath(); +}; +var Hl = Math.sin(0), Wl = Math.cos(0), Gs = {}, Hs = {}, Bf = Math.PI / 40; +for (var Vt = 0 * Math.PI; Vt < 2 * Math.PI; Vt += Bf) + Gs[Vt] = Math.sin(Vt), Hs[Vt] = Math.cos(Vt); +ht.drawEllipsePath = function(r, e, t, a, n) { + if (r.beginPath && r.beginPath(), r.ellipse) + r.ellipse(e, t, a / 2, n / 2, 0, 0, 2 * Math.PI); + else + for (var i, s, o = a / 2, l = n / 2, u = 0 * Math.PI; u < 2 * Math.PI; u += Bf) + i = e - o * Gs[u] * Hl + o * Hs[u] * Wl, s = t + l * Hs[u] * Hl + l * Gs[u] * Wl, u === 0 ? r.moveTo(i, s) : r.lineTo(i, s); + r.closePath(); +}; +var _a = {}; +_a.createBuffer = function(r, e) { + var t = document.createElement("canvas"); + return t.width = r, t.height = e, [t, t.getContext("2d")]; +}; +_a.bufferCanvasImage = function(r) { + var e = this.cy, t = e.mutableElements(), a = t.boundingBox(), n = this.findContainerClientCoords(), i = r.full ? Math.ceil(a.w) : n[2], s = r.full ? Math.ceil(a.h) : n[3], o = te(r.maxWidth) || te(r.maxHeight), l = this.getPixelRatio(), u = 1; + if (r.scale !== void 0) + i *= r.scale, s *= r.scale, u = r.scale; + else if (o) { + var v = 1 / 0, f = 1 / 0; + te(r.maxWidth) && (v = u * r.maxWidth / i), te(r.maxHeight) && (f = u * r.maxHeight / s), u = Math.min(v, f), i *= u, s *= u; + } + o || (i *= l, s *= l, u *= l); + var c = document.createElement("canvas"); + c.width = i, c.height = s, c.style.width = i + "px", c.style.height = s + "px"; + var h = c.getContext("2d"); + if (i > 0 && s > 0) { + h.clearRect(0, 0, i, s), h.globalCompositeOperation = "source-over"; + var d = this.getCachedZSortedEles(); + if (r.full) + h.translate(-a.x1 * u, -a.y1 * u), h.scale(u, u), this.drawElements(h, d), h.scale(1 / u, 1 / u), h.translate(a.x1 * u, a.y1 * u); + else { + var y = e.pan(), g = { + x: y.x * u, + y: y.y * u + }; + u *= e.zoom(), h.translate(g.x, g.y), h.scale(u, u), this.drawElements(h, d), h.scale(1 / u, 1 / u), h.translate(-g.x, -g.y); + } + r.bg && (h.globalCompositeOperation = "destination-over", h.fillStyle = r.bg, h.rect(0, 0, i, s), h.fill()); + } + return c; +}; +function lm(r, e) { + for (var t = atob(r), a = new ArrayBuffer(t.length), n = new Uint8Array(a), i = 0; i < t.length; i++) + n[i] = t.charCodeAt(i); + return new Blob([a], { + type: e + }); +} +function Ul(r) { + var e = r.indexOf(","); + return r.substr(e + 1); +} +function Pf(r, e, t) { + var a = function() { + return e.toDataURL(t, r.quality); + }; + switch (r.output) { + case "blob-promise": + return new ea(function(n, i) { + try { + e.toBlob(function(s) { + s != null ? n(s) : i(new Error("`canvas.toBlob()` sent a null value in its callback")); + }, t, r.quality); + } catch (s) { + i(s); + } + }); + case "blob": + return lm(Ul(a()), t); + case "base64": + return Ul(a()); + case "base64uri": + default: + return a(); + } +} +_a.png = function(r) { + return Pf(r, this.bufferCanvasImage(r), "image/png"); +}; +_a.jpg = function(r) { + return Pf(r, this.bufferCanvasImage(r), "image/jpeg"); +}; +var Af = {}; +Af.nodeShapeImpl = function(r, e, t, a, n, i, s, o) { + switch (r) { + case "ellipse": + return this.drawEllipsePath(e, t, a, n, i); + case "polygon": + return this.drawPolygonPath(e, t, a, n, i, s); + case "round-polygon": + return this.drawRoundPolygonPath(e, t, a, n, i, s, o); + case "roundrectangle": + case "round-rectangle": + return this.drawRoundRectanglePath(e, t, a, n, i, o); + case "cutrectangle": + case "cut-rectangle": + return this.drawCutRectanglePath(e, t, a, n, i, s, o); + case "bottomroundrectangle": + case "bottom-round-rectangle": + return this.drawBottomRoundRectanglePath(e, t, a, n, i, o); + case "barrel": + return this.drawBarrelPath(e, t, a, n, i); + } +}; +var vm = Rf, Te = Rf.prototype; +Te.CANVAS_LAYERS = 3; +Te.SELECT_BOX = 0; +Te.DRAG = 1; +Te.NODE = 2; +Te.WEBGL = 3; +Te.CANVAS_TYPES = ["2d", "2d", "2d", "webgl2"]; +Te.BUFFER_COUNT = 3; +Te.TEXTURE_BUFFER = 0; +Te.MOTIONBLUR_BUFFER_NODE = 1; +Te.MOTIONBLUR_BUFFER_DRAG = 2; +function Rf(r) { + var e = this, t = e.cy.window(), a = t.document; + r.webgl && (Te.CANVAS_LAYERS = e.CANVAS_LAYERS = 4, console.log("webgl rendering enabled")), e.data = { + canvases: new Array(Te.CANVAS_LAYERS), + contexts: new Array(Te.CANVAS_LAYERS), + canvasNeedsRedraw: new Array(Te.CANVAS_LAYERS), + bufferCanvases: new Array(Te.BUFFER_COUNT), + bufferContexts: new Array(Te.CANVAS_LAYERS) + }; + var n = "-webkit-tap-highlight-color", i = "rgba(0,0,0,0)"; + e.data.canvasContainer = a.createElement("div"); + var s = e.data.canvasContainer.style; + e.data.canvasContainer.style[n] = i, s.position = "relative", s.zIndex = "0", s.overflow = "hidden"; + var o = r.cy.container(); + o.appendChild(e.data.canvasContainer), o.style[n] = i; + var l = { + "-webkit-user-select": "none", + "-moz-user-select": "-moz-none", + "user-select": "none", + "-webkit-tap-highlight-color": "rgba(0,0,0,0)", + "outline-style": "none" + }; + uc() && (l["-ms-touch-action"] = "none", l["touch-action"] = "none"); + for (var u = 0; u < Te.CANVAS_LAYERS; u++) { + var v = e.data.canvases[u] = a.createElement("canvas"), f = Te.CANVAS_TYPES[u]; + e.data.contexts[u] = v.getContext(f), e.data.contexts[u] || He("Could not create canvas of type " + f), Object.keys(l).forEach(function(J) { + v.style[J] = l[J]; + }), v.style.position = "absolute", v.setAttribute("data-id", "layer" + u), v.style.zIndex = String(Te.CANVAS_LAYERS - u), e.data.canvasContainer.appendChild(v), e.data.canvasNeedsRedraw[u] = !1; + } + e.data.topCanvas = e.data.canvases[0], e.data.canvases[Te.NODE].setAttribute("data-id", "layer" + Te.NODE + "-node"), e.data.canvases[Te.SELECT_BOX].setAttribute("data-id", "layer" + Te.SELECT_BOX + "-selectbox"), e.data.canvases[Te.DRAG].setAttribute("data-id", "layer" + Te.DRAG + "-drag"), e.data.canvases[Te.WEBGL] && e.data.canvases[Te.WEBGL].setAttribute("data-id", "layer" + Te.WEBGL + "-webgl"); + for (var u = 0; u < Te.BUFFER_COUNT; u++) + e.data.bufferCanvases[u] = a.createElement("canvas"), e.data.bufferContexts[u] = e.data.bufferCanvases[u].getContext("2d"), e.data.bufferCanvases[u].style.position = "absolute", e.data.bufferCanvases[u].setAttribute("data-id", "buffer" + u), e.data.bufferCanvases[u].style.zIndex = String(-u - 1), e.data.bufferCanvases[u].style.visibility = "hidden"; + e.pathsEnabled = !0; + var c = Sr(), h = function(z) { + return { + x: (z.x1 + z.x2) / 2, + y: (z.y1 + z.y2) / 2 + }; + }, d = function(z) { + return { + x: -z.w / 2, + y: -z.h / 2 + }; + }, y = function(z) { + var q = z[0]._private, H = q.oldBackgroundTimestamp === q.backgroundTimestamp; + return !H; + }, g = function(z) { + return z[0]._private.nodeKey; + }, p = function(z) { + return z[0]._private.labelStyleKey; + }, m = function(z) { + return z[0]._private.sourceLabelStyleKey; + }, b = function(z) { + return z[0]._private.targetLabelStyleKey; + }, w = function(z, q, H, ee, ne) { + return e.drawElement(z, q, H, !1, !1, ne); + }, E = function(z, q, H, ee, ne) { + return e.drawElementText(z, q, H, ee, "main", ne); + }, C = function(z, q, H, ee, ne) { + return e.drawElementText(z, q, H, ee, "source", ne); + }, x = function(z, q, H, ee, ne) { + return e.drawElementText(z, q, H, ee, "target", ne); + }, k = function(z) { + return z.boundingBox(), z[0]._private.bodyBounds; + }, S = function(z) { + return z.boundingBox(), z[0]._private.labelBounds.main || c; + }, P = function(z) { + return z.boundingBox(), z[0]._private.labelBounds.source || c; + }, D = function(z) { + return z.boundingBox(), z[0]._private.labelBounds.target || c; + }, A = function(z, q) { + return q; + }, B = function(z) { + return h(k(z)); + }, R = function(z, q, H) { + var ee = z ? z + "-" : ""; + return { + x: q.x + H.pstyle(ee + "text-margin-x").pfValue, + y: q.y + H.pstyle(ee + "text-margin-y").pfValue + }; + }, M = function(z, q, H) { + var ee = z[0]._private.rscratch; + return { + x: ee[q], + y: ee[H] + }; + }, I = function(z) { + return R("", M(z, "labelX", "labelY"), z); + }, L = function(z) { + return R("source", M(z, "sourceLabelX", "sourceLabelY"), z); + }, O = function(z) { + return R("target", M(z, "targetLabelX", "targetLabelY"), z); + }, V = function(z) { + return d(k(z)); + }, G = function(z) { + return d(P(z)); + }, N = function(z) { + return d(D(z)); + }, F = function(z) { + var q = S(z), H = d(S(z)); + if (z.isNode()) { + switch (z.pstyle("text-halign").value) { + case "left": + H.x = -q.w - (q.leftPad || 0); + break; + case "right": + H.x = -(q.rightPad || 0); + break; + } + switch (z.pstyle("text-valign").value) { + case "top": + H.y = -q.h - (q.topPad || 0); + break; + case "bottom": + H.y = -(q.botPad || 0); + break; + } + } + return H; + }, K = e.data.eleTxrCache = new pa(e, { + getKey: g, + doesEleInvalidateKey: y, + drawElement: w, + getBoundingBox: k, + getRotationPoint: B, + getRotationOffset: V, + allowEdgeTxrCaching: !1, + allowParentTxrCaching: !1 + }), X = e.data.lblTxrCache = new pa(e, { + getKey: p, + drawElement: E, + getBoundingBox: S, + getRotationPoint: I, + getRotationOffset: F, + isVisible: A + }), Q = e.data.slbTxrCache = new pa(e, { + getKey: m, + drawElement: C, + getBoundingBox: P, + getRotationPoint: L, + getRotationOffset: G, + isVisible: A + }), Z = e.data.tlbTxrCache = new pa(e, { + getKey: b, + drawElement: x, + getBoundingBox: D, + getRotationPoint: O, + getRotationOffset: N, + isVisible: A + }), re = e.data.lyrTxrCache = new mf(e); + e.onUpdateEleCalcs(function(z, q) { + K.invalidateElements(q), X.invalidateElements(q), Q.invalidateElements(q), Z.invalidateElements(q), re.invalidateElements(q); + for (var H = 0; H < q.length; H++) { + var ee = q[H]._private; + ee.oldBackgroundTimestamp = ee.backgroundTimestamp; + } + }); + var ae = function(z) { + for (var q = 0; q < z.length; q++) + re.enqueueElementRefinement(z[q].ele); + }; + K.onDequeue(ae), X.onDequeue(ae), Q.onDequeue(ae), Z.onDequeue(ae), r.webgl && e.initWebgl(r, { + getStyleKey: g, + getLabelKey: p, + getSourceLabelKey: m, + getTargetLabelKey: b, + drawElement: w, + drawLabel: E, + drawSourceLabel: C, + drawTargetLabel: x, + getElementBox: k, + getLabelBox: S, + getSourceLabelBox: P, + getTargetLabelBox: D, + getElementRotationPoint: B, + getElementRotationOffset: V, + getLabelRotationPoint: I, + getSourceLabelRotationPoint: L, + getTargetLabelRotationPoint: O, + getLabelRotationOffset: F, + getSourceLabelRotationOffset: G, + getTargetLabelRotationOffset: N + }); +} +Te.redrawHint = function(r, e) { + var t = this; + switch (r) { + case "eles": + t.data.canvasNeedsRedraw[Te.NODE] = e; + break; + case "drag": + t.data.canvasNeedsRedraw[Te.DRAG] = e; + break; + case "select": + t.data.canvasNeedsRedraw[Te.SELECT_BOX] = e; + break; + case "gc": + t.data.gc = !0; + break; + } +}; +var fm = typeof Path2D < "u"; +Te.path2dEnabled = function(r) { + if (r === void 0) + return this.pathsEnabled; + this.pathsEnabled = !!r; +}; +Te.usePaths = function() { + return fm && this.pathsEnabled; +}; +Te.setImgSmoothing = function(r, e) { + r.imageSmoothingEnabled != null ? r.imageSmoothingEnabled = e : (r.webkitImageSmoothingEnabled = e, r.mozImageSmoothingEnabled = e, r.msImageSmoothingEnabled = e); +}; +Te.getImgSmoothing = function(r) { + return r.imageSmoothingEnabled != null ? r.imageSmoothingEnabled : r.webkitImageSmoothingEnabled || r.mozImageSmoothingEnabled || r.msImageSmoothingEnabled; +}; +Te.makeOffscreenCanvas = function(r, e) { + var t; + if ((typeof OffscreenCanvas > "u" ? "undefined" : rr(OffscreenCanvas)) !== "undefined") + t = new OffscreenCanvas(r, e); + else { + var a = this.cy.window(), n = a.document; + t = n.createElement("canvas"), t.width = r, t.height = e; + } + return t; +}; +[bf, Hr, Qr, go, At, dt, mr, Tf, ht, _a, Af].forEach(function(r) { + he(Te, r); +}); +var cm = [{ + name: "null", + impl: nf +}, { + name: "base", + impl: gf +}, { + name: "canvas", + impl: vm +}], dm = [{ + type: "layout", + extensions: Vp +}, { + type: "renderer", + extensions: cm +}], Mf = {}, Lf = {}; +function If(r, e, t) { + var a = t, n = function(k) { + Le("Can not register `" + e + "` for `" + r + "` since `" + k + "` already exists in the prototype and can not be overridden"); + }; + if (r === "core") { + if (Ba.prototype[e]) + return n(e); + Ba.prototype[e] = t; + } else if (r === "collection") { + if (vr.prototype[e]) + return n(e); + vr.prototype[e] = t; + } else if (r === "layout") { + for (var i = function(k) { + this.options = k, t.call(this, k), Pe(this._private) || (this._private = {}), this._private.cy = k.cy, this._private.listeners = [], this.createEmitter(); + }, s = i.prototype = Object.create(t.prototype), o = [], l = 0; l < o.length; l++) { + var u = o[l]; + s[u] = s[u] || function() { + return this; + }; + } + s.start && !s.run ? s.run = function() { + return this.start(), this; + } : !s.start && s.run && (s.start = function() { + return this.run(), this; + }); + var v = t.prototype.stop; + s.stop = function() { + var x = this.options; + if (x && x.animate) { + var k = this.animations; + if (k) + for (var S = 0; S < k.length; S++) + k[S].stop(); + } + return v ? v.call(this) : this.emit("layoutstop"), this; + }, s.destroy || (s.destroy = function() { + return this; + }), s.cy = function() { + return this._private.cy; + }; + var f = function(k) { + return k._private.cy; + }, c = { + addEventFields: function(k, S) { + S.layout = k, S.cy = f(k), S.target = k; + }, + bubble: function() { + return !0; + }, + parent: function(k) { + return f(k); + } + }; + he(s, { + createEmitter: function() { + return this._private.emitter = new qn(c, this), this; + }, + emitter: function() { + return this._private.emitter; + }, + on: function(k, S) { + return this.emitter().on(k, S), this; + }, + one: function(k, S) { + return this.emitter().one(k, S), this; + }, + once: function(k, S) { + return this.emitter().one(k, S), this; + }, + removeListener: function(k, S) { + return this.emitter().removeListener(k, S), this; + }, + removeAllListeners: function() { + return this.emitter().removeAllListeners(), this; + }, + emit: function(k, S) { + return this.emitter().emit(k, S), this; + } + }), Me.eventAliasesOn(s), a = i; + } else if (r === "renderer" && e !== "null" && e !== "base") { + var h = Of("renderer", "base"), d = h.prototype, y = t, g = t.prototype, p = function() { + h.apply(this, arguments), y.apply(this, arguments); + }, m = p.prototype; + for (var b in d) { + var w = d[b], E = g[b] != null; + if (E) + return n(b); + m[b] = w; + } + for (var C in g) + m[C] = g[C]; + d.clientFunctions.forEach(function(x) { + m[x] = m[x] || function() { + He("Renderer does not implement `renderer." + x + "()` on its prototype"); + }; + }), a = p; + } else if (r === "__proto__" || r === "constructor" || r === "prototype") + return He(r + " is an illegal type to be registered, possibly lead to prototype pollutions"); + return ev({ + map: Mf, + keys: [r, e], + value: a + }); +} +function Of(r, e) { + return rv({ + map: Mf, + keys: [r, e] + }); +} +function hm(r, e, t, a, n) { + return ev({ + map: Lf, + keys: [r, e, t, a], + value: n + }); +} +function gm(r, e, t, a) { + return rv({ + map: Lf, + keys: [r, e, t, a] + }); +} +var Ws = function() { + if (arguments.length === 2) + return Of.apply(null, arguments); + if (arguments.length === 3) + return If.apply(null, arguments); + if (arguments.length === 4) + return gm.apply(null, arguments); + if (arguments.length === 5) + return hm.apply(null, arguments); + He("Invalid extension access syntax"); +}; +Ba.prototype.extension = Ws; +dm.forEach(function(r) { + r.extensions.forEach(function(e) { + If(r.type, e.name, e.impl); + }); +}); +var Pn = function() { + if (!(this instanceof Pn)) + return new Pn(); + this.length = 0; +}, Bt = Pn.prototype; +Bt.instanceString = function() { + return "stylesheet"; +}; +Bt.selector = function(r) { + var e = this.length++; + return this[e] = { + selector: r, + properties: [] + }, this; +}; +Bt.css = function(r, e) { + var t = this.length - 1; + if (fe(r)) + this[t].properties.push({ + name: r, + value: e + }); + else if (Pe(r)) + for (var a = r, n = Object.keys(a), i = 0; i < n.length; i++) { + var s = n[i], o = a[s]; + if (o != null) { + var l = ir.properties[s] || ir.properties[An(s)]; + if (l != null) { + var u = l.name, v = o; + this[t].properties.push({ + name: u, + value: v + }); + } + } + } + return this; +}; +Bt.style = Bt.css; +Bt.generateStyle = function(r) { + var e = new ir(r); + return this.appendToStyle(e); +}; +Bt.appendToStyle = function(r) { + for (var e = 0; e < this.length; e++) { + var t = this[e], a = t.selector, n = t.properties; + r.selector(a); + for (var i = 0; i < n.length; i++) { + var s = n[i]; + r.css(s.name, s.value); + } + } + return r; +}; +var pm = "3.32.0", Jt = function(e) { + if (e === void 0 && (e = {}), Pe(e)) + return new Ba(e); + if (fe(e)) + return Ws.apply(Ws, arguments); +}; +Jt.use = function(r) { + var e = Array.prototype.slice.call(arguments, 1); + return e.unshift(Jt), r.apply(null, e), this; +}; +Jt.warnings = function(r) { + return uv(r); +}; +Jt.version = pm; +Jt.stylesheet = Jt.Stylesheet = Pn; +export { + Jt as c +}; diff --git a/backend/fastrtc/templates/component/dagre-OKDRZEBW-7tjnWrwm.js b/backend/fastrtc/templates/component/dagre-OKDRZEBW-7tjnWrwm.js new file mode 100644 index 0000000..eff48c6 --- /dev/null +++ b/backend/fastrtc/templates/component/dagre-OKDRZEBW-7tjnWrwm.js @@ -0,0 +1,447 @@ +import { _ as X, aq as F, ar as Y, as as _, at as H, l as i, d as V, au as q, av as U, af as $, ak as z, ag as P, ae as K, aw as Q, ax as W, ay as Z } from "./mermaid.core-Cmyps_S7.js"; +import { G as B } from "./graph-BaPzJnYr.js"; +import { l as I } from "./layout-ZrEF_W9p.js"; +import { i as x } from "./_baseUniq-BN26mYqf.js"; +import { c as L } from "./clone-Bt-5RraT.js"; +import { m as A } from "./_basePickBy-Bz_aTL3_.js"; +function p(e) { + var t = { + options: { + directed: e.isDirected(), + multigraph: e.isMultigraph(), + compound: e.isCompound() + }, + nodes: ee(e), + edges: ne(e) + }; + return x(e.graph()) || (t.value = L(e.graph())), t; +} +function ee(e) { + return A(e.nodes(), function(t) { + var n = e.node(t), o = e.parent(t), c = { v: t }; + return x(n) || (c.value = n), x(o) || (c.parent = o), c; + }); +} +function ne(e) { + return A(e.edges(), function(t) { + var n = e.edge(t), o = { v: t.v, w: t.w }; + return x(t.name) || (o.name = t.name), x(n) || (o.value = n), o; + }); +} +var f = /* @__PURE__ */ new Map(), b = /* @__PURE__ */ new Map(), J = /* @__PURE__ */ new Map(), te = /* @__PURE__ */ X(() => { + b.clear(), J.clear(), f.clear(); +}, "clear"), O = /* @__PURE__ */ X((e, t) => { + const n = b.get(t) || []; + return i.trace("In isDescendant", t, " ", e, " = ", n.includes(e)), n.includes(e); +}, "isDescendant"), se = /* @__PURE__ */ X((e, t) => { + const n = b.get(t) || []; + return i.info("Descendants of ", t, " is ", n), i.info("Edge is ", e), e.v === t || e.w === t ? !1 : n ? n.includes(e.v) || O(e.v, t) || O(e.w, t) || n.includes(e.w) : (i.debug("Tilt, ", t, ",not in descendants"), !1); +}, "edgeInCluster"), G = /* @__PURE__ */ X((e, t, n, o) => { + i.warn( + "Copying children of ", + e, + "root", + o, + "data", + t.node(e), + o + ); + const c = t.children(e) || []; + e !== o && c.push(e), i.warn("Copying (nodes) clusterId", e, "nodes", c), c.forEach((a) => { + if (t.children(a).length > 0) + G(a, t, n, o); + else { + const r = t.node(a); + i.info("cp ", a, " to ", o, " with parent ", e), n.setNode(a, r), o !== t.parent(a) && (i.warn("Setting parent", a, t.parent(a)), n.setParent(a, t.parent(a))), e !== o && a !== e ? (i.debug("Setting parent", a, e), n.setParent(a, e)) : (i.info("In copy ", e, "root", o, "data", t.node(e), o), i.debug( + "Not Setting parent for node=", + a, + "cluster!==rootId", + e !== o, + "node!==clusterId", + a !== e + )); + const u = t.edges(a); + i.debug("Copying Edges", u), u.forEach((l) => { + i.info("Edge", l); + const h = t.edge(l.v, l.w, l.name); + i.info("Edge data", h, o); + try { + se(l, o) ? (i.info("Copying as ", l.v, l.w, h, l.name), n.setEdge(l.v, l.w, h, l.name), i.info("newGraph edges ", n.edges(), n.edge(n.edges()[0]))) : i.info( + "Skipping copy of edge ", + l.v, + "-->", + l.w, + " rootId: ", + o, + " clusterId:", + e + ); + } catch (C) { + i.error(C); + } + }); + } + i.debug("Removing node", a), t.removeNode(a); + }); +}, "copy"), R = /* @__PURE__ */ X((e, t) => { + const n = t.children(e); + let o = [...n]; + for (const c of n) + J.set(c, e), o = [...o, ...R(c, t)]; + return o; +}, "extractDescendants"), ie = /* @__PURE__ */ X((e, t, n) => { + const o = e.edges().filter((l) => l.v === t || l.w === t), c = e.edges().filter((l) => l.v === n || l.w === n), a = o.map((l) => ({ v: l.v === t ? n : l.v, w: l.w === t ? t : l.w })), r = c.map((l) => ({ v: l.v, w: l.w })); + return a.filter((l) => r.some((h) => l.v === h.v && l.w === h.w)); +}, "findCommonEdges"), D = /* @__PURE__ */ X((e, t, n) => { + const o = t.children(e); + if (i.trace("Searching children of id ", e, o), o.length < 1) + return e; + let c; + for (const a of o) { + const r = D(a, t, n), u = ie(t, n, r); + if (r) + if (u.length > 0) + c = r; + else + return r; + } + return c; +}, "findNonClusterChild"), k = /* @__PURE__ */ X((e) => !f.has(e) || !f.get(e).externalConnections ? e : f.has(e) ? f.get(e).id : e, "getAnchorId"), re = /* @__PURE__ */ X((e, t) => { + if (!e || t > 10) { + i.debug("Opting out, no graph "); + return; + } else + i.debug("Opting in, graph "); + e.nodes().forEach(function(n) { + e.children(n).length > 0 && (i.warn( + "Cluster identified", + n, + " Replacement id in edges: ", + D(n, e, n) + ), b.set(n, R(n, e)), f.set(n, { id: D(n, e, n), clusterData: e.node(n) })); + }), e.nodes().forEach(function(n) { + const o = e.children(n), c = e.edges(); + o.length > 0 ? (i.debug("Cluster identified", n, b), c.forEach((a) => { + const r = O(a.v, n), u = O(a.w, n); + r ^ u && (i.warn("Edge: ", a, " leaves cluster ", n), i.warn("Descendants of XXX ", n, ": ", b.get(n)), f.get(n).externalConnections = !0); + })) : i.debug("Not a cluster ", n, b); + }); + for (let n of f.keys()) { + const o = f.get(n).id, c = e.parent(o); + c !== n && f.has(c) && !f.get(c).externalConnections && (f.get(n).id = c); + } + e.edges().forEach(function(n) { + const o = e.edge(n); + i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(n)), i.warn("Edge " + n.v + " -> " + n.w + ": " + JSON.stringify(e.edge(n))); + let c = n.v, a = n.w; + if (i.warn( + "Fix XXX", + f, + "ids:", + n.v, + n.w, + "Translating: ", + f.get(n.v), + " --- ", + f.get(n.w) + ), f.get(n.v) || f.get(n.w)) { + if (i.warn("Fixing and trying - removing XXX", n.v, n.w, n.name), c = k(n.v), a = k(n.w), e.removeEdge(n.v, n.w, n.name), c !== n.v) { + const r = e.parent(c); + f.get(r).externalConnections = !0, o.fromCluster = n.v; + } + if (a !== n.w) { + const r = e.parent(a); + f.get(r).externalConnections = !0, o.toCluster = n.w; + } + i.warn("Fix Replacing with XXX", c, a, n.name), e.setEdge(c, a, o, n.name); + } + }), i.warn("Adjusted Graph", p(e)), T(e, 0), i.trace(f); +}, "adjustClustersAndEdges"), T = /* @__PURE__ */ X((e, t) => { + var c, a; + if (i.warn("extractor - ", t, p(e), e.children("D")), t > 10) { + i.error("Bailing out"); + return; + } + let n = e.nodes(), o = !1; + for (const r of n) { + const u = e.children(r); + o = o || u.length > 0; + } + if (!o) { + i.debug("Done, no node has children", e.nodes()); + return; + } + i.debug("Nodes = ", n, t); + for (const r of n) + if (i.debug( + "Extracting node", + r, + f, + f.has(r) && !f.get(r).externalConnections, + !e.parent(r), + e.node(r), + e.children("D"), + " Depth ", + t + ), !f.has(r)) + i.debug("Not a cluster", r, t); + else if (!f.get(r).externalConnections && e.children(r) && e.children(r).length > 0) { + i.warn( + "Cluster without external connections, without a parent and with children", + r, + t + ); + let l = e.graph().rankdir === "TB" ? "LR" : "TB"; + (a = (c = f.get(r)) == null ? void 0 : c.clusterData) != null && a.dir && (l = f.get(r).clusterData.dir, i.warn("Fixing dir", f.get(r).clusterData.dir, l)); + const h = new B({ + multigraph: !0, + compound: !0 + }).setGraph({ + rankdir: l, + nodesep: 50, + ranksep: 50, + marginx: 8, + marginy: 8 + }).setDefaultEdgeLabel(function() { + return {}; + }); + i.warn("Old graph before copy", p(e)), G(r, e, h, r), e.setNode(r, { + clusterNode: !0, + id: r, + clusterData: f.get(r).clusterData, + label: f.get(r).label, + graph: h + }), i.warn("New graph after copy node: (", r, ")", p(h)), i.debug("Old graph after copy", p(e)); + } else + i.warn( + "Cluster ** ", + r, + " **not meeting the criteria !externalConnections:", + !f.get(r).externalConnections, + " no parent: ", + !e.parent(r), + " children ", + e.children(r) && e.children(r).length > 0, + e.children("D"), + t + ), i.debug(f); + n = e.nodes(), i.warn("New list of nodes", n); + for (const r of n) { + const u = e.node(r); + i.warn(" Now next level", r, u), u != null && u.clusterNode && T(u.graph, t + 1); + } +}, "extractor"), M = /* @__PURE__ */ X((e, t) => { + if (t.length === 0) + return []; + let n = Object.assign([], t); + return t.forEach((o) => { + const c = e.children(o), a = M(e, c); + n = [...n, ...a]; + }), n; +}, "sorter"), oe = /* @__PURE__ */ X((e) => M(e, e.children()), "sortNodesByHierarchy"), j = /* @__PURE__ */ X(async (e, t, n, o, c, a) => { + i.warn("Graph in recursive render:XAX", p(t), c); + const r = t.graph().rankdir; + i.trace("Dir in recursive render - dir:", r); + const u = e.insert("g").attr("class", "root"); + t.nodes() ? i.info("Recursive render XXX", t.nodes()) : i.info("No nodes found for", t), t.edges().length > 0 && i.info("Recursive edges", t.edge(t.edges()[0])); + const l = u.insert("g").attr("class", "clusters"), h = u.insert("g").attr("class", "edgePaths"), C = u.insert("g").attr("class", "edgeLabels"), g = u.insert("g").attr("class", "nodes"); + await Promise.all( + t.nodes().map(async function(d) { + const s = t.node(d); + if (c !== void 0) { + const w = JSON.parse(JSON.stringify(c.clusterData)); + i.trace( + `Setting data for parent cluster XXX + Node.id = `, + d, + ` + data=`, + w.height, + ` +Parent cluster`, + c.height + ), t.setNode(c.id, w), t.parent(d) || (i.trace("Setting parent", d, c.id), t.setParent(d, c.id, w)); + } + if (i.info("(Insert) Node XXX" + d + ": " + JSON.stringify(t.node(d))), s != null && s.clusterNode) { + i.info("Cluster identified XBX", d, s.width, t.node(d)); + const { ranksep: w, nodesep: m } = t.graph(); + s.graph.setGraph({ + ...s.graph.graph(), + ranksep: w + 25, + nodesep: m + }); + const N = await j( + g, + s.graph, + n, + o, + t.node(d), + a + ), S = N.elem; + q(s, S), s.diff = N.diff || 0, i.info( + "New compound node after recursive render XAX", + d, + "width", + // node, + s.width, + "height", + s.height + // node.x, + // node.y + ), U(S, s); + } else + t.children(d).length > 0 ? (i.trace( + "Cluster - the non recursive path XBX", + d, + s.id, + s, + s.width, + "Graph:", + t + ), i.trace(D(s.id, t)), f.set(s.id, { id: D(s.id, t), node: s })) : (i.trace("Node - the non recursive path XAX", d, g, t.node(d), r), await $(g, t.node(d), { config: a, dir: r })); + }) + ), await (/* @__PURE__ */ X(async () => { + const d = t.edges().map(async function(s) { + const w = t.edge(s.v, s.w, s.name); + i.info("Edge " + s.v + " -> " + s.w + ": " + JSON.stringify(s)), i.info("Edge " + s.v + " -> " + s.w + ": ", s, " ", JSON.stringify(t.edge(s))), i.info( + "Fix", + f, + "ids:", + s.v, + s.w, + "Translating: ", + f.get(s.v), + f.get(s.w) + ), await Z(C, w); + }); + await Promise.all(d); + }, "processEdges"))(), i.info("Graph before layout:", JSON.stringify(p(t))), i.info("############################################# XXX"), i.info("### Layout ### XXX"), i.info("############################################# XXX"), I(t), i.info("Graph after layout:", JSON.stringify(p(t))); + let E = 0, { subGraphTitleTotalMargin: y } = z(a); + return await Promise.all( + oe(t).map(async function(d) { + var w; + const s = t.node(d); + if (i.info( + "Position XBX => " + d + ": (" + s.x, + "," + s.y, + ") width: ", + s.width, + " height: ", + s.height + ), s != null && s.clusterNode) + s.y += y, i.info( + "A tainted cluster node XBX1", + d, + s.id, + s.width, + s.height, + s.x, + s.y, + t.parent(d) + ), f.get(s.id).node = s, P(s); + else if (t.children(d).length > 0) { + i.info( + "A pure cluster node XBX1", + d, + s.id, + s.x, + s.y, + s.width, + s.height, + t.parent(d) + ), s.height += y, t.node(s.parentId); + const m = (s == null ? void 0 : s.padding) / 2 || 0, N = ((w = s == null ? void 0 : s.labelBBox) == null ? void 0 : w.height) || 0, S = N - m || 0; + i.debug("OffsetY", S, "labelHeight", N, "halfPadding", m), await K(l, s), f.get(s.id).node = s; + } else { + const m = t.node(s.parentId); + s.y += y / 2, i.info( + "A regular node XBX1 - using the padding", + s.id, + "parent", + s.parentId, + s.width, + s.height, + s.x, + s.y, + "offsetY", + s.offsetY, + "parent", + m, + m == null ? void 0 : m.offsetY, + s + ), P(s); + } + }) + ), t.edges().forEach(function(d) { + const s = t.edge(d); + i.info("Edge " + d.v + " -> " + d.w + ": " + JSON.stringify(s), s), s.points.forEach((S) => S.y += y / 2); + const w = t.node(d.v); + var m = t.node(d.w); + const N = Q(h, s, f, n, w, m, o); + W(s, N); + }), t.nodes().forEach(function(d) { + const s = t.node(d); + i.info(d, s.type, s.diff), s.isGroup && (E = s.diff); + }), i.warn("Returning from recursive render XAX", u, E), { elem: u, diff: E }; +}, "recursiveRender"), ge = /* @__PURE__ */ X(async (e, t) => { + var a, r, u, l, h, C; + const n = new B({ + multigraph: !0, + compound: !0 + }).setGraph({ + rankdir: e.direction, + nodesep: ((a = e.config) == null ? void 0 : a.nodeSpacing) || ((u = (r = e.config) == null ? void 0 : r.flowchart) == null ? void 0 : u.nodeSpacing) || e.nodeSpacing, + ranksep: ((l = e.config) == null ? void 0 : l.rankSpacing) || ((C = (h = e.config) == null ? void 0 : h.flowchart) == null ? void 0 : C.rankSpacing) || e.rankSpacing, + marginx: 8, + marginy: 8 + }).setDefaultEdgeLabel(function() { + return {}; + }), o = t.select("g"); + F(o, e.markers, e.type, e.diagramId), Y(), _(), H(), te(), e.nodes.forEach((g) => { + n.setNode(g.id, { ...g }), g.parentId && n.setParent(g.id, g.parentId); + }), i.debug("Edges:", e.edges), e.edges.forEach((g) => { + if (g.start === g.end) { + const v = g.start, E = v + "---" + v + "---1", y = v + "---" + v + "---2", d = n.node(v); + n.setNode(E, { + domId: E, + id: E, + parentId: d.parentId, + labelStyle: "", + label: "", + padding: 0, + shape: "labelRect", + // shape: 'rect', + style: "", + width: 10, + height: 10 + }), n.setParent(E, d.parentId), n.setNode(y, { + domId: y, + id: y, + parentId: d.parentId, + labelStyle: "", + padding: 0, + // shape: 'rect', + shape: "labelRect", + label: "", + style: "", + width: 10, + height: 10 + }), n.setParent(y, d.parentId); + const s = structuredClone(g), w = structuredClone(g), m = structuredClone(g); + s.label = "", s.arrowTypeEnd = "none", s.id = v + "-cyclic-special-1", w.arrowTypeStart = "none", w.arrowTypeEnd = "none", w.id = v + "-cyclic-special-mid", m.label = "", d.isGroup && (s.fromCluster = v, m.toCluster = v), m.id = v + "-cyclic-special-2", m.arrowTypeStart = "none", n.setEdge(v, E, s, v + "-cyclic-special-0"), n.setEdge(E, y, w, v + "-cyclic-special-1"), n.setEdge(y, v, m, v + "-cyc y({ + ...B, + ...C().radar +}), "getConfig"), b = /* @__PURE__ */ l(() => h.axes, "getAxes"), K = /* @__PURE__ */ l(() => h.curves, "getCurves"), N = /* @__PURE__ */ l(() => h.options, "getOptions"), U = /* @__PURE__ */ l((a) => { + h.axes = a.map((t) => ({ + name: t.name, + label: t.label ?? t.name + })); +}, "setAxes"), X = /* @__PURE__ */ l((a) => { + h.curves = a.map((t) => ({ + name: t.name, + label: t.label ?? t.name, + entries: Y(t.entries) + })); +}, "setCurves"), Y = /* @__PURE__ */ l((a) => { + if (a[0].axis == null) + return a.map((e) => e.value); + const t = b(); + if (t.length === 0) + throw new Error("Axes must be populated before curves for reference entries"); + return t.map((e) => { + const r = a.find((s) => { + var o; + return ((o = s.axis) == null ? void 0 : o.$refText) === e.name; + }); + if (r === void 0) + throw new Error("Missing entry for axis " + e.label); + return r.value; + }); +}, "computeCurveEntries"), Z = /* @__PURE__ */ l((a) => { + var e, r, s, o, i; + const t = a.reduce( + (n, c) => (n[c.name] = c, n), + {} + ); + h.options = { + showLegend: ((e = t.showLegend) == null ? void 0 : e.value) ?? x.showLegend, + ticks: ((r = t.ticks) == null ? void 0 : r.value) ?? x.ticks, + max: ((s = t.max) == null ? void 0 : s.value) ?? x.max, + min: ((o = t.min) == null ? void 0 : o.value) ?? x.min, + graticule: ((i = t.graticule) == null ? void 0 : i.value) ?? x.graticule + }; +}, "setOptions"), q = /* @__PURE__ */ l(() => { + z(), h = structuredClone(w); +}, "clear"), $ = { + getAxes: b, + getCurves: K, + getOptions: N, + setAxes: U, + setCurves: X, + setOptions: Z, + getConfig: j, + clear: q, + setAccTitle: E, + getAccTitle: I, + setDiagramTitle: _, + getDiagramTitle: D, + getAccDescription: F, + setAccDescription: G +}, J = /* @__PURE__ */ l((a) => { + k(a, $); + const { axes: t, curves: e, options: r } = a; + $.setAxes(t), $.setCurves(e), $.setOptions(r); +}, "populate"), Q = { + parse: /* @__PURE__ */ l(async (a) => { + const t = await W("radar", a); + P.debug(t), J(t); + }, "parse") +}, tt = /* @__PURE__ */ l((a, t, e, r) => { + const s = r.db, o = s.getAxes(), i = s.getCurves(), n = s.getOptions(), c = s.getConfig(), d = s.getDiagramTitle(), p = H(t), u = et(p, c), g = n.max ?? Math.max(...i.map((f) => Math.max(...f.entries))), m = n.min, v = Math.min(c.width, c.height) / 2; + at(u, o, v, n.ticks, n.graticule), rt(u, o, v, c), M(u, o, i, m, g, n.graticule, c), T(u, i, n.showLegend, c), u.append("text").attr("class", "radarTitle").text(d).attr("x", 0).attr("y", -c.height / 2 - c.marginTop); +}, "draw"), et = /* @__PURE__ */ l((a, t) => { + const e = t.width + t.marginLeft + t.marginRight, r = t.height + t.marginTop + t.marginBottom, s = { + x: t.marginLeft + t.width / 2, + y: t.marginTop + t.height / 2 + }; + return a.attr("viewbox", `0 0 ${e} ${r}`).attr("width", e).attr("height", r), a.append("g").attr("transform", `translate(${s.x}, ${s.y})`); +}, "drawFrame"), at = /* @__PURE__ */ l((a, t, e, r, s) => { + if (s === "circle") + for (let o = 0; o < r; o++) { + const i = e * (o + 1) / r; + a.append("circle").attr("r", i).attr("class", "radarGraticule"); + } + else if (s === "polygon") { + const o = t.length; + for (let i = 0; i < r; i++) { + const n = e * (i + 1) / r, c = t.map((d, p) => { + const u = 2 * p * Math.PI / o - Math.PI / 2, g = n * Math.cos(u), m = n * Math.sin(u); + return `${g},${m}`; + }).join(" "); + a.append("polygon").attr("points", c).attr("class", "radarGraticule"); + } + } +}, "drawGraticule"), rt = /* @__PURE__ */ l((a, t, e, r) => { + const s = t.length; + for (let o = 0; o < s; o++) { + const i = t[o].label, n = 2 * o * Math.PI / s - Math.PI / 2; + a.append("line").attr("x1", 0).attr("y1", 0).attr("x2", e * r.axisScaleFactor * Math.cos(n)).attr("y2", e * r.axisScaleFactor * Math.sin(n)).attr("class", "radarAxisLine"), a.append("text").text(i).attr("x", e * r.axisLabelFactor * Math.cos(n)).attr("y", e * r.axisLabelFactor * Math.sin(n)).attr("class", "radarAxisLabel"); + } +}, "drawAxes"); +function M(a, t, e, r, s, o, i) { + const n = t.length, c = Math.min(i.width, i.height) / 2; + e.forEach((d, p) => { + if (d.entries.length !== n) + return; + const u = d.entries.map((g, m) => { + const v = 2 * Math.PI * m / n - Math.PI / 2, f = A(g, r, s, c), O = f * Math.cos(v), S = f * Math.sin(v); + return { x: O, y: S }; + }); + o === "circle" ? a.append("path").attr("d", L(u, i.curveTension)).attr("class", `radarCurve-${p}`) : o === "polygon" && a.append("polygon").attr("points", u.map((g) => `${g.x},${g.y}`).join(" ")).attr("class", `radarCurve-${p}`); + }); +} +l(M, "drawCurves"); +function A(a, t, e, r) { + const s = Math.min(Math.max(a, t), e); + return r * (s - t) / (e - t); +} +l(A, "relativeRadius"); +function L(a, t) { + const e = a.length; + let r = `M${a[0].x},${a[0].y}`; + for (let s = 0; s < e; s++) { + const o = a[(s - 1 + e) % e], i = a[s], n = a[(s + 1) % e], c = a[(s + 2) % e], d = { + x: i.x + (n.x - o.x) * t, + y: i.y + (n.y - o.y) * t + }, p = { + x: n.x - (c.x - i.x) * t, + y: n.y - (c.y - i.y) * t + }; + r += ` C${d.x},${d.y} ${p.x},${p.y} ${n.x},${n.y}`; + } + return `${r} Z`; +} +l(L, "closedRoundCurve"); +function T(a, t, e, r) { + if (!e) + return; + const s = (r.width / 2 + r.marginRight) * 3 / 4, o = -(r.height / 2 + r.marginTop) * 3 / 4, i = 20; + t.forEach((n, c) => { + const d = a.append("g").attr("transform", `translate(${s}, ${o + c * i})`); + d.append("rect").attr("width", 12).attr("height", 12).attr("class", `radarLegendBox-${c}`), d.append("text").attr("x", 16).attr("y", 0).attr("class", "radarLegendText").text(n.label); + }); +} +l(T, "drawLegend"); +var st = { draw: tt }, nt = /* @__PURE__ */ l((a, t) => { + let e = ""; + for (let r = 0; r < a.THEME_COLOR_LIMIT; r++) { + const s = a[`cScale${r}`]; + e += ` + .radarCurve-${r} { + color: ${s}; + fill: ${s}; + fill-opacity: ${t.curveOpacity}; + stroke: ${s}; + stroke-width: ${t.curveStrokeWidth}; + } + .radarLegendBox-${r} { + fill: ${s}; + fill-opacity: ${t.curveOpacity}; + stroke: ${s}; + } + `; + } + return e; +}, "genIndexStyles"), ot = /* @__PURE__ */ l((a) => { + const t = V(), e = C(), r = y(t, e.themeVariables), s = y(r.radar, a); + return { themeVariables: r, radarOptions: s }; +}, "buildRadarStyleOptions"), it = /* @__PURE__ */ l(({ radar: a } = {}) => { + const { themeVariables: t, radarOptions: e } = ot(a); + return ` + .radarTitle { + font-size: ${t.fontSize}; + color: ${t.titleColor}; + dominant-baseline: hanging; + text-anchor: middle; + } + .radarAxisLine { + stroke: ${e.axisColor}; + stroke-width: ${e.axisStrokeWidth}; + } + .radarAxisLabel { + dominant-baseline: middle; + text-anchor: middle; + font-size: ${e.axisLabelFontSize}px; + color: ${e.axisColor}; + } + .radarGraticule { + fill: ${e.graticuleColor}; + fill-opacity: ${e.graticuleOpacity}; + stroke: ${e.graticuleColor}; + stroke-width: ${e.graticuleStrokeWidth}; + } + .radarLegendText { + text-anchor: start; + font-size: ${e.legendFontSize}px; + dominant-baseline: hanging; + } + ${nt(t, e)} + `; +}, "styles"), ut = { + parser: Q, + db: $, + renderer: st, + styles: it +}; +export { + ut as diagram +}; diff --git a/backend/fastrtc/templates/component/diagram-VNBRO52H-B6l1DKJW.js b/backend/fastrtc/templates/component/diagram-VNBRO52H-B6l1DKJW.js new file mode 100644 index 0000000..2d588a3 --- /dev/null +++ b/backend/fastrtc/templates/component/diagram-VNBRO52H-B6l1DKJW.js @@ -0,0 +1,126 @@ +import { p as w } from "./chunk-4BMEZGHF-skpIwyQ5.js"; +import { C as B, s as S, g as F, n as z, o as P, b as W, c as D, _ as n, l as x, D as m, E as T, t as E, H as _, k as A } from "./mermaid.core-Cmyps_S7.js"; +import { p as N } from "./radar-MK3ICKWK-Bw4p6KaX.js"; +var C = { + packet: [] +}, v = structuredClone(C), L = B.packet, Y = /* @__PURE__ */ n(() => { + const t = m({ + ...L, + ...T().packet + }); + return t.showBits && (t.paddingY += 10), t; +}, "getConfig"), H = /* @__PURE__ */ n(() => v.packet, "getPacket"), I = /* @__PURE__ */ n((t) => { + t.length > 0 && v.packet.push(t); +}, "pushWord"), M = /* @__PURE__ */ n(() => { + E(), v = structuredClone(C); +}, "clear"), h = { + pushWord: I, + getPacket: H, + getConfig: Y, + clear: M, + setAccTitle: S, + getAccTitle: F, + setDiagramTitle: z, + getDiagramTitle: P, + getAccDescription: W, + setAccDescription: D +}, O = 1e4, G = /* @__PURE__ */ n((t) => { + w(t, h); + let e = -1, o = [], s = 1; + const { bitsPerRow: i } = h.getConfig(); + for (let { start: a, end: r, label: p } of t.blocks) { + if (r && r < a) + throw new Error(`Packet block ${a} - ${r} is invalid. End must be greater than start.`); + if (a !== e + 1) + throw new Error( + `Packet block ${a} - ${r ?? a} is not contiguous. It should start from ${e + 1}.` + ); + for (e = r ?? a, x.debug(`Packet block ${a} - ${e} with label ${p}`); o.length <= i + 1 && h.getPacket().length < O; ) { + const [b, c] = K({ start: a, end: r, label: p }, s, i); + if (o.push(b), b.end + 1 === s * i && (h.pushWord(o), o = [], s++), !c) + break; + ({ start: a, end: r, label: p } = c); + } + } + h.pushWord(o); +}, "populate"), K = /* @__PURE__ */ n((t, e, o) => { + if (t.end === void 0 && (t.end = t.start), t.start > t.end) + throw new Error(`Block start ${t.start} is greater than block end ${t.end}.`); + return t.end + 1 <= e * o ? [t, void 0] : [ + { + start: t.start, + end: e * o - 1, + label: t.label + }, + { + start: e * o, + end: t.end, + label: t.label + } + ]; +}, "getNextFittingBlock"), R = { + parse: /* @__PURE__ */ n(async (t) => { + const e = await N("packet", t); + x.debug(e), G(e); + }, "parse") +}, U = /* @__PURE__ */ n((t, e, o, s) => { + const i = s.db, a = i.getConfig(), { rowHeight: r, paddingY: p, bitWidth: b, bitsPerRow: c } = a, u = i.getPacket(), l = i.getDiagramTitle(), g = r + p, d = g * (u.length + 1) - (l ? 0 : r), k = b * c + 2, f = _(e); + f.attr("viewbox", `0 0 ${k} ${d}`), A(f, d, k, a.useMaxWidth); + for (const [$, y] of u.entries()) + X(f, y, $, a); + f.append("text").text(l).attr("x", k / 2).attr("y", d - g / 2).attr("dominant-baseline", "middle").attr("text-anchor", "middle").attr("class", "packetTitle"); +}, "draw"), X = /* @__PURE__ */ n((t, e, o, { rowHeight: s, paddingX: i, paddingY: a, bitWidth: r, bitsPerRow: p, showBits: b }) => { + const c = t.append("g"), u = o * (s + a) + a; + for (const l of e) { + const g = l.start % p * r + 1, d = (l.end - l.start + 1) * r - i; + if (c.append("rect").attr("x", g).attr("y", u).attr("width", d).attr("height", s).attr("class", "packetBlock"), c.append("text").attr("x", g + d / 2).attr("y", u + s / 2).attr("class", "packetLabel").attr("dominant-baseline", "middle").attr("text-anchor", "middle").text(l.label), !b) + continue; + const k = l.end === l.start, f = u - 2; + c.append("text").attr("x", g + (k ? d / 2 : 0)).attr("y", f).attr("class", "packetByte start").attr("dominant-baseline", "auto").attr("text-anchor", k ? "middle" : "start").text(l.start), k || c.append("text").attr("x", g + d).attr("y", f).attr("class", "packetByte end").attr("dominant-baseline", "auto").attr("text-anchor", "end").text(l.end); + } +}, "drawWord"), j = { draw: U }, q = { + byteFontSize: "10px", + startByteColor: "black", + endByteColor: "black", + labelColor: "black", + labelFontSize: "12px", + titleColor: "black", + titleFontSize: "14px", + blockStrokeColor: "black", + blockStrokeWidth: "1", + blockFillColor: "#efefef" +}, J = /* @__PURE__ */ n(({ packet: t } = {}) => { + const e = m(q, t); + return ` + .packetByte { + font-size: ${e.byteFontSize}; + } + .packetByte.start { + fill: ${e.startByteColor}; + } + .packetByte.end { + fill: ${e.endByteColor}; + } + .packetLabel { + fill: ${e.labelColor}; + font-size: ${e.labelFontSize}; + } + .packetTitle { + fill: ${e.titleColor}; + font-size: ${e.titleFontSize}; + } + .packetBlock { + stroke: ${e.blockStrokeColor}; + stroke-width: ${e.blockStrokeWidth}; + fill: ${e.blockFillColor}; + } + `; +}, "styles"), tt = { + parser: R, + db: h, + renderer: j, + styles: J +}; +export { + tt as diagram +}; diff --git a/backend/fastrtc/templates/component/erDiagram-Q7BY3M3F-B_BAUKms.js b/backend/fastrtc/templates/component/erDiagram-Q7BY3M3F-B_BAUKms.js new file mode 100644 index 0000000..3ef5d41 --- /dev/null +++ b/backend/fastrtc/templates/component/erDiagram-Q7BY3M3F-B_BAUKms.js @@ -0,0 +1,841 @@ +import { g as Dt, s as wt } from "./chunk-RZ5BOZE2-C6qYYKQn.js"; +import { _ as u, s as Vt, g as Lt, c as Mt, b as Bt, n as Ft, o as Yt, d as tt, l as D, t as Pt, r as zt, B as Gt, y as Kt, z as Zt, j as Ut, u as jt, A as Wt } from "./mermaid.core-Cmyps_S7.js"; +import { c as Qt } from "./channel-DQMget29.js"; +var dt = function() { + var s = /* @__PURE__ */ u(function(R, n, a, c) { + for (a = a || {}, c = R.length; c--; a[R[c]] = n) ; + return a; + }, "o"), i = [6, 8, 10, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 50], h = [1, 10], d = [1, 11], o = [1, 12], l = [1, 13], f = [1, 20], _ = [1, 21], E = [1, 22], V = [1, 23], Z = [1, 24], S = [1, 19], et = [1, 25], U = [1, 26], T = [1, 18], L = [1, 33], st = [1, 34], it = [1, 35], rt = [1, 36], nt = [1, 37], pt = [6, 8, 10, 13, 15, 17, 20, 21, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 43, 44, 50, 63, 64, 65, 66, 67], O = [1, 42], A = [1, 43], M = [1, 52], B = [40, 50, 68, 69], F = [1, 63], Y = [1, 61], N = [1, 58], P = [1, 62], z = [1, 64], j = [6, 8, 10, 13, 17, 22, 24, 26, 28, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 48, 49, 50, 63, 64, 65, 66, 67], yt = [63, 64, 65, 66, 67], ft = [1, 81], _t = [1, 80], gt = [1, 78], bt = [1, 79], mt = [6, 10, 42, 47], v = [6, 10, 13, 41, 42, 47, 48, 49], W = [1, 89], Q = [1, 88], X = [1, 87], G = [19, 56], Et = [1, 98], kt = [1, 97], at = [19, 56, 58, 60], ct = { + trace: /* @__PURE__ */ u(function() { + }, "trace"), + yy: {}, + symbols_: { error: 2, start: 3, ER_DIAGRAM: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NEWLINE: 10, entityName: 11, relSpec: 12, COLON: 13, role: 14, STYLE_SEPARATOR: 15, idList: 16, BLOCK_START: 17, attributes: 18, BLOCK_STOP: 19, SQS: 20, SQE: 21, title: 22, title_value: 23, acc_title: 24, acc_title_value: 25, acc_descr: 26, acc_descr_value: 27, acc_descr_multiline_value: 28, direction: 29, classDefStatement: 30, classStatement: 31, styleStatement: 32, direction_tb: 33, direction_bt: 34, direction_rl: 35, direction_lr: 36, CLASSDEF: 37, stylesOpt: 38, separator: 39, UNICODE_TEXT: 40, STYLE_TEXT: 41, COMMA: 42, CLASS: 43, STYLE: 44, style: 45, styleComponent: 46, SEMI: 47, NUM: 48, BRKT: 49, ENTITY_NAME: 50, attribute: 51, attributeType: 52, attributeName: 53, attributeKeyTypeList: 54, attributeComment: 55, ATTRIBUTE_WORD: 56, attributeKeyType: 57, ",": 58, ATTRIBUTE_KEY: 59, COMMENT: 60, cardinality: 61, relType: 62, ZERO_OR_ONE: 63, ZERO_OR_MORE: 64, ONE_OR_MORE: 65, ONLY_ONE: 66, MD_PARENT: 67, NON_IDENTIFYING: 68, IDENTIFYING: 69, WORD: 70, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 4: "ER_DIAGRAM", 6: "EOF", 8: "SPACE", 10: "NEWLINE", 13: "COLON", 15: "STYLE_SEPARATOR", 17: "BLOCK_START", 19: "BLOCK_STOP", 20: "SQS", 21: "SQE", 22: "title", 23: "title_value", 24: "acc_title", 25: "acc_title_value", 26: "acc_descr", 27: "acc_descr_value", 28: "acc_descr_multiline_value", 33: "direction_tb", 34: "direction_bt", 35: "direction_rl", 36: "direction_lr", 37: "CLASSDEF", 40: "UNICODE_TEXT", 41: "STYLE_TEXT", 42: "COMMA", 43: "CLASS", 44: "STYLE", 47: "SEMI", 48: "NUM", 49: "BRKT", 50: "ENTITY_NAME", 56: "ATTRIBUTE_WORD", 58: ",", 59: "ATTRIBUTE_KEY", 60: "COMMENT", 63: "ZERO_OR_ONE", 64: "ZERO_OR_MORE", 65: "ONE_OR_MORE", 66: "ONLY_ONE", 67: "MD_PARENT", 68: "NON_IDENTIFYING", 69: "IDENTIFYING", 70: "WORD" }, + productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [9, 5], [9, 9], [9, 7], [9, 7], [9, 4], [9, 6], [9, 3], [9, 5], [9, 1], [9, 3], [9, 7], [9, 9], [9, 6], [9, 8], [9, 4], [9, 6], [9, 2], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [29, 1], [29, 1], [29, 1], [29, 1], [30, 4], [16, 1], [16, 1], [16, 3], [16, 3], [31, 3], [32, 4], [38, 1], [38, 3], [45, 1], [45, 2], [39, 1], [39, 1], [39, 1], [46, 1], [46, 1], [46, 1], [46, 1], [11, 1], [11, 1], [18, 1], [18, 2], [51, 2], [51, 3], [51, 3], [51, 4], [52, 1], [53, 1], [54, 1], [54, 3], [57, 1], [55, 1], [12, 3], [61, 1], [61, 1], [61, 1], [61, 1], [61, 1], [62, 1], [62, 1], [14, 1], [14, 1], [14, 1]], + performAction: /* @__PURE__ */ u(function(n, a, c, r, p, t, K) { + var e = t.length - 1; + switch (p) { + case 1: + break; + case 2: + this.$ = []; + break; + case 3: + t[e - 1].push(t[e]), this.$ = t[e - 1]; + break; + case 4: + case 5: + this.$ = t[e]; + break; + case 6: + case 7: + this.$ = []; + break; + case 8: + r.addEntity(t[e - 4]), r.addEntity(t[e - 2]), r.addRelationship(t[e - 4], t[e], t[e - 2], t[e - 3]); + break; + case 9: + r.addEntity(t[e - 8]), r.addEntity(t[e - 4]), r.addRelationship(t[e - 8], t[e], t[e - 4], t[e - 5]), r.setClass([t[e - 8]], t[e - 6]), r.setClass([t[e - 4]], t[e - 2]); + break; + case 10: + r.addEntity(t[e - 6]), r.addEntity(t[e - 2]), r.addRelationship(t[e - 6], t[e], t[e - 2], t[e - 3]), r.setClass([t[e - 6]], t[e - 4]); + break; + case 11: + r.addEntity(t[e - 6]), r.addEntity(t[e - 4]), r.addRelationship(t[e - 6], t[e], t[e - 4], t[e - 5]), r.setClass([t[e - 4]], t[e - 2]); + break; + case 12: + r.addEntity(t[e - 3]), r.addAttributes(t[e - 3], t[e - 1]); + break; + case 13: + r.addEntity(t[e - 5]), r.addAttributes(t[e - 5], t[e - 1]), r.setClass([t[e - 5]], t[e - 3]); + break; + case 14: + r.addEntity(t[e - 2]); + break; + case 15: + r.addEntity(t[e - 4]), r.setClass([t[e - 4]], t[e - 2]); + break; + case 16: + r.addEntity(t[e]); + break; + case 17: + r.addEntity(t[e - 2]), r.setClass([t[e - 2]], t[e]); + break; + case 18: + r.addEntity(t[e - 6], t[e - 4]), r.addAttributes(t[e - 6], t[e - 1]); + break; + case 19: + r.addEntity(t[e - 8], t[e - 6]), r.addAttributes(t[e - 8], t[e - 1]), r.setClass([t[e - 8]], t[e - 3]); + break; + case 20: + r.addEntity(t[e - 5], t[e - 3]); + break; + case 21: + r.addEntity(t[e - 7], t[e - 5]), r.setClass([t[e - 7]], t[e - 2]); + break; + case 22: + r.addEntity(t[e - 3], t[e - 1]); + break; + case 23: + r.addEntity(t[e - 5], t[e - 3]), r.setClass([t[e - 5]], t[e]); + break; + case 24: + case 25: + this.$ = t[e].trim(), r.setAccTitle(this.$); + break; + case 26: + case 27: + this.$ = t[e].trim(), r.setAccDescription(this.$); + break; + case 32: + r.setDirection("TB"); + break; + case 33: + r.setDirection("BT"); + break; + case 34: + r.setDirection("RL"); + break; + case 35: + r.setDirection("LR"); + break; + case 36: + this.$ = t[e - 3], r.addClass(t[e - 2], t[e - 1]); + break; + case 37: + case 38: + case 56: + case 64: + this.$ = [t[e]]; + break; + case 39: + case 40: + this.$ = t[e - 2].concat([t[e]]); + break; + case 41: + this.$ = t[e - 2], r.setClass(t[e - 1], t[e]); + break; + case 42: + this.$ = t[e - 3], r.addCssStyles(t[e - 2], t[e - 1]); + break; + case 43: + this.$ = [t[e]]; + break; + case 44: + t[e - 2].push(t[e]), this.$ = t[e - 2]; + break; + case 46: + this.$ = t[e - 1] + t[e]; + break; + case 54: + case 76: + case 77: + this.$ = t[e].replace(/"/g, ""); + break; + case 55: + case 78: + this.$ = t[e]; + break; + case 57: + t[e].push(t[e - 1]), this.$ = t[e]; + break; + case 58: + this.$ = { type: t[e - 1], name: t[e] }; + break; + case 59: + this.$ = { type: t[e - 2], name: t[e - 1], keys: t[e] }; + break; + case 60: + this.$ = { type: t[e - 2], name: t[e - 1], comment: t[e] }; + break; + case 61: + this.$ = { type: t[e - 3], name: t[e - 2], keys: t[e - 1], comment: t[e] }; + break; + case 62: + case 63: + case 66: + this.$ = t[e]; + break; + case 65: + t[e - 2].push(t[e]), this.$ = t[e - 2]; + break; + case 67: + this.$ = t[e].replace(/"/g, ""); + break; + case 68: + this.$ = { cardA: t[e], relType: t[e - 1], cardB: t[e - 2] }; + break; + case 69: + this.$ = r.Cardinality.ZERO_OR_ONE; + break; + case 70: + this.$ = r.Cardinality.ZERO_OR_MORE; + break; + case 71: + this.$ = r.Cardinality.ONE_OR_MORE; + break; + case 72: + this.$ = r.Cardinality.ONLY_ONE; + break; + case 73: + this.$ = r.Cardinality.MD_PARENT; + break; + case 74: + this.$ = r.Identification.NON_IDENTIFYING; + break; + case 75: + this.$ = r.Identification.IDENTIFYING; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, s(i, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 9, 22: h, 24: d, 26: o, 28: l, 29: 14, 30: 15, 31: 16, 32: 17, 33: f, 34: _, 35: E, 36: V, 37: Z, 40: S, 43: et, 44: U, 50: T }, s(i, [2, 7], { 1: [2, 1] }), s(i, [2, 3]), { 9: 27, 11: 9, 22: h, 24: d, 26: o, 28: l, 29: 14, 30: 15, 31: 16, 32: 17, 33: f, 34: _, 35: E, 36: V, 37: Z, 40: S, 43: et, 44: U, 50: T }, s(i, [2, 5]), s(i, [2, 6]), s(i, [2, 16], { 12: 28, 61: 32, 15: [1, 29], 17: [1, 30], 20: [1, 31], 63: L, 64: st, 65: it, 66: rt, 67: nt }), { 23: [1, 38] }, { 25: [1, 39] }, { 27: [1, 40] }, s(i, [2, 27]), s(i, [2, 28]), s(i, [2, 29]), s(i, [2, 30]), s(i, [2, 31]), s(pt, [2, 54]), s(pt, [2, 55]), s(i, [2, 32]), s(i, [2, 33]), s(i, [2, 34]), s(i, [2, 35]), { 16: 41, 40: O, 41: A }, { 16: 44, 40: O, 41: A }, { 16: 45, 40: O, 41: A }, s(i, [2, 4]), { 11: 46, 40: S, 50: T }, { 16: 47, 40: O, 41: A }, { 18: 48, 19: [1, 49], 51: 50, 52: 51, 56: M }, { 11: 53, 40: S, 50: T }, { 62: 54, 68: [1, 55], 69: [1, 56] }, s(B, [2, 69]), s(B, [2, 70]), s(B, [2, 71]), s(B, [2, 72]), s(B, [2, 73]), s(i, [2, 24]), s(i, [2, 25]), s(i, [2, 26]), { 13: F, 38: 57, 41: Y, 42: N, 45: 59, 46: 60, 48: P, 49: z }, s(j, [2, 37]), s(j, [2, 38]), { 16: 65, 40: O, 41: A, 42: N }, { 13: F, 38: 66, 41: Y, 42: N, 45: 59, 46: 60, 48: P, 49: z }, { 13: [1, 67], 15: [1, 68] }, s(i, [2, 17], { 61: 32, 12: 69, 17: [1, 70], 42: N, 63: L, 64: st, 65: it, 66: rt, 67: nt }), { 19: [1, 71] }, s(i, [2, 14]), { 18: 72, 19: [2, 56], 51: 50, 52: 51, 56: M }, { 53: 73, 56: [1, 74] }, { 56: [2, 62] }, { 21: [1, 75] }, { 61: 76, 63: L, 64: st, 65: it, 66: rt, 67: nt }, s(yt, [2, 74]), s(yt, [2, 75]), { 6: ft, 10: _t, 39: 77, 42: gt, 47: bt }, { 40: [1, 82], 41: [1, 83] }, s(mt, [2, 43], { 46: 84, 13: F, 41: Y, 48: P, 49: z }), s(v, [2, 45]), s(v, [2, 50]), s(v, [2, 51]), s(v, [2, 52]), s(v, [2, 53]), s(i, [2, 41], { 42: N }), { 6: ft, 10: _t, 39: 85, 42: gt, 47: bt }, { 14: 86, 40: W, 50: Q, 70: X }, { 16: 90, 40: O, 41: A }, { 11: 91, 40: S, 50: T }, { 18: 92, 19: [1, 93], 51: 50, 52: 51, 56: M }, s(i, [2, 12]), { 19: [2, 57] }, s(G, [2, 58], { 54: 94, 55: 95, 57: 96, 59: Et, 60: kt }), s([19, 56, 59, 60], [2, 63]), s(i, [2, 22], { 15: [1, 100], 17: [1, 99] }), s([40, 50], [2, 68]), s(i, [2, 36]), { 13: F, 41: Y, 45: 101, 46: 60, 48: P, 49: z }, s(i, [2, 47]), s(i, [2, 48]), s(i, [2, 49]), s(j, [2, 39]), s(j, [2, 40]), s(v, [2, 46]), s(i, [2, 42]), s(i, [2, 8]), s(i, [2, 76]), s(i, [2, 77]), s(i, [2, 78]), { 13: [1, 102], 42: N }, { 13: [1, 104], 15: [1, 103] }, { 19: [1, 105] }, s(i, [2, 15]), s(G, [2, 59], { 55: 106, 58: [1, 107], 60: kt }), s(G, [2, 60]), s(at, [2, 64]), s(G, [2, 67]), s(at, [2, 66]), { 18: 108, 19: [1, 109], 51: 50, 52: 51, 56: M }, { 16: 110, 40: O, 41: A }, s(mt, [2, 44], { 46: 84, 13: F, 41: Y, 48: P, 49: z }), { 14: 111, 40: W, 50: Q, 70: X }, { 16: 112, 40: O, 41: A }, { 14: 113, 40: W, 50: Q, 70: X }, s(i, [2, 13]), s(G, [2, 61]), { 57: 114, 59: Et }, { 19: [1, 115] }, s(i, [2, 20]), s(i, [2, 23], { 17: [1, 116], 42: N }), s(i, [2, 11]), { 13: [1, 117], 42: N }, s(i, [2, 10]), s(at, [2, 65]), s(i, [2, 18]), { 18: 118, 19: [1, 119], 51: 50, 52: 51, 56: M }, { 14: 120, 40: W, 50: Q, 70: X }, { 19: [1, 121] }, s(i, [2, 21]), s(i, [2, 9]), s(i, [2, 19])], + defaultActions: { 52: [2, 62], 72: [2, 57] }, + parseError: /* @__PURE__ */ u(function(n, a) { + if (a.recoverable) + this.trace(n); + else { + var c = new Error(n); + throw c.hash = a, c; + } + }, "parseError"), + parse: /* @__PURE__ */ u(function(n) { + var a = this, c = [0], r = [], p = [null], t = [], K = this.table, e = "", H = 0, St = 0, It = 2, Tt = 1, xt = t.slice.call(arguments, 1), y = Object.create(this.lexer), I = { yy: {} }; + for (var lt in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, lt) && (I.yy[lt] = this.yy[lt]); + y.setInput(n, I.yy), I.yy.lexer = y, I.yy.parser = this, typeof y.yylloc > "u" && (y.yylloc = {}); + var ot = y.yylloc; + t.push(ot); + var vt = y.options && y.options.ranges; + typeof I.yy.parseError == "function" ? this.parseError = I.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function Ct(b) { + c.length = c.length - 2 * b, p.length = p.length - b, t.length = t.length - b; + } + u(Ct, "popStack"); + function Ot() { + var b; + return b = r.pop() || y.lex() || Tt, typeof b != "number" && (b instanceof Array && (r = b, b = r.pop()), b = a.symbols_[b] || b), b; + } + u(Ot, "lex"); + for (var g, x, m, ht, C = {}, J, k, At, $; ; ) { + if (x = c[c.length - 1], this.defaultActions[x] ? m = this.defaultActions[x] : ((g === null || typeof g > "u") && (g = Ot()), m = K[x] && K[x][g]), typeof m > "u" || !m.length || !m[0]) { + var ut = ""; + $ = []; + for (J in K[x]) + this.terminals_[J] && J > It && $.push("'" + this.terminals_[J] + "'"); + y.showPosition ? ut = "Parse error on line " + (H + 1) + `: +` + y.showPosition() + ` +Expecting ` + $.join(", ") + ", got '" + (this.terminals_[g] || g) + "'" : ut = "Parse error on line " + (H + 1) + ": Unexpected " + (g == Tt ? "end of input" : "'" + (this.terminals_[g] || g) + "'"), this.parseError(ut, { + text: y.match, + token: this.terminals_[g] || g, + line: y.yylineno, + loc: ot, + expected: $ + }); + } + if (m[0] instanceof Array && m.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + x + ", token: " + g); + switch (m[0]) { + case 1: + c.push(g), p.push(y.yytext), t.push(y.yylloc), c.push(m[1]), g = null, St = y.yyleng, e = y.yytext, H = y.yylineno, ot = y.yylloc; + break; + case 2: + if (k = this.productions_[m[1]][1], C.$ = p[p.length - k], C._$ = { + first_line: t[t.length - (k || 1)].first_line, + last_line: t[t.length - 1].last_line, + first_column: t[t.length - (k || 1)].first_column, + last_column: t[t.length - 1].last_column + }, vt && (C._$.range = [ + t[t.length - (k || 1)].range[0], + t[t.length - 1].range[1] + ]), ht = this.performAction.apply(C, [ + e, + St, + H, + I.yy, + m[1], + p, + t + ].concat(xt)), typeof ht < "u") + return ht; + k && (c = c.slice(0, -1 * k * 2), p = p.slice(0, -1 * k), t = t.slice(0, -1 * k)), c.push(this.productions_[m[1]][0]), p.push(C.$), t.push(C._$), At = K[c[c.length - 2]][c[c.length - 1]], c.push(At); + break; + case 3: + return !0; + } + } + return !0; + }, "parse") + }, Rt = /* @__PURE__ */ function() { + var R = { + EOF: 1, + parseError: /* @__PURE__ */ u(function(a, c) { + if (this.yy.parser) + this.yy.parser.parseError(a, c); + else + throw new Error(a); + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ u(function(n, a) { + return this.yy = a || this.yy || {}, this._input = n, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ u(function() { + var n = this._input[0]; + this.yytext += n, this.yyleng++, this.offset++, this.match += n, this.matched += n; + var a = n.match(/(?:\r\n?|\n).*/g); + return a ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), n; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ u(function(n) { + var a = n.length, c = n.split(/(?:\r\n?|\n)/g); + this._input = n + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - a), this.offset -= a; + var r = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), c.length - 1 && (this.yylineno -= c.length - 1); + var p = this.yylloc.range; + return this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: c ? (c.length === r.length ? this.yylloc.first_column : 0) + r[r.length - c.length].length - c[0].length : this.yylloc.first_column - a + }, this.options.ranges && (this.yylloc.range = [p[0], p[0] + this.yyleng - a]), this.yyleng = this.yytext.length, this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ u(function() { + return this._more = !0, this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ u(function() { + if (this.options.backtrack_lexer) + this._backtrack = !0; + else + return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ u(function(n) { + this.unput(this.match.slice(n)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ u(function() { + var n = this.matched.substr(0, this.matched.length - this.match.length); + return (n.length > 20 ? "..." : "") + n.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ u(function() { + var n = this.match; + return n.length < 20 && (n += this._input.substr(0, 20 - n.length)), (n.substr(0, 20) + (n.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ u(function() { + var n = this.pastInput(), a = new Array(n.length + 1).join("-"); + return n + this.upcomingInput() + ` +` + a + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ u(function(n, a) { + var c, r, p; + if (this.options.backtrack_lexer && (p = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }, this.options.ranges && (p.yylloc.range = this.yylloc.range.slice(0))), r = n[0].match(/(?:\r\n?|\n).*/g), r && (this.yylineno += r.length), this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: r ? r[r.length - 1].length - r[r.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + n[0].length + }, this.yytext += n[0], this.match += n[0], this.matches = n, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(n[0].length), this.matched += n[0], c = this.performAction.call(this, this.yy, this, a, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), c) + return c; + if (this._backtrack) { + for (var t in p) + this[t] = p[t]; + return !1; + } + return !1; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ u(function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var n, a, c, r; + this._more || (this.yytext = "", this.match = ""); + for (var p = this._currentRules(), t = 0; t < p.length; t++) + if (c = this._input.match(this.rules[p[t]]), c && (!a || c[0].length > a[0].length)) { + if (a = c, r = t, this.options.backtrack_lexer) { + if (n = this.test_match(c, p[t]), n !== !1) + return n; + if (this._backtrack) { + a = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return a ? (n = this.test_match(a, p[r]), n !== !1 ? n : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ u(function() { + var a = this.next(); + return a || this.lex(); + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ u(function(a) { + this.conditionStack.push(a); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ u(function() { + var a = this.conditionStack.length - 1; + return a > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ u(function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ u(function(a) { + return a = this.conditionStack.length - 1 - Math.abs(a || 0), a >= 0 ? this.conditionStack[a] : "INITIAL"; + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ u(function(a) { + this.begin(a); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ u(function() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": !0 }, + performAction: /* @__PURE__ */ u(function(a, c, r, p) { + switch (r) { + case 0: + return this.begin("acc_title"), 24; + case 1: + return this.popState(), "acc_title_value"; + case 2: + return this.begin("acc_descr"), 26; + case 3: + return this.popState(), "acc_descr_value"; + case 4: + this.begin("acc_descr_multiline"); + break; + case 5: + this.popState(); + break; + case 6: + return "acc_descr_multiline_value"; + case 7: + return 33; + case 8: + return 34; + case 9: + return 35; + case 10: + return 36; + case 11: + return 10; + case 12: + break; + case 13: + return 8; + case 14: + return 50; + case 15: + return 70; + case 16: + return 4; + case 17: + return this.begin("block"), 17; + case 18: + return 49; + case 19: + return 49; + case 20: + return 42; + case 21: + return 15; + case 22: + return 13; + case 23: + break; + case 24: + return 59; + case 25: + return 56; + case 26: + return 56; + case 27: + return 60; + case 28: + break; + case 29: + return this.popState(), 19; + case 30: + return c.yytext[0]; + case 31: + return 20; + case 32: + return 21; + case 33: + return this.begin("style"), 44; + case 34: + return this.popState(), 10; + case 35: + break; + case 36: + return 13; + case 37: + return 42; + case 38: + return 49; + case 39: + return this.begin("style"), 37; + case 40: + return 43; + case 41: + return 63; + case 42: + return 65; + case 43: + return 65; + case 44: + return 65; + case 45: + return 63; + case 46: + return 63; + case 47: + return 64; + case 48: + return 64; + case 49: + return 64; + case 50: + return 64; + case 51: + return 64; + case 52: + return 65; + case 53: + return 64; + case 54: + return 65; + case 55: + return 66; + case 56: + return 66; + case 57: + return 66; + case 58: + return 66; + case 59: + return 63; + case 60: + return 64; + case 61: + return 65; + case 62: + return 67; + case 63: + return 68; + case 64: + return 69; + case 65: + return 69; + case 66: + return 68; + case 67: + return 68; + case 68: + return 68; + case 69: + return 41; + case 70: + return 47; + case 71: + return 40; + case 72: + return 48; + case 73: + return c.yytext[0]; + case 74: + return 6; + } + }, "anonymous"), + rules: [/^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:.*direction\s+TB[^\n]*)/i, /^(?:.*direction\s+BT[^\n]*)/i, /^(?:.*direction\s+RL[^\n]*)/i, /^(?:.*direction\s+LR[^\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:[\s]+)/i, /^(?:"[^"%\r\n\v\b\\]+")/i, /^(?:"[^"]*")/i, /^(?:erDiagram\b)/i, /^(?:\{)/i, /^(?:#)/i, /^(?:#)/i, /^(?:,)/i, /^(?::::)/i, /^(?::)/i, /^(?:\s+)/i, /^(?:\b((?:PK)|(?:FK)|(?:UK))\b)/i, /^(?:([^\s]*)[~].*[~]([^\s]*))/i, /^(?:([\*A-Za-z_\u00C0-\uFFFF][A-Za-z0-9\-\_\[\]\(\)\u00C0-\uFFFF\*]*))/i, /^(?:"[^"]*")/i, /^(?:[\n]+)/i, /^(?:\})/i, /^(?:.)/i, /^(?:\[)/i, /^(?:\])/i, /^(?:style\b)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?::)/i, /^(?:,)/i, /^(?:#)/i, /^(?:classDef\b)/i, /^(?:class\b)/i, /^(?:one or zero\b)/i, /^(?:one or more\b)/i, /^(?:one or many\b)/i, /^(?:1\+)/i, /^(?:\|o\b)/i, /^(?:zero or one\b)/i, /^(?:zero or more\b)/i, /^(?:zero or many\b)/i, /^(?:0\+)/i, /^(?:\}o\b)/i, /^(?:many\(0\))/i, /^(?:many\(1\))/i, /^(?:many\b)/i, /^(?:\}\|)/i, /^(?:one\b)/i, /^(?:only one\b)/i, /^(?:1\b)/i, /^(?:\|\|)/i, /^(?:o\|)/i, /^(?:o\{)/i, /^(?:\|\{)/i, /^(?:\s*u\b)/i, /^(?:\.\.)/i, /^(?:--)/i, /^(?:to\b)/i, /^(?:optionally to\b)/i, /^(?:\.-)/i, /^(?:-\.)/i, /^(?:([^\x00-\x7F]|\w|-|\*)+)/i, /^(?:;)/i, /^(?:([^\x00-\x7F]|\w|-|\*)+)/i, /^(?:[0-9])/i, /^(?:.)/i, /^(?:$)/i], + conditions: { style: { rules: [34, 35, 36, 37, 38, 69, 70], inclusive: !1 }, acc_descr_multiline: { rules: [5, 6], inclusive: !1 }, acc_descr: { rules: [3], inclusive: !1 }, acc_title: { rules: [1], inclusive: !1 }, block: { rules: [23, 24, 25, 26, 27, 28, 29, 30], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 31, 32, 33, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 71, 72, 73, 74], inclusive: !0 } } + }; + return R; + }(); + ct.lexer = Rt; + function q() { + this.yy = {}; + } + return u(q, "Parser"), q.prototype = ct, ct.Parser = q, new q(); +}(); +dt.parser = dt; +var Xt = dt, w, qt = (w = class { + constructor() { + this.entities = /* @__PURE__ */ new Map(), this.relationships = [], this.classes = /* @__PURE__ */ new Map(), this.direction = "TB", this.Cardinality = { + ZERO_OR_ONE: "ZERO_OR_ONE", + ZERO_OR_MORE: "ZERO_OR_MORE", + ONE_OR_MORE: "ONE_OR_MORE", + ONLY_ONE: "ONLY_ONE", + MD_PARENT: "MD_PARENT" + }, this.Identification = { + NON_IDENTIFYING: "NON_IDENTIFYING", + IDENTIFYING: "IDENTIFYING" + }, this.setAccTitle = Vt, this.getAccTitle = Lt, this.setAccDescription = Mt, this.getAccDescription = Bt, this.setDiagramTitle = Ft, this.getDiagramTitle = Yt, this.getConfig = /* @__PURE__ */ u(() => tt().er, "getConfig"), this.clear(), this.addEntity = this.addEntity.bind(this), this.addAttributes = this.addAttributes.bind(this), this.addRelationship = this.addRelationship.bind(this), this.setDirection = this.setDirection.bind(this), this.addCssStyles = this.addCssStyles.bind(this), this.addClass = this.addClass.bind(this), this.setClass = this.setClass.bind(this), this.setAccTitle = this.setAccTitle.bind(this), this.setAccDescription = this.setAccDescription.bind(this); + } + /** + * Add entity + * @param name - The name of the entity + * @param alias - The alias of the entity + */ + addEntity(i, h = "") { + var d; + return this.entities.has(i) ? !((d = this.entities.get(i)) != null && d.alias) && h && (this.entities.get(i).alias = h, D.info(`Add alias '${h}' to entity '${i}'`)) : (this.entities.set(i, { + id: `entity-${i}-${this.entities.size}`, + label: i, + attributes: [], + alias: h, + shape: "erBox", + look: tt().look ?? "default", + cssClasses: "default", + cssStyles: [] + }), D.info("Added new entity :", i)), this.entities.get(i); + } + getEntity(i) { + return this.entities.get(i); + } + getEntities() { + return this.entities; + } + getClasses() { + return this.classes; + } + addAttributes(i, h) { + const d = this.addEntity(i); + let o; + for (o = h.length - 1; o >= 0; o--) + h[o].keys || (h[o].keys = []), h[o].comment || (h[o].comment = ""), d.attributes.push(h[o]), D.debug("Added attribute ", h[o].name); + } + /** + * Add a relationship + * + * @param entA - The first entity in the relationship + * @param rolA - The role played by the first entity in relation to the second + * @param entB - The second entity in the relationship + * @param rSpec - The details of the relationship between the two entities + */ + addRelationship(i, h, d, o) { + const l = this.entities.get(i), f = this.entities.get(d); + if (!l || !f) + return; + const _ = { + entityA: l.id, + roleA: h, + entityB: f.id, + relSpec: o + }; + this.relationships.push(_), D.debug("Added new relationship :", _); + } + getRelationships() { + return this.relationships; + } + getDirection() { + return this.direction; + } + setDirection(i) { + this.direction = i; + } + getCompiledStyles(i) { + let h = []; + for (const d of i) { + const o = this.classes.get(d); + o != null && o.styles && (h = [...h, ...o.styles ?? []].map((l) => l.trim())), o != null && o.textStyles && (h = [...h, ...o.textStyles ?? []].map((l) => l.trim())); + } + return h; + } + addCssStyles(i, h) { + for (const d of i) { + const o = this.entities.get(d); + if (!h || !o) + return; + for (const l of h) + o.cssStyles.push(l); + } + } + addClass(i, h) { + i.forEach((d) => { + let o = this.classes.get(d); + o === void 0 && (o = { id: d, styles: [], textStyles: [] }, this.classes.set(d, o)), h && h.forEach(function(l) { + if (/color/.exec(l)) { + const f = l.replace("fill", "bgFill"); + o.textStyles.push(f); + } + o.styles.push(l); + }); + }); + } + setClass(i, h) { + for (const d of i) { + const o = this.entities.get(d); + if (o) + for (const l of h) + o.cssClasses += " " + l; + } + } + clear() { + this.entities = /* @__PURE__ */ new Map(), this.classes = /* @__PURE__ */ new Map(), this.relationships = [], Pt(); + } + getData() { + const i = [], h = [], d = tt(); + for (const l of this.entities.keys()) { + const f = this.entities.get(l); + f && (f.cssCompiledStyles = this.getCompiledStyles(f.cssClasses.split(" ")), i.push(f)); + } + let o = 0; + for (const l of this.relationships) { + const f = { + id: zt(l.entityA, l.entityB, { + prefix: "id", + counter: o++ + }), + type: "normal", + curve: "basis", + start: l.entityA, + end: l.entityB, + label: l.roleA, + labelpos: "c", + thickness: "normal", + classes: "relationshipLine", + arrowTypeStart: l.relSpec.cardB.toLowerCase(), + arrowTypeEnd: l.relSpec.cardA.toLowerCase(), + pattern: l.relSpec.relType == "IDENTIFYING" ? "solid" : "dashed", + look: d.look + }; + h.push(f); + } + return { nodes: i, edges: h, other: {}, config: d, direction: "TB" }; + } +}, u(w, "ErDB"), w), Nt = {}; +Gt(Nt, { + draw: () => Ht +}); +var Ht = /* @__PURE__ */ u(async function(s, i, h, d) { + D.info("REF0:"), D.info("Drawing er diagram (unified)", i); + const { securityLevel: o, er: l, layout: f } = tt(), _ = d.db.getData(), E = Dt(i, o); + _.type = d.type, _.layoutAlgorithm = Kt(f), _.config.flowchart.nodeSpacing = (l == null ? void 0 : l.nodeSpacing) || 140, _.config.flowchart.rankSpacing = (l == null ? void 0 : l.rankSpacing) || 80, _.direction = d.db.getDirection(), _.markers = ["only_one", "zero_or_one", "one_or_more", "zero_or_more"], _.diagramId = i, await Zt(_, E), _.layoutAlgorithm === "elk" && E.select(".edges").lower(); + const V = E.selectAll('[id*="-background"]'); + Array.from(V).length > 0 && V.each(function() { + const S = Ut(this), U = S.attr("id").replace("-background", ""), T = E.select(`#${CSS.escape(U)}`); + if (!T.empty()) { + const L = T.attr("transform"); + S.attr("transform", L); + } + }); + const Z = 8; + jt.insertTitle( + E, + "erDiagramTitleText", + (l == null ? void 0 : l.titleTopMargin) ?? 25, + d.db.getDiagramTitle() + ), wt(E, Z, "erDiagram", (l == null ? void 0 : l.useMaxWidth) ?? !0); +}, "draw"), Jt = /* @__PURE__ */ u((s, i) => { + const h = Qt, d = h(s, "r"), o = h(s, "g"), l = h(s, "b"); + return Wt(d, o, l, i); +}, "fade"), $t = /* @__PURE__ */ u((s) => ` + .entityBox { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; + } + + .relationshipLabelBox { + fill: ${s.tertiaryColor}; + opacity: 0.7; + background-color: ${s.tertiaryColor}; + rect { + opacity: 0.5; + } + } + + .labelBkg { + background-color: ${Jt(s.tertiaryColor, 0.5)}; + } + + .edgeLabel .label { + fill: ${s.nodeBorder}; + font-size: 14px; + } + + .label { + font-family: ${s.fontFamily}; + color: ${s.nodeTextColor || s.textColor}; + } + + .edge-pattern-dashed { + stroke-dasharray: 8,8; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon + { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; + stroke-width: 1px; + } + + .relationshipLine { + stroke: ${s.lineColor}; + stroke-width: 1; + fill: none; + } + + .marker { + fill: none !important; + stroke: ${s.lineColor} !important; + stroke-width: 1; + } +`, "getStyles"), te = $t, re = { + parser: Xt, + get db() { + return new qt(); + }, + renderer: Nt, + styles: te +}; +export { + re as diagram +}; diff --git a/backend/fastrtc/templates/component/flowDiagram-4HSFHLVR-BEKKIWnV.js b/backend/fastrtc/templates/component/flowDiagram-4HSFHLVR-BEKKIWnV.js new file mode 100644 index 0000000..1f79e2f --- /dev/null +++ b/backend/fastrtc/templates/component/flowDiagram-4HSFHLVR-BEKKIWnV.js @@ -0,0 +1,1622 @@ +import { d as G1, s as Ht, c as qt, n as Xt, g as Qt, b as Jt, o as Zt, _ as m, e as $t, p as te, J as ee, q as se, l as Z, r as st, u as it, j as C1, t as ie, v as re, x as Ot, y as ae, z as ne, A as ue } from "./mermaid.core-Cmyps_S7.js"; +import { g as le, s as oe } from "./chunk-RZ5BOZE2-C6qYYKQn.js"; +import { c as ce } from "./channel-DQMget29.js"; +var he = "flowchart-", P1, de = (P1 = class { + // cspell:ignore funs + constructor() { + this.vertexCounter = 0, this.config = G1(), this.vertices = /* @__PURE__ */ new Map(), this.edges = [], this.classes = /* @__PURE__ */ new Map(), this.subGraphs = [], this.subGraphLookup = /* @__PURE__ */ new Map(), this.tooltips = /* @__PURE__ */ new Map(), this.subCount = 0, this.firstGraphFlag = !0, this.secCount = -1, this.posCrossRef = [], this.funs = [], this.setAccTitle = Ht, this.setAccDescription = qt, this.setDiagramTitle = Xt, this.getAccTitle = Qt, this.getAccDescription = Jt, this.getDiagramTitle = Zt, this.funs.push(this.setupToolTips.bind(this)), this.addVertex = this.addVertex.bind(this), this.firstGraph = this.firstGraph.bind(this), this.setDirection = this.setDirection.bind(this), this.addSubGraph = this.addSubGraph.bind(this), this.addLink = this.addLink.bind(this), this.setLink = this.setLink.bind(this), this.updateLink = this.updateLink.bind(this), this.addClass = this.addClass.bind(this), this.setClass = this.setClass.bind(this), this.destructLink = this.destructLink.bind(this), this.setClickEvent = this.setClickEvent.bind(this), this.setTooltip = this.setTooltip.bind(this), this.updateLinkInterpolate = this.updateLinkInterpolate.bind(this), this.setClickFun = this.setClickFun.bind(this), this.bindFunctions = this.bindFunctions.bind(this), this.lex = { + firstGraph: this.firstGraph.bind(this) + }, this.clear(), this.setGen("gen-2"); + } + sanitizeText(i) { + return $t.sanitizeText(i, this.config); + } + /** + * Function to lookup domId from id in the graph definition. + * + * @param id - id of the node + */ + lookUpDomId(i) { + for (const a of this.vertices.values()) + if (a.id === i) + return a.domId; + return i; + } + /** + * Function called by parser when a node definition has been found + */ + addVertex(i, a, n, u, l, f, c = {}, A) { + var U, T; + if (!i || i.trim().length === 0) + return; + let r; + if (A !== void 0) { + let d; + A.includes(` +`) ? d = A + ` +` : d = `{ +` + A + ` +}`, r = te(d, { schema: ee }); + } + const b = this.edges.find((d) => d.id === i); + if (b) { + const d = r; + (d == null ? void 0 : d.animate) !== void 0 && (b.animate = d.animate), (d == null ? void 0 : d.animation) !== void 0 && (b.animation = d.animation); + return; + } + let F, k = this.vertices.get(i); + if (k === void 0 && (k = { + id: i, + labelType: "text", + domId: he + i + "-" + this.vertexCounter, + styles: [], + classes: [] + }, this.vertices.set(i, k)), this.vertexCounter++, a !== void 0 ? (this.config = G1(), F = this.sanitizeText(a.text.trim()), k.labelType = a.type, F.startsWith('"') && F.endsWith('"') && (F = F.substring(1, F.length - 1)), k.text = F) : k.text === void 0 && (k.text = i), n !== void 0 && (k.type = n), u != null && u.forEach((d) => { + k.styles.push(d); + }), l != null && l.forEach((d) => { + k.classes.push(d); + }), f !== void 0 && (k.dir = f), k.props === void 0 ? k.props = c : c !== void 0 && Object.assign(k.props, c), r !== void 0) { + if (r.shape) { + if (r.shape !== r.shape.toLowerCase() || r.shape.includes("_")) + throw new Error(`No such shape: ${r.shape}. Shape names should be lowercase.`); + if (!se(r.shape)) + throw new Error(`No such shape: ${r.shape}.`); + k.type = r == null ? void 0 : r.shape; + } + r != null && r.label && (k.text = r == null ? void 0 : r.label), r != null && r.icon && (k.icon = r == null ? void 0 : r.icon, !((U = r.label) != null && U.trim()) && k.text === i && (k.text = "")), r != null && r.form && (k.form = r == null ? void 0 : r.form), r != null && r.pos && (k.pos = r == null ? void 0 : r.pos), r != null && r.img && (k.img = r == null ? void 0 : r.img, !((T = r.label) != null && T.trim()) && k.text === i && (k.text = "")), r != null && r.constraint && (k.constraint = r.constraint), r.w && (k.assetWidth = Number(r.w)), r.h && (k.assetHeight = Number(r.h)); + } + } + /** + * Function called by parser when a link/edge definition has been found + * + */ + addSingleLink(i, a, n, u) { + const c = { + start: i, + end: a, + type: void 0, + text: "", + labelType: "text", + classes: [], + isUserDefinedId: !1, + interpolate: this.edges.defaultInterpolate + }; + Z.info("abc78 Got edge...", c); + const A = n.text; + if (A !== void 0 && (c.text = this.sanitizeText(A.text.trim()), c.text.startsWith('"') && c.text.endsWith('"') && (c.text = c.text.substring(1, c.text.length - 1)), c.labelType = A.type), n !== void 0 && (c.type = n.type, c.stroke = n.stroke, c.length = n.length > 10 ? 10 : n.length), u && !this.edges.some((r) => r.id === u)) + c.id = u, c.isUserDefinedId = !0; + else { + const r = this.edges.filter((b) => b.start === c.start && b.end === c.end); + r.length === 0 ? c.id = st(c.start, c.end, { counter: 0, prefix: "L" }) : c.id = st(c.start, c.end, { + counter: r.length + 1, + prefix: "L" + }); + } + if (this.edges.length < (this.config.maxEdges ?? 500)) + Z.info("Pushing edge..."), this.edges.push(c); + else + throw new Error( + `Edge limit exceeded. ${this.edges.length} edges found, but the limit is ${this.config.maxEdges}. + +Initialize mermaid with maxEdges set to a higher number to allow more edges. +You cannot set this config via configuration inside the diagram as it is a secure config. +You have to call mermaid.initialize.` + ); + } + isLinkData(i) { + return i !== null && typeof i == "object" && "id" in i && typeof i.id == "string"; + } + addLink(i, a, n) { + const u = this.isLinkData(n) ? n.id.replace("@", "") : void 0; + Z.info("addLink", i, a, u); + for (const l of i) + for (const f of a) { + const c = l === i[i.length - 1], A = f === a[0]; + c && A ? this.addSingleLink(l, f, n, u) : this.addSingleLink(l, f, n, void 0); + } + } + /** + * Updates a link's line interpolation algorithm + */ + updateLinkInterpolate(i, a) { + i.forEach((n) => { + n === "default" ? this.edges.defaultInterpolate = a : this.edges[n].interpolate = a; + }); + } + /** + * Updates a link with a style + * + */ + updateLink(i, a) { + i.forEach((n) => { + var u, l, f, c, A, r; + if (typeof n == "number" && n >= this.edges.length) + throw new Error( + `The index ${n} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)` + ); + n === "default" ? this.edges.defaultStyle = a : (this.edges[n].style = a, (((l = (u = this.edges[n]) == null ? void 0 : u.style) == null ? void 0 : l.length) ?? 0) > 0 && !((c = (f = this.edges[n]) == null ? void 0 : f.style) != null && c.some((b) => b == null ? void 0 : b.startsWith("fill"))) && ((r = (A = this.edges[n]) == null ? void 0 : A.style) == null || r.push("fill:none"))); + }); + } + addClass(i, a) { + const n = a.join().replace(/\\,/g, "§§§").replace(/,/g, ";").replace(/§§§/g, ",").split(";"); + i.split(",").forEach((u) => { + let l = this.classes.get(u); + l === void 0 && (l = { id: u, styles: [], textStyles: [] }, this.classes.set(u, l)), n != null && n.forEach((f) => { + if (/color/.exec(f)) { + const c = f.replace("fill", "bgFill"); + l.textStyles.push(c); + } + l.styles.push(f); + }); + }); + } + /** + * Called by parser when a graph definition is found, stores the direction of the chart. + * + */ + setDirection(i) { + this.direction = i, /.*/.exec(this.direction) && (this.direction = "LR"), /.*v/.exec(this.direction) && (this.direction = "TB"), this.direction === "TD" && (this.direction = "TB"); + } + /** + * Called by parser when a special node is found, e.g. a clickable element. + * + * @param ids - Comma separated list of ids + * @param className - Class to add + */ + setClass(i, a) { + for (const n of i.split(",")) { + const u = this.vertices.get(n); + u && u.classes.push(a); + const l = this.edges.find((c) => c.id === n); + l && l.classes.push(a); + const f = this.subGraphLookup.get(n); + f && f.classes.push(a); + } + } + setTooltip(i, a) { + if (a !== void 0) { + a = this.sanitizeText(a); + for (const n of i.split(",")) + this.tooltips.set(this.version === "gen-1" ? this.lookUpDomId(n) : n, a); + } + } + setClickFun(i, a, n) { + const u = this.lookUpDomId(i); + if (G1().securityLevel !== "loose" || a === void 0) + return; + let l = []; + if (typeof n == "string") { + l = n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); + for (let c = 0; c < l.length; c++) { + let A = l[c].trim(); + A.startsWith('"') && A.endsWith('"') && (A = A.substr(1, A.length - 2)), l[c] = A; + } + } + l.length === 0 && l.push(i); + const f = this.vertices.get(i); + f && (f.haveCallback = !0, this.funs.push(() => { + const c = document.querySelector(`[id="${u}"]`); + c !== null && c.addEventListener( + "click", + () => { + it.runFunc(a, ...l); + }, + !1 + ); + })); + } + /** + * Called by parser when a link is found. Adds the URL to the vertex data. + * + * @param ids - Comma separated list of ids + * @param linkStr - URL to create a link for + * @param target - Target attribute for the link + */ + setLink(i, a, n) { + i.split(",").forEach((u) => { + const l = this.vertices.get(u); + l !== void 0 && (l.link = it.formatUrl(a, this.config), l.linkTarget = n); + }), this.setClass(i, "clickable"); + } + getTooltip(i) { + return this.tooltips.get(i); + } + /** + * Called by parser when a click definition is found. Registers an event handler. + * + * @param ids - Comma separated list of ids + * @param functionName - Function to be called on click + * @param functionArgs - Arguments to be passed to the function + */ + setClickEvent(i, a, n) { + i.split(",").forEach((u) => { + this.setClickFun(u, a, n); + }), this.setClass(i, "clickable"); + } + bindFunctions(i) { + this.funs.forEach((a) => { + a(i); + }); + } + getDirection() { + var i; + return (i = this.direction) == null ? void 0 : i.trim(); + } + /** + * Retrieval function for fetching the found nodes after parsing has completed. + * + */ + getVertices() { + return this.vertices; + } + /** + * Retrieval function for fetching the found links after parsing has completed. + * + */ + getEdges() { + return this.edges; + } + /** + * Retrieval function for fetching the found class definitions after parsing has completed. + * + */ + getClasses() { + return this.classes; + } + setupToolTips(i) { + let a = C1(".mermaidTooltip"); + (a._groups || a)[0][0] === null && (a = C1("body").append("div").attr("class", "mermaidTooltip").style("opacity", 0)), C1(i).select("svg").selectAll("g.node").on("mouseover", (l) => { + var r; + const f = C1(l.currentTarget); + if (f.attr("title") === null) + return; + const A = (r = l.currentTarget) == null ? void 0 : r.getBoundingClientRect(); + a.transition().duration(200).style("opacity", ".9"), a.text(f.attr("title")).style("left", window.scrollX + A.left + (A.right - A.left) / 2 + "px").style("top", window.scrollY + A.bottom + "px"), a.html(a.html().replace(/<br\/>/g, "
")), f.classed("hover", !0); + }).on("mouseout", (l) => { + a.transition().duration(500).style("opacity", 0), C1(l.currentTarget).classed("hover", !1); + }); + } + /** + * Clears the internal graph db so that a new graph can be parsed. + * + */ + clear(i = "gen-2") { + this.vertices = /* @__PURE__ */ new Map(), this.classes = /* @__PURE__ */ new Map(), this.edges = [], this.funs = [this.setupToolTips.bind(this)], this.subGraphs = [], this.subGraphLookup = /* @__PURE__ */ new Map(), this.subCount = 0, this.tooltips = /* @__PURE__ */ new Map(), this.firstGraphFlag = !0, this.version = i, this.config = G1(), ie(); + } + setGen(i) { + this.version = i || "gen-2"; + } + defaultStyle() { + return "fill:#ffa;stroke: #f66; stroke-width: 3px; stroke-dasharray: 5, 5;fill:#ffa;stroke: #666;"; + } + addSubGraph(i, a, n) { + let u = i.text.trim(), l = n.text; + i === n && /\s/.exec(n.text) && (u = void 0); + const f = /* @__PURE__ */ m((b) => { + const F = { boolean: {}, number: {}, string: {} }, k = []; + let U; + return { nodeList: b.filter(function(d) { + const K = typeof d; + return d.stmt && d.stmt === "dir" ? (U = d.value, !1) : d.trim() === "" ? !1 : K in F ? F[K].hasOwnProperty(d) ? !1 : F[K][d] = !0 : k.includes(d) ? !1 : k.push(d); + }), dir: U }; + }, "uniq"), { nodeList: c, dir: A } = f(a.flat()); + if (this.version === "gen-1") + for (let b = 0; b < c.length; b++) + c[b] = this.lookUpDomId(c[b]); + u = u ?? "subGraph" + this.subCount, l = l || "", l = this.sanitizeText(l), this.subCount = this.subCount + 1; + const r = { + id: u, + nodes: c, + title: l.trim(), + classes: [], + dir: A, + labelType: n.type + }; + return Z.info("Adding", r.id, r.nodes, r.dir), r.nodes = this.makeUniq(r, this.subGraphs).nodes, this.subGraphs.push(r), this.subGraphLookup.set(u, r), u; + } + getPosForId(i) { + for (const [a, n] of this.subGraphs.entries()) + if (n.id === i) + return a; + return -1; + } + indexNodes2(i, a) { + const n = this.subGraphs[a].nodes; + if (this.secCount = this.secCount + 1, this.secCount > 2e3) + return { + result: !1, + count: 0 + }; + if (this.posCrossRef[this.secCount] = a, this.subGraphs[a].id === i) + return { + result: !0, + count: 0 + }; + let u = 0, l = 1; + for (; u < n.length; ) { + const f = this.getPosForId(n[u]); + if (f >= 0) { + const c = this.indexNodes2(i, f); + if (c.result) + return { + result: !0, + count: l + c.count + }; + l = l + c.count; + } + u = u + 1; + } + return { + result: !1, + count: l + }; + } + getDepthFirstPos(i) { + return this.posCrossRef[i]; + } + indexNodes() { + this.secCount = -1, this.subGraphs.length > 0 && this.indexNodes2("none", this.subGraphs.length - 1); + } + getSubGraphs() { + return this.subGraphs; + } + firstGraph() { + return this.firstGraphFlag ? (this.firstGraphFlag = !1, !0) : !1; + } + destructStartLink(i) { + let a = i.trim(), n = "arrow_open"; + switch (a[0]) { + case "<": + n = "arrow_point", a = a.slice(1); + break; + case "x": + n = "arrow_cross", a = a.slice(1); + break; + case "o": + n = "arrow_circle", a = a.slice(1); + break; + } + let u = "normal"; + return a.includes("=") && (u = "thick"), a.includes(".") && (u = "dotted"), { type: n, stroke: u }; + } + countChar(i, a) { + const n = a.length; + let u = 0; + for (let l = 0; l < n; ++l) + a[l] === i && ++u; + return u; + } + destructEndLink(i) { + const a = i.trim(); + let n = a.slice(0, -1), u = "arrow_open"; + switch (a.slice(-1)) { + case "x": + u = "arrow_cross", a.startsWith("x") && (u = "double_" + u, n = n.slice(1)); + break; + case ">": + u = "arrow_point", a.startsWith("<") && (u = "double_" + u, n = n.slice(1)); + break; + case "o": + u = "arrow_circle", a.startsWith("o") && (u = "double_" + u, n = n.slice(1)); + break; + } + let l = "normal", f = n.length - 1; + n.startsWith("=") && (l = "thick"), n.startsWith("~") && (l = "invisible"); + const c = this.countChar(".", n); + return c && (l = "dotted", f = c), { type: u, stroke: l, length: f }; + } + destructLink(i, a) { + const n = this.destructEndLink(i); + let u; + if (a) { + if (u = this.destructStartLink(a), u.stroke !== n.stroke) + return { type: "INVALID", stroke: "INVALID" }; + if (u.type === "arrow_open") + u.type = n.type; + else { + if (u.type !== n.type) + return { type: "INVALID", stroke: "INVALID" }; + u.type = "double_" + u.type; + } + return u.type === "double_arrow" && (u.type = "double_arrow_point"), u.length = n.length, u; + } + return n; + } + // Todo optimizer this by caching existing nodes + exists(i, a) { + for (const n of i) + if (n.nodes.includes(a)) + return !0; + return !1; + } + /** + * Deletes an id from all subgraphs + * + */ + makeUniq(i, a) { + const n = []; + return i.nodes.forEach((u, l) => { + this.exists(a, u) || n.push(i.nodes[l]); + }), { nodes: n }; + } + getTypeFromVertex(i) { + if (i.img) + return "imageSquare"; + if (i.icon) + return i.form === "circle" ? "iconCircle" : i.form === "square" ? "iconSquare" : i.form === "rounded" ? "iconRounded" : "icon"; + switch (i.type) { + case "square": + case void 0: + return "squareRect"; + case "round": + return "roundedRect"; + case "ellipse": + return "ellipse"; + default: + return i.type; + } + } + findNode(i, a) { + return i.find((n) => n.id === a); + } + destructEdgeType(i) { + let a = "none", n = "arrow_point"; + switch (i) { + case "arrow_point": + case "arrow_circle": + case "arrow_cross": + n = i; + break; + case "double_arrow_point": + case "double_arrow_circle": + case "double_arrow_cross": + a = i.replace("double_", ""), n = a; + break; + } + return { arrowTypeStart: a, arrowTypeEnd: n }; + } + addNodeFromVertex(i, a, n, u, l, f) { + var b; + const c = n.get(i.id), A = u.get(i.id) ?? !1, r = this.findNode(a, i.id); + if (r) + r.cssStyles = i.styles, r.cssCompiledStyles = this.getCompiledStyles(i.classes), r.cssClasses = i.classes.join(" "); + else { + const F = { + id: i.id, + label: i.text, + labelStyle: "", + parentId: c, + padding: ((b = l.flowchart) == null ? void 0 : b.padding) || 8, + cssStyles: i.styles, + cssCompiledStyles: this.getCompiledStyles(["default", "node", ...i.classes]), + cssClasses: "default " + i.classes.join(" "), + dir: i.dir, + domId: i.domId, + look: f, + link: i.link, + linkTarget: i.linkTarget, + tooltip: this.getTooltip(i.id), + icon: i.icon, + pos: i.pos, + img: i.img, + assetWidth: i.assetWidth, + assetHeight: i.assetHeight, + constraint: i.constraint + }; + A ? a.push({ + ...F, + isGroup: !0, + shape: "rect" + }) : a.push({ + ...F, + isGroup: !1, + shape: this.getTypeFromVertex(i) + }); + } + } + getCompiledStyles(i) { + let a = []; + for (const n of i) { + const u = this.classes.get(n); + u != null && u.styles && (a = [...a, ...u.styles ?? []].map((l) => l.trim())), u != null && u.textStyles && (a = [...a, ...u.textStyles ?? []].map((l) => l.trim())); + } + return a; + } + getData() { + const i = G1(), a = [], n = [], u = this.getSubGraphs(), l = /* @__PURE__ */ new Map(), f = /* @__PURE__ */ new Map(); + for (let r = u.length - 1; r >= 0; r--) { + const b = u[r]; + b.nodes.length > 0 && f.set(b.id, !0); + for (const F of b.nodes) + l.set(F, b.id); + } + for (let r = u.length - 1; r >= 0; r--) { + const b = u[r]; + a.push({ + id: b.id, + label: b.title, + labelStyle: "", + parentId: l.get(b.id), + padding: 8, + cssCompiledStyles: this.getCompiledStyles(b.classes), + cssClasses: b.classes.join(" "), + shape: "rect", + dir: b.dir, + isGroup: !0, + look: i.look + }); + } + this.getVertices().forEach((r) => { + this.addNodeFromVertex(r, a, l, f, i, i.look || "classic"); + }); + const A = this.getEdges(); + return A.forEach((r, b) => { + var d; + const { arrowTypeStart: F, arrowTypeEnd: k } = this.destructEdgeType(r.type), U = [...A.defaultStyle ?? []]; + r.style && U.push(...r.style); + const T = { + id: st(r.start, r.end, { counter: b, prefix: "L" }, r.id), + isUserDefinedId: r.isUserDefinedId, + start: r.start, + end: r.end, + type: r.type ?? "normal", + label: r.text, + labelpos: "c", + thickness: r.stroke, + minlen: r.length, + classes: (r == null ? void 0 : r.stroke) === "invisible" ? "" : "edge-thickness-normal edge-pattern-solid flowchart-link", + arrowTypeStart: (r == null ? void 0 : r.stroke) === "invisible" || (r == null ? void 0 : r.type) === "arrow_open" ? "none" : F, + arrowTypeEnd: (r == null ? void 0 : r.stroke) === "invisible" || (r == null ? void 0 : r.type) === "arrow_open" ? "none" : k, + arrowheadStyle: "fill: #333", + cssCompiledStyles: this.getCompiledStyles(r.classes), + labelStyle: U, + style: U, + pattern: r.stroke, + look: i.look, + animate: r.animate, + animation: r.animation, + curve: r.interpolate || this.edges.defaultInterpolate || ((d = i.flowchart) == null ? void 0 : d.curve) + }; + n.push(T); + }), { nodes: a, edges: n, other: {}, config: i }; + } + defaultConfig() { + return re.flowchart; + } +}, m(P1, "FlowDB"), P1), pe = /* @__PURE__ */ m(function(s, i) { + return i.db.getClasses(); +}, "getClasses"), fe = /* @__PURE__ */ m(async function(s, i, a, n) { + var U; + Z.info("REF0:"), Z.info("Drawing state diagram (v2)", i); + const { securityLevel: u, flowchart: l, layout: f } = G1(); + let c; + u === "sandbox" && (c = C1("#i" + i)); + const A = u === "sandbox" ? c.nodes()[0].contentDocument : document; + Z.debug("Before getData: "); + const r = n.db.getData(); + Z.debug("Data: ", r); + const b = le(i, u), F = n.db.getDirection(); + r.type = n.type, r.layoutAlgorithm = ae(f), r.layoutAlgorithm === "dagre" && f === "elk" && Z.warn( + "flowchart-elk was moved to an external package in Mermaid v11. Please refer [release notes](https://github.com/mermaid-js/mermaid/releases/tag/v11.0.0) for more details. This diagram will be rendered using `dagre` layout as a fallback." + ), r.direction = F, r.nodeSpacing = (l == null ? void 0 : l.nodeSpacing) || 50, r.rankSpacing = (l == null ? void 0 : l.rankSpacing) || 50, r.markers = ["point", "circle", "cross"], r.diagramId = i, Z.debug("REF1:", r), await ne(r, b); + const k = ((U = r.config.flowchart) == null ? void 0 : U.diagramPadding) ?? 8; + it.insertTitle( + b, + "flowchartTitleText", + (l == null ? void 0 : l.titleTopMargin) || 0, + n.db.getDiagramTitle() + ), oe(b, k, "flowchart", (l == null ? void 0 : l.useMaxWidth) || !1); + for (const T of r.nodes) { + const d = C1(`#${i} [id="${T.id}"]`); + if (!d || !T.link) + continue; + const K = A.createElementNS("http://www.w3.org/2000/svg", "a"); + K.setAttributeNS("http://www.w3.org/2000/svg", "class", T.cssClasses), K.setAttributeNS("http://www.w3.org/2000/svg", "rel", "noopener"), u === "sandbox" ? K.setAttributeNS("http://www.w3.org/2000/svg", "target", "_top") : T.linkTarget && K.setAttributeNS("http://www.w3.org/2000/svg", "target", T.linkTarget); + const f1 = d.insert(function() { + return K; + }, ":first-child"), g1 = d.select(".label-container"); + g1 && f1.append(function() { + return g1.node(); + }); + const b1 = d.select(".label"); + b1 && f1.append(function() { + return b1.node(); + }); + } +}, "draw"), ge = { + getClasses: pe, + draw: fe +}, rt = function() { + var s = /* @__PURE__ */ m(function(p1, h, p, g) { + for (p = p || {}, g = p1.length; g--; p[p1[g]] = h) ; + return p; + }, "o"), i = [1, 4], a = [1, 3], n = [1, 5], u = [1, 8, 9, 10, 11, 27, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124], l = [2, 2], f = [1, 13], c = [1, 14], A = [1, 15], r = [1, 16], b = [1, 23], F = [1, 25], k = [1, 26], U = [1, 27], T = [1, 49], d = [1, 48], K = [1, 29], f1 = [1, 30], g1 = [1, 31], b1 = [1, 32], M1 = [1, 33], V = [1, 44], L = [1, 46], I = [1, 42], w = [1, 47], R = [1, 43], N = [1, 50], G = [1, 45], P = [1, 51], O = [1, 52], U1 = [1, 34], W1 = [1, 35], z1 = [1, 36], j1 = [1, 37], h1 = [1, 57], E = [1, 8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124], $ = [1, 61], t1 = [1, 60], e1 = [1, 62], S1 = [8, 9, 11, 75, 77, 78], at = [1, 78], D1 = [1, 91], x1 = [1, 96], T1 = [1, 95], E1 = [1, 92], y1 = [1, 88], F1 = [1, 94], _1 = [1, 90], B1 = [1, 97], v1 = [1, 93], V1 = [1, 98], L1 = [1, 89], A1 = [8, 9, 10, 11, 40, 75, 77, 78], W = [8, 9, 10, 11, 40, 46, 75, 77, 78], H = [8, 9, 10, 11, 29, 40, 44, 46, 48, 50, 52, 54, 56, 58, 60, 63, 65, 67, 68, 70, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], nt = [8, 9, 11, 44, 60, 75, 77, 78, 89, 102, 105, 106, 109, 111, 114, 115, 116], I1 = [44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], ut = [1, 121], lt = [1, 122], K1 = [1, 124], Y1 = [1, 123], ot = [44, 60, 62, 74, 89, 102, 105, 106, 109, 111, 114, 115, 116], ct = [1, 133], ht = [1, 147], dt = [1, 148], pt = [1, 149], ft = [1, 150], gt = [1, 135], bt = [1, 137], At = [1, 141], kt = [1, 142], mt = [1, 143], Ct = [1, 144], St = [1, 145], Dt = [1, 146], xt = [1, 151], Tt = [1, 152], Et = [1, 131], yt = [1, 132], Ft = [1, 139], _t = [1, 134], Bt = [1, 138], vt = [1, 136], Q1 = [8, 9, 10, 11, 27, 32, 34, 36, 38, 44, 60, 84, 85, 86, 87, 88, 89, 102, 105, 106, 109, 111, 114, 115, 116, 121, 122, 123, 124], Vt = [1, 154], Lt = [1, 156], B = [8, 9, 11], q = [8, 9, 10, 11, 14, 44, 60, 89, 105, 106, 109, 111, 114, 115, 116], C = [1, 176], z = [1, 172], j = [1, 173], S = [1, 177], D = [1, 174], x = [1, 175], w1 = [77, 116, 119], y = [8, 9, 10, 11, 12, 14, 27, 29, 32, 44, 60, 75, 84, 85, 86, 87, 88, 89, 90, 105, 109, 111, 114, 115, 116], It = [10, 106], d1 = [31, 49, 51, 53, 55, 57, 62, 64, 66, 67, 69, 71, 116, 117, 118], s1 = [1, 247], i1 = [1, 245], r1 = [1, 249], a1 = [1, 243], n1 = [1, 244], u1 = [1, 246], l1 = [1, 248], o1 = [1, 250], R1 = [1, 268], wt = [8, 9, 11, 106], J = [8, 9, 10, 11, 60, 84, 105, 106, 109, 110, 111, 112], J1 = { + trace: /* @__PURE__ */ m(function() { + }, "trace"), + yy: {}, + symbols_: { error: 2, start: 3, graphConfig: 4, document: 5, line: 6, statement: 7, SEMI: 8, NEWLINE: 9, SPACE: 10, EOF: 11, GRAPH: 12, NODIR: 13, DIR: 14, FirstStmtSeparator: 15, ending: 16, endToken: 17, spaceList: 18, spaceListNewline: 19, vertexStatement: 20, separator: 21, styleStatement: 22, linkStyleStatement: 23, classDefStatement: 24, classStatement: 25, clickStatement: 26, subgraph: 27, textNoTags: 28, SQS: 29, text: 30, SQE: 31, end: 32, direction: 33, acc_title: 34, acc_title_value: 35, acc_descr: 36, acc_descr_value: 37, acc_descr_multiline_value: 38, shapeData: 39, SHAPE_DATA: 40, link: 41, node: 42, styledVertex: 43, AMP: 44, vertex: 45, STYLE_SEPARATOR: 46, idString: 47, DOUBLECIRCLESTART: 48, DOUBLECIRCLEEND: 49, PS: 50, PE: 51, "(-": 52, "-)": 53, STADIUMSTART: 54, STADIUMEND: 55, SUBROUTINESTART: 56, SUBROUTINEEND: 57, VERTEX_WITH_PROPS_START: 58, "NODE_STRING[field]": 59, COLON: 60, "NODE_STRING[value]": 61, PIPE: 62, CYLINDERSTART: 63, CYLINDEREND: 64, DIAMOND_START: 65, DIAMOND_STOP: 66, TAGEND: 67, TRAPSTART: 68, TRAPEND: 69, INVTRAPSTART: 70, INVTRAPEND: 71, linkStatement: 72, arrowText: 73, TESTSTR: 74, START_LINK: 75, edgeText: 76, LINK: 77, LINK_ID: 78, edgeTextToken: 79, STR: 80, MD_STR: 81, textToken: 82, keywords: 83, STYLE: 84, LINKSTYLE: 85, CLASSDEF: 86, CLASS: 87, CLICK: 88, DOWN: 89, UP: 90, textNoTagsToken: 91, stylesOpt: 92, "idString[vertex]": 93, "idString[class]": 94, CALLBACKNAME: 95, CALLBACKARGS: 96, HREF: 97, LINK_TARGET: 98, "STR[link]": 99, "STR[tooltip]": 100, alphaNum: 101, DEFAULT: 102, numList: 103, INTERPOLATE: 104, NUM: 105, COMMA: 106, style: 107, styleComponent: 108, NODE_STRING: 109, UNIT: 110, BRKT: 111, PCT: 112, idStringToken: 113, MINUS: 114, MULT: 115, UNICODE_TEXT: 116, TEXT: 117, TAGSTART: 118, EDGE_TEXT: 119, alphaNumToken: 120, direction_tb: 121, direction_bt: 122, direction_rl: 123, direction_lr: 124, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 8: "SEMI", 9: "NEWLINE", 10: "SPACE", 11: "EOF", 12: "GRAPH", 13: "NODIR", 14: "DIR", 27: "subgraph", 29: "SQS", 31: "SQE", 32: "end", 34: "acc_title", 35: "acc_title_value", 36: "acc_descr", 37: "acc_descr_value", 38: "acc_descr_multiline_value", 40: "SHAPE_DATA", 44: "AMP", 46: "STYLE_SEPARATOR", 48: "DOUBLECIRCLESTART", 49: "DOUBLECIRCLEEND", 50: "PS", 51: "PE", 52: "(-", 53: "-)", 54: "STADIUMSTART", 55: "STADIUMEND", 56: "SUBROUTINESTART", 57: "SUBROUTINEEND", 58: "VERTEX_WITH_PROPS_START", 59: "NODE_STRING[field]", 60: "COLON", 61: "NODE_STRING[value]", 62: "PIPE", 63: "CYLINDERSTART", 64: "CYLINDEREND", 65: "DIAMOND_START", 66: "DIAMOND_STOP", 67: "TAGEND", 68: "TRAPSTART", 69: "TRAPEND", 70: "INVTRAPSTART", 71: "INVTRAPEND", 74: "TESTSTR", 75: "START_LINK", 77: "LINK", 78: "LINK_ID", 80: "STR", 81: "MD_STR", 84: "STYLE", 85: "LINKSTYLE", 86: "CLASSDEF", 87: "CLASS", 88: "CLICK", 89: "DOWN", 90: "UP", 93: "idString[vertex]", 94: "idString[class]", 95: "CALLBACKNAME", 96: "CALLBACKARGS", 97: "HREF", 98: "LINK_TARGET", 99: "STR[link]", 100: "STR[tooltip]", 102: "DEFAULT", 104: "INTERPOLATE", 105: "NUM", 106: "COMMA", 109: "NODE_STRING", 110: "UNIT", 111: "BRKT", 112: "PCT", 114: "MINUS", 115: "MULT", 116: "UNICODE_TEXT", 117: "TEXT", 118: "TAGSTART", 119: "EDGE_TEXT", 121: "direction_tb", 122: "direction_bt", 123: "direction_rl", 124: "direction_lr" }, + productions_: [0, [3, 2], [5, 0], [5, 2], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [4, 2], [4, 2], [4, 2], [4, 3], [16, 2], [16, 1], [17, 1], [17, 1], [17, 1], [15, 1], [15, 1], [15, 2], [19, 2], [19, 2], [19, 1], [19, 1], [18, 2], [18, 1], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 2], [7, 9], [7, 6], [7, 4], [7, 1], [7, 2], [7, 2], [7, 1], [21, 1], [21, 1], [21, 1], [39, 2], [39, 1], [20, 4], [20, 3], [20, 4], [20, 2], [20, 2], [20, 1], [42, 1], [42, 6], [42, 5], [43, 1], [43, 3], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 8], [45, 4], [45, 4], [45, 4], [45, 6], [45, 4], [45, 4], [45, 4], [45, 4], [45, 4], [45, 1], [41, 2], [41, 3], [41, 3], [41, 1], [41, 3], [41, 4], [76, 1], [76, 2], [76, 1], [76, 1], [72, 1], [72, 2], [73, 3], [30, 1], [30, 2], [30, 1], [30, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [83, 1], [28, 1], [28, 2], [28, 1], [28, 1], [24, 5], [25, 5], [26, 2], [26, 4], [26, 3], [26, 5], [26, 3], [26, 5], [26, 5], [26, 7], [26, 2], [26, 4], [26, 2], [26, 4], [26, 4], [26, 6], [22, 5], [23, 5], [23, 5], [23, 9], [23, 9], [23, 7], [23, 7], [103, 1], [103, 3], [92, 1], [92, 3], [107, 1], [107, 2], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [108, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [113, 1], [82, 1], [82, 1], [82, 1], [82, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [91, 1], [79, 1], [79, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [120, 1], [47, 1], [47, 2], [101, 1], [101, 2], [33, 1], [33, 1], [33, 1], [33, 1]], + performAction: /* @__PURE__ */ m(function(h, p, g, o, _, t, O1) { + var e = t.length - 1; + switch (_) { + case 2: + this.$ = []; + break; + case 3: + (!Array.isArray(t[e]) || t[e].length > 0) && t[e - 1].push(t[e]), this.$ = t[e - 1]; + break; + case 4: + case 183: + this.$ = t[e]; + break; + case 11: + o.setDirection("TB"), this.$ = "TB"; + break; + case 12: + o.setDirection(t[e - 1]), this.$ = t[e - 1]; + break; + case 27: + this.$ = t[e - 1].nodes; + break; + case 28: + case 29: + case 30: + case 31: + case 32: + this.$ = []; + break; + case 33: + this.$ = o.addSubGraph(t[e - 6], t[e - 1], t[e - 4]); + break; + case 34: + this.$ = o.addSubGraph(t[e - 3], t[e - 1], t[e - 3]); + break; + case 35: + this.$ = o.addSubGraph(void 0, t[e - 1], void 0); + break; + case 37: + this.$ = t[e].trim(), o.setAccTitle(this.$); + break; + case 38: + case 39: + this.$ = t[e].trim(), o.setAccDescription(this.$); + break; + case 43: + this.$ = t[e - 1] + t[e]; + break; + case 44: + this.$ = t[e]; + break; + case 45: + o.addVertex(t[e - 1][t[e - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, t[e]), o.addLink(t[e - 3].stmt, t[e - 1], t[e - 2]), this.$ = { stmt: t[e - 1], nodes: t[e - 1].concat(t[e - 3].nodes) }; + break; + case 46: + o.addLink(t[e - 2].stmt, t[e], t[e - 1]), this.$ = { stmt: t[e], nodes: t[e].concat(t[e - 2].nodes) }; + break; + case 47: + o.addLink(t[e - 3].stmt, t[e - 1], t[e - 2]), this.$ = { stmt: t[e - 1], nodes: t[e - 1].concat(t[e - 3].nodes) }; + break; + case 48: + this.$ = { stmt: t[e - 1], nodes: t[e - 1] }; + break; + case 49: + o.addVertex(t[e - 1][t[e - 1].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, t[e]), this.$ = { stmt: t[e - 1], nodes: t[e - 1], shapeData: t[e] }; + break; + case 50: + this.$ = { stmt: t[e], nodes: t[e] }; + break; + case 51: + this.$ = [t[e]]; + break; + case 52: + o.addVertex(t[e - 5][t[e - 5].length - 1], void 0, void 0, void 0, void 0, void 0, void 0, t[e - 4]), this.$ = t[e - 5].concat(t[e]); + break; + case 53: + this.$ = t[e - 4].concat(t[e]); + break; + case 54: + this.$ = t[e]; + break; + case 55: + this.$ = t[e - 2], o.setClass(t[e - 2], t[e]); + break; + case 56: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "square"); + break; + case 57: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "doublecircle"); + break; + case 58: + this.$ = t[e - 5], o.addVertex(t[e - 5], t[e - 2], "circle"); + break; + case 59: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "ellipse"); + break; + case 60: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "stadium"); + break; + case 61: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "subroutine"); + break; + case 62: + this.$ = t[e - 7], o.addVertex(t[e - 7], t[e - 1], "rect", void 0, void 0, void 0, Object.fromEntries([[t[e - 5], t[e - 3]]])); + break; + case 63: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "cylinder"); + break; + case 64: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "round"); + break; + case 65: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "diamond"); + break; + case 66: + this.$ = t[e - 5], o.addVertex(t[e - 5], t[e - 2], "hexagon"); + break; + case 67: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "odd"); + break; + case 68: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "trapezoid"); + break; + case 69: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "inv_trapezoid"); + break; + case 70: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "lean_right"); + break; + case 71: + this.$ = t[e - 3], o.addVertex(t[e - 3], t[e - 1], "lean_left"); + break; + case 72: + this.$ = t[e], o.addVertex(t[e]); + break; + case 73: + t[e - 1].text = t[e], this.$ = t[e - 1]; + break; + case 74: + case 75: + t[e - 2].text = t[e - 1], this.$ = t[e - 2]; + break; + case 76: + this.$ = t[e]; + break; + case 77: + var v = o.destructLink(t[e], t[e - 2]); + this.$ = { type: v.type, stroke: v.stroke, length: v.length, text: t[e - 1] }; + break; + case 78: + var v = o.destructLink(t[e], t[e - 2]); + this.$ = { type: v.type, stroke: v.stroke, length: v.length, text: t[e - 1], id: t[e - 3] }; + break; + case 79: + this.$ = { text: t[e], type: "text" }; + break; + case 80: + this.$ = { text: t[e - 1].text + "" + t[e], type: t[e - 1].type }; + break; + case 81: + this.$ = { text: t[e], type: "string" }; + break; + case 82: + this.$ = { text: t[e], type: "markdown" }; + break; + case 83: + var v = o.destructLink(t[e]); + this.$ = { type: v.type, stroke: v.stroke, length: v.length }; + break; + case 84: + var v = o.destructLink(t[e]); + this.$ = { type: v.type, stroke: v.stroke, length: v.length, id: t[e - 1] }; + break; + case 85: + this.$ = t[e - 1]; + break; + case 86: + this.$ = { text: t[e], type: "text" }; + break; + case 87: + this.$ = { text: t[e - 1].text + "" + t[e], type: t[e - 1].type }; + break; + case 88: + this.$ = { text: t[e], type: "string" }; + break; + case 89: + case 104: + this.$ = { text: t[e], type: "markdown" }; + break; + case 101: + this.$ = { text: t[e], type: "text" }; + break; + case 102: + this.$ = { text: t[e - 1].text + "" + t[e], type: t[e - 1].type }; + break; + case 103: + this.$ = { text: t[e], type: "text" }; + break; + case 105: + this.$ = t[e - 4], o.addClass(t[e - 2], t[e]); + break; + case 106: + this.$ = t[e - 4], o.setClass(t[e - 2], t[e]); + break; + case 107: + case 115: + this.$ = t[e - 1], o.setClickEvent(t[e - 1], t[e]); + break; + case 108: + case 116: + this.$ = t[e - 3], o.setClickEvent(t[e - 3], t[e - 2]), o.setTooltip(t[e - 3], t[e]); + break; + case 109: + this.$ = t[e - 2], o.setClickEvent(t[e - 2], t[e - 1], t[e]); + break; + case 110: + this.$ = t[e - 4], o.setClickEvent(t[e - 4], t[e - 3], t[e - 2]), o.setTooltip(t[e - 4], t[e]); + break; + case 111: + this.$ = t[e - 2], o.setLink(t[e - 2], t[e]); + break; + case 112: + this.$ = t[e - 4], o.setLink(t[e - 4], t[e - 2]), o.setTooltip(t[e - 4], t[e]); + break; + case 113: + this.$ = t[e - 4], o.setLink(t[e - 4], t[e - 2], t[e]); + break; + case 114: + this.$ = t[e - 6], o.setLink(t[e - 6], t[e - 4], t[e]), o.setTooltip(t[e - 6], t[e - 2]); + break; + case 117: + this.$ = t[e - 1], o.setLink(t[e - 1], t[e]); + break; + case 118: + this.$ = t[e - 3], o.setLink(t[e - 3], t[e - 2]), o.setTooltip(t[e - 3], t[e]); + break; + case 119: + this.$ = t[e - 3], o.setLink(t[e - 3], t[e - 2], t[e]); + break; + case 120: + this.$ = t[e - 5], o.setLink(t[e - 5], t[e - 4], t[e]), o.setTooltip(t[e - 5], t[e - 2]); + break; + case 121: + this.$ = t[e - 4], o.addVertex(t[e - 2], void 0, void 0, t[e]); + break; + case 122: + this.$ = t[e - 4], o.updateLink([t[e - 2]], t[e]); + break; + case 123: + this.$ = t[e - 4], o.updateLink(t[e - 2], t[e]); + break; + case 124: + this.$ = t[e - 8], o.updateLinkInterpolate([t[e - 6]], t[e - 2]), o.updateLink([t[e - 6]], t[e]); + break; + case 125: + this.$ = t[e - 8], o.updateLinkInterpolate(t[e - 6], t[e - 2]), o.updateLink(t[e - 6], t[e]); + break; + case 126: + this.$ = t[e - 6], o.updateLinkInterpolate([t[e - 4]], t[e]); + break; + case 127: + this.$ = t[e - 6], o.updateLinkInterpolate(t[e - 4], t[e]); + break; + case 128: + case 130: + this.$ = [t[e]]; + break; + case 129: + case 131: + t[e - 2].push(t[e]), this.$ = t[e - 2]; + break; + case 133: + this.$ = t[e - 1] + t[e]; + break; + case 181: + this.$ = t[e]; + break; + case 182: + this.$ = t[e - 1] + "" + t[e]; + break; + case 184: + this.$ = t[e - 1] + "" + t[e]; + break; + case 185: + this.$ = { stmt: "dir", value: "TB" }; + break; + case 186: + this.$ = { stmt: "dir", value: "BT" }; + break; + case 187: + this.$ = { stmt: "dir", value: "RL" }; + break; + case 188: + this.$ = { stmt: "dir", value: "LR" }; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: 2, 9: i, 10: a, 12: n }, { 1: [3] }, s(u, l, { 5: 6 }), { 4: 7, 9: i, 10: a, 12: n }, { 4: 8, 9: i, 10: a, 12: n }, { 13: [1, 9], 14: [1, 10] }, { 1: [2, 1], 6: 11, 7: 12, 8: f, 9: c, 10: A, 11: r, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: b, 33: 24, 34: F, 36: k, 38: U, 42: 28, 43: 38, 44: T, 45: 39, 47: 40, 60: d, 84: K, 85: f1, 86: g1, 87: b1, 88: M1, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O, 121: U1, 122: W1, 123: z1, 124: j1 }, s(u, [2, 9]), s(u, [2, 10]), s(u, [2, 11]), { 8: [1, 54], 9: [1, 55], 10: h1, 15: 53, 18: 56 }, s(E, [2, 3]), s(E, [2, 4]), s(E, [2, 5]), s(E, [2, 6]), s(E, [2, 7]), s(E, [2, 8]), { 8: $, 9: t1, 11: e1, 21: 58, 41: 59, 72: 63, 75: [1, 64], 77: [1, 66], 78: [1, 65] }, { 8: $, 9: t1, 11: e1, 21: 67 }, { 8: $, 9: t1, 11: e1, 21: 68 }, { 8: $, 9: t1, 11: e1, 21: 69 }, { 8: $, 9: t1, 11: e1, 21: 70 }, { 8: $, 9: t1, 11: e1, 21: 71 }, { 8: $, 9: t1, 10: [1, 72], 11: e1, 21: 73 }, s(E, [2, 36]), { 35: [1, 74] }, { 37: [1, 75] }, s(E, [2, 39]), s(S1, [2, 50], { 18: 76, 39: 77, 10: h1, 40: at }), { 10: [1, 79] }, { 10: [1, 80] }, { 10: [1, 81] }, { 10: [1, 82] }, { 14: D1, 44: x1, 60: T1, 80: [1, 86], 89: E1, 95: [1, 83], 97: [1, 84], 101: 85, 105: y1, 106: F1, 109: _1, 111: B1, 114: v1, 115: V1, 116: L1, 120: 87 }, s(E, [2, 185]), s(E, [2, 186]), s(E, [2, 187]), s(E, [2, 188]), s(A1, [2, 51]), s(A1, [2, 54], { 46: [1, 99] }), s(W, [2, 72], { 113: 112, 29: [1, 100], 44: T, 48: [1, 101], 50: [1, 102], 52: [1, 103], 54: [1, 104], 56: [1, 105], 58: [1, 106], 60: d, 63: [1, 107], 65: [1, 108], 67: [1, 109], 68: [1, 110], 70: [1, 111], 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 114: G, 115: P, 116: O }), s(H, [2, 181]), s(H, [2, 142]), s(H, [2, 143]), s(H, [2, 144]), s(H, [2, 145]), s(H, [2, 146]), s(H, [2, 147]), s(H, [2, 148]), s(H, [2, 149]), s(H, [2, 150]), s(H, [2, 151]), s(H, [2, 152]), s(u, [2, 12]), s(u, [2, 18]), s(u, [2, 19]), { 9: [1, 113] }, s(nt, [2, 26], { 18: 114, 10: h1 }), s(E, [2, 27]), { 42: 115, 43: 38, 44: T, 45: 39, 47: 40, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, s(E, [2, 40]), s(E, [2, 41]), s(E, [2, 42]), s(I1, [2, 76], { 73: 116, 62: [1, 118], 74: [1, 117] }), { 76: 119, 79: 120, 80: ut, 81: lt, 116: K1, 119: Y1 }, { 75: [1, 125], 77: [1, 126] }, s(ot, [2, 83]), s(E, [2, 28]), s(E, [2, 29]), s(E, [2, 30]), s(E, [2, 31]), s(E, [2, 32]), { 10: ct, 12: ht, 14: dt, 27: pt, 28: 127, 32: ft, 44: gt, 60: bt, 75: At, 80: [1, 129], 81: [1, 130], 83: 140, 84: kt, 85: mt, 86: Ct, 87: St, 88: Dt, 89: xt, 90: Tt, 91: 128, 105: Et, 109: yt, 111: Ft, 114: _t, 115: Bt, 116: vt }, s(Q1, l, { 5: 153 }), s(E, [2, 37]), s(E, [2, 38]), s(S1, [2, 48], { 44: Vt }), s(S1, [2, 49], { 18: 155, 10: h1, 40: Lt }), s(A1, [2, 44]), { 44: T, 47: 157, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, { 102: [1, 158], 103: 159, 105: [1, 160] }, { 44: T, 47: 161, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, { 44: T, 47: 162, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, s(B, [2, 107], { 10: [1, 163], 96: [1, 164] }), { 80: [1, 165] }, s(B, [2, 115], { 120: 167, 10: [1, 166], 14: D1, 44: x1, 60: T1, 89: E1, 105: y1, 106: F1, 109: _1, 111: B1, 114: v1, 115: V1, 116: L1 }), s(B, [2, 117], { 10: [1, 168] }), s(q, [2, 183]), s(q, [2, 170]), s(q, [2, 171]), s(q, [2, 172]), s(q, [2, 173]), s(q, [2, 174]), s(q, [2, 175]), s(q, [2, 176]), s(q, [2, 177]), s(q, [2, 178]), s(q, [2, 179]), s(q, [2, 180]), { 44: T, 47: 169, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, { 30: 170, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 178, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 180, 50: [1, 179], 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 181, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 182, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 183, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 109: [1, 184] }, { 30: 185, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 186, 65: [1, 187], 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 188, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 189, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 30: 190, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, s(H, [2, 182]), s(u, [2, 20]), s(nt, [2, 25]), s(S1, [2, 46], { 39: 191, 18: 192, 10: h1, 40: at }), s(I1, [2, 73], { 10: [1, 193] }), { 10: [1, 194] }, { 30: 195, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 77: [1, 196], 79: 197, 116: K1, 119: Y1 }, s(w1, [2, 79]), s(w1, [2, 81]), s(w1, [2, 82]), s(w1, [2, 168]), s(w1, [2, 169]), { 76: 198, 79: 120, 80: ut, 81: lt, 116: K1, 119: Y1 }, s(ot, [2, 84]), { 8: $, 9: t1, 10: ct, 11: e1, 12: ht, 14: dt, 21: 200, 27: pt, 29: [1, 199], 32: ft, 44: gt, 60: bt, 75: At, 83: 140, 84: kt, 85: mt, 86: Ct, 87: St, 88: Dt, 89: xt, 90: Tt, 91: 201, 105: Et, 109: yt, 111: Ft, 114: _t, 115: Bt, 116: vt }, s(y, [2, 101]), s(y, [2, 103]), s(y, [2, 104]), s(y, [2, 157]), s(y, [2, 158]), s(y, [2, 159]), s(y, [2, 160]), s(y, [2, 161]), s(y, [2, 162]), s(y, [2, 163]), s(y, [2, 164]), s(y, [2, 165]), s(y, [2, 166]), s(y, [2, 167]), s(y, [2, 90]), s(y, [2, 91]), s(y, [2, 92]), s(y, [2, 93]), s(y, [2, 94]), s(y, [2, 95]), s(y, [2, 96]), s(y, [2, 97]), s(y, [2, 98]), s(y, [2, 99]), s(y, [2, 100]), { 6: 11, 7: 12, 8: f, 9: c, 10: A, 11: r, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: b, 32: [1, 202], 33: 24, 34: F, 36: k, 38: U, 42: 28, 43: 38, 44: T, 45: 39, 47: 40, 60: d, 84: K, 85: f1, 86: g1, 87: b1, 88: M1, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O, 121: U1, 122: W1, 123: z1, 124: j1 }, { 10: h1, 18: 203 }, { 44: [1, 204] }, s(A1, [2, 43]), { 10: [1, 205], 44: T, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 112, 114: G, 115: P, 116: O }, { 10: [1, 206] }, { 10: [1, 207], 106: [1, 208] }, s(It, [2, 128]), { 10: [1, 209], 44: T, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 112, 114: G, 115: P, 116: O }, { 10: [1, 210], 44: T, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 112, 114: G, 115: P, 116: O }, { 80: [1, 211] }, s(B, [2, 109], { 10: [1, 212] }), s(B, [2, 111], { 10: [1, 213] }), { 80: [1, 214] }, s(q, [2, 184]), { 80: [1, 215], 98: [1, 216] }, s(A1, [2, 55], { 113: 112, 44: T, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 114: G, 115: P, 116: O }), { 31: [1, 217], 67: C, 82: 218, 116: S, 117: D, 118: x }, s(d1, [2, 86]), s(d1, [2, 88]), s(d1, [2, 89]), s(d1, [2, 153]), s(d1, [2, 154]), s(d1, [2, 155]), s(d1, [2, 156]), { 49: [1, 219], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 30: 220, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 51: [1, 221], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 53: [1, 222], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 55: [1, 223], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 57: [1, 224], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 60: [1, 225] }, { 64: [1, 226], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 66: [1, 227], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 30: 228, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, { 31: [1, 229], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 67: C, 69: [1, 230], 71: [1, 231], 82: 218, 116: S, 117: D, 118: x }, { 67: C, 69: [1, 233], 71: [1, 232], 82: 218, 116: S, 117: D, 118: x }, s(S1, [2, 45], { 18: 155, 10: h1, 40: Lt }), s(S1, [2, 47], { 44: Vt }), s(I1, [2, 75]), s(I1, [2, 74]), { 62: [1, 234], 67: C, 82: 218, 116: S, 117: D, 118: x }, s(I1, [2, 77]), s(w1, [2, 80]), { 77: [1, 235], 79: 197, 116: K1, 119: Y1 }, { 30: 236, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, s(Q1, l, { 5: 237 }), s(y, [2, 102]), s(E, [2, 35]), { 43: 238, 44: T, 45: 39, 47: 40, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, { 10: h1, 18: 239 }, { 10: s1, 60: i1, 84: r1, 92: 240, 105: a1, 107: 241, 108: 242, 109: n1, 110: u1, 111: l1, 112: o1 }, { 10: s1, 60: i1, 84: r1, 92: 251, 104: [1, 252], 105: a1, 107: 241, 108: 242, 109: n1, 110: u1, 111: l1, 112: o1 }, { 10: s1, 60: i1, 84: r1, 92: 253, 104: [1, 254], 105: a1, 107: 241, 108: 242, 109: n1, 110: u1, 111: l1, 112: o1 }, { 105: [1, 255] }, { 10: s1, 60: i1, 84: r1, 92: 256, 105: a1, 107: 241, 108: 242, 109: n1, 110: u1, 111: l1, 112: o1 }, { 44: T, 47: 257, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, s(B, [2, 108]), { 80: [1, 258] }, { 80: [1, 259], 98: [1, 260] }, s(B, [2, 116]), s(B, [2, 118], { 10: [1, 261] }), s(B, [2, 119]), s(W, [2, 56]), s(d1, [2, 87]), s(W, [2, 57]), { 51: [1, 262], 67: C, 82: 218, 116: S, 117: D, 118: x }, s(W, [2, 64]), s(W, [2, 59]), s(W, [2, 60]), s(W, [2, 61]), { 109: [1, 263] }, s(W, [2, 63]), s(W, [2, 65]), { 66: [1, 264], 67: C, 82: 218, 116: S, 117: D, 118: x }, s(W, [2, 67]), s(W, [2, 68]), s(W, [2, 70]), s(W, [2, 69]), s(W, [2, 71]), s([10, 44, 60, 89, 102, 105, 106, 109, 111, 114, 115, 116], [2, 85]), s(I1, [2, 78]), { 31: [1, 265], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 6: 11, 7: 12, 8: f, 9: c, 10: A, 11: r, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: b, 32: [1, 266], 33: 24, 34: F, 36: k, 38: U, 42: 28, 43: 38, 44: T, 45: 39, 47: 40, 60: d, 84: K, 85: f1, 86: g1, 87: b1, 88: M1, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O, 121: U1, 122: W1, 123: z1, 124: j1 }, s(A1, [2, 53]), { 43: 267, 44: T, 45: 39, 47: 40, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O }, s(B, [2, 121], { 106: R1 }), s(wt, [2, 130], { 108: 269, 10: s1, 60: i1, 84: r1, 105: a1, 109: n1, 110: u1, 111: l1, 112: o1 }), s(J, [2, 132]), s(J, [2, 134]), s(J, [2, 135]), s(J, [2, 136]), s(J, [2, 137]), s(J, [2, 138]), s(J, [2, 139]), s(J, [2, 140]), s(J, [2, 141]), s(B, [2, 122], { 106: R1 }), { 10: [1, 270] }, s(B, [2, 123], { 106: R1 }), { 10: [1, 271] }, s(It, [2, 129]), s(B, [2, 105], { 106: R1 }), s(B, [2, 106], { 113: 112, 44: T, 60: d, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 114: G, 115: P, 116: O }), s(B, [2, 110]), s(B, [2, 112], { 10: [1, 272] }), s(B, [2, 113]), { 98: [1, 273] }, { 51: [1, 274] }, { 62: [1, 275] }, { 66: [1, 276] }, { 8: $, 9: t1, 11: e1, 21: 277 }, s(E, [2, 34]), s(A1, [2, 52]), { 10: s1, 60: i1, 84: r1, 105: a1, 107: 278, 108: 242, 109: n1, 110: u1, 111: l1, 112: o1 }, s(J, [2, 133]), { 14: D1, 44: x1, 60: T1, 89: E1, 101: 279, 105: y1, 106: F1, 109: _1, 111: B1, 114: v1, 115: V1, 116: L1, 120: 87 }, { 14: D1, 44: x1, 60: T1, 89: E1, 101: 280, 105: y1, 106: F1, 109: _1, 111: B1, 114: v1, 115: V1, 116: L1, 120: 87 }, { 98: [1, 281] }, s(B, [2, 120]), s(W, [2, 58]), { 30: 282, 67: C, 80: z, 81: j, 82: 171, 116: S, 117: D, 118: x }, s(W, [2, 66]), s(Q1, l, { 5: 283 }), s(wt, [2, 131], { 108: 269, 10: s1, 60: i1, 84: r1, 105: a1, 109: n1, 110: u1, 111: l1, 112: o1 }), s(B, [2, 126], { 120: 167, 10: [1, 284], 14: D1, 44: x1, 60: T1, 89: E1, 105: y1, 106: F1, 109: _1, 111: B1, 114: v1, 115: V1, 116: L1 }), s(B, [2, 127], { 120: 167, 10: [1, 285], 14: D1, 44: x1, 60: T1, 89: E1, 105: y1, 106: F1, 109: _1, 111: B1, 114: v1, 115: V1, 116: L1 }), s(B, [2, 114]), { 31: [1, 286], 67: C, 82: 218, 116: S, 117: D, 118: x }, { 6: 11, 7: 12, 8: f, 9: c, 10: A, 11: r, 20: 17, 22: 18, 23: 19, 24: 20, 25: 21, 26: 22, 27: b, 32: [1, 287], 33: 24, 34: F, 36: k, 38: U, 42: 28, 43: 38, 44: T, 45: 39, 47: 40, 60: d, 84: K, 85: f1, 86: g1, 87: b1, 88: M1, 89: V, 102: L, 105: I, 106: w, 109: R, 111: N, 113: 41, 114: G, 115: P, 116: O, 121: U1, 122: W1, 123: z1, 124: j1 }, { 10: s1, 60: i1, 84: r1, 92: 288, 105: a1, 107: 241, 108: 242, 109: n1, 110: u1, 111: l1, 112: o1 }, { 10: s1, 60: i1, 84: r1, 92: 289, 105: a1, 107: 241, 108: 242, 109: n1, 110: u1, 111: l1, 112: o1 }, s(W, [2, 62]), s(E, [2, 33]), s(B, [2, 124], { 106: R1 }), s(B, [2, 125], { 106: R1 })], + defaultActions: {}, + parseError: /* @__PURE__ */ m(function(h, p) { + if (p.recoverable) + this.trace(h); + else { + var g = new Error(h); + throw g.hash = p, g; + } + }, "parseError"), + parse: /* @__PURE__ */ m(function(h) { + var p = this, g = [0], o = [], _ = [null], t = [], O1 = this.table, e = "", v = 0, Rt = 0, zt = 2, Nt = 1, jt = t.slice.call(arguments, 1), M = Object.create(this.lexer), k1 = { yy: {} }; + for (var Z1 in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, Z1) && (k1.yy[Z1] = this.yy[Z1]); + M.setInput(h, k1.yy), k1.yy.lexer = M, k1.yy.parser = this, typeof M.yylloc > "u" && (M.yylloc = {}); + var $1 = M.yylloc; + t.push($1); + var Kt = M.options && M.options.ranges; + typeof k1.yy.parseError == "function" ? this.parseError = k1.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function Yt(X) { + g.length = g.length - 2 * X, _.length = _.length - X, t.length = t.length - X; + } + m(Yt, "popStack"); + function Gt() { + var X; + return X = o.pop() || M.lex() || Nt, typeof X != "number" && (X instanceof Array && (o = X, X = o.pop()), X = p.symbols_[X] || X), X; + } + m(Gt, "lex"); + for (var Y, m1, Q, tt, N1 = {}, q1, c1, Pt, X1; ; ) { + if (m1 = g[g.length - 1], this.defaultActions[m1] ? Q = this.defaultActions[m1] : ((Y === null || typeof Y > "u") && (Y = Gt()), Q = O1[m1] && O1[m1][Y]), typeof Q > "u" || !Q.length || !Q[0]) { + var et = ""; + X1 = []; + for (q1 in O1[m1]) + this.terminals_[q1] && q1 > zt && X1.push("'" + this.terminals_[q1] + "'"); + M.showPosition ? et = "Parse error on line " + (v + 1) + `: +` + M.showPosition() + ` +Expecting ` + X1.join(", ") + ", got '" + (this.terminals_[Y] || Y) + "'" : et = "Parse error on line " + (v + 1) + ": Unexpected " + (Y == Nt ? "end of input" : "'" + (this.terminals_[Y] || Y) + "'"), this.parseError(et, { + text: M.match, + token: this.terminals_[Y] || Y, + line: M.yylineno, + loc: $1, + expected: X1 + }); + } + if (Q[0] instanceof Array && Q.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + m1 + ", token: " + Y); + switch (Q[0]) { + case 1: + g.push(Y), _.push(M.yytext), t.push(M.yylloc), g.push(Q[1]), Y = null, Rt = M.yyleng, e = M.yytext, v = M.yylineno, $1 = M.yylloc; + break; + case 2: + if (c1 = this.productions_[Q[1]][1], N1.$ = _[_.length - c1], N1._$ = { + first_line: t[t.length - (c1 || 1)].first_line, + last_line: t[t.length - 1].last_line, + first_column: t[t.length - (c1 || 1)].first_column, + last_column: t[t.length - 1].last_column + }, Kt && (N1._$.range = [ + t[t.length - (c1 || 1)].range[0], + t[t.length - 1].range[1] + ]), tt = this.performAction.apply(N1, [ + e, + Rt, + v, + k1.yy, + Q[1], + _, + t + ].concat(jt)), typeof tt < "u") + return tt; + c1 && (g = g.slice(0, -1 * c1 * 2), _ = _.slice(0, -1 * c1), t = t.slice(0, -1 * c1)), g.push(this.productions_[Q[1]][0]), _.push(N1.$), t.push(N1._$), Pt = O1[g[g.length - 2]][g[g.length - 1]], g.push(Pt); + break; + case 3: + return !0; + } + } + return !0; + }, "parse") + }, Wt = /* @__PURE__ */ function() { + var p1 = { + EOF: 1, + parseError: /* @__PURE__ */ m(function(p, g) { + if (this.yy.parser) + this.yy.parser.parseError(p, g); + else + throw new Error(p); + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ m(function(h, p) { + return this.yy = p || this.yy || {}, this._input = h, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ m(function() { + var h = this._input[0]; + this.yytext += h, this.yyleng++, this.offset++, this.match += h, this.matched += h; + var p = h.match(/(?:\r\n?|\n).*/g); + return p ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), h; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ m(function(h) { + var p = h.length, g = h.split(/(?:\r\n?|\n)/g); + this._input = h + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - p), this.offset -= p; + var o = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), g.length - 1 && (this.yylineno -= g.length - 1); + var _ = this.yylloc.range; + return this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: g ? (g.length === o.length ? this.yylloc.first_column : 0) + o[o.length - g.length].length - g[0].length : this.yylloc.first_column - p + }, this.options.ranges && (this.yylloc.range = [_[0], _[0] + this.yyleng - p]), this.yyleng = this.yytext.length, this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ m(function() { + return this._more = !0, this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ m(function() { + if (this.options.backtrack_lexer) + this._backtrack = !0; + else + return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ m(function(h) { + this.unput(this.match.slice(h)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ m(function() { + var h = this.matched.substr(0, this.matched.length - this.match.length); + return (h.length > 20 ? "..." : "") + h.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ m(function() { + var h = this.match; + return h.length < 20 && (h += this._input.substr(0, 20 - h.length)), (h.substr(0, 20) + (h.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ m(function() { + var h = this.pastInput(), p = new Array(h.length + 1).join("-"); + return h + this.upcomingInput() + ` +` + p + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ m(function(h, p) { + var g, o, _; + if (this.options.backtrack_lexer && (_ = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }, this.options.ranges && (_.yylloc.range = this.yylloc.range.slice(0))), o = h[0].match(/(?:\r\n?|\n).*/g), o && (this.yylineno += o.length), this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: o ? o[o.length - 1].length - o[o.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + h[0].length + }, this.yytext += h[0], this.match += h[0], this.matches = h, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(h[0].length), this.matched += h[0], g = this.performAction.call(this, this.yy, this, p, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), g) + return g; + if (this._backtrack) { + for (var t in _) + this[t] = _[t]; + return !1; + } + return !1; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ m(function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var h, p, g, o; + this._more || (this.yytext = "", this.match = ""); + for (var _ = this._currentRules(), t = 0; t < _.length; t++) + if (g = this._input.match(this.rules[_[t]]), g && (!p || g[0].length > p[0].length)) { + if (p = g, o = t, this.options.backtrack_lexer) { + if (h = this.test_match(g, _[t]), h !== !1) + return h; + if (this._backtrack) { + p = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return p ? (h = this.test_match(p, _[o]), h !== !1 ? h : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ m(function() { + var p = this.next(); + return p || this.lex(); + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ m(function(p) { + this.conditionStack.push(p); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ m(function() { + var p = this.conditionStack.length - 1; + return p > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ m(function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ m(function(p) { + return p = this.conditionStack.length - 1 - Math.abs(p || 0), p >= 0 ? this.conditionStack[p] : "INITIAL"; + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ m(function(p) { + this.begin(p); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ m(function() { + return this.conditionStack.length; + }, "stateStackSize"), + options: {}, + performAction: /* @__PURE__ */ m(function(p, g, o, _) { + switch (o) { + case 0: + return this.begin("acc_title"), 34; + case 1: + return this.popState(), "acc_title_value"; + case 2: + return this.begin("acc_descr"), 36; + case 3: + return this.popState(), "acc_descr_value"; + case 4: + this.begin("acc_descr_multiline"); + break; + case 5: + this.popState(); + break; + case 6: + return "acc_descr_multiline_value"; + case 7: + return this.pushState("shapeData"), g.yytext = "", 40; + case 8: + return this.pushState("shapeDataStr"), 40; + case 9: + return this.popState(), 40; + case 10: + const t = /\n\s*/g; + return g.yytext = g.yytext.replace(t, "
"), 40; + case 11: + return 40; + case 12: + this.popState(); + break; + case 13: + this.begin("callbackname"); + break; + case 14: + this.popState(); + break; + case 15: + this.popState(), this.begin("callbackargs"); + break; + case 16: + return 95; + case 17: + this.popState(); + break; + case 18: + return 96; + case 19: + return "MD_STR"; + case 20: + this.popState(); + break; + case 21: + this.begin("md_string"); + break; + case 22: + return "STR"; + case 23: + this.popState(); + break; + case 24: + this.pushState("string"); + break; + case 25: + return 84; + case 26: + return 102; + case 27: + return 85; + case 28: + return 104; + case 29: + return 86; + case 30: + return 87; + case 31: + return 97; + case 32: + this.begin("click"); + break; + case 33: + this.popState(); + break; + case 34: + return 88; + case 35: + return p.lex.firstGraph() && this.begin("dir"), 12; + case 36: + return p.lex.firstGraph() && this.begin("dir"), 12; + case 37: + return p.lex.firstGraph() && this.begin("dir"), 12; + case 38: + return 27; + case 39: + return 32; + case 40: + return 98; + case 41: + return 98; + case 42: + return 98; + case 43: + return 98; + case 44: + return this.popState(), 13; + case 45: + return this.popState(), 14; + case 46: + return this.popState(), 14; + case 47: + return this.popState(), 14; + case 48: + return this.popState(), 14; + case 49: + return this.popState(), 14; + case 50: + return this.popState(), 14; + case 51: + return this.popState(), 14; + case 52: + return this.popState(), 14; + case 53: + return this.popState(), 14; + case 54: + return this.popState(), 14; + case 55: + return 121; + case 56: + return 122; + case 57: + return 123; + case 58: + return 124; + case 59: + return 78; + case 60: + return 105; + case 61: + return 111; + case 62: + return 46; + case 63: + return 60; + case 64: + return 44; + case 65: + return 8; + case 66: + return 106; + case 67: + return 115; + case 68: + return this.popState(), 77; + case 69: + return this.pushState("edgeText"), 75; + case 70: + return 119; + case 71: + return this.popState(), 77; + case 72: + return this.pushState("thickEdgeText"), 75; + case 73: + return 119; + case 74: + return this.popState(), 77; + case 75: + return this.pushState("dottedEdgeText"), 75; + case 76: + return 119; + case 77: + return 77; + case 78: + return this.popState(), 53; + case 79: + return "TEXT"; + case 80: + return this.pushState("ellipseText"), 52; + case 81: + return this.popState(), 55; + case 82: + return this.pushState("text"), 54; + case 83: + return this.popState(), 57; + case 84: + return this.pushState("text"), 56; + case 85: + return 58; + case 86: + return this.pushState("text"), 67; + case 87: + return this.popState(), 64; + case 88: + return this.pushState("text"), 63; + case 89: + return this.popState(), 49; + case 90: + return this.pushState("text"), 48; + case 91: + return this.popState(), 69; + case 92: + return this.popState(), 71; + case 93: + return 117; + case 94: + return this.pushState("trapText"), 68; + case 95: + return this.pushState("trapText"), 70; + case 96: + return 118; + case 97: + return 67; + case 98: + return 90; + case 99: + return "SEP"; + case 100: + return 89; + case 101: + return 115; + case 102: + return 111; + case 103: + return 44; + case 104: + return 109; + case 105: + return 114; + case 106: + return 116; + case 107: + return this.popState(), 62; + case 108: + return this.pushState("text"), 62; + case 109: + return this.popState(), 51; + case 110: + return this.pushState("text"), 50; + case 111: + return this.popState(), 31; + case 112: + return this.pushState("text"), 29; + case 113: + return this.popState(), 66; + case 114: + return this.pushState("text"), 65; + case 115: + return "TEXT"; + case 116: + return "QUOTE"; + case 117: + return 9; + case 118: + return 10; + case 119: + return 11; + } + }, "anonymous"), + rules: [/^(?:accTitle\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*:\s*)/, /^(?:(?!\n||)*[^\n]*)/, /^(?:accDescr\s*\{\s*)/, /^(?:[\}])/, /^(?:[^\}]*)/, /^(?:@\{)/, /^(?:["])/, /^(?:["])/, /^(?:[^\"]+)/, /^(?:[^}^"]+)/, /^(?:\})/, /^(?:call[\s]+)/, /^(?:\([\s]*\))/, /^(?:\()/, /^(?:[^(]*)/, /^(?:\))/, /^(?:[^)]*)/, /^(?:[^`"]+)/, /^(?:[`]["])/, /^(?:["][`])/, /^(?:[^"]+)/, /^(?:["])/, /^(?:["])/, /^(?:style\b)/, /^(?:default\b)/, /^(?:linkStyle\b)/, /^(?:interpolate\b)/, /^(?:classDef\b)/, /^(?:class\b)/, /^(?:href[\s])/, /^(?:click[\s]+)/, /^(?:[\s\n])/, /^(?:[^\s\n]*)/, /^(?:flowchart-elk\b)/, /^(?:graph\b)/, /^(?:flowchart\b)/, /^(?:subgraph\b)/, /^(?:end\b\s*)/, /^(?:_self\b)/, /^(?:_blank\b)/, /^(?:_parent\b)/, /^(?:_top\b)/, /^(?:(\r?\n)*\s*\n)/, /^(?:\s*LR\b)/, /^(?:\s*RL\b)/, /^(?:\s*TB\b)/, /^(?:\s*BT\b)/, /^(?:\s*TD\b)/, /^(?:\s*BR\b)/, /^(?:\s*<)/, /^(?:\s*>)/, /^(?:\s*\^)/, /^(?:\s*v\b)/, /^(?:.*direction\s+TB[^\n]*)/, /^(?:.*direction\s+BT[^\n]*)/, /^(?:.*direction\s+RL[^\n]*)/, /^(?:.*direction\s+LR[^\n]*)/, /^(?:[^\s\"]+@(?=[^\{\"]))/, /^(?:[0-9]+)/, /^(?:#)/, /^(?::::)/, /^(?::)/, /^(?:&)/, /^(?:;)/, /^(?:,)/, /^(?:\*)/, /^(?:\s*[xo<]?--+[-xo>]\s*)/, /^(?:\s*[xo<]?--\s*)/, /^(?:[^-]|-(?!-)+)/, /^(?:\s*[xo<]?==+[=xo>]\s*)/, /^(?:\s*[xo<]?==\s*)/, /^(?:[^=]|=(?!))/, /^(?:\s*[xo<]?-?\.+-[xo>]?\s*)/, /^(?:\s*[xo<]?-\.\s*)/, /^(?:[^\.]|\.(?!))/, /^(?:\s*~~[\~]+\s*)/, /^(?:[-/\)][\)])/, /^(?:[^\(\)\[\]\{\}]|!\)+)/, /^(?:\(-)/, /^(?:\]\))/, /^(?:\(\[)/, /^(?:\]\])/, /^(?:\[\[)/, /^(?:\[\|)/, /^(?:>)/, /^(?:\)\])/, /^(?:\[\()/, /^(?:\)\)\))/, /^(?:\(\(\()/, /^(?:[\\(?=\])][\]])/, /^(?:\/(?=\])\])/, /^(?:\/(?!\])|\\(?!\])|[^\\\[\]\(\)\{\}\/]+)/, /^(?:\[\/)/, /^(?:\[\\)/, /^(?:<)/, /^(?:>)/, /^(?:\^)/, /^(?:\\\|)/, /^(?:v\b)/, /^(?:\*)/, /^(?:#)/, /^(?:&)/, /^(?:([A-Za-z0-9!"\#$%&'*+\.`?\\_\/]|-(?=[^\>\-\.])|(?!))+)/, /^(?:-)/, /^(?:[\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6]|[\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377]|[\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5]|[\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA]|[\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE]|[\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA]|[\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0]|[\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977]|[\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2]|[\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A]|[\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39]|[\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8]|[\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C]|[\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C]|[\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99]|[\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0]|[\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D]|[\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3]|[\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10]|[\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1]|[\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81]|[\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3]|[\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6]|[\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A]|[\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081]|[\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D]|[\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0]|[\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310]|[\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C]|[\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711]|[\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7]|[\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C]|[\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16]|[\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF]|[\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC]|[\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D]|[\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D]|[\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3]|[\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F]|[\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128]|[\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184]|[\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3]|[\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6]|[\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE]|[\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C]|[\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D]|[\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC]|[\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B]|[\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788]|[\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805]|[\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB]|[\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28]|[\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5]|[\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4]|[\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E]|[\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D]|[\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36]|[\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D]|[\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC]|[\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF]|[\uFFD2-\uFFD7\uFFDA-\uFFDC])/, /^(?:\|)/, /^(?:\|)/, /^(?:\))/, /^(?:\()/, /^(?:\])/, /^(?:\[)/, /^(?:(\}))/, /^(?:\{)/, /^(?:[^\[\]\(\)\{\}\|\"]+)/, /^(?:")/, /^(?:(\r?\n)+)/, /^(?:\s)/, /^(?:$)/], + conditions: { shapeDataEndBracket: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, shapeDataStr: { rules: [9, 10, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, shapeData: { rules: [8, 11, 12, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, callbackargs: { rules: [17, 18, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, callbackname: { rules: [14, 15, 16, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, href: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, click: { rules: [21, 24, 33, 34, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, dottedEdgeText: { rules: [21, 24, 74, 76, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, thickEdgeText: { rules: [21, 24, 71, 73, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, edgeText: { rules: [21, 24, 68, 70, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, trapText: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 91, 92, 93, 94, 95, 108, 110, 112, 114], inclusive: !1 }, ellipseText: { rules: [21, 24, 77, 78, 79, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, text: { rules: [21, 24, 77, 80, 81, 82, 83, 84, 87, 88, 89, 90, 94, 95, 107, 108, 109, 110, 111, 112, 113, 114, 115], inclusive: !1 }, vertex: { rules: [21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, dir: { rules: [21, 24, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, acc_descr_multiline: { rules: [5, 6, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, acc_descr: { rules: [3, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, acc_title: { rules: [1, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, md_string: { rules: [19, 20, 21, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, string: { rules: [21, 22, 23, 24, 77, 80, 82, 84, 88, 90, 94, 95, 108, 110, 112, 114], inclusive: !1 }, INITIAL: { rules: [0, 2, 4, 7, 13, 21, 24, 25, 26, 27, 28, 29, 30, 31, 32, 35, 36, 37, 38, 39, 40, 41, 42, 43, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 71, 72, 74, 75, 77, 80, 82, 84, 85, 86, 88, 90, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 108, 110, 112, 114, 116, 117, 118, 119], inclusive: !0 } } + }; + return p1; + }(); + J1.lexer = Wt; + function H1() { + this.yy = {}; + } + return m(H1, "Parser"), H1.prototype = J1, J1.Parser = H1, new H1(); +}(); +rt.parser = rt; +var Mt = rt, Ut = Object.assign({}, Mt); +Ut.parse = (s) => { + const i = s.replace(/}\s*\n/g, `} +`); + return Mt.parse(i); +}; +var be = Ut, Ae = /* @__PURE__ */ m((s, i) => { + const a = ce, n = a(s, "r"), u = a(s, "g"), l = a(s, "b"); + return ue(n, u, l, i); +}, "fade"), ke = /* @__PURE__ */ m((s) => `.label { + font-family: ${s.fontFamily}; + color: ${s.nodeTextColor || s.textColor}; + } + .cluster-label text { + fill: ${s.titleColor}; + } + .cluster-label span { + color: ${s.titleColor}; + } + .cluster-label span p { + background-color: transparent; + } + + .label text,span { + fill: ${s.nodeTextColor || s.textColor}; + color: ${s.nodeTextColor || s.textColor}; + } + + .node rect, + .node circle, + .node ellipse, + .node polygon, + .node path { + fill: ${s.mainBkg}; + stroke: ${s.nodeBorder}; + stroke-width: 1px; + } + .rough-node .label text , .node .label text, .image-shape .label, .icon-shape .label { + text-anchor: middle; + } + // .flowchart-label .text-outer-tspan { + // text-anchor: middle; + // } + // .flowchart-label .text-inner-tspan { + // text-anchor: start; + // } + + .node .katex path { + fill: #000; + stroke: #000; + stroke-width: 1px; + } + + .rough-node .label,.node .label, .image-shape .label, .icon-shape .label { + text-align: center; + } + .node.clickable { + cursor: pointer; + } + + + .root .anchor path { + fill: ${s.lineColor} !important; + stroke-width: 0; + stroke: ${s.lineColor}; + } + + .arrowheadPath { + fill: ${s.arrowheadColor}; + } + + .edgePath .path { + stroke: ${s.lineColor}; + stroke-width: 2.0px; + } + + .flowchart-link { + stroke: ${s.lineColor}; + fill: none; + } + + .edgeLabel { + background-color: ${s.edgeLabelBackground}; + p { + background-color: ${s.edgeLabelBackground}; + } + rect { + opacity: 0.5; + background-color: ${s.edgeLabelBackground}; + fill: ${s.edgeLabelBackground}; + } + text-align: center; + } + + /* For html labels only */ + .labelBkg { + background-color: ${Ae(s.edgeLabelBackground, 0.5)}; + // background-color: + } + + .cluster rect { + fill: ${s.clusterBkg}; + stroke: ${s.clusterBorder}; + stroke-width: 1px; + } + + .cluster text { + fill: ${s.titleColor}; + } + + .cluster span { + color: ${s.titleColor}; + } + /* .cluster div { + color: ${s.titleColor}; + } */ + + div.mermaidTooltip { + position: absolute; + text-align: center; + max-width: 200px; + padding: 2px; + font-family: ${s.fontFamily}; + font-size: 12px; + background: ${s.tertiaryColor}; + border: 1px solid ${s.border2}; + border-radius: 2px; + pointer-events: none; + z-index: 100; + } + + .flowchartTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${s.textColor}; + } + + rect.text { + fill: none; + stroke-width: 0; + } + + .icon-shape, .image-shape { + background-color: ${s.edgeLabelBackground}; + p { + background-color: ${s.edgeLabelBackground}; + padding: 2px; + } + rect { + opacity: 0.5; + background-color: ${s.edgeLabelBackground}; + fill: ${s.edgeLabelBackground}; + } + text-align: center; + } +`, "getStyles"), me = ke, xe = { + parser: be, + get db() { + return new de(); + }, + renderer: ge, + styles: me, + init: /* @__PURE__ */ m((s) => { + s.flowchart || (s.flowchart = {}), s.layout && Ot({ layout: s.layout }), s.flowchart.arrowMarkerAbsolute = s.arrowMarkerAbsolute, Ot({ flowchart: { arrowMarkerAbsolute: s.arrowMarkerAbsolute } }); + }, "init") +}; +export { + xe as diagram +}; diff --git a/backend/fastrtc/templates/component/ganttDiagram-APWFNJXF-DujTUm7n.js b/backend/fastrtc/templates/component/ganttDiagram-APWFNJXF-DujTUm7n.js new file mode 100644 index 0000000..e5f6dbc --- /dev/null +++ b/backend/fastrtc/templates/component/ganttDiagram-APWFNJXF-DujTUm7n.js @@ -0,0 +1,2488 @@ +import { aS as $e, aT as Je, aU as Ke, aV as tn, aW as Un, aX as re, aY as En, _ as h, aZ as at, d as _t, s as Ln, g as An, n as In, o as Wn, c as On, b as Hn, t as Nn, m as Vn, l as Qt, j as Zt, k as zn, e as Pn, u as Rn } from "./mermaid.core-Cmyps_S7.js"; +import { c as Te, g as be } from "./index-DeMSGuTm.js"; +import { b as Bn, t as Ie, c as Zn, a as Xn, l as qn } from "./linear-a_bmPvcN.js"; +import { i as Gn } from "./init-DjUOC4st.js"; +function jn(t, e) { + let n; + if (e === void 0) + for (const r of t) + r != null && (n < r || n === void 0 && r >= r) && (n = r); + else { + let r = -1; + for (let a of t) + (a = e(a, ++r, t)) != null && (n < a || n === void 0 && a >= a) && (n = a); + } + return n; +} +function Qn(t, e) { + let n; + if (e === void 0) + for (const r of t) + r != null && (n > r || n === void 0 && r >= r) && (n = r); + else { + let r = -1; + for (let a of t) + (a = e(a, ++r, t)) != null && (n > a || n === void 0 && a >= a) && (n = a); + } + return n; +} +function $n(t) { + return t; +} +var qt = 1, ae = 2, me = 3, Xt = 4, We = 1e-6; +function Jn(t) { + return "translate(" + t + ",0)"; +} +function Kn(t) { + return "translate(0," + t + ")"; +} +function tr(t) { + return (e) => +t(e); +} +function er(t, e) { + return e = Math.max(0, t.bandwidth() - e * 2) / 2, t.round() && (e = Math.round(e)), (n) => +t(n) + e; +} +function nr() { + return !this.__axis; +} +function en(t, e) { + var n = [], r = null, a = null, i = 6, s = 6, k = 3, M = typeof window < "u" && window.devicePixelRatio > 1 ? 0 : 0.5, T = t === qt || t === Xt ? -1 : 1, g = t === Xt || t === ae ? "x" : "y", U = t === qt || t === me ? Jn : Kn; + function D(b) { + var q = r ?? (e.ticks ? e.ticks.apply(e, n) : e.domain()), O = a ?? (e.tickFormat ? e.tickFormat.apply(e, n) : $n), C = Math.max(i, 0) + k, I = e.range(), V = +I[0] + M, W = +I[I.length - 1] + M, Z = (e.bandwidth ? er : tr)(e.copy(), M), Q = b.selection ? b.selection() : b, w = Q.selectAll(".domain").data([null]), H = Q.selectAll(".tick").data(q, e).order(), x = H.exit(), F = H.enter().append("g").attr("class", "tick"), _ = H.select("line"), S = H.select("text"); + w = w.merge(w.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")), H = H.merge(F), _ = _.merge(F.append("line").attr("stroke", "currentColor").attr(g + "2", T * i)), S = S.merge(F.append("text").attr("fill", "currentColor").attr(g, T * C).attr("dy", t === qt ? "0em" : t === me ? "0.71em" : "0.32em")), b !== Q && (w = w.transition(b), H = H.transition(b), _ = _.transition(b), S = S.transition(b), x = x.transition(b).attr("opacity", We).attr("transform", function(p) { + return isFinite(p = Z(p)) ? U(p + M) : this.getAttribute("transform"); + }), F.attr("opacity", We).attr("transform", function(p) { + var Y = this.parentNode.__axis; + return U((Y && isFinite(Y = Y(p)) ? Y : Z(p)) + M); + })), x.remove(), w.attr("d", t === Xt || t === ae ? s ? "M" + T * s + "," + V + "H" + M + "V" + W + "H" + T * s : "M" + M + "," + V + "V" + W : s ? "M" + V + "," + T * s + "V" + M + "H" + W + "V" + T * s : "M" + V + "," + M + "H" + W), H.attr("opacity", 1).attr("transform", function(p) { + return U(Z(p) + M); + }), _.attr(g + "2", T * i), S.attr(g, T * C).text(O), Q.filter(nr).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", t === ae ? "start" : t === Xt ? "end" : "middle"), Q.each(function() { + this.__axis = Z; + }); + } + return D.scale = function(b) { + return arguments.length ? (e = b, D) : e; + }, D.ticks = function() { + return n = Array.from(arguments), D; + }, D.tickArguments = function(b) { + return arguments.length ? (n = b == null ? [] : Array.from(b), D) : n.slice(); + }, D.tickValues = function(b) { + return arguments.length ? (r = b == null ? null : Array.from(b), D) : r && r.slice(); + }, D.tickFormat = function(b) { + return arguments.length ? (a = b, D) : a; + }, D.tickSize = function(b) { + return arguments.length ? (i = s = +b, D) : i; + }, D.tickSizeInner = function(b) { + return arguments.length ? (i = +b, D) : i; + }, D.tickSizeOuter = function(b) { + return arguments.length ? (s = +b, D) : s; + }, D.tickPadding = function(b) { + return arguments.length ? (k = +b, D) : k; + }, D.offset = function(b) { + return arguments.length ? (M = +b, D) : M; + }, D; +} +function rr(t) { + return en(qt, t); +} +function ar(t) { + return en(me, t); +} +const ir = Math.PI / 180, sr = 180 / Math.PI, $t = 18, nn = 0.96422, rn = 1, an = 0.82521, sn = 4 / 29, St = 6 / 29, on = 3 * St * St, or = St * St * St; +function cn(t) { + if (t instanceof ft) return new ft(t.l, t.a, t.b, t.opacity); + if (t instanceof dt) return ln(t); + t instanceof Ke || (t = Un(t)); + var e = ce(t.r), n = ce(t.g), r = ce(t.b), a = ie((0.2225045 * e + 0.7168786 * n + 0.0606169 * r) / rn), i, s; + return e === n && n === r ? i = s = a : (i = ie((0.4360747 * e + 0.3850649 * n + 0.1430804 * r) / nn), s = ie((0.0139322 * e + 0.0971045 * n + 0.7141733 * r) / an)), new ft(116 * a - 16, 500 * (i - a), 200 * (a - s), t.opacity); +} +function cr(t, e, n, r) { + return arguments.length === 1 ? cn(t) : new ft(t, e, n, r ?? 1); +} +function ft(t, e, n, r) { + this.l = +t, this.a = +e, this.b = +n, this.opacity = +r; +} +$e(ft, cr, Je(tn, { + brighter(t) { + return new ft(this.l + $t * (t ?? 1), this.a, this.b, this.opacity); + }, + darker(t) { + return new ft(this.l - $t * (t ?? 1), this.a, this.b, this.opacity); + }, + rgb() { + var t = (this.l + 16) / 116, e = isNaN(this.a) ? t : t + this.a / 500, n = isNaN(this.b) ? t : t - this.b / 200; + return e = nn * se(e), t = rn * se(t), n = an * se(n), new Ke( + oe(3.1338561 * e - 1.6168667 * t - 0.4906146 * n), + oe(-0.9787684 * e + 1.9161415 * t + 0.033454 * n), + oe(0.0719453 * e - 0.2289914 * t + 1.4052427 * n), + this.opacity + ); + } +})); +function ie(t) { + return t > or ? Math.pow(t, 1 / 3) : t / on + sn; +} +function se(t) { + return t > St ? t * t * t : on * (t - sn); +} +function oe(t) { + return 255 * (t <= 31308e-7 ? 12.92 * t : 1.055 * Math.pow(t, 1 / 2.4) - 0.055); +} +function ce(t) { + return (t /= 255) <= 0.04045 ? t / 12.92 : Math.pow((t + 0.055) / 1.055, 2.4); +} +function lr(t) { + if (t instanceof dt) return new dt(t.h, t.c, t.l, t.opacity); + if (t instanceof ft || (t = cn(t)), t.a === 0 && t.b === 0) return new dt(NaN, 0 < t.l && t.l < 100 ? 0 : NaN, t.l, t.opacity); + var e = Math.atan2(t.b, t.a) * sr; + return new dt(e < 0 ? e + 360 : e, Math.sqrt(t.a * t.a + t.b * t.b), t.l, t.opacity); +} +function ge(t, e, n, r) { + return arguments.length === 1 ? lr(t) : new dt(t, e, n, r ?? 1); +} +function dt(t, e, n, r) { + this.h = +t, this.c = +e, this.l = +n, this.opacity = +r; +} +function ln(t) { + if (isNaN(t.h)) return new ft(t.l, 0, 0, t.opacity); + var e = t.h * ir; + return new ft(t.l, Math.cos(e) * t.c, Math.sin(e) * t.c, t.opacity); +} +$e(dt, ge, Je(tn, { + brighter(t) { + return new dt(this.h, this.c, this.l + $t * (t ?? 1), this.opacity); + }, + darker(t) { + return new dt(this.h, this.c, this.l - $t * (t ?? 1), this.opacity); + }, + rgb() { + return ln(this).rgb(); + } +})); +function ur(t) { + return function(e, n) { + var r = t((e = ge(e)).h, (n = ge(n)).h), a = re(e.c, n.c), i = re(e.l, n.l), s = re(e.opacity, n.opacity); + return function(k) { + return e.h = r(k), e.c = a(k), e.l = i(k), e.opacity = s(k), e + ""; + }; + }; +} +const fr = ur(En); +function hr(t, e) { + t = t.slice(); + var n = 0, r = t.length - 1, a = t[n], i = t[r], s; + return i < a && (s = n, n = r, r = s, s = a, a = i, i = s), t[n] = e.floor(a), t[r] = e.ceil(i), t; +} +const le = /* @__PURE__ */ new Date(), ue = /* @__PURE__ */ new Date(); +function et(t, e, n, r) { + function a(i) { + return t(i = arguments.length === 0 ? /* @__PURE__ */ new Date() : /* @__PURE__ */ new Date(+i)), i; + } + return a.floor = (i) => (t(i = /* @__PURE__ */ new Date(+i)), i), a.ceil = (i) => (t(i = new Date(i - 1)), e(i, 1), t(i), i), a.round = (i) => { + const s = a(i), k = a.ceil(i); + return i - s < k - i ? s : k; + }, a.offset = (i, s) => (e(i = /* @__PURE__ */ new Date(+i), s == null ? 1 : Math.floor(s)), i), a.range = (i, s, k) => { + const M = []; + if (i = a.ceil(i), k = k == null ? 1 : Math.floor(k), !(i < s) || !(k > 0)) return M; + let T; + do + M.push(T = /* @__PURE__ */ new Date(+i)), e(i, k), t(i); + while (T < i && i < s); + return M; + }, a.filter = (i) => et((s) => { + if (s >= s) for (; t(s), !i(s); ) s.setTime(s - 1); + }, (s, k) => { + if (s >= s) + if (k < 0) for (; ++k <= 0; ) + for (; e(s, -1), !i(s); ) + ; + else for (; --k >= 0; ) + for (; e(s, 1), !i(s); ) + ; + }), n && (a.count = (i, s) => (le.setTime(+i), ue.setTime(+s), t(le), t(ue), Math.floor(n(le, ue))), a.every = (i) => (i = Math.floor(i), !isFinite(i) || !(i > 0) ? null : i > 1 ? a.filter(r ? (s) => r(s) % i === 0 : (s) => a.count(0, s) % i === 0) : a)), a; +} +const Yt = et(() => { +}, (t, e) => { + t.setTime(+t + e); +}, (t, e) => e - t); +Yt.every = (t) => (t = Math.floor(t), !isFinite(t) || !(t > 0) ? null : t > 1 ? et((e) => { + e.setTime(Math.floor(e / t) * t); +}, (e, n) => { + e.setTime(+e + n * t); +}, (e, n) => (n - e) / t) : Yt); +Yt.range; +const mt = 1e3, ct = mt * 60, gt = ct * 60, yt = gt * 24, xe = yt * 7, Oe = yt * 30, fe = yt * 365, vt = et((t) => { + t.setTime(t - t.getMilliseconds()); +}, (t, e) => { + t.setTime(+t + e * mt); +}, (t, e) => (e - t) / mt, (t) => t.getUTCSeconds()); +vt.range; +const Wt = et((t) => { + t.setTime(t - t.getMilliseconds() - t.getSeconds() * mt); +}, (t, e) => { + t.setTime(+t + e * ct); +}, (t, e) => (e - t) / ct, (t) => t.getMinutes()); +Wt.range; +const dr = et((t) => { + t.setUTCSeconds(0, 0); +}, (t, e) => { + t.setTime(+t + e * ct); +}, (t, e) => (e - t) / ct, (t) => t.getUTCMinutes()); +dr.range; +const Ot = et((t) => { + t.setTime(t - t.getMilliseconds() - t.getSeconds() * mt - t.getMinutes() * ct); +}, (t, e) => { + t.setTime(+t + e * gt); +}, (t, e) => (e - t) / gt, (t) => t.getHours()); +Ot.range; +const mr = et((t) => { + t.setUTCMinutes(0, 0, 0); +}, (t, e) => { + t.setTime(+t + e * gt); +}, (t, e) => (e - t) / gt, (t) => t.getUTCHours()); +mr.range; +const Tt = et( + (t) => t.setHours(0, 0, 0, 0), + (t, e) => t.setDate(t.getDate() + e), + (t, e) => (e - t - (e.getTimezoneOffset() - t.getTimezoneOffset()) * ct) / yt, + (t) => t.getDate() - 1 +); +Tt.range; +const we = et((t) => { + t.setUTCHours(0, 0, 0, 0); +}, (t, e) => { + t.setUTCDate(t.getUTCDate() + e); +}, (t, e) => (e - t) / yt, (t) => t.getUTCDate() - 1); +we.range; +const gr = et((t) => { + t.setUTCHours(0, 0, 0, 0); +}, (t, e) => { + t.setUTCDate(t.getUTCDate() + e); +}, (t, e) => (e - t) / yt, (t) => Math.floor(t / yt)); +gr.range; +function wt(t) { + return et((e) => { + e.setDate(e.getDate() - (e.getDay() + 7 - t) % 7), e.setHours(0, 0, 0, 0); + }, (e, n) => { + e.setDate(e.getDate() + n * 7); + }, (e, n) => (n - e - (n.getTimezoneOffset() - e.getTimezoneOffset()) * ct) / xe); +} +const Vt = wt(0), Ht = wt(1), un = wt(2), fn = wt(3), bt = wt(4), hn = wt(5), dn = wt(6); +Vt.range; +Ht.range; +un.range; +fn.range; +bt.range; +hn.range; +dn.range; +function Dt(t) { + return et((e) => { + e.setUTCDate(e.getUTCDate() - (e.getUTCDay() + 7 - t) % 7), e.setUTCHours(0, 0, 0, 0); + }, (e, n) => { + e.setUTCDate(e.getUTCDate() + n * 7); + }, (e, n) => (n - e) / xe); +} +const mn = Dt(0), Jt = Dt(1), yr = Dt(2), kr = Dt(3), Ut = Dt(4), pr = Dt(5), vr = Dt(6); +mn.range; +Jt.range; +yr.range; +kr.range; +Ut.range; +pr.range; +vr.range; +const Nt = et((t) => { + t.setDate(1), t.setHours(0, 0, 0, 0); +}, (t, e) => { + t.setMonth(t.getMonth() + e); +}, (t, e) => e.getMonth() - t.getMonth() + (e.getFullYear() - t.getFullYear()) * 12, (t) => t.getMonth()); +Nt.range; +const Tr = et((t) => { + t.setUTCDate(1), t.setUTCHours(0, 0, 0, 0); +}, (t, e) => { + t.setUTCMonth(t.getUTCMonth() + e); +}, (t, e) => e.getUTCMonth() - t.getUTCMonth() + (e.getUTCFullYear() - t.getUTCFullYear()) * 12, (t) => t.getUTCMonth()); +Tr.range; +const kt = et((t) => { + t.setMonth(0, 1), t.setHours(0, 0, 0, 0); +}, (t, e) => { + t.setFullYear(t.getFullYear() + e); +}, (t, e) => e.getFullYear() - t.getFullYear(), (t) => t.getFullYear()); +kt.every = (t) => !isFinite(t = Math.floor(t)) || !(t > 0) ? null : et((e) => { + e.setFullYear(Math.floor(e.getFullYear() / t) * t), e.setMonth(0, 1), e.setHours(0, 0, 0, 0); +}, (e, n) => { + e.setFullYear(e.getFullYear() + n * t); +}); +kt.range; +const xt = et((t) => { + t.setUTCMonth(0, 1), t.setUTCHours(0, 0, 0, 0); +}, (t, e) => { + t.setUTCFullYear(t.getUTCFullYear() + e); +}, (t, e) => e.getUTCFullYear() - t.getUTCFullYear(), (t) => t.getUTCFullYear()); +xt.every = (t) => !isFinite(t = Math.floor(t)) || !(t > 0) ? null : et((e) => { + e.setUTCFullYear(Math.floor(e.getUTCFullYear() / t) * t), e.setUTCMonth(0, 1), e.setUTCHours(0, 0, 0, 0); +}, (e, n) => { + e.setUTCFullYear(e.getUTCFullYear() + n * t); +}); +xt.range; +function br(t, e, n, r, a, i) { + const s = [ + [vt, 1, mt], + [vt, 5, 5 * mt], + [vt, 15, 15 * mt], + [vt, 30, 30 * mt], + [i, 1, ct], + [i, 5, 5 * ct], + [i, 15, 15 * ct], + [i, 30, 30 * ct], + [a, 1, gt], + [a, 3, 3 * gt], + [a, 6, 6 * gt], + [a, 12, 12 * gt], + [r, 1, yt], + [r, 2, 2 * yt], + [n, 1, xe], + [e, 1, Oe], + [e, 3, 3 * Oe], + [t, 1, fe] + ]; + function k(T, g, U) { + const D = g < T; + D && ([T, g] = [g, T]); + const b = U && typeof U.range == "function" ? U : M(T, g, U), q = b ? b.range(T, +g + 1) : []; + return D ? q.reverse() : q; + } + function M(T, g, U) { + const D = Math.abs(g - T) / U, b = Bn(([, , C]) => C).right(s, D); + if (b === s.length) return t.every(Ie(T / fe, g / fe, U)); + if (b === 0) return Yt.every(Math.max(Ie(T, g, U), 1)); + const [q, O] = s[D / s[b - 1][2] < s[b][2] / D ? b - 1 : b]; + return q.every(O); + } + return [k, M]; +} +const [xr, wr] = br(kt, Nt, Vt, Tt, Ot, Wt); +function he(t) { + if (0 <= t.y && t.y < 100) { + var e = new Date(-1, t.m, t.d, t.H, t.M, t.S, t.L); + return e.setFullYear(t.y), e; + } + return new Date(t.y, t.m, t.d, t.H, t.M, t.S, t.L); +} +function de(t) { + if (0 <= t.y && t.y < 100) { + var e = new Date(Date.UTC(-1, t.m, t.d, t.H, t.M, t.S, t.L)); + return e.setUTCFullYear(t.y), e; + } + return new Date(Date.UTC(t.y, t.m, t.d, t.H, t.M, t.S, t.L)); +} +function Lt(t, e, n) { + return { y: t, m: e, d: n, H: 0, M: 0, S: 0, L: 0 }; +} +function Dr(t) { + var e = t.dateTime, n = t.date, r = t.time, a = t.periods, i = t.days, s = t.shortDays, k = t.months, M = t.shortMonths, T = At(a), g = It(a), U = At(i), D = It(i), b = At(s), q = It(s), O = At(k), C = It(k), I = At(M), V = It(M), W = { + a: m, + A: E, + b: c, + B: d, + c: null, + d: Re, + e: Re, + f: qr, + g: ra, + G: ia, + H: Br, + I: Zr, + j: Xr, + L: gn, + m: Gr, + M: jr, + p: o, + q: P, + Q: Xe, + s: qe, + S: Qr, + u: $r, + U: Jr, + V: Kr, + w: ta, + W: ea, + x: null, + X: null, + y: na, + Y: aa, + Z: sa, + "%": Ze + }, Z = { + a: z, + A: R, + b: K, + B: G, + c: null, + d: Be, + e: Be, + f: ua, + g: Ta, + G: xa, + H: oa, + I: ca, + j: la, + L: kn, + m: fa, + M: ha, + p: $, + q: it, + Q: Xe, + s: qe, + S: da, + u: ma, + U: ga, + V: ya, + w: ka, + W: pa, + x: null, + X: null, + y: va, + Y: ba, + Z: wa, + "%": Ze + }, Q = { + a: _, + A: S, + b: p, + B: Y, + c: l, + d: ze, + e: ze, + f: Vr, + g: Ve, + G: Ne, + H: Pe, + I: Pe, + j: Wr, + L: Nr, + m: Ir, + M: Or, + p: F, + q: Ar, + Q: Pr, + s: Rr, + S: Hr, + u: Fr, + U: Yr, + V: Ur, + w: Sr, + W: Er, + x: f, + X: y, + y: Ve, + Y: Ne, + Z: Lr, + "%": zr + }; + W.x = w(n, W), W.X = w(r, W), W.c = w(e, W), Z.x = w(n, Z), Z.X = w(r, Z), Z.c = w(e, Z); + function w(v, A) { + return function(N) { + var u = [], J = -1, L = 0, j = v.length, X, rt, st; + for (N instanceof Date || (N = /* @__PURE__ */ new Date(+N)); ++J < j; ) + v.charCodeAt(J) === 37 && (u.push(v.slice(L, J)), (rt = He[X = v.charAt(++J)]) != null ? X = v.charAt(++J) : rt = X === "e" ? " " : "0", (st = A[X]) && (X = st(N, rt)), u.push(X), L = J + 1); + return u.push(v.slice(L, J)), u.join(""); + }; + } + function H(v, A) { + return function(N) { + var u = Lt(1900, void 0, 1), J = x(u, v, N += "", 0), L, j; + if (J != N.length) return null; + if ("Q" in u) return new Date(u.Q); + if ("s" in u) return new Date(u.s * 1e3 + ("L" in u ? u.L : 0)); + if (A && !("Z" in u) && (u.Z = 0), "p" in u && (u.H = u.H % 12 + u.p * 12), u.m === void 0 && (u.m = "q" in u ? u.q : 0), "V" in u) { + if (u.V < 1 || u.V > 53) return null; + "w" in u || (u.w = 1), "Z" in u ? (L = de(Lt(u.y, 0, 1)), j = L.getUTCDay(), L = j > 4 || j === 0 ? Jt.ceil(L) : Jt(L), L = we.offset(L, (u.V - 1) * 7), u.y = L.getUTCFullYear(), u.m = L.getUTCMonth(), u.d = L.getUTCDate() + (u.w + 6) % 7) : (L = he(Lt(u.y, 0, 1)), j = L.getDay(), L = j > 4 || j === 0 ? Ht.ceil(L) : Ht(L), L = Tt.offset(L, (u.V - 1) * 7), u.y = L.getFullYear(), u.m = L.getMonth(), u.d = L.getDate() + (u.w + 6) % 7); + } else ("W" in u || "U" in u) && ("w" in u || (u.w = "u" in u ? u.u % 7 : "W" in u ? 1 : 0), j = "Z" in u ? de(Lt(u.y, 0, 1)).getUTCDay() : he(Lt(u.y, 0, 1)).getDay(), u.m = 0, u.d = "W" in u ? (u.w + 6) % 7 + u.W * 7 - (j + 5) % 7 : u.w + u.U * 7 - (j + 6) % 7); + return "Z" in u ? (u.H += u.Z / 100 | 0, u.M += u.Z % 100, de(u)) : he(u); + }; + } + function x(v, A, N, u) { + for (var J = 0, L = A.length, j = N.length, X, rt; J < L; ) { + if (u >= j) return -1; + if (X = A.charCodeAt(J++), X === 37) { + if (X = A.charAt(J++), rt = Q[X in He ? A.charAt(J++) : X], !rt || (u = rt(v, N, u)) < 0) return -1; + } else if (X != N.charCodeAt(u++)) + return -1; + } + return u; + } + function F(v, A, N) { + var u = T.exec(A.slice(N)); + return u ? (v.p = g.get(u[0].toLowerCase()), N + u[0].length) : -1; + } + function _(v, A, N) { + var u = b.exec(A.slice(N)); + return u ? (v.w = q.get(u[0].toLowerCase()), N + u[0].length) : -1; + } + function S(v, A, N) { + var u = U.exec(A.slice(N)); + return u ? (v.w = D.get(u[0].toLowerCase()), N + u[0].length) : -1; + } + function p(v, A, N) { + var u = I.exec(A.slice(N)); + return u ? (v.m = V.get(u[0].toLowerCase()), N + u[0].length) : -1; + } + function Y(v, A, N) { + var u = O.exec(A.slice(N)); + return u ? (v.m = C.get(u[0].toLowerCase()), N + u[0].length) : -1; + } + function l(v, A, N) { + return x(v, e, A, N); + } + function f(v, A, N) { + return x(v, n, A, N); + } + function y(v, A, N) { + return x(v, r, A, N); + } + function m(v) { + return s[v.getDay()]; + } + function E(v) { + return i[v.getDay()]; + } + function c(v) { + return M[v.getMonth()]; + } + function d(v) { + return k[v.getMonth()]; + } + function o(v) { + return a[+(v.getHours() >= 12)]; + } + function P(v) { + return 1 + ~~(v.getMonth() / 3); + } + function z(v) { + return s[v.getUTCDay()]; + } + function R(v) { + return i[v.getUTCDay()]; + } + function K(v) { + return M[v.getUTCMonth()]; + } + function G(v) { + return k[v.getUTCMonth()]; + } + function $(v) { + return a[+(v.getUTCHours() >= 12)]; + } + function it(v) { + return 1 + ~~(v.getUTCMonth() / 3); + } + return { + format: function(v) { + var A = w(v += "", W); + return A.toString = function() { + return v; + }, A; + }, + parse: function(v) { + var A = H(v += "", !1); + return A.toString = function() { + return v; + }, A; + }, + utcFormat: function(v) { + var A = w(v += "", Z); + return A.toString = function() { + return v; + }, A; + }, + utcParse: function(v) { + var A = H(v += "", !0); + return A.toString = function() { + return v; + }, A; + } + }; +} +var He = { "-": "", _: " ", 0: "0" }, nt = /^\s*\d+/, Cr = /^%/, Mr = /[\\^$*+?|[\]().{}]/g; +function B(t, e, n) { + var r = t < 0 ? "-" : "", a = (r ? -t : t) + "", i = a.length; + return r + (i < n ? new Array(n - i + 1).join(e) + a : a); +} +function _r(t) { + return t.replace(Mr, "\\$&"); +} +function At(t) { + return new RegExp("^(?:" + t.map(_r).join("|") + ")", "i"); +} +function It(t) { + return new Map(t.map((e, n) => [e.toLowerCase(), n])); +} +function Sr(t, e, n) { + var r = nt.exec(e.slice(n, n + 1)); + return r ? (t.w = +r[0], n + r[0].length) : -1; +} +function Fr(t, e, n) { + var r = nt.exec(e.slice(n, n + 1)); + return r ? (t.u = +r[0], n + r[0].length) : -1; +} +function Yr(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.U = +r[0], n + r[0].length) : -1; +} +function Ur(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.V = +r[0], n + r[0].length) : -1; +} +function Er(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.W = +r[0], n + r[0].length) : -1; +} +function Ne(t, e, n) { + var r = nt.exec(e.slice(n, n + 4)); + return r ? (t.y = +r[0], n + r[0].length) : -1; +} +function Ve(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.y = +r[0] + (+r[0] > 68 ? 1900 : 2e3), n + r[0].length) : -1; +} +function Lr(t, e, n) { + var r = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n, n + 6)); + return r ? (t.Z = r[1] ? 0 : -(r[2] + (r[3] || "00")), n + r[0].length) : -1; +} +function Ar(t, e, n) { + var r = nt.exec(e.slice(n, n + 1)); + return r ? (t.q = r[0] * 3 - 3, n + r[0].length) : -1; +} +function Ir(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.m = r[0] - 1, n + r[0].length) : -1; +} +function ze(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.d = +r[0], n + r[0].length) : -1; +} +function Wr(t, e, n) { + var r = nt.exec(e.slice(n, n + 3)); + return r ? (t.m = 0, t.d = +r[0], n + r[0].length) : -1; +} +function Pe(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.H = +r[0], n + r[0].length) : -1; +} +function Or(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.M = +r[0], n + r[0].length) : -1; +} +function Hr(t, e, n) { + var r = nt.exec(e.slice(n, n + 2)); + return r ? (t.S = +r[0], n + r[0].length) : -1; +} +function Nr(t, e, n) { + var r = nt.exec(e.slice(n, n + 3)); + return r ? (t.L = +r[0], n + r[0].length) : -1; +} +function Vr(t, e, n) { + var r = nt.exec(e.slice(n, n + 6)); + return r ? (t.L = Math.floor(r[0] / 1e3), n + r[0].length) : -1; +} +function zr(t, e, n) { + var r = Cr.exec(e.slice(n, n + 1)); + return r ? n + r[0].length : -1; +} +function Pr(t, e, n) { + var r = nt.exec(e.slice(n)); + return r ? (t.Q = +r[0], n + r[0].length) : -1; +} +function Rr(t, e, n) { + var r = nt.exec(e.slice(n)); + return r ? (t.s = +r[0], n + r[0].length) : -1; +} +function Re(t, e) { + return B(t.getDate(), e, 2); +} +function Br(t, e) { + return B(t.getHours(), e, 2); +} +function Zr(t, e) { + return B(t.getHours() % 12 || 12, e, 2); +} +function Xr(t, e) { + return B(1 + Tt.count(kt(t), t), e, 3); +} +function gn(t, e) { + return B(t.getMilliseconds(), e, 3); +} +function qr(t, e) { + return gn(t, e) + "000"; +} +function Gr(t, e) { + return B(t.getMonth() + 1, e, 2); +} +function jr(t, e) { + return B(t.getMinutes(), e, 2); +} +function Qr(t, e) { + return B(t.getSeconds(), e, 2); +} +function $r(t) { + var e = t.getDay(); + return e === 0 ? 7 : e; +} +function Jr(t, e) { + return B(Vt.count(kt(t) - 1, t), e, 2); +} +function yn(t) { + var e = t.getDay(); + return e >= 4 || e === 0 ? bt(t) : bt.ceil(t); +} +function Kr(t, e) { + return t = yn(t), B(bt.count(kt(t), t) + (kt(t).getDay() === 4), e, 2); +} +function ta(t) { + return t.getDay(); +} +function ea(t, e) { + return B(Ht.count(kt(t) - 1, t), e, 2); +} +function na(t, e) { + return B(t.getFullYear() % 100, e, 2); +} +function ra(t, e) { + return t = yn(t), B(t.getFullYear() % 100, e, 2); +} +function aa(t, e) { + return B(t.getFullYear() % 1e4, e, 4); +} +function ia(t, e) { + var n = t.getDay(); + return t = n >= 4 || n === 0 ? bt(t) : bt.ceil(t), B(t.getFullYear() % 1e4, e, 4); +} +function sa(t) { + var e = t.getTimezoneOffset(); + return (e > 0 ? "-" : (e *= -1, "+")) + B(e / 60 | 0, "0", 2) + B(e % 60, "0", 2); +} +function Be(t, e) { + return B(t.getUTCDate(), e, 2); +} +function oa(t, e) { + return B(t.getUTCHours(), e, 2); +} +function ca(t, e) { + return B(t.getUTCHours() % 12 || 12, e, 2); +} +function la(t, e) { + return B(1 + we.count(xt(t), t), e, 3); +} +function kn(t, e) { + return B(t.getUTCMilliseconds(), e, 3); +} +function ua(t, e) { + return kn(t, e) + "000"; +} +function fa(t, e) { + return B(t.getUTCMonth() + 1, e, 2); +} +function ha(t, e) { + return B(t.getUTCMinutes(), e, 2); +} +function da(t, e) { + return B(t.getUTCSeconds(), e, 2); +} +function ma(t) { + var e = t.getUTCDay(); + return e === 0 ? 7 : e; +} +function ga(t, e) { + return B(mn.count(xt(t) - 1, t), e, 2); +} +function pn(t) { + var e = t.getUTCDay(); + return e >= 4 || e === 0 ? Ut(t) : Ut.ceil(t); +} +function ya(t, e) { + return t = pn(t), B(Ut.count(xt(t), t) + (xt(t).getUTCDay() === 4), e, 2); +} +function ka(t) { + return t.getUTCDay(); +} +function pa(t, e) { + return B(Jt.count(xt(t) - 1, t), e, 2); +} +function va(t, e) { + return B(t.getUTCFullYear() % 100, e, 2); +} +function Ta(t, e) { + return t = pn(t), B(t.getUTCFullYear() % 100, e, 2); +} +function ba(t, e) { + return B(t.getUTCFullYear() % 1e4, e, 4); +} +function xa(t, e) { + var n = t.getUTCDay(); + return t = n >= 4 || n === 0 ? Ut(t) : Ut.ceil(t), B(t.getUTCFullYear() % 1e4, e, 4); +} +function wa() { + return "+0000"; +} +function Ze() { + return "%"; +} +function Xe(t) { + return +t; +} +function qe(t) { + return Math.floor(+t / 1e3); +} +var Mt, Kt; +Da({ + dateTime: "%x, %X", + date: "%-m/%-d/%Y", + time: "%-I:%M:%S %p", + periods: ["AM", "PM"], + days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], + shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], + months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], + shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] +}); +function Da(t) { + return Mt = Dr(t), Kt = Mt.format, Mt.parse, Mt.utcFormat, Mt.utcParse, Mt; +} +function Ca(t) { + return new Date(t); +} +function Ma(t) { + return t instanceof Date ? +t : +/* @__PURE__ */ new Date(+t); +} +function vn(t, e, n, r, a, i, s, k, M, T) { + var g = Zn(), U = g.invert, D = g.domain, b = T(".%L"), q = T(":%S"), O = T("%I:%M"), C = T("%I %p"), I = T("%a %d"), V = T("%b %d"), W = T("%B"), Z = T("%Y"); + function Q(w) { + return (M(w) < w ? b : k(w) < w ? q : s(w) < w ? O : i(w) < w ? C : r(w) < w ? a(w) < w ? I : V : n(w) < w ? W : Z)(w); + } + return g.invert = function(w) { + return new Date(U(w)); + }, g.domain = function(w) { + return arguments.length ? D(Array.from(w, Ma)) : D().map(Ca); + }, g.ticks = function(w) { + var H = D(); + return t(H[0], H[H.length - 1], w ?? 10); + }, g.tickFormat = function(w, H) { + return H == null ? Q : T(H); + }, g.nice = function(w) { + var H = D(); + return (!w || typeof w.range != "function") && (w = e(H[0], H[H.length - 1], w ?? 10)), w ? D(hr(H, w)) : g; + }, g.copy = function() { + return Xn(g, vn(t, e, n, r, a, i, s, k, M, T)); + }, g; +} +function _a() { + return Gn.apply(vn(xr, wr, kt, Nt, Vt, Tt, Ot, Wt, vt, Kt).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); +} +var Tn = { exports: {} }; +(function(t, e) { + (function(n, r) { + t.exports = r(); + })(Te, function() { + var n = "day"; + return function(r, a, i) { + var s = function(T) { + return T.add(4 - T.isoWeekday(), n); + }, k = a.prototype; + k.isoWeekYear = function() { + return s(this).year(); + }, k.isoWeek = function(T) { + if (!this.$utils().u(T)) return this.add(7 * (T - this.isoWeek()), n); + var g, U, D, b, q = s(this), O = (g = this.isoWeekYear(), U = this.$u, D = (U ? i.utc : i)().year(g).startOf("year"), b = 4 - D.isoWeekday(), D.isoWeekday() > 4 && (b += 7), D.add(b, n)); + return q.diff(O, "week") + 1; + }, k.isoWeekday = function(T) { + return this.$utils().u(T) ? this.day() || 7 : this.day(this.day() % 7 ? T : T - 7); + }; + var M = k.startOf; + k.startOf = function(T, g) { + var U = this.$utils(), D = !!U.u(g) || g; + return U.p(T) === "isoweek" ? D ? this.date(this.date() - (this.isoWeekday() - 1)).startOf("day") : this.date(this.date() - 1 - (this.isoWeekday() - 1) + 7).endOf("day") : M.bind(this)(T, g); + }; + }; + }); +})(Tn); +var Sa = Tn.exports; +const Fa = /* @__PURE__ */ be(Sa); +var bn = { exports: {} }; +(function(t, e) { + (function(n, r) { + t.exports = r(); + })(Te, function() { + var n = { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, r = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, a = /\d/, i = /\d\d/, s = /\d\d?/, k = /\d*[^-_:/,()\s\d]+/, M = {}, T = function(C) { + return (C = +C) + (C > 68 ? 1900 : 2e3); + }, g = function(C) { + return function(I) { + this[C] = +I; + }; + }, U = [/[+-]\d\d:?(\d\d)?|Z/, function(C) { + (this.zone || (this.zone = {})).offset = function(I) { + if (!I || I === "Z") return 0; + var V = I.match(/([+-]|\d\d)/g), W = 60 * V[1] + (+V[2] || 0); + return W === 0 ? 0 : V[0] === "+" ? -W : W; + }(C); + }], D = function(C) { + var I = M[C]; + return I && (I.indexOf ? I : I.s.concat(I.f)); + }, b = function(C, I) { + var V, W = M.meridiem; + if (W) { + for (var Z = 1; Z <= 24; Z += 1) if (C.indexOf(W(Z, 0, I)) > -1) { + V = Z > 12; + break; + } + } else V = C === (I ? "pm" : "PM"); + return V; + }, q = { A: [k, function(C) { + this.afternoon = b(C, !1); + }], a: [k, function(C) { + this.afternoon = b(C, !0); + }], Q: [a, function(C) { + this.month = 3 * (C - 1) + 1; + }], S: [a, function(C) { + this.milliseconds = 100 * +C; + }], SS: [i, function(C) { + this.milliseconds = 10 * +C; + }], SSS: [/\d{3}/, function(C) { + this.milliseconds = +C; + }], s: [s, g("seconds")], ss: [s, g("seconds")], m: [s, g("minutes")], mm: [s, g("minutes")], H: [s, g("hours")], h: [s, g("hours")], HH: [s, g("hours")], hh: [s, g("hours")], D: [s, g("day")], DD: [i, g("day")], Do: [k, function(C) { + var I = M.ordinal, V = C.match(/\d+/); + if (this.day = V[0], I) for (var W = 1; W <= 31; W += 1) I(W).replace(/\[|\]/g, "") === C && (this.day = W); + }], w: [s, g("week")], ww: [i, g("week")], M: [s, g("month")], MM: [i, g("month")], MMM: [k, function(C) { + var I = D("months"), V = (D("monthsShort") || I.map(function(W) { + return W.slice(0, 3); + })).indexOf(C) + 1; + if (V < 1) throw new Error(); + this.month = V % 12 || V; + }], MMMM: [k, function(C) { + var I = D("months").indexOf(C) + 1; + if (I < 1) throw new Error(); + this.month = I % 12 || I; + }], Y: [/[+-]?\d+/, g("year")], YY: [i, function(C) { + this.year = T(C); + }], YYYY: [/\d{4}/, g("year")], Z: U, ZZ: U }; + function O(C) { + var I, V; + I = C, V = M && M.formats; + for (var W = (C = I.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(_, S, p) { + var Y = p && p.toUpperCase(); + return S || V[p] || n[p] || V[Y].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(l, f, y) { + return f || y.slice(1); + }); + })).match(r), Z = W.length, Q = 0; Q < Z; Q += 1) { + var w = W[Q], H = q[w], x = H && H[0], F = H && H[1]; + W[Q] = F ? { regex: x, parser: F } : w.replace(/^\[|\]$/g, ""); + } + return function(_) { + for (var S = {}, p = 0, Y = 0; p < Z; p += 1) { + var l = W[p]; + if (typeof l == "string") Y += l.length; + else { + var f = l.regex, y = l.parser, m = _.slice(Y), E = f.exec(m)[0]; + y.call(S, E), _ = _.replace(E, ""); + } + } + return function(c) { + var d = c.afternoon; + if (d !== void 0) { + var o = c.hours; + d ? o < 12 && (c.hours += 12) : o === 12 && (c.hours = 0), delete c.afternoon; + } + }(S), S; + }; + } + return function(C, I, V) { + V.p.customParseFormat = !0, C && C.parseTwoDigitYear && (T = C.parseTwoDigitYear); + var W = I.prototype, Z = W.parse; + W.parse = function(Q) { + var w = Q.date, H = Q.utc, x = Q.args; + this.$u = H; + var F = x[1]; + if (typeof F == "string") { + var _ = x[2] === !0, S = x[3] === !0, p = _ || S, Y = x[2]; + S && (Y = x[2]), M = this.$locale(), !_ && Y && (M = V.Ls[Y]), this.$d = function(m, E, c, d) { + try { + if (["x", "X"].indexOf(E) > -1) return new Date((E === "X" ? 1e3 : 1) * m); + var o = O(E)(m), P = o.year, z = o.month, R = o.day, K = o.hours, G = o.minutes, $ = o.seconds, it = o.milliseconds, v = o.zone, A = o.week, N = /* @__PURE__ */ new Date(), u = R || (P || z ? 1 : N.getDate()), J = P || N.getFullYear(), L = 0; + P && !z || (L = z > 0 ? z - 1 : N.getMonth()); + var j, X = K || 0, rt = G || 0, st = $ || 0, pt = it || 0; + return v ? new Date(Date.UTC(J, L, u, X, rt, st, pt + 60 * v.offset * 1e3)) : c ? new Date(Date.UTC(J, L, u, X, rt, st, pt)) : (j = new Date(J, L, u, X, rt, st, pt), A && (j = d(j).week(A).toDate()), j); + } catch { + return /* @__PURE__ */ new Date(""); + } + }(w, F, H, V), this.init(), Y && Y !== !0 && (this.$L = this.locale(Y).$L), p && w != this.format(F) && (this.$d = /* @__PURE__ */ new Date("")), M = {}; + } else if (F instanceof Array) for (var l = F.length, f = 1; f <= l; f += 1) { + x[1] = F[f - 1]; + var y = V.apply(this, x); + if (y.isValid()) { + this.$d = y.$d, this.$L = y.$L, this.init(); + break; + } + f === l && (this.$d = /* @__PURE__ */ new Date("")); + } + else Z.call(this, Q); + }; + }; + }); +})(bn); +var Ya = bn.exports; +const Ua = /* @__PURE__ */ be(Ya); +var xn = { exports: {} }; +(function(t, e) { + (function(n, r) { + t.exports = r(); + })(Te, function() { + return function(n, r) { + var a = r.prototype, i = a.format; + a.format = function(s) { + var k = this, M = this.$locale(); + if (!this.isValid()) return i.bind(this)(s); + var T = this.$utils(), g = (s || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function(U) { + switch (U) { + case "Q": + return Math.ceil((k.$M + 1) / 3); + case "Do": + return M.ordinal(k.$D); + case "gggg": + return k.weekYear(); + case "GGGG": + return k.isoWeekYear(); + case "wo": + return M.ordinal(k.week(), "W"); + case "w": + case "ww": + return T.s(k.week(), U === "w" ? 1 : 2, "0"); + case "W": + case "WW": + return T.s(k.isoWeek(), U === "W" ? 1 : 2, "0"); + case "k": + case "kk": + return T.s(String(k.$H === 0 ? 24 : k.$H), U === "k" ? 1 : 2, "0"); + case "X": + return Math.floor(k.$d.getTime() / 1e3); + case "x": + return k.$d.getTime(); + case "z": + return "[" + k.offsetName() + "]"; + case "zzz": + return "[" + k.offsetName("long") + "]"; + default: + return U; + } + }); + return i.bind(this)(g); + }; + }; + }); +})(xn); +var Ea = xn.exports; +const La = /* @__PURE__ */ be(Ea); +var ye = function() { + var t = /* @__PURE__ */ h(function(Y, l, f, y) { + for (f = f || {}, y = Y.length; y--; f[Y[y]] = l) ; + return f; + }, "o"), e = [6, 8, 10, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 33, 35, 36, 38, 40], n = [1, 26], r = [1, 27], a = [1, 28], i = [1, 29], s = [1, 30], k = [1, 31], M = [1, 32], T = [1, 33], g = [1, 34], U = [1, 9], D = [1, 10], b = [1, 11], q = [1, 12], O = [1, 13], C = [1, 14], I = [1, 15], V = [1, 16], W = [1, 19], Z = [1, 20], Q = [1, 21], w = [1, 22], H = [1, 23], x = [1, 25], F = [1, 35], _ = { + trace: /* @__PURE__ */ h(function() { + }, "trace"), + yy: {}, + symbols_: { error: 2, start: 3, gantt: 4, document: 5, EOF: 6, line: 7, SPACE: 8, statement: 9, NL: 10, weekday: 11, weekday_monday: 12, weekday_tuesday: 13, weekday_wednesday: 14, weekday_thursday: 15, weekday_friday: 16, weekday_saturday: 17, weekday_sunday: 18, weekend: 19, weekend_friday: 20, weekend_saturday: 21, dateFormat: 22, inclusiveEndDates: 23, topAxis: 24, axisFormat: 25, tickInterval: 26, excludes: 27, includes: 28, todayMarker: 29, title: 30, acc_title: 31, acc_title_value: 32, acc_descr: 33, acc_descr_value: 34, acc_descr_multiline_value: 35, section: 36, clickStatement: 37, taskTxt: 38, taskData: 39, click: 40, callbackname: 41, callbackargs: 42, href: 43, clickStatementDebug: 44, $accept: 0, $end: 1 }, + terminals_: { 2: "error", 4: "gantt", 6: "EOF", 8: "SPACE", 10: "NL", 12: "weekday_monday", 13: "weekday_tuesday", 14: "weekday_wednesday", 15: "weekday_thursday", 16: "weekday_friday", 17: "weekday_saturday", 18: "weekday_sunday", 20: "weekend_friday", 21: "weekend_saturday", 22: "dateFormat", 23: "inclusiveEndDates", 24: "topAxis", 25: "axisFormat", 26: "tickInterval", 27: "excludes", 28: "includes", 29: "todayMarker", 30: "title", 31: "acc_title", 32: "acc_title_value", 33: "acc_descr", 34: "acc_descr_value", 35: "acc_descr_multiline_value", 36: "section", 38: "taskTxt", 39: "taskData", 40: "click", 41: "callbackname", 42: "callbackargs", 43: "href" }, + productions_: [0, [3, 3], [5, 0], [5, 2], [7, 2], [7, 1], [7, 1], [7, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [11, 1], [19, 1], [19, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 1], [9, 2], [9, 2], [9, 1], [9, 1], [9, 1], [9, 2], [37, 2], [37, 3], [37, 3], [37, 4], [37, 3], [37, 4], [37, 2], [44, 2], [44, 3], [44, 3], [44, 4], [44, 3], [44, 4], [44, 2]], + performAction: /* @__PURE__ */ h(function(l, f, y, m, E, c, d) { + var o = c.length - 1; + switch (E) { + case 1: + return c[o - 1]; + case 2: + this.$ = []; + break; + case 3: + c[o - 1].push(c[o]), this.$ = c[o - 1]; + break; + case 4: + case 5: + this.$ = c[o]; + break; + case 6: + case 7: + this.$ = []; + break; + case 8: + m.setWeekday("monday"); + break; + case 9: + m.setWeekday("tuesday"); + break; + case 10: + m.setWeekday("wednesday"); + break; + case 11: + m.setWeekday("thursday"); + break; + case 12: + m.setWeekday("friday"); + break; + case 13: + m.setWeekday("saturday"); + break; + case 14: + m.setWeekday("sunday"); + break; + case 15: + m.setWeekend("friday"); + break; + case 16: + m.setWeekend("saturday"); + break; + case 17: + m.setDateFormat(c[o].substr(11)), this.$ = c[o].substr(11); + break; + case 18: + m.enableInclusiveEndDates(), this.$ = c[o].substr(18); + break; + case 19: + m.TopAxis(), this.$ = c[o].substr(8); + break; + case 20: + m.setAxisFormat(c[o].substr(11)), this.$ = c[o].substr(11); + break; + case 21: + m.setTickInterval(c[o].substr(13)), this.$ = c[o].substr(13); + break; + case 22: + m.setExcludes(c[o].substr(9)), this.$ = c[o].substr(9); + break; + case 23: + m.setIncludes(c[o].substr(9)), this.$ = c[o].substr(9); + break; + case 24: + m.setTodayMarker(c[o].substr(12)), this.$ = c[o].substr(12); + break; + case 27: + m.setDiagramTitle(c[o].substr(6)), this.$ = c[o].substr(6); + break; + case 28: + this.$ = c[o].trim(), m.setAccTitle(this.$); + break; + case 29: + case 30: + this.$ = c[o].trim(), m.setAccDescription(this.$); + break; + case 31: + m.addSection(c[o].substr(8)), this.$ = c[o].substr(8); + break; + case 33: + m.addTask(c[o - 1], c[o]), this.$ = "task"; + break; + case 34: + this.$ = c[o - 1], m.setClickEvent(c[o - 1], c[o], null); + break; + case 35: + this.$ = c[o - 2], m.setClickEvent(c[o - 2], c[o - 1], c[o]); + break; + case 36: + this.$ = c[o - 2], m.setClickEvent(c[o - 2], c[o - 1], null), m.setLink(c[o - 2], c[o]); + break; + case 37: + this.$ = c[o - 3], m.setClickEvent(c[o - 3], c[o - 2], c[o - 1]), m.setLink(c[o - 3], c[o]); + break; + case 38: + this.$ = c[o - 2], m.setClickEvent(c[o - 2], c[o], null), m.setLink(c[o - 2], c[o - 1]); + break; + case 39: + this.$ = c[o - 3], m.setClickEvent(c[o - 3], c[o - 1], c[o]), m.setLink(c[o - 3], c[o - 2]); + break; + case 40: + this.$ = c[o - 1], m.setLink(c[o - 1], c[o]); + break; + case 41: + case 47: + this.$ = c[o - 1] + " " + c[o]; + break; + case 42: + case 43: + case 45: + this.$ = c[o - 2] + " " + c[o - 1] + " " + c[o]; + break; + case 44: + case 46: + this.$ = c[o - 3] + " " + c[o - 2] + " " + c[o - 1] + " " + c[o]; + break; + } + }, "anonymous"), + table: [{ 3: 1, 4: [1, 2] }, { 1: [3] }, t(e, [2, 2], { 5: 3 }), { 6: [1, 4], 7: 5, 8: [1, 6], 9: 7, 10: [1, 8], 11: 17, 12: n, 13: r, 14: a, 15: i, 16: s, 17: k, 18: M, 19: 18, 20: T, 21: g, 22: U, 23: D, 24: b, 25: q, 26: O, 27: C, 28: I, 29: V, 30: W, 31: Z, 33: Q, 35: w, 36: H, 37: 24, 38: x, 40: F }, t(e, [2, 7], { 1: [2, 1] }), t(e, [2, 3]), { 9: 36, 11: 17, 12: n, 13: r, 14: a, 15: i, 16: s, 17: k, 18: M, 19: 18, 20: T, 21: g, 22: U, 23: D, 24: b, 25: q, 26: O, 27: C, 28: I, 29: V, 30: W, 31: Z, 33: Q, 35: w, 36: H, 37: 24, 38: x, 40: F }, t(e, [2, 5]), t(e, [2, 6]), t(e, [2, 17]), t(e, [2, 18]), t(e, [2, 19]), t(e, [2, 20]), t(e, [2, 21]), t(e, [2, 22]), t(e, [2, 23]), t(e, [2, 24]), t(e, [2, 25]), t(e, [2, 26]), t(e, [2, 27]), { 32: [1, 37] }, { 34: [1, 38] }, t(e, [2, 30]), t(e, [2, 31]), t(e, [2, 32]), { 39: [1, 39] }, t(e, [2, 8]), t(e, [2, 9]), t(e, [2, 10]), t(e, [2, 11]), t(e, [2, 12]), t(e, [2, 13]), t(e, [2, 14]), t(e, [2, 15]), t(e, [2, 16]), { 41: [1, 40], 43: [1, 41] }, t(e, [2, 4]), t(e, [2, 28]), t(e, [2, 29]), t(e, [2, 33]), t(e, [2, 34], { 42: [1, 42], 43: [1, 43] }), t(e, [2, 40], { 41: [1, 44] }), t(e, [2, 35], { 43: [1, 45] }), t(e, [2, 36]), t(e, [2, 38], { 42: [1, 46] }), t(e, [2, 37]), t(e, [2, 39])], + defaultActions: {}, + parseError: /* @__PURE__ */ h(function(l, f) { + if (f.recoverable) + this.trace(l); + else { + var y = new Error(l); + throw y.hash = f, y; + } + }, "parseError"), + parse: /* @__PURE__ */ h(function(l) { + var f = this, y = [0], m = [], E = [null], c = [], d = this.table, o = "", P = 0, z = 0, R = 2, K = 1, G = c.slice.call(arguments, 1), $ = Object.create(this.lexer), it = { yy: {} }; + for (var v in this.yy) + Object.prototype.hasOwnProperty.call(this.yy, v) && (it.yy[v] = this.yy[v]); + $.setInput(l, it.yy), it.yy.lexer = $, it.yy.parser = this, typeof $.yylloc > "u" && ($.yylloc = {}); + var A = $.yylloc; + c.push(A); + var N = $.options && $.options.ranges; + typeof it.yy.parseError == "function" ? this.parseError = it.yy.parseError : this.parseError = Object.getPrototypeOf(this).parseError; + function u(ot) { + y.length = y.length - 2 * ot, E.length = E.length - ot, c.length = c.length - ot; + } + h(u, "popStack"); + function J() { + var ot; + return ot = m.pop() || $.lex() || K, typeof ot != "number" && (ot instanceof Array && (m = ot, ot = m.pop()), ot = f.symbols_[ot] || ot), ot; + } + h(J, "lex"); + for (var L, j, X, rt, st = {}, pt, lt, Ae, Bt; ; ) { + if (j = y[y.length - 1], this.defaultActions[j] ? X = this.defaultActions[j] : ((L === null || typeof L > "u") && (L = J()), X = d[j] && d[j][L]), typeof X > "u" || !X.length || !X[0]) { + var ne = ""; + Bt = []; + for (pt in d[j]) + this.terminals_[pt] && pt > R && Bt.push("'" + this.terminals_[pt] + "'"); + $.showPosition ? ne = "Parse error on line " + (P + 1) + `: +` + $.showPosition() + ` +Expecting ` + Bt.join(", ") + ", got '" + (this.terminals_[L] || L) + "'" : ne = "Parse error on line " + (P + 1) + ": Unexpected " + (L == K ? "end of input" : "'" + (this.terminals_[L] || L) + "'"), this.parseError(ne, { + text: $.match, + token: this.terminals_[L] || L, + line: $.yylineno, + loc: A, + expected: Bt + }); + } + if (X[0] instanceof Array && X.length > 1) + throw new Error("Parse Error: multiple actions possible at state: " + j + ", token: " + L); + switch (X[0]) { + case 1: + y.push(L), E.push($.yytext), c.push($.yylloc), y.push(X[1]), L = null, z = $.yyleng, o = $.yytext, P = $.yylineno, A = $.yylloc; + break; + case 2: + if (lt = this.productions_[X[1]][1], st.$ = E[E.length - lt], st._$ = { + first_line: c[c.length - (lt || 1)].first_line, + last_line: c[c.length - 1].last_line, + first_column: c[c.length - (lt || 1)].first_column, + last_column: c[c.length - 1].last_column + }, N && (st._$.range = [ + c[c.length - (lt || 1)].range[0], + c[c.length - 1].range[1] + ]), rt = this.performAction.apply(st, [ + o, + z, + P, + it.yy, + X[1], + E, + c + ].concat(G)), typeof rt < "u") + return rt; + lt && (y = y.slice(0, -1 * lt * 2), E = E.slice(0, -1 * lt), c = c.slice(0, -1 * lt)), y.push(this.productions_[X[1]][0]), E.push(st.$), c.push(st._$), Ae = d[y[y.length - 2]][y[y.length - 1]], y.push(Ae); + break; + case 3: + return !0; + } + } + return !0; + }, "parse") + }, S = /* @__PURE__ */ function() { + var Y = { + EOF: 1, + parseError: /* @__PURE__ */ h(function(f, y) { + if (this.yy.parser) + this.yy.parser.parseError(f, y); + else + throw new Error(f); + }, "parseError"), + // resets the lexer, sets new input + setInput: /* @__PURE__ */ h(function(l, f) { + return this.yy = f || this.yy || {}, this._input = l, this._more = this._backtrack = this.done = !1, this.yylineno = this.yyleng = 0, this.yytext = this.matched = this.match = "", this.conditionStack = ["INITIAL"], this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }, this.options.ranges && (this.yylloc.range = [0, 0]), this.offset = 0, this; + }, "setInput"), + // consumes and returns one char from the input + input: /* @__PURE__ */ h(function() { + var l = this._input[0]; + this.yytext += l, this.yyleng++, this.offset++, this.match += l, this.matched += l; + var f = l.match(/(?:\r\n?|\n).*/g); + return f ? (this.yylineno++, this.yylloc.last_line++) : this.yylloc.last_column++, this.options.ranges && this.yylloc.range[1]++, this._input = this._input.slice(1), l; + }, "input"), + // unshifts one char (or a string) into the input + unput: /* @__PURE__ */ h(function(l) { + var f = l.length, y = l.split(/(?:\r\n?|\n)/g); + this._input = l + this._input, this.yytext = this.yytext.substr(0, this.yytext.length - f), this.offset -= f; + var m = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1), this.matched = this.matched.substr(0, this.matched.length - 1), y.length - 1 && (this.yylineno -= y.length - 1); + var E = this.yylloc.range; + return this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: y ? (y.length === m.length ? this.yylloc.first_column : 0) + m[m.length - y.length].length - y[0].length : this.yylloc.first_column - f + }, this.options.ranges && (this.yylloc.range = [E[0], E[0] + this.yyleng - f]), this.yyleng = this.yytext.length, this; + }, "unput"), + // When called from action, caches matched text and appends it on next action + more: /* @__PURE__ */ h(function() { + return this._more = !0, this; + }, "more"), + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: /* @__PURE__ */ h(function() { + if (this.options.backtrack_lexer) + this._backtrack = !0; + else + return this.parseError("Lexical error on line " + (this.yylineno + 1) + `. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true). +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + return this; + }, "reject"), + // retain first n characters of the match + less: /* @__PURE__ */ h(function(l) { + this.unput(this.match.slice(l)); + }, "less"), + // displays already matched input, i.e. for error messages + pastInput: /* @__PURE__ */ h(function() { + var l = this.matched.substr(0, this.matched.length - this.match.length); + return (l.length > 20 ? "..." : "") + l.substr(-20).replace(/\n/g, ""); + }, "pastInput"), + // displays upcoming input, i.e. for error messages + upcomingInput: /* @__PURE__ */ h(function() { + var l = this.match; + return l.length < 20 && (l += this._input.substr(0, 20 - l.length)), (l.substr(0, 20) + (l.length > 20 ? "..." : "")).replace(/\n/g, ""); + }, "upcomingInput"), + // displays the character position where the lexing error occurred, i.e. for error messages + showPosition: /* @__PURE__ */ h(function() { + var l = this.pastInput(), f = new Array(l.length + 1).join("-"); + return l + this.upcomingInput() + ` +` + f + "^"; + }, "showPosition"), + // test the lexed token: return FALSE when not a match, otherwise return token + test_match: /* @__PURE__ */ h(function(l, f) { + var y, m, E; + if (this.options.backtrack_lexer && (E = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }, this.options.ranges && (E.yylloc.range = this.yylloc.range.slice(0))), m = l[0].match(/(?:\r\n?|\n).*/g), m && (this.yylineno += m.length), this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: m ? m[m.length - 1].length - m[m.length - 1].match(/\r?\n?/)[0].length : this.yylloc.last_column + l[0].length + }, this.yytext += l[0], this.match += l[0], this.matches = l, this.yyleng = this.yytext.length, this.options.ranges && (this.yylloc.range = [this.offset, this.offset += this.yyleng]), this._more = !1, this._backtrack = !1, this._input = this._input.slice(l[0].length), this.matched += l[0], y = this.performAction.call(this, this.yy, this, f, this.conditionStack[this.conditionStack.length - 1]), this.done && this._input && (this.done = !1), y) + return y; + if (this._backtrack) { + for (var c in E) + this[c] = E[c]; + return !1; + } + return !1; + }, "test_match"), + // return next match in input + next: /* @__PURE__ */ h(function() { + if (this.done) + return this.EOF; + this._input || (this.done = !0); + var l, f, y, m; + this._more || (this.yytext = "", this.match = ""); + for (var E = this._currentRules(), c = 0; c < E.length; c++) + if (y = this._input.match(this.rules[E[c]]), y && (!f || y[0].length > f[0].length)) { + if (f = y, m = c, this.options.backtrack_lexer) { + if (l = this.test_match(y, E[c]), l !== !1) + return l; + if (this._backtrack) { + f = !1; + continue; + } else + return !1; + } else if (!this.options.flex) + break; + } + return f ? (l = this.test_match(f, E[m]), l !== !1 ? l : !1) : this._input === "" ? this.EOF : this.parseError("Lexical error on line " + (this.yylineno + 1) + `. Unrecognized text. +` + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + }, "next"), + // return next match that has a token + lex: /* @__PURE__ */ h(function() { + var f = this.next(); + return f || this.lex(); + }, "lex"), + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + begin: /* @__PURE__ */ h(function(f) { + this.conditionStack.push(f); + }, "begin"), + // pop the previously active lexer condition state off the condition stack + popState: /* @__PURE__ */ h(function() { + var f = this.conditionStack.length - 1; + return f > 0 ? this.conditionStack.pop() : this.conditionStack[0]; + }, "popState"), + // produce the lexer rule set which is active for the currently active lexer condition state + _currentRules: /* @__PURE__ */ h(function() { + return this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1] ? this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules : this.conditions.INITIAL.rules; + }, "_currentRules"), + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: /* @__PURE__ */ h(function(f) { + return f = this.conditionStack.length - 1 - Math.abs(f || 0), f >= 0 ? this.conditionStack[f] : "INITIAL"; + }, "topState"), + // alias for begin(condition) + pushState: /* @__PURE__ */ h(function(f) { + this.begin(f); + }, "pushState"), + // return the number of states currently on the stack + stateStackSize: /* @__PURE__ */ h(function() { + return this.conditionStack.length; + }, "stateStackSize"), + options: { "case-insensitive": !0 }, + performAction: /* @__PURE__ */ h(function(f, y, m, E) { + switch (m) { + case 0: + return this.begin("open_directive"), "open_directive"; + case 1: + return this.begin("acc_title"), 31; + case 2: + return this.popState(), "acc_title_value"; + case 3: + return this.begin("acc_descr"), 33; + case 4: + return this.popState(), "acc_descr_value"; + case 5: + this.begin("acc_descr_multiline"); + break; + case 6: + this.popState(); + break; + case 7: + return "acc_descr_multiline_value"; + case 8: + break; + case 9: + break; + case 10: + break; + case 11: + return 10; + case 12: + break; + case 13: + break; + case 14: + this.begin("href"); + break; + case 15: + this.popState(); + break; + case 16: + return 43; + case 17: + this.begin("callbackname"); + break; + case 18: + this.popState(); + break; + case 19: + this.popState(), this.begin("callbackargs"); + break; + case 20: + return 41; + case 21: + this.popState(); + break; + case 22: + return 42; + case 23: + this.begin("click"); + break; + case 24: + this.popState(); + break; + case 25: + return 40; + case 26: + return 4; + case 27: + return 22; + case 28: + return 23; + case 29: + return 24; + case 30: + return 25; + case 31: + return 26; + case 32: + return 28; + case 33: + return 27; + case 34: + return 29; + case 35: + return 12; + case 36: + return 13; + case 37: + return 14; + case 38: + return 15; + case 39: + return 16; + case 40: + return 17; + case 41: + return 18; + case 42: + return 20; + case 43: + return 21; + case 44: + return "date"; + case 45: + return 30; + case 46: + return "accDescription"; + case 47: + return 36; + case 48: + return 38; + case 49: + return 39; + case 50: + return ":"; + case 51: + return 6; + case 52: + return "INVALID"; + } + }, "anonymous"), + rules: [/^(?:%%\{)/i, /^(?:accTitle\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*:\s*)/i, /^(?:(?!\n||)*[^\n]*)/i, /^(?:accDescr\s*\{\s*)/i, /^(?:[\}])/i, /^(?:[^\}]*)/i, /^(?:%%(?!\{)*[^\n]*)/i, /^(?:[^\}]%%*[^\n]*)/i, /^(?:%%*[^\n]*[\n]*)/i, /^(?:[\n]+)/i, /^(?:\s+)/i, /^(?:%[^\n]*)/i, /^(?:href[\s]+["])/i, /^(?:["])/i, /^(?:[^"]*)/i, /^(?:call[\s]+)/i, /^(?:\([\s]*\))/i, /^(?:\()/i, /^(?:[^(]*)/i, /^(?:\))/i, /^(?:[^)]*)/i, /^(?:click[\s]+)/i, /^(?:[\s\n])/i, /^(?:[^\s\n]*)/i, /^(?:gantt\b)/i, /^(?:dateFormat\s[^#\n;]+)/i, /^(?:inclusiveEndDates\b)/i, /^(?:topAxis\b)/i, /^(?:axisFormat\s[^#\n;]+)/i, /^(?:tickInterval\s[^#\n;]+)/i, /^(?:includes\s[^#\n;]+)/i, /^(?:excludes\s[^#\n;]+)/i, /^(?:todayMarker\s[^\n;]+)/i, /^(?:weekday\s+monday\b)/i, /^(?:weekday\s+tuesday\b)/i, /^(?:weekday\s+wednesday\b)/i, /^(?:weekday\s+thursday\b)/i, /^(?:weekday\s+friday\b)/i, /^(?:weekday\s+saturday\b)/i, /^(?:weekday\s+sunday\b)/i, /^(?:weekend\s+friday\b)/i, /^(?:weekend\s+saturday\b)/i, /^(?:\d\d\d\d-\d\d-\d\d\b)/i, /^(?:title\s[^\n]+)/i, /^(?:accDescription\s[^#\n;]+)/i, /^(?:section\s[^\n]+)/i, /^(?:[^:\n]+)/i, /^(?::[^#\n;]+)/i, /^(?::)/i, /^(?:$)/i, /^(?:.)/i], + conditions: { acc_descr_multiline: { rules: [6, 7], inclusive: !1 }, acc_descr: { rules: [4], inclusive: !1 }, acc_title: { rules: [2], inclusive: !1 }, callbackargs: { rules: [21, 22], inclusive: !1 }, callbackname: { rules: [18, 19, 20], inclusive: !1 }, href: { rules: [15, 16], inclusive: !1 }, click: { rules: [24, 25], inclusive: !1 }, INITIAL: { rules: [0, 1, 3, 5, 8, 9, 10, 11, 12, 13, 14, 17, 23, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52], inclusive: !0 } } + }; + return Y; + }(); + _.lexer = S; + function p() { + this.yy = {}; + } + return h(p, "Parser"), p.prototype = _, _.Parser = p, new p(); +}(); +ye.parser = ye; +var Aa = ye; +at.extend(Fa); +at.extend(Ua); +at.extend(La); +var Ge = { friday: 5, saturday: 6 }, ut = "", De = "", Ce = void 0, Me = "", zt = [], Pt = [], _e = /* @__PURE__ */ new Map(), Se = [], te = [], Et = "", Fe = "", wn = ["active", "done", "crit", "milestone"], Ye = [], Rt = !1, Ue = !1, Ee = "sunday", ee = "saturday", ke = 0, Ia = /* @__PURE__ */ h(function() { + Se = [], te = [], Et = "", Ye = [], Gt = 0, ve = void 0, jt = void 0, tt = [], ut = "", De = "", Fe = "", Ce = void 0, Me = "", zt = [], Pt = [], Rt = !1, Ue = !1, ke = 0, _e = /* @__PURE__ */ new Map(), Nn(), Ee = "sunday", ee = "saturday"; +}, "clear"), Wa = /* @__PURE__ */ h(function(t) { + De = t; +}, "setAxisFormat"), Oa = /* @__PURE__ */ h(function() { + return De; +}, "getAxisFormat"), Ha = /* @__PURE__ */ h(function(t) { + Ce = t; +}, "setTickInterval"), Na = /* @__PURE__ */ h(function() { + return Ce; +}, "getTickInterval"), Va = /* @__PURE__ */ h(function(t) { + Me = t; +}, "setTodayMarker"), za = /* @__PURE__ */ h(function() { + return Me; +}, "getTodayMarker"), Pa = /* @__PURE__ */ h(function(t) { + ut = t; +}, "setDateFormat"), Ra = /* @__PURE__ */ h(function() { + Rt = !0; +}, "enableInclusiveEndDates"), Ba = /* @__PURE__ */ h(function() { + return Rt; +}, "endDatesAreInclusive"), Za = /* @__PURE__ */ h(function() { + Ue = !0; +}, "enableTopAxis"), Xa = /* @__PURE__ */ h(function() { + return Ue; +}, "topAxisEnabled"), qa = /* @__PURE__ */ h(function(t) { + Fe = t; +}, "setDisplayMode"), Ga = /* @__PURE__ */ h(function() { + return Fe; +}, "getDisplayMode"), ja = /* @__PURE__ */ h(function() { + return ut; +}, "getDateFormat"), Qa = /* @__PURE__ */ h(function(t) { + zt = t.toLowerCase().split(/[\s,]+/); +}, "setIncludes"), $a = /* @__PURE__ */ h(function() { + return zt; +}, "getIncludes"), Ja = /* @__PURE__ */ h(function(t) { + Pt = t.toLowerCase().split(/[\s,]+/); +}, "setExcludes"), Ka = /* @__PURE__ */ h(function() { + return Pt; +}, "getExcludes"), ti = /* @__PURE__ */ h(function() { + return _e; +}, "getLinks"), ei = /* @__PURE__ */ h(function(t) { + Et = t, Se.push(t); +}, "addSection"), ni = /* @__PURE__ */ h(function() { + return Se; +}, "getSections"), ri = /* @__PURE__ */ h(function() { + let t = je(); + const e = 10; + let n = 0; + for (; !t && n < e; ) + t = je(), n++; + return te = tt, te; +}, "getTasks"), Dn = /* @__PURE__ */ h(function(t, e, n, r) { + return r.includes(t.format(e.trim())) ? !1 : n.includes("weekends") && (t.isoWeekday() === Ge[ee] || t.isoWeekday() === Ge[ee] + 1) || n.includes(t.format("dddd").toLowerCase()) ? !0 : n.includes(t.format(e.trim())); +}, "isInvalidDate"), ai = /* @__PURE__ */ h(function(t) { + Ee = t; +}, "setWeekday"), ii = /* @__PURE__ */ h(function() { + return Ee; +}, "getWeekday"), si = /* @__PURE__ */ h(function(t) { + ee = t; +}, "setWeekend"), Cn = /* @__PURE__ */ h(function(t, e, n, r) { + if (!n.length || t.manualEndTime) + return; + let a; + t.startTime instanceof Date ? a = at(t.startTime) : a = at(t.startTime, e, !0), a = a.add(1, "d"); + let i; + t.endTime instanceof Date ? i = at(t.endTime) : i = at(t.endTime, e, !0); + const [s, k] = oi( + a, + i, + e, + n, + r + ); + t.endTime = s.toDate(), t.renderEndTime = k; +}, "checkTaskDates"), oi = /* @__PURE__ */ h(function(t, e, n, r, a) { + let i = !1, s = null; + for (; t <= e; ) + i || (s = e.toDate()), i = Dn(t, n, r, a), i && (e = e.add(1, "d")), t = t.add(1, "d"); + return [e, s]; +}, "fixTaskDates"), pe = /* @__PURE__ */ h(function(t, e, n) { + n = n.trim(); + const a = /^after\s+(?[\d\w- ]+)/.exec(n); + if (a !== null) { + let s = null; + for (const M of a.groups.ids.split(" ")) { + let T = Ct(M); + T !== void 0 && (!s || T.endTime > s.endTime) && (s = T); + } + if (s) + return s.endTime; + const k = /* @__PURE__ */ new Date(); + return k.setHours(0, 0, 0, 0), k; + } + let i = at(n, e.trim(), !0); + if (i.isValid()) + return i.toDate(); + { + Qt.debug("Invalid date:" + n), Qt.debug("With date format:" + e.trim()); + const s = new Date(n); + if (s === void 0 || isNaN(s.getTime()) || // WebKit browsers can mis-parse invalid dates to be ridiculously + // huge numbers, e.g. new Date('202304') gets parsed as January 1, 202304. + // This can cause virtually infinite loops while rendering, so for the + // purposes of Gantt charts we'll just treat any date beyond 10,000 AD/BC as + // invalid. + s.getFullYear() < -1e4 || s.getFullYear() > 1e4) + throw new Error("Invalid date:" + n); + return s; + } +}, "getStartDate"), Mn = /* @__PURE__ */ h(function(t) { + const e = /^(\d+(?:\.\d+)?)([Mdhmswy]|ms)$/.exec(t.trim()); + return e !== null ? [Number.parseFloat(e[1]), e[2]] : [NaN, "ms"]; +}, "parseDuration"), _n = /* @__PURE__ */ h(function(t, e, n, r = !1) { + n = n.trim(); + const i = /^until\s+(?[\d\w- ]+)/.exec(n); + if (i !== null) { + let g = null; + for (const D of i.groups.ids.split(" ")) { + let b = Ct(D); + b !== void 0 && (!g || b.startTime < g.startTime) && (g = b); + } + if (g) + return g.startTime; + const U = /* @__PURE__ */ new Date(); + return U.setHours(0, 0, 0, 0), U; + } + let s = at(n, e.trim(), !0); + if (s.isValid()) + return r && (s = s.add(1, "d")), s.toDate(); + let k = at(t); + const [M, T] = Mn(n); + if (!Number.isNaN(M)) { + const g = k.add(M, T); + g.isValid() && (k = g); + } + return k.toDate(); +}, "getEndDate"), Gt = 0, Ft = /* @__PURE__ */ h(function(t) { + return t === void 0 ? (Gt = Gt + 1, "task" + Gt) : t; +}, "parseId"), ci = /* @__PURE__ */ h(function(t, e) { + let n; + e.substr(0, 1) === ":" ? n = e.substr(1, e.length) : n = e; + const r = n.split(","), a = {}; + Le(r, a, wn); + for (let s = 0; s < r.length; s++) + r[s] = r[s].trim(); + let i = ""; + switch (r.length) { + case 1: + a.id = Ft(), a.startTime = t.endTime, i = r[0]; + break; + case 2: + a.id = Ft(), a.startTime = pe(void 0, ut, r[0]), i = r[1]; + break; + case 3: + a.id = Ft(r[0]), a.startTime = pe(void 0, ut, r[1]), i = r[2]; + break; + } + return i && (a.endTime = _n(a.startTime, ut, i, Rt), a.manualEndTime = at(i, "YYYY-MM-DD", !0).isValid(), Cn(a, ut, Pt, zt)), a; +}, "compileData"), li = /* @__PURE__ */ h(function(t, e) { + let n; + e.substr(0, 1) === ":" ? n = e.substr(1, e.length) : n = e; + const r = n.split(","), a = {}; + Le(r, a, wn); + for (let i = 0; i < r.length; i++) + r[i] = r[i].trim(); + switch (r.length) { + case 1: + a.id = Ft(), a.startTime = { + type: "prevTaskEnd", + id: t + }, a.endTime = { + data: r[0] + }; + break; + case 2: + a.id = Ft(), a.startTime = { + type: "getStartDate", + startData: r[0] + }, a.endTime = { + data: r[1] + }; + break; + case 3: + a.id = Ft(r[0]), a.startTime = { + type: "getStartDate", + startData: r[1] + }, a.endTime = { + data: r[2] + }; + break; + } + return a; +}, "parseData"), ve, jt, tt = [], Sn = {}, ui = /* @__PURE__ */ h(function(t, e) { + const n = { + section: Et, + type: Et, + processed: !1, + manualEndTime: !1, + renderEndTime: null, + raw: { data: e }, + task: t, + classes: [] + }, r = li(jt, e); + n.raw.startTime = r.startTime, n.raw.endTime = r.endTime, n.id = r.id, n.prevTaskId = jt, n.active = r.active, n.done = r.done, n.crit = r.crit, n.milestone = r.milestone, n.order = ke, ke++; + const a = tt.push(n); + jt = n.id, Sn[n.id] = a - 1; +}, "addTask"), Ct = /* @__PURE__ */ h(function(t) { + const e = Sn[t]; + return tt[e]; +}, "findTaskById"), fi = /* @__PURE__ */ h(function(t, e) { + const n = { + section: Et, + type: Et, + description: t, + task: t, + classes: [] + }, r = ci(ve, e); + n.startTime = r.startTime, n.endTime = r.endTime, n.id = r.id, n.active = r.active, n.done = r.done, n.crit = r.crit, n.milestone = r.milestone, ve = n, te.push(n); +}, "addTaskOrg"), je = /* @__PURE__ */ h(function() { + const t = /* @__PURE__ */ h(function(n) { + const r = tt[n]; + let a = ""; + switch (tt[n].raw.startTime.type) { + case "prevTaskEnd": { + const i = Ct(r.prevTaskId); + r.startTime = i.endTime; + break; + } + case "getStartDate": + a = pe(void 0, ut, tt[n].raw.startTime.startData), a && (tt[n].startTime = a); + break; + } + return tt[n].startTime && (tt[n].endTime = _n( + tt[n].startTime, + ut, + tt[n].raw.endTime.data, + Rt + ), tt[n].endTime && (tt[n].processed = !0, tt[n].manualEndTime = at( + tt[n].raw.endTime.data, + "YYYY-MM-DD", + !0 + ).isValid(), Cn(tt[n], ut, Pt, zt))), tt[n].processed; + }, "compileTask"); + let e = !0; + for (const [n, r] of tt.entries()) + t(n), e = e && r.processed; + return e; +}, "compileTasks"), hi = /* @__PURE__ */ h(function(t, e) { + let n = e; + _t().securityLevel !== "loose" && (n = Vn(e)), t.split(",").forEach(function(r) { + Ct(r) !== void 0 && (Yn(r, () => { + window.open(n, "_self"); + }), _e.set(r, n)); + }), Fn(t, "clickable"); +}, "setLink"), Fn = /* @__PURE__ */ h(function(t, e) { + t.split(",").forEach(function(n) { + let r = Ct(n); + r !== void 0 && r.classes.push(e); + }); +}, "setClass"), di = /* @__PURE__ */ h(function(t, e, n) { + if (_t().securityLevel !== "loose" || e === void 0) + return; + let r = []; + if (typeof n == "string") { + r = n.split(/,(?=(?:(?:[^"]*"){2})*[^"]*$)/); + for (let i = 0; i < r.length; i++) { + let s = r[i].trim(); + s.startsWith('"') && s.endsWith('"') && (s = s.substr(1, s.length - 2)), r[i] = s; + } + } + r.length === 0 && r.push(t), Ct(t) !== void 0 && Yn(t, () => { + Rn.runFunc(e, ...r); + }); +}, "setClickFun"), Yn = /* @__PURE__ */ h(function(t, e) { + Ye.push( + function() { + const n = document.querySelector(`[id="${t}"]`); + n !== null && n.addEventListener("click", function() { + e(); + }); + }, + function() { + const n = document.querySelector(`[id="${t}-text"]`); + n !== null && n.addEventListener("click", function() { + e(); + }); + } + ); +}, "pushFun"), mi = /* @__PURE__ */ h(function(t, e, n) { + t.split(",").forEach(function(r) { + di(r, e, n); + }), Fn(t, "clickable"); +}, "setClickEvent"), gi = /* @__PURE__ */ h(function(t) { + Ye.forEach(function(e) { + e(t); + }); +}, "bindFunctions"), yi = { + getConfig: /* @__PURE__ */ h(() => _t().gantt, "getConfig"), + clear: Ia, + setDateFormat: Pa, + getDateFormat: ja, + enableInclusiveEndDates: Ra, + endDatesAreInclusive: Ba, + enableTopAxis: Za, + topAxisEnabled: Xa, + setAxisFormat: Wa, + getAxisFormat: Oa, + setTickInterval: Ha, + getTickInterval: Na, + setTodayMarker: Va, + getTodayMarker: za, + setAccTitle: Ln, + getAccTitle: An, + setDiagramTitle: In, + getDiagramTitle: Wn, + setDisplayMode: qa, + getDisplayMode: Ga, + setAccDescription: On, + getAccDescription: Hn, + addSection: ei, + getSections: ni, + getTasks: ri, + addTask: ui, + findTaskById: Ct, + addTaskOrg: fi, + setIncludes: Qa, + getIncludes: $a, + setExcludes: Ja, + getExcludes: Ka, + setClickEvent: mi, + setLink: hi, + getLinks: ti, + bindFunctions: gi, + parseDuration: Mn, + isInvalidDate: Dn, + setWeekday: ai, + getWeekday: ii, + setWeekend: si +}; +function Le(t, e, n) { + let r = !0; + for (; r; ) + r = !1, n.forEach(function(a) { + const i = "^\\s*" + a + "\\s*$", s = new RegExp(i); + t[0].match(s) && (e[a] = !0, t.shift(1), r = !0); + }); +} +h(Le, "getTaskTags"); +var ki = /* @__PURE__ */ h(function() { + Qt.debug("Something is calling, setConf, remove the call"); +}, "setConf"), Qe = { + monday: Ht, + tuesday: un, + wednesday: fn, + thursday: bt, + friday: hn, + saturday: dn, + sunday: Vt +}, pi = /* @__PURE__ */ h((t, e) => { + let n = [...t].map(() => -1 / 0), r = [...t].sort((i, s) => i.startTime - s.startTime || i.order - s.order), a = 0; + for (const i of r) + for (let s = 0; s < n.length; s++) + if (i.startTime >= n[s]) { + n[s] = i.endTime, i.order = s + e, s > a && (a = s); + break; + } + return a; +}, "getMaxIntersections"), ht, vi = /* @__PURE__ */ h(function(t, e, n, r) { + const a = _t().gantt, i = _t().securityLevel; + let s; + i === "sandbox" && (s = Zt("#i" + e)); + const k = i === "sandbox" ? Zt(s.nodes()[0].contentDocument.body) : Zt("body"), M = i === "sandbox" ? s.nodes()[0].contentDocument : document, T = M.getElementById(e); + ht = T.parentElement.offsetWidth, ht === void 0 && (ht = 1200), a.useWidth !== void 0 && (ht = a.useWidth); + const g = r.db.getTasks(); + let U = []; + for (const x of g) + U.push(x.type); + U = H(U); + const D = {}; + let b = 2 * a.topPadding; + if (r.db.getDisplayMode() === "compact" || a.displayMode === "compact") { + const x = {}; + for (const _ of g) + x[_.section] === void 0 ? x[_.section] = [_] : x[_.section].push(_); + let F = 0; + for (const _ of Object.keys(x)) { + const S = pi(x[_], F) + 1; + F += S, b += S * (a.barHeight + a.barGap), D[_] = S; + } + } else { + b += g.length * (a.barHeight + a.barGap); + for (const x of U) + D[x] = g.filter((F) => F.type === x).length; + } + T.setAttribute("viewBox", "0 0 " + ht + " " + b); + const q = k.select(`[id="${e}"]`), O = _a().domain([ + Qn(g, function(x) { + return x.startTime; + }), + jn(g, function(x) { + return x.endTime; + }) + ]).rangeRound([0, ht - a.leftPadding - a.rightPadding]); + function C(x, F) { + const _ = x.startTime, S = F.startTime; + let p = 0; + return _ > S ? p = 1 : _ < S && (p = -1), p; + } + h(C, "taskCompare"), g.sort(C), I(g, ht, b), zn(q, b, ht, a.useMaxWidth), q.append("text").text(r.db.getDiagramTitle()).attr("x", ht / 2).attr("y", a.titleTopMargin).attr("class", "titleText"); + function I(x, F, _) { + const S = a.barHeight, p = S + a.barGap, Y = a.topPadding, l = a.leftPadding, f = qn().domain([0, U.length]).range(["#00B9FA", "#F95002"]).interpolate(fr); + W( + p, + Y, + l, + F, + _, + x, + r.db.getExcludes(), + r.db.getIncludes() + ), Z(l, Y, F, _), V(x, p, Y, l, S, f, F), Q(p, Y), w(l, Y, F, _); + } + h(I, "makeGantt"); + function V(x, F, _, S, p, Y, l) { + const y = [...new Set(x.map((d) => d.order))].map((d) => x.find((o) => o.order === d)); + q.append("g").selectAll("rect").data(y).enter().append("rect").attr("x", 0).attr("y", function(d, o) { + return o = d.order, o * F + _ - 2; + }).attr("width", function() { + return l - a.rightPadding / 2; + }).attr("height", F).attr("class", function(d) { + for (const [o, P] of U.entries()) + if (d.type === P) + return "section section" + o % a.numberSectionStyles; + return "section section0"; + }); + const m = q.append("g").selectAll("rect").data(x).enter(), E = r.db.getLinks(); + if (m.append("rect").attr("id", function(d) { + return d.id; + }).attr("rx", 3).attr("ry", 3).attr("x", function(d) { + return d.milestone ? O(d.startTime) + S + 0.5 * (O(d.endTime) - O(d.startTime)) - 0.5 * p : O(d.startTime) + S; + }).attr("y", function(d, o) { + return o = d.order, o * F + _; + }).attr("width", function(d) { + return d.milestone ? p : O(d.renderEndTime || d.endTime) - O(d.startTime); + }).attr("height", p).attr("transform-origin", function(d, o) { + return o = d.order, (O(d.startTime) + S + 0.5 * (O(d.endTime) - O(d.startTime))).toString() + "px " + (o * F + _ + 0.5 * p).toString() + "px"; + }).attr("class", function(d) { + const o = "task"; + let P = ""; + d.classes.length > 0 && (P = d.classes.join(" ")); + let z = 0; + for (const [K, G] of U.entries()) + d.type === G && (z = K % a.numberSectionStyles); + let R = ""; + return d.active ? d.crit ? R += " activeCrit" : R = " active" : d.done ? d.crit ? R = " doneCrit" : R = " done" : d.crit && (R += " crit"), R.length === 0 && (R = " task"), d.milestone && (R = " milestone " + R), R += z, R += " " + P, o + R; + }), m.append("text").attr("id", function(d) { + return d.id + "-text"; + }).text(function(d) { + return d.task; + }).attr("font-size", a.fontSize).attr("x", function(d) { + let o = O(d.startTime), P = O(d.renderEndTime || d.endTime); + d.milestone && (o += 0.5 * (O(d.endTime) - O(d.startTime)) - 0.5 * p), d.milestone && (P = o + p); + const z = this.getBBox().width; + return z > P - o ? P + z + 1.5 * a.leftPadding > l ? o + S - 5 : P + S + 5 : (P - o) / 2 + o + S; + }).attr("y", function(d, o) { + return o = d.order, o * F + a.barHeight / 2 + (a.fontSize / 2 - 2) + _; + }).attr("text-height", p).attr("class", function(d) { + const o = O(d.startTime); + let P = O(d.endTime); + d.milestone && (P = o + p); + const z = this.getBBox().width; + let R = ""; + d.classes.length > 0 && (R = d.classes.join(" ")); + let K = 0; + for (const [$, it] of U.entries()) + d.type === it && (K = $ % a.numberSectionStyles); + let G = ""; + return d.active && (d.crit ? G = "activeCritText" + K : G = "activeText" + K), d.done ? d.crit ? G = G + " doneCritText" + K : G = G + " doneText" + K : d.crit && (G = G + " critText" + K), d.milestone && (G += " milestoneText"), z > P - o ? P + z + 1.5 * a.leftPadding > l ? R + " taskTextOutsideLeft taskTextOutside" + K + " " + G : R + " taskTextOutsideRight taskTextOutside" + K + " " + G + " width-" + z : R + " taskText taskText" + K + " " + G + " width-" + z; + }), _t().securityLevel === "sandbox") { + let d; + d = Zt("#i" + e); + const o = d.nodes()[0].contentDocument; + m.filter(function(P) { + return E.has(P.id); + }).each(function(P) { + var z = o.querySelector("#" + P.id), R = o.querySelector("#" + P.id + "-text"); + const K = z.parentNode; + var G = o.createElement("a"); + G.setAttribute("xlink:href", E.get(P.id)), G.setAttribute("target", "_top"), K.appendChild(G), G.appendChild(z), G.appendChild(R); + }); + } + } + h(V, "drawRects"); + function W(x, F, _, S, p, Y, l, f) { + if (l.length === 0 && f.length === 0) + return; + let y, m; + for (const { startTime: z, endTime: R } of Y) + (y === void 0 || z < y) && (y = z), (m === void 0 || R > m) && (m = R); + if (!y || !m) + return; + if (at(m).diff(at(y), "year") > 5) { + Qt.warn( + "The difference between the min and max time is more than 5 years. This will cause performance issues. Skipping drawing exclude days." + ); + return; + } + const E = r.db.getDateFormat(), c = []; + let d = null, o = at(y); + for (; o.valueOf() <= m; ) + r.db.isInvalidDate(o, E, l, f) ? d ? d.end = o : d = { + start: o, + end: o + } : d && (c.push(d), d = null), o = o.add(1, "d"); + q.append("g").selectAll("rect").data(c).enter().append("rect").attr("id", function(z) { + return "exclude-" + z.start.format("YYYY-MM-DD"); + }).attr("x", function(z) { + return O(z.start) + _; + }).attr("y", a.gridLineStartPadding).attr("width", function(z) { + const R = z.end.add(1, "day"); + return O(R) - O(z.start); + }).attr("height", p - F - a.gridLineStartPadding).attr("transform-origin", function(z, R) { + return (O(z.start) + _ + 0.5 * (O(z.end) - O(z.start))).toString() + "px " + (R * x + 0.5 * p).toString() + "px"; + }).attr("class", "exclude-range"); + } + h(W, "drawExcludeDays"); + function Z(x, F, _, S) { + let p = ar(O).tickSize(-S + F + a.gridLineStartPadding).tickFormat(Kt(r.db.getAxisFormat() || a.axisFormat || "%Y-%m-%d")); + const l = /^([1-9]\d*)(millisecond|second|minute|hour|day|week|month)$/.exec( + r.db.getTickInterval() || a.tickInterval + ); + if (l !== null) { + const f = l[1], y = l[2], m = r.db.getWeekday() || a.weekday; + switch (y) { + case "millisecond": + p.ticks(Yt.every(f)); + break; + case "second": + p.ticks(vt.every(f)); + break; + case "minute": + p.ticks(Wt.every(f)); + break; + case "hour": + p.ticks(Ot.every(f)); + break; + case "day": + p.ticks(Tt.every(f)); + break; + case "week": + p.ticks(Qe[m].every(f)); + break; + case "month": + p.ticks(Nt.every(f)); + break; + } + } + if (q.append("g").attr("class", "grid").attr("transform", "translate(" + x + ", " + (S - 50) + ")").call(p).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10).attr("dy", "1em"), r.db.topAxisEnabled() || a.topAxis) { + let f = rr(O).tickSize(-S + F + a.gridLineStartPadding).tickFormat(Kt(r.db.getAxisFormat() || a.axisFormat || "%Y-%m-%d")); + if (l !== null) { + const y = l[1], m = l[2], E = r.db.getWeekday() || a.weekday; + switch (m) { + case "millisecond": + f.ticks(Yt.every(y)); + break; + case "second": + f.ticks(vt.every(y)); + break; + case "minute": + f.ticks(Wt.every(y)); + break; + case "hour": + f.ticks(Ot.every(y)); + break; + case "day": + f.ticks(Tt.every(y)); + break; + case "week": + f.ticks(Qe[E].every(y)); + break; + case "month": + f.ticks(Nt.every(y)); + break; + } + } + q.append("g").attr("class", "grid").attr("transform", "translate(" + x + ", " + F + ")").call(f).selectAll("text").style("text-anchor", "middle").attr("fill", "#000").attr("stroke", "none").attr("font-size", 10); + } + } + h(Z, "makeGrid"); + function Q(x, F) { + let _ = 0; + const S = Object.keys(D).map((p) => [p, D[p]]); + q.append("g").selectAll("text").data(S).enter().append(function(p) { + const Y = p[0].split(Pn.lineBreakRegex), l = -(Y.length - 1) / 2, f = M.createElementNS("http://www.w3.org/2000/svg", "text"); + f.setAttribute("dy", l + "em"); + for (const [y, m] of Y.entries()) { + const E = M.createElementNS("http://www.w3.org/2000/svg", "tspan"); + E.setAttribute("alignment-baseline", "central"), E.setAttribute("x", "10"), y > 0 && E.setAttribute("dy", "1em"), E.textContent = m, f.appendChild(E); + } + return f; + }).attr("x", 10).attr("y", function(p, Y) { + if (Y > 0) + for (let l = 0; l < Y; l++) + return _ += S[Y - 1][1], p[1] * x / 2 + _ * x + F; + else + return p[1] * x / 2 + F; + }).attr("font-size", a.sectionFontSize).attr("class", function(p) { + for (const [Y, l] of U.entries()) + if (p[0] === l) + return "sectionTitle sectionTitle" + Y % a.numberSectionStyles; + return "sectionTitle"; + }); + } + h(Q, "vertLabels"); + function w(x, F, _, S) { + const p = r.db.getTodayMarker(); + if (p === "off") + return; + const Y = q.append("g").attr("class", "today"), l = /* @__PURE__ */ new Date(), f = Y.append("line"); + f.attr("x1", O(l) + x).attr("x2", O(l) + x).attr("y1", a.titleTopMargin).attr("y2", S - a.titleTopMargin).attr("class", "today"), p !== "" && f.attr("style", p.replace(/,/g, ";")); + } + h(w, "drawToday"); + function H(x) { + const F = {}, _ = []; + for (let S = 0, p = x.length; S < p; ++S) + Object.prototype.hasOwnProperty.call(F, x[S]) || (F[x[S]] = !0, _.push(x[S])); + return _; + } + h(H, "checkUnique"); +}, "draw"), Ti = { + setConf: ki, + draw: vi +}, bi = /* @__PURE__ */ h((t) => ` + .mermaid-main-font { + font-family: ${t.fontFamily}; + } + + .exclude-range { + fill: ${t.excludeBkgColor}; + } + + .section { + stroke: none; + opacity: 0.2; + } + + .section0 { + fill: ${t.sectionBkgColor}; + } + + .section2 { + fill: ${t.sectionBkgColor2}; + } + + .section1, + .section3 { + fill: ${t.altSectionBkgColor}; + opacity: 0.2; + } + + .sectionTitle0 { + fill: ${t.titleColor}; + } + + .sectionTitle1 { + fill: ${t.titleColor}; + } + + .sectionTitle2 { + fill: ${t.titleColor}; + } + + .sectionTitle3 { + fill: ${t.titleColor}; + } + + .sectionTitle { + text-anchor: start; + font-family: ${t.fontFamily}; + } + + + /* Grid and axis */ + + .grid .tick { + stroke: ${t.gridColor}; + opacity: 0.8; + shape-rendering: crispEdges; + } + + .grid .tick text { + font-family: ${t.fontFamily}; + fill: ${t.textColor}; + } + + .grid path { + stroke-width: 0; + } + + + /* Today line */ + + .today { + fill: none; + stroke: ${t.todayLineColor}; + stroke-width: 2px; + } + + + /* Task styling */ + + /* Default task */ + + .task { + stroke-width: 2; + } + + .taskText { + text-anchor: middle; + font-family: ${t.fontFamily}; + } + + .taskTextOutsideRight { + fill: ${t.taskTextDarkColor}; + text-anchor: start; + font-family: ${t.fontFamily}; + } + + .taskTextOutsideLeft { + fill: ${t.taskTextDarkColor}; + text-anchor: end; + } + + + /* Special case clickable */ + + .task.clickable { + cursor: pointer; + } + + .taskText.clickable { + cursor: pointer; + fill: ${t.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideLeft.clickable { + cursor: pointer; + fill: ${t.taskTextClickableColor} !important; + font-weight: bold; + } + + .taskTextOutsideRight.clickable { + cursor: pointer; + fill: ${t.taskTextClickableColor} !important; + font-weight: bold; + } + + + /* Specific task settings for the sections*/ + + .taskText0, + .taskText1, + .taskText2, + .taskText3 { + fill: ${t.taskTextColor}; + } + + .task0, + .task1, + .task2, + .task3 { + fill: ${t.taskBkgColor}; + stroke: ${t.taskBorderColor}; + } + + .taskTextOutside0, + .taskTextOutside2 + { + fill: ${t.taskTextOutsideColor}; + } + + .taskTextOutside1, + .taskTextOutside3 { + fill: ${t.taskTextOutsideColor}; + } + + + /* Active task */ + + .active0, + .active1, + .active2, + .active3 { + fill: ${t.activeTaskBkgColor}; + stroke: ${t.activeTaskBorderColor}; + } + + .activeText0, + .activeText1, + .activeText2, + .activeText3 { + fill: ${t.taskTextDarkColor} !important; + } + + + /* Completed task */ + + .done0, + .done1, + .done2, + .done3 { + stroke: ${t.doneTaskBorderColor}; + fill: ${t.doneTaskBkgColor}; + stroke-width: 2; + } + + .doneText0, + .doneText1, + .doneText2, + .doneText3 { + fill: ${t.taskTextDarkColor} !important; + } + + + /* Tasks on the critical line */ + + .crit0, + .crit1, + .crit2, + .crit3 { + stroke: ${t.critBorderColor}; + fill: ${t.critBkgColor}; + stroke-width: 2; + } + + .activeCrit0, + .activeCrit1, + .activeCrit2, + .activeCrit3 { + stroke: ${t.critBorderColor}; + fill: ${t.activeTaskBkgColor}; + stroke-width: 2; + } + + .doneCrit0, + .doneCrit1, + .doneCrit2, + .doneCrit3 { + stroke: ${t.critBorderColor}; + fill: ${t.doneTaskBkgColor}; + stroke-width: 2; + cursor: pointer; + shape-rendering: crispEdges; + } + + .milestone { + transform: rotate(45deg) scale(0.8,0.8); + } + + .milestoneText { + font-style: italic; + } + .doneCritText0, + .doneCritText1, + .doneCritText2, + .doneCritText3 { + fill: ${t.taskTextDarkColor} !important; + } + + .activeCritText0, + .activeCritText1, + .activeCritText2, + .activeCritText3 { + fill: ${t.taskTextDarkColor} !important; + } + + .titleText { + text-anchor: middle; + font-size: 18px; + fill: ${t.titleColor || t.textColor}; + font-family: ${t.fontFamily}; + } +`, "getStyles"), xi = bi, _i = { + parser: Aa, + db: yi, + renderer: Ti, + styles: xi +}; +export { + _i as diagram +}; diff --git a/backend/fastrtc/templates/component/gitGraphDiagram-7IBYFJ6S-BXKIFSAy.js b/backend/fastrtc/templates/component/gitGraphDiagram-7IBYFJ6S-BXKIFSAy.js new file mode 100644 index 0000000..37e41fa --- /dev/null +++ b/backend/fastrtc/templates/component/gitGraphDiagram-7IBYFJ6S-BXKIFSAy.js @@ -0,0 +1,712 @@ +import { p as Z } from "./chunk-4BMEZGHF-skpIwyQ5.js"; +import { I as F } from "./chunk-XZIHB7SX-BL75jMe6.js"; +import { C as U, _ as h, d as rr, D as er, E as tr, F as ar, l as w, s as nr, g as sr, b as or, c as cr, n as ir, o as dr, e as B, t as hr, j as lr, u as $r, G as fr } from "./mermaid.core-Cmyps_S7.js"; +import { p as gr } from "./radar-MK3ICKWK-Bw4p6KaX.js"; +var x = { + NORMAL: 0, + REVERSE: 1, + HIGHLIGHT: 2, + MERGE: 3, + CHERRY_PICK: 4 +}, yr = U.gitGraph, z = /* @__PURE__ */ h(() => er({ + ...yr, + ...tr().gitGraph +}), "getConfig"), i = new F(() => { + const t = z(), r = t.mainBranchName, a = t.mainBranchOrder; + return { + mainBranchName: r, + commits: /* @__PURE__ */ new Map(), + head: null, + branchConfig: /* @__PURE__ */ new Map([[r, { name: r, order: a }]]), + branches: /* @__PURE__ */ new Map([[r, null]]), + currBranch: r, + direction: "LR", + seq: 0, + options: {} + }; +}); +function j() { + return ar({ length: 7 }); +} +h(j, "getID"); +function N(t, r) { + const a = /* @__PURE__ */ Object.create(null); + return t.reduce((s, e) => { + const n = r(e); + return a[n] || (a[n] = !0, s.push(e)), s; + }, []); +} +h(N, "uniqBy"); +var ur = /* @__PURE__ */ h(function(t) { + i.records.direction = t; +}, "setDirection"), xr = /* @__PURE__ */ h(function(t) { + w.debug("options str", t), t = t == null ? void 0 : t.trim(), t = t || "{}"; + try { + i.records.options = JSON.parse(t); + } catch (r) { + w.error("error while parsing gitGraph options", r.message); + } +}, "setOptions"), pr = /* @__PURE__ */ h(function() { + return i.records.options; +}, "getOptions"), br = /* @__PURE__ */ h(function(t) { + let r = t.msg, a = t.id; + const s = t.type; + let e = t.tags; + w.info("commit", r, a, s, e), w.debug("Entering commit:", r, a, s, e); + const n = z(); + a = B.sanitizeText(a, n), r = B.sanitizeText(r, n), e = e == null ? void 0 : e.map((o) => B.sanitizeText(o, n)); + const c = { + id: a || i.records.seq + "-" + j(), + message: r, + seq: i.records.seq++, + type: s ?? x.NORMAL, + tags: e ?? [], + parents: i.records.head == null ? [] : [i.records.head.id], + branch: i.records.currBranch + }; + i.records.head = c, w.info("main branch", n.mainBranchName), i.records.commits.set(c.id, c), i.records.branches.set(i.records.currBranch, c.id), w.debug("in pushCommit " + c.id); +}, "commit"), mr = /* @__PURE__ */ h(function(t) { + let r = t.name; + const a = t.order; + if (r = B.sanitizeText(r, z()), i.records.branches.has(r)) + throw new Error( + `Trying to create an existing branch. (Help: Either use a new name if you want create a new branch or try using "checkout ${r}")` + ); + i.records.branches.set(r, i.records.head != null ? i.records.head.id : null), i.records.branchConfig.set(r, { name: r, order: a }), _(r), w.debug("in createBranch"); +}, "branch"), wr = /* @__PURE__ */ h((t) => { + let r = t.branch, a = t.id; + const s = t.type, e = t.tags, n = z(); + r = B.sanitizeText(r, n), a && (a = B.sanitizeText(a, n)); + const c = i.records.branches.get(i.records.currBranch), o = i.records.branches.get(r), $ = c ? i.records.commits.get(c) : void 0, l = o ? i.records.commits.get(o) : void 0; + if ($ && l && $.branch === r) + throw new Error(`Cannot merge branch '${r}' into itself.`); + if (i.records.currBranch === r) { + const d = new Error('Incorrect usage of "merge". Cannot merge a branch to itself'); + throw d.hash = { + text: `merge ${r}`, + token: `merge ${r}`, + expected: ["branch abc"] + }, d; + } + if ($ === void 0 || !$) { + const d = new Error( + `Incorrect usage of "merge". Current branch (${i.records.currBranch})has no commits` + ); + throw d.hash = { + text: `merge ${r}`, + token: `merge ${r}`, + expected: ["commit"] + }, d; + } + if (!i.records.branches.has(r)) { + const d = new Error( + 'Incorrect usage of "merge". Branch to be merged (' + r + ") does not exist" + ); + throw d.hash = { + text: `merge ${r}`, + token: `merge ${r}`, + expected: [`branch ${r}`] + }, d; + } + if (l === void 0 || !l) { + const d = new Error( + 'Incorrect usage of "merge". Branch to be merged (' + r + ") has no commits" + ); + throw d.hash = { + text: `merge ${r}`, + token: `merge ${r}`, + expected: ['"commit"'] + }, d; + } + if ($ === l) { + const d = new Error('Incorrect usage of "merge". Both branches have same head'); + throw d.hash = { + text: `merge ${r}`, + token: `merge ${r}`, + expected: ["branch abc"] + }, d; + } + if (a && i.records.commits.has(a)) { + const d = new Error( + 'Incorrect usage of "merge". Commit with id:' + a + " already exists, use different custom Id" + ); + throw d.hash = { + text: `merge ${r} ${a} ${s} ${e == null ? void 0 : e.join(" ")}`, + token: `merge ${r} ${a} ${s} ${e == null ? void 0 : e.join(" ")}`, + expected: [ + `merge ${r} ${a}_UNIQUE ${s} ${e == null ? void 0 : e.join(" ")}` + ] + }, d; + } + const f = o || "", g = { + id: a || `${i.records.seq}-${j()}`, + message: `merged branch ${r} into ${i.records.currBranch}`, + seq: i.records.seq++, + parents: i.records.head == null ? [] : [i.records.head.id, f], + branch: i.records.currBranch, + type: x.MERGE, + customType: s, + customId: !!a, + tags: e ?? [] + }; + i.records.head = g, i.records.commits.set(g.id, g), i.records.branches.set(i.records.currBranch, g.id), w.debug(i.records.branches), w.debug("in mergeBranch"); +}, "merge"), vr = /* @__PURE__ */ h(function(t) { + let r = t.id, a = t.targetId, s = t.tags, e = t.parent; + w.debug("Entering cherryPick:", r, a, s); + const n = z(); + if (r = B.sanitizeText(r, n), a = B.sanitizeText(a, n), s = s == null ? void 0 : s.map(($) => B.sanitizeText($, n)), e = B.sanitizeText(e, n), !r || !i.records.commits.has(r)) { + const $ = new Error( + 'Incorrect usage of "cherryPick". Source commit id should exist and provided' + ); + throw $.hash = { + text: `cherryPick ${r} ${a}`, + token: `cherryPick ${r} ${a}`, + expected: ["cherry-pick abc"] + }, $; + } + const c = i.records.commits.get(r); + if (c === void 0 || !c) + throw new Error('Incorrect usage of "cherryPick". Source commit id should exist and provided'); + if (e && !(Array.isArray(c.parents) && c.parents.includes(e))) + throw new Error( + "Invalid operation: The specified parent commit is not an immediate parent of the cherry-picked commit." + ); + const o = c.branch; + if (c.type === x.MERGE && !e) + throw new Error( + "Incorrect usage of cherry-pick: If the source commit is a merge commit, an immediate parent commit must be specified." + ); + if (!a || !i.records.commits.has(a)) { + if (o === i.records.currBranch) { + const g = new Error( + 'Incorrect usage of "cherryPick". Source commit is already on current branch' + ); + throw g.hash = { + text: `cherryPick ${r} ${a}`, + token: `cherryPick ${r} ${a}`, + expected: ["cherry-pick abc"] + }, g; + } + const $ = i.records.branches.get(i.records.currBranch); + if ($ === void 0 || !$) { + const g = new Error( + `Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits` + ); + throw g.hash = { + text: `cherryPick ${r} ${a}`, + token: `cherryPick ${r} ${a}`, + expected: ["cherry-pick abc"] + }, g; + } + const l = i.records.commits.get($); + if (l === void 0 || !l) { + const g = new Error( + `Incorrect usage of "cherry-pick". Current branch (${i.records.currBranch})has no commits` + ); + throw g.hash = { + text: `cherryPick ${r} ${a}`, + token: `cherryPick ${r} ${a}`, + expected: ["cherry-pick abc"] + }, g; + } + const f = { + id: i.records.seq + "-" + j(), + message: `cherry-picked ${c == null ? void 0 : c.message} into ${i.records.currBranch}`, + seq: i.records.seq++, + parents: i.records.head == null ? [] : [i.records.head.id, c.id], + branch: i.records.currBranch, + type: x.CHERRY_PICK, + tags: s ? s.filter(Boolean) : [ + `cherry-pick:${c.id}${c.type === x.MERGE ? `|parent:${e}` : ""}` + ] + }; + i.records.head = f, i.records.commits.set(f.id, f), i.records.branches.set(i.records.currBranch, f.id), w.debug(i.records.branches), w.debug("in cherryPick"); + } +}, "cherryPick"), _ = /* @__PURE__ */ h(function(t) { + if (t = B.sanitizeText(t, z()), i.records.branches.has(t)) { + i.records.currBranch = t; + const r = i.records.branches.get(i.records.currBranch); + r === void 0 || !r ? i.records.head = null : i.records.head = i.records.commits.get(r) ?? null; + } else { + const r = new Error( + `Trying to checkout branch which is not yet created. (Help try using "branch ${t}")` + ); + throw r.hash = { + text: `checkout ${t}`, + token: `checkout ${t}`, + expected: [`branch ${t}`] + }, r; + } +}, "checkout"); +function A(t, r, a) { + const s = t.indexOf(r); + s === -1 ? t.push(a) : t.splice(s, 1, a); +} +h(A, "upsert"); +function D(t) { + const r = t.reduce((e, n) => e.seq > n.seq ? e : n, t[0]); + let a = ""; + t.forEach(function(e) { + e === r ? a += " *" : a += " |"; + }); + const s = [a, r.id, r.seq]; + for (const e in i.records.branches) + i.records.branches.get(e) === r.id && s.push(e); + if (w.debug(s.join(" ")), r.parents && r.parents.length == 2 && r.parents[0] && r.parents[1]) { + const e = i.records.commits.get(r.parents[0]); + A(t, r, e), r.parents[1] && t.push(i.records.commits.get(r.parents[1])); + } else { + if (r.parents.length == 0) + return; + if (r.parents[0]) { + const e = i.records.commits.get(r.parents[0]); + A(t, r, e); + } + } + t = N(t, (e) => e.id), D(t); +} +h(D, "prettyPrintCommitHistory"); +var Cr = /* @__PURE__ */ h(function() { + w.debug(i.records.commits); + const t = V()[0]; + D([t]); +}, "prettyPrint"), Er = /* @__PURE__ */ h(function() { + i.reset(), hr(); +}, "clear"), Br = /* @__PURE__ */ h(function() { + return [...i.records.branchConfig.values()].map((r, a) => r.order !== null && r.order !== void 0 ? r : { + ...r, + order: parseFloat(`0.${a}`) + }).sort((r, a) => (r.order ?? 0) - (a.order ?? 0)).map(({ name: r }) => ({ name: r })); +}, "getBranchesAsObjArray"), kr = /* @__PURE__ */ h(function() { + return i.records.branches; +}, "getBranches"), Lr = /* @__PURE__ */ h(function() { + return i.records.commits; +}, "getCommits"), V = /* @__PURE__ */ h(function() { + const t = [...i.records.commits.values()]; + return t.forEach(function(r) { + w.debug(r.id); + }), t.sort((r, a) => r.seq - a.seq), t; +}, "getCommitsArray"), Tr = /* @__PURE__ */ h(function() { + return i.records.currBranch; +}, "getCurrentBranch"), Mr = /* @__PURE__ */ h(function() { + return i.records.direction; +}, "getDirection"), Rr = /* @__PURE__ */ h(function() { + return i.records.head; +}, "getHead"), X = { + commitType: x, + getConfig: z, + setDirection: ur, + setOptions: xr, + getOptions: pr, + commit: br, + branch: mr, + merge: wr, + cherryPick: vr, + checkout: _, + //reset, + prettyPrint: Cr, + clear: Er, + getBranchesAsObjArray: Br, + getBranches: kr, + getCommits: Lr, + getCommitsArray: V, + getCurrentBranch: Tr, + getDirection: Mr, + getHead: Rr, + setAccTitle: nr, + getAccTitle: sr, + getAccDescription: or, + setAccDescription: cr, + setDiagramTitle: ir, + getDiagramTitle: dr +}, Ir = /* @__PURE__ */ h((t, r) => { + Z(t, r), t.dir && r.setDirection(t.dir); + for (const a of t.statements) + qr(a, r); +}, "populate"), qr = /* @__PURE__ */ h((t, r) => { + const s = { + Commit: /* @__PURE__ */ h((e) => r.commit(Or(e)), "Commit"), + Branch: /* @__PURE__ */ h((e) => r.branch(zr(e)), "Branch"), + Merge: /* @__PURE__ */ h((e) => r.merge(Gr(e)), "Merge"), + Checkout: /* @__PURE__ */ h((e) => r.checkout(Hr(e)), "Checkout"), + CherryPicking: /* @__PURE__ */ h((e) => r.cherryPick(Pr(e)), "CherryPicking") + }[t.$type]; + s ? s(t) : w.error(`Unknown statement type: ${t.$type}`); +}, "parseStatement"), Or = /* @__PURE__ */ h((t) => ({ + id: t.id, + msg: t.message ?? "", + type: t.type !== void 0 ? x[t.type] : x.NORMAL, + tags: t.tags ?? void 0 +}), "parseCommit"), zr = /* @__PURE__ */ h((t) => ({ + name: t.name, + order: t.order ?? 0 +}), "parseBranch"), Gr = /* @__PURE__ */ h((t) => ({ + branch: t.branch, + id: t.id ?? "", + type: t.type !== void 0 ? x[t.type] : void 0, + tags: t.tags ?? void 0 +}), "parseMerge"), Hr = /* @__PURE__ */ h((t) => t.branch, "parseCheckout"), Pr = /* @__PURE__ */ h((t) => { + var a; + return { + id: t.id, + targetId: "", + tags: ((a = t.tags) == null ? void 0 : a.length) === 0 ? void 0 : t.tags, + parent: t.parent + }; +}, "parseCherryPicking"), Wr = { + parse: /* @__PURE__ */ h(async (t) => { + const r = await gr("gitGraph", t); + w.debug(r), Ir(r, X); + }, "parse") +}, S = rr(), b = S == null ? void 0 : S.gitGraph, R = 10, I = 40, k = 4, L = 2, O = 8, C = /* @__PURE__ */ new Map(), E = /* @__PURE__ */ new Map(), P = 30, G = /* @__PURE__ */ new Map(), W = [], M = 0, u = "LR", jr = /* @__PURE__ */ h(() => { + C.clear(), E.clear(), G.clear(), M = 0, W = [], u = "LR"; +}, "clear"), J = /* @__PURE__ */ h((t) => { + const r = document.createElementNS("http://www.w3.org/2000/svg", "text"); + return (typeof t == "string" ? t.split(/\\n|\n|/gi) : t).forEach((s) => { + const e = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); + e.setAttributeNS("http://www.w3.org/XML/1998/namespace", "xml:space", "preserve"), e.setAttribute("dy", "1em"), e.setAttribute("x", "0"), e.setAttribute("class", "row"), e.textContent = s.trim(), r.appendChild(e); + }), r; +}, "drawText"), Q = /* @__PURE__ */ h((t) => { + let r, a, s; + return u === "BT" ? (a = /* @__PURE__ */ h((e, n) => e <= n, "comparisonFunc"), s = 1 / 0) : (a = /* @__PURE__ */ h((e, n) => e >= n, "comparisonFunc"), s = 0), t.forEach((e) => { + var c, o; + const n = u === "TB" || u == "BT" ? (c = E.get(e)) == null ? void 0 : c.y : (o = E.get(e)) == null ? void 0 : o.x; + n !== void 0 && a(n, s) && (r = e, s = n); + }), r; +}, "findClosestParent"), Sr = /* @__PURE__ */ h((t) => { + let r = "", a = 1 / 0; + return t.forEach((s) => { + const e = E.get(s).y; + e <= a && (r = s, a = e); + }), r || void 0; +}, "findClosestParentBT"), Ar = /* @__PURE__ */ h((t, r, a) => { + let s = a, e = a; + const n = []; + t.forEach((c) => { + const o = r.get(c); + if (!o) + throw new Error(`Commit not found for key ${c}`); + o.parents.length ? (s = Yr(o), e = Math.max(s, e)) : n.push(o), Kr(o, s); + }), s = e, n.forEach((c) => { + Nr(c, s, a); + }), t.forEach((c) => { + const o = r.get(c); + if (o != null && o.parents.length) { + const $ = Sr(o.parents); + s = E.get($).y - I, s <= e && (e = s); + const l = C.get(o.branch).pos, f = s - R; + E.set(o.id, { x: l, y: f }); + } + }); +}, "setParallelBTPos"), Dr = /* @__PURE__ */ h((t) => { + var s; + const r = Q(t.parents.filter((e) => e !== null)); + if (!r) + throw new Error(`Closest parent not found for commit ${t.id}`); + const a = (s = E.get(r)) == null ? void 0 : s.y; + if (a === void 0) + throw new Error(`Closest parent position not found for commit ${t.id}`); + return a; +}, "findClosestParentPos"), Yr = /* @__PURE__ */ h((t) => Dr(t) + I, "calculateCommitPosition"), Kr = /* @__PURE__ */ h((t, r) => { + const a = C.get(t.branch); + if (!a) + throw new Error(`Branch not found for commit ${t.id}`); + const s = a.pos, e = r + R; + return E.set(t.id, { x: s, y: e }), { x: s, y: e }; +}, "setCommitPosition"), Nr = /* @__PURE__ */ h((t, r, a) => { + const s = C.get(t.branch); + if (!s) + throw new Error(`Branch not found for commit ${t.id}`); + const e = r + a, n = s.pos; + E.set(t.id, { x: n, y: e }); +}, "setRootPosition"), _r = /* @__PURE__ */ h((t, r, a, s, e, n) => { + if (n === x.HIGHLIGHT) + t.append("rect").attr("x", a.x - 10).attr("y", a.y - 10).attr("width", 20).attr("height", 20).attr( + "class", + `commit ${r.id} commit-highlight${e % O} ${s}-outer` + ), t.append("rect").attr("x", a.x - 6).attr("y", a.y - 6).attr("width", 12).attr("height", 12).attr( + "class", + `commit ${r.id} commit${e % O} ${s}-inner` + ); + else if (n === x.CHERRY_PICK) + t.append("circle").attr("cx", a.x).attr("cy", a.y).attr("r", 10).attr("class", `commit ${r.id} ${s}`), t.append("circle").attr("cx", a.x - 3).attr("cy", a.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${s}`), t.append("circle").attr("cx", a.x + 3).attr("cy", a.y + 2).attr("r", 2.75).attr("fill", "#fff").attr("class", `commit ${r.id} ${s}`), t.append("line").attr("x1", a.x + 3).attr("y1", a.y + 1).attr("x2", a.x).attr("y2", a.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${s}`), t.append("line").attr("x1", a.x - 3).attr("y1", a.y + 1).attr("x2", a.x).attr("y2", a.y - 5).attr("stroke", "#fff").attr("class", `commit ${r.id} ${s}`); + else { + const c = t.append("circle"); + if (c.attr("cx", a.x), c.attr("cy", a.y), c.attr("r", r.type === x.MERGE ? 9 : 10), c.attr("class", `commit ${r.id} commit${e % O}`), n === x.MERGE) { + const o = t.append("circle"); + o.attr("cx", a.x), o.attr("cy", a.y), o.attr("r", 6), o.attr( + "class", + `commit ${s} ${r.id} commit${e % O}` + ); + } + n === x.REVERSE && t.append("path").attr( + "d", + `M ${a.x - 5},${a.y - 5}L${a.x + 5},${a.y + 5}M${a.x - 5},${a.y + 5}L${a.x + 5},${a.y - 5}` + ).attr("class", `commit ${s} ${r.id} commit${e % O}`); + } +}, "drawCommitBullet"), Vr = /* @__PURE__ */ h((t, r, a, s) => { + var e; + if (r.type !== x.CHERRY_PICK && (r.customId && r.type === x.MERGE || r.type !== x.MERGE) && (b != null && b.showCommitLabel)) { + const n = t.append("g"), c = n.insert("rect").attr("class", "commit-label-bkg"), o = n.append("text").attr("x", s).attr("y", a.y + 25).attr("class", "commit-label").text(r.id), $ = (e = o.node()) == null ? void 0 : e.getBBox(); + if ($ && (c.attr("x", a.posWithOffset - $.width / 2 - L).attr("y", a.y + 13.5).attr("width", $.width + 2 * L).attr("height", $.height + 2 * L), u === "TB" || u === "BT" ? (c.attr("x", a.x - ($.width + 4 * k + 5)).attr("y", a.y - 12), o.attr("x", a.x - ($.width + 4 * k)).attr("y", a.y + $.height - 12)) : o.attr("x", a.posWithOffset - $.width / 2), b.rotateCommitLabel)) + if (u === "TB" || u === "BT") + o.attr( + "transform", + "rotate(-45, " + a.x + ", " + a.y + ")" + ), c.attr( + "transform", + "rotate(-45, " + a.x + ", " + a.y + ")" + ); + else { + const l = -7.5 - ($.width + 10) / 25 * 9.5, f = 10 + $.width / 25 * 8.5; + n.attr( + "transform", + "translate(" + l + ", " + f + ") rotate(-45, " + s + ", " + a.y + ")" + ); + } + } +}, "drawCommitLabel"), Xr = /* @__PURE__ */ h((t, r, a, s) => { + var e; + if (r.tags.length > 0) { + let n = 0, c = 0, o = 0; + const $ = []; + for (const l of r.tags.reverse()) { + const f = t.insert("polygon"), g = t.append("circle"), d = t.append("text").attr("y", a.y - 16 - n).attr("class", "tag-label").text(l), y = (e = d.node()) == null ? void 0 : e.getBBox(); + if (!y) + throw new Error("Tag bbox not found"); + c = Math.max(c, y.width), o = Math.max(o, y.height), d.attr("x", a.posWithOffset - y.width / 2), $.push({ + tag: d, + hole: g, + rect: f, + yOffset: n + }), n += 20; + } + for (const { tag: l, hole: f, rect: g, yOffset: d } of $) { + const y = o / 2, p = a.y - 19.2 - d; + if (g.attr("class", "tag-label-bkg").attr( + "points", + ` + ${s - c / 2 - k / 2},${p + L} + ${s - c / 2 - k / 2},${p - L} + ${a.posWithOffset - c / 2 - k},${p - y - L} + ${a.posWithOffset + c / 2 + k},${p - y - L} + ${a.posWithOffset + c / 2 + k},${p + y + L} + ${a.posWithOffset - c / 2 - k},${p + y + L}` + ), f.attr("cy", p).attr("cx", s - c / 2 + k / 2).attr("r", 1.5).attr("class", "tag-hole"), u === "TB" || u === "BT") { + const m = s + d; + g.attr("class", "tag-label-bkg").attr( + "points", + ` + ${a.x},${m + 2} + ${a.x},${m - 2} + ${a.x + R},${m - y - 2} + ${a.x + R + c + 4},${m - y - 2} + ${a.x + R + c + 4},${m + y + 2} + ${a.x + R},${m + y + 2}` + ).attr("transform", "translate(12,12) rotate(45, " + a.x + "," + s + ")"), f.attr("cx", a.x + k / 2).attr("cy", m).attr("transform", "translate(12,12) rotate(45, " + a.x + "," + s + ")"), l.attr("x", a.x + 5).attr("y", m + 3).attr("transform", "translate(14,14) rotate(45, " + a.x + "," + s + ")"); + } + } + } +}, "drawCommitTags"), Jr = /* @__PURE__ */ h((t) => { + switch (t.customType ?? t.type) { + case x.NORMAL: + return "commit-normal"; + case x.REVERSE: + return "commit-reverse"; + case x.HIGHLIGHT: + return "commit-highlight"; + case x.MERGE: + return "commit-merge"; + case x.CHERRY_PICK: + return "commit-cherry-pick"; + default: + return "commit-normal"; + } +}, "getCommitClassType"), Qr = /* @__PURE__ */ h((t, r, a, s) => { + const e = { x: 0, y: 0 }; + if (t.parents.length > 0) { + const n = Q(t.parents); + if (n) { + const c = s.get(n) ?? e; + return r === "TB" ? c.y + I : r === "BT" ? (s.get(t.id) ?? e).y - I : c.x + I; + } + } else + return r === "TB" ? P : r === "BT" ? (s.get(t.id) ?? e).y - I : 0; + return 0; +}, "calculatePosition"), Zr = /* @__PURE__ */ h((t, r, a) => { + var c, o; + const s = u === "BT" && a ? r : r + R, e = u === "TB" || u === "BT" ? s : (c = C.get(t.branch)) == null ? void 0 : c.pos, n = u === "TB" || u === "BT" ? (o = C.get(t.branch)) == null ? void 0 : o.pos : s; + if (n === void 0 || e === void 0) + throw new Error(`Position were undefined for commit ${t.id}`); + return { x: n, y: e, posWithOffset: s }; +}, "getCommitPosition"), K = /* @__PURE__ */ h((t, r, a) => { + if (!b) + throw new Error("GitGraph config not found"); + const s = t.append("g").attr("class", "commit-bullets"), e = t.append("g").attr("class", "commit-labels"); + let n = u === "TB" || u === "BT" ? P : 0; + const c = [...r.keys()], o = (b == null ? void 0 : b.parallelCommits) ?? !1, $ = /* @__PURE__ */ h((f, g) => { + var p, m; + const d = (p = r.get(f)) == null ? void 0 : p.seq, y = (m = r.get(g)) == null ? void 0 : m.seq; + return d !== void 0 && y !== void 0 ? d - y : 0; + }, "sortKeys"); + let l = c.sort($); + u === "BT" && (o && Ar(l, r, n), l = l.reverse()), l.forEach((f) => { + var y; + const g = r.get(f); + if (!g) + throw new Error(`Commit not found for key ${f}`); + o && (n = Qr(g, u, n, E)); + const d = Zr(g, n, o); + if (a) { + const p = Jr(g), m = g.customType ?? g.type, q = ((y = C.get(g.branch)) == null ? void 0 : y.index) ?? 0; + _r(s, g, d, p, q, m), Vr(e, g, d, n), Xr(e, g, d, n); + } + u === "TB" || u === "BT" ? E.set(g.id, { x: d.x, y: d.posWithOffset }) : E.set(g.id, { x: d.posWithOffset, y: d.y }), n = u === "BT" && o ? n + I : n + I + R, n > M && (M = n); + }); +}, "drawCommits"), Fr = /* @__PURE__ */ h((t, r, a, s, e) => { + const c = (u === "TB" || u === "BT" ? a.x < s.x : a.y < s.y) ? r.branch : t.branch, o = /* @__PURE__ */ h((l) => l.branch === c, "isOnBranchToGetCurve"), $ = /* @__PURE__ */ h((l) => l.seq > t.seq && l.seq < r.seq, "isBetweenCommits"); + return [...e.values()].some((l) => $(l) && o(l)); +}, "shouldRerouteArrow"), H = /* @__PURE__ */ h((t, r, a = 0) => { + const s = t + Math.abs(t - r) / 2; + if (a > 5) + return s; + if (W.every((c) => Math.abs(c - s) >= 10)) + return W.push(s), s; + const n = Math.abs(t - r); + return H(t, r - n / 5, a + 1); +}, "findLane"), Ur = /* @__PURE__ */ h((t, r, a, s) => { + var y, p, m, q, Y; + const e = E.get(r.id), n = E.get(a.id); + if (e === void 0 || n === void 0) + throw new Error(`Commit positions not found for commits ${r.id} and ${a.id}`); + const c = Fr(r, a, e, n, s); + let o = "", $ = "", l = 0, f = 0, g = (y = C.get(a.branch)) == null ? void 0 : y.index; + a.type === x.MERGE && r.id !== a.parents[0] && (g = (p = C.get(r.branch)) == null ? void 0 : p.index); + let d; + if (c) { + o = "A 10 10, 0, 0, 0,", $ = "A 10 10, 0, 0, 1,", l = 10, f = 10; + const T = e.y < n.y ? H(e.y, n.y) : H(n.y, e.y), v = e.x < n.x ? H(e.x, n.x) : H(n.x, e.x); + u === "TB" ? e.x < n.x ? d = `M ${e.x} ${e.y} L ${v - l} ${e.y} ${$} ${v} ${e.y + f} L ${v} ${n.y - l} ${o} ${v + f} ${n.y} L ${n.x} ${n.y}` : (g = (m = C.get(r.branch)) == null ? void 0 : m.index, d = `M ${e.x} ${e.y} L ${v + l} ${e.y} ${o} ${v} ${e.y + f} L ${v} ${n.y - l} ${$} ${v - f} ${n.y} L ${n.x} ${n.y}`) : u === "BT" ? e.x < n.x ? d = `M ${e.x} ${e.y} L ${v - l} ${e.y} ${o} ${v} ${e.y - f} L ${v} ${n.y + l} ${$} ${v + f} ${n.y} L ${n.x} ${n.y}` : (g = (q = C.get(r.branch)) == null ? void 0 : q.index, d = `M ${e.x} ${e.y} L ${v + l} ${e.y} ${$} ${v} ${e.y - f} L ${v} ${n.y + l} ${o} ${v - f} ${n.y} L ${n.x} ${n.y}`) : e.y < n.y ? d = `M ${e.x} ${e.y} L ${e.x} ${T - l} ${o} ${e.x + f} ${T} L ${n.x - l} ${T} ${$} ${n.x} ${T + f} L ${n.x} ${n.y}` : (g = (Y = C.get(r.branch)) == null ? void 0 : Y.index, d = `M ${e.x} ${e.y} L ${e.x} ${T + l} ${$} ${e.x + f} ${T} L ${n.x - l} ${T} ${o} ${n.x} ${T - f} L ${n.x} ${n.y}`); + } else + o = "A 20 20, 0, 0, 0,", $ = "A 20 20, 0, 0, 1,", l = 20, f = 20, u === "TB" ? (e.x < n.x && (a.type === x.MERGE && r.id !== a.parents[0] ? d = `M ${e.x} ${e.y} L ${e.x} ${n.y - l} ${o} ${e.x + f} ${n.y} L ${n.x} ${n.y}` : d = `M ${e.x} ${e.y} L ${n.x - l} ${e.y} ${$} ${n.x} ${e.y + f} L ${n.x} ${n.y}`), e.x > n.x && (o = "A 20 20, 0, 0, 0,", $ = "A 20 20, 0, 0, 1,", l = 20, f = 20, a.type === x.MERGE && r.id !== a.parents[0] ? d = `M ${e.x} ${e.y} L ${e.x} ${n.y - l} ${$} ${e.x - f} ${n.y} L ${n.x} ${n.y}` : d = `M ${e.x} ${e.y} L ${n.x + l} ${e.y} ${o} ${n.x} ${e.y + f} L ${n.x} ${n.y}`), e.x === n.x && (d = `M ${e.x} ${e.y} L ${n.x} ${n.y}`)) : u === "BT" ? (e.x < n.x && (a.type === x.MERGE && r.id !== a.parents[0] ? d = `M ${e.x} ${e.y} L ${e.x} ${n.y + l} ${$} ${e.x + f} ${n.y} L ${n.x} ${n.y}` : d = `M ${e.x} ${e.y} L ${n.x - l} ${e.y} ${o} ${n.x} ${e.y - f} L ${n.x} ${n.y}`), e.x > n.x && (o = "A 20 20, 0, 0, 0,", $ = "A 20 20, 0, 0, 1,", l = 20, f = 20, a.type === x.MERGE && r.id !== a.parents[0] ? d = `M ${e.x} ${e.y} L ${e.x} ${n.y + l} ${o} ${e.x - f} ${n.y} L ${n.x} ${n.y}` : d = `M ${e.x} ${e.y} L ${n.x - l} ${e.y} ${o} ${n.x} ${e.y - f} L ${n.x} ${n.y}`), e.x === n.x && (d = `M ${e.x} ${e.y} L ${n.x} ${n.y}`)) : (e.y < n.y && (a.type === x.MERGE && r.id !== a.parents[0] ? d = `M ${e.x} ${e.y} L ${n.x - l} ${e.y} ${$} ${n.x} ${e.y + f} L ${n.x} ${n.y}` : d = `M ${e.x} ${e.y} L ${e.x} ${n.y - l} ${o} ${e.x + f} ${n.y} L ${n.x} ${n.y}`), e.y > n.y && (a.type === x.MERGE && r.id !== a.parents[0] ? d = `M ${e.x} ${e.y} L ${n.x - l} ${e.y} ${o} ${n.x} ${e.y - f} L ${n.x} ${n.y}` : d = `M ${e.x} ${e.y} L ${e.x} ${n.y + l} ${$} ${e.x + f} ${n.y} L ${n.x} ${n.y}`), e.y === n.y && (d = `M ${e.x} ${e.y} L ${n.x} ${n.y}`)); + if (d === void 0) + throw new Error("Line definition not found"); + t.append("path").attr("d", d).attr("class", "arrow arrow" + g % O); +}, "drawArrow"), re = /* @__PURE__ */ h((t, r) => { + const a = t.append("g").attr("class", "commit-arrows"); + [...r.keys()].forEach((s) => { + const e = r.get(s); + e.parents && e.parents.length > 0 && e.parents.forEach((n) => { + Ur(a, r.get(n), e, r); + }); + }); +}, "drawArrows"), ee = /* @__PURE__ */ h((t, r) => { + const a = t.append("g"); + r.forEach((s, e) => { + var p; + const n = e % O, c = (p = C.get(s.name)) == null ? void 0 : p.pos; + if (c === void 0) + throw new Error(`Position not found for branch ${s.name}`); + const o = a.append("line"); + o.attr("x1", 0), o.attr("y1", c), o.attr("x2", M), o.attr("y2", c), o.attr("class", "branch branch" + n), u === "TB" ? (o.attr("y1", P), o.attr("x1", c), o.attr("y2", M), o.attr("x2", c)) : u === "BT" && (o.attr("y1", M), o.attr("x1", c), o.attr("y2", P), o.attr("x2", c)), W.push(c); + const $ = s.name, l = J($), f = a.insert("rect"), d = a.insert("g").attr("class", "branchLabel").insert("g").attr("class", "label branch-label" + n); + d.node().appendChild(l); + const y = l.getBBox(); + f.attr("class", "branchLabelBkg label" + n).attr("rx", 4).attr("ry", 4).attr("x", -y.width - 4 - ((b == null ? void 0 : b.rotateCommitLabel) === !0 ? 30 : 0)).attr("y", -y.height / 2 + 8).attr("width", y.width + 18).attr("height", y.height + 4), d.attr( + "transform", + "translate(" + (-y.width - 14 - ((b == null ? void 0 : b.rotateCommitLabel) === !0 ? 30 : 0)) + ", " + (c - y.height / 2 - 1) + ")" + ), u === "TB" ? (f.attr("x", c - y.width / 2 - 10).attr("y", 0), d.attr("transform", "translate(" + (c - y.width / 2 - 5) + ", 0)")) : u === "BT" ? (f.attr("x", c - y.width / 2 - 10).attr("y", M), d.attr("transform", "translate(" + (c - y.width / 2 - 5) + ", " + M + ")")) : f.attr("transform", "translate(-19, " + (c - y.height / 2) + ")"); + }); +}, "drawBranches"), te = /* @__PURE__ */ h(function(t, r, a, s, e) { + return C.set(t, { pos: r, index: a }), r += 50 + (e ? 40 : 0) + (u === "TB" || u === "BT" ? s.width / 2 : 0), r; +}, "setBranchPosition"), ae = /* @__PURE__ */ h(function(t, r, a, s) { + if (jr(), w.debug("in gitgraph renderer", t + ` +`, "id:", r, a), !b) + throw new Error("GitGraph config not found"); + const e = b.rotateCommitLabel ?? !1, n = s.db; + G = n.getCommits(); + const c = n.getBranchesAsObjArray(); + u = n.getDirection(); + const o = lr(`[id="${r}"]`); + let $ = 0; + c.forEach((l, f) => { + var q; + const g = J(l.name), d = o.append("g"), y = d.insert("g").attr("class", "branchLabel"), p = y.insert("g").attr("class", "label branch-label"); + (q = p.node()) == null || q.appendChild(g); + const m = g.getBBox(); + $ = te(l.name, $, f, m, e), p.remove(), y.remove(), d.remove(); + }), K(o, G, !1), b.showBranches && ee(o, c), re(o, G), K(o, G, !0), $r.insertTitle( + o, + "gitTitleText", + b.titleTopMargin ?? 0, + n.getDiagramTitle() + ), fr( + void 0, + o, + b.diagramPadding, + b.useMaxWidth + ); +}, "draw"), ne = { + draw: ae +}, se = /* @__PURE__ */ h((t) => ` + .commit-id, + .commit-msg, + .branch-label { + fill: lightgrey; + color: lightgrey; + font-family: 'trebuchet ms', verdana, arial, sans-serif; + font-family: var(--mermaid-font-family); + } + ${[0, 1, 2, 3, 4, 5, 6, 7].map( + (r) => ` + .branch-label${r} { fill: ${t["gitBranchLabel" + r]}; } + .commit${r} { stroke: ${t["git" + r]}; fill: ${t["git" + r]}; } + .commit-highlight${r} { stroke: ${t["gitInv" + r]}; fill: ${t["gitInv" + r]}; } + .label${r} { fill: ${t["git" + r]}; } + .arrow${r} { stroke: ${t["git" + r]}; } + ` +).join(` +`)} + + .branch { + stroke-width: 1; + stroke: ${t.lineColor}; + stroke-dasharray: 2; + } + .commit-label { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelColor};} + .commit-label-bkg { font-size: ${t.commitLabelFontSize}; fill: ${t.commitLabelBackground}; opacity: 0.5; } + .tag-label { font-size: ${t.tagLabelFontSize}; fill: ${t.tagLabelColor};} + .tag-label-bkg { fill: ${t.tagLabelBackground}; stroke: ${t.tagLabelBorder}; } + .tag-hole { fill: ${t.textColor}; } + + .commit-merge { + stroke: ${t.primaryColor}; + fill: ${t.primaryColor}; + } + .commit-reverse { + stroke: ${t.primaryColor}; + fill: ${t.primaryColor}; + stroke-width: 3; + } + .commit-highlight-outer { + } + .commit-highlight-inner { + stroke: ${t.primaryColor}; + fill: ${t.primaryColor}; + } + + .arrow { stroke-width: 8; stroke-linecap: round; fill: none} + .gitTitleText { + text-anchor: middle; + font-size: 18px; + fill: ${t.textColor}; + } +`, "getStyles"), oe = se, le = { + parser: Wr, + db: X, + renderer: ne, + styles: oe +}; +export { + le as diagram +}; diff --git a/backend/fastrtc/templates/component/graph-BaPzJnYr.js b/backend/fastrtc/templates/component/graph-BaPzJnYr.js new file mode 100644 index 0000000..55374fe --- /dev/null +++ b/backend/fastrtc/templates/component/graph-BaPzJnYr.js @@ -0,0 +1,247 @@ +import { az as N, aA as j, aB as f, aC as b, aD as E } from "./mermaid.core-Cmyps_S7.js"; +import { a as v, c as P, k as _, f as g, d, i as l, v as p, r as D } from "./_baseUniq-BN26mYqf.js"; +var w = N(function(o) { + return v(P(o, 1, j, !0)); +}), F = "\0", a = "\0", O = ""; +class L { + constructor(e = {}) { + this._isDirected = Object.prototype.hasOwnProperty.call(e, "directed") ? e.directed : !0, this._isMultigraph = Object.prototype.hasOwnProperty.call(e, "multigraph") ? e.multigraph : !1, this._isCompound = Object.prototype.hasOwnProperty.call(e, "compound") ? e.compound : !1, this._label = void 0, this._defaultNodeLabelFn = f(void 0), this._defaultEdgeLabelFn = f(void 0), this._nodes = {}, this._isCompound && (this._parent = {}, this._children = {}, this._children[a] = {}), this._in = {}, this._preds = {}, this._out = {}, this._sucs = {}, this._edgeObjs = {}, this._edgeLabels = {}; + } + /* === Graph functions ========= */ + isDirected() { + return this._isDirected; + } + isMultigraph() { + return this._isMultigraph; + } + isCompound() { + return this._isCompound; + } + setGraph(e) { + return this._label = e, this; + } + graph() { + return this._label; + } + /* === Node functions ========== */ + setDefaultNodeLabel(e) { + return b(e) || (e = f(e)), this._defaultNodeLabelFn = e, this; + } + nodeCount() { + return this._nodeCount; + } + nodes() { + return _(this._nodes); + } + sources() { + var e = this; + return g(this.nodes(), function(t) { + return E(e._in[t]); + }); + } + sinks() { + var e = this; + return g(this.nodes(), function(t) { + return E(e._out[t]); + }); + } + setNodes(e, t) { + var s = arguments, i = this; + return d(e, function(r) { + s.length > 1 ? i.setNode(r, t) : i.setNode(r); + }), this; + } + setNode(e, t) { + return Object.prototype.hasOwnProperty.call(this._nodes, e) ? (arguments.length > 1 && (this._nodes[e] = t), this) : (this._nodes[e] = arguments.length > 1 ? t : this._defaultNodeLabelFn(e), this._isCompound && (this._parent[e] = a, this._children[e] = {}, this._children[a][e] = !0), this._in[e] = {}, this._preds[e] = {}, this._out[e] = {}, this._sucs[e] = {}, ++this._nodeCount, this); + } + node(e) { + return this._nodes[e]; + } + hasNode(e) { + return Object.prototype.hasOwnProperty.call(this._nodes, e); + } + removeNode(e) { + if (Object.prototype.hasOwnProperty.call(this._nodes, e)) { + var t = (s) => this.removeEdge(this._edgeObjs[s]); + delete this._nodes[e], this._isCompound && (this._removeFromParentsChildList(e), delete this._parent[e], d(this.children(e), (s) => { + this.setParent(s); + }), delete this._children[e]), d(_(this._in[e]), t), delete this._in[e], delete this._preds[e], d(_(this._out[e]), t), delete this._out[e], delete this._sucs[e], --this._nodeCount; + } + return this; + } + setParent(e, t) { + if (!this._isCompound) + throw new Error("Cannot set parent in a non-compound graph"); + if (l(t)) + t = a; + else { + t += ""; + for (var s = t; !l(s); s = this.parent(s)) + if (s === e) + throw new Error("Setting " + t + " as parent of " + e + " would create a cycle"); + this.setNode(t); + } + return this.setNode(e), this._removeFromParentsChildList(e), this._parent[e] = t, this._children[t][e] = !0, this; + } + _removeFromParentsChildList(e) { + delete this._children[this._parent[e]][e]; + } + parent(e) { + if (this._isCompound) { + var t = this._parent[e]; + if (t !== a) + return t; + } + } + children(e) { + if (l(e) && (e = a), this._isCompound) { + var t = this._children[e]; + if (t) + return _(t); + } else { + if (e === a) + return this.nodes(); + if (this.hasNode(e)) + return []; + } + } + predecessors(e) { + var t = this._preds[e]; + if (t) + return _(t); + } + successors(e) { + var t = this._sucs[e]; + if (t) + return _(t); + } + neighbors(e) { + var t = this.predecessors(e); + if (t) + return w(t, this.successors(e)); + } + isLeaf(e) { + var t; + return this.isDirected() ? t = this.successors(e) : t = this.neighbors(e), t.length === 0; + } + filterNodes(e) { + var t = new this.constructor({ + directed: this._isDirected, + multigraph: this._isMultigraph, + compound: this._isCompound + }); + t.setGraph(this.graph()); + var s = this; + d(this._nodes, function(n, h) { + e(h) && t.setNode(h, n); + }), d(this._edgeObjs, function(n) { + t.hasNode(n.v) && t.hasNode(n.w) && t.setEdge(n, s.edge(n)); + }); + var i = {}; + function r(n) { + var h = s.parent(n); + return h === void 0 || t.hasNode(h) ? (i[n] = h, h) : h in i ? i[h] : r(h); + } + return this._isCompound && d(t.nodes(), function(n) { + t.setParent(n, r(n)); + }), t; + } + /* === Edge functions ========== */ + setDefaultEdgeLabel(e) { + return b(e) || (e = f(e)), this._defaultEdgeLabelFn = e, this; + } + edgeCount() { + return this._edgeCount; + } + edges() { + return p(this._edgeObjs); + } + setPath(e, t) { + var s = this, i = arguments; + return D(e, function(r, n) { + return i.length > 1 ? s.setEdge(r, n, t) : s.setEdge(r, n), n; + }), this; + } + /* + * setEdge(v, w, [value, [name]]) + * setEdge({ v, w, [name] }, [value]) + */ + setEdge() { + var e, t, s, i, r = !1, n = arguments[0]; + typeof n == "object" && n !== null && "v" in n ? (e = n.v, t = n.w, s = n.name, arguments.length === 2 && (i = arguments[1], r = !0)) : (e = n, t = arguments[1], s = arguments[3], arguments.length > 2 && (i = arguments[2], r = !0)), e = "" + e, t = "" + t, l(s) || (s = "" + s); + var h = c(this._isDirected, e, t, s); + if (Object.prototype.hasOwnProperty.call(this._edgeLabels, h)) + return r && (this._edgeLabels[h] = i), this; + if (!l(s) && !this._isMultigraph) + throw new Error("Cannot set a named edge when isMultigraph = false"); + this.setNode(e), this.setNode(t), this._edgeLabels[h] = r ? i : this._defaultEdgeLabelFn(e, t, s); + var u = M(this._isDirected, e, t, s); + return e = u.v, t = u.w, Object.freeze(u), this._edgeObjs[h] = u, C(this._preds[t], e), C(this._sucs[e], t), this._in[t][h] = u, this._out[e][h] = u, this._edgeCount++, this; + } + edge(e, t, s) { + var i = arguments.length === 1 ? m(this._isDirected, arguments[0]) : c(this._isDirected, e, t, s); + return this._edgeLabels[i]; + } + hasEdge(e, t, s) { + var i = arguments.length === 1 ? m(this._isDirected, arguments[0]) : c(this._isDirected, e, t, s); + return Object.prototype.hasOwnProperty.call(this._edgeLabels, i); + } + removeEdge(e, t, s) { + var i = arguments.length === 1 ? m(this._isDirected, arguments[0]) : c(this._isDirected, e, t, s), r = this._edgeObjs[i]; + return r && (e = r.v, t = r.w, delete this._edgeLabels[i], delete this._edgeObjs[i], y(this._preds[t], e), y(this._sucs[e], t), delete this._in[t][i], delete this._out[e][i], this._edgeCount--), this; + } + inEdges(e, t) { + var s = this._in[e]; + if (s) { + var i = p(s); + return t ? g(i, function(r) { + return r.v === t; + }) : i; + } + } + outEdges(e, t) { + var s = this._out[e]; + if (s) { + var i = p(s); + return t ? g(i, function(r) { + return r.w === t; + }) : i; + } + } + nodeEdges(e, t) { + var s = this.inEdges(e, t); + if (s) + return s.concat(this.outEdges(e, t)); + } +} +L.prototype._nodeCount = 0; +L.prototype._edgeCount = 0; +function C(o, e) { + o[e] ? o[e]++ : o[e] = 1; +} +function y(o, e) { + --o[e] || delete o[e]; +} +function c(o, e, t, s) { + var i = "" + e, r = "" + t; + if (!o && i > r) { + var n = i; + i = r, r = n; + } + return i + O + r + O + (l(s) ? F : s); +} +function M(o, e, t, s) { + var i = "" + e, r = "" + t; + if (!o && i > r) { + var n = i; + i = r, r = n; + } + var h = { v: i, w: r }; + return s && (h.name = s), h; +} +function m(o, e) { + return c(o, e.v, e.w, e.name); +} +export { + L as G +}; diff --git a/backend/fastrtc/templates/component/index-DeMSGuTm.js b/backend/fastrtc/templates/component/index-DeMSGuTm.js new file mode 100644 index 0000000..8c4d585 --- /dev/null +++ b/backend/fastrtc/templates/component/index-DeMSGuTm.js @@ -0,0 +1,28704 @@ +var Rm = Object.defineProperty; +var E1 = (n) => { + throw TypeError(n); +}; +var Om = (n, e, t) => e in n ? Rm(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t; +var Oe = (n, e, t) => Om(n, typeof e != "symbol" ? e + "" : e, t), qm = (n, e, t) => e.has(n) || E1("Cannot " + t); +var S1 = (n, e, t) => e.has(n) ? E1("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t); +var yi = (n, e, t) => (qm(n, e, "access private method"), t); +const { + SvelteComponent: Pm, + assign: Hm, + children: Um, + claim_element: Vm, + create_slot: Gm, + detach: x1, + element: jm, + get_all_dirty_from_scope: Wm, + get_slot_changes: Xm, + get_spread_update: Ym, + init: Zm, + insert_hydration: Km, + safe_not_equal: Jm, + set_dynamic_element_data: T1, + set_style: St, + toggle_class: p0, + transition_in: yd, + transition_out: kd, + update_slot_base: Qm +} = window.__gradio__svelte__internal; +function $m(n) { + let e, t, r; + const a = ( + /*#slots*/ + n[22].default + ), i = Gm( + a, + n, + /*$$scope*/ + n[21], + null + ); + let l = [ + { "data-testid": ( + /*test_id*/ + n[10] + ) }, + { id: ( + /*elem_id*/ + n[5] + ) }, + { + class: t = "block " + /*elem_classes*/ + n[6].join(" ") + " svelte-1ezsyiy" + } + ], s = {}; + for (let o = 0; o < l.length; o += 1) + s = Hm(s, l[o]); + return { + c() { + e = jm( + /*tag*/ + n[18] + ), i && i.c(), this.h(); + }, + l(o) { + e = Vm( + o, + /*tag*/ + (n[18] || "null").toUpperCase(), + { + "data-testid": !0, + id: !0, + class: !0 + } + ); + var u = Um(e); + i && i.l(u), u.forEach(x1), this.h(); + }, + h() { + T1( + /*tag*/ + n[18] + )(e, s), p0( + e, + "hidden", + /*visible*/ + n[13] === !1 + ), p0( + e, + "padded", + /*padding*/ + n[9] + ), p0( + e, + "flex", + /*flex*/ + n[0] + ), p0( + e, + "border_focus", + /*border_mode*/ + n[8] === "focus" + ), p0( + e, + "border_contrast", + /*border_mode*/ + n[8] === "contrast" + ), p0(e, "hide-container", !/*explicit_call*/ + n[11] && !/*container*/ + n[12]), St( + e, + "height", + /*get_dimension*/ + n[19]( + /*height*/ + n[1] + ) + ), St( + e, + "min-height", + /*get_dimension*/ + n[19]( + /*min_height*/ + n[2] + ) + ), St( + e, + "max-height", + /*get_dimension*/ + n[19]( + /*max_height*/ + n[3] + ) + ), St(e, "width", typeof /*width*/ + n[4] == "number" ? `calc(min(${/*width*/ + n[4]}px, 100%))` : ( + /*get_dimension*/ + n[19]( + /*width*/ + n[4] + ) + )), St( + e, + "border-style", + /*variant*/ + n[7] + ), St( + e, + "overflow", + /*allow_overflow*/ + n[14] ? ( + /*overflow_behavior*/ + n[15] + ) : "hidden" + ), St( + e, + "flex-grow", + /*scale*/ + n[16] + ), St(e, "min-width", `calc(min(${/*min_width*/ + n[17]}px, 100%))`), St(e, "border-width", "var(--block-border-width)"); + }, + m(o, u) { + Km(o, e, u), i && i.m(e, null), r = !0; + }, + p(o, u) { + i && i.p && (!r || u & /*$$scope*/ + 2097152) && Qm( + i, + a, + o, + /*$$scope*/ + o[21], + r ? Xm( + a, + /*$$scope*/ + o[21], + u, + null + ) : Wm( + /*$$scope*/ + o[21] + ), + null + ), T1( + /*tag*/ + o[18] + )(e, s = Ym(l, [ + (!r || u & /*test_id*/ + 1024) && { "data-testid": ( + /*test_id*/ + o[10] + ) }, + (!r || u & /*elem_id*/ + 32) && { id: ( + /*elem_id*/ + o[5] + ) }, + (!r || u & /*elem_classes*/ + 64 && t !== (t = "block " + /*elem_classes*/ + o[6].join(" ") + " svelte-1ezsyiy")) && { class: t } + ])), p0( + e, + "hidden", + /*visible*/ + o[13] === !1 + ), p0( + e, + "padded", + /*padding*/ + o[9] + ), p0( + e, + "flex", + /*flex*/ + o[0] + ), p0( + e, + "border_focus", + /*border_mode*/ + o[8] === "focus" + ), p0( + e, + "border_contrast", + /*border_mode*/ + o[8] === "contrast" + ), p0(e, "hide-container", !/*explicit_call*/ + o[11] && !/*container*/ + o[12]), u & /*height*/ + 2 && St( + e, + "height", + /*get_dimension*/ + o[19]( + /*height*/ + o[1] + ) + ), u & /*min_height*/ + 4 && St( + e, + "min-height", + /*get_dimension*/ + o[19]( + /*min_height*/ + o[2] + ) + ), u & /*max_height*/ + 8 && St( + e, + "max-height", + /*get_dimension*/ + o[19]( + /*max_height*/ + o[3] + ) + ), u & /*width*/ + 16 && St(e, "width", typeof /*width*/ + o[4] == "number" ? `calc(min(${/*width*/ + o[4]}px, 100%))` : ( + /*get_dimension*/ + o[19]( + /*width*/ + o[4] + ) + )), u & /*variant*/ + 128 && St( + e, + "border-style", + /*variant*/ + o[7] + ), u & /*allow_overflow, overflow_behavior*/ + 49152 && St( + e, + "overflow", + /*allow_overflow*/ + o[14] ? ( + /*overflow_behavior*/ + o[15] + ) : "hidden" + ), u & /*scale*/ + 65536 && St( + e, + "flex-grow", + /*scale*/ + o[16] + ), u & /*min_width*/ + 131072 && St(e, "min-width", `calc(min(${/*min_width*/ + o[17]}px, 100%))`); + }, + i(o) { + r || (yd(i, o), r = !0); + }, + o(o) { + kd(i, o), r = !1; + }, + d(o) { + o && x1(e), i && i.d(o); + } + }; +} +function e2(n) { + let e, t = ( + /*tag*/ + n[18] && $m(n) + ); + return { + c() { + t && t.c(); + }, + l(r) { + t && t.l(r); + }, + m(r, a) { + t && t.m(r, a), e = !0; + }, + p(r, [a]) { + /*tag*/ + r[18] && t.p(r, a); + }, + i(r) { + e || (yd(t, r), e = !0); + }, + o(r) { + kd(t, r), e = !1; + }, + d(r) { + t && t.d(r); + } + }; +} +function t2(n, e, t) { + let { $$slots: r = {}, $$scope: a } = e, { height: i = void 0 } = e, { min_height: l = void 0 } = e, { max_height: s = void 0 } = e, { width: o = void 0 } = e, { elem_id: u = "" } = e, { elem_classes: c = [] } = e, { variant: d = "solid" } = e, { border_mode: h = "base" } = e, { padding: p = !0 } = e, { type: _ = "normal" } = e, { test_id: b = void 0 } = e, { explicit_call: D = !1 } = e, { container: y = !0 } = e, { visible: k = !0 } = e, { allow_overflow: w = !0 } = e, { overflow_behavior: E = "auto" } = e, { scale: S = null } = e, { min_width: T = 0 } = e, { flex: C = !1 } = e; + k || (C = !1); + let F = _ === "fieldset" ? "fieldset" : "div"; + const B = (I) => { + if (I !== void 0) { + if (typeof I == "number") + return I + "px"; + if (typeof I == "string") + return I; + } + }; + return n.$$set = (I) => { + "height" in I && t(1, i = I.height), "min_height" in I && t(2, l = I.min_height), "max_height" in I && t(3, s = I.max_height), "width" in I && t(4, o = I.width), "elem_id" in I && t(5, u = I.elem_id), "elem_classes" in I && t(6, c = I.elem_classes), "variant" in I && t(7, d = I.variant), "border_mode" in I && t(8, h = I.border_mode), "padding" in I && t(9, p = I.padding), "type" in I && t(20, _ = I.type), "test_id" in I && t(10, b = I.test_id), "explicit_call" in I && t(11, D = I.explicit_call), "container" in I && t(12, y = I.container), "visible" in I && t(13, k = I.visible), "allow_overflow" in I && t(14, w = I.allow_overflow), "overflow_behavior" in I && t(15, E = I.overflow_behavior), "scale" in I && t(16, S = I.scale), "min_width" in I && t(17, T = I.min_width), "flex" in I && t(0, C = I.flex), "$$scope" in I && t(21, a = I.$$scope); + }, [ + C, + i, + l, + s, + o, + u, + c, + d, + h, + p, + b, + D, + y, + k, + w, + E, + S, + T, + F, + B, + _, + a, + r + ]; +} +class Dd extends Pm { + constructor(e) { + super(), Zm(this, e, t2, e2, Jm, { + height: 1, + min_height: 2, + max_height: 3, + width: 4, + elem_id: 5, + elem_classes: 6, + variant: 7, + border_mode: 8, + padding: 9, + type: 20, + test_id: 10, + explicit_call: 11, + container: 12, + visible: 13, + allow_overflow: 14, + overflow_behavior: 15, + scale: 16, + min_width: 17, + flex: 0 + }); + } +} +const r2 = [ + { color: "red", primary: 600, secondary: 100 }, + { color: "green", primary: 600, secondary: 100 }, + { color: "blue", primary: 600, secondary: 100 }, + { color: "yellow", primary: 500, secondary: 100 }, + { color: "purple", primary: 600, secondary: 100 }, + { color: "teal", primary: 600, secondary: 100 }, + { color: "orange", primary: 600, secondary: 100 }, + { color: "cyan", primary: 600, secondary: 100 }, + { color: "lime", primary: 500, secondary: 100 }, + { color: "pink", primary: 600, secondary: 100 } +], C1 = { + inherit: "inherit", + current: "currentColor", + transparent: "transparent", + black: "#000", + white: "#fff", + slate: { + 50: "#f8fafc", + 100: "#f1f5f9", + 200: "#e2e8f0", + 300: "#cbd5e1", + 400: "#94a3b8", + 500: "#64748b", + 600: "#475569", + 700: "#334155", + 800: "#1e293b", + 900: "#0f172a", + 950: "#020617" + }, + gray: { + 50: "#f9fafb", + 100: "#f3f4f6", + 200: "#e5e7eb", + 300: "#d1d5db", + 400: "#9ca3af", + 500: "#6b7280", + 600: "#4b5563", + 700: "#374151", + 800: "#1f2937", + 900: "#111827", + 950: "#030712" + }, + zinc: { + 50: "#fafafa", + 100: "#f4f4f5", + 200: "#e4e4e7", + 300: "#d4d4d8", + 400: "#a1a1aa", + 500: "#71717a", + 600: "#52525b", + 700: "#3f3f46", + 800: "#27272a", + 900: "#18181b", + 950: "#09090b" + }, + neutral: { + 50: "#fafafa", + 100: "#f5f5f5", + 200: "#e5e5e5", + 300: "#d4d4d4", + 400: "#a3a3a3", + 500: "#737373", + 600: "#525252", + 700: "#404040", + 800: "#262626", + 900: "#171717", + 950: "#0a0a0a" + }, + stone: { + 50: "#fafaf9", + 100: "#f5f5f4", + 200: "#e7e5e4", + 300: "#d6d3d1", + 400: "#a8a29e", + 500: "#78716c", + 600: "#57534e", + 700: "#44403c", + 800: "#292524", + 900: "#1c1917", + 950: "#0c0a09" + }, + red: { + 50: "#fef2f2", + 100: "#fee2e2", + 200: "#fecaca", + 300: "#fca5a5", + 400: "#f87171", + 500: "#ef4444", + 600: "#dc2626", + 700: "#b91c1c", + 800: "#991b1b", + 900: "#7f1d1d", + 950: "#450a0a" + }, + orange: { + 50: "#fff7ed", + 100: "#ffedd5", + 200: "#fed7aa", + 300: "#fdba74", + 400: "#fb923c", + 500: "#f97316", + 600: "#ea580c", + 700: "#c2410c", + 800: "#9a3412", + 900: "#7c2d12", + 950: "#431407" + }, + amber: { + 50: "#fffbeb", + 100: "#fef3c7", + 200: "#fde68a", + 300: "#fcd34d", + 400: "#fbbf24", + 500: "#f59e0b", + 600: "#d97706", + 700: "#b45309", + 800: "#92400e", + 900: "#78350f", + 950: "#451a03" + }, + yellow: { + 50: "#fefce8", + 100: "#fef9c3", + 200: "#fef08a", + 300: "#fde047", + 400: "#facc15", + 500: "#eab308", + 600: "#ca8a04", + 700: "#a16207", + 800: "#854d0e", + 900: "#713f12", + 950: "#422006" + }, + lime: { + 50: "#f7fee7", + 100: "#ecfccb", + 200: "#d9f99d", + 300: "#bef264", + 400: "#a3e635", + 500: "#84cc16", + 600: "#65a30d", + 700: "#4d7c0f", + 800: "#3f6212", + 900: "#365314", + 950: "#1a2e05" + }, + green: { + 50: "#f0fdf4", + 100: "#dcfce7", + 200: "#bbf7d0", + 300: "#86efac", + 400: "#4ade80", + 500: "#22c55e", + 600: "#16a34a", + 700: "#15803d", + 800: "#166534", + 900: "#14532d", + 950: "#052e16" + }, + emerald: { + 50: "#ecfdf5", + 100: "#d1fae5", + 200: "#a7f3d0", + 300: "#6ee7b7", + 400: "#34d399", + 500: "#10b981", + 600: "#059669", + 700: "#047857", + 800: "#065f46", + 900: "#064e3b", + 950: "#022c22" + }, + teal: { + 50: "#f0fdfa", + 100: "#ccfbf1", + 200: "#99f6e4", + 300: "#5eead4", + 400: "#2dd4bf", + 500: "#14b8a6", + 600: "#0d9488", + 700: "#0f766e", + 800: "#115e59", + 900: "#134e4a", + 950: "#042f2e" + }, + cyan: { + 50: "#ecfeff", + 100: "#cffafe", + 200: "#a5f3fc", + 300: "#67e8f9", + 400: "#22d3ee", + 500: "#06b6d4", + 600: "#0891b2", + 700: "#0e7490", + 800: "#155e75", + 900: "#164e63", + 950: "#083344" + }, + sky: { + 50: "#f0f9ff", + 100: "#e0f2fe", + 200: "#bae6fd", + 300: "#7dd3fc", + 400: "#38bdf8", + 500: "#0ea5e9", + 600: "#0284c7", + 700: "#0369a1", + 800: "#075985", + 900: "#0c4a6e", + 950: "#082f49" + }, + blue: { + 50: "#eff6ff", + 100: "#dbeafe", + 200: "#bfdbfe", + 300: "#93c5fd", + 400: "#60a5fa", + 500: "#3b82f6", + 600: "#2563eb", + 700: "#1d4ed8", + 800: "#1e40af", + 900: "#1e3a8a", + 950: "#172554" + }, + indigo: { + 50: "#eef2ff", + 100: "#e0e7ff", + 200: "#c7d2fe", + 300: "#a5b4fc", + 400: "#818cf8", + 500: "#6366f1", + 600: "#4f46e5", + 700: "#4338ca", + 800: "#3730a3", + 900: "#312e81", + 950: "#1e1b4b" + }, + violet: { + 50: "#f5f3ff", + 100: "#ede9fe", + 200: "#ddd6fe", + 300: "#c4b5fd", + 400: "#a78bfa", + 500: "#8b5cf6", + 600: "#7c3aed", + 700: "#6d28d9", + 800: "#5b21b6", + 900: "#4c1d95", + 950: "#2e1065" + }, + purple: { + 50: "#faf5ff", + 100: "#f3e8ff", + 200: "#e9d5ff", + 300: "#d8b4fe", + 400: "#c084fc", + 500: "#a855f7", + 600: "#9333ea", + 700: "#7e22ce", + 800: "#6b21a8", + 900: "#581c87", + 950: "#3b0764" + }, + fuchsia: { + 50: "#fdf4ff", + 100: "#fae8ff", + 200: "#f5d0fe", + 300: "#f0abfc", + 400: "#e879f9", + 500: "#d946ef", + 600: "#c026d3", + 700: "#a21caf", + 800: "#86198f", + 900: "#701a75", + 950: "#4a044e" + }, + pink: { + 50: "#fdf2f8", + 100: "#fce7f3", + 200: "#fbcfe8", + 300: "#f9a8d4", + 400: "#f472b6", + 500: "#ec4899", + 600: "#db2777", + 700: "#be185d", + 800: "#9d174d", + 900: "#831843", + 950: "#500724" + }, + rose: { + 50: "#fff1f2", + 100: "#ffe4e6", + 200: "#fecdd3", + 300: "#fda4af", + 400: "#fb7185", + 500: "#f43f5e", + 600: "#e11d48", + 700: "#be123c", + 800: "#9f1239", + 900: "#881337", + 950: "#4c0519" + } +}; +r2.reduce( + (n, { color: e, primary: t, secondary: r }) => ({ + ...n, + [e]: { + primary: C1[e][t], + secondary: C1[e][r] + } + }), + {} +); +const { + SvelteComponent: n2, + append_hydration: a2, + attr: B0, + children: F1, + claim_svg_element: M1, + detach: ws, + init: i2, + insert_hydration: l2, + noop: ys, + safe_not_equal: s2, + svg_element: z1 +} = window.__gradio__svelte__internal; +function o2(n) { + let e, t; + return { + c() { + e = z1("svg"), t = z1("circle"), this.h(); + }, + l(r) { + e = M1(r, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var a = F1(e); + t = M1(a, "circle", { cx: !0, cy: !0, r: !0 }), F1(t).forEach(ws), a.forEach(ws), this.h(); + }, + h() { + B0(t, "cx", "12"), B0(t, "cy", "12"), B0(t, "r", "10"), B0(e, "xmlns", "http://www.w3.org/2000/svg"), B0(e, "width", "100%"), B0(e, "height", "100%"), B0(e, "viewBox", "0 0 24 24"), B0(e, "stroke-width", "1.5"), B0(e, "stroke-linecap", "round"), B0(e, "stroke-linejoin", "round"), B0(e, "class", "feather feather-circle"); + }, + m(r, a) { + l2(r, e, a), a2(e, t); + }, + p: ys, + i: ys, + o: ys, + d(r) { + r && ws(e); + } + }; +} +class Xl extends n2 { + constructor(e) { + super(), i2(this, e, null, o2, s2, {}); + } +} +const { + SvelteComponent: u2, + append_hydration: ks, + attr: I0, + children: ki, + claim_svg_element: Di, + detach: da, + init: c2, + insert_hydration: f2, + noop: Ds, + safe_not_equal: h2, + set_style: Z0, + svg_element: Ai +} = window.__gradio__svelte__internal; +function d2(n) { + let e, t, r, a; + return { + c() { + e = Ai("svg"), t = Ai("g"), r = Ai("path"), a = Ai("path"), this.h(); + }, + l(i) { + e = Di(i, "svg", { + width: !0, + height: !0, + viewBox: !0, + version: !0, + xmlns: !0, + "xmlns:xlink": !0, + "xml:space": !0, + stroke: !0, + style: !0 + }); + var l = ki(e); + t = Di(l, "g", { transform: !0 }); + var s = ki(t); + r = Di(s, "path", { d: !0, style: !0 }), ki(r).forEach(da), s.forEach(da), a = Di(l, "path", { d: !0, style: !0 }), ki(a).forEach(da), l.forEach(da), this.h(); + }, + h() { + I0(r, "d", "M18,6L6.087,17.913"), Z0(r, "fill", "none"), Z0(r, "fill-rule", "nonzero"), Z0(r, "stroke-width", "2px"), I0(t, "transform", "matrix(1.14096,-0.140958,-0.140958,1.14096,-0.0559523,0.0559523)"), I0(a, "d", "M4.364,4.364L19.636,19.636"), Z0(a, "fill", "none"), Z0(a, "fill-rule", "nonzero"), Z0(a, "stroke-width", "2px"), I0(e, "width", "100%"), I0(e, "height", "100%"), I0(e, "viewBox", "0 0 24 24"), I0(e, "version", "1.1"), I0(e, "xmlns", "http://www.w3.org/2000/svg"), I0(e, "xmlns:xlink", "http://www.w3.org/1999/xlink"), I0(e, "xml:space", "preserve"), I0(e, "stroke", "currentColor"), Z0(e, "fill-rule", "evenodd"), Z0(e, "clip-rule", "evenodd"), Z0(e, "stroke-linecap", "round"), Z0(e, "stroke-linejoin", "round"); + }, + m(i, l) { + f2(i, e, l), ks(e, t), ks(t, r), ks(e, a); + }, + p: Ds, + i: Ds, + o: Ds, + d(i) { + i && da(e); + } + }; +} +class m2 extends u2 { + constructor(e) { + super(), c2(this, e, null, d2, h2, {}); + } +} +const { + SvelteComponent: p2, + append_hydration: g2, + attr: Pn, + children: B1, + claim_svg_element: I1, + detach: As, + init: _2, + insert_hydration: v2, + noop: Es, + safe_not_equal: b2, + svg_element: L1 +} = window.__gradio__svelte__internal; +function w2(n) { + let e, t; + return { + c() { + e = L1("svg"), t = L1("path"), this.h(); + }, + l(r) { + e = I1(r, "svg", { + class: !0, + xmlns: !0, + width: !0, + height: !0, + viewBox: !0 + }); + var a = B1(e); + t = I1(a, "path", { d: !0 }), B1(t).forEach(As), a.forEach(As), this.h(); + }, + h() { + Pn(t, "d", "M5 8l4 4 4-4z"), Pn(e, "class", "dropdown-arrow svelte-145leq6"), Pn(e, "xmlns", "http://www.w3.org/2000/svg"), Pn(e, "width", "100%"), Pn(e, "height", "100%"), Pn(e, "viewBox", "0 0 18 18"); + }, + m(r, a) { + v2(r, e, a), g2(e, t); + }, + p: Es, + i: Es, + o: Es, + d(r) { + r && As(e); + } + }; +} +class Yl extends p2 { + constructor(e) { + super(), _2(this, e, null, w2, b2, {}); + } +} +const { + SvelteComponent: y2, + append_hydration: k2, + attr: Ei, + children: N1, + claim_svg_element: R1, + detach: Ss, + init: D2, + insert_hydration: A2, + noop: xs, + safe_not_equal: E2, + svg_element: O1 +} = window.__gradio__svelte__internal; +function S2(n) { + let e, t; + return { + c() { + e = O1("svg"), t = O1("path"), this.h(); + }, + l(r) { + e = R1(r, "svg", { xmlns: !0, viewBox: !0 }); + var a = N1(e); + t = R1(a, "path", { fill: !0, d: !0 }), N1(t).forEach(Ss), a.forEach(Ss), this.h(); + }, + h() { + Ei(t, "fill", "currentColor"), Ei(t, "d", "M13.75 2a2.25 2.25 0 0 1 2.236 2.002V4h1.764A2.25 2.25 0 0 1 20 6.25V11h-1.5V6.25a.75.75 0 0 0-.75-.75h-2.129c-.404.603-1.091 1-1.871 1h-3.5c-.78 0-1.467-.397-1.871-1H6.25a.75.75 0 0 0-.75.75v13.5c0 .414.336.75.75.75h4.78a4 4 0 0 0 .505 1.5H6.25A2.25 2.25 0 0 1 4 19.75V6.25A2.25 2.25 0 0 1 6.25 4h1.764a2.25 2.25 0 0 1 2.236-2zm2.245 2.096L16 4.25q0-.078-.005-.154M13.75 3.5h-3.5a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5M15 12a3 3 0 0 0-3 3v5c0 .556.151 1.077.415 1.524l3.494-3.494a2.25 2.25 0 0 1 3.182 0l3.494 3.494c.264-.447.415-.968.415-1.524v-5a3 3 0 0 0-3-3zm0 11a3 3 0 0 1-1.524-.415l3.494-3.494a.75.75 0 0 1 1.06 0l3.494 3.494A3 3 0 0 1 20 23zm5-7a1 1 0 1 1 0-2 1 1 0 0 1 0 2"), Ei(e, "xmlns", "http://www.w3.org/2000/svg"), Ei(e, "viewBox", "0 0 24 24"); + }, + m(r, a) { + A2(r, e, a), k2(e, t); + }, + p: xs, + i: xs, + o: xs, + d(r) { + r && Ss(e); + } + }; +} +class x2 extends y2 { + constructor(e) { + super(), D2(this, e, null, S2, E2, {}); + } +} +const { + SvelteComponent: T2, + append_hydration: Si, + attr: st, + children: ma, + claim_svg_element: pa, + detach: Hn, + init: C2, + insert_hydration: F2, + noop: Ts, + safe_not_equal: M2, + svg_element: ga +} = window.__gradio__svelte__internal; +function z2(n) { + let e, t, r, a, i; + return { + c() { + e = ga("svg"), t = ga("path"), r = ga("path"), a = ga("line"), i = ga("line"), this.h(); + }, + l(l) { + e = pa(l, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var s = ma(e); + t = pa(s, "path", { d: !0 }), ma(t).forEach(Hn), r = pa(s, "path", { d: !0 }), ma(r).forEach(Hn), a = pa(s, "line", { x1: !0, y1: !0, x2: !0, y2: !0 }), ma(a).forEach(Hn), i = pa(s, "line", { x1: !0, y1: !0, x2: !0, y2: !0 }), ma(i).forEach(Hn), s.forEach(Hn), this.h(); + }, + h() { + st(t, "d", "M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z"), st(r, "d", "M19 10v2a7 7 0 0 1-14 0v-2"), st(a, "x1", "12"), st(a, "y1", "19"), st(a, "x2", "12"), st(a, "y2", "23"), st(i, "x1", "8"), st(i, "y1", "23"), st(i, "x2", "16"), st(i, "y2", "23"), st(e, "xmlns", "http://www.w3.org/2000/svg"), st(e, "width", "100%"), st(e, "height", "100%"), st(e, "viewBox", "0 0 24 24"), st(e, "fill", "none"), st(e, "stroke", "currentColor"), st(e, "stroke-width", "2"), st(e, "stroke-linecap", "round"), st(e, "stroke-linejoin", "round"), st(e, "class", "feather feather-mic"); + }, + m(l, s) { + F2(l, e, s), Si(e, t), Si(e, r), Si(e, a), Si(e, i); + }, + p: Ts, + i: Ts, + o: Ts, + d(l) { + l && Hn(e); + } + }; +} +class Cn extends T2 { + constructor(e) { + super(), C2(this, e, null, z2, M2, {}); + } +} +const { + SvelteComponent: B2, + append_hydration: Cs, + attr: xt, + children: xi, + claim_svg_element: Ti, + detach: _a, + init: I2, + insert_hydration: L2, + noop: Fs, + safe_not_equal: N2, + svg_element: Ci +} = window.__gradio__svelte__internal; +function R2(n) { + let e, t, r, a; + return { + c() { + e = Ci("svg"), t = Ci("path"), r = Ci("circle"), a = Ci("circle"), this.h(); + }, + l(i) { + e = Ti(i, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var l = xi(e); + t = Ti(l, "path", { d: !0 }), xi(t).forEach(_a), r = Ti(l, "circle", { cx: !0, cy: !0, r: !0 }), xi(r).forEach(_a), a = Ti(l, "circle", { cx: !0, cy: !0, r: !0 }), xi(a).forEach(_a), l.forEach(_a), this.h(); + }, + h() { + xt(t, "d", "M9 18V5l12-2v13"), xt(r, "cx", "6"), xt(r, "cy", "18"), xt(r, "r", "3"), xt(a, "cx", "18"), xt(a, "cy", "16"), xt(a, "r", "3"), xt(e, "xmlns", "http://www.w3.org/2000/svg"), xt(e, "width", "100%"), xt(e, "height", "100%"), xt(e, "viewBox", "0 0 24 24"), xt(e, "fill", "none"), xt(e, "stroke", "currentColor"), xt(e, "stroke-width", "1.5"), xt(e, "stroke-linecap", "round"), xt(e, "stroke-linejoin", "round"), xt(e, "class", "feather feather-music"); + }, + m(i, l) { + L2(i, e, l), Cs(e, t), Cs(e, r), Cs(e, a); + }, + p: Fs, + i: Fs, + o: Fs, + d(i) { + i && _a(e); + } + }; +} +class Au extends B2 { + constructor(e) { + super(), I2(this, e, null, R2, N2, {}); + } +} +const { + SvelteComponent: O2, + append_hydration: q2, + attr: vt, + children: q1, + claim_svg_element: P1, + detach: Ms, + init: P2, + insert_hydration: H2, + noop: H1, + safe_not_equal: U2, + svg_element: U1 +} = window.__gradio__svelte__internal; +function V2(n) { + let e, t, r; + return { + c() { + e = U1("svg"), t = U1("rect"), this.h(); + }, + l(a) { + e = P1(a, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var i = q1(e); + t = P1(i, "rect", { + x: !0, + y: !0, + width: !0, + height: !0, + rx: !0, + ry: !0 + }), q1(t).forEach(Ms), i.forEach(Ms), this.h(); + }, + h() { + vt(t, "x", "3"), vt(t, "y", "3"), vt(t, "width", "18"), vt(t, "height", "18"), vt(t, "rx", "2"), vt(t, "ry", "2"), vt(e, "xmlns", "http://www.w3.org/2000/svg"), vt(e, "width", "100%"), vt(e, "height", "100%"), vt(e, "viewBox", "0 0 24 24"), vt( + e, + "fill", + /*fill*/ + n[0] + ), vt(e, "stroke", "currentColor"), vt(e, "stroke-width", r = `${/*stroke_width*/ + n[1]}`), vt(e, "stroke-linecap", "round"), vt(e, "stroke-linejoin", "round"), vt(e, "class", "feather feather-square"); + }, + m(a, i) { + H2(a, e, i), q2(e, t); + }, + p(a, [i]) { + i & /*fill*/ + 1 && vt( + e, + "fill", + /*fill*/ + a[0] + ), i & /*stroke_width*/ + 2 && r !== (r = `${/*stroke_width*/ + a[1]}`) && vt(e, "stroke-width", r); + }, + i: H1, + o: H1, + d(a) { + a && Ms(e); + } + }; +} +function G2(n, e, t) { + let { fill: r = "currentColor" } = e, { stroke_width: a = 1.5 } = e; + return n.$$set = (i) => { + "fill" in i && t(0, r = i.fill), "stroke_width" in i && t(1, a = i.stroke_width); + }, [r, a]; +} +let Ad = class extends O2 { + constructor(e) { + super(), P2(this, e, G2, V2, U2, { fill: 0, stroke_width: 1 }); + } +}; +const { + SvelteComponent: j2, + append_hydration: zs, + attr: Nt, + children: Fi, + claim_svg_element: Mi, + detach: va, + init: W2, + insert_hydration: X2, + noop: Bs, + safe_not_equal: Y2, + svg_element: zi +} = window.__gradio__svelte__internal; +function Z2(n) { + let e, t, r, a; + return { + c() { + e = zi("svg"), t = zi("path"), r = zi("polyline"), a = zi("line"), this.h(); + }, + l(i) { + e = Mi(i, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var l = Fi(e); + t = Mi(l, "path", { d: !0 }), Fi(t).forEach(va), r = Mi(l, "polyline", { points: !0 }), Fi(r).forEach(va), a = Mi(l, "line", { x1: !0, y1: !0, x2: !0, y2: !0 }), Fi(a).forEach(va), l.forEach(va), this.h(); + }, + h() { + Nt(t, "d", "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"), Nt(r, "points", "17 8 12 3 7 8"), Nt(a, "x1", "12"), Nt(a, "y1", "3"), Nt(a, "x2", "12"), Nt(a, "y2", "15"), Nt(e, "xmlns", "http://www.w3.org/2000/svg"), Nt(e, "width", "90%"), Nt(e, "height", "90%"), Nt(e, "viewBox", "0 0 24 24"), Nt(e, "fill", "none"), Nt(e, "stroke", "currentColor"), Nt(e, "stroke-width", "2"), Nt(e, "stroke-linecap", "round"), Nt(e, "stroke-linejoin", "round"), Nt(e, "class", "feather feather-upload"); + }, + m(i, l) { + X2(i, e, l), zs(e, t), zs(e, r), zs(e, a); + }, + p: Bs, + i: Bs, + o: Bs, + d(i) { + i && va(e); + } + }; +} +class K2 extends j2 { + constructor(e) { + super(), W2(this, e, null, Z2, Y2, {}); + } +} +const { + SvelteComponent: J2, + append_hydration: V1, + attr: Tt, + children: Is, + claim_svg_element: Ls, + detach: Bi, + init: Q2, + insert_hydration: $2, + noop: Ns, + safe_not_equal: e5, + svg_element: Rs +} = window.__gradio__svelte__internal; +function t5(n) { + let e, t, r; + return { + c() { + e = Rs("svg"), t = Rs("polygon"), r = Rs("rect"), this.h(); + }, + l(a) { + e = Ls(a, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + fill: !0, + stroke: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0, + class: !0 + }); + var i = Is(e); + t = Ls(i, "polygon", { points: !0 }), Is(t).forEach(Bi), r = Ls(i, "rect", { + x: !0, + y: !0, + width: !0, + height: !0, + rx: !0, + ry: !0 + }), Is(r).forEach(Bi), i.forEach(Bi), this.h(); + }, + h() { + Tt(t, "points", "23 7 16 12 23 17 23 7"), Tt(r, "x", "1"), Tt(r, "y", "5"), Tt(r, "width", "15"), Tt(r, "height", "14"), Tt(r, "rx", "2"), Tt(r, "ry", "2"), Tt(e, "xmlns", "http://www.w3.org/2000/svg"), Tt(e, "width", "100%"), Tt(e, "height", "100%"), Tt(e, "viewBox", "0 0 24 24"), Tt(e, "fill", "none"), Tt(e, "stroke", "currentColor"), Tt(e, "stroke-width", "1.5"), Tt(e, "stroke-linecap", "round"), Tt(e, "stroke-linejoin", "round"), Tt(e, "class", "feather feather-video"); + }, + m(a, i) { + $2(a, e, i), V1(e, t), V1(e, r); + }, + p: Ns, + i: Ns, + o: Ns, + d(a) { + a && Bi(e); + } + }; +} +class Eu extends J2 { + constructor(e) { + super(), Q2(this, e, null, t5, e5, {}); + } +} +const { + SvelteComponent: r5, + append_hydration: ba, + attr: bt, + children: wa, + claim_svg_element: ya, + claim_text: n5, + detach: Un, + init: a5, + insert_hydration: i5, + noop: Os, + safe_not_equal: l5, + svg_element: ka, + text: s5 +} = window.__gradio__svelte__internal; +function o5(n) { + let e, t, r, a, i, l; + return { + c() { + e = ka("svg"), t = ka("title"), r = s5("High volume"), a = ka("path"), i = ka("path"), l = ka("path"), this.h(); + }, + l(s) { + e = ya(s, "svg", { + width: !0, + height: !0, + viewBox: !0, + "stroke-width": !0, + fill: !0, + stroke: !0, + xmlns: !0, + color: !0 + }); + var o = wa(e); + t = ya(o, "title", {}); + var u = wa(t); + r = n5(u, "High volume"), u.forEach(Un), a = ya(o, "path", { d: !0, "stroke-width": !0 }), wa(a).forEach(Un), i = ya(o, "path", { + d: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0 + }), wa(i).forEach(Un), l = ya(o, "path", { + d: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0 + }), wa(l).forEach(Un), o.forEach(Un), this.h(); + }, + h() { + bt(a, "d", "M1 13.8571V10.1429C1 9.03829 1.89543 8.14286 3 8.14286H5.9C6.09569 8.14286 6.28708 8.08544 6.45046 7.97772L12.4495 4.02228C13.1144 3.5839 14 4.06075 14 4.85714V19.1429C14 19.9392 13.1144 20.4161 12.4495 19.9777L6.45046 16.0223C6.28708 15.9146 6.09569 15.8571 5.9 15.8571H3C1.89543 15.8571 1 14.9617 1 13.8571Z"), bt(a, "stroke-width", "1.5"), bt(i, "d", "M17.5 7.5C17.5 7.5 19 9 19 11.5C19 14 17.5 15.5 17.5 15.5"), bt(i, "stroke-width", "1.5"), bt(i, "stroke-linecap", "round"), bt(i, "stroke-linejoin", "round"), bt(l, "d", "M20.5 4.5C20.5 4.5 23 7 23 11.5C23 16 20.5 18.5 20.5 18.5"), bt(l, "stroke-width", "1.5"), bt(l, "stroke-linecap", "round"), bt(l, "stroke-linejoin", "round"), bt(e, "width", "100%"), bt(e, "height", "100%"), bt(e, "viewBox", "0 0 24 24"), bt(e, "stroke-width", "1.5"), bt(e, "fill", "none"), bt(e, "stroke", "currentColor"), bt(e, "xmlns", "http://www.w3.org/2000/svg"), bt(e, "color", "currentColor"); + }, + m(s, o) { + i5(s, e, o), ba(e, t), ba(t, r), ba(e, a), ba(e, i), ba(e, l); + }, + p: Os, + i: Os, + o: Os, + d(s) { + s && Un(e); + } + }; +} +class El extends r5 { + constructor(e) { + super(), a5(this, e, null, o5, l5, {}); + } +} +const { + SvelteComponent: u5, + append_hydration: Ur, + attr: ht, + children: Vr, + claim_svg_element: Gr, + claim_text: c5, + detach: br, + init: f5, + insert_hydration: h5, + noop: qs, + safe_not_equal: d5, + svg_element: jr, + text: m5 +} = window.__gradio__svelte__internal; +function p5(n) { + let e, t, r, a, i, l, s, o, u; + return { + c() { + e = jr("svg"), t = jr("title"), r = m5("Muted volume"), a = jr("g"), i = jr("path"), l = jr("path"), s = jr("defs"), o = jr("clipPath"), u = jr("rect"), this.h(); + }, + l(c) { + e = Gr(c, "svg", { + width: !0, + height: !0, + viewBox: !0, + "stroke-width": !0, + fill: !0, + xmlns: !0, + stroke: !0, + color: !0 + }); + var d = Vr(e); + t = Gr(d, "title", {}); + var h = Vr(t); + r = c5(h, "Muted volume"), h.forEach(br), a = Gr(d, "g", { "clip-path": !0 }); + var p = Vr(a); + i = Gr(p, "path", { + d: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-linejoin": !0 + }), Vr(i).forEach(br), l = Gr(p, "path", { d: !0, "stroke-width": !0 }), Vr(l).forEach(br), p.forEach(br), s = Gr(d, "defs", {}); + var _ = Vr(s); + o = Gr(_, "clipPath", { id: !0 }); + var b = Vr(o); + u = Gr(b, "rect", { width: !0, height: !0, fill: !0 }), Vr(u).forEach(br), b.forEach(br), _.forEach(br), d.forEach(br), this.h(); + }, + h() { + ht(i, "d", "M18 14L20.0005 12M22 10L20.0005 12M20.0005 12L18 10M20.0005 12L22 14"), ht(i, "stroke-width", "1.5"), ht(i, "stroke-linecap", "round"), ht(i, "stroke-linejoin", "round"), ht(l, "d", "M2 13.8571V10.1429C2 9.03829 2.89543 8.14286 4 8.14286H6.9C7.09569 8.14286 7.28708 8.08544 7.45046 7.97772L13.4495 4.02228C14.1144 3.5839 15 4.06075 15 4.85714V19.1429C15 19.9392 14.1144 20.4161 13.4495 19.9777L7.45046 16.0223C7.28708 15.9146 7.09569 15.8571 6.9 15.8571H4C2.89543 15.8571 2 14.9617 2 13.8571Z"), ht(l, "stroke-width", "1.5"), ht(a, "clip-path", "url(#clip0_3173_16686)"), ht(u, "width", "24"), ht(u, "height", "24"), ht(u, "fill", "white"), ht(o, "id", "clip0_3173_16686"), ht(e, "width", "100%"), ht(e, "height", "100%"), ht(e, "viewBox", "0 0 24 24"), ht(e, "stroke-width", "1.5"), ht(e, "fill", "none"), ht(e, "xmlns", "http://www.w3.org/2000/svg"), ht(e, "stroke", "currentColor"), ht(e, "color", "currentColor"); + }, + m(c, d) { + h5(c, e, d), Ur(e, t), Ur(t, r), Ur(e, a), Ur(a, i), Ur(a, l), Ur(e, s), Ur(s, o), Ur(o, u); + }, + p: qs, + i: qs, + o: qs, + d(c) { + c && br(e); + } + }; +} +class Sl extends u5 { + constructor(e) { + super(), f5(this, e, null, p5, d5, {}); + } +} +const { + SvelteComponent: g5, + append_hydration: G1, + attr: Wr, + children: Ps, + claim_svg_element: Hs, + detach: Ii, + init: _5, + insert_hydration: v5, + noop: Us, + safe_not_equal: b5, + svg_element: Vs +} = window.__gradio__svelte__internal; +function w5(n) { + let e, t, r; + return { + c() { + e = Vs("svg"), t = Vs("path"), r = Vs("path"), this.h(); + }, + l(a) { + e = Hs(a, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0 + }); + var i = Ps(e); + t = Hs(i, "path", { fill: !0, d: !0 }), Ps(t).forEach(Ii), r = Hs(i, "path", { fill: !0, d: !0 }), Ps(r).forEach(Ii), i.forEach(Ii), this.h(); + }, + h() { + Wr(t, "fill", "currentColor"), Wr(t, "d", "M12 2c-4.963 0-9 4.038-9 9c0 3.328 1.82 6.232 4.513 7.79l-2.067 1.378A1 1 0 0 0 6 22h12a1 1 0 0 0 .555-1.832l-2.067-1.378C19.18 17.232 21 14.328 21 11c0-4.962-4.037-9-9-9zm0 16c-3.859 0-7-3.141-7-7c0-3.86 3.141-7 7-7s7 3.14 7 7c0 3.859-3.141 7-7 7z"), Wr(r, "fill", "currentColor"), Wr(r, "d", "M12 6c-2.757 0-5 2.243-5 5s2.243 5 5 5s5-2.243 5-5s-2.243-5-5-5zm0 8c-1.654 0-3-1.346-3-3s1.346-3 3-3s3 1.346 3 3s-1.346 3-3 3z"), Wr(e, "xmlns", "http://www.w3.org/2000/svg"), Wr(e, "width", "100%"), Wr(e, "height", "100%"), Wr(e, "viewBox", "0 0 24 24"); + }, + m(a, i) { + v5(a, e, i), G1(e, t), G1(e, r); + }, + p: Us, + i: Us, + o: Us, + d(a) { + a && Ii(e); + } + }; +} +let j1 = class extends g5 { + constructor(e) { + super(), _5(this, e, null, w5, b5, {}); + } +}; +const { + SvelteComponent: y5, + append_hydration: W1, + attr: wt, + children: Gs, + claim_svg_element: js, + detach: Li, + init: k5, + insert_hydration: D5, + noop: Ws, + safe_not_equal: A5, + svg_element: Xs +} = window.__gradio__svelte__internal; +function E5(n) { + let e, t, r; + return { + c() { + e = Xs("svg"), t = Xs("circle"), r = Xs("animateTransform"), this.h(); + }, + l(a) { + e = js(a, "svg", { + xmlns: !0, + width: !0, + height: !0, + viewBox: !0, + class: !0 + }); + var i = Gs(e); + t = js(i, "circle", { + cx: !0, + cy: !0, + r: !0, + fill: !0, + "stroke-width": !0, + "stroke-linecap": !0, + "stroke-dasharray": !0, + "stroke-dashoffset": !0 + }); + var l = Gs(t); + r = js(l, "animateTransform", { + attributeName: !0, + type: !0, + from: !0, + to: !0, + repeatCount: !0 + }), Gs(r).forEach(Li), l.forEach(Li), i.forEach(Li), this.h(); + }, + h() { + wt(r, "attributeName", "transform"), wt(r, "type", "rotate"), wt(r, "from", "0 25 25"), wt(r, "to", "360 25 25"), wt(r, "repeatCount", "indefinite"), wt(t, "cx", "25"), wt(t, "cy", "25"), wt(t, "r", "20"), wt(t, "fill", "none"), wt(t, "stroke-width", "3.0"), wt(t, "stroke-linecap", "round"), wt(t, "stroke-dasharray", "94.2477796076938 94.2477796076938"), wt(t, "stroke-dashoffset", "0"), wt(e, "xmlns", "http://www.w3.org/2000/svg"), wt(e, "width", "100%"), wt(e, "height", "100%"), wt(e, "viewBox", "0 0 50 50"), wt(e, "class", "svelte-pb9pol"); + }, + m(a, i) { + D5(a, e, i), W1(e, t), W1(t, r); + }, + p: Ws, + i: Ws, + o: Ws, + d(a) { + a && Li(e); + } + }; +} +class Su extends y5 { + constructor(e) { + super(), k5(this, e, null, E5, A5, {}); + } +} +class u0 { + // The + prefix indicates that these fields aren't writeable + // Lexer holding the input string. + // Start offset, zero-based inclusive. + // End offset, zero-based exclusive. + constructor(e, t, r) { + this.lexer = void 0, this.start = void 0, this.end = void 0, this.lexer = e, this.start = t, this.end = r; + } + /** + * Merges two `SourceLocation`s from location providers, given they are + * provided in order of appearance. + * - Returns the first one's location if only the first is provided. + * - Returns a merged range of the first and the last if both are provided + * and their lexers match. + * - Otherwise, returns null. + */ + static range(e, t) { + return t ? !e || !e.loc || !t.loc || e.loc.lexer !== t.loc.lexer ? null : new u0(e.loc.lexer, e.loc.start, t.loc.end) : e && e.loc; + } +} +class S0 { + // don't expand the token + // used in \noexpand + constructor(e, t) { + this.text = void 0, this.loc = void 0, this.noexpand = void 0, this.treatAsRelax = void 0, this.text = e, this.loc = t; + } + /** + * Given a pair of tokens (this and endToken), compute a `Token` encompassing + * the whole input range enclosed by these two. + */ + range(e, t) { + return new S0(t, u0.range(this, e)); + } +} +class G { + // Error start position based on passed-in Token or ParseNode. + // Length of affected text based on passed-in Token or ParseNode. + // The underlying error message without any context added. + constructor(e, t) { + this.name = void 0, this.position = void 0, this.length = void 0, this.rawMessage = void 0; + var r = "KaTeX parse error: " + e, a, i, l = t && t.loc; + if (l && l.start <= l.end) { + var s = l.lexer.input; + a = l.start, i = l.end, a === s.length ? r += " at end of input: " : r += " at position " + (a + 1) + ": "; + var o = s.slice(a, i).replace(/[^]/g, "$&̲"), u; + a > 15 ? u = "…" + s.slice(a - 15, a) : u = s.slice(0, a); + var c; + i + 15 < s.length ? c = s.slice(i, i + 15) + "…" : c = s.slice(i), r += u + o + c; + } + var d = new Error(r); + return d.name = "ParseError", d.__proto__ = G.prototype, d.position = a, a != null && i != null && (d.length = i - a), d.rawMessage = e, d; + } +} +G.prototype.__proto__ = Error.prototype; +var S5 = function(e, t) { + return e.indexOf(t) !== -1; +}, x5 = function(e, t) { + return e === void 0 ? t : e; +}, T5 = /([A-Z])/g, C5 = function(e) { + return e.replace(T5, "-$1").toLowerCase(); +}, F5 = { + "&": "&", + ">": ">", + "<": "<", + '"': """, + "'": "'" +}, M5 = /[&><"']/g; +function z5(n) { + return String(n).replace(M5, (e) => F5[e]); +} +var Ed = function n(e) { + return e.type === "ordgroup" || e.type === "color" ? e.body.length === 1 ? n(e.body[0]) : e : e.type === "font" ? n(e.body) : e; +}, B5 = function(e) { + var t = Ed(e); + return t.type === "mathord" || t.type === "textord" || t.type === "atom"; +}, I5 = function(e) { + if (!e) + throw new Error("Expected non-null, but got " + String(e)); + return e; +}, L5 = function(e) { + var t = /^[\x00-\x20]*([^\\/#?]*?)(:|�*58|�*3a|&colon)/i.exec(e); + return t ? t[2] !== ":" || !/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1]) ? null : t[1].toLowerCase() : "_relative"; +}, re = { + contains: S5, + deflt: x5, + escape: z5, + hyphenate: C5, + getBaseElem: Ed, + isCharacterBox: B5, + protocolFromUrl: L5 +}, gl = { + displayMode: { + type: "boolean", + description: "Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.", + cli: "-d, --display-mode" + }, + output: { + type: { + enum: ["htmlAndMathml", "html", "mathml"] + }, + description: "Determines the markup language of the output.", + cli: "-F, --format " + }, + leqno: { + type: "boolean", + description: "Render display math in leqno style (left-justified tags)." + }, + fleqn: { + type: "boolean", + description: "Render display math flush left." + }, + throwOnError: { + type: "boolean", + default: !0, + cli: "-t, --no-throw-on-error", + cliDescription: "Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error." + }, + errorColor: { + type: "string", + default: "#cc0000", + cli: "-c, --error-color ", + cliDescription: "A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.", + cliProcessor: (n) => "#" + n + }, + macros: { + type: "object", + cli: "-m, --macro ", + cliDescription: "Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).", + cliDefault: [], + cliProcessor: (n, e) => (e.push(n), e) + }, + minRuleThickness: { + type: "number", + description: "Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.", + processor: (n) => Math.max(0, n), + cli: "--min-rule-thickness ", + cliProcessor: parseFloat + }, + colorIsTextColor: { + type: "boolean", + description: "Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.", + cli: "-b, --color-is-text-color" + }, + strict: { + type: [{ + enum: ["warn", "ignore", "error"] + }, "boolean", "function"], + description: "Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.", + cli: "-S, --strict", + cliDefault: !1 + }, + trust: { + type: ["boolean", "function"], + description: "Trust the input, enabling all HTML features such as \\url.", + cli: "-T, --trust" + }, + maxSize: { + type: "number", + default: 1 / 0, + description: "If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large", + processor: (n) => Math.max(0, n), + cli: "-s, --max-size ", + cliProcessor: parseInt + }, + maxExpand: { + type: "number", + default: 1e3, + description: "Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.", + processor: (n) => Math.max(0, n), + cli: "-e, --max-expand ", + cliProcessor: (n) => n === "Infinity" ? 1 / 0 : parseInt(n) + }, + globalGroup: { + type: "boolean", + cli: !1 + } +}; +function N5(n) { + if (n.default) + return n.default; + var e = n.type, t = Array.isArray(e) ? e[0] : e; + if (typeof t != "string") + return t.enum[0]; + switch (t) { + case "boolean": + return !1; + case "string": + return ""; + case "number": + return 0; + case "object": + return {}; + } +} +class xu { + constructor(e) { + this.displayMode = void 0, this.output = void 0, this.leqno = void 0, this.fleqn = void 0, this.throwOnError = void 0, this.errorColor = void 0, this.macros = void 0, this.minRuleThickness = void 0, this.colorIsTextColor = void 0, this.strict = void 0, this.trust = void 0, this.maxSize = void 0, this.maxExpand = void 0, this.globalGroup = void 0, e = e || {}; + for (var t in gl) + if (gl.hasOwnProperty(t)) { + var r = gl[t]; + this[t] = e[t] !== void 0 ? r.processor ? r.processor(e[t]) : e[t] : N5(r); + } + } + /** + * Report nonstrict (non-LaTeX-compatible) input. + * Can safely not be called if `this.strict` is false in JavaScript. + */ + reportNonstrict(e, t, r) { + var a = this.strict; + if (typeof a == "function" && (a = a(e, t, r)), !(!a || a === "ignore")) { + if (a === !0 || a === "error") + throw new G("LaTeX-incompatible input and strict mode is set to 'error': " + (t + " [" + e + "]"), r); + a === "warn" ? typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (t + " [" + e + "]")) : typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + a + "': " + t + " [" + e + "]")); + } + } + /** + * Check whether to apply strict (LaTeX-adhering) behavior for unusual + * input (like `\\`). Unlike `nonstrict`, will not throw an error; + * instead, "error" translates to a return value of `true`, while "ignore" + * translates to a return value of `false`. May still print a warning: + * "warn" prints a warning and returns `false`. + * This is for the second category of `errorCode`s listed in the README. + */ + useStrictBehavior(e, t, r) { + var a = this.strict; + if (typeof a == "function") + try { + a = a(e, t, r); + } catch { + a = "error"; + } + return !a || a === "ignore" ? !1 : a === !0 || a === "error" ? !0 : a === "warn" ? (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to 'warn': " + (t + " [" + e + "]")), !1) : (typeof console < "u" && console.warn("LaTeX-incompatible input and strict mode is set to " + ("unrecognized '" + a + "': " + t + " [" + e + "]")), !1); + } + /** + * Check whether to test potentially dangerous input, and return + * `true` (trusted) or `false` (untrusted). The sole argument `context` + * should be an object with `command` field specifying the relevant LaTeX + * command (as a string starting with `\`), and any other arguments, etc. + * If `context` has a `url` field, a `protocol` field will automatically + * get added by this function (changing the specified object). + */ + isTrusted(e) { + if (e.url && !e.protocol) { + var t = re.protocolFromUrl(e.url); + if (t == null) + return !1; + e.protocol = t; + } + var r = typeof this.trust == "function" ? this.trust(e) : this.trust; + return !!r; + } +} +class Xr { + constructor(e, t, r) { + this.id = void 0, this.size = void 0, this.cramped = void 0, this.id = e, this.size = t, this.cramped = r; + } + /** + * Get the style of a superscript given a base in the current style. + */ + sup() { + return $0[R5[this.id]]; + } + /** + * Get the style of a subscript given a base in the current style. + */ + sub() { + return $0[O5[this.id]]; + } + /** + * Get the style of a fraction numerator given the fraction in the current + * style. + */ + fracNum() { + return $0[q5[this.id]]; + } + /** + * Get the style of a fraction denominator given the fraction in the current + * style. + */ + fracDen() { + return $0[P5[this.id]]; + } + /** + * Get the cramped version of a style (in particular, cramping a cramped style + * doesn't change the style). + */ + cramp() { + return $0[H5[this.id]]; + } + /** + * Get a text or display version of this style. + */ + text() { + return $0[U5[this.id]]; + } + /** + * Return true if this style is tightly spaced (scriptstyle/scriptscriptstyle) + */ + isTight() { + return this.size >= 2; + } +} +var Tu = 0, xl = 1, ra = 2, Tr = 3, Xa = 4, k0 = 5, sa = 6, Vt = 7, $0 = [new Xr(Tu, 0, !1), new Xr(xl, 0, !0), new Xr(ra, 1, !1), new Xr(Tr, 1, !0), new Xr(Xa, 2, !1), new Xr(k0, 2, !0), new Xr(sa, 3, !1), new Xr(Vt, 3, !0)], R5 = [Xa, k0, Xa, k0, sa, Vt, sa, Vt], O5 = [k0, k0, k0, k0, Vt, Vt, Vt, Vt], q5 = [ra, Tr, Xa, k0, sa, Vt, sa, Vt], P5 = [Tr, Tr, k0, k0, Vt, Vt, Vt, Vt], H5 = [xl, xl, Tr, Tr, k0, k0, Vt, Vt], U5 = [Tu, xl, ra, Tr, ra, Tr, ra, Tr], ae = { + DISPLAY: $0[Tu], + TEXT: $0[ra], + SCRIPT: $0[Xa], + SCRIPTSCRIPT: $0[sa] +}, Xo = [{ + // Latin characters beyond the Latin-1 characters we have metrics for. + // Needed for Czech, Hungarian and Turkish text, for example. + name: "latin", + blocks: [ + [256, 591], + // Latin Extended-A and Latin Extended-B + [768, 879] + // Combining Diacritical marks + ] +}, { + // The Cyrillic script used by Russian and related languages. + // A Cyrillic subset used to be supported as explicitly defined + // symbols in symbols.js + name: "cyrillic", + blocks: [[1024, 1279]] +}, { + // Armenian + name: "armenian", + blocks: [[1328, 1423]] +}, { + // The Brahmic scripts of South and Southeast Asia + // Devanagari (0900–097F) + // Bengali (0980–09FF) + // Gurmukhi (0A00–0A7F) + // Gujarati (0A80–0AFF) + // Oriya (0B00–0B7F) + // Tamil (0B80–0BFF) + // Telugu (0C00–0C7F) + // Kannada (0C80–0CFF) + // Malayalam (0D00–0D7F) + // Sinhala (0D80–0DFF) + // Thai (0E00–0E7F) + // Lao (0E80–0EFF) + // Tibetan (0F00–0FFF) + // Myanmar (1000–109F) + name: "brahmic", + blocks: [[2304, 4255]] +}, { + name: "georgian", + blocks: [[4256, 4351]] +}, { + // Chinese and Japanese. + // The "k" in cjk is for Korean, but we've separated Korean out + name: "cjk", + blocks: [ + [12288, 12543], + // CJK symbols and punctuation, Hiragana, Katakana + [19968, 40879], + // CJK ideograms + [65280, 65376] + // Fullwidth punctuation + // TODO: add halfwidth Katakana and Romanji glyphs + ] +}, { + // Korean + name: "hangul", + blocks: [[44032, 55215]] +}]; +function V5(n) { + for (var e = 0; e < Xo.length; e++) + for (var t = Xo[e], r = 0; r < t.blocks.length; r++) { + var a = t.blocks[r]; + if (n >= a[0] && n <= a[1]) + return t.name; + } + return null; +} +var _l = []; +Xo.forEach((n) => n.blocks.forEach((e) => _l.push(...e))); +function Sd(n) { + for (var e = 0; e < _l.length; e += 2) + if (n >= _l[e] && n <= _l[e + 1]) + return !0; + return !1; +} +var Vn = 80, G5 = function(e, t) { + return "M95," + (622 + e + t) + ` +c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14 +c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54 +c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10 +s173,378,173,378c0.7,0,35.3,-71,104,-213c68.7,-142,137.5,-285,206.5,-429 +c69,-144,104.5,-217.7,106.5,-221 +l` + e / 2.075 + " -" + e + ` +c5.3,-9.3,12,-14,20,-14 +H400000v` + (40 + e) + `H845.2724 +s-225.272,467,-225.272,467s-235,486,-235,486c-2.7,4.7,-9,7,-19,7 +c-6,0,-10,-1,-12,-3s-194,-422,-194,-422s-65,47,-65,47z +M` + (834 + e) + " " + t + "h400000v" + (40 + e) + "h-400000z"; +}, j5 = function(e, t) { + return "M263," + (601 + e + t) + `c0.7,0,18,39.7,52,119 +c34,79.3,68.167,158.7,102.5,238c34.3,79.3,51.8,119.3,52.5,120 +c340,-704.7,510.7,-1060.3,512,-1067 +l` + e / 2.084 + " -" + e + ` +c4.7,-7.3,11,-11,19,-11 +H40000v` + (40 + e) + `H1012.3 +s-271.3,567,-271.3,567c-38.7,80.7,-84,175,-136,283c-52,108,-89.167,185.3,-111.5,232 +c-22.3,46.7,-33.8,70.3,-34.5,71c-4.7,4.7,-12.3,7,-23,7s-12,-1,-12,-1 +s-109,-253,-109,-253c-72.7,-168,-109.3,-252,-110,-252c-10.7,8,-22,16.7,-34,26 +c-22,17.3,-33.3,26,-34,26s-26,-26,-26,-26s76,-59,76,-59s76,-60,76,-60z +M` + (1001 + e) + " " + t + "h400000v" + (40 + e) + "h-400000z"; +}, W5 = function(e, t) { + return "M983 " + (10 + e + t) + ` +l` + e / 3.13 + " -" + e + ` +c4,-6.7,10,-10,18,-10 H400000v` + (40 + e) + ` +H1013.1s-83.4,268,-264.1,840c-180.7,572,-277,876.3,-289,913c-4.7,4.7,-12.7,7,-24,7 +s-12,0,-12,0c-1.3,-3.3,-3.7,-11.7,-7,-25c-35.3,-125.3,-106.7,-373.3,-214,-744 +c-10,12,-21,25,-33,39s-32,39,-32,39c-6,-5.3,-15,-14,-27,-26s25,-30,25,-30 +c26.7,-32.7,52,-63,76,-91s52,-60,52,-60s208,722,208,722 +c56,-175.3,126.3,-397.3,211,-666c84.7,-268.7,153.8,-488.2,207.5,-658.5 +c53.7,-170.3,84.5,-266.8,92.5,-289.5z +M` + (1001 + e) + " " + t + "h400000v" + (40 + e) + "h-400000z"; +}, X5 = function(e, t) { + return "M424," + (2398 + e + t) + ` +c-1.3,-0.7,-38.5,-172,-111.5,-514c-73,-342,-109.8,-513.3,-110.5,-514 +c0,-2,-10.7,14.3,-32,49c-4.7,7.3,-9.8,15.7,-15.5,25c-5.7,9.3,-9.8,16,-12.5,20 +s-5,7,-5,7c-4,-3.3,-8.3,-7.7,-13,-13s-13,-13,-13,-13s76,-122,76,-122s77,-121,77,-121 +s209,968,209,968c0,-2,84.7,-361.7,254,-1079c169.3,-717.3,254.7,-1077.7,256,-1081 +l` + e / 4.223 + " -" + e + `c4,-6.7,10,-10,18,-10 H400000 +v` + (40 + e) + `H1014.6 +s-87.3,378.7,-272.6,1166c-185.3,787.3,-279.3,1182.3,-282,1185 +c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2z M` + (1001 + e) + " " + t + ` +h400000v` + (40 + e) + "h-400000z"; +}, Y5 = function(e, t) { + return "M473," + (2713 + e + t) + ` +c339.3,-1799.3,509.3,-2700,510,-2702 l` + e / 5.298 + " -" + e + ` +c3.3,-7.3,9.3,-11,18,-11 H400000v` + (40 + e) + `H1017.7 +s-90.5,478,-276.2,1466c-185.7,988,-279.5,1483,-281.5,1485c-2,6,-10,9,-24,9 +c-8,0,-12,-0.7,-12,-2c0,-1.3,-5.3,-32,-16,-92c-50.7,-293.3,-119.7,-693.3,-207,-1200 +c0,-1.3,-5.3,8.7,-16,30c-10.7,21.3,-21.3,42.7,-32,64s-16,33,-16,33s-26,-26,-26,-26 +s76,-153,76,-153s77,-151,77,-151c0.7,0.7,35.7,202,105,604c67.3,400.7,102,602.7,104, +606zM` + (1001 + e) + " " + t + "h400000v" + (40 + e) + "H1017.7z"; +}, Z5 = function(e) { + var t = e / 2; + return "M400000 " + e + " H0 L" + t + " 0 l65 45 L145 " + (e - 80) + " H400000z"; +}, K5 = function(e, t, r) { + var a = r - 54 - t - e; + return "M702 " + (e + t) + "H400000" + (40 + e) + ` +H742v` + a + `l-4 4-4 4c-.667.7 -2 1.5-4 2.5s-4.167 1.833-6.5 2.5-5.5 1-9.5 1 +h-12l-28-84c-16.667-52-96.667 -294.333-240-727l-212 -643 -85 170 +c-4-3.333-8.333-7.667-13 -13l-13-13l77-155 77-156c66 199.333 139 419.667 +219 661 l218 661zM702 ` + t + "H400000v" + (40 + e) + "H742z"; +}, J5 = function(e, t, r) { + t = 1e3 * t; + var a = ""; + switch (e) { + case "sqrtMain": + a = G5(t, Vn); + break; + case "sqrtSize1": + a = j5(t, Vn); + break; + case "sqrtSize2": + a = W5(t, Vn); + break; + case "sqrtSize3": + a = X5(t, Vn); + break; + case "sqrtSize4": + a = Y5(t, Vn); + break; + case "sqrtTall": + a = K5(t, Vn, r); + } + return a; +}, Q5 = function(e, t) { + switch (e) { + case "⎜": + return "M291 0 H417 V" + t + " H291z M291 0 H417 V" + t + " H291z"; + case "∣": + return "M145 0 H188 V" + t + " H145z M145 0 H188 V" + t + " H145z"; + case "∥": + return "M145 0 H188 V" + t + " H145z M145 0 H188 V" + t + " H145z" + ("M367 0 H410 V" + t + " H367z M367 0 H410 V" + t + " H367z"); + case "⎟": + return "M457 0 H583 V" + t + " H457z M457 0 H583 V" + t + " H457z"; + case "⎢": + return "M319 0 H403 V" + t + " H319z M319 0 H403 V" + t + " H319z"; + case "⎥": + return "M263 0 H347 V" + t + " H263z M263 0 H347 V" + t + " H263z"; + case "⎪": + return "M384 0 H504 V" + t + " H384z M384 0 H504 V" + t + " H384z"; + case "⏐": + return "M312 0 H355 V" + t + " H312z M312 0 H355 V" + t + " H312z"; + case "‖": + return "M257 0 H300 V" + t + " H257z M257 0 H300 V" + t + " H257z" + ("M478 0 H521 V" + t + " H478z M478 0 H521 V" + t + " H478z"); + default: + return ""; + } +}, X1 = { + // The doubleleftarrow geometry is from glyph U+21D0 in the font KaTeX Main + doubleleftarrow: `M262 157 +l10-10c34-36 62.7-77 86-123 3.3-8 5-13.3 5-16 0-5.3-6.7-8-20-8-7.3 + 0-12.2.5-14.5 1.5-2.3 1-4.8 4.5-7.5 10.5-49.3 97.3-121.7 169.3-217 216-28 + 14-57.3 25-88 33-6.7 2-11 3.8-13 5.5-2 1.7-3 4.2-3 7.5s1 5.8 3 7.5 +c2 1.7 6.3 3.5 13 5.5 68 17.3 128.2 47.8 180.5 91.5 52.3 43.7 93.8 96.2 124.5 + 157.5 9.3 8 15.3 12.3 18 13h6c12-.7 18-4 18-10 0-2-1.7-7-5-15-23.3-46-52-87 +-86-123l-10-10h399738v-40H218c328 0 0 0 0 0l-10-8c-26.7-20-65.7-43-117-69 2.7 +-2 6-3.7 10-5 36.7-16 72.3-37.3 107-64l10-8h399782v-40z +m8 0v40h399730v-40zm0 194v40h399730v-40z`, + // doublerightarrow is from glyph U+21D2 in font KaTeX Main + doublerightarrow: `M399738 392l +-10 10c-34 36-62.7 77-86 123-3.3 8-5 13.3-5 16 0 5.3 6.7 8 20 8 7.3 0 12.2-.5 + 14.5-1.5 2.3-1 4.8-4.5 7.5-10.5 49.3-97.3 121.7-169.3 217-216 28-14 57.3-25 88 +-33 6.7-2 11-3.8 13-5.5 2-1.7 3-4.2 3-7.5s-1-5.8-3-7.5c-2-1.7-6.3-3.5-13-5.5-68 +-17.3-128.2-47.8-180.5-91.5-52.3-43.7-93.8-96.2-124.5-157.5-9.3-8-15.3-12.3-18 +-13h-6c-12 .7-18 4-18 10 0 2 1.7 7 5 15 23.3 46 52 87 86 123l10 10H0v40h399782 +c-328 0 0 0 0 0l10 8c26.7 20 65.7 43 117 69-2.7 2-6 3.7-10 5-36.7 16-72.3 37.3 +-107 64l-10 8H0v40zM0 157v40h399730v-40zm0 194v40h399730v-40z`, + // leftarrow is from glyph U+2190 in font KaTeX Main + leftarrow: `M400000 241H110l3-3c68.7-52.7 113.7-120 + 135-202 4-14.7 6-23 6-25 0-7.3-7-11-21-11-8 0-13.2.8-15.5 2.5-2.3 1.7-4.2 5.8 +-5.5 12.5-1.3 4.7-2.7 10.3-4 17-12 48.7-34.8 92-68.5 130S65.3 228.3 18 247 +c-10 4-16 7.7-18 11 0 8.7 6 14.3 18 17 47.3 18.7 87.8 47 121.5 85S196 441.3 208 + 490c.7 2 1.3 5 2 9s1.2 6.7 1.5 8c.3 1.3 1 3.3 2 6s2.2 4.5 3.5 5.5c1.3 1 3.3 + 1.8 6 2.5s6 1 10 1c14 0 21-3.7 21-11 0-2-2-10.3-6-25-20-79.3-65-146.7-135-202 + l-3-3h399890zM100 241v40h399900v-40z`, + // overbrace is from glyphs U+23A9/23A8/23A7 in font KaTeX_Size4-Regular + leftbrace: `M6 548l-6-6v-35l6-11c56-104 135.3-181.3 238-232 57.3-28.7 117 +-45 179-50h399577v120H403c-43.3 7-81 15-113 26-100.7 33-179.7 91-237 174-2.7 + 5-6 9-10 13-.7 1-7.3 1-20 1H6z`, + leftbraceunder: `M0 6l6-6h17c12.688 0 19.313.3 20 1 4 4 7.313 8.3 10 13 + 35.313 51.3 80.813 93.8 136.5 127.5 55.688 33.7 117.188 55.8 184.5 66.5.688 + 0 2 .3 4 1 18.688 2.7 76 4.3 172 5h399450v120H429l-6-1c-124.688-8-235-61.7 +-331-161C60.687 138.7 32.312 99.3 7 54L0 41V6z`, + // overgroup is from the MnSymbol package (public domain) + leftgroup: `M400000 80 +H435C64 80 168.3 229.4 21 260c-5.9 1.2-18 0-18 0-2 0-3-1-3-3v-38C76 61 257 0 + 435 0h399565z`, + leftgroupunder: `M400000 262 +H435C64 262 168.3 112.6 21 82c-5.9-1.2-18 0-18 0-2 0-3 1-3 3v38c76 158 257 219 + 435 219h399565z`, + // Harpoons are from glyph U+21BD in font KaTeX Main + leftharpoon: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3 +-3.3 10.2-9.5 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5 +-18.3 3-21-1.3-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7 +-196 228-6.7 4.7-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40z`, + leftharpoonplus: `M0 267c.7 5.3 3 10 7 14h399993v-40H93c3.3-3.3 10.2-9.5 + 20.5-18.5s17.8-15.8 22.5-20.5c50.7-52 88-110.3 112-175 4-11.3 5-18.3 3-21-1.3 +-4-7.3-6-18-6-8 0-13 .7-15 2s-4.7 6.7-8 16c-42 98.7-107.3 174.7-196 228-6.7 4.7 +-10.7 8-12 10-1.3 2-2 5.7-2 11zm100-26v40h399900v-40zM0 435v40h400000v-40z +m0 0v40h400000v-40z`, + leftharpoondown: `M7 241c-4 4-6.333 8.667-7 14 0 5.333.667 9 2 11s5.333 + 5.333 12 10c90.667 54 156 130 196 228 3.333 10.667 6.333 16.333 9 17 2 .667 5 + 1 9 1h5c10.667 0 16.667-2 18-6 2-2.667 1-9.667-3-21-32-87.333-82.667-157.667 +-152-211l-3-3h399907v-40zM93 281 H400000 v-40L7 241z`, + leftharpoondownplus: `M7 435c-4 4-6.3 8.7-7 14 0 5.3.7 9 2 11s5.3 5.3 12 + 10c90.7 54 156 130 196 228 3.3 10.7 6.3 16.3 9 17 2 .7 5 1 9 1h5c10.7 0 16.7 +-2 18-6 2-2.7 1-9.7-3-21-32-87.3-82.7-157.7-152-211l-3-3h399907v-40H7zm93 0 +v40h399900v-40zM0 241v40h399900v-40zm0 0v40h399900v-40z`, + // hook is from glyph U+21A9 in font KaTeX Main + lefthook: `M400000 281 H103s-33-11.2-61-33.5S0 197.3 0 164s14.2-61.2 42.5 +-83.5C70.8 58.2 104 47 142 47 c16.7 0 25 6.7 25 20 0 12-8.7 18.7-26 20-40 3.3 +-68.7 15.7-86 37-10 12-15 25.3-15 40 0 22.7 9.8 40.7 29.5 54 19.7 13.3 43.5 21 + 71.5 23h399859zM103 281v-40h399897v40z`, + leftlinesegment: `M40 281 V428 H0 V94 H40 V241 H400000 v40z +M40 281 V428 H0 V94 H40 V241 H400000 v40z`, + leftmapsto: `M40 281 V448H0V74H40V241H400000v40z +M40 281 V448H0V74H40V241H400000v40z`, + // tofrom is from glyph U+21C4 in font KaTeX AMS Regular + leftToFrom: `M0 147h400000v40H0zm0 214c68 40 115.7 95.7 143 167h22c15.3 0 23 +-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69-70-101l-7-8h399905v-40H95l7-8 +c28.7-32 52-65.7 70-101 10.7-23.3 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 265.3 + 68 321 0 361zm0-174v-40h399900v40zm100 154v40h399900v-40z`, + longequal: `M0 50 h400000 v40H0z m0 194h40000v40H0z +M0 50 h400000 v40H0z m0 194h40000v40H0z`, + midbrace: `M200428 334 +c-100.7-8.3-195.3-44-280-108-55.3-42-101.7-93-139-153l-9-14c-2.7 4-5.7 8.7-9 14 +-53.3 86.7-123.7 153-211 199-66.7 36-137.3 56.3-212 62H0V214h199568c178.3-11.7 + 311.7-78.3 403-201 6-8 9.7-12 11-12 .7-.7 6.7-1 18-1s17.3.3 18 1c1.3 0 5 4 11 + 12 44.7 59.3 101.3 106.3 170 141s145.3 54.3 229 60h199572v120z`, + midbraceunder: `M199572 214 +c100.7 8.3 195.3 44 280 108 55.3 42 101.7 93 139 153l9 14c2.7-4 5.7-8.7 9-14 + 53.3-86.7 123.7-153 211-199 66.7-36 137.3-56.3 212-62h199568v120H200432c-178.3 + 11.7-311.7 78.3-403 201-6 8-9.7 12-11 12-.7.7-6.7 1-18 1s-17.3-.3-18-1c-1.3 0 +-5-4-11-12-44.7-59.3-101.3-106.3-170-141s-145.3-54.3-229-60H0V214z`, + oiintSize1: `M512.6 71.6c272.6 0 320.3 106.8 320.3 178.2 0 70.8-47.7 177.6 +-320.3 177.6S193.1 320.6 193.1 249.8c0-71.4 46.9-178.2 319.5-178.2z +m368.1 178.2c0-86.4-60.9-215.4-368.1-215.4-306.4 0-367.3 129-367.3 215.4 0 85.8 +60.9 214.8 367.3 214.8 307.2 0 368.1-129 368.1-214.8z`, + oiintSize2: `M757.8 100.1c384.7 0 451.1 137.6 451.1 230 0 91.3-66.4 228.8 +-451.1 228.8-386.3 0-452.7-137.5-452.7-228.8 0-92.4 66.4-230 452.7-230z +m502.4 230c0-111.2-82.4-277.2-502.4-277.2s-504 166-504 277.2 +c0 110 84 276 504 276s502.4-166 502.4-276z`, + oiiintSize1: `M681.4 71.6c408.9 0 480.5 106.8 480.5 178.2 0 70.8-71.6 177.6 +-480.5 177.6S202.1 320.6 202.1 249.8c0-71.4 70.5-178.2 479.3-178.2z +m525.8 178.2c0-86.4-86.8-215.4-525.7-215.4-437.9 0-524.7 129-524.7 215.4 0 +85.8 86.8 214.8 524.7 214.8 438.9 0 525.7-129 525.7-214.8z`, + oiiintSize2: `M1021.2 53c603.6 0 707.8 165.8 707.8 277.2 0 110-104.2 275.8 +-707.8 275.8-606 0-710.2-165.8-710.2-275.8C311 218.8 415.2 53 1021.2 53z +m770.4 277.1c0-131.2-126.4-327.6-770.5-327.6S248.4 198.9 248.4 330.1 +c0 130 128.8 326.4 772.7 326.4s770.5-196.4 770.5-326.4z`, + rightarrow: `M0 241v40h399891c-47.3 35.3-84 78-110 128 +-16.7 32-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 + 11 8 0 13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 + 39-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85 +-40.5-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 + 151.7 139 205zm0 0v40h399900v-40z`, + rightbrace: `M400000 542l +-6 6h-17c-12.7 0-19.3-.3-20-1-4-4-7.3-8.3-10-13-35.3-51.3-80.8-93.8-136.5-127.5 +s-117.2-55.8-184.5-66.5c-.7 0-2-.3-4-1-18.7-2.7-76-4.3-172-5H0V214h399571l6 1 +c124.7 8 235 61.7 331 161 31.3 33.3 59.7 72.7 85 118l7 13v35z`, + rightbraceunder: `M399994 0l6 6v35l-6 11c-56 104-135.3 181.3-238 232-57.3 + 28.7-117 45-179 50H-300V214h399897c43.3-7 81-15 113-26 100.7-33 179.7-91 237 +-174 2.7-5 6-9 10-13 .7-1 7.3-1 20-1h17z`, + rightgroup: `M0 80h399565c371 0 266.7 149.4 414 180 5.9 1.2 18 0 18 0 2 0 + 3-1 3-3v-38c-76-158-257-219-435-219H0z`, + rightgroupunder: `M0 262h399565c371 0 266.7-149.4 414-180 5.9-1.2 18 0 18 + 0 2 0 3 1 3 3v38c-76 158-257 219-435 219H0z`, + rightharpoon: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3 +-3.7-15.3-11-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2 +-10.7 0-16.7 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 + 69.2 92 94.5zm0 0v40h399900v-40z`, + rightharpoonplus: `M0 241v40h399993c4.7-4.7 7-9.3 7-14 0-9.3-3.7-15.3-11 +-18-92.7-56.7-159-133.7-199-231-3.3-9.3-6-14.7-8-16-2-1.3-7-2-15-2-10.7 0-16.7 + 2-18 6-2 2.7-1 9.7 3 21 15.3 42 36.7 81.8 64 119.5 27.3 37.7 58 69.2 92 94.5z +m0 0v40h399900v-40z m100 194v40h399900v-40zm0 0v40h399900v-40z`, + rightharpoondown: `M399747 511c0 7.3 6.7 11 20 11 8 0 13-.8 15-2.5s4.7-6.8 + 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 8.5-5.8 9.5 +-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3-64.7 57-92 95 +-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 241v40h399900v-40z`, + rightharpoondownplus: `M399747 705c0 7.3 6.7 11 20 11 8 0 13-.8 + 15-2.5s4.7-6.8 8-15.5c40-94 99.3-166.3 178-217 13.3-8 20.3-12.3 21-13 5.3-3.3 + 8.5-5.8 9.5-7.5 1-1.7 1.5-5.2 1.5-10.5s-2.3-10.3-7-15H0v40h399908c-34 25.3 +-64.7 57-92 95-27.3 38-48.7 77.7-64 119-3.3 8.7-5 14-5 16zM0 435v40h399900v-40z +m0-194v40h400000v-40zm0 0v40h400000v-40z`, + righthook: `M399859 241c-764 0 0 0 0 0 40-3.3 68.7-15.7 86-37 10-12 15-25.3 + 15-40 0-22.7-9.8-40.7-29.5-54-19.7-13.3-43.5-21-71.5-23-17.3-1.3-26-8-26-20 0 +-13.3 8.7-20 26-20 38 0 71 11.2 99 33.5 0 0 7 5.6 21 16.7 14 11.2 21 33.5 21 + 66.8s-14 61.2-42 83.5c-28 22.3-61 33.5-99 33.5L0 241z M0 281v-40h399859v40z`, + rightlinesegment: `M399960 241 V94 h40 V428 h-40 V281 H0 v-40z +M399960 241 V94 h40 V428 h-40 V281 H0 v-40z`, + rightToFrom: `M400000 167c-70.7-42-118-97.7-142-167h-23c-15.3 0-23 .3-23 + 1 0 1.3 5.3 13.7 16 37 18 35.3 41.3 69 70 101l7 8H0v40h399905l-7 8c-28.7 32 +-52 65.7-70 101-10.7 23.3-16 35.7-16 37 0 .7 7.7 1 23 1h23c24-69.3 71.3-125 142 +-167z M100 147v40h399900v-40zM0 341v40h399900v-40z`, + // twoheadleftarrow is from glyph U+219E in font KaTeX AMS Regular + twoheadleftarrow: `M0 167c68 40 + 115.7 95.7 143 167h22c15.3 0 23-.3 23-1 0-1.3-5.3-13.7-16-37-18-35.3-41.3-69 +-70-101l-7-8h125l9 7c50.7 39.3 85 86 103 140h46c0-4.7-6.3-18.7-19-42-18-35.3 +-40-67.3-66-96l-9-9h399716v-40H284l9-9c26-28.7 48-60.7 66-96 12.7-23.333 19 +-37.333 19-42h-46c-18 54-52.3 100.7-103 140l-9 7H95l7-8c28.7-32 52-65.7 70-101 + 10.7-23.333 16-35.7 16-37 0-.7-7.7-1-23-1h-22C115.7 71.3 68 127 0 167z`, + twoheadrightarrow: `M400000 167 +c-68-40-115.7-95.7-143-167h-22c-15.3 0-23 .3-23 1 0 1.3 5.3 13.7 16 37 18 35.3 + 41.3 69 70 101l7 8h-125l-9-7c-50.7-39.3-85-86-103-140h-46c0 4.7 6.3 18.7 19 42 + 18 35.3 40 67.3 66 96l9 9H0v40h399716l-9 9c-26 28.7-48 60.7-66 96-12.7 23.333 +-19 37.333-19 42h46c18-54 52.3-100.7 103-140l9-7h125l-7 8c-28.7 32-52 65.7-70 + 101-10.7 23.333-16 35.7-16 37 0 .7 7.7 1 23 1h22c27.3-71.3 75-127 143-167z`, + // tilde1 is a modified version of a glyph from the MnSymbol package + tilde1: `M200 55.538c-77 0-168 73.953-177 73.953-3 0-7 +-2.175-9-5.437L2 97c-1-2-2-4-2-6 0-4 2-7 5-9l20-12C116 12 171 0 207 0c86 0 + 114 68 191 68 78 0 168-68 177-68 4 0 7 2 9 5l12 19c1 2.175 2 4.35 2 6.525 0 + 4.35-2 7.613-5 9.788l-19 13.05c-92 63.077-116.937 75.308-183 76.128 +-68.267.847-113-73.952-191-73.952z`, + // ditto tilde2, tilde3, & tilde4 + tilde2: `M344 55.266c-142 0-300.638 81.316-311.5 86.418 +-8.01 3.762-22.5 10.91-23.5 5.562L1 120c-1-2-1-3-1-4 0-5 3-9 8-10l18.4-9C160.9 + 31.9 283 0 358 0c148 0 188 122 331 122s314-97 326-97c4 0 8 2 10 7l7 21.114 +c1 2.14 1 3.21 1 4.28 0 5.347-3 9.626-7 10.696l-22.3 12.622C852.6 158.372 751 + 181.476 676 181.476c-149 0-189-126.21-332-126.21z`, + tilde3: `M786 59C457 59 32 175.242 13 175.242c-6 0-10-3.457 +-11-10.37L.15 138c-1-7 3-12 10-13l19.2-6.4C378.4 40.7 634.3 0 804.3 0c337 0 + 411.8 157 746.8 157 328 0 754-112 773-112 5 0 10 3 11 9l1 14.075c1 8.066-.697 + 16.595-6.697 17.492l-21.052 7.31c-367.9 98.146-609.15 122.696-778.15 122.696 + -338 0-409-156.573-744-156.573z`, + tilde4: `M786 58C457 58 32 177.487 13 177.487c-6 0-10-3.345 +-11-10.035L.15 143c-1-7 3-12 10-13l22-6.7C381.2 35 637.15 0 807.15 0c337 0 409 + 177 744 177 328 0 754-127 773-127 5 0 10 3 11 9l1 14.794c1 7.805-3 13.38-9 + 14.495l-20.7 5.574c-366.85 99.79-607.3 139.372-776.3 139.372-338 0-409 + -175.236-744-175.236z`, + // vec is from glyph U+20D7 in font KaTeX Main + vec: `M377 20c0-5.333 1.833-10 5.5-14S391 0 397 0c4.667 0 8.667 1.667 12 5 +3.333 2.667 6.667 9 10 19 6.667 24.667 20.333 43.667 41 57 7.333 4.667 11 +10.667 11 18 0 6-1 10-3 12s-6.667 5-14 9c-28.667 14.667-53.667 35.667-75 63 +-1.333 1.333-3.167 3.5-5.5 6.5s-4 4.833-5 5.5c-1 .667-2.5 1.333-4.5 2s-4.333 1 +-7 1c-4.667 0-9.167-1.833-13.5-5.5S337 184 337 178c0-12.667 15.667-32.333 47-59 +H213l-171-1c-8.667-6-13-12.333-13-19 0-4.667 4.333-11.333 13-20h359 +c-16-25.333-24-45-24-59z`, + // widehat1 is a modified version of a glyph from the MnSymbol package + widehat1: `M529 0h5l519 115c5 1 9 5 9 10 0 1-1 2-1 3l-4 22 +c-1 5-5 9-11 9h-2L532 67 19 159h-2c-5 0-9-4-11-9l-5-22c-1-6 2-12 8-13z`, + // ditto widehat2, widehat3, & widehat4 + widehat2: `M1181 0h2l1171 176c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 220h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + widehat3: `M1181 0h2l1171 236c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 280h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + widehat4: `M1181 0h2l1171 296c6 0 10 5 10 11l-2 23c-1 6-5 10 +-11 10h-1L1182 67 15 340h-1c-6 0-10-4-11-10l-2-23c-1-6 4-11 10-11z`, + // widecheck paths are all inverted versions of widehat + widecheck1: `M529,159h5l519,-115c5,-1,9,-5,9,-10c0,-1,-1,-2,-1,-3l-4,-22c-1, +-5,-5,-9,-11,-9h-2l-512,92l-513,-92h-2c-5,0,-9,4,-11,9l-5,22c-1,6,2,12,8,13z`, + widecheck2: `M1181,220h2l1171,-176c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,153l-1167,-153h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + widecheck3: `M1181,280h2l1171,-236c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,213l-1167,-213h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + widecheck4: `M1181,340h2l1171,-296c6,0,10,-5,10,-11l-2,-23c-1,-6,-5,-10, +-11,-10h-1l-1168,273l-1167,-273h-1c-6,0,-10,4,-11,10l-2,23c-1,6,4,11,10,11z`, + // The next ten paths support reaction arrows from the mhchem package. + // Arrows for \ce{<-->} are offset from xAxis by 0.22ex, per mhchem in LaTeX + // baraboveleftarrow is mostly from glyph U+2190 in font KaTeX Main + baraboveleftarrow: `M400000 620h-399890l3 -3c68.7 -52.7 113.7 -120 135 -202 +c4 -14.7 6 -23 6 -25c0 -7.3 -7 -11 -21 -11c-8 0 -13.2 0.8 -15.5 2.5 +c-2.3 1.7 -4.2 5.8 -5.5 12.5c-1.3 4.7 -2.7 10.3 -4 17c-12 48.7 -34.8 92 -68.5 130 +s-74.2 66.3 -121.5 85c-10 4 -16 7.7 -18 11c0 8.7 6 14.3 18 17c47.3 18.7 87.8 47 +121.5 85s56.5 81.3 68.5 130c0.7 2 1.3 5 2 9s1.2 6.7 1.5 8c0.3 1.3 1 3.3 2 6 +s2.2 4.5 3.5 5.5c1.3 1 3.3 1.8 6 2.5s6 1 10 1c14 0 21 -3.7 21 -11 +c0 -2 -2 -10.3 -6 -25c-20 -79.3 -65 -146.7 -135 -202l-3 -3h399890z +M100 620v40h399900v-40z M0 241v40h399900v-40zM0 241v40h399900v-40z`, + // rightarrowabovebar is mostly from glyph U+2192, KaTeX Main + rightarrowabovebar: `M0 241v40h399891c-47.3 35.3-84 78-110 128-16.7 32 +-27.7 63.7-33 95 0 1.3-.2 2.7-.5 4-.3 1.3-.5 2.3-.5 3 0 7.3 6.7 11 20 11 8 0 +13.2-.8 15.5-2.5 2.3-1.7 4.2-5.5 5.5-11.5 2-13.3 5.7-27 11-41 14.7-44.7 39 +-84.5 73-119.5s73.7-60.2 119-75.5c6-2 9-5.7 9-11s-3-9-9-11c-45.3-15.3-85-40.5 +-119-75.5s-58.3-74.8-73-119.5c-4.7-14-8.3-27.3-11-40-1.3-6.7-3.2-10.8-5.5 +-12.5-2.3-1.7-7.5-2.5-15.5-2.5-14 0-21 3.7-21 11 0 2 2 10.3 6 25 20.7 83.3 67 +151.7 139 205zm96 379h399894v40H0zm0 0h399904v40H0z`, + // The short left harpoon has 0.5em (i.e. 500 units) kern on the left end. + // Ref from mhchem.sty: \rlap{\raisebox{-.22ex}{$\kern0.5em + baraboveshortleftharpoon: `M507,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17 +c2,0.7,5,1,9,1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21 +c-32,-87.3,-82.7,-157.7,-152,-211c0,0,-3,-3,-3,-3l399351,0l0,-40 +c-398570,0,-399437,0,-399437,0z M593 435 v40 H399500 v-40z +M0 281 v-40 H399908 v40z M0 281 v-40 H399908 v40z`, + rightharpoonaboveshortbar: `M0,241 l0,40c399126,0,399993,0,399993,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M0 241 v40 H399908 v-40z M0 475 v-40 H399500 v40z M0 475 v-40 H399500 v40z`, + shortbaraboveleftharpoon: `M7,435c-4,4,-6.3,8.7,-7,14c0,5.3,0.7,9,2,11 +c1.3,2,5.3,5.3,12,10c90.7,54,156,130,196,228c3.3,10.7,6.3,16.3,9,17c2,0.7,5,1,9, +1c0,0,5,0,5,0c10.7,0,16.7,-2,18,-6c2,-2.7,1,-9.7,-3,-21c-32,-87.3,-82.7,-157.7, +-152,-211c0,0,-3,-3,-3,-3l399907,0l0,-40c-399126,0,-399993,0,-399993,0z +M93 435 v40 H400000 v-40z M500 241 v40 H400000 v-40z M500 241 v40 H400000 v-40z`, + shortrightharpoonabovebar: `M53,241l0,40c398570,0,399437,0,399437,0 +c4.7,-4.7,7,-9.3,7,-14c0,-9.3,-3.7,-15.3,-11,-18c-92.7,-56.7,-159,-133.7,-199, +-231c-3.3,-9.3,-6,-14.7,-8,-16c-2,-1.3,-7,-2,-15,-2c-10.7,0,-16.7,2,-18,6 +c-2,2.7,-1,9.7,3,21c15.3,42,36.7,81.8,64,119.5c27.3,37.7,58,69.2,92,94.5z +M500 241 v40 H399408 v-40z M500 435 v40 H400000 v-40z` +}, $5 = function(e, t) { + switch (e) { + case "lbrack": + return "M403 1759 V84 H666 V0 H319 V1759 v" + t + ` v1759 h347 v-84 +H403z M403 1759 V0 H319 V1759 v` + t + " v1759 h84z"; + case "rbrack": + return "M347 1759 V0 H0 V84 H263 V1759 v" + t + ` v1759 H0 v84 H347z +M347 1759 V0 H263 V1759 v` + t + " v1759 h84z"; + case "vert": + return "M145 15 v585 v" + t + ` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + t + " v585 h43z"; + case "doublevert": + return "M145 15 v585 v" + t + ` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M188 15 H145 v585 v` + t + ` v585 h43z +M367 15 v585 v` + t + ` v585 c2.667,10,9.667,15,21,15 +c10,0,16.667,-5,20,-15 v-585 v` + -t + ` v-585 c-2.667,-10,-9.667,-15,-21,-15 +c-10,0,-16.667,5,-20,15z M410 15 H367 v585 v` + t + " v585 h43z"; + case "lfloor": + return "M319 602 V0 H403 V602 v" + t + ` v1715 h263 v84 H319z +MM319 602 V0 H403 V602 v` + t + " v1715 H319z"; + case "rfloor": + return "M319 602 V0 H403 V602 v" + t + ` v1799 H0 v-84 H319z +MM319 602 V0 H403 V602 v` + t + " v1715 H319z"; + case "lceil": + return "M403 1759 V84 H666 V0 H319 V1759 v" + t + ` v602 h84z +M403 1759 V0 H319 V1759 v` + t + " v602 h84z"; + case "rceil": + return "M347 1759 V0 H0 V84 H263 V1759 v" + t + ` v602 h84z +M347 1759 V0 h-84 V1759 v` + t + " v602 h84z"; + case "lparen": + return `M863,9c0,-2,-2,-5,-6,-9c0,0,-17,0,-17,0c-12.7,0,-19.3,0.3,-20,1 +c-5.3,5.3,-10.3,11,-15,17c-242.7,294.7,-395.3,682,-458,1162c-21.3,163.3,-33.3,349, +-36,557 l0,` + (t + 84) + `c0.2,6,0,26,0,60c2,159.3,10,310.7,24,454c53.3,528,210, +949.7,470,1265c4.7,6,9.7,11.7,15,17c0.7,0.7,7,1,19,1c0,0,18,0,18,0c4,-4,6,-7,6,-9 +c0,-2.7,-3.3,-8.7,-10,-18c-135.3,-192.7,-235.5,-414.3,-300.5,-665c-65,-250.7,-102.5, +-544.7,-112.5,-882c-2,-104,-3,-167,-3,-189 +l0,-` + (t + 92) + `c0,-162.7,5.7,-314,17,-454c20.7,-272,63.7,-513,129,-723c65.3, +-210,155.3,-396.3,270,-559c6.7,-9.3,10,-15.3,10,-18z`; + case "rparen": + return `M76,0c-16.7,0,-25,3,-25,9c0,2,2,6.3,6,13c21.3,28.7,42.3,60.3, +63,95c96.7,156.7,172.8,332.5,228.5,527.5c55.7,195,92.8,416.5,111.5,664.5 +c11.3,139.3,17,290.7,17,454c0,28,1.7,43,3.3,45l0,` + (t + 9) + ` +c-3,4,-3.3,16.7,-3.3,38c0,162,-5.7,313.7,-17,455c-18.7,248,-55.8,469.3,-111.5,664 +c-55.7,194.7,-131.8,370.3,-228.5,527c-20.7,34.7,-41.7,66.3,-63,95c-2,3.3,-4,7,-6,11 +c0,7.3,5.7,11,17,11c0,0,11,0,11,0c9.3,0,14.3,-0.3,15,-1c5.3,-5.3,10.3,-11,15,-17 +c242.7,-294.7,395.3,-681.7,458,-1161c21.3,-164.7,33.3,-350.7,36,-558 +l0,-` + (t + 144) + `c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7, +-470,-1265c-4.7,-6,-9.7,-11.7,-15,-17c-0.7,-0.7,-6.7,-1,-18,-1z`; + default: + throw new Error("Unknown stretchy delimiter."); + } +}; +class ti { + // HtmlDomNode + // Never used; needed for satisfying interface. + constructor(e) { + this.children = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.children = e, this.classes = [], this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = {}; + } + hasClass(e) { + return re.contains(this.classes, e); + } + /** Convert the fragment into a node. */ + toNode() { + for (var e = document.createDocumentFragment(), t = 0; t < this.children.length; t++) + e.appendChild(this.children[t].toNode()); + return e; + } + /** Convert the fragment into HTML markup. */ + toMarkup() { + for (var e = "", t = 0; t < this.children.length; t++) + e += this.children[t].toMarkup(); + return e; + } + /** + * Converts the math node into a string, similar to innerText. Applies to + * MathDomNode's only. + */ + toText() { + var e = (t) => t.toText(); + return this.children.map(e).join(""); + } +} +var rr = { + "AMS-Regular": { + 32: [0, 0, 0, 0, 0.25], + 65: [0, 0.68889, 0, 0, 0.72222], + 66: [0, 0.68889, 0, 0, 0.66667], + 67: [0, 0.68889, 0, 0, 0.72222], + 68: [0, 0.68889, 0, 0, 0.72222], + 69: [0, 0.68889, 0, 0, 0.66667], + 70: [0, 0.68889, 0, 0, 0.61111], + 71: [0, 0.68889, 0, 0, 0.77778], + 72: [0, 0.68889, 0, 0, 0.77778], + 73: [0, 0.68889, 0, 0, 0.38889], + 74: [0.16667, 0.68889, 0, 0, 0.5], + 75: [0, 0.68889, 0, 0, 0.77778], + 76: [0, 0.68889, 0, 0, 0.66667], + 77: [0, 0.68889, 0, 0, 0.94445], + 78: [0, 0.68889, 0, 0, 0.72222], + 79: [0.16667, 0.68889, 0, 0, 0.77778], + 80: [0, 0.68889, 0, 0, 0.61111], + 81: [0.16667, 0.68889, 0, 0, 0.77778], + 82: [0, 0.68889, 0, 0, 0.72222], + 83: [0, 0.68889, 0, 0, 0.55556], + 84: [0, 0.68889, 0, 0, 0.66667], + 85: [0, 0.68889, 0, 0, 0.72222], + 86: [0, 0.68889, 0, 0, 0.72222], + 87: [0, 0.68889, 0, 0, 1], + 88: [0, 0.68889, 0, 0, 0.72222], + 89: [0, 0.68889, 0, 0, 0.72222], + 90: [0, 0.68889, 0, 0, 0.66667], + 107: [0, 0.68889, 0, 0, 0.55556], + 160: [0, 0, 0, 0, 0.25], + 165: [0, 0.675, 0.025, 0, 0.75], + 174: [0.15559, 0.69224, 0, 0, 0.94666], + 240: [0, 0.68889, 0, 0, 0.55556], + 295: [0, 0.68889, 0, 0, 0.54028], + 710: [0, 0.825, 0, 0, 2.33334], + 732: [0, 0.9, 0, 0, 2.33334], + 770: [0, 0.825, 0, 0, 2.33334], + 771: [0, 0.9, 0, 0, 2.33334], + 989: [0.08167, 0.58167, 0, 0, 0.77778], + 1008: [0, 0.43056, 0.04028, 0, 0.66667], + 8245: [0, 0.54986, 0, 0, 0.275], + 8463: [0, 0.68889, 0, 0, 0.54028], + 8487: [0, 0.68889, 0, 0, 0.72222], + 8498: [0, 0.68889, 0, 0, 0.55556], + 8502: [0, 0.68889, 0, 0, 0.66667], + 8503: [0, 0.68889, 0, 0, 0.44445], + 8504: [0, 0.68889, 0, 0, 0.66667], + 8513: [0, 0.68889, 0, 0, 0.63889], + 8592: [-0.03598, 0.46402, 0, 0, 0.5], + 8594: [-0.03598, 0.46402, 0, 0, 0.5], + 8602: [-0.13313, 0.36687, 0, 0, 1], + 8603: [-0.13313, 0.36687, 0, 0, 1], + 8606: [0.01354, 0.52239, 0, 0, 1], + 8608: [0.01354, 0.52239, 0, 0, 1], + 8610: [0.01354, 0.52239, 0, 0, 1.11111], + 8611: [0.01354, 0.52239, 0, 0, 1.11111], + 8619: [0, 0.54986, 0, 0, 1], + 8620: [0, 0.54986, 0, 0, 1], + 8621: [-0.13313, 0.37788, 0, 0, 1.38889], + 8622: [-0.13313, 0.36687, 0, 0, 1], + 8624: [0, 0.69224, 0, 0, 0.5], + 8625: [0, 0.69224, 0, 0, 0.5], + 8630: [0, 0.43056, 0, 0, 1], + 8631: [0, 0.43056, 0, 0, 1], + 8634: [0.08198, 0.58198, 0, 0, 0.77778], + 8635: [0.08198, 0.58198, 0, 0, 0.77778], + 8638: [0.19444, 0.69224, 0, 0, 0.41667], + 8639: [0.19444, 0.69224, 0, 0, 0.41667], + 8642: [0.19444, 0.69224, 0, 0, 0.41667], + 8643: [0.19444, 0.69224, 0, 0, 0.41667], + 8644: [0.1808, 0.675, 0, 0, 1], + 8646: [0.1808, 0.675, 0, 0, 1], + 8647: [0.1808, 0.675, 0, 0, 1], + 8648: [0.19444, 0.69224, 0, 0, 0.83334], + 8649: [0.1808, 0.675, 0, 0, 1], + 8650: [0.19444, 0.69224, 0, 0, 0.83334], + 8651: [0.01354, 0.52239, 0, 0, 1], + 8652: [0.01354, 0.52239, 0, 0, 1], + 8653: [-0.13313, 0.36687, 0, 0, 1], + 8654: [-0.13313, 0.36687, 0, 0, 1], + 8655: [-0.13313, 0.36687, 0, 0, 1], + 8666: [0.13667, 0.63667, 0, 0, 1], + 8667: [0.13667, 0.63667, 0, 0, 1], + 8669: [-0.13313, 0.37788, 0, 0, 1], + 8672: [-0.064, 0.437, 0, 0, 1.334], + 8674: [-0.064, 0.437, 0, 0, 1.334], + 8705: [0, 0.825, 0, 0, 0.5], + 8708: [0, 0.68889, 0, 0, 0.55556], + 8709: [0.08167, 0.58167, 0, 0, 0.77778], + 8717: [0, 0.43056, 0, 0, 0.42917], + 8722: [-0.03598, 0.46402, 0, 0, 0.5], + 8724: [0.08198, 0.69224, 0, 0, 0.77778], + 8726: [0.08167, 0.58167, 0, 0, 0.77778], + 8733: [0, 0.69224, 0, 0, 0.77778], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8737: [0, 0.69224, 0, 0, 0.72222], + 8738: [0.03517, 0.52239, 0, 0, 0.72222], + 8739: [0.08167, 0.58167, 0, 0, 0.22222], + 8740: [0.25142, 0.74111, 0, 0, 0.27778], + 8741: [0.08167, 0.58167, 0, 0, 0.38889], + 8742: [0.25142, 0.74111, 0, 0, 0.5], + 8756: [0, 0.69224, 0, 0, 0.66667], + 8757: [0, 0.69224, 0, 0, 0.66667], + 8764: [-0.13313, 0.36687, 0, 0, 0.77778], + 8765: [-0.13313, 0.37788, 0, 0, 0.77778], + 8769: [-0.13313, 0.36687, 0, 0, 0.77778], + 8770: [-0.03625, 0.46375, 0, 0, 0.77778], + 8774: [0.30274, 0.79383, 0, 0, 0.77778], + 8776: [-0.01688, 0.48312, 0, 0, 0.77778], + 8778: [0.08167, 0.58167, 0, 0, 0.77778], + 8782: [0.06062, 0.54986, 0, 0, 0.77778], + 8783: [0.06062, 0.54986, 0, 0, 0.77778], + 8785: [0.08198, 0.58198, 0, 0, 0.77778], + 8786: [0.08198, 0.58198, 0, 0, 0.77778], + 8787: [0.08198, 0.58198, 0, 0, 0.77778], + 8790: [0, 0.69224, 0, 0, 0.77778], + 8791: [0.22958, 0.72958, 0, 0, 0.77778], + 8796: [0.08198, 0.91667, 0, 0, 0.77778], + 8806: [0.25583, 0.75583, 0, 0, 0.77778], + 8807: [0.25583, 0.75583, 0, 0, 0.77778], + 8808: [0.25142, 0.75726, 0, 0, 0.77778], + 8809: [0.25142, 0.75726, 0, 0, 0.77778], + 8812: [0.25583, 0.75583, 0, 0, 0.5], + 8814: [0.20576, 0.70576, 0, 0, 0.77778], + 8815: [0.20576, 0.70576, 0, 0, 0.77778], + 8816: [0.30274, 0.79383, 0, 0, 0.77778], + 8817: [0.30274, 0.79383, 0, 0, 0.77778], + 8818: [0.22958, 0.72958, 0, 0, 0.77778], + 8819: [0.22958, 0.72958, 0, 0, 0.77778], + 8822: [0.1808, 0.675, 0, 0, 0.77778], + 8823: [0.1808, 0.675, 0, 0, 0.77778], + 8828: [0.13667, 0.63667, 0, 0, 0.77778], + 8829: [0.13667, 0.63667, 0, 0, 0.77778], + 8830: [0.22958, 0.72958, 0, 0, 0.77778], + 8831: [0.22958, 0.72958, 0, 0, 0.77778], + 8832: [0.20576, 0.70576, 0, 0, 0.77778], + 8833: [0.20576, 0.70576, 0, 0, 0.77778], + 8840: [0.30274, 0.79383, 0, 0, 0.77778], + 8841: [0.30274, 0.79383, 0, 0, 0.77778], + 8842: [0.13597, 0.63597, 0, 0, 0.77778], + 8843: [0.13597, 0.63597, 0, 0, 0.77778], + 8847: [0.03517, 0.54986, 0, 0, 0.77778], + 8848: [0.03517, 0.54986, 0, 0, 0.77778], + 8858: [0.08198, 0.58198, 0, 0, 0.77778], + 8859: [0.08198, 0.58198, 0, 0, 0.77778], + 8861: [0.08198, 0.58198, 0, 0, 0.77778], + 8862: [0, 0.675, 0, 0, 0.77778], + 8863: [0, 0.675, 0, 0, 0.77778], + 8864: [0, 0.675, 0, 0, 0.77778], + 8865: [0, 0.675, 0, 0, 0.77778], + 8872: [0, 0.69224, 0, 0, 0.61111], + 8873: [0, 0.69224, 0, 0, 0.72222], + 8874: [0, 0.69224, 0, 0, 0.88889], + 8876: [0, 0.68889, 0, 0, 0.61111], + 8877: [0, 0.68889, 0, 0, 0.61111], + 8878: [0, 0.68889, 0, 0, 0.72222], + 8879: [0, 0.68889, 0, 0, 0.72222], + 8882: [0.03517, 0.54986, 0, 0, 0.77778], + 8883: [0.03517, 0.54986, 0, 0, 0.77778], + 8884: [0.13667, 0.63667, 0, 0, 0.77778], + 8885: [0.13667, 0.63667, 0, 0, 0.77778], + 8888: [0, 0.54986, 0, 0, 1.11111], + 8890: [0.19444, 0.43056, 0, 0, 0.55556], + 8891: [0.19444, 0.69224, 0, 0, 0.61111], + 8892: [0.19444, 0.69224, 0, 0, 0.61111], + 8901: [0, 0.54986, 0, 0, 0.27778], + 8903: [0.08167, 0.58167, 0, 0, 0.77778], + 8905: [0.08167, 0.58167, 0, 0, 0.77778], + 8906: [0.08167, 0.58167, 0, 0, 0.77778], + 8907: [0, 0.69224, 0, 0, 0.77778], + 8908: [0, 0.69224, 0, 0, 0.77778], + 8909: [-0.03598, 0.46402, 0, 0, 0.77778], + 8910: [0, 0.54986, 0, 0, 0.76042], + 8911: [0, 0.54986, 0, 0, 0.76042], + 8912: [0.03517, 0.54986, 0, 0, 0.77778], + 8913: [0.03517, 0.54986, 0, 0, 0.77778], + 8914: [0, 0.54986, 0, 0, 0.66667], + 8915: [0, 0.54986, 0, 0, 0.66667], + 8916: [0, 0.69224, 0, 0, 0.66667], + 8918: [0.0391, 0.5391, 0, 0, 0.77778], + 8919: [0.0391, 0.5391, 0, 0, 0.77778], + 8920: [0.03517, 0.54986, 0, 0, 1.33334], + 8921: [0.03517, 0.54986, 0, 0, 1.33334], + 8922: [0.38569, 0.88569, 0, 0, 0.77778], + 8923: [0.38569, 0.88569, 0, 0, 0.77778], + 8926: [0.13667, 0.63667, 0, 0, 0.77778], + 8927: [0.13667, 0.63667, 0, 0, 0.77778], + 8928: [0.30274, 0.79383, 0, 0, 0.77778], + 8929: [0.30274, 0.79383, 0, 0, 0.77778], + 8934: [0.23222, 0.74111, 0, 0, 0.77778], + 8935: [0.23222, 0.74111, 0, 0, 0.77778], + 8936: [0.23222, 0.74111, 0, 0, 0.77778], + 8937: [0.23222, 0.74111, 0, 0, 0.77778], + 8938: [0.20576, 0.70576, 0, 0, 0.77778], + 8939: [0.20576, 0.70576, 0, 0, 0.77778], + 8940: [0.30274, 0.79383, 0, 0, 0.77778], + 8941: [0.30274, 0.79383, 0, 0, 0.77778], + 8994: [0.19444, 0.69224, 0, 0, 0.77778], + 8995: [0.19444, 0.69224, 0, 0, 0.77778], + 9416: [0.15559, 0.69224, 0, 0, 0.90222], + 9484: [0, 0.69224, 0, 0, 0.5], + 9488: [0, 0.69224, 0, 0, 0.5], + 9492: [0, 0.37788, 0, 0, 0.5], + 9496: [0, 0.37788, 0, 0, 0.5], + 9585: [0.19444, 0.68889, 0, 0, 0.88889], + 9586: [0.19444, 0.74111, 0, 0, 0.88889], + 9632: [0, 0.675, 0, 0, 0.77778], + 9633: [0, 0.675, 0, 0, 0.77778], + 9650: [0, 0.54986, 0, 0, 0.72222], + 9651: [0, 0.54986, 0, 0, 0.72222], + 9654: [0.03517, 0.54986, 0, 0, 0.77778], + 9660: [0, 0.54986, 0, 0, 0.72222], + 9661: [0, 0.54986, 0, 0, 0.72222], + 9664: [0.03517, 0.54986, 0, 0, 0.77778], + 9674: [0.11111, 0.69224, 0, 0, 0.66667], + 9733: [0.19444, 0.69224, 0, 0, 0.94445], + 10003: [0, 0.69224, 0, 0, 0.83334], + 10016: [0, 0.69224, 0, 0, 0.83334], + 10731: [0.11111, 0.69224, 0, 0, 0.66667], + 10846: [0.19444, 0.75583, 0, 0, 0.61111], + 10877: [0.13667, 0.63667, 0, 0, 0.77778], + 10878: [0.13667, 0.63667, 0, 0, 0.77778], + 10885: [0.25583, 0.75583, 0, 0, 0.77778], + 10886: [0.25583, 0.75583, 0, 0, 0.77778], + 10887: [0.13597, 0.63597, 0, 0, 0.77778], + 10888: [0.13597, 0.63597, 0, 0, 0.77778], + 10889: [0.26167, 0.75726, 0, 0, 0.77778], + 10890: [0.26167, 0.75726, 0, 0, 0.77778], + 10891: [0.48256, 0.98256, 0, 0, 0.77778], + 10892: [0.48256, 0.98256, 0, 0, 0.77778], + 10901: [0.13667, 0.63667, 0, 0, 0.77778], + 10902: [0.13667, 0.63667, 0, 0, 0.77778], + 10933: [0.25142, 0.75726, 0, 0, 0.77778], + 10934: [0.25142, 0.75726, 0, 0, 0.77778], + 10935: [0.26167, 0.75726, 0, 0, 0.77778], + 10936: [0.26167, 0.75726, 0, 0, 0.77778], + 10937: [0.26167, 0.75726, 0, 0, 0.77778], + 10938: [0.26167, 0.75726, 0, 0, 0.77778], + 10949: [0.25583, 0.75583, 0, 0, 0.77778], + 10950: [0.25583, 0.75583, 0, 0, 0.77778], + 10955: [0.28481, 0.79383, 0, 0, 0.77778], + 10956: [0.28481, 0.79383, 0, 0, 0.77778], + 57350: [0.08167, 0.58167, 0, 0, 0.22222], + 57351: [0.08167, 0.58167, 0, 0, 0.38889], + 57352: [0.08167, 0.58167, 0, 0, 0.77778], + 57353: [0, 0.43056, 0.04028, 0, 0.66667], + 57356: [0.25142, 0.75726, 0, 0, 0.77778], + 57357: [0.25142, 0.75726, 0, 0, 0.77778], + 57358: [0.41951, 0.91951, 0, 0, 0.77778], + 57359: [0.30274, 0.79383, 0, 0, 0.77778], + 57360: [0.30274, 0.79383, 0, 0, 0.77778], + 57361: [0.41951, 0.91951, 0, 0, 0.77778], + 57366: [0.25142, 0.75726, 0, 0, 0.77778], + 57367: [0.25142, 0.75726, 0, 0, 0.77778], + 57368: [0.25142, 0.75726, 0, 0, 0.77778], + 57369: [0.25142, 0.75726, 0, 0, 0.77778], + 57370: [0.13597, 0.63597, 0, 0, 0.77778], + 57371: [0.13597, 0.63597, 0, 0, 0.77778] + }, + "Caligraphic-Regular": { + 32: [0, 0, 0, 0, 0.25], + 65: [0, 0.68333, 0, 0.19445, 0.79847], + 66: [0, 0.68333, 0.03041, 0.13889, 0.65681], + 67: [0, 0.68333, 0.05834, 0.13889, 0.52653], + 68: [0, 0.68333, 0.02778, 0.08334, 0.77139], + 69: [0, 0.68333, 0.08944, 0.11111, 0.52778], + 70: [0, 0.68333, 0.09931, 0.11111, 0.71875], + 71: [0.09722, 0.68333, 0.0593, 0.11111, 0.59487], + 72: [0, 0.68333, 965e-5, 0.11111, 0.84452], + 73: [0, 0.68333, 0.07382, 0, 0.54452], + 74: [0.09722, 0.68333, 0.18472, 0.16667, 0.67778], + 75: [0, 0.68333, 0.01445, 0.05556, 0.76195], + 76: [0, 0.68333, 0, 0.13889, 0.68972], + 77: [0, 0.68333, 0, 0.13889, 1.2009], + 78: [0, 0.68333, 0.14736, 0.08334, 0.82049], + 79: [0, 0.68333, 0.02778, 0.11111, 0.79611], + 80: [0, 0.68333, 0.08222, 0.08334, 0.69556], + 81: [0.09722, 0.68333, 0, 0.11111, 0.81667], + 82: [0, 0.68333, 0, 0.08334, 0.8475], + 83: [0, 0.68333, 0.075, 0.13889, 0.60556], + 84: [0, 0.68333, 0.25417, 0, 0.54464], + 85: [0, 0.68333, 0.09931, 0.08334, 0.62583], + 86: [0, 0.68333, 0.08222, 0, 0.61278], + 87: [0, 0.68333, 0.08222, 0.08334, 0.98778], + 88: [0, 0.68333, 0.14643, 0.13889, 0.7133], + 89: [0.09722, 0.68333, 0.08222, 0.08334, 0.66834], + 90: [0, 0.68333, 0.07944, 0.13889, 0.72473], + 160: [0, 0, 0, 0, 0.25] + }, + "Fraktur-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69141, 0, 0, 0.29574], + 34: [0, 0.69141, 0, 0, 0.21471], + 38: [0, 0.69141, 0, 0, 0.73786], + 39: [0, 0.69141, 0, 0, 0.21201], + 40: [0.24982, 0.74947, 0, 0, 0.38865], + 41: [0.24982, 0.74947, 0, 0, 0.38865], + 42: [0, 0.62119, 0, 0, 0.27764], + 43: [0.08319, 0.58283, 0, 0, 0.75623], + 44: [0, 0.10803, 0, 0, 0.27764], + 45: [0.08319, 0.58283, 0, 0, 0.75623], + 46: [0, 0.10803, 0, 0, 0.27764], + 47: [0.24982, 0.74947, 0, 0, 0.50181], + 48: [0, 0.47534, 0, 0, 0.50181], + 49: [0, 0.47534, 0, 0, 0.50181], + 50: [0, 0.47534, 0, 0, 0.50181], + 51: [0.18906, 0.47534, 0, 0, 0.50181], + 52: [0.18906, 0.47534, 0, 0, 0.50181], + 53: [0.18906, 0.47534, 0, 0, 0.50181], + 54: [0, 0.69141, 0, 0, 0.50181], + 55: [0.18906, 0.47534, 0, 0, 0.50181], + 56: [0, 0.69141, 0, 0, 0.50181], + 57: [0.18906, 0.47534, 0, 0, 0.50181], + 58: [0, 0.47534, 0, 0, 0.21606], + 59: [0.12604, 0.47534, 0, 0, 0.21606], + 61: [-0.13099, 0.36866, 0, 0, 0.75623], + 63: [0, 0.69141, 0, 0, 0.36245], + 65: [0, 0.69141, 0, 0, 0.7176], + 66: [0, 0.69141, 0, 0, 0.88397], + 67: [0, 0.69141, 0, 0, 0.61254], + 68: [0, 0.69141, 0, 0, 0.83158], + 69: [0, 0.69141, 0, 0, 0.66278], + 70: [0.12604, 0.69141, 0, 0, 0.61119], + 71: [0, 0.69141, 0, 0, 0.78539], + 72: [0.06302, 0.69141, 0, 0, 0.7203], + 73: [0, 0.69141, 0, 0, 0.55448], + 74: [0.12604, 0.69141, 0, 0, 0.55231], + 75: [0, 0.69141, 0, 0, 0.66845], + 76: [0, 0.69141, 0, 0, 0.66602], + 77: [0, 0.69141, 0, 0, 1.04953], + 78: [0, 0.69141, 0, 0, 0.83212], + 79: [0, 0.69141, 0, 0, 0.82699], + 80: [0.18906, 0.69141, 0, 0, 0.82753], + 81: [0.03781, 0.69141, 0, 0, 0.82699], + 82: [0, 0.69141, 0, 0, 0.82807], + 83: [0, 0.69141, 0, 0, 0.82861], + 84: [0, 0.69141, 0, 0, 0.66899], + 85: [0, 0.69141, 0, 0, 0.64576], + 86: [0, 0.69141, 0, 0, 0.83131], + 87: [0, 0.69141, 0, 0, 1.04602], + 88: [0, 0.69141, 0, 0, 0.71922], + 89: [0.18906, 0.69141, 0, 0, 0.83293], + 90: [0.12604, 0.69141, 0, 0, 0.60201], + 91: [0.24982, 0.74947, 0, 0, 0.27764], + 93: [0.24982, 0.74947, 0, 0, 0.27764], + 94: [0, 0.69141, 0, 0, 0.49965], + 97: [0, 0.47534, 0, 0, 0.50046], + 98: [0, 0.69141, 0, 0, 0.51315], + 99: [0, 0.47534, 0, 0, 0.38946], + 100: [0, 0.62119, 0, 0, 0.49857], + 101: [0, 0.47534, 0, 0, 0.40053], + 102: [0.18906, 0.69141, 0, 0, 0.32626], + 103: [0.18906, 0.47534, 0, 0, 0.5037], + 104: [0.18906, 0.69141, 0, 0, 0.52126], + 105: [0, 0.69141, 0, 0, 0.27899], + 106: [0, 0.69141, 0, 0, 0.28088], + 107: [0, 0.69141, 0, 0, 0.38946], + 108: [0, 0.69141, 0, 0, 0.27953], + 109: [0, 0.47534, 0, 0, 0.76676], + 110: [0, 0.47534, 0, 0, 0.52666], + 111: [0, 0.47534, 0, 0, 0.48885], + 112: [0.18906, 0.52396, 0, 0, 0.50046], + 113: [0.18906, 0.47534, 0, 0, 0.48912], + 114: [0, 0.47534, 0, 0, 0.38919], + 115: [0, 0.47534, 0, 0, 0.44266], + 116: [0, 0.62119, 0, 0, 0.33301], + 117: [0, 0.47534, 0, 0, 0.5172], + 118: [0, 0.52396, 0, 0, 0.5118], + 119: [0, 0.52396, 0, 0, 0.77351], + 120: [0.18906, 0.47534, 0, 0, 0.38865], + 121: [0.18906, 0.47534, 0, 0, 0.49884], + 122: [0.18906, 0.47534, 0, 0, 0.39054], + 160: [0, 0, 0, 0, 0.25], + 8216: [0, 0.69141, 0, 0, 0.21471], + 8217: [0, 0.69141, 0, 0, 0.21471], + 58112: [0, 0.62119, 0, 0, 0.49749], + 58113: [0, 0.62119, 0, 0, 0.4983], + 58114: [0.18906, 0.69141, 0, 0, 0.33328], + 58115: [0.18906, 0.69141, 0, 0, 0.32923], + 58116: [0.18906, 0.47534, 0, 0, 0.50343], + 58117: [0, 0.69141, 0, 0, 0.33301], + 58118: [0, 0.62119, 0, 0, 0.33409], + 58119: [0, 0.47534, 0, 0, 0.50073] + }, + "Main-Bold": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.35], + 34: [0, 0.69444, 0, 0, 0.60278], + 35: [0.19444, 0.69444, 0, 0, 0.95833], + 36: [0.05556, 0.75, 0, 0, 0.575], + 37: [0.05556, 0.75, 0, 0, 0.95833], + 38: [0, 0.69444, 0, 0, 0.89444], + 39: [0, 0.69444, 0, 0, 0.31944], + 40: [0.25, 0.75, 0, 0, 0.44722], + 41: [0.25, 0.75, 0, 0, 0.44722], + 42: [0, 0.75, 0, 0, 0.575], + 43: [0.13333, 0.63333, 0, 0, 0.89444], + 44: [0.19444, 0.15556, 0, 0, 0.31944], + 45: [0, 0.44444, 0, 0, 0.38333], + 46: [0, 0.15556, 0, 0, 0.31944], + 47: [0.25, 0.75, 0, 0, 0.575], + 48: [0, 0.64444, 0, 0, 0.575], + 49: [0, 0.64444, 0, 0, 0.575], + 50: [0, 0.64444, 0, 0, 0.575], + 51: [0, 0.64444, 0, 0, 0.575], + 52: [0, 0.64444, 0, 0, 0.575], + 53: [0, 0.64444, 0, 0, 0.575], + 54: [0, 0.64444, 0, 0, 0.575], + 55: [0, 0.64444, 0, 0, 0.575], + 56: [0, 0.64444, 0, 0, 0.575], + 57: [0, 0.64444, 0, 0, 0.575], + 58: [0, 0.44444, 0, 0, 0.31944], + 59: [0.19444, 0.44444, 0, 0, 0.31944], + 60: [0.08556, 0.58556, 0, 0, 0.89444], + 61: [-0.10889, 0.39111, 0, 0, 0.89444], + 62: [0.08556, 0.58556, 0, 0, 0.89444], + 63: [0, 0.69444, 0, 0, 0.54305], + 64: [0, 0.69444, 0, 0, 0.89444], + 65: [0, 0.68611, 0, 0, 0.86944], + 66: [0, 0.68611, 0, 0, 0.81805], + 67: [0, 0.68611, 0, 0, 0.83055], + 68: [0, 0.68611, 0, 0, 0.88194], + 69: [0, 0.68611, 0, 0, 0.75555], + 70: [0, 0.68611, 0, 0, 0.72361], + 71: [0, 0.68611, 0, 0, 0.90416], + 72: [0, 0.68611, 0, 0, 0.9], + 73: [0, 0.68611, 0, 0, 0.43611], + 74: [0, 0.68611, 0, 0, 0.59444], + 75: [0, 0.68611, 0, 0, 0.90138], + 76: [0, 0.68611, 0, 0, 0.69166], + 77: [0, 0.68611, 0, 0, 1.09166], + 78: [0, 0.68611, 0, 0, 0.9], + 79: [0, 0.68611, 0, 0, 0.86388], + 80: [0, 0.68611, 0, 0, 0.78611], + 81: [0.19444, 0.68611, 0, 0, 0.86388], + 82: [0, 0.68611, 0, 0, 0.8625], + 83: [0, 0.68611, 0, 0, 0.63889], + 84: [0, 0.68611, 0, 0, 0.8], + 85: [0, 0.68611, 0, 0, 0.88472], + 86: [0, 0.68611, 0.01597, 0, 0.86944], + 87: [0, 0.68611, 0.01597, 0, 1.18888], + 88: [0, 0.68611, 0, 0, 0.86944], + 89: [0, 0.68611, 0.02875, 0, 0.86944], + 90: [0, 0.68611, 0, 0, 0.70277], + 91: [0.25, 0.75, 0, 0, 0.31944], + 92: [0.25, 0.75, 0, 0, 0.575], + 93: [0.25, 0.75, 0, 0, 0.31944], + 94: [0, 0.69444, 0, 0, 0.575], + 95: [0.31, 0.13444, 0.03194, 0, 0.575], + 97: [0, 0.44444, 0, 0, 0.55902], + 98: [0, 0.69444, 0, 0, 0.63889], + 99: [0, 0.44444, 0, 0, 0.51111], + 100: [0, 0.69444, 0, 0, 0.63889], + 101: [0, 0.44444, 0, 0, 0.52708], + 102: [0, 0.69444, 0.10903, 0, 0.35139], + 103: [0.19444, 0.44444, 0.01597, 0, 0.575], + 104: [0, 0.69444, 0, 0, 0.63889], + 105: [0, 0.69444, 0, 0, 0.31944], + 106: [0.19444, 0.69444, 0, 0, 0.35139], + 107: [0, 0.69444, 0, 0, 0.60694], + 108: [0, 0.69444, 0, 0, 0.31944], + 109: [0, 0.44444, 0, 0, 0.95833], + 110: [0, 0.44444, 0, 0, 0.63889], + 111: [0, 0.44444, 0, 0, 0.575], + 112: [0.19444, 0.44444, 0, 0, 0.63889], + 113: [0.19444, 0.44444, 0, 0, 0.60694], + 114: [0, 0.44444, 0, 0, 0.47361], + 115: [0, 0.44444, 0, 0, 0.45361], + 116: [0, 0.63492, 0, 0, 0.44722], + 117: [0, 0.44444, 0, 0, 0.63889], + 118: [0, 0.44444, 0.01597, 0, 0.60694], + 119: [0, 0.44444, 0.01597, 0, 0.83055], + 120: [0, 0.44444, 0, 0, 0.60694], + 121: [0.19444, 0.44444, 0.01597, 0, 0.60694], + 122: [0, 0.44444, 0, 0, 0.51111], + 123: [0.25, 0.75, 0, 0, 0.575], + 124: [0.25, 0.75, 0, 0, 0.31944], + 125: [0.25, 0.75, 0, 0, 0.575], + 126: [0.35, 0.34444, 0, 0, 0.575], + 160: [0, 0, 0, 0, 0.25], + 163: [0, 0.69444, 0, 0, 0.86853], + 168: [0, 0.69444, 0, 0, 0.575], + 172: [0, 0.44444, 0, 0, 0.76666], + 176: [0, 0.69444, 0, 0, 0.86944], + 177: [0.13333, 0.63333, 0, 0, 0.89444], + 184: [0.17014, 0, 0, 0, 0.51111], + 198: [0, 0.68611, 0, 0, 1.04166], + 215: [0.13333, 0.63333, 0, 0, 0.89444], + 216: [0.04861, 0.73472, 0, 0, 0.89444], + 223: [0, 0.69444, 0, 0, 0.59722], + 230: [0, 0.44444, 0, 0, 0.83055], + 247: [0.13333, 0.63333, 0, 0, 0.89444], + 248: [0.09722, 0.54167, 0, 0, 0.575], + 305: [0, 0.44444, 0, 0, 0.31944], + 338: [0, 0.68611, 0, 0, 1.16944], + 339: [0, 0.44444, 0, 0, 0.89444], + 567: [0.19444, 0.44444, 0, 0, 0.35139], + 710: [0, 0.69444, 0, 0, 0.575], + 711: [0, 0.63194, 0, 0, 0.575], + 713: [0, 0.59611, 0, 0, 0.575], + 714: [0, 0.69444, 0, 0, 0.575], + 715: [0, 0.69444, 0, 0, 0.575], + 728: [0, 0.69444, 0, 0, 0.575], + 729: [0, 0.69444, 0, 0, 0.31944], + 730: [0, 0.69444, 0, 0, 0.86944], + 732: [0, 0.69444, 0, 0, 0.575], + 733: [0, 0.69444, 0, 0, 0.575], + 915: [0, 0.68611, 0, 0, 0.69166], + 916: [0, 0.68611, 0, 0, 0.95833], + 920: [0, 0.68611, 0, 0, 0.89444], + 923: [0, 0.68611, 0, 0, 0.80555], + 926: [0, 0.68611, 0, 0, 0.76666], + 928: [0, 0.68611, 0, 0, 0.9], + 931: [0, 0.68611, 0, 0, 0.83055], + 933: [0, 0.68611, 0, 0, 0.89444], + 934: [0, 0.68611, 0, 0, 0.83055], + 936: [0, 0.68611, 0, 0, 0.89444], + 937: [0, 0.68611, 0, 0, 0.83055], + 8211: [0, 0.44444, 0.03194, 0, 0.575], + 8212: [0, 0.44444, 0.03194, 0, 1.14999], + 8216: [0, 0.69444, 0, 0, 0.31944], + 8217: [0, 0.69444, 0, 0, 0.31944], + 8220: [0, 0.69444, 0, 0, 0.60278], + 8221: [0, 0.69444, 0, 0, 0.60278], + 8224: [0.19444, 0.69444, 0, 0, 0.51111], + 8225: [0.19444, 0.69444, 0, 0, 0.51111], + 8242: [0, 0.55556, 0, 0, 0.34444], + 8407: [0, 0.72444, 0.15486, 0, 0.575], + 8463: [0, 0.69444, 0, 0, 0.66759], + 8465: [0, 0.69444, 0, 0, 0.83055], + 8467: [0, 0.69444, 0, 0, 0.47361], + 8472: [0.19444, 0.44444, 0, 0, 0.74027], + 8476: [0, 0.69444, 0, 0, 0.83055], + 8501: [0, 0.69444, 0, 0, 0.70277], + 8592: [-0.10889, 0.39111, 0, 0, 1.14999], + 8593: [0.19444, 0.69444, 0, 0, 0.575], + 8594: [-0.10889, 0.39111, 0, 0, 1.14999], + 8595: [0.19444, 0.69444, 0, 0, 0.575], + 8596: [-0.10889, 0.39111, 0, 0, 1.14999], + 8597: [0.25, 0.75, 0, 0, 0.575], + 8598: [0.19444, 0.69444, 0, 0, 1.14999], + 8599: [0.19444, 0.69444, 0, 0, 1.14999], + 8600: [0.19444, 0.69444, 0, 0, 1.14999], + 8601: [0.19444, 0.69444, 0, 0, 1.14999], + 8636: [-0.10889, 0.39111, 0, 0, 1.14999], + 8637: [-0.10889, 0.39111, 0, 0, 1.14999], + 8640: [-0.10889, 0.39111, 0, 0, 1.14999], + 8641: [-0.10889, 0.39111, 0, 0, 1.14999], + 8656: [-0.10889, 0.39111, 0, 0, 1.14999], + 8657: [0.19444, 0.69444, 0, 0, 0.70277], + 8658: [-0.10889, 0.39111, 0, 0, 1.14999], + 8659: [0.19444, 0.69444, 0, 0, 0.70277], + 8660: [-0.10889, 0.39111, 0, 0, 1.14999], + 8661: [0.25, 0.75, 0, 0, 0.70277], + 8704: [0, 0.69444, 0, 0, 0.63889], + 8706: [0, 0.69444, 0.06389, 0, 0.62847], + 8707: [0, 0.69444, 0, 0, 0.63889], + 8709: [0.05556, 0.75, 0, 0, 0.575], + 8711: [0, 0.68611, 0, 0, 0.95833], + 8712: [0.08556, 0.58556, 0, 0, 0.76666], + 8715: [0.08556, 0.58556, 0, 0, 0.76666], + 8722: [0.13333, 0.63333, 0, 0, 0.89444], + 8723: [0.13333, 0.63333, 0, 0, 0.89444], + 8725: [0.25, 0.75, 0, 0, 0.575], + 8726: [0.25, 0.75, 0, 0, 0.575], + 8727: [-0.02778, 0.47222, 0, 0, 0.575], + 8728: [-0.02639, 0.47361, 0, 0, 0.575], + 8729: [-0.02639, 0.47361, 0, 0, 0.575], + 8730: [0.18, 0.82, 0, 0, 0.95833], + 8733: [0, 0.44444, 0, 0, 0.89444], + 8734: [0, 0.44444, 0, 0, 1.14999], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8739: [0.25, 0.75, 0, 0, 0.31944], + 8741: [0.25, 0.75, 0, 0, 0.575], + 8743: [0, 0.55556, 0, 0, 0.76666], + 8744: [0, 0.55556, 0, 0, 0.76666], + 8745: [0, 0.55556, 0, 0, 0.76666], + 8746: [0, 0.55556, 0, 0, 0.76666], + 8747: [0.19444, 0.69444, 0.12778, 0, 0.56875], + 8764: [-0.10889, 0.39111, 0, 0, 0.89444], + 8768: [0.19444, 0.69444, 0, 0, 0.31944], + 8771: [222e-5, 0.50222, 0, 0, 0.89444], + 8773: [0.027, 0.638, 0, 0, 0.894], + 8776: [0.02444, 0.52444, 0, 0, 0.89444], + 8781: [222e-5, 0.50222, 0, 0, 0.89444], + 8801: [222e-5, 0.50222, 0, 0, 0.89444], + 8804: [0.19667, 0.69667, 0, 0, 0.89444], + 8805: [0.19667, 0.69667, 0, 0, 0.89444], + 8810: [0.08556, 0.58556, 0, 0, 1.14999], + 8811: [0.08556, 0.58556, 0, 0, 1.14999], + 8826: [0.08556, 0.58556, 0, 0, 0.89444], + 8827: [0.08556, 0.58556, 0, 0, 0.89444], + 8834: [0.08556, 0.58556, 0, 0, 0.89444], + 8835: [0.08556, 0.58556, 0, 0, 0.89444], + 8838: [0.19667, 0.69667, 0, 0, 0.89444], + 8839: [0.19667, 0.69667, 0, 0, 0.89444], + 8846: [0, 0.55556, 0, 0, 0.76666], + 8849: [0.19667, 0.69667, 0, 0, 0.89444], + 8850: [0.19667, 0.69667, 0, 0, 0.89444], + 8851: [0, 0.55556, 0, 0, 0.76666], + 8852: [0, 0.55556, 0, 0, 0.76666], + 8853: [0.13333, 0.63333, 0, 0, 0.89444], + 8854: [0.13333, 0.63333, 0, 0, 0.89444], + 8855: [0.13333, 0.63333, 0, 0, 0.89444], + 8856: [0.13333, 0.63333, 0, 0, 0.89444], + 8857: [0.13333, 0.63333, 0, 0, 0.89444], + 8866: [0, 0.69444, 0, 0, 0.70277], + 8867: [0, 0.69444, 0, 0, 0.70277], + 8868: [0, 0.69444, 0, 0, 0.89444], + 8869: [0, 0.69444, 0, 0, 0.89444], + 8900: [-0.02639, 0.47361, 0, 0, 0.575], + 8901: [-0.02639, 0.47361, 0, 0, 0.31944], + 8902: [-0.02778, 0.47222, 0, 0, 0.575], + 8968: [0.25, 0.75, 0, 0, 0.51111], + 8969: [0.25, 0.75, 0, 0, 0.51111], + 8970: [0.25, 0.75, 0, 0, 0.51111], + 8971: [0.25, 0.75, 0, 0, 0.51111], + 8994: [-0.13889, 0.36111, 0, 0, 1.14999], + 8995: [-0.13889, 0.36111, 0, 0, 1.14999], + 9651: [0.19444, 0.69444, 0, 0, 1.02222], + 9657: [-0.02778, 0.47222, 0, 0, 0.575], + 9661: [0.19444, 0.69444, 0, 0, 1.02222], + 9667: [-0.02778, 0.47222, 0, 0, 0.575], + 9711: [0.19444, 0.69444, 0, 0, 1.14999], + 9824: [0.12963, 0.69444, 0, 0, 0.89444], + 9825: [0.12963, 0.69444, 0, 0, 0.89444], + 9826: [0.12963, 0.69444, 0, 0, 0.89444], + 9827: [0.12963, 0.69444, 0, 0, 0.89444], + 9837: [0, 0.75, 0, 0, 0.44722], + 9838: [0.19444, 0.69444, 0, 0, 0.44722], + 9839: [0.19444, 0.69444, 0, 0, 0.44722], + 10216: [0.25, 0.75, 0, 0, 0.44722], + 10217: [0.25, 0.75, 0, 0, 0.44722], + 10815: [0, 0.68611, 0, 0, 0.9], + 10927: [0.19667, 0.69667, 0, 0, 0.89444], + 10928: [0.19667, 0.69667, 0, 0, 0.89444], + 57376: [0.19444, 0.69444, 0, 0, 0] + }, + "Main-BoldItalic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.11417, 0, 0.38611], + 34: [0, 0.69444, 0.07939, 0, 0.62055], + 35: [0.19444, 0.69444, 0.06833, 0, 0.94444], + 37: [0.05556, 0.75, 0.12861, 0, 0.94444], + 38: [0, 0.69444, 0.08528, 0, 0.88555], + 39: [0, 0.69444, 0.12945, 0, 0.35555], + 40: [0.25, 0.75, 0.15806, 0, 0.47333], + 41: [0.25, 0.75, 0.03306, 0, 0.47333], + 42: [0, 0.75, 0.14333, 0, 0.59111], + 43: [0.10333, 0.60333, 0.03306, 0, 0.88555], + 44: [0.19444, 0.14722, 0, 0, 0.35555], + 45: [0, 0.44444, 0.02611, 0, 0.41444], + 46: [0, 0.14722, 0, 0, 0.35555], + 47: [0.25, 0.75, 0.15806, 0, 0.59111], + 48: [0, 0.64444, 0.13167, 0, 0.59111], + 49: [0, 0.64444, 0.13167, 0, 0.59111], + 50: [0, 0.64444, 0.13167, 0, 0.59111], + 51: [0, 0.64444, 0.13167, 0, 0.59111], + 52: [0.19444, 0.64444, 0.13167, 0, 0.59111], + 53: [0, 0.64444, 0.13167, 0, 0.59111], + 54: [0, 0.64444, 0.13167, 0, 0.59111], + 55: [0.19444, 0.64444, 0.13167, 0, 0.59111], + 56: [0, 0.64444, 0.13167, 0, 0.59111], + 57: [0, 0.64444, 0.13167, 0, 0.59111], + 58: [0, 0.44444, 0.06695, 0, 0.35555], + 59: [0.19444, 0.44444, 0.06695, 0, 0.35555], + 61: [-0.10889, 0.39111, 0.06833, 0, 0.88555], + 63: [0, 0.69444, 0.11472, 0, 0.59111], + 64: [0, 0.69444, 0.09208, 0, 0.88555], + 65: [0, 0.68611, 0, 0, 0.86555], + 66: [0, 0.68611, 0.0992, 0, 0.81666], + 67: [0, 0.68611, 0.14208, 0, 0.82666], + 68: [0, 0.68611, 0.09062, 0, 0.87555], + 69: [0, 0.68611, 0.11431, 0, 0.75666], + 70: [0, 0.68611, 0.12903, 0, 0.72722], + 71: [0, 0.68611, 0.07347, 0, 0.89527], + 72: [0, 0.68611, 0.17208, 0, 0.8961], + 73: [0, 0.68611, 0.15681, 0, 0.47166], + 74: [0, 0.68611, 0.145, 0, 0.61055], + 75: [0, 0.68611, 0.14208, 0, 0.89499], + 76: [0, 0.68611, 0, 0, 0.69777], + 77: [0, 0.68611, 0.17208, 0, 1.07277], + 78: [0, 0.68611, 0.17208, 0, 0.8961], + 79: [0, 0.68611, 0.09062, 0, 0.85499], + 80: [0, 0.68611, 0.0992, 0, 0.78721], + 81: [0.19444, 0.68611, 0.09062, 0, 0.85499], + 82: [0, 0.68611, 0.02559, 0, 0.85944], + 83: [0, 0.68611, 0.11264, 0, 0.64999], + 84: [0, 0.68611, 0.12903, 0, 0.7961], + 85: [0, 0.68611, 0.17208, 0, 0.88083], + 86: [0, 0.68611, 0.18625, 0, 0.86555], + 87: [0, 0.68611, 0.18625, 0, 1.15999], + 88: [0, 0.68611, 0.15681, 0, 0.86555], + 89: [0, 0.68611, 0.19803, 0, 0.86555], + 90: [0, 0.68611, 0.14208, 0, 0.70888], + 91: [0.25, 0.75, 0.1875, 0, 0.35611], + 93: [0.25, 0.75, 0.09972, 0, 0.35611], + 94: [0, 0.69444, 0.06709, 0, 0.59111], + 95: [0.31, 0.13444, 0.09811, 0, 0.59111], + 97: [0, 0.44444, 0.09426, 0, 0.59111], + 98: [0, 0.69444, 0.07861, 0, 0.53222], + 99: [0, 0.44444, 0.05222, 0, 0.53222], + 100: [0, 0.69444, 0.10861, 0, 0.59111], + 101: [0, 0.44444, 0.085, 0, 0.53222], + 102: [0.19444, 0.69444, 0.21778, 0, 0.4], + 103: [0.19444, 0.44444, 0.105, 0, 0.53222], + 104: [0, 0.69444, 0.09426, 0, 0.59111], + 105: [0, 0.69326, 0.11387, 0, 0.35555], + 106: [0.19444, 0.69326, 0.1672, 0, 0.35555], + 107: [0, 0.69444, 0.11111, 0, 0.53222], + 108: [0, 0.69444, 0.10861, 0, 0.29666], + 109: [0, 0.44444, 0.09426, 0, 0.94444], + 110: [0, 0.44444, 0.09426, 0, 0.64999], + 111: [0, 0.44444, 0.07861, 0, 0.59111], + 112: [0.19444, 0.44444, 0.07861, 0, 0.59111], + 113: [0.19444, 0.44444, 0.105, 0, 0.53222], + 114: [0, 0.44444, 0.11111, 0, 0.50167], + 115: [0, 0.44444, 0.08167, 0, 0.48694], + 116: [0, 0.63492, 0.09639, 0, 0.385], + 117: [0, 0.44444, 0.09426, 0, 0.62055], + 118: [0, 0.44444, 0.11111, 0, 0.53222], + 119: [0, 0.44444, 0.11111, 0, 0.76777], + 120: [0, 0.44444, 0.12583, 0, 0.56055], + 121: [0.19444, 0.44444, 0.105, 0, 0.56166], + 122: [0, 0.44444, 0.13889, 0, 0.49055], + 126: [0.35, 0.34444, 0.11472, 0, 0.59111], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.69444, 0.11473, 0, 0.59111], + 176: [0, 0.69444, 0, 0, 0.94888], + 184: [0.17014, 0, 0, 0, 0.53222], + 198: [0, 0.68611, 0.11431, 0, 1.02277], + 216: [0.04861, 0.73472, 0.09062, 0, 0.88555], + 223: [0.19444, 0.69444, 0.09736, 0, 0.665], + 230: [0, 0.44444, 0.085, 0, 0.82666], + 248: [0.09722, 0.54167, 0.09458, 0, 0.59111], + 305: [0, 0.44444, 0.09426, 0, 0.35555], + 338: [0, 0.68611, 0.11431, 0, 1.14054], + 339: [0, 0.44444, 0.085, 0, 0.82666], + 567: [0.19444, 0.44444, 0.04611, 0, 0.385], + 710: [0, 0.69444, 0.06709, 0, 0.59111], + 711: [0, 0.63194, 0.08271, 0, 0.59111], + 713: [0, 0.59444, 0.10444, 0, 0.59111], + 714: [0, 0.69444, 0.08528, 0, 0.59111], + 715: [0, 0.69444, 0, 0, 0.59111], + 728: [0, 0.69444, 0.10333, 0, 0.59111], + 729: [0, 0.69444, 0.12945, 0, 0.35555], + 730: [0, 0.69444, 0, 0, 0.94888], + 732: [0, 0.69444, 0.11472, 0, 0.59111], + 733: [0, 0.69444, 0.11472, 0, 0.59111], + 915: [0, 0.68611, 0.12903, 0, 0.69777], + 916: [0, 0.68611, 0, 0, 0.94444], + 920: [0, 0.68611, 0.09062, 0, 0.88555], + 923: [0, 0.68611, 0, 0, 0.80666], + 926: [0, 0.68611, 0.15092, 0, 0.76777], + 928: [0, 0.68611, 0.17208, 0, 0.8961], + 931: [0, 0.68611, 0.11431, 0, 0.82666], + 933: [0, 0.68611, 0.10778, 0, 0.88555], + 934: [0, 0.68611, 0.05632, 0, 0.82666], + 936: [0, 0.68611, 0.10778, 0, 0.88555], + 937: [0, 0.68611, 0.0992, 0, 0.82666], + 8211: [0, 0.44444, 0.09811, 0, 0.59111], + 8212: [0, 0.44444, 0.09811, 0, 1.18221], + 8216: [0, 0.69444, 0.12945, 0, 0.35555], + 8217: [0, 0.69444, 0.12945, 0, 0.35555], + 8220: [0, 0.69444, 0.16772, 0, 0.62055], + 8221: [0, 0.69444, 0.07939, 0, 0.62055] + }, + "Main-Italic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.12417, 0, 0.30667], + 34: [0, 0.69444, 0.06961, 0, 0.51444], + 35: [0.19444, 0.69444, 0.06616, 0, 0.81777], + 37: [0.05556, 0.75, 0.13639, 0, 0.81777], + 38: [0, 0.69444, 0.09694, 0, 0.76666], + 39: [0, 0.69444, 0.12417, 0, 0.30667], + 40: [0.25, 0.75, 0.16194, 0, 0.40889], + 41: [0.25, 0.75, 0.03694, 0, 0.40889], + 42: [0, 0.75, 0.14917, 0, 0.51111], + 43: [0.05667, 0.56167, 0.03694, 0, 0.76666], + 44: [0.19444, 0.10556, 0, 0, 0.30667], + 45: [0, 0.43056, 0.02826, 0, 0.35778], + 46: [0, 0.10556, 0, 0, 0.30667], + 47: [0.25, 0.75, 0.16194, 0, 0.51111], + 48: [0, 0.64444, 0.13556, 0, 0.51111], + 49: [0, 0.64444, 0.13556, 0, 0.51111], + 50: [0, 0.64444, 0.13556, 0, 0.51111], + 51: [0, 0.64444, 0.13556, 0, 0.51111], + 52: [0.19444, 0.64444, 0.13556, 0, 0.51111], + 53: [0, 0.64444, 0.13556, 0, 0.51111], + 54: [0, 0.64444, 0.13556, 0, 0.51111], + 55: [0.19444, 0.64444, 0.13556, 0, 0.51111], + 56: [0, 0.64444, 0.13556, 0, 0.51111], + 57: [0, 0.64444, 0.13556, 0, 0.51111], + 58: [0, 0.43056, 0.0582, 0, 0.30667], + 59: [0.19444, 0.43056, 0.0582, 0, 0.30667], + 61: [-0.13313, 0.36687, 0.06616, 0, 0.76666], + 63: [0, 0.69444, 0.1225, 0, 0.51111], + 64: [0, 0.69444, 0.09597, 0, 0.76666], + 65: [0, 0.68333, 0, 0, 0.74333], + 66: [0, 0.68333, 0.10257, 0, 0.70389], + 67: [0, 0.68333, 0.14528, 0, 0.71555], + 68: [0, 0.68333, 0.09403, 0, 0.755], + 69: [0, 0.68333, 0.12028, 0, 0.67833], + 70: [0, 0.68333, 0.13305, 0, 0.65277], + 71: [0, 0.68333, 0.08722, 0, 0.77361], + 72: [0, 0.68333, 0.16389, 0, 0.74333], + 73: [0, 0.68333, 0.15806, 0, 0.38555], + 74: [0, 0.68333, 0.14028, 0, 0.525], + 75: [0, 0.68333, 0.14528, 0, 0.76888], + 76: [0, 0.68333, 0, 0, 0.62722], + 77: [0, 0.68333, 0.16389, 0, 0.89666], + 78: [0, 0.68333, 0.16389, 0, 0.74333], + 79: [0, 0.68333, 0.09403, 0, 0.76666], + 80: [0, 0.68333, 0.10257, 0, 0.67833], + 81: [0.19444, 0.68333, 0.09403, 0, 0.76666], + 82: [0, 0.68333, 0.03868, 0, 0.72944], + 83: [0, 0.68333, 0.11972, 0, 0.56222], + 84: [0, 0.68333, 0.13305, 0, 0.71555], + 85: [0, 0.68333, 0.16389, 0, 0.74333], + 86: [0, 0.68333, 0.18361, 0, 0.74333], + 87: [0, 0.68333, 0.18361, 0, 0.99888], + 88: [0, 0.68333, 0.15806, 0, 0.74333], + 89: [0, 0.68333, 0.19383, 0, 0.74333], + 90: [0, 0.68333, 0.14528, 0, 0.61333], + 91: [0.25, 0.75, 0.1875, 0, 0.30667], + 93: [0.25, 0.75, 0.10528, 0, 0.30667], + 94: [0, 0.69444, 0.06646, 0, 0.51111], + 95: [0.31, 0.12056, 0.09208, 0, 0.51111], + 97: [0, 0.43056, 0.07671, 0, 0.51111], + 98: [0, 0.69444, 0.06312, 0, 0.46], + 99: [0, 0.43056, 0.05653, 0, 0.46], + 100: [0, 0.69444, 0.10333, 0, 0.51111], + 101: [0, 0.43056, 0.07514, 0, 0.46], + 102: [0.19444, 0.69444, 0.21194, 0, 0.30667], + 103: [0.19444, 0.43056, 0.08847, 0, 0.46], + 104: [0, 0.69444, 0.07671, 0, 0.51111], + 105: [0, 0.65536, 0.1019, 0, 0.30667], + 106: [0.19444, 0.65536, 0.14467, 0, 0.30667], + 107: [0, 0.69444, 0.10764, 0, 0.46], + 108: [0, 0.69444, 0.10333, 0, 0.25555], + 109: [0, 0.43056, 0.07671, 0, 0.81777], + 110: [0, 0.43056, 0.07671, 0, 0.56222], + 111: [0, 0.43056, 0.06312, 0, 0.51111], + 112: [0.19444, 0.43056, 0.06312, 0, 0.51111], + 113: [0.19444, 0.43056, 0.08847, 0, 0.46], + 114: [0, 0.43056, 0.10764, 0, 0.42166], + 115: [0, 0.43056, 0.08208, 0, 0.40889], + 116: [0, 0.61508, 0.09486, 0, 0.33222], + 117: [0, 0.43056, 0.07671, 0, 0.53666], + 118: [0, 0.43056, 0.10764, 0, 0.46], + 119: [0, 0.43056, 0.10764, 0, 0.66444], + 120: [0, 0.43056, 0.12042, 0, 0.46389], + 121: [0.19444, 0.43056, 0.08847, 0, 0.48555], + 122: [0, 0.43056, 0.12292, 0, 0.40889], + 126: [0.35, 0.31786, 0.11585, 0, 0.51111], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.66786, 0.10474, 0, 0.51111], + 176: [0, 0.69444, 0, 0, 0.83129], + 184: [0.17014, 0, 0, 0, 0.46], + 198: [0, 0.68333, 0.12028, 0, 0.88277], + 216: [0.04861, 0.73194, 0.09403, 0, 0.76666], + 223: [0.19444, 0.69444, 0.10514, 0, 0.53666], + 230: [0, 0.43056, 0.07514, 0, 0.71555], + 248: [0.09722, 0.52778, 0.09194, 0, 0.51111], + 338: [0, 0.68333, 0.12028, 0, 0.98499], + 339: [0, 0.43056, 0.07514, 0, 0.71555], + 710: [0, 0.69444, 0.06646, 0, 0.51111], + 711: [0, 0.62847, 0.08295, 0, 0.51111], + 713: [0, 0.56167, 0.10333, 0, 0.51111], + 714: [0, 0.69444, 0.09694, 0, 0.51111], + 715: [0, 0.69444, 0, 0, 0.51111], + 728: [0, 0.69444, 0.10806, 0, 0.51111], + 729: [0, 0.66786, 0.11752, 0, 0.30667], + 730: [0, 0.69444, 0, 0, 0.83129], + 732: [0, 0.66786, 0.11585, 0, 0.51111], + 733: [0, 0.69444, 0.1225, 0, 0.51111], + 915: [0, 0.68333, 0.13305, 0, 0.62722], + 916: [0, 0.68333, 0, 0, 0.81777], + 920: [0, 0.68333, 0.09403, 0, 0.76666], + 923: [0, 0.68333, 0, 0, 0.69222], + 926: [0, 0.68333, 0.15294, 0, 0.66444], + 928: [0, 0.68333, 0.16389, 0, 0.74333], + 931: [0, 0.68333, 0.12028, 0, 0.71555], + 933: [0, 0.68333, 0.11111, 0, 0.76666], + 934: [0, 0.68333, 0.05986, 0, 0.71555], + 936: [0, 0.68333, 0.11111, 0, 0.76666], + 937: [0, 0.68333, 0.10257, 0, 0.71555], + 8211: [0, 0.43056, 0.09208, 0, 0.51111], + 8212: [0, 0.43056, 0.09208, 0, 1.02222], + 8216: [0, 0.69444, 0.12417, 0, 0.30667], + 8217: [0, 0.69444, 0.12417, 0, 0.30667], + 8220: [0, 0.69444, 0.1685, 0, 0.51444], + 8221: [0, 0.69444, 0.06961, 0, 0.51444], + 8463: [0, 0.68889, 0, 0, 0.54028] + }, + "Main-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.27778], + 34: [0, 0.69444, 0, 0, 0.5], + 35: [0.19444, 0.69444, 0, 0, 0.83334], + 36: [0.05556, 0.75, 0, 0, 0.5], + 37: [0.05556, 0.75, 0, 0, 0.83334], + 38: [0, 0.69444, 0, 0, 0.77778], + 39: [0, 0.69444, 0, 0, 0.27778], + 40: [0.25, 0.75, 0, 0, 0.38889], + 41: [0.25, 0.75, 0, 0, 0.38889], + 42: [0, 0.75, 0, 0, 0.5], + 43: [0.08333, 0.58333, 0, 0, 0.77778], + 44: [0.19444, 0.10556, 0, 0, 0.27778], + 45: [0, 0.43056, 0, 0, 0.33333], + 46: [0, 0.10556, 0, 0, 0.27778], + 47: [0.25, 0.75, 0, 0, 0.5], + 48: [0, 0.64444, 0, 0, 0.5], + 49: [0, 0.64444, 0, 0, 0.5], + 50: [0, 0.64444, 0, 0, 0.5], + 51: [0, 0.64444, 0, 0, 0.5], + 52: [0, 0.64444, 0, 0, 0.5], + 53: [0, 0.64444, 0, 0, 0.5], + 54: [0, 0.64444, 0, 0, 0.5], + 55: [0, 0.64444, 0, 0, 0.5], + 56: [0, 0.64444, 0, 0, 0.5], + 57: [0, 0.64444, 0, 0, 0.5], + 58: [0, 0.43056, 0, 0, 0.27778], + 59: [0.19444, 0.43056, 0, 0, 0.27778], + 60: [0.0391, 0.5391, 0, 0, 0.77778], + 61: [-0.13313, 0.36687, 0, 0, 0.77778], + 62: [0.0391, 0.5391, 0, 0, 0.77778], + 63: [0, 0.69444, 0, 0, 0.47222], + 64: [0, 0.69444, 0, 0, 0.77778], + 65: [0, 0.68333, 0, 0, 0.75], + 66: [0, 0.68333, 0, 0, 0.70834], + 67: [0, 0.68333, 0, 0, 0.72222], + 68: [0, 0.68333, 0, 0, 0.76389], + 69: [0, 0.68333, 0, 0, 0.68056], + 70: [0, 0.68333, 0, 0, 0.65278], + 71: [0, 0.68333, 0, 0, 0.78472], + 72: [0, 0.68333, 0, 0, 0.75], + 73: [0, 0.68333, 0, 0, 0.36111], + 74: [0, 0.68333, 0, 0, 0.51389], + 75: [0, 0.68333, 0, 0, 0.77778], + 76: [0, 0.68333, 0, 0, 0.625], + 77: [0, 0.68333, 0, 0, 0.91667], + 78: [0, 0.68333, 0, 0, 0.75], + 79: [0, 0.68333, 0, 0, 0.77778], + 80: [0, 0.68333, 0, 0, 0.68056], + 81: [0.19444, 0.68333, 0, 0, 0.77778], + 82: [0, 0.68333, 0, 0, 0.73611], + 83: [0, 0.68333, 0, 0, 0.55556], + 84: [0, 0.68333, 0, 0, 0.72222], + 85: [0, 0.68333, 0, 0, 0.75], + 86: [0, 0.68333, 0.01389, 0, 0.75], + 87: [0, 0.68333, 0.01389, 0, 1.02778], + 88: [0, 0.68333, 0, 0, 0.75], + 89: [0, 0.68333, 0.025, 0, 0.75], + 90: [0, 0.68333, 0, 0, 0.61111], + 91: [0.25, 0.75, 0, 0, 0.27778], + 92: [0.25, 0.75, 0, 0, 0.5], + 93: [0.25, 0.75, 0, 0, 0.27778], + 94: [0, 0.69444, 0, 0, 0.5], + 95: [0.31, 0.12056, 0.02778, 0, 0.5], + 97: [0, 0.43056, 0, 0, 0.5], + 98: [0, 0.69444, 0, 0, 0.55556], + 99: [0, 0.43056, 0, 0, 0.44445], + 100: [0, 0.69444, 0, 0, 0.55556], + 101: [0, 0.43056, 0, 0, 0.44445], + 102: [0, 0.69444, 0.07778, 0, 0.30556], + 103: [0.19444, 0.43056, 0.01389, 0, 0.5], + 104: [0, 0.69444, 0, 0, 0.55556], + 105: [0, 0.66786, 0, 0, 0.27778], + 106: [0.19444, 0.66786, 0, 0, 0.30556], + 107: [0, 0.69444, 0, 0, 0.52778], + 108: [0, 0.69444, 0, 0, 0.27778], + 109: [0, 0.43056, 0, 0, 0.83334], + 110: [0, 0.43056, 0, 0, 0.55556], + 111: [0, 0.43056, 0, 0, 0.5], + 112: [0.19444, 0.43056, 0, 0, 0.55556], + 113: [0.19444, 0.43056, 0, 0, 0.52778], + 114: [0, 0.43056, 0, 0, 0.39167], + 115: [0, 0.43056, 0, 0, 0.39445], + 116: [0, 0.61508, 0, 0, 0.38889], + 117: [0, 0.43056, 0, 0, 0.55556], + 118: [0, 0.43056, 0.01389, 0, 0.52778], + 119: [0, 0.43056, 0.01389, 0, 0.72222], + 120: [0, 0.43056, 0, 0, 0.52778], + 121: [0.19444, 0.43056, 0.01389, 0, 0.52778], + 122: [0, 0.43056, 0, 0, 0.44445], + 123: [0.25, 0.75, 0, 0, 0.5], + 124: [0.25, 0.75, 0, 0, 0.27778], + 125: [0.25, 0.75, 0, 0, 0.5], + 126: [0.35, 0.31786, 0, 0, 0.5], + 160: [0, 0, 0, 0, 0.25], + 163: [0, 0.69444, 0, 0, 0.76909], + 167: [0.19444, 0.69444, 0, 0, 0.44445], + 168: [0, 0.66786, 0, 0, 0.5], + 172: [0, 0.43056, 0, 0, 0.66667], + 176: [0, 0.69444, 0, 0, 0.75], + 177: [0.08333, 0.58333, 0, 0, 0.77778], + 182: [0.19444, 0.69444, 0, 0, 0.61111], + 184: [0.17014, 0, 0, 0, 0.44445], + 198: [0, 0.68333, 0, 0, 0.90278], + 215: [0.08333, 0.58333, 0, 0, 0.77778], + 216: [0.04861, 0.73194, 0, 0, 0.77778], + 223: [0, 0.69444, 0, 0, 0.5], + 230: [0, 0.43056, 0, 0, 0.72222], + 247: [0.08333, 0.58333, 0, 0, 0.77778], + 248: [0.09722, 0.52778, 0, 0, 0.5], + 305: [0, 0.43056, 0, 0, 0.27778], + 338: [0, 0.68333, 0, 0, 1.01389], + 339: [0, 0.43056, 0, 0, 0.77778], + 567: [0.19444, 0.43056, 0, 0, 0.30556], + 710: [0, 0.69444, 0, 0, 0.5], + 711: [0, 0.62847, 0, 0, 0.5], + 713: [0, 0.56778, 0, 0, 0.5], + 714: [0, 0.69444, 0, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0, 0, 0.5], + 729: [0, 0.66786, 0, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.75], + 732: [0, 0.66786, 0, 0, 0.5], + 733: [0, 0.69444, 0, 0, 0.5], + 915: [0, 0.68333, 0, 0, 0.625], + 916: [0, 0.68333, 0, 0, 0.83334], + 920: [0, 0.68333, 0, 0, 0.77778], + 923: [0, 0.68333, 0, 0, 0.69445], + 926: [0, 0.68333, 0, 0, 0.66667], + 928: [0, 0.68333, 0, 0, 0.75], + 931: [0, 0.68333, 0, 0, 0.72222], + 933: [0, 0.68333, 0, 0, 0.77778], + 934: [0, 0.68333, 0, 0, 0.72222], + 936: [0, 0.68333, 0, 0, 0.77778], + 937: [0, 0.68333, 0, 0, 0.72222], + 8211: [0, 0.43056, 0.02778, 0, 0.5], + 8212: [0, 0.43056, 0.02778, 0, 1], + 8216: [0, 0.69444, 0, 0, 0.27778], + 8217: [0, 0.69444, 0, 0, 0.27778], + 8220: [0, 0.69444, 0, 0, 0.5], + 8221: [0, 0.69444, 0, 0, 0.5], + 8224: [0.19444, 0.69444, 0, 0, 0.44445], + 8225: [0.19444, 0.69444, 0, 0, 0.44445], + 8230: [0, 0.123, 0, 0, 1.172], + 8242: [0, 0.55556, 0, 0, 0.275], + 8407: [0, 0.71444, 0.15382, 0, 0.5], + 8463: [0, 0.68889, 0, 0, 0.54028], + 8465: [0, 0.69444, 0, 0, 0.72222], + 8467: [0, 0.69444, 0, 0.11111, 0.41667], + 8472: [0.19444, 0.43056, 0, 0.11111, 0.63646], + 8476: [0, 0.69444, 0, 0, 0.72222], + 8501: [0, 0.69444, 0, 0, 0.61111], + 8592: [-0.13313, 0.36687, 0, 0, 1], + 8593: [0.19444, 0.69444, 0, 0, 0.5], + 8594: [-0.13313, 0.36687, 0, 0, 1], + 8595: [0.19444, 0.69444, 0, 0, 0.5], + 8596: [-0.13313, 0.36687, 0, 0, 1], + 8597: [0.25, 0.75, 0, 0, 0.5], + 8598: [0.19444, 0.69444, 0, 0, 1], + 8599: [0.19444, 0.69444, 0, 0, 1], + 8600: [0.19444, 0.69444, 0, 0, 1], + 8601: [0.19444, 0.69444, 0, 0, 1], + 8614: [0.011, 0.511, 0, 0, 1], + 8617: [0.011, 0.511, 0, 0, 1.126], + 8618: [0.011, 0.511, 0, 0, 1.126], + 8636: [-0.13313, 0.36687, 0, 0, 1], + 8637: [-0.13313, 0.36687, 0, 0, 1], + 8640: [-0.13313, 0.36687, 0, 0, 1], + 8641: [-0.13313, 0.36687, 0, 0, 1], + 8652: [0.011, 0.671, 0, 0, 1], + 8656: [-0.13313, 0.36687, 0, 0, 1], + 8657: [0.19444, 0.69444, 0, 0, 0.61111], + 8658: [-0.13313, 0.36687, 0, 0, 1], + 8659: [0.19444, 0.69444, 0, 0, 0.61111], + 8660: [-0.13313, 0.36687, 0, 0, 1], + 8661: [0.25, 0.75, 0, 0, 0.61111], + 8704: [0, 0.69444, 0, 0, 0.55556], + 8706: [0, 0.69444, 0.05556, 0.08334, 0.5309], + 8707: [0, 0.69444, 0, 0, 0.55556], + 8709: [0.05556, 0.75, 0, 0, 0.5], + 8711: [0, 0.68333, 0, 0, 0.83334], + 8712: [0.0391, 0.5391, 0, 0, 0.66667], + 8715: [0.0391, 0.5391, 0, 0, 0.66667], + 8722: [0.08333, 0.58333, 0, 0, 0.77778], + 8723: [0.08333, 0.58333, 0, 0, 0.77778], + 8725: [0.25, 0.75, 0, 0, 0.5], + 8726: [0.25, 0.75, 0, 0, 0.5], + 8727: [-0.03472, 0.46528, 0, 0, 0.5], + 8728: [-0.05555, 0.44445, 0, 0, 0.5], + 8729: [-0.05555, 0.44445, 0, 0, 0.5], + 8730: [0.2, 0.8, 0, 0, 0.83334], + 8733: [0, 0.43056, 0, 0, 0.77778], + 8734: [0, 0.43056, 0, 0, 1], + 8736: [0, 0.69224, 0, 0, 0.72222], + 8739: [0.25, 0.75, 0, 0, 0.27778], + 8741: [0.25, 0.75, 0, 0, 0.5], + 8743: [0, 0.55556, 0, 0, 0.66667], + 8744: [0, 0.55556, 0, 0, 0.66667], + 8745: [0, 0.55556, 0, 0, 0.66667], + 8746: [0, 0.55556, 0, 0, 0.66667], + 8747: [0.19444, 0.69444, 0.11111, 0, 0.41667], + 8764: [-0.13313, 0.36687, 0, 0, 0.77778], + 8768: [0.19444, 0.69444, 0, 0, 0.27778], + 8771: [-0.03625, 0.46375, 0, 0, 0.77778], + 8773: [-0.022, 0.589, 0, 0, 0.778], + 8776: [-0.01688, 0.48312, 0, 0, 0.77778], + 8781: [-0.03625, 0.46375, 0, 0, 0.77778], + 8784: [-0.133, 0.673, 0, 0, 0.778], + 8801: [-0.03625, 0.46375, 0, 0, 0.77778], + 8804: [0.13597, 0.63597, 0, 0, 0.77778], + 8805: [0.13597, 0.63597, 0, 0, 0.77778], + 8810: [0.0391, 0.5391, 0, 0, 1], + 8811: [0.0391, 0.5391, 0, 0, 1], + 8826: [0.0391, 0.5391, 0, 0, 0.77778], + 8827: [0.0391, 0.5391, 0, 0, 0.77778], + 8834: [0.0391, 0.5391, 0, 0, 0.77778], + 8835: [0.0391, 0.5391, 0, 0, 0.77778], + 8838: [0.13597, 0.63597, 0, 0, 0.77778], + 8839: [0.13597, 0.63597, 0, 0, 0.77778], + 8846: [0, 0.55556, 0, 0, 0.66667], + 8849: [0.13597, 0.63597, 0, 0, 0.77778], + 8850: [0.13597, 0.63597, 0, 0, 0.77778], + 8851: [0, 0.55556, 0, 0, 0.66667], + 8852: [0, 0.55556, 0, 0, 0.66667], + 8853: [0.08333, 0.58333, 0, 0, 0.77778], + 8854: [0.08333, 0.58333, 0, 0, 0.77778], + 8855: [0.08333, 0.58333, 0, 0, 0.77778], + 8856: [0.08333, 0.58333, 0, 0, 0.77778], + 8857: [0.08333, 0.58333, 0, 0, 0.77778], + 8866: [0, 0.69444, 0, 0, 0.61111], + 8867: [0, 0.69444, 0, 0, 0.61111], + 8868: [0, 0.69444, 0, 0, 0.77778], + 8869: [0, 0.69444, 0, 0, 0.77778], + 8872: [0.249, 0.75, 0, 0, 0.867], + 8900: [-0.05555, 0.44445, 0, 0, 0.5], + 8901: [-0.05555, 0.44445, 0, 0, 0.27778], + 8902: [-0.03472, 0.46528, 0, 0, 0.5], + 8904: [5e-3, 0.505, 0, 0, 0.9], + 8942: [0.03, 0.903, 0, 0, 0.278], + 8943: [-0.19, 0.313, 0, 0, 1.172], + 8945: [-0.1, 0.823, 0, 0, 1.282], + 8968: [0.25, 0.75, 0, 0, 0.44445], + 8969: [0.25, 0.75, 0, 0, 0.44445], + 8970: [0.25, 0.75, 0, 0, 0.44445], + 8971: [0.25, 0.75, 0, 0, 0.44445], + 8994: [-0.14236, 0.35764, 0, 0, 1], + 8995: [-0.14236, 0.35764, 0, 0, 1], + 9136: [0.244, 0.744, 0, 0, 0.412], + 9137: [0.244, 0.745, 0, 0, 0.412], + 9651: [0.19444, 0.69444, 0, 0, 0.88889], + 9657: [-0.03472, 0.46528, 0, 0, 0.5], + 9661: [0.19444, 0.69444, 0, 0, 0.88889], + 9667: [-0.03472, 0.46528, 0, 0, 0.5], + 9711: [0.19444, 0.69444, 0, 0, 1], + 9824: [0.12963, 0.69444, 0, 0, 0.77778], + 9825: [0.12963, 0.69444, 0, 0, 0.77778], + 9826: [0.12963, 0.69444, 0, 0, 0.77778], + 9827: [0.12963, 0.69444, 0, 0, 0.77778], + 9837: [0, 0.75, 0, 0, 0.38889], + 9838: [0.19444, 0.69444, 0, 0, 0.38889], + 9839: [0.19444, 0.69444, 0, 0, 0.38889], + 10216: [0.25, 0.75, 0, 0, 0.38889], + 10217: [0.25, 0.75, 0, 0, 0.38889], + 10222: [0.244, 0.744, 0, 0, 0.412], + 10223: [0.244, 0.745, 0, 0, 0.412], + 10229: [0.011, 0.511, 0, 0, 1.609], + 10230: [0.011, 0.511, 0, 0, 1.638], + 10231: [0.011, 0.511, 0, 0, 1.859], + 10232: [0.024, 0.525, 0, 0, 1.609], + 10233: [0.024, 0.525, 0, 0, 1.638], + 10234: [0.024, 0.525, 0, 0, 1.858], + 10236: [0.011, 0.511, 0, 0, 1.638], + 10815: [0, 0.68333, 0, 0, 0.75], + 10927: [0.13597, 0.63597, 0, 0, 0.77778], + 10928: [0.13597, 0.63597, 0, 0, 0.77778], + 57376: [0.19444, 0.69444, 0, 0, 0] + }, + "Math-BoldItalic": { + 32: [0, 0, 0, 0, 0.25], + 48: [0, 0.44444, 0, 0, 0.575], + 49: [0, 0.44444, 0, 0, 0.575], + 50: [0, 0.44444, 0, 0, 0.575], + 51: [0.19444, 0.44444, 0, 0, 0.575], + 52: [0.19444, 0.44444, 0, 0, 0.575], + 53: [0.19444, 0.44444, 0, 0, 0.575], + 54: [0, 0.64444, 0, 0, 0.575], + 55: [0.19444, 0.44444, 0, 0, 0.575], + 56: [0, 0.64444, 0, 0, 0.575], + 57: [0.19444, 0.44444, 0, 0, 0.575], + 65: [0, 0.68611, 0, 0, 0.86944], + 66: [0, 0.68611, 0.04835, 0, 0.8664], + 67: [0, 0.68611, 0.06979, 0, 0.81694], + 68: [0, 0.68611, 0.03194, 0, 0.93812], + 69: [0, 0.68611, 0.05451, 0, 0.81007], + 70: [0, 0.68611, 0.15972, 0, 0.68889], + 71: [0, 0.68611, 0, 0, 0.88673], + 72: [0, 0.68611, 0.08229, 0, 0.98229], + 73: [0, 0.68611, 0.07778, 0, 0.51111], + 74: [0, 0.68611, 0.10069, 0, 0.63125], + 75: [0, 0.68611, 0.06979, 0, 0.97118], + 76: [0, 0.68611, 0, 0, 0.75555], + 77: [0, 0.68611, 0.11424, 0, 1.14201], + 78: [0, 0.68611, 0.11424, 0, 0.95034], + 79: [0, 0.68611, 0.03194, 0, 0.83666], + 80: [0, 0.68611, 0.15972, 0, 0.72309], + 81: [0.19444, 0.68611, 0, 0, 0.86861], + 82: [0, 0.68611, 421e-5, 0, 0.87235], + 83: [0, 0.68611, 0.05382, 0, 0.69271], + 84: [0, 0.68611, 0.15972, 0, 0.63663], + 85: [0, 0.68611, 0.11424, 0, 0.80027], + 86: [0, 0.68611, 0.25555, 0, 0.67778], + 87: [0, 0.68611, 0.15972, 0, 1.09305], + 88: [0, 0.68611, 0.07778, 0, 0.94722], + 89: [0, 0.68611, 0.25555, 0, 0.67458], + 90: [0, 0.68611, 0.06979, 0, 0.77257], + 97: [0, 0.44444, 0, 0, 0.63287], + 98: [0, 0.69444, 0, 0, 0.52083], + 99: [0, 0.44444, 0, 0, 0.51342], + 100: [0, 0.69444, 0, 0, 0.60972], + 101: [0, 0.44444, 0, 0, 0.55361], + 102: [0.19444, 0.69444, 0.11042, 0, 0.56806], + 103: [0.19444, 0.44444, 0.03704, 0, 0.5449], + 104: [0, 0.69444, 0, 0, 0.66759], + 105: [0, 0.69326, 0, 0, 0.4048], + 106: [0.19444, 0.69326, 0.0622, 0, 0.47083], + 107: [0, 0.69444, 0.01852, 0, 0.6037], + 108: [0, 0.69444, 88e-4, 0, 0.34815], + 109: [0, 0.44444, 0, 0, 1.0324], + 110: [0, 0.44444, 0, 0, 0.71296], + 111: [0, 0.44444, 0, 0, 0.58472], + 112: [0.19444, 0.44444, 0, 0, 0.60092], + 113: [0.19444, 0.44444, 0.03704, 0, 0.54213], + 114: [0, 0.44444, 0.03194, 0, 0.5287], + 115: [0, 0.44444, 0, 0, 0.53125], + 116: [0, 0.63492, 0, 0, 0.41528], + 117: [0, 0.44444, 0, 0, 0.68102], + 118: [0, 0.44444, 0.03704, 0, 0.56666], + 119: [0, 0.44444, 0.02778, 0, 0.83148], + 120: [0, 0.44444, 0, 0, 0.65903], + 121: [0.19444, 0.44444, 0.03704, 0, 0.59028], + 122: [0, 0.44444, 0.04213, 0, 0.55509], + 160: [0, 0, 0, 0, 0.25], + 915: [0, 0.68611, 0.15972, 0, 0.65694], + 916: [0, 0.68611, 0, 0, 0.95833], + 920: [0, 0.68611, 0.03194, 0, 0.86722], + 923: [0, 0.68611, 0, 0, 0.80555], + 926: [0, 0.68611, 0.07458, 0, 0.84125], + 928: [0, 0.68611, 0.08229, 0, 0.98229], + 931: [0, 0.68611, 0.05451, 0, 0.88507], + 933: [0, 0.68611, 0.15972, 0, 0.67083], + 934: [0, 0.68611, 0, 0, 0.76666], + 936: [0, 0.68611, 0.11653, 0, 0.71402], + 937: [0, 0.68611, 0.04835, 0, 0.8789], + 945: [0, 0.44444, 0, 0, 0.76064], + 946: [0.19444, 0.69444, 0.03403, 0, 0.65972], + 947: [0.19444, 0.44444, 0.06389, 0, 0.59003], + 948: [0, 0.69444, 0.03819, 0, 0.52222], + 949: [0, 0.44444, 0, 0, 0.52882], + 950: [0.19444, 0.69444, 0.06215, 0, 0.50833], + 951: [0.19444, 0.44444, 0.03704, 0, 0.6], + 952: [0, 0.69444, 0.03194, 0, 0.5618], + 953: [0, 0.44444, 0, 0, 0.41204], + 954: [0, 0.44444, 0, 0, 0.66759], + 955: [0, 0.69444, 0, 0, 0.67083], + 956: [0.19444, 0.44444, 0, 0, 0.70787], + 957: [0, 0.44444, 0.06898, 0, 0.57685], + 958: [0.19444, 0.69444, 0.03021, 0, 0.50833], + 959: [0, 0.44444, 0, 0, 0.58472], + 960: [0, 0.44444, 0.03704, 0, 0.68241], + 961: [0.19444, 0.44444, 0, 0, 0.6118], + 962: [0.09722, 0.44444, 0.07917, 0, 0.42361], + 963: [0, 0.44444, 0.03704, 0, 0.68588], + 964: [0, 0.44444, 0.13472, 0, 0.52083], + 965: [0, 0.44444, 0.03704, 0, 0.63055], + 966: [0.19444, 0.44444, 0, 0, 0.74722], + 967: [0.19444, 0.44444, 0, 0, 0.71805], + 968: [0.19444, 0.69444, 0.03704, 0, 0.75833], + 969: [0, 0.44444, 0.03704, 0, 0.71782], + 977: [0, 0.69444, 0, 0, 0.69155], + 981: [0.19444, 0.69444, 0, 0, 0.7125], + 982: [0, 0.44444, 0.03194, 0, 0.975], + 1009: [0.19444, 0.44444, 0, 0, 0.6118], + 1013: [0, 0.44444, 0, 0, 0.48333], + 57649: [0, 0.44444, 0, 0, 0.39352], + 57911: [0.19444, 0.44444, 0, 0, 0.43889] + }, + "Math-Italic": { + 32: [0, 0, 0, 0, 0.25], + 48: [0, 0.43056, 0, 0, 0.5], + 49: [0, 0.43056, 0, 0, 0.5], + 50: [0, 0.43056, 0, 0, 0.5], + 51: [0.19444, 0.43056, 0, 0, 0.5], + 52: [0.19444, 0.43056, 0, 0, 0.5], + 53: [0.19444, 0.43056, 0, 0, 0.5], + 54: [0, 0.64444, 0, 0, 0.5], + 55: [0.19444, 0.43056, 0, 0, 0.5], + 56: [0, 0.64444, 0, 0, 0.5], + 57: [0.19444, 0.43056, 0, 0, 0.5], + 65: [0, 0.68333, 0, 0.13889, 0.75], + 66: [0, 0.68333, 0.05017, 0.08334, 0.75851], + 67: [0, 0.68333, 0.07153, 0.08334, 0.71472], + 68: [0, 0.68333, 0.02778, 0.05556, 0.82792], + 69: [0, 0.68333, 0.05764, 0.08334, 0.7382], + 70: [0, 0.68333, 0.13889, 0.08334, 0.64306], + 71: [0, 0.68333, 0, 0.08334, 0.78625], + 72: [0, 0.68333, 0.08125, 0.05556, 0.83125], + 73: [0, 0.68333, 0.07847, 0.11111, 0.43958], + 74: [0, 0.68333, 0.09618, 0.16667, 0.55451], + 75: [0, 0.68333, 0.07153, 0.05556, 0.84931], + 76: [0, 0.68333, 0, 0.02778, 0.68056], + 77: [0, 0.68333, 0.10903, 0.08334, 0.97014], + 78: [0, 0.68333, 0.10903, 0.08334, 0.80347], + 79: [0, 0.68333, 0.02778, 0.08334, 0.76278], + 80: [0, 0.68333, 0.13889, 0.08334, 0.64201], + 81: [0.19444, 0.68333, 0, 0.08334, 0.79056], + 82: [0, 0.68333, 773e-5, 0.08334, 0.75929], + 83: [0, 0.68333, 0.05764, 0.08334, 0.6132], + 84: [0, 0.68333, 0.13889, 0.08334, 0.58438], + 85: [0, 0.68333, 0.10903, 0.02778, 0.68278], + 86: [0, 0.68333, 0.22222, 0, 0.58333], + 87: [0, 0.68333, 0.13889, 0, 0.94445], + 88: [0, 0.68333, 0.07847, 0.08334, 0.82847], + 89: [0, 0.68333, 0.22222, 0, 0.58056], + 90: [0, 0.68333, 0.07153, 0.08334, 0.68264], + 97: [0, 0.43056, 0, 0, 0.52859], + 98: [0, 0.69444, 0, 0, 0.42917], + 99: [0, 0.43056, 0, 0.05556, 0.43276], + 100: [0, 0.69444, 0, 0.16667, 0.52049], + 101: [0, 0.43056, 0, 0.05556, 0.46563], + 102: [0.19444, 0.69444, 0.10764, 0.16667, 0.48959], + 103: [0.19444, 0.43056, 0.03588, 0.02778, 0.47697], + 104: [0, 0.69444, 0, 0, 0.57616], + 105: [0, 0.65952, 0, 0, 0.34451], + 106: [0.19444, 0.65952, 0.05724, 0, 0.41181], + 107: [0, 0.69444, 0.03148, 0, 0.5206], + 108: [0, 0.69444, 0.01968, 0.08334, 0.29838], + 109: [0, 0.43056, 0, 0, 0.87801], + 110: [0, 0.43056, 0, 0, 0.60023], + 111: [0, 0.43056, 0, 0.05556, 0.48472], + 112: [0.19444, 0.43056, 0, 0.08334, 0.50313], + 113: [0.19444, 0.43056, 0.03588, 0.08334, 0.44641], + 114: [0, 0.43056, 0.02778, 0.05556, 0.45116], + 115: [0, 0.43056, 0, 0.05556, 0.46875], + 116: [0, 0.61508, 0, 0.08334, 0.36111], + 117: [0, 0.43056, 0, 0.02778, 0.57246], + 118: [0, 0.43056, 0.03588, 0.02778, 0.48472], + 119: [0, 0.43056, 0.02691, 0.08334, 0.71592], + 120: [0, 0.43056, 0, 0.02778, 0.57153], + 121: [0.19444, 0.43056, 0.03588, 0.05556, 0.49028], + 122: [0, 0.43056, 0.04398, 0.05556, 0.46505], + 160: [0, 0, 0, 0, 0.25], + 915: [0, 0.68333, 0.13889, 0.08334, 0.61528], + 916: [0, 0.68333, 0, 0.16667, 0.83334], + 920: [0, 0.68333, 0.02778, 0.08334, 0.76278], + 923: [0, 0.68333, 0, 0.16667, 0.69445], + 926: [0, 0.68333, 0.07569, 0.08334, 0.74236], + 928: [0, 0.68333, 0.08125, 0.05556, 0.83125], + 931: [0, 0.68333, 0.05764, 0.08334, 0.77986], + 933: [0, 0.68333, 0.13889, 0.05556, 0.58333], + 934: [0, 0.68333, 0, 0.08334, 0.66667], + 936: [0, 0.68333, 0.11, 0.05556, 0.61222], + 937: [0, 0.68333, 0.05017, 0.08334, 0.7724], + 945: [0, 0.43056, 37e-4, 0.02778, 0.6397], + 946: [0.19444, 0.69444, 0.05278, 0.08334, 0.56563], + 947: [0.19444, 0.43056, 0.05556, 0, 0.51773], + 948: [0, 0.69444, 0.03785, 0.05556, 0.44444], + 949: [0, 0.43056, 0, 0.08334, 0.46632], + 950: [0.19444, 0.69444, 0.07378, 0.08334, 0.4375], + 951: [0.19444, 0.43056, 0.03588, 0.05556, 0.49653], + 952: [0, 0.69444, 0.02778, 0.08334, 0.46944], + 953: [0, 0.43056, 0, 0.05556, 0.35394], + 954: [0, 0.43056, 0, 0, 0.57616], + 955: [0, 0.69444, 0, 0, 0.58334], + 956: [0.19444, 0.43056, 0, 0.02778, 0.60255], + 957: [0, 0.43056, 0.06366, 0.02778, 0.49398], + 958: [0.19444, 0.69444, 0.04601, 0.11111, 0.4375], + 959: [0, 0.43056, 0, 0.05556, 0.48472], + 960: [0, 0.43056, 0.03588, 0, 0.57003], + 961: [0.19444, 0.43056, 0, 0.08334, 0.51702], + 962: [0.09722, 0.43056, 0.07986, 0.08334, 0.36285], + 963: [0, 0.43056, 0.03588, 0, 0.57141], + 964: [0, 0.43056, 0.1132, 0.02778, 0.43715], + 965: [0, 0.43056, 0.03588, 0.02778, 0.54028], + 966: [0.19444, 0.43056, 0, 0.08334, 0.65417], + 967: [0.19444, 0.43056, 0, 0.05556, 0.62569], + 968: [0.19444, 0.69444, 0.03588, 0.11111, 0.65139], + 969: [0, 0.43056, 0.03588, 0, 0.62245], + 977: [0, 0.69444, 0, 0.08334, 0.59144], + 981: [0.19444, 0.69444, 0, 0.08334, 0.59583], + 982: [0, 0.43056, 0.02778, 0, 0.82813], + 1009: [0.19444, 0.43056, 0, 0.08334, 0.51702], + 1013: [0, 0.43056, 0, 0.05556, 0.4059], + 57649: [0, 0.43056, 0, 0.02778, 0.32246], + 57911: [0.19444, 0.43056, 0, 0.08334, 0.38403] + }, + "SansSerif-Bold": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.36667], + 34: [0, 0.69444, 0, 0, 0.55834], + 35: [0.19444, 0.69444, 0, 0, 0.91667], + 36: [0.05556, 0.75, 0, 0, 0.55], + 37: [0.05556, 0.75, 0, 0, 1.02912], + 38: [0, 0.69444, 0, 0, 0.83056], + 39: [0, 0.69444, 0, 0, 0.30556], + 40: [0.25, 0.75, 0, 0, 0.42778], + 41: [0.25, 0.75, 0, 0, 0.42778], + 42: [0, 0.75, 0, 0, 0.55], + 43: [0.11667, 0.61667, 0, 0, 0.85556], + 44: [0.10556, 0.13056, 0, 0, 0.30556], + 45: [0, 0.45833, 0, 0, 0.36667], + 46: [0, 0.13056, 0, 0, 0.30556], + 47: [0.25, 0.75, 0, 0, 0.55], + 48: [0, 0.69444, 0, 0, 0.55], + 49: [0, 0.69444, 0, 0, 0.55], + 50: [0, 0.69444, 0, 0, 0.55], + 51: [0, 0.69444, 0, 0, 0.55], + 52: [0, 0.69444, 0, 0, 0.55], + 53: [0, 0.69444, 0, 0, 0.55], + 54: [0, 0.69444, 0, 0, 0.55], + 55: [0, 0.69444, 0, 0, 0.55], + 56: [0, 0.69444, 0, 0, 0.55], + 57: [0, 0.69444, 0, 0, 0.55], + 58: [0, 0.45833, 0, 0, 0.30556], + 59: [0.10556, 0.45833, 0, 0, 0.30556], + 61: [-0.09375, 0.40625, 0, 0, 0.85556], + 63: [0, 0.69444, 0, 0, 0.51945], + 64: [0, 0.69444, 0, 0, 0.73334], + 65: [0, 0.69444, 0, 0, 0.73334], + 66: [0, 0.69444, 0, 0, 0.73334], + 67: [0, 0.69444, 0, 0, 0.70278], + 68: [0, 0.69444, 0, 0, 0.79445], + 69: [0, 0.69444, 0, 0, 0.64167], + 70: [0, 0.69444, 0, 0, 0.61111], + 71: [0, 0.69444, 0, 0, 0.73334], + 72: [0, 0.69444, 0, 0, 0.79445], + 73: [0, 0.69444, 0, 0, 0.33056], + 74: [0, 0.69444, 0, 0, 0.51945], + 75: [0, 0.69444, 0, 0, 0.76389], + 76: [0, 0.69444, 0, 0, 0.58056], + 77: [0, 0.69444, 0, 0, 0.97778], + 78: [0, 0.69444, 0, 0, 0.79445], + 79: [0, 0.69444, 0, 0, 0.79445], + 80: [0, 0.69444, 0, 0, 0.70278], + 81: [0.10556, 0.69444, 0, 0, 0.79445], + 82: [0, 0.69444, 0, 0, 0.70278], + 83: [0, 0.69444, 0, 0, 0.61111], + 84: [0, 0.69444, 0, 0, 0.73334], + 85: [0, 0.69444, 0, 0, 0.76389], + 86: [0, 0.69444, 0.01528, 0, 0.73334], + 87: [0, 0.69444, 0.01528, 0, 1.03889], + 88: [0, 0.69444, 0, 0, 0.73334], + 89: [0, 0.69444, 0.0275, 0, 0.73334], + 90: [0, 0.69444, 0, 0, 0.67223], + 91: [0.25, 0.75, 0, 0, 0.34306], + 93: [0.25, 0.75, 0, 0, 0.34306], + 94: [0, 0.69444, 0, 0, 0.55], + 95: [0.35, 0.10833, 0.03056, 0, 0.55], + 97: [0, 0.45833, 0, 0, 0.525], + 98: [0, 0.69444, 0, 0, 0.56111], + 99: [0, 0.45833, 0, 0, 0.48889], + 100: [0, 0.69444, 0, 0, 0.56111], + 101: [0, 0.45833, 0, 0, 0.51111], + 102: [0, 0.69444, 0.07639, 0, 0.33611], + 103: [0.19444, 0.45833, 0.01528, 0, 0.55], + 104: [0, 0.69444, 0, 0, 0.56111], + 105: [0, 0.69444, 0, 0, 0.25556], + 106: [0.19444, 0.69444, 0, 0, 0.28611], + 107: [0, 0.69444, 0, 0, 0.53056], + 108: [0, 0.69444, 0, 0, 0.25556], + 109: [0, 0.45833, 0, 0, 0.86667], + 110: [0, 0.45833, 0, 0, 0.56111], + 111: [0, 0.45833, 0, 0, 0.55], + 112: [0.19444, 0.45833, 0, 0, 0.56111], + 113: [0.19444, 0.45833, 0, 0, 0.56111], + 114: [0, 0.45833, 0.01528, 0, 0.37222], + 115: [0, 0.45833, 0, 0, 0.42167], + 116: [0, 0.58929, 0, 0, 0.40417], + 117: [0, 0.45833, 0, 0, 0.56111], + 118: [0, 0.45833, 0.01528, 0, 0.5], + 119: [0, 0.45833, 0.01528, 0, 0.74445], + 120: [0, 0.45833, 0, 0, 0.5], + 121: [0.19444, 0.45833, 0.01528, 0, 0.5], + 122: [0, 0.45833, 0, 0, 0.47639], + 126: [0.35, 0.34444, 0, 0, 0.55], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.69444, 0, 0, 0.55], + 176: [0, 0.69444, 0, 0, 0.73334], + 180: [0, 0.69444, 0, 0, 0.55], + 184: [0.17014, 0, 0, 0, 0.48889], + 305: [0, 0.45833, 0, 0, 0.25556], + 567: [0.19444, 0.45833, 0, 0, 0.28611], + 710: [0, 0.69444, 0, 0, 0.55], + 711: [0, 0.63542, 0, 0, 0.55], + 713: [0, 0.63778, 0, 0, 0.55], + 728: [0, 0.69444, 0, 0, 0.55], + 729: [0, 0.69444, 0, 0, 0.30556], + 730: [0, 0.69444, 0, 0, 0.73334], + 732: [0, 0.69444, 0, 0, 0.55], + 733: [0, 0.69444, 0, 0, 0.55], + 915: [0, 0.69444, 0, 0, 0.58056], + 916: [0, 0.69444, 0, 0, 0.91667], + 920: [0, 0.69444, 0, 0, 0.85556], + 923: [0, 0.69444, 0, 0, 0.67223], + 926: [0, 0.69444, 0, 0, 0.73334], + 928: [0, 0.69444, 0, 0, 0.79445], + 931: [0, 0.69444, 0, 0, 0.79445], + 933: [0, 0.69444, 0, 0, 0.85556], + 934: [0, 0.69444, 0, 0, 0.79445], + 936: [0, 0.69444, 0, 0, 0.85556], + 937: [0, 0.69444, 0, 0, 0.79445], + 8211: [0, 0.45833, 0.03056, 0, 0.55], + 8212: [0, 0.45833, 0.03056, 0, 1.10001], + 8216: [0, 0.69444, 0, 0, 0.30556], + 8217: [0, 0.69444, 0, 0, 0.30556], + 8220: [0, 0.69444, 0, 0, 0.55834], + 8221: [0, 0.69444, 0, 0, 0.55834] + }, + "SansSerif-Italic": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0.05733, 0, 0.31945], + 34: [0, 0.69444, 316e-5, 0, 0.5], + 35: [0.19444, 0.69444, 0.05087, 0, 0.83334], + 36: [0.05556, 0.75, 0.11156, 0, 0.5], + 37: [0.05556, 0.75, 0.03126, 0, 0.83334], + 38: [0, 0.69444, 0.03058, 0, 0.75834], + 39: [0, 0.69444, 0.07816, 0, 0.27778], + 40: [0.25, 0.75, 0.13164, 0, 0.38889], + 41: [0.25, 0.75, 0.02536, 0, 0.38889], + 42: [0, 0.75, 0.11775, 0, 0.5], + 43: [0.08333, 0.58333, 0.02536, 0, 0.77778], + 44: [0.125, 0.08333, 0, 0, 0.27778], + 45: [0, 0.44444, 0.01946, 0, 0.33333], + 46: [0, 0.08333, 0, 0, 0.27778], + 47: [0.25, 0.75, 0.13164, 0, 0.5], + 48: [0, 0.65556, 0.11156, 0, 0.5], + 49: [0, 0.65556, 0.11156, 0, 0.5], + 50: [0, 0.65556, 0.11156, 0, 0.5], + 51: [0, 0.65556, 0.11156, 0, 0.5], + 52: [0, 0.65556, 0.11156, 0, 0.5], + 53: [0, 0.65556, 0.11156, 0, 0.5], + 54: [0, 0.65556, 0.11156, 0, 0.5], + 55: [0, 0.65556, 0.11156, 0, 0.5], + 56: [0, 0.65556, 0.11156, 0, 0.5], + 57: [0, 0.65556, 0.11156, 0, 0.5], + 58: [0, 0.44444, 0.02502, 0, 0.27778], + 59: [0.125, 0.44444, 0.02502, 0, 0.27778], + 61: [-0.13, 0.37, 0.05087, 0, 0.77778], + 63: [0, 0.69444, 0.11809, 0, 0.47222], + 64: [0, 0.69444, 0.07555, 0, 0.66667], + 65: [0, 0.69444, 0, 0, 0.66667], + 66: [0, 0.69444, 0.08293, 0, 0.66667], + 67: [0, 0.69444, 0.11983, 0, 0.63889], + 68: [0, 0.69444, 0.07555, 0, 0.72223], + 69: [0, 0.69444, 0.11983, 0, 0.59722], + 70: [0, 0.69444, 0.13372, 0, 0.56945], + 71: [0, 0.69444, 0.11983, 0, 0.66667], + 72: [0, 0.69444, 0.08094, 0, 0.70834], + 73: [0, 0.69444, 0.13372, 0, 0.27778], + 74: [0, 0.69444, 0.08094, 0, 0.47222], + 75: [0, 0.69444, 0.11983, 0, 0.69445], + 76: [0, 0.69444, 0, 0, 0.54167], + 77: [0, 0.69444, 0.08094, 0, 0.875], + 78: [0, 0.69444, 0.08094, 0, 0.70834], + 79: [0, 0.69444, 0.07555, 0, 0.73611], + 80: [0, 0.69444, 0.08293, 0, 0.63889], + 81: [0.125, 0.69444, 0.07555, 0, 0.73611], + 82: [0, 0.69444, 0.08293, 0, 0.64584], + 83: [0, 0.69444, 0.09205, 0, 0.55556], + 84: [0, 0.69444, 0.13372, 0, 0.68056], + 85: [0, 0.69444, 0.08094, 0, 0.6875], + 86: [0, 0.69444, 0.1615, 0, 0.66667], + 87: [0, 0.69444, 0.1615, 0, 0.94445], + 88: [0, 0.69444, 0.13372, 0, 0.66667], + 89: [0, 0.69444, 0.17261, 0, 0.66667], + 90: [0, 0.69444, 0.11983, 0, 0.61111], + 91: [0.25, 0.75, 0.15942, 0, 0.28889], + 93: [0.25, 0.75, 0.08719, 0, 0.28889], + 94: [0, 0.69444, 0.0799, 0, 0.5], + 95: [0.35, 0.09444, 0.08616, 0, 0.5], + 97: [0, 0.44444, 981e-5, 0, 0.48056], + 98: [0, 0.69444, 0.03057, 0, 0.51667], + 99: [0, 0.44444, 0.08336, 0, 0.44445], + 100: [0, 0.69444, 0.09483, 0, 0.51667], + 101: [0, 0.44444, 0.06778, 0, 0.44445], + 102: [0, 0.69444, 0.21705, 0, 0.30556], + 103: [0.19444, 0.44444, 0.10836, 0, 0.5], + 104: [0, 0.69444, 0.01778, 0, 0.51667], + 105: [0, 0.67937, 0.09718, 0, 0.23889], + 106: [0.19444, 0.67937, 0.09162, 0, 0.26667], + 107: [0, 0.69444, 0.08336, 0, 0.48889], + 108: [0, 0.69444, 0.09483, 0, 0.23889], + 109: [0, 0.44444, 0.01778, 0, 0.79445], + 110: [0, 0.44444, 0.01778, 0, 0.51667], + 111: [0, 0.44444, 0.06613, 0, 0.5], + 112: [0.19444, 0.44444, 0.0389, 0, 0.51667], + 113: [0.19444, 0.44444, 0.04169, 0, 0.51667], + 114: [0, 0.44444, 0.10836, 0, 0.34167], + 115: [0, 0.44444, 0.0778, 0, 0.38333], + 116: [0, 0.57143, 0.07225, 0, 0.36111], + 117: [0, 0.44444, 0.04169, 0, 0.51667], + 118: [0, 0.44444, 0.10836, 0, 0.46111], + 119: [0, 0.44444, 0.10836, 0, 0.68334], + 120: [0, 0.44444, 0.09169, 0, 0.46111], + 121: [0.19444, 0.44444, 0.10836, 0, 0.46111], + 122: [0, 0.44444, 0.08752, 0, 0.43472], + 126: [0.35, 0.32659, 0.08826, 0, 0.5], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.67937, 0.06385, 0, 0.5], + 176: [0, 0.69444, 0, 0, 0.73752], + 184: [0.17014, 0, 0, 0, 0.44445], + 305: [0, 0.44444, 0.04169, 0, 0.23889], + 567: [0.19444, 0.44444, 0.04169, 0, 0.26667], + 710: [0, 0.69444, 0.0799, 0, 0.5], + 711: [0, 0.63194, 0.08432, 0, 0.5], + 713: [0, 0.60889, 0.08776, 0, 0.5], + 714: [0, 0.69444, 0.09205, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0.09483, 0, 0.5], + 729: [0, 0.67937, 0.07774, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.73752], + 732: [0, 0.67659, 0.08826, 0, 0.5], + 733: [0, 0.69444, 0.09205, 0, 0.5], + 915: [0, 0.69444, 0.13372, 0, 0.54167], + 916: [0, 0.69444, 0, 0, 0.83334], + 920: [0, 0.69444, 0.07555, 0, 0.77778], + 923: [0, 0.69444, 0, 0, 0.61111], + 926: [0, 0.69444, 0.12816, 0, 0.66667], + 928: [0, 0.69444, 0.08094, 0, 0.70834], + 931: [0, 0.69444, 0.11983, 0, 0.72222], + 933: [0, 0.69444, 0.09031, 0, 0.77778], + 934: [0, 0.69444, 0.04603, 0, 0.72222], + 936: [0, 0.69444, 0.09031, 0, 0.77778], + 937: [0, 0.69444, 0.08293, 0, 0.72222], + 8211: [0, 0.44444, 0.08616, 0, 0.5], + 8212: [0, 0.44444, 0.08616, 0, 1], + 8216: [0, 0.69444, 0.07816, 0, 0.27778], + 8217: [0, 0.69444, 0.07816, 0, 0.27778], + 8220: [0, 0.69444, 0.14205, 0, 0.5], + 8221: [0, 0.69444, 316e-5, 0, 0.5] + }, + "SansSerif-Regular": { + 32: [0, 0, 0, 0, 0.25], + 33: [0, 0.69444, 0, 0, 0.31945], + 34: [0, 0.69444, 0, 0, 0.5], + 35: [0.19444, 0.69444, 0, 0, 0.83334], + 36: [0.05556, 0.75, 0, 0, 0.5], + 37: [0.05556, 0.75, 0, 0, 0.83334], + 38: [0, 0.69444, 0, 0, 0.75834], + 39: [0, 0.69444, 0, 0, 0.27778], + 40: [0.25, 0.75, 0, 0, 0.38889], + 41: [0.25, 0.75, 0, 0, 0.38889], + 42: [0, 0.75, 0, 0, 0.5], + 43: [0.08333, 0.58333, 0, 0, 0.77778], + 44: [0.125, 0.08333, 0, 0, 0.27778], + 45: [0, 0.44444, 0, 0, 0.33333], + 46: [0, 0.08333, 0, 0, 0.27778], + 47: [0.25, 0.75, 0, 0, 0.5], + 48: [0, 0.65556, 0, 0, 0.5], + 49: [0, 0.65556, 0, 0, 0.5], + 50: [0, 0.65556, 0, 0, 0.5], + 51: [0, 0.65556, 0, 0, 0.5], + 52: [0, 0.65556, 0, 0, 0.5], + 53: [0, 0.65556, 0, 0, 0.5], + 54: [0, 0.65556, 0, 0, 0.5], + 55: [0, 0.65556, 0, 0, 0.5], + 56: [0, 0.65556, 0, 0, 0.5], + 57: [0, 0.65556, 0, 0, 0.5], + 58: [0, 0.44444, 0, 0, 0.27778], + 59: [0.125, 0.44444, 0, 0, 0.27778], + 61: [-0.13, 0.37, 0, 0, 0.77778], + 63: [0, 0.69444, 0, 0, 0.47222], + 64: [0, 0.69444, 0, 0, 0.66667], + 65: [0, 0.69444, 0, 0, 0.66667], + 66: [0, 0.69444, 0, 0, 0.66667], + 67: [0, 0.69444, 0, 0, 0.63889], + 68: [0, 0.69444, 0, 0, 0.72223], + 69: [0, 0.69444, 0, 0, 0.59722], + 70: [0, 0.69444, 0, 0, 0.56945], + 71: [0, 0.69444, 0, 0, 0.66667], + 72: [0, 0.69444, 0, 0, 0.70834], + 73: [0, 0.69444, 0, 0, 0.27778], + 74: [0, 0.69444, 0, 0, 0.47222], + 75: [0, 0.69444, 0, 0, 0.69445], + 76: [0, 0.69444, 0, 0, 0.54167], + 77: [0, 0.69444, 0, 0, 0.875], + 78: [0, 0.69444, 0, 0, 0.70834], + 79: [0, 0.69444, 0, 0, 0.73611], + 80: [0, 0.69444, 0, 0, 0.63889], + 81: [0.125, 0.69444, 0, 0, 0.73611], + 82: [0, 0.69444, 0, 0, 0.64584], + 83: [0, 0.69444, 0, 0, 0.55556], + 84: [0, 0.69444, 0, 0, 0.68056], + 85: [0, 0.69444, 0, 0, 0.6875], + 86: [0, 0.69444, 0.01389, 0, 0.66667], + 87: [0, 0.69444, 0.01389, 0, 0.94445], + 88: [0, 0.69444, 0, 0, 0.66667], + 89: [0, 0.69444, 0.025, 0, 0.66667], + 90: [0, 0.69444, 0, 0, 0.61111], + 91: [0.25, 0.75, 0, 0, 0.28889], + 93: [0.25, 0.75, 0, 0, 0.28889], + 94: [0, 0.69444, 0, 0, 0.5], + 95: [0.35, 0.09444, 0.02778, 0, 0.5], + 97: [0, 0.44444, 0, 0, 0.48056], + 98: [0, 0.69444, 0, 0, 0.51667], + 99: [0, 0.44444, 0, 0, 0.44445], + 100: [0, 0.69444, 0, 0, 0.51667], + 101: [0, 0.44444, 0, 0, 0.44445], + 102: [0, 0.69444, 0.06944, 0, 0.30556], + 103: [0.19444, 0.44444, 0.01389, 0, 0.5], + 104: [0, 0.69444, 0, 0, 0.51667], + 105: [0, 0.67937, 0, 0, 0.23889], + 106: [0.19444, 0.67937, 0, 0, 0.26667], + 107: [0, 0.69444, 0, 0, 0.48889], + 108: [0, 0.69444, 0, 0, 0.23889], + 109: [0, 0.44444, 0, 0, 0.79445], + 110: [0, 0.44444, 0, 0, 0.51667], + 111: [0, 0.44444, 0, 0, 0.5], + 112: [0.19444, 0.44444, 0, 0, 0.51667], + 113: [0.19444, 0.44444, 0, 0, 0.51667], + 114: [0, 0.44444, 0.01389, 0, 0.34167], + 115: [0, 0.44444, 0, 0, 0.38333], + 116: [0, 0.57143, 0, 0, 0.36111], + 117: [0, 0.44444, 0, 0, 0.51667], + 118: [0, 0.44444, 0.01389, 0, 0.46111], + 119: [0, 0.44444, 0.01389, 0, 0.68334], + 120: [0, 0.44444, 0, 0, 0.46111], + 121: [0.19444, 0.44444, 0.01389, 0, 0.46111], + 122: [0, 0.44444, 0, 0, 0.43472], + 126: [0.35, 0.32659, 0, 0, 0.5], + 160: [0, 0, 0, 0, 0.25], + 168: [0, 0.67937, 0, 0, 0.5], + 176: [0, 0.69444, 0, 0, 0.66667], + 184: [0.17014, 0, 0, 0, 0.44445], + 305: [0, 0.44444, 0, 0, 0.23889], + 567: [0.19444, 0.44444, 0, 0, 0.26667], + 710: [0, 0.69444, 0, 0, 0.5], + 711: [0, 0.63194, 0, 0, 0.5], + 713: [0, 0.60889, 0, 0, 0.5], + 714: [0, 0.69444, 0, 0, 0.5], + 715: [0, 0.69444, 0, 0, 0.5], + 728: [0, 0.69444, 0, 0, 0.5], + 729: [0, 0.67937, 0, 0, 0.27778], + 730: [0, 0.69444, 0, 0, 0.66667], + 732: [0, 0.67659, 0, 0, 0.5], + 733: [0, 0.69444, 0, 0, 0.5], + 915: [0, 0.69444, 0, 0, 0.54167], + 916: [0, 0.69444, 0, 0, 0.83334], + 920: [0, 0.69444, 0, 0, 0.77778], + 923: [0, 0.69444, 0, 0, 0.61111], + 926: [0, 0.69444, 0, 0, 0.66667], + 928: [0, 0.69444, 0, 0, 0.70834], + 931: [0, 0.69444, 0, 0, 0.72222], + 933: [0, 0.69444, 0, 0, 0.77778], + 934: [0, 0.69444, 0, 0, 0.72222], + 936: [0, 0.69444, 0, 0, 0.77778], + 937: [0, 0.69444, 0, 0, 0.72222], + 8211: [0, 0.44444, 0.02778, 0, 0.5], + 8212: [0, 0.44444, 0.02778, 0, 1], + 8216: [0, 0.69444, 0, 0, 0.27778], + 8217: [0, 0.69444, 0, 0, 0.27778], + 8220: [0, 0.69444, 0, 0, 0.5], + 8221: [0, 0.69444, 0, 0, 0.5] + }, + "Script-Regular": { + 32: [0, 0, 0, 0, 0.25], + 65: [0, 0.7, 0.22925, 0, 0.80253], + 66: [0, 0.7, 0.04087, 0, 0.90757], + 67: [0, 0.7, 0.1689, 0, 0.66619], + 68: [0, 0.7, 0.09371, 0, 0.77443], + 69: [0, 0.7, 0.18583, 0, 0.56162], + 70: [0, 0.7, 0.13634, 0, 0.89544], + 71: [0, 0.7, 0.17322, 0, 0.60961], + 72: [0, 0.7, 0.29694, 0, 0.96919], + 73: [0, 0.7, 0.19189, 0, 0.80907], + 74: [0.27778, 0.7, 0.19189, 0, 1.05159], + 75: [0, 0.7, 0.31259, 0, 0.91364], + 76: [0, 0.7, 0.19189, 0, 0.87373], + 77: [0, 0.7, 0.15981, 0, 1.08031], + 78: [0, 0.7, 0.3525, 0, 0.9015], + 79: [0, 0.7, 0.08078, 0, 0.73787], + 80: [0, 0.7, 0.08078, 0, 1.01262], + 81: [0, 0.7, 0.03305, 0, 0.88282], + 82: [0, 0.7, 0.06259, 0, 0.85], + 83: [0, 0.7, 0.19189, 0, 0.86767], + 84: [0, 0.7, 0.29087, 0, 0.74697], + 85: [0, 0.7, 0.25815, 0, 0.79996], + 86: [0, 0.7, 0.27523, 0, 0.62204], + 87: [0, 0.7, 0.27523, 0, 0.80532], + 88: [0, 0.7, 0.26006, 0, 0.94445], + 89: [0, 0.7, 0.2939, 0, 0.70961], + 90: [0, 0.7, 0.24037, 0, 0.8212], + 160: [0, 0, 0, 0, 0.25] + }, + "Size1-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.35001, 0.85, 0, 0, 0.45834], + 41: [0.35001, 0.85, 0, 0, 0.45834], + 47: [0.35001, 0.85, 0, 0, 0.57778], + 91: [0.35001, 0.85, 0, 0, 0.41667], + 92: [0.35001, 0.85, 0, 0, 0.57778], + 93: [0.35001, 0.85, 0, 0, 0.41667], + 123: [0.35001, 0.85, 0, 0, 0.58334], + 125: [0.35001, 0.85, 0, 0, 0.58334], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.72222, 0, 0, 0.55556], + 732: [0, 0.72222, 0, 0, 0.55556], + 770: [0, 0.72222, 0, 0, 0.55556], + 771: [0, 0.72222, 0, 0, 0.55556], + 8214: [-99e-5, 0.601, 0, 0, 0.77778], + 8593: [1e-5, 0.6, 0, 0, 0.66667], + 8595: [1e-5, 0.6, 0, 0, 0.66667], + 8657: [1e-5, 0.6, 0, 0, 0.77778], + 8659: [1e-5, 0.6, 0, 0, 0.77778], + 8719: [0.25001, 0.75, 0, 0, 0.94445], + 8720: [0.25001, 0.75, 0, 0, 0.94445], + 8721: [0.25001, 0.75, 0, 0, 1.05556], + 8730: [0.35001, 0.85, 0, 0, 1], + 8739: [-599e-5, 0.606, 0, 0, 0.33333], + 8741: [-599e-5, 0.606, 0, 0, 0.55556], + 8747: [0.30612, 0.805, 0.19445, 0, 0.47222], + 8748: [0.306, 0.805, 0.19445, 0, 0.47222], + 8749: [0.306, 0.805, 0.19445, 0, 0.47222], + 8750: [0.30612, 0.805, 0.19445, 0, 0.47222], + 8896: [0.25001, 0.75, 0, 0, 0.83334], + 8897: [0.25001, 0.75, 0, 0, 0.83334], + 8898: [0.25001, 0.75, 0, 0, 0.83334], + 8899: [0.25001, 0.75, 0, 0, 0.83334], + 8968: [0.35001, 0.85, 0, 0, 0.47222], + 8969: [0.35001, 0.85, 0, 0, 0.47222], + 8970: [0.35001, 0.85, 0, 0, 0.47222], + 8971: [0.35001, 0.85, 0, 0, 0.47222], + 9168: [-99e-5, 0.601, 0, 0, 0.66667], + 10216: [0.35001, 0.85, 0, 0, 0.47222], + 10217: [0.35001, 0.85, 0, 0, 0.47222], + 10752: [0.25001, 0.75, 0, 0, 1.11111], + 10753: [0.25001, 0.75, 0, 0, 1.11111], + 10754: [0.25001, 0.75, 0, 0, 1.11111], + 10756: [0.25001, 0.75, 0, 0, 0.83334], + 10758: [0.25001, 0.75, 0, 0, 0.83334] + }, + "Size2-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.65002, 1.15, 0, 0, 0.59722], + 41: [0.65002, 1.15, 0, 0, 0.59722], + 47: [0.65002, 1.15, 0, 0, 0.81111], + 91: [0.65002, 1.15, 0, 0, 0.47222], + 92: [0.65002, 1.15, 0, 0, 0.81111], + 93: [0.65002, 1.15, 0, 0, 0.47222], + 123: [0.65002, 1.15, 0, 0, 0.66667], + 125: [0.65002, 1.15, 0, 0, 0.66667], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.75, 0, 0, 1], + 732: [0, 0.75, 0, 0, 1], + 770: [0, 0.75, 0, 0, 1], + 771: [0, 0.75, 0, 0, 1], + 8719: [0.55001, 1.05, 0, 0, 1.27778], + 8720: [0.55001, 1.05, 0, 0, 1.27778], + 8721: [0.55001, 1.05, 0, 0, 1.44445], + 8730: [0.65002, 1.15, 0, 0, 1], + 8747: [0.86225, 1.36, 0.44445, 0, 0.55556], + 8748: [0.862, 1.36, 0.44445, 0, 0.55556], + 8749: [0.862, 1.36, 0.44445, 0, 0.55556], + 8750: [0.86225, 1.36, 0.44445, 0, 0.55556], + 8896: [0.55001, 1.05, 0, 0, 1.11111], + 8897: [0.55001, 1.05, 0, 0, 1.11111], + 8898: [0.55001, 1.05, 0, 0, 1.11111], + 8899: [0.55001, 1.05, 0, 0, 1.11111], + 8968: [0.65002, 1.15, 0, 0, 0.52778], + 8969: [0.65002, 1.15, 0, 0, 0.52778], + 8970: [0.65002, 1.15, 0, 0, 0.52778], + 8971: [0.65002, 1.15, 0, 0, 0.52778], + 10216: [0.65002, 1.15, 0, 0, 0.61111], + 10217: [0.65002, 1.15, 0, 0, 0.61111], + 10752: [0.55001, 1.05, 0, 0, 1.51112], + 10753: [0.55001, 1.05, 0, 0, 1.51112], + 10754: [0.55001, 1.05, 0, 0, 1.51112], + 10756: [0.55001, 1.05, 0, 0, 1.11111], + 10758: [0.55001, 1.05, 0, 0, 1.11111] + }, + "Size3-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [0.95003, 1.45, 0, 0, 0.73611], + 41: [0.95003, 1.45, 0, 0, 0.73611], + 47: [0.95003, 1.45, 0, 0, 1.04445], + 91: [0.95003, 1.45, 0, 0, 0.52778], + 92: [0.95003, 1.45, 0, 0, 1.04445], + 93: [0.95003, 1.45, 0, 0, 0.52778], + 123: [0.95003, 1.45, 0, 0, 0.75], + 125: [0.95003, 1.45, 0, 0, 0.75], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.75, 0, 0, 1.44445], + 732: [0, 0.75, 0, 0, 1.44445], + 770: [0, 0.75, 0, 0, 1.44445], + 771: [0, 0.75, 0, 0, 1.44445], + 8730: [0.95003, 1.45, 0, 0, 1], + 8968: [0.95003, 1.45, 0, 0, 0.58334], + 8969: [0.95003, 1.45, 0, 0, 0.58334], + 8970: [0.95003, 1.45, 0, 0, 0.58334], + 8971: [0.95003, 1.45, 0, 0, 0.58334], + 10216: [0.95003, 1.45, 0, 0, 0.75], + 10217: [0.95003, 1.45, 0, 0, 0.75] + }, + "Size4-Regular": { + 32: [0, 0, 0, 0, 0.25], + 40: [1.25003, 1.75, 0, 0, 0.79167], + 41: [1.25003, 1.75, 0, 0, 0.79167], + 47: [1.25003, 1.75, 0, 0, 1.27778], + 91: [1.25003, 1.75, 0, 0, 0.58334], + 92: [1.25003, 1.75, 0, 0, 1.27778], + 93: [1.25003, 1.75, 0, 0, 0.58334], + 123: [1.25003, 1.75, 0, 0, 0.80556], + 125: [1.25003, 1.75, 0, 0, 0.80556], + 160: [0, 0, 0, 0, 0.25], + 710: [0, 0.825, 0, 0, 1.8889], + 732: [0, 0.825, 0, 0, 1.8889], + 770: [0, 0.825, 0, 0, 1.8889], + 771: [0, 0.825, 0, 0, 1.8889], + 8730: [1.25003, 1.75, 0, 0, 1], + 8968: [1.25003, 1.75, 0, 0, 0.63889], + 8969: [1.25003, 1.75, 0, 0, 0.63889], + 8970: [1.25003, 1.75, 0, 0, 0.63889], + 8971: [1.25003, 1.75, 0, 0, 0.63889], + 9115: [0.64502, 1.155, 0, 0, 0.875], + 9116: [1e-5, 0.6, 0, 0, 0.875], + 9117: [0.64502, 1.155, 0, 0, 0.875], + 9118: [0.64502, 1.155, 0, 0, 0.875], + 9119: [1e-5, 0.6, 0, 0, 0.875], + 9120: [0.64502, 1.155, 0, 0, 0.875], + 9121: [0.64502, 1.155, 0, 0, 0.66667], + 9122: [-99e-5, 0.601, 0, 0, 0.66667], + 9123: [0.64502, 1.155, 0, 0, 0.66667], + 9124: [0.64502, 1.155, 0, 0, 0.66667], + 9125: [-99e-5, 0.601, 0, 0, 0.66667], + 9126: [0.64502, 1.155, 0, 0, 0.66667], + 9127: [1e-5, 0.9, 0, 0, 0.88889], + 9128: [0.65002, 1.15, 0, 0, 0.88889], + 9129: [0.90001, 0, 0, 0, 0.88889], + 9130: [0, 0.3, 0, 0, 0.88889], + 9131: [1e-5, 0.9, 0, 0, 0.88889], + 9132: [0.65002, 1.15, 0, 0, 0.88889], + 9133: [0.90001, 0, 0, 0, 0.88889], + 9143: [0.88502, 0.915, 0, 0, 1.05556], + 10216: [1.25003, 1.75, 0, 0, 0.80556], + 10217: [1.25003, 1.75, 0, 0, 0.80556], + 57344: [-499e-5, 0.605, 0, 0, 1.05556], + 57345: [-499e-5, 0.605, 0, 0, 1.05556], + 57680: [0, 0.12, 0, 0, 0.45], + 57681: [0, 0.12, 0, 0, 0.45], + 57682: [0, 0.12, 0, 0, 0.45], + 57683: [0, 0.12, 0, 0, 0.45] + }, + "Typewriter-Regular": { + 32: [0, 0, 0, 0, 0.525], + 33: [0, 0.61111, 0, 0, 0.525], + 34: [0, 0.61111, 0, 0, 0.525], + 35: [0, 0.61111, 0, 0, 0.525], + 36: [0.08333, 0.69444, 0, 0, 0.525], + 37: [0.08333, 0.69444, 0, 0, 0.525], + 38: [0, 0.61111, 0, 0, 0.525], + 39: [0, 0.61111, 0, 0, 0.525], + 40: [0.08333, 0.69444, 0, 0, 0.525], + 41: [0.08333, 0.69444, 0, 0, 0.525], + 42: [0, 0.52083, 0, 0, 0.525], + 43: [-0.08056, 0.53055, 0, 0, 0.525], + 44: [0.13889, 0.125, 0, 0, 0.525], + 45: [-0.08056, 0.53055, 0, 0, 0.525], + 46: [0, 0.125, 0, 0, 0.525], + 47: [0.08333, 0.69444, 0, 0, 0.525], + 48: [0, 0.61111, 0, 0, 0.525], + 49: [0, 0.61111, 0, 0, 0.525], + 50: [0, 0.61111, 0, 0, 0.525], + 51: [0, 0.61111, 0, 0, 0.525], + 52: [0, 0.61111, 0, 0, 0.525], + 53: [0, 0.61111, 0, 0, 0.525], + 54: [0, 0.61111, 0, 0, 0.525], + 55: [0, 0.61111, 0, 0, 0.525], + 56: [0, 0.61111, 0, 0, 0.525], + 57: [0, 0.61111, 0, 0, 0.525], + 58: [0, 0.43056, 0, 0, 0.525], + 59: [0.13889, 0.43056, 0, 0, 0.525], + 60: [-0.05556, 0.55556, 0, 0, 0.525], + 61: [-0.19549, 0.41562, 0, 0, 0.525], + 62: [-0.05556, 0.55556, 0, 0, 0.525], + 63: [0, 0.61111, 0, 0, 0.525], + 64: [0, 0.61111, 0, 0, 0.525], + 65: [0, 0.61111, 0, 0, 0.525], + 66: [0, 0.61111, 0, 0, 0.525], + 67: [0, 0.61111, 0, 0, 0.525], + 68: [0, 0.61111, 0, 0, 0.525], + 69: [0, 0.61111, 0, 0, 0.525], + 70: [0, 0.61111, 0, 0, 0.525], + 71: [0, 0.61111, 0, 0, 0.525], + 72: [0, 0.61111, 0, 0, 0.525], + 73: [0, 0.61111, 0, 0, 0.525], + 74: [0, 0.61111, 0, 0, 0.525], + 75: [0, 0.61111, 0, 0, 0.525], + 76: [0, 0.61111, 0, 0, 0.525], + 77: [0, 0.61111, 0, 0, 0.525], + 78: [0, 0.61111, 0, 0, 0.525], + 79: [0, 0.61111, 0, 0, 0.525], + 80: [0, 0.61111, 0, 0, 0.525], + 81: [0.13889, 0.61111, 0, 0, 0.525], + 82: [0, 0.61111, 0, 0, 0.525], + 83: [0, 0.61111, 0, 0, 0.525], + 84: [0, 0.61111, 0, 0, 0.525], + 85: [0, 0.61111, 0, 0, 0.525], + 86: [0, 0.61111, 0, 0, 0.525], + 87: [0, 0.61111, 0, 0, 0.525], + 88: [0, 0.61111, 0, 0, 0.525], + 89: [0, 0.61111, 0, 0, 0.525], + 90: [0, 0.61111, 0, 0, 0.525], + 91: [0.08333, 0.69444, 0, 0, 0.525], + 92: [0.08333, 0.69444, 0, 0, 0.525], + 93: [0.08333, 0.69444, 0, 0, 0.525], + 94: [0, 0.61111, 0, 0, 0.525], + 95: [0.09514, 0, 0, 0, 0.525], + 96: [0, 0.61111, 0, 0, 0.525], + 97: [0, 0.43056, 0, 0, 0.525], + 98: [0, 0.61111, 0, 0, 0.525], + 99: [0, 0.43056, 0, 0, 0.525], + 100: [0, 0.61111, 0, 0, 0.525], + 101: [0, 0.43056, 0, 0, 0.525], + 102: [0, 0.61111, 0, 0, 0.525], + 103: [0.22222, 0.43056, 0, 0, 0.525], + 104: [0, 0.61111, 0, 0, 0.525], + 105: [0, 0.61111, 0, 0, 0.525], + 106: [0.22222, 0.61111, 0, 0, 0.525], + 107: [0, 0.61111, 0, 0, 0.525], + 108: [0, 0.61111, 0, 0, 0.525], + 109: [0, 0.43056, 0, 0, 0.525], + 110: [0, 0.43056, 0, 0, 0.525], + 111: [0, 0.43056, 0, 0, 0.525], + 112: [0.22222, 0.43056, 0, 0, 0.525], + 113: [0.22222, 0.43056, 0, 0, 0.525], + 114: [0, 0.43056, 0, 0, 0.525], + 115: [0, 0.43056, 0, 0, 0.525], + 116: [0, 0.55358, 0, 0, 0.525], + 117: [0, 0.43056, 0, 0, 0.525], + 118: [0, 0.43056, 0, 0, 0.525], + 119: [0, 0.43056, 0, 0, 0.525], + 120: [0, 0.43056, 0, 0, 0.525], + 121: [0.22222, 0.43056, 0, 0, 0.525], + 122: [0, 0.43056, 0, 0, 0.525], + 123: [0.08333, 0.69444, 0, 0, 0.525], + 124: [0.08333, 0.69444, 0, 0, 0.525], + 125: [0.08333, 0.69444, 0, 0, 0.525], + 126: [0, 0.61111, 0, 0, 0.525], + 127: [0, 0.61111, 0, 0, 0.525], + 160: [0, 0, 0, 0, 0.525], + 176: [0, 0.61111, 0, 0, 0.525], + 184: [0.19445, 0, 0, 0, 0.525], + 305: [0, 0.43056, 0, 0, 0.525], + 567: [0.22222, 0.43056, 0, 0, 0.525], + 711: [0, 0.56597, 0, 0, 0.525], + 713: [0, 0.56555, 0, 0, 0.525], + 714: [0, 0.61111, 0, 0, 0.525], + 715: [0, 0.61111, 0, 0, 0.525], + 728: [0, 0.61111, 0, 0, 0.525], + 730: [0, 0.61111, 0, 0, 0.525], + 770: [0, 0.61111, 0, 0, 0.525], + 771: [0, 0.61111, 0, 0, 0.525], + 776: [0, 0.61111, 0, 0, 0.525], + 915: [0, 0.61111, 0, 0, 0.525], + 916: [0, 0.61111, 0, 0, 0.525], + 920: [0, 0.61111, 0, 0, 0.525], + 923: [0, 0.61111, 0, 0, 0.525], + 926: [0, 0.61111, 0, 0, 0.525], + 928: [0, 0.61111, 0, 0, 0.525], + 931: [0, 0.61111, 0, 0, 0.525], + 933: [0, 0.61111, 0, 0, 0.525], + 934: [0, 0.61111, 0, 0, 0.525], + 936: [0, 0.61111, 0, 0, 0.525], + 937: [0, 0.61111, 0, 0, 0.525], + 8216: [0, 0.61111, 0, 0, 0.525], + 8217: [0, 0.61111, 0, 0, 0.525], + 8242: [0, 0.61111, 0, 0, 0.525], + 9251: [0.11111, 0.21944, 0, 0, 0.525] + } +}, Ni = { + slant: [0.25, 0.25, 0.25], + // sigma1 + space: [0, 0, 0], + // sigma2 + stretch: [0, 0, 0], + // sigma3 + shrink: [0, 0, 0], + // sigma4 + xHeight: [0.431, 0.431, 0.431], + // sigma5 + quad: [1, 1.171, 1.472], + // sigma6 + extraSpace: [0, 0, 0], + // sigma7 + num1: [0.677, 0.732, 0.925], + // sigma8 + num2: [0.394, 0.384, 0.387], + // sigma9 + num3: [0.444, 0.471, 0.504], + // sigma10 + denom1: [0.686, 0.752, 1.025], + // sigma11 + denom2: [0.345, 0.344, 0.532], + // sigma12 + sup1: [0.413, 0.503, 0.504], + // sigma13 + sup2: [0.363, 0.431, 0.404], + // sigma14 + sup3: [0.289, 0.286, 0.294], + // sigma15 + sub1: [0.15, 0.143, 0.2], + // sigma16 + sub2: [0.247, 0.286, 0.4], + // sigma17 + supDrop: [0.386, 0.353, 0.494], + // sigma18 + subDrop: [0.05, 0.071, 0.1], + // sigma19 + delim1: [2.39, 1.7, 1.98], + // sigma20 + delim2: [1.01, 1.157, 1.42], + // sigma21 + axisHeight: [0.25, 0.25, 0.25], + // sigma22 + // These font metrics are extracted from TeX by using tftopl on cmex10.tfm; + // they correspond to the font parameters of the extension fonts (family 3). + // See the TeXbook, page 441. In AMSTeX, the extension fonts scale; to + // match cmex7, we'd use cmex7.tfm values for script and scriptscript + // values. + defaultRuleThickness: [0.04, 0.049, 0.049], + // xi8; cmex7: 0.049 + bigOpSpacing1: [0.111, 0.111, 0.111], + // xi9 + bigOpSpacing2: [0.166, 0.166, 0.166], + // xi10 + bigOpSpacing3: [0.2, 0.2, 0.2], + // xi11 + bigOpSpacing4: [0.6, 0.611, 0.611], + // xi12; cmex7: 0.611 + bigOpSpacing5: [0.1, 0.143, 0.143], + // xi13; cmex7: 0.143 + // The \sqrt rule width is taken from the height of the surd character. + // Since we use the same font at all sizes, this thickness doesn't scale. + sqrtRuleThickness: [0.04, 0.04, 0.04], + // This value determines how large a pt is, for metrics which are defined + // in terms of pts. + // This value is also used in katex.scss; if you change it make sure the + // values match. + ptPerEm: [10, 10, 10], + // The space between adjacent `|` columns in an array definition. From + // `\showthe\doublerulesep` in LaTeX. Equals 2.0 / ptPerEm. + doubleRuleSep: [0.2, 0.2, 0.2], + // The width of separator lines in {array} environments. From + // `\showthe\arrayrulewidth` in LaTeX. Equals 0.4 / ptPerEm. + arrayRuleWidth: [0.04, 0.04, 0.04], + // Two values from LaTeX source2e: + fboxsep: [0.3, 0.3, 0.3], + // 3 pt / ptPerEm + fboxrule: [0.04, 0.04, 0.04] + // 0.4 pt / ptPerEm +}, Y1 = { + // Latin-1 + Å: "A", + Ð: "D", + Þ: "o", + å: "a", + ð: "d", + þ: "o", + // Cyrillic + А: "A", + Б: "B", + В: "B", + Г: "F", + Д: "A", + Е: "E", + Ж: "K", + З: "3", + И: "N", + Й: "N", + К: "K", + Л: "N", + М: "M", + Н: "H", + О: "O", + П: "N", + Р: "P", + С: "C", + Т: "T", + У: "y", + Ф: "O", + Х: "X", + Ц: "U", + Ч: "h", + Ш: "W", + Щ: "W", + Ъ: "B", + Ы: "X", + Ь: "B", + Э: "3", + Ю: "X", + Я: "R", + а: "a", + б: "b", + в: "a", + г: "r", + д: "y", + е: "e", + ж: "m", + з: "e", + и: "n", + й: "n", + к: "n", + л: "n", + м: "m", + н: "n", + о: "o", + п: "n", + р: "p", + с: "c", + т: "o", + у: "y", + ф: "b", + х: "x", + ц: "n", + ч: "n", + ш: "w", + щ: "w", + ъ: "a", + ы: "m", + ь: "a", + э: "e", + ю: "m", + я: "r" +}; +function e3(n, e) { + rr[n] = e; +} +function Cu(n, e, t) { + if (!rr[e]) + throw new Error("Font metrics not found for font: " + e + "."); + var r = n.charCodeAt(0), a = rr[e][r]; + if (!a && n[0] in Y1 && (r = Y1[n[0]].charCodeAt(0), a = rr[e][r]), !a && t === "text" && Sd(r) && (a = rr[e][77]), a) + return { + depth: a[0], + height: a[1], + italic: a[2], + skew: a[3], + width: a[4] + }; +} +var Ys = {}; +function t3(n) { + var e; + if (n >= 5 ? e = 0 : n >= 3 ? e = 1 : e = 2, !Ys[e]) { + var t = Ys[e] = { + cssEmPerMu: Ni.quad[e] / 18 + }; + for (var r in Ni) + Ni.hasOwnProperty(r) && (t[r] = Ni[r][e]); + } + return Ys[e]; +} +var r3 = [ + // Each element contains [textsize, scriptsize, scriptscriptsize]. + // The size mappings are taken from TeX with \normalsize=10pt. + [1, 1, 1], + // size1: [5, 5, 5] \tiny + [2, 1, 1], + // size2: [6, 5, 5] + [3, 1, 1], + // size3: [7, 5, 5] \scriptsize + [4, 2, 1], + // size4: [8, 6, 5] \footnotesize + [5, 2, 1], + // size5: [9, 6, 5] \small + [6, 3, 1], + // size6: [10, 7, 5] \normalsize + [7, 4, 2], + // size7: [12, 8, 6] \large + [8, 6, 3], + // size8: [14.4, 10, 7] \Large + [9, 7, 6], + // size9: [17.28, 12, 10] \LARGE + [10, 8, 7], + // size10: [20.74, 14.4, 12] \huge + [11, 10, 9] + // size11: [24.88, 20.74, 17.28] \HUGE +], Z1 = [ + // fontMetrics.js:getGlobalMetrics also uses size indexes, so if + // you change size indexes, change that function. + 0.5, + 0.6, + 0.7, + 0.8, + 0.9, + 1, + 1.2, + 1.44, + 1.728, + 2.074, + 2.488 +], K1 = function(e, t) { + return t.size < 2 ? e : r3[e - 1][t.size - 1]; +}; +class Dr { + // A font family applies to a group of fonts (i.e. SansSerif), while a font + // represents a specific font (i.e. SansSerif Bold). + // See: https://tex.stackexchange.com/questions/22350/difference-between-textrm-and-mathrm + /** + * The base size index. + */ + constructor(e) { + this.style = void 0, this.color = void 0, this.size = void 0, this.textSize = void 0, this.phantom = void 0, this.font = void 0, this.fontFamily = void 0, this.fontWeight = void 0, this.fontShape = void 0, this.sizeMultiplier = void 0, this.maxSize = void 0, this.minRuleThickness = void 0, this._fontMetrics = void 0, this.style = e.style, this.color = e.color, this.size = e.size || Dr.BASESIZE, this.textSize = e.textSize || this.size, this.phantom = !!e.phantom, this.font = e.font || "", this.fontFamily = e.fontFamily || "", this.fontWeight = e.fontWeight || "", this.fontShape = e.fontShape || "", this.sizeMultiplier = Z1[this.size - 1], this.maxSize = e.maxSize, this.minRuleThickness = e.minRuleThickness, this._fontMetrics = void 0; + } + /** + * Returns a new options object with the same properties as "this". Properties + * from "extension" will be copied to the new options object. + */ + extend(e) { + var t = { + style: this.style, + size: this.size, + textSize: this.textSize, + color: this.color, + phantom: this.phantom, + font: this.font, + fontFamily: this.fontFamily, + fontWeight: this.fontWeight, + fontShape: this.fontShape, + maxSize: this.maxSize, + minRuleThickness: this.minRuleThickness + }; + for (var r in e) + e.hasOwnProperty(r) && (t[r] = e[r]); + return new Dr(t); + } + /** + * Return an options object with the given style. If `this.style === style`, + * returns `this`. + */ + havingStyle(e) { + return this.style === e ? this : this.extend({ + style: e, + size: K1(this.textSize, e) + }); + } + /** + * Return an options object with a cramped version of the current style. If + * the current style is cramped, returns `this`. + */ + havingCrampedStyle() { + return this.havingStyle(this.style.cramp()); + } + /** + * Return an options object with the given size and in at least `\textstyle`. + * Returns `this` if appropriate. + */ + havingSize(e) { + return this.size === e && this.textSize === e ? this : this.extend({ + style: this.style.text(), + size: e, + textSize: e, + sizeMultiplier: Z1[e - 1] + }); + } + /** + * Like `this.havingSize(BASESIZE).havingStyle(style)`. If `style` is omitted, + * changes to at least `\textstyle`. + */ + havingBaseStyle(e) { + e = e || this.style.text(); + var t = K1(Dr.BASESIZE, e); + return this.size === t && this.textSize === Dr.BASESIZE && this.style === e ? this : this.extend({ + style: e, + size: t + }); + } + /** + * Remove the effect of sizing changes such as \Huge. + * Keep the effect of the current style, such as \scriptstyle. + */ + havingBaseSizing() { + var e; + switch (this.style.id) { + case 4: + case 5: + e = 3; + break; + case 6: + case 7: + e = 1; + break; + default: + e = 6; + } + return this.extend({ + style: this.style.text(), + size: e + }); + } + /** + * Create a new options object with the given color. + */ + withColor(e) { + return this.extend({ + color: e + }); + } + /** + * Create a new options object with "phantom" set to true. + */ + withPhantom() { + return this.extend({ + phantom: !0 + }); + } + /** + * Creates a new options object with the given math font or old text font. + * @type {[type]} + */ + withFont(e) { + return this.extend({ + font: e + }); + } + /** + * Create a new options objects with the given fontFamily. + */ + withTextFontFamily(e) { + return this.extend({ + fontFamily: e, + font: "" + }); + } + /** + * Creates a new options object with the given font weight + */ + withTextFontWeight(e) { + return this.extend({ + fontWeight: e, + font: "" + }); + } + /** + * Creates a new options object with the given font weight + */ + withTextFontShape(e) { + return this.extend({ + fontShape: e, + font: "" + }); + } + /** + * Return the CSS sizing classes required to switch from enclosing options + * `oldOptions` to `this`. Returns an array of classes. + */ + sizingClasses(e) { + return e.size !== this.size ? ["sizing", "reset-size" + e.size, "size" + this.size] : []; + } + /** + * Return the CSS sizing classes required to switch to the base size. Like + * `this.havingSize(BASESIZE).sizingClasses(this)`. + */ + baseSizingClasses() { + return this.size !== Dr.BASESIZE ? ["sizing", "reset-size" + this.size, "size" + Dr.BASESIZE] : []; + } + /** + * Return the font metrics for this size. + */ + fontMetrics() { + return this._fontMetrics || (this._fontMetrics = t3(this.size)), this._fontMetrics; + } + /** + * Gets the CSS color of the current options object + */ + getColor() { + return this.phantom ? "transparent" : this.color; + } +} +Dr.BASESIZE = 6; +var Yo = { + // https://en.wikibooks.org/wiki/LaTeX/Lengths and + // https://tex.stackexchange.com/a/8263 + pt: 1, + // TeX point + mm: 7227 / 2540, + // millimeter + cm: 7227 / 254, + // centimeter + in: 72.27, + // inch + bp: 803 / 800, + // big (PostScript) points + pc: 12, + // pica + dd: 1238 / 1157, + // didot + cc: 14856 / 1157, + // cicero (12 didot) + nd: 685 / 642, + // new didot + nc: 1370 / 107, + // new cicero (12 new didot) + sp: 1 / 65536, + // scaled point (TeX's internal smallest unit) + // https://tex.stackexchange.com/a/41371 + px: 803 / 800 + // \pdfpxdimen defaults to 1 bp in pdfTeX and LuaTeX +}, n3 = { + ex: !0, + em: !0, + mu: !0 +}, xd = function(e) { + return typeof e != "string" && (e = e.unit), e in Yo || e in n3 || e === "ex"; +}, Ye = function(e, t) { + var r; + if (e.unit in Yo) + r = Yo[e.unit] / t.fontMetrics().ptPerEm / t.sizeMultiplier; + else if (e.unit === "mu") + r = t.fontMetrics().cssEmPerMu; + else { + var a; + if (t.style.isTight() ? a = t.havingStyle(t.style.text()) : a = t, e.unit === "ex") + r = a.fontMetrics().xHeight; + else if (e.unit === "em") + r = a.fontMetrics().quad; + else + throw new G("Invalid unit: '" + e.unit + "'"); + a !== t && (r *= a.sizeMultiplier / t.sizeMultiplier); + } + return Math.min(e.number * r, t.maxSize); +}, X = function(e) { + return +e.toFixed(4) + "em"; +}, on = function(e) { + return e.filter((t) => t).join(" "); +}, Td = function(e, t, r) { + if (this.classes = e || [], this.attributes = {}, this.height = 0, this.depth = 0, this.maxFontSize = 0, this.style = r || {}, t) { + t.style.isTight() && this.classes.push("mtight"); + var a = t.getColor(); + a && (this.style.color = a); + } +}, Cd = function(e) { + var t = document.createElement(e); + t.className = on(this.classes); + for (var r in this.style) + this.style.hasOwnProperty(r) && (t.style[r] = this.style[r]); + for (var a in this.attributes) + this.attributes.hasOwnProperty(a) && t.setAttribute(a, this.attributes[a]); + for (var i = 0; i < this.children.length; i++) + t.appendChild(this.children[i].toNode()); + return t; +}, Fd = function(e) { + var t = "<" + e; + this.classes.length && (t += ' class="' + re.escape(on(this.classes)) + '"'); + var r = ""; + for (var a in this.style) + this.style.hasOwnProperty(a) && (r += re.hyphenate(a) + ":" + this.style[a] + ";"); + r && (t += ' style="' + re.escape(r) + '"'); + for (var i in this.attributes) + this.attributes.hasOwnProperty(i) && (t += " " + i + '="' + re.escape(this.attributes[i]) + '"'); + t += ">"; + for (var l = 0; l < this.children.length; l++) + t += this.children[l].toMarkup(); + return t += "", t; +}; +class ri { + constructor(e, t, r, a) { + this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.width = void 0, this.maxFontSize = void 0, this.style = void 0, Td.call(this, e, r, a), this.children = t || []; + } + /** + * Sets an arbitrary attribute on the span. Warning: use this wisely. Not + * all browsers support attributes the same, and having too many custom + * attributes is probably bad. + */ + setAttribute(e, t) { + this.attributes[e] = t; + } + hasClass(e) { + return re.contains(this.classes, e); + } + toNode() { + return Cd.call(this, "span"); + } + toMarkup() { + return Fd.call(this, "span"); + } +} +class Fu { + constructor(e, t, r, a) { + this.children = void 0, this.attributes = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, Td.call(this, t, a), this.children = r || [], this.setAttribute("href", e); + } + setAttribute(e, t) { + this.attributes[e] = t; + } + hasClass(e) { + return re.contains(this.classes, e); + } + toNode() { + return Cd.call(this, "a"); + } + toMarkup() { + return Fd.call(this, "a"); + } +} +class a3 { + constructor(e, t, r) { + this.src = void 0, this.alt = void 0, this.classes = void 0, this.height = void 0, this.depth = void 0, this.maxFontSize = void 0, this.style = void 0, this.alt = t, this.src = e, this.classes = ["mord"], this.style = r; + } + hasClass(e) { + return re.contains(this.classes, e); + } + toNode() { + var e = document.createElement("img"); + e.src = this.src, e.alt = this.alt, e.className = "mord"; + for (var t in this.style) + this.style.hasOwnProperty(t) && (e.style[t] = this.style[t]); + return e; + } + toMarkup() { + var e = '' + re.escape(this.alt) + ' 0 && (t = document.createElement("span"), t.style.marginRight = X(this.italic)), this.classes.length > 0 && (t = t || document.createElement("span"), t.className = on(this.classes)); + for (var r in this.style) + this.style.hasOwnProperty(r) && (t = t || document.createElement("span"), t.style[r] = this.style[r]); + return t ? (t.appendChild(e), t) : e; + } + /** + * Creates markup for a symbol node. + */ + toMarkup() { + var e = !1, t = " 0 && (r += "margin-right:" + this.italic + "em;"); + for (var a in this.style) + this.style.hasOwnProperty(a) && (r += re.hyphenate(a) + ":" + this.style[a] + ";"); + r && (e = !0, t += ' style="' + re.escape(r) + '"'); + var i = re.escape(this.text); + return e ? (t += ">", t += i, t += "", t) : i; + } +} +class Br { + constructor(e, t) { + this.children = void 0, this.attributes = void 0, this.children = e || [], this.attributes = t || {}; + } + toNode() { + var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "svg"); + for (var r in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, r) && t.setAttribute(r, this.attributes[r]); + for (var a = 0; a < this.children.length; a++) + t.appendChild(this.children[a].toNode()); + return t; + } + toMarkup() { + var e = '' : ''; + } +} +class Zo { + constructor(e) { + this.attributes = void 0, this.attributes = e || {}; + } + toNode() { + var e = "http://www.w3.org/2000/svg", t = document.createElementNS(e, "line"); + for (var r in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, r) && t.setAttribute(r, this.attributes[r]); + return t; + } + toMarkup() { + var e = " but got " + String(n) + "."); +} +var s3 = { + bin: 1, + close: 1, + inner: 1, + open: 1, + punct: 1, + rel: 1 +}, o3 = { + "accent-token": 1, + mathord: 1, + "op-token": 1, + spacing: 1, + textord: 1 +}, Ne = { + math: {}, + text: {} +}; +function f(n, e, t, r, a, i) { + Ne[n][a] = { + font: e, + group: t, + replace: r + }, i && r && (Ne[n][r] = Ne[n][a]); +} +var m = "math", H = "text", g = "main", A = "ams", Ge = "accent-token", J = "bin", Kt = "close", oa = "inner", ne = "mathord", ct = "op-token", d0 = "open", Zl = "punct", x = "rel", Pr = "spacing", M = "textord"; +f(m, g, x, "≡", "\\equiv", !0); +f(m, g, x, "≺", "\\prec", !0); +f(m, g, x, "≻", "\\succ", !0); +f(m, g, x, "∼", "\\sim", !0); +f(m, g, x, "⊥", "\\perp"); +f(m, g, x, "⪯", "\\preceq", !0); +f(m, g, x, "⪰", "\\succeq", !0); +f(m, g, x, "≃", "\\simeq", !0); +f(m, g, x, "∣", "\\mid", !0); +f(m, g, x, "≪", "\\ll", !0); +f(m, g, x, "≫", "\\gg", !0); +f(m, g, x, "≍", "\\asymp", !0); +f(m, g, x, "∥", "\\parallel"); +f(m, g, x, "⋈", "\\bowtie", !0); +f(m, g, x, "⌣", "\\smile", !0); +f(m, g, x, "⊑", "\\sqsubseteq", !0); +f(m, g, x, "⊒", "\\sqsupseteq", !0); +f(m, g, x, "≐", "\\doteq", !0); +f(m, g, x, "⌢", "\\frown", !0); +f(m, g, x, "∋", "\\ni", !0); +f(m, g, x, "∝", "\\propto", !0); +f(m, g, x, "⊢", "\\vdash", !0); +f(m, g, x, "⊣", "\\dashv", !0); +f(m, g, x, "∋", "\\owns"); +f(m, g, Zl, ".", "\\ldotp"); +f(m, g, Zl, "⋅", "\\cdotp"); +f(m, g, M, "#", "\\#"); +f(H, g, M, "#", "\\#"); +f(m, g, M, "&", "\\&"); +f(H, g, M, "&", "\\&"); +f(m, g, M, "ℵ", "\\aleph", !0); +f(m, g, M, "∀", "\\forall", !0); +f(m, g, M, "ℏ", "\\hbar", !0); +f(m, g, M, "∃", "\\exists", !0); +f(m, g, M, "∇", "\\nabla", !0); +f(m, g, M, "♭", "\\flat", !0); +f(m, g, M, "ℓ", "\\ell", !0); +f(m, g, M, "♮", "\\natural", !0); +f(m, g, M, "♣", "\\clubsuit", !0); +f(m, g, M, "℘", "\\wp", !0); +f(m, g, M, "♯", "\\sharp", !0); +f(m, g, M, "♢", "\\diamondsuit", !0); +f(m, g, M, "ℜ", "\\Re", !0); +f(m, g, M, "♡", "\\heartsuit", !0); +f(m, g, M, "ℑ", "\\Im", !0); +f(m, g, M, "♠", "\\spadesuit", !0); +f(m, g, M, "§", "\\S", !0); +f(H, g, M, "§", "\\S"); +f(m, g, M, "¶", "\\P", !0); +f(H, g, M, "¶", "\\P"); +f(m, g, M, "†", "\\dag"); +f(H, g, M, "†", "\\dag"); +f(H, g, M, "†", "\\textdagger"); +f(m, g, M, "‡", "\\ddag"); +f(H, g, M, "‡", "\\ddag"); +f(H, g, M, "‡", "\\textdaggerdbl"); +f(m, g, Kt, "⎱", "\\rmoustache", !0); +f(m, g, d0, "⎰", "\\lmoustache", !0); +f(m, g, Kt, "⟯", "\\rgroup", !0); +f(m, g, d0, "⟮", "\\lgroup", !0); +f(m, g, J, "∓", "\\mp", !0); +f(m, g, J, "⊖", "\\ominus", !0); +f(m, g, J, "⊎", "\\uplus", !0); +f(m, g, J, "⊓", "\\sqcap", !0); +f(m, g, J, "∗", "\\ast"); +f(m, g, J, "⊔", "\\sqcup", !0); +f(m, g, J, "◯", "\\bigcirc", !0); +f(m, g, J, "∙", "\\bullet", !0); +f(m, g, J, "‡", "\\ddagger"); +f(m, g, J, "≀", "\\wr", !0); +f(m, g, J, "⨿", "\\amalg"); +f(m, g, J, "&", "\\And"); +f(m, g, x, "⟵", "\\longleftarrow", !0); +f(m, g, x, "⇐", "\\Leftarrow", !0); +f(m, g, x, "⟸", "\\Longleftarrow", !0); +f(m, g, x, "⟶", "\\longrightarrow", !0); +f(m, g, x, "⇒", "\\Rightarrow", !0); +f(m, g, x, "⟹", "\\Longrightarrow", !0); +f(m, g, x, "↔", "\\leftrightarrow", !0); +f(m, g, x, "⟷", "\\longleftrightarrow", !0); +f(m, g, x, "⇔", "\\Leftrightarrow", !0); +f(m, g, x, "⟺", "\\Longleftrightarrow", !0); +f(m, g, x, "↦", "\\mapsto", !0); +f(m, g, x, "⟼", "\\longmapsto", !0); +f(m, g, x, "↗", "\\nearrow", !0); +f(m, g, x, "↩", "\\hookleftarrow", !0); +f(m, g, x, "↪", "\\hookrightarrow", !0); +f(m, g, x, "↘", "\\searrow", !0); +f(m, g, x, "↼", "\\leftharpoonup", !0); +f(m, g, x, "⇀", "\\rightharpoonup", !0); +f(m, g, x, "↙", "\\swarrow", !0); +f(m, g, x, "↽", "\\leftharpoondown", !0); +f(m, g, x, "⇁", "\\rightharpoondown", !0); +f(m, g, x, "↖", "\\nwarrow", !0); +f(m, g, x, "⇌", "\\rightleftharpoons", !0); +f(m, A, x, "≮", "\\nless", !0); +f(m, A, x, "", "\\@nleqslant"); +f(m, A, x, "", "\\@nleqq"); +f(m, A, x, "⪇", "\\lneq", !0); +f(m, A, x, "≨", "\\lneqq", !0); +f(m, A, x, "", "\\@lvertneqq"); +f(m, A, x, "⋦", "\\lnsim", !0); +f(m, A, x, "⪉", "\\lnapprox", !0); +f(m, A, x, "⊀", "\\nprec", !0); +f(m, A, x, "⋠", "\\npreceq", !0); +f(m, A, x, "⋨", "\\precnsim", !0); +f(m, A, x, "⪹", "\\precnapprox", !0); +f(m, A, x, "≁", "\\nsim", !0); +f(m, A, x, "", "\\@nshortmid"); +f(m, A, x, "∤", "\\nmid", !0); +f(m, A, x, "⊬", "\\nvdash", !0); +f(m, A, x, "⊭", "\\nvDash", !0); +f(m, A, x, "⋪", "\\ntriangleleft"); +f(m, A, x, "⋬", "\\ntrianglelefteq", !0); +f(m, A, x, "⊊", "\\subsetneq", !0); +f(m, A, x, "", "\\@varsubsetneq"); +f(m, A, x, "⫋", "\\subsetneqq", !0); +f(m, A, x, "", "\\@varsubsetneqq"); +f(m, A, x, "≯", "\\ngtr", !0); +f(m, A, x, "", "\\@ngeqslant"); +f(m, A, x, "", "\\@ngeqq"); +f(m, A, x, "⪈", "\\gneq", !0); +f(m, A, x, "≩", "\\gneqq", !0); +f(m, A, x, "", "\\@gvertneqq"); +f(m, A, x, "⋧", "\\gnsim", !0); +f(m, A, x, "⪊", "\\gnapprox", !0); +f(m, A, x, "⊁", "\\nsucc", !0); +f(m, A, x, "⋡", "\\nsucceq", !0); +f(m, A, x, "⋩", "\\succnsim", !0); +f(m, A, x, "⪺", "\\succnapprox", !0); +f(m, A, x, "≆", "\\ncong", !0); +f(m, A, x, "", "\\@nshortparallel"); +f(m, A, x, "∦", "\\nparallel", !0); +f(m, A, x, "⊯", "\\nVDash", !0); +f(m, A, x, "⋫", "\\ntriangleright"); +f(m, A, x, "⋭", "\\ntrianglerighteq", !0); +f(m, A, x, "", "\\@nsupseteqq"); +f(m, A, x, "⊋", "\\supsetneq", !0); +f(m, A, x, "", "\\@varsupsetneq"); +f(m, A, x, "⫌", "\\supsetneqq", !0); +f(m, A, x, "", "\\@varsupsetneqq"); +f(m, A, x, "⊮", "\\nVdash", !0); +f(m, A, x, "⪵", "\\precneqq", !0); +f(m, A, x, "⪶", "\\succneqq", !0); +f(m, A, x, "", "\\@nsubseteqq"); +f(m, A, J, "⊴", "\\unlhd"); +f(m, A, J, "⊵", "\\unrhd"); +f(m, A, x, "↚", "\\nleftarrow", !0); +f(m, A, x, "↛", "\\nrightarrow", !0); +f(m, A, x, "⇍", "\\nLeftarrow", !0); +f(m, A, x, "⇏", "\\nRightarrow", !0); +f(m, A, x, "↮", "\\nleftrightarrow", !0); +f(m, A, x, "⇎", "\\nLeftrightarrow", !0); +f(m, A, x, "△", "\\vartriangle"); +f(m, A, M, "ℏ", "\\hslash"); +f(m, A, M, "▽", "\\triangledown"); +f(m, A, M, "◊", "\\lozenge"); +f(m, A, M, "Ⓢ", "\\circledS"); +f(m, A, M, "®", "\\circledR"); +f(H, A, M, "®", "\\circledR"); +f(m, A, M, "∡", "\\measuredangle", !0); +f(m, A, M, "∄", "\\nexists"); +f(m, A, M, "℧", "\\mho"); +f(m, A, M, "Ⅎ", "\\Finv", !0); +f(m, A, M, "⅁", "\\Game", !0); +f(m, A, M, "‵", "\\backprime"); +f(m, A, M, "▲", "\\blacktriangle"); +f(m, A, M, "▼", "\\blacktriangledown"); +f(m, A, M, "■", "\\blacksquare"); +f(m, A, M, "⧫", "\\blacklozenge"); +f(m, A, M, "★", "\\bigstar"); +f(m, A, M, "∢", "\\sphericalangle", !0); +f(m, A, M, "∁", "\\complement", !0); +f(m, A, M, "ð", "\\eth", !0); +f(H, g, M, "ð", "ð"); +f(m, A, M, "╱", "\\diagup"); +f(m, A, M, "╲", "\\diagdown"); +f(m, A, M, "□", "\\square"); +f(m, A, M, "□", "\\Box"); +f(m, A, M, "◊", "\\Diamond"); +f(m, A, M, "¥", "\\yen", !0); +f(H, A, M, "¥", "\\yen", !0); +f(m, A, M, "✓", "\\checkmark", !0); +f(H, A, M, "✓", "\\checkmark"); +f(m, A, M, "ℶ", "\\beth", !0); +f(m, A, M, "ℸ", "\\daleth", !0); +f(m, A, M, "ℷ", "\\gimel", !0); +f(m, A, M, "ϝ", "\\digamma", !0); +f(m, A, M, "ϰ", "\\varkappa"); +f(m, A, d0, "┌", "\\@ulcorner", !0); +f(m, A, Kt, "┐", "\\@urcorner", !0); +f(m, A, d0, "└", "\\@llcorner", !0); +f(m, A, Kt, "┘", "\\@lrcorner", !0); +f(m, A, x, "≦", "\\leqq", !0); +f(m, A, x, "⩽", "\\leqslant", !0); +f(m, A, x, "⪕", "\\eqslantless", !0); +f(m, A, x, "≲", "\\lesssim", !0); +f(m, A, x, "⪅", "\\lessapprox", !0); +f(m, A, x, "≊", "\\approxeq", !0); +f(m, A, J, "⋖", "\\lessdot"); +f(m, A, x, "⋘", "\\lll", !0); +f(m, A, x, "≶", "\\lessgtr", !0); +f(m, A, x, "⋚", "\\lesseqgtr", !0); +f(m, A, x, "⪋", "\\lesseqqgtr", !0); +f(m, A, x, "≑", "\\doteqdot"); +f(m, A, x, "≓", "\\risingdotseq", !0); +f(m, A, x, "≒", "\\fallingdotseq", !0); +f(m, A, x, "∽", "\\backsim", !0); +f(m, A, x, "⋍", "\\backsimeq", !0); +f(m, A, x, "⫅", "\\subseteqq", !0); +f(m, A, x, "⋐", "\\Subset", !0); +f(m, A, x, "⊏", "\\sqsubset", !0); +f(m, A, x, "≼", "\\preccurlyeq", !0); +f(m, A, x, "⋞", "\\curlyeqprec", !0); +f(m, A, x, "≾", "\\precsim", !0); +f(m, A, x, "⪷", "\\precapprox", !0); +f(m, A, x, "⊲", "\\vartriangleleft"); +f(m, A, x, "⊴", "\\trianglelefteq"); +f(m, A, x, "⊨", "\\vDash", !0); +f(m, A, x, "⊪", "\\Vvdash", !0); +f(m, A, x, "⌣", "\\smallsmile"); +f(m, A, x, "⌢", "\\smallfrown"); +f(m, A, x, "≏", "\\bumpeq", !0); +f(m, A, x, "≎", "\\Bumpeq", !0); +f(m, A, x, "≧", "\\geqq", !0); +f(m, A, x, "⩾", "\\geqslant", !0); +f(m, A, x, "⪖", "\\eqslantgtr", !0); +f(m, A, x, "≳", "\\gtrsim", !0); +f(m, A, x, "⪆", "\\gtrapprox", !0); +f(m, A, J, "⋗", "\\gtrdot"); +f(m, A, x, "⋙", "\\ggg", !0); +f(m, A, x, "≷", "\\gtrless", !0); +f(m, A, x, "⋛", "\\gtreqless", !0); +f(m, A, x, "⪌", "\\gtreqqless", !0); +f(m, A, x, "≖", "\\eqcirc", !0); +f(m, A, x, "≗", "\\circeq", !0); +f(m, A, x, "≜", "\\triangleq", !0); +f(m, A, x, "∼", "\\thicksim"); +f(m, A, x, "≈", "\\thickapprox"); +f(m, A, x, "⫆", "\\supseteqq", !0); +f(m, A, x, "⋑", "\\Supset", !0); +f(m, A, x, "⊐", "\\sqsupset", !0); +f(m, A, x, "≽", "\\succcurlyeq", !0); +f(m, A, x, "⋟", "\\curlyeqsucc", !0); +f(m, A, x, "≿", "\\succsim", !0); +f(m, A, x, "⪸", "\\succapprox", !0); +f(m, A, x, "⊳", "\\vartriangleright"); +f(m, A, x, "⊵", "\\trianglerighteq"); +f(m, A, x, "⊩", "\\Vdash", !0); +f(m, A, x, "∣", "\\shortmid"); +f(m, A, x, "∥", "\\shortparallel"); +f(m, A, x, "≬", "\\between", !0); +f(m, A, x, "⋔", "\\pitchfork", !0); +f(m, A, x, "∝", "\\varpropto"); +f(m, A, x, "◀", "\\blacktriangleleft"); +f(m, A, x, "∴", "\\therefore", !0); +f(m, A, x, "∍", "\\backepsilon"); +f(m, A, x, "▶", "\\blacktriangleright"); +f(m, A, x, "∵", "\\because", !0); +f(m, A, x, "⋘", "\\llless"); +f(m, A, x, "⋙", "\\gggtr"); +f(m, A, J, "⊲", "\\lhd"); +f(m, A, J, "⊳", "\\rhd"); +f(m, A, x, "≂", "\\eqsim", !0); +f(m, g, x, "⋈", "\\Join"); +f(m, A, x, "≑", "\\Doteq", !0); +f(m, A, J, "∔", "\\dotplus", !0); +f(m, A, J, "∖", "\\smallsetminus"); +f(m, A, J, "⋒", "\\Cap", !0); +f(m, A, J, "⋓", "\\Cup", !0); +f(m, A, J, "⩞", "\\doublebarwedge", !0); +f(m, A, J, "⊟", "\\boxminus", !0); +f(m, A, J, "⊞", "\\boxplus", !0); +f(m, A, J, "⋇", "\\divideontimes", !0); +f(m, A, J, "⋉", "\\ltimes", !0); +f(m, A, J, "⋊", "\\rtimes", !0); +f(m, A, J, "⋋", "\\leftthreetimes", !0); +f(m, A, J, "⋌", "\\rightthreetimes", !0); +f(m, A, J, "⋏", "\\curlywedge", !0); +f(m, A, J, "⋎", "\\curlyvee", !0); +f(m, A, J, "⊝", "\\circleddash", !0); +f(m, A, J, "⊛", "\\circledast", !0); +f(m, A, J, "⋅", "\\centerdot"); +f(m, A, J, "⊺", "\\intercal", !0); +f(m, A, J, "⋒", "\\doublecap"); +f(m, A, J, "⋓", "\\doublecup"); +f(m, A, J, "⊠", "\\boxtimes", !0); +f(m, A, x, "⇢", "\\dashrightarrow", !0); +f(m, A, x, "⇠", "\\dashleftarrow", !0); +f(m, A, x, "⇇", "\\leftleftarrows", !0); +f(m, A, x, "⇆", "\\leftrightarrows", !0); +f(m, A, x, "⇚", "\\Lleftarrow", !0); +f(m, A, x, "↞", "\\twoheadleftarrow", !0); +f(m, A, x, "↢", "\\leftarrowtail", !0); +f(m, A, x, "↫", "\\looparrowleft", !0); +f(m, A, x, "⇋", "\\leftrightharpoons", !0); +f(m, A, x, "↶", "\\curvearrowleft", !0); +f(m, A, x, "↺", "\\circlearrowleft", !0); +f(m, A, x, "↰", "\\Lsh", !0); +f(m, A, x, "⇈", "\\upuparrows", !0); +f(m, A, x, "↿", "\\upharpoonleft", !0); +f(m, A, x, "⇃", "\\downharpoonleft", !0); +f(m, g, x, "⊶", "\\origof", !0); +f(m, g, x, "⊷", "\\imageof", !0); +f(m, A, x, "⊸", "\\multimap", !0); +f(m, A, x, "↭", "\\leftrightsquigarrow", !0); +f(m, A, x, "⇉", "\\rightrightarrows", !0); +f(m, A, x, "⇄", "\\rightleftarrows", !0); +f(m, A, x, "↠", "\\twoheadrightarrow", !0); +f(m, A, x, "↣", "\\rightarrowtail", !0); +f(m, A, x, "↬", "\\looparrowright", !0); +f(m, A, x, "↷", "\\curvearrowright", !0); +f(m, A, x, "↻", "\\circlearrowright", !0); +f(m, A, x, "↱", "\\Rsh", !0); +f(m, A, x, "⇊", "\\downdownarrows", !0); +f(m, A, x, "↾", "\\upharpoonright", !0); +f(m, A, x, "⇂", "\\downharpoonright", !0); +f(m, A, x, "⇝", "\\rightsquigarrow", !0); +f(m, A, x, "⇝", "\\leadsto"); +f(m, A, x, "⇛", "\\Rrightarrow", !0); +f(m, A, x, "↾", "\\restriction"); +f(m, g, M, "‘", "`"); +f(m, g, M, "$", "\\$"); +f(H, g, M, "$", "\\$"); +f(H, g, M, "$", "\\textdollar"); +f(m, g, M, "%", "\\%"); +f(H, g, M, "%", "\\%"); +f(m, g, M, "_", "\\_"); +f(H, g, M, "_", "\\_"); +f(H, g, M, "_", "\\textunderscore"); +f(m, g, M, "∠", "\\angle", !0); +f(m, g, M, "∞", "\\infty", !0); +f(m, g, M, "′", "\\prime"); +f(m, g, M, "△", "\\triangle"); +f(m, g, M, "Γ", "\\Gamma", !0); +f(m, g, M, "Δ", "\\Delta", !0); +f(m, g, M, "Θ", "\\Theta", !0); +f(m, g, M, "Λ", "\\Lambda", !0); +f(m, g, M, "Ξ", "\\Xi", !0); +f(m, g, M, "Π", "\\Pi", !0); +f(m, g, M, "Σ", "\\Sigma", !0); +f(m, g, M, "Υ", "\\Upsilon", !0); +f(m, g, M, "Φ", "\\Phi", !0); +f(m, g, M, "Ψ", "\\Psi", !0); +f(m, g, M, "Ω", "\\Omega", !0); +f(m, g, M, "A", "Α"); +f(m, g, M, "B", "Β"); +f(m, g, M, "E", "Ε"); +f(m, g, M, "Z", "Ζ"); +f(m, g, M, "H", "Η"); +f(m, g, M, "I", "Ι"); +f(m, g, M, "K", "Κ"); +f(m, g, M, "M", "Μ"); +f(m, g, M, "N", "Ν"); +f(m, g, M, "O", "Ο"); +f(m, g, M, "P", "Ρ"); +f(m, g, M, "T", "Τ"); +f(m, g, M, "X", "Χ"); +f(m, g, M, "¬", "\\neg", !0); +f(m, g, M, "¬", "\\lnot"); +f(m, g, M, "⊤", "\\top"); +f(m, g, M, "⊥", "\\bot"); +f(m, g, M, "∅", "\\emptyset"); +f(m, A, M, "∅", "\\varnothing"); +f(m, g, ne, "α", "\\alpha", !0); +f(m, g, ne, "β", "\\beta", !0); +f(m, g, ne, "γ", "\\gamma", !0); +f(m, g, ne, "δ", "\\delta", !0); +f(m, g, ne, "ϵ", "\\epsilon", !0); +f(m, g, ne, "ζ", "\\zeta", !0); +f(m, g, ne, "η", "\\eta", !0); +f(m, g, ne, "θ", "\\theta", !0); +f(m, g, ne, "ι", "\\iota", !0); +f(m, g, ne, "κ", "\\kappa", !0); +f(m, g, ne, "λ", "\\lambda", !0); +f(m, g, ne, "μ", "\\mu", !0); +f(m, g, ne, "ν", "\\nu", !0); +f(m, g, ne, "ξ", "\\xi", !0); +f(m, g, ne, "ο", "\\omicron", !0); +f(m, g, ne, "π", "\\pi", !0); +f(m, g, ne, "ρ", "\\rho", !0); +f(m, g, ne, "σ", "\\sigma", !0); +f(m, g, ne, "τ", "\\tau", !0); +f(m, g, ne, "υ", "\\upsilon", !0); +f(m, g, ne, "ϕ", "\\phi", !0); +f(m, g, ne, "χ", "\\chi", !0); +f(m, g, ne, "ψ", "\\psi", !0); +f(m, g, ne, "ω", "\\omega", !0); +f(m, g, ne, "ε", "\\varepsilon", !0); +f(m, g, ne, "ϑ", "\\vartheta", !0); +f(m, g, ne, "ϖ", "\\varpi", !0); +f(m, g, ne, "ϱ", "\\varrho", !0); +f(m, g, ne, "ς", "\\varsigma", !0); +f(m, g, ne, "φ", "\\varphi", !0); +f(m, g, J, "∗", "*", !0); +f(m, g, J, "+", "+"); +f(m, g, J, "−", "-", !0); +f(m, g, J, "⋅", "\\cdot", !0); +f(m, g, J, "∘", "\\circ", !0); +f(m, g, J, "÷", "\\div", !0); +f(m, g, J, "±", "\\pm", !0); +f(m, g, J, "×", "\\times", !0); +f(m, g, J, "∩", "\\cap", !0); +f(m, g, J, "∪", "\\cup", !0); +f(m, g, J, "∖", "\\setminus", !0); +f(m, g, J, "∧", "\\land"); +f(m, g, J, "∨", "\\lor"); +f(m, g, J, "∧", "\\wedge", !0); +f(m, g, J, "∨", "\\vee", !0); +f(m, g, M, "√", "\\surd"); +f(m, g, d0, "⟨", "\\langle", !0); +f(m, g, d0, "∣", "\\lvert"); +f(m, g, d0, "∥", "\\lVert"); +f(m, g, Kt, "?", "?"); +f(m, g, Kt, "!", "!"); +f(m, g, Kt, "⟩", "\\rangle", !0); +f(m, g, Kt, "∣", "\\rvert"); +f(m, g, Kt, "∥", "\\rVert"); +f(m, g, x, "=", "="); +f(m, g, x, ":", ":"); +f(m, g, x, "≈", "\\approx", !0); +f(m, g, x, "≅", "\\cong", !0); +f(m, g, x, "≥", "\\ge"); +f(m, g, x, "≥", "\\geq", !0); +f(m, g, x, "←", "\\gets"); +f(m, g, x, ">", "\\gt", !0); +f(m, g, x, "∈", "\\in", !0); +f(m, g, x, "", "\\@not"); +f(m, g, x, "⊂", "\\subset", !0); +f(m, g, x, "⊃", "\\supset", !0); +f(m, g, x, "⊆", "\\subseteq", !0); +f(m, g, x, "⊇", "\\supseteq", !0); +f(m, A, x, "⊈", "\\nsubseteq", !0); +f(m, A, x, "⊉", "\\nsupseteq", !0); +f(m, g, x, "⊨", "\\models"); +f(m, g, x, "←", "\\leftarrow", !0); +f(m, g, x, "≤", "\\le"); +f(m, g, x, "≤", "\\leq", !0); +f(m, g, x, "<", "\\lt", !0); +f(m, g, x, "→", "\\rightarrow", !0); +f(m, g, x, "→", "\\to"); +f(m, A, x, "≱", "\\ngeq", !0); +f(m, A, x, "≰", "\\nleq", !0); +f(m, g, Pr, " ", "\\ "); +f(m, g, Pr, " ", "\\space"); +f(m, g, Pr, " ", "\\nobreakspace"); +f(H, g, Pr, " ", "\\ "); +f(H, g, Pr, " ", " "); +f(H, g, Pr, " ", "\\space"); +f(H, g, Pr, " ", "\\nobreakspace"); +f(m, g, Pr, null, "\\nobreak"); +f(m, g, Pr, null, "\\allowbreak"); +f(m, g, Zl, ",", ","); +f(m, g, Zl, ";", ";"); +f(m, A, J, "⊼", "\\barwedge", !0); +f(m, A, J, "⊻", "\\veebar", !0); +f(m, g, J, "⊙", "\\odot", !0); +f(m, g, J, "⊕", "\\oplus", !0); +f(m, g, J, "⊗", "\\otimes", !0); +f(m, g, M, "∂", "\\partial", !0); +f(m, g, J, "⊘", "\\oslash", !0); +f(m, A, J, "⊚", "\\circledcirc", !0); +f(m, A, J, "⊡", "\\boxdot", !0); +f(m, g, J, "△", "\\bigtriangleup"); +f(m, g, J, "▽", "\\bigtriangledown"); +f(m, g, J, "†", "\\dagger"); +f(m, g, J, "⋄", "\\diamond"); +f(m, g, J, "⋆", "\\star"); +f(m, g, J, "◃", "\\triangleleft"); +f(m, g, J, "▹", "\\triangleright"); +f(m, g, d0, "{", "\\{"); +f(H, g, M, "{", "\\{"); +f(H, g, M, "{", "\\textbraceleft"); +f(m, g, Kt, "}", "\\}"); +f(H, g, M, "}", "\\}"); +f(H, g, M, "}", "\\textbraceright"); +f(m, g, d0, "{", "\\lbrace"); +f(m, g, Kt, "}", "\\rbrace"); +f(m, g, d0, "[", "\\lbrack", !0); +f(H, g, M, "[", "\\lbrack", !0); +f(m, g, Kt, "]", "\\rbrack", !0); +f(H, g, M, "]", "\\rbrack", !0); +f(m, g, d0, "(", "\\lparen", !0); +f(m, g, Kt, ")", "\\rparen", !0); +f(H, g, M, "<", "\\textless", !0); +f(H, g, M, ">", "\\textgreater", !0); +f(m, g, d0, "⌊", "\\lfloor", !0); +f(m, g, Kt, "⌋", "\\rfloor", !0); +f(m, g, d0, "⌈", "\\lceil", !0); +f(m, g, Kt, "⌉", "\\rceil", !0); +f(m, g, M, "\\", "\\backslash"); +f(m, g, M, "∣", "|"); +f(m, g, M, "∣", "\\vert"); +f(H, g, M, "|", "\\textbar", !0); +f(m, g, M, "∥", "\\|"); +f(m, g, M, "∥", "\\Vert"); +f(H, g, M, "∥", "\\textbardbl"); +f(H, g, M, "~", "\\textasciitilde"); +f(H, g, M, "\\", "\\textbackslash"); +f(H, g, M, "^", "\\textasciicircum"); +f(m, g, x, "↑", "\\uparrow", !0); +f(m, g, x, "⇑", "\\Uparrow", !0); +f(m, g, x, "↓", "\\downarrow", !0); +f(m, g, x, "⇓", "\\Downarrow", !0); +f(m, g, x, "↕", "\\updownarrow", !0); +f(m, g, x, "⇕", "\\Updownarrow", !0); +f(m, g, ct, "∐", "\\coprod"); +f(m, g, ct, "⋁", "\\bigvee"); +f(m, g, ct, "⋀", "\\bigwedge"); +f(m, g, ct, "⨄", "\\biguplus"); +f(m, g, ct, "⋂", "\\bigcap"); +f(m, g, ct, "⋃", "\\bigcup"); +f(m, g, ct, "∫", "\\int"); +f(m, g, ct, "∫", "\\intop"); +f(m, g, ct, "∬", "\\iint"); +f(m, g, ct, "∭", "\\iiint"); +f(m, g, ct, "∏", "\\prod"); +f(m, g, ct, "∑", "\\sum"); +f(m, g, ct, "⨂", "\\bigotimes"); +f(m, g, ct, "⨁", "\\bigoplus"); +f(m, g, ct, "⨀", "\\bigodot"); +f(m, g, ct, "∮", "\\oint"); +f(m, g, ct, "∯", "\\oiint"); +f(m, g, ct, "∰", "\\oiiint"); +f(m, g, ct, "⨆", "\\bigsqcup"); +f(m, g, ct, "∫", "\\smallint"); +f(H, g, oa, "…", "\\textellipsis"); +f(m, g, oa, "…", "\\mathellipsis"); +f(H, g, oa, "…", "\\ldots", !0); +f(m, g, oa, "…", "\\ldots", !0); +f(m, g, oa, "⋯", "\\@cdots", !0); +f(m, g, oa, "⋱", "\\ddots", !0); +f(m, g, M, "⋮", "\\varvdots"); +f(m, g, Ge, "ˊ", "\\acute"); +f(m, g, Ge, "ˋ", "\\grave"); +f(m, g, Ge, "¨", "\\ddot"); +f(m, g, Ge, "~", "\\tilde"); +f(m, g, Ge, "ˉ", "\\bar"); +f(m, g, Ge, "˘", "\\breve"); +f(m, g, Ge, "ˇ", "\\check"); +f(m, g, Ge, "^", "\\hat"); +f(m, g, Ge, "⃗", "\\vec"); +f(m, g, Ge, "˙", "\\dot"); +f(m, g, Ge, "˚", "\\mathring"); +f(m, g, ne, "", "\\@imath"); +f(m, g, ne, "", "\\@jmath"); +f(m, g, M, "ı", "ı"); +f(m, g, M, "ȷ", "ȷ"); +f(H, g, M, "ı", "\\i", !0); +f(H, g, M, "ȷ", "\\j", !0); +f(H, g, M, "ß", "\\ss", !0); +f(H, g, M, "æ", "\\ae", !0); +f(H, g, M, "œ", "\\oe", !0); +f(H, g, M, "ø", "\\o", !0); +f(H, g, M, "Æ", "\\AE", !0); +f(H, g, M, "Œ", "\\OE", !0); +f(H, g, M, "Ø", "\\O", !0); +f(H, g, Ge, "ˊ", "\\'"); +f(H, g, Ge, "ˋ", "\\`"); +f(H, g, Ge, "ˆ", "\\^"); +f(H, g, Ge, "˜", "\\~"); +f(H, g, Ge, "ˉ", "\\="); +f(H, g, Ge, "˘", "\\u"); +f(H, g, Ge, "˙", "\\."); +f(H, g, Ge, "¸", "\\c"); +f(H, g, Ge, "˚", "\\r"); +f(H, g, Ge, "ˇ", "\\v"); +f(H, g, Ge, "¨", '\\"'); +f(H, g, Ge, "˝", "\\H"); +f(H, g, Ge, "◯", "\\textcircled"); +var Md = { + "--": !0, + "---": !0, + "``": !0, + "''": !0 +}; +f(H, g, M, "–", "--", !0); +f(H, g, M, "–", "\\textendash"); +f(H, g, M, "—", "---", !0); +f(H, g, M, "—", "\\textemdash"); +f(H, g, M, "‘", "`", !0); +f(H, g, M, "‘", "\\textquoteleft"); +f(H, g, M, "’", "'", !0); +f(H, g, M, "’", "\\textquoteright"); +f(H, g, M, "“", "``", !0); +f(H, g, M, "“", "\\textquotedblleft"); +f(H, g, M, "”", "''", !0); +f(H, g, M, "”", "\\textquotedblright"); +f(m, g, M, "°", "\\degree", !0); +f(H, g, M, "°", "\\degree"); +f(H, g, M, "°", "\\textdegree", !0); +f(m, g, M, "£", "\\pounds"); +f(m, g, M, "£", "\\mathsterling", !0); +f(H, g, M, "£", "\\pounds"); +f(H, g, M, "£", "\\textsterling", !0); +f(m, A, M, "✠", "\\maltese"); +f(H, A, M, "✠", "\\maltese"); +var Q1 = '0123456789/@."'; +for (var Zs = 0; Zs < Q1.length; Zs++) { + var $1 = Q1.charAt(Zs); + f(m, g, M, $1, $1); +} +var ec = '0123456789!@*()-=+";:?/.,'; +for (var Ks = 0; Ks < ec.length; Ks++) { + var tc = ec.charAt(Ks); + f(H, g, M, tc, tc); +} +var Tl = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; +for (var Js = 0; Js < Tl.length; Js++) { + var Ri = Tl.charAt(Js); + f(m, g, ne, Ri, Ri), f(H, g, M, Ri, Ri); +} +f(m, A, M, "C", "ℂ"); +f(H, A, M, "C", "ℂ"); +f(m, A, M, "H", "ℍ"); +f(H, A, M, "H", "ℍ"); +f(m, A, M, "N", "ℕ"); +f(H, A, M, "N", "ℕ"); +f(m, A, M, "P", "ℙ"); +f(H, A, M, "P", "ℙ"); +f(m, A, M, "Q", "ℚ"); +f(H, A, M, "Q", "ℚ"); +f(m, A, M, "R", "ℝ"); +f(H, A, M, "R", "ℝ"); +f(m, A, M, "Z", "ℤ"); +f(H, A, M, "Z", "ℤ"); +f(m, g, ne, "h", "ℎ"); +f(H, g, ne, "h", "ℎ"); +var oe = ""; +for (var Ht = 0; Ht < Tl.length; Ht++) { + var $e = Tl.charAt(Ht); + oe = String.fromCharCode(55349, 56320 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56372 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56424 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56580 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56684 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56736 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56788 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56840 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56944 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), Ht < 26 && (oe = String.fromCharCode(55349, 56632 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe), oe = String.fromCharCode(55349, 56476 + Ht), f(m, g, ne, $e, oe), f(H, g, M, $e, oe)); +} +oe = "𝕜"; +f(m, g, ne, "k", oe); +f(H, g, M, "k", oe); +for (var vn = 0; vn < 10; vn++) { + var Yr = vn.toString(); + oe = String.fromCharCode(55349, 57294 + vn), f(m, g, ne, Yr, oe), f(H, g, M, Yr, oe), oe = String.fromCharCode(55349, 57314 + vn), f(m, g, ne, Yr, oe), f(H, g, M, Yr, oe), oe = String.fromCharCode(55349, 57324 + vn), f(m, g, ne, Yr, oe), f(H, g, M, Yr, oe), oe = String.fromCharCode(55349, 57334 + vn), f(m, g, ne, Yr, oe), f(H, g, M, Yr, oe); +} +var Ko = "ÐÞþ"; +for (var Qs = 0; Qs < Ko.length; Qs++) { + var Oi = Ko.charAt(Qs); + f(m, g, ne, Oi, Oi), f(H, g, M, Oi, Oi); +} +var qi = [ + ["mathbf", "textbf", "Main-Bold"], + // A-Z bold upright + ["mathbf", "textbf", "Main-Bold"], + // a-z bold upright + ["mathnormal", "textit", "Math-Italic"], + // A-Z italic + ["mathnormal", "textit", "Math-Italic"], + // a-z italic + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + // A-Z bold italic + ["boldsymbol", "boldsymbol", "Main-BoldItalic"], + // a-z bold italic + // Map fancy A-Z letters to script, not calligraphic. + // This aligns with unicode-math and math fonts (except Cambria Math). + ["mathscr", "textscr", "Script-Regular"], + // A-Z script + ["", "", ""], + // a-z script. No font + ["", "", ""], + // A-Z bold script. No font + ["", "", ""], + // a-z bold script. No font + ["mathfrak", "textfrak", "Fraktur-Regular"], + // A-Z Fraktur + ["mathfrak", "textfrak", "Fraktur-Regular"], + // a-z Fraktur + ["mathbb", "textbb", "AMS-Regular"], + // A-Z double-struck + ["mathbb", "textbb", "AMS-Regular"], + // k double-struck + // Note that we are using a bold font, but font metrics for regular Fraktur. + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + // A-Z bold Fraktur + ["mathboldfrak", "textboldfrak", "Fraktur-Regular"], + // a-z bold Fraktur + ["mathsf", "textsf", "SansSerif-Regular"], + // A-Z sans-serif + ["mathsf", "textsf", "SansSerif-Regular"], + // a-z sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // A-Z bold sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // a-z bold sans-serif + ["mathitsf", "textitsf", "SansSerif-Italic"], + // A-Z italic sans-serif + ["mathitsf", "textitsf", "SansSerif-Italic"], + // a-z italic sans-serif + ["", "", ""], + // A-Z bold italic sans. No font + ["", "", ""], + // a-z bold italic sans. No font + ["mathtt", "texttt", "Typewriter-Regular"], + // A-Z monospace + ["mathtt", "texttt", "Typewriter-Regular"] + // a-z monospace +], rc = [ + ["mathbf", "textbf", "Main-Bold"], + // 0-9 bold + ["", "", ""], + // 0-9 double-struck. No KaTeX font. + ["mathsf", "textsf", "SansSerif-Regular"], + // 0-9 sans-serif + ["mathboldsf", "textboldsf", "SansSerif-Bold"], + // 0-9 bold sans-serif + ["mathtt", "texttt", "Typewriter-Regular"] + // 0-9 monospace +], u3 = function(e, t) { + var r = e.charCodeAt(0), a = e.charCodeAt(1), i = (r - 55296) * 1024 + (a - 56320) + 65536, l = t === "math" ? 0 : 1; + if (119808 <= i && i < 120484) { + var s = Math.floor((i - 119808) / 26); + return [qi[s][2], qi[s][l]]; + } else if (120782 <= i && i <= 120831) { + var o = Math.floor((i - 120782) / 10); + return [rc[o][2], rc[o][l]]; + } else { + if (i === 120485 || i === 120486) + return [qi[0][2], qi[0][l]]; + if (120486 < i && i < 120782) + return ["", ""]; + throw new G("Unsupported character: " + e); + } +}, Kl = function(e, t, r) { + return Ne[r][e] && Ne[r][e].replace && (e = Ne[r][e].replace), { + value: e, + metrics: Cu(e, t, r) + }; +}, q0 = function(e, t, r, a, i) { + var l = Kl(e, t, r), s = l.metrics; + e = l.value; + var o; + if (s) { + var u = s.italic; + (r === "text" || a && a.font === "mathit") && (u = 0), o = new x0(e, s.height, s.depth, u, s.skew, s.width, i); + } else + typeof console < "u" && console.warn("No character metrics " + ("for '" + e + "' in style '" + t + "' and mode '" + r + "'")), o = new x0(e, 0, 0, 0, 0, 0, i); + if (a) { + o.maxFontSize = a.sizeMultiplier, a.style.isTight() && o.classes.push("mtight"); + var c = a.getColor(); + c && (o.style.color = c); + } + return o; +}, c3 = function(e, t, r, a) { + return a === void 0 && (a = []), r.font === "boldsymbol" && Kl(e, "Main-Bold", t).metrics ? q0(e, "Main-Bold", t, r, a.concat(["mathbf"])) : e === "\\" || Ne[t][e].font === "main" ? q0(e, "Main-Regular", t, r, a) : q0(e, "AMS-Regular", t, r, a.concat(["amsrm"])); +}, f3 = function(e, t, r, a, i) { + return i !== "textord" && Kl(e, "Math-BoldItalic", t).metrics ? { + fontName: "Math-BoldItalic", + fontClass: "boldsymbol" + } : { + fontName: "Main-Bold", + fontClass: "mathbf" + }; +}, h3 = function(e, t, r) { + var a = e.mode, i = e.text, l = ["mord"], s = a === "math" || a === "text" && t.font, o = s ? t.font : t.fontFamily, u = "", c = ""; + if (i.charCodeAt(0) === 55349 && ([u, c] = u3(i, a)), u.length > 0) + return q0(i, u, a, t, l.concat(c)); + if (o) { + var d, h; + if (o === "boldsymbol") { + var p = f3(i, a, t, l, r); + d = p.fontName, h = [p.fontClass]; + } else s ? (d = Id[o].fontName, h = [o]) : (d = Pi(o, t.fontWeight, t.fontShape), h = [o, t.fontWeight, t.fontShape]); + if (Kl(i, d, a).metrics) + return q0(i, d, a, t, l.concat(h)); + if (Md.hasOwnProperty(i) && d.slice(0, 10) === "Typewriter") { + for (var _ = [], b = 0; b < i.length; b++) + _.push(q0(i[b], d, a, t, l.concat(h))); + return Bd(_); + } + } + if (r === "mathord") + return q0(i, "Math-Italic", a, t, l.concat(["mathnormal"])); + if (r === "textord") { + var D = Ne[a][i] && Ne[a][i].font; + if (D === "ams") { + var y = Pi("amsrm", t.fontWeight, t.fontShape); + return q0(i, y, a, t, l.concat("amsrm", t.fontWeight, t.fontShape)); + } else if (D === "main" || !D) { + var k = Pi("textrm", t.fontWeight, t.fontShape); + return q0(i, k, a, t, l.concat(t.fontWeight, t.fontShape)); + } else { + var w = Pi(D, t.fontWeight, t.fontShape); + return q0(i, w, a, t, l.concat(w, t.fontWeight, t.fontShape)); + } + } else + throw new Error("unexpected type: " + r + " in makeOrd"); +}, d3 = (n, e) => { + if (on(n.classes) !== on(e.classes) || n.skew !== e.skew || n.maxFontSize !== e.maxFontSize) + return !1; + if (n.classes.length === 1) { + var t = n.classes[0]; + if (t === "mbin" || t === "mord") + return !1; + } + for (var r in n.style) + if (n.style.hasOwnProperty(r) && n.style[r] !== e.style[r]) + return !1; + for (var a in e.style) + if (e.style.hasOwnProperty(a) && n.style[a] !== e.style[a]) + return !1; + return !0; +}, m3 = (n) => { + for (var e = 0; e < n.length - 1; e++) { + var t = n[e], r = n[e + 1]; + t instanceof x0 && r instanceof x0 && d3(t, r) && (t.text += r.text, t.height = Math.max(t.height, r.height), t.depth = Math.max(t.depth, r.depth), t.italic = r.italic, n.splice(e + 1, 1), e--); + } + return n; +}, Mu = function(e) { + for (var t = 0, r = 0, a = 0, i = 0; i < e.children.length; i++) { + var l = e.children[i]; + l.height > t && (t = l.height), l.depth > r && (r = l.depth), l.maxFontSize > a && (a = l.maxFontSize); + } + e.height = t, e.depth = r, e.maxFontSize = a; +}, e0 = function(e, t, r, a) { + var i = new ri(e, t, r, a); + return Mu(i), i; +}, zd = (n, e, t, r) => new ri(n, e, t, r), p3 = function(e, t, r) { + var a = e0([e], [], t); + return a.height = Math.max(r || t.fontMetrics().defaultRuleThickness, t.minRuleThickness), a.style.borderBottomWidth = X(a.height), a.maxFontSize = 1, a; +}, g3 = function(e, t, r, a) { + var i = new Fu(e, t, r, a); + return Mu(i), i; +}, Bd = function(e) { + var t = new ti(e); + return Mu(t), t; +}, _3 = function(e, t) { + return e instanceof ti ? e0([], [e], t) : e; +}, v3 = function(e) { + if (e.positionType === "individualShift") { + for (var t = e.children, r = [t[0]], a = -t[0].shift - t[0].elem.depth, i = a, l = 1; l < t.length; l++) { + var s = -t[l].shift - i - t[l].elem.depth, o = s - (t[l - 1].elem.height + t[l - 1].elem.depth); + i = i + s, r.push({ + type: "kern", + size: o + }), r.push(t[l]); + } + return { + children: r, + depth: a + }; + } + var u; + if (e.positionType === "top") { + for (var c = e.positionData, d = 0; d < e.children.length; d++) { + var h = e.children[d]; + c -= h.type === "kern" ? h.size : h.elem.height + h.elem.depth; + } + u = c; + } else if (e.positionType === "bottom") + u = -e.positionData; + else { + var p = e.children[0]; + if (p.type !== "elem") + throw new Error('First child must have type "elem".'); + if (e.positionType === "shift") + u = -p.elem.depth - e.positionData; + else if (e.positionType === "firstBaseline") + u = -p.elem.depth; + else + throw new Error("Invalid positionType " + e.positionType + "."); + } + return { + children: e.children, + depth: u + }; +}, b3 = function(e, t) { + for (var { + children: r, + depth: a + } = v3(e), i = 0, l = 0; l < r.length; l++) { + var s = r[l]; + if (s.type === "elem") { + var o = s.elem; + i = Math.max(i, o.maxFontSize, o.height); + } + } + i += 2; + var u = e0(["pstrut"], []); + u.style.height = X(i); + for (var c = [], d = a, h = a, p = a, _ = 0; _ < r.length; _++) { + var b = r[_]; + if (b.type === "kern") + p += b.size; + else { + var D = b.elem, y = b.wrapperClasses || [], k = b.wrapperStyle || {}, w = e0(y, [u, D], void 0, k); + w.style.top = X(-i - p - D.depth), b.marginLeft && (w.style.marginLeft = b.marginLeft), b.marginRight && (w.style.marginRight = b.marginRight), c.push(w), p += D.height + D.depth; + } + d = Math.min(d, p), h = Math.max(h, p); + } + var E = e0(["vlist"], c); + E.style.height = X(h); + var S; + if (d < 0) { + var T = e0([], []), C = e0(["vlist"], [T]); + C.style.height = X(-d); + var F = e0(["vlist-s"], [new x0("​")]); + S = [e0(["vlist-r"], [E, F]), e0(["vlist-r"], [C])]; + } else + S = [e0(["vlist-r"], [E])]; + var B = e0(["vlist-t"], S); + return S.length === 2 && B.classes.push("vlist-t2"), B.height = h, B.depth = -d, B; +}, w3 = (n, e) => { + var t = e0(["mspace"], [], e), r = Ye(n, e); + return t.style.marginRight = X(r), t; +}, Pi = function(e, t, r) { + var a = ""; + switch (e) { + case "amsrm": + a = "AMS"; + break; + case "textrm": + a = "Main"; + break; + case "textsf": + a = "SansSerif"; + break; + case "texttt": + a = "Typewriter"; + break; + default: + a = e; + } + var i; + return t === "textbf" && r === "textit" ? i = "BoldItalic" : t === "textbf" ? i = "Bold" : t === "textit" ? i = "Italic" : i = "Regular", a + "-" + i; +}, Id = { + // styles + mathbf: { + variant: "bold", + fontName: "Main-Bold" + }, + mathrm: { + variant: "normal", + fontName: "Main-Regular" + }, + textit: { + variant: "italic", + fontName: "Main-Italic" + }, + mathit: { + variant: "italic", + fontName: "Main-Italic" + }, + mathnormal: { + variant: "italic", + fontName: "Math-Italic" + }, + // "boldsymbol" is missing because they require the use of multiple fonts: + // Math-BoldItalic and Main-Bold. This is handled by a special case in + // makeOrd which ends up calling boldsymbol. + // families + mathbb: { + variant: "double-struck", + fontName: "AMS-Regular" + }, + mathcal: { + variant: "script", + fontName: "Caligraphic-Regular" + }, + mathfrak: { + variant: "fraktur", + fontName: "Fraktur-Regular" + }, + mathscr: { + variant: "script", + fontName: "Script-Regular" + }, + mathsf: { + variant: "sans-serif", + fontName: "SansSerif-Regular" + }, + mathtt: { + variant: "monospace", + fontName: "Typewriter-Regular" + } +}, Ld = { + // path, width, height + vec: ["vec", 0.471, 0.714], + // values from the font glyph + oiintSize1: ["oiintSize1", 0.957, 0.499], + // oval to overlay the integrand + oiintSize2: ["oiintSize2", 1.472, 0.659], + oiiintSize1: ["oiiintSize1", 1.304, 0.499], + oiiintSize2: ["oiiintSize2", 1.98, 0.659] +}, y3 = function(e, t) { + var [r, a, i] = Ld[e], l = new un(r), s = new Br([l], { + width: X(a), + height: X(i), + // Override CSS rule `.katex svg { width: 100% }` + style: "width:" + X(a), + viewBox: "0 0 " + 1e3 * a + " " + 1e3 * i, + preserveAspectRatio: "xMinYMin" + }), o = zd(["overlay"], [s], t); + return o.height = i, o.style.height = X(i), o.style.width = X(a), o; +}, R = { + fontMap: Id, + makeSymbol: q0, + mathsym: c3, + makeSpan: e0, + makeSvgSpan: zd, + makeLineSpan: p3, + makeAnchor: g3, + makeFragment: Bd, + wrapFragment: _3, + makeVList: b3, + makeOrd: h3, + makeGlue: w3, + staticSvg: y3, + svgData: Ld, + tryCombineChars: m3 +}, Xe = { + number: 3, + unit: "mu" +}, bn = { + number: 4, + unit: "mu" +}, wr = { + number: 5, + unit: "mu" +}, k3 = { + mord: { + mop: Xe, + mbin: bn, + mrel: wr, + minner: Xe + }, + mop: { + mord: Xe, + mop: Xe, + mrel: wr, + minner: Xe + }, + mbin: { + mord: bn, + mop: bn, + mopen: bn, + minner: bn + }, + mrel: { + mord: wr, + mop: wr, + mopen: wr, + minner: wr + }, + mopen: {}, + mclose: { + mop: Xe, + mbin: bn, + mrel: wr, + minner: Xe + }, + mpunct: { + mord: Xe, + mop: Xe, + mrel: wr, + mopen: Xe, + mclose: Xe, + mpunct: Xe, + minner: Xe + }, + minner: { + mord: Xe, + mop: Xe, + mbin: bn, + mrel: wr, + mopen: Xe, + mpunct: Xe, + minner: Xe + } +}, D3 = { + mord: { + mop: Xe + }, + mop: { + mord: Xe, + mop: Xe + }, + mbin: {}, + mrel: {}, + mopen: {}, + mclose: { + mop: Xe + }, + mpunct: {}, + minner: { + mop: Xe + } +}, Nd = {}, Cl = {}, Fl = {}; +function Y(n) { + for (var { + type: e, + names: t, + props: r, + handler: a, + htmlBuilder: i, + mathmlBuilder: l + } = n, s = { + type: e, + numArgs: r.numArgs, + argTypes: r.argTypes, + allowedInArgument: !!r.allowedInArgument, + allowedInText: !!r.allowedInText, + allowedInMath: r.allowedInMath === void 0 ? !0 : r.allowedInMath, + numOptionalArgs: r.numOptionalArgs || 0, + infix: !!r.infix, + primitive: !!r.primitive, + handler: a + }, o = 0; o < t.length; ++o) + Nd[t[o]] = s; + e && (i && (Cl[e] = i), l && (Fl[e] = l)); +} +function Bn(n) { + var { + type: e, + htmlBuilder: t, + mathmlBuilder: r + } = n; + Y({ + type: e, + names: [], + props: { + numArgs: 0 + }, + handler() { + throw new Error("Should never be called."); + }, + htmlBuilder: t, + mathmlBuilder: r + }); +} +var Ml = function(e) { + return e.type === "ordgroup" && e.body.length === 1 ? e.body[0] : e; +}, tt = function(e) { + return e.type === "ordgroup" ? e.body : [e]; +}, Ir = R.makeSpan, A3 = ["leftmost", "mbin", "mopen", "mrel", "mop", "mpunct"], E3 = ["rightmost", "mrel", "mclose", "mpunct"], S3 = { + display: ae.DISPLAY, + text: ae.TEXT, + script: ae.SCRIPT, + scriptscript: ae.SCRIPTSCRIPT +}, x3 = { + mord: "mord", + mop: "mop", + mbin: "mbin", + mrel: "mrel", + mopen: "mopen", + mclose: "mclose", + mpunct: "mpunct", + minner: "minner" +}, gt = function(e, t, r, a) { + a === void 0 && (a = [null, null]); + for (var i = [], l = 0; l < e.length; l++) { + var s = Se(e[l], t); + if (s instanceof ti) { + var o = s.children; + i.push(...o); + } else + i.push(s); + } + if (R.tryCombineChars(i), !r) + return i; + var u = t; + if (e.length === 1) { + var c = e[0]; + c.type === "sizing" ? u = t.havingSize(c.size) : c.type === "styling" && (u = t.havingStyle(S3[c.style])); + } + var d = Ir([a[0] || "leftmost"], [], t), h = Ir([a[1] || "rightmost"], [], t), p = r === "root"; + return nc(i, (_, b) => { + var D = b.classes[0], y = _.classes[0]; + D === "mbin" && re.contains(E3, y) ? b.classes[0] = "mord" : y === "mbin" && re.contains(A3, D) && (_.classes[0] = "mord"); + }, { + node: d + }, h, p), nc(i, (_, b) => { + var D = Jo(b), y = Jo(_), k = D && y ? _.hasClass("mtight") ? D3[D][y] : k3[D][y] : null; + if (k) + return R.makeGlue(k, u); + }, { + node: d + }, h, p), i; +}, nc = function n(e, t, r, a, i) { + a && e.push(a); + for (var l = 0; l < e.length; l++) { + var s = e[l], o = Rd(s); + if (o) { + n(o.children, t, r, null, i); + continue; + } + var u = !s.hasClass("mspace"); + if (u) { + var c = t(s, r.node); + c && (r.insertAfter ? r.insertAfter(c) : (e.unshift(c), l++)); + } + u ? r.node = s : i && s.hasClass("newline") && (r.node = Ir(["leftmost"])), r.insertAfter = /* @__PURE__ */ ((d) => (h) => { + e.splice(d + 1, 0, h), l++; + })(l); + } + a && e.pop(); +}, Rd = function(e) { + return e instanceof ti || e instanceof Fu || e instanceof ri && e.hasClass("enclosing") ? e : null; +}, T3 = function n(e, t) { + var r = Rd(e); + if (r) { + var a = r.children; + if (a.length) { + if (t === "right") + return n(a[a.length - 1], "right"); + if (t === "left") + return n(a[0], "left"); + } + } + return e; +}, Jo = function(e, t) { + return e ? (t && (e = T3(e, t)), x3[e.classes[0]] || null) : null; +}, Ya = function(e, t) { + var r = ["nulldelimiter"].concat(e.baseSizingClasses()); + return Ir(t.concat(r)); +}, Se = function(e, t, r) { + if (!e) + return Ir(); + if (Cl[e.type]) { + var a = Cl[e.type](e, t); + if (r && t.size !== r.size) { + a = Ir(t.sizingClasses(r), [a], t); + var i = t.sizeMultiplier / r.sizeMultiplier; + a.height *= i, a.depth *= i; + } + return a; + } else + throw new G("Got group of unknown type: '" + e.type + "'"); +}; +function Hi(n, e) { + var t = Ir(["base"], n, e), r = Ir(["strut"]); + return r.style.height = X(t.height + t.depth), t.depth && (r.style.verticalAlign = X(-t.depth)), t.children.unshift(r), t; +} +function Qo(n, e) { + var t = null; + n.length === 1 && n[0].type === "tag" && (t = n[0].tag, n = n[0].body); + var r = gt(n, e, "root"), a; + r.length === 2 && r[1].hasClass("tag") && (a = r.pop()); + for (var i = [], l = [], s = 0; s < r.length; s++) + if (l.push(r[s]), r[s].hasClass("mbin") || r[s].hasClass("mrel") || r[s].hasClass("allowbreak")) { + for (var o = !1; s < r.length - 1 && r[s + 1].hasClass("mspace") && !r[s + 1].hasClass("newline"); ) + s++, l.push(r[s]), r[s].hasClass("nobreak") && (o = !0); + o || (i.push(Hi(l, e)), l = []); + } else r[s].hasClass("newline") && (l.pop(), l.length > 0 && (i.push(Hi(l, e)), l = []), i.push(r[s])); + l.length > 0 && i.push(Hi(l, e)); + var u; + t ? (u = Hi(gt(t, e, !0)), u.classes = ["tag"], i.push(u)) : a && i.push(a); + var c = Ir(["katex-html"], i); + if (c.setAttribute("aria-hidden", "true"), u) { + var d = u.children[0]; + d.style.height = X(c.height + c.depth), c.depth && (d.style.verticalAlign = X(-c.depth)); + } + return c; +} +function Od(n) { + return new ti(n); +} +class y0 { + constructor(e, t, r) { + this.type = void 0, this.attributes = void 0, this.children = void 0, this.classes = void 0, this.type = e, this.attributes = {}, this.children = t || [], this.classes = r || []; + } + /** + * Sets an attribute on a MathML node. MathML depends on attributes to convey a + * semantic content, so this is used heavily. + */ + setAttribute(e, t) { + this.attributes[e] = t; + } + /** + * Gets an attribute on a MathML node. + */ + getAttribute(e) { + return this.attributes[e]; + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + toNode() { + var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", this.type); + for (var t in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, t) && e.setAttribute(t, this.attributes[t]); + this.classes.length > 0 && (e.className = on(this.classes)); + for (var r = 0; r < this.children.length; r++) + e.appendChild(this.children[r].toNode()); + return e; + } + /** + * Converts the math node into an HTML markup string. + */ + toMarkup() { + var e = "<" + this.type; + for (var t in this.attributes) + Object.prototype.hasOwnProperty.call(this.attributes, t) && (e += " " + t + '="', e += re.escape(this.attributes[t]), e += '"'); + this.classes.length > 0 && (e += ' class ="' + re.escape(on(this.classes)) + '"'), e += ">"; + for (var r = 0; r < this.children.length; r++) + e += this.children[r].toMarkup(); + return e += "", e; + } + /** + * Converts the math node into a string, similar to innerText, but escaped. + */ + toText() { + return this.children.map((e) => e.toText()).join(""); + } +} +class Oa { + constructor(e) { + this.text = void 0, this.text = e; + } + /** + * Converts the text node into a DOM text node. + */ + toNode() { + return document.createTextNode(this.text); + } + /** + * Converts the text node into escaped HTML markup + * (representing the text itself). + */ + toMarkup() { + return re.escape(this.toText()); + } + /** + * Converts the text node into a string + * (representing the text itself). + */ + toText() { + return this.text; + } +} +class C3 { + /** + * Create a Space node with width given in CSS ems. + */ + constructor(e) { + this.width = void 0, this.character = void 0, this.width = e, e >= 0.05555 && e <= 0.05556 ? this.character = " " : e >= 0.1666 && e <= 0.1667 ? this.character = " " : e >= 0.2222 && e <= 0.2223 ? this.character = " " : e >= 0.2777 && e <= 0.2778 ? this.character = "  " : e >= -0.05556 && e <= -0.05555 ? this.character = " ⁣" : e >= -0.1667 && e <= -0.1666 ? this.character = " ⁣" : e >= -0.2223 && e <= -0.2222 ? this.character = " ⁣" : e >= -0.2778 && e <= -0.2777 ? this.character = " ⁣" : this.character = null; + } + /** + * Converts the math node into a MathML-namespaced DOM element. + */ + toNode() { + if (this.character) + return document.createTextNode(this.character); + var e = document.createElementNS("http://www.w3.org/1998/Math/MathML", "mspace"); + return e.setAttribute("width", X(this.width)), e; + } + /** + * Converts the math node into an HTML markup string. + */ + toMarkup() { + return this.character ? "" + this.character + "" : ''; + } + /** + * Converts the math node into a string, similar to innerText. + */ + toText() { + return this.character ? this.character : " "; + } +} +var U = { + MathNode: y0, + TextNode: Oa, + SpaceNode: C3, + newDocumentFragment: Od +}, T0 = function(e, t, r) { + return Ne[t][e] && Ne[t][e].replace && e.charCodeAt(0) !== 55349 && !(Md.hasOwnProperty(e) && r && (r.fontFamily && r.fontFamily.slice(4, 6) === "tt" || r.font && r.font.slice(4, 6) === "tt")) && (e = Ne[t][e].replace), new U.TextNode(e); +}, zu = function(e) { + return e.length === 1 ? e[0] : new U.MathNode("mrow", e); +}, Bu = function(e, t) { + if (t.fontFamily === "texttt") + return "monospace"; + if (t.fontFamily === "textsf") + return t.fontShape === "textit" && t.fontWeight === "textbf" ? "sans-serif-bold-italic" : t.fontShape === "textit" ? "sans-serif-italic" : t.fontWeight === "textbf" ? "bold-sans-serif" : "sans-serif"; + if (t.fontShape === "textit" && t.fontWeight === "textbf") + return "bold-italic"; + if (t.fontShape === "textit") + return "italic"; + if (t.fontWeight === "textbf") + return "bold"; + var r = t.font; + if (!r || r === "mathnormal") + return null; + var a = e.mode; + if (r === "mathit") + return "italic"; + if (r === "boldsymbol") + return e.type === "textord" ? "bold" : "bold-italic"; + if (r === "mathbf") + return "bold"; + if (r === "mathbb") + return "double-struck"; + if (r === "mathfrak") + return "fraktur"; + if (r === "mathscr" || r === "mathcal") + return "script"; + if (r === "mathsf") + return "sans-serif"; + if (r === "mathtt") + return "monospace"; + var i = e.text; + if (re.contains(["\\imath", "\\jmath"], i)) + return null; + Ne[a][i] && Ne[a][i].replace && (i = Ne[a][i].replace); + var l = R.fontMap[r].fontName; + return Cu(i, l, a) ? R.fontMap[r].variant : null; +}, a0 = function(e, t, r) { + if (e.length === 1) { + var a = Ie(e[0], t); + return r && a instanceof y0 && a.type === "mo" && (a.setAttribute("lspace", "0em"), a.setAttribute("rspace", "0em")), [a]; + } + for (var i = [], l, s = 0; s < e.length; s++) { + var o = Ie(e[s], t); + if (o instanceof y0 && l instanceof y0) { + if (o.type === "mtext" && l.type === "mtext" && o.getAttribute("mathvariant") === l.getAttribute("mathvariant")) { + l.children.push(...o.children); + continue; + } else if (o.type === "mn" && l.type === "mn") { + l.children.push(...o.children); + continue; + } else if (o.type === "mi" && o.children.length === 1 && l.type === "mn") { + var u = o.children[0]; + if (u instanceof Oa && u.text === ".") { + l.children.push(...o.children); + continue; + } + } else if (l.type === "mi" && l.children.length === 1) { + var c = l.children[0]; + if (c instanceof Oa && c.text === "̸" && (o.type === "mo" || o.type === "mi" || o.type === "mn")) { + var d = o.children[0]; + d instanceof Oa && d.text.length > 0 && (d.text = d.text.slice(0, 1) + "̸" + d.text.slice(1), i.pop()); + } + } + } + i.push(o), l = o; + } + return i; +}, cn = function(e, t, r) { + return zu(a0(e, t, r)); +}, Ie = function(e, t) { + if (!e) + return new U.MathNode("mrow"); + if (Fl[e.type]) { + var r = Fl[e.type](e, t); + return r; + } else + throw new G("Got group of unknown type: '" + e.type + "'"); +}; +function ac(n, e, t, r, a) { + var i = a0(n, t), l; + i.length === 1 && i[0] instanceof y0 && re.contains(["mrow", "mtable"], i[0].type) ? l = i[0] : l = new U.MathNode("mrow", i); + var s = new U.MathNode("annotation", [new U.TextNode(e)]); + s.setAttribute("encoding", "application/x-tex"); + var o = new U.MathNode("semantics", [l, s]), u = new U.MathNode("math", [o]); + u.setAttribute("xmlns", "http://www.w3.org/1998/Math/MathML"), r && u.setAttribute("display", "block"); + var c = a ? "katex" : "katex-mathml"; + return R.makeSpan([c], [u]); +} +var qd = function(e) { + return new Dr({ + style: e.displayMode ? ae.DISPLAY : ae.TEXT, + maxSize: e.maxSize, + minRuleThickness: e.minRuleThickness + }); +}, Pd = function(e, t) { + if (t.displayMode) { + var r = ["katex-display"]; + t.leqno && r.push("leqno"), t.fleqn && r.push("fleqn"), e = R.makeSpan(r, [e]); + } + return e; +}, F3 = function(e, t, r) { + var a = qd(r), i; + if (r.output === "mathml") + return ac(e, t, a, r.displayMode, !0); + if (r.output === "html") { + var l = Qo(e, a); + i = R.makeSpan(["katex"], [l]); + } else { + var s = ac(e, t, a, r.displayMode, !1), o = Qo(e, a); + i = R.makeSpan(["katex"], [s, o]); + } + return Pd(i, r); +}, M3 = function(e, t, r) { + var a = qd(r), i = Qo(e, a), l = R.makeSpan(["katex"], [i]); + return Pd(l, r); +}, z3 = { + widehat: "^", + widecheck: "ˇ", + widetilde: "~", + utilde: "~", + overleftarrow: "←", + underleftarrow: "←", + xleftarrow: "←", + overrightarrow: "→", + underrightarrow: "→", + xrightarrow: "→", + underbrace: "⏟", + overbrace: "⏞", + overgroup: "⏠", + undergroup: "⏡", + overleftrightarrow: "↔", + underleftrightarrow: "↔", + xleftrightarrow: "↔", + Overrightarrow: "⇒", + xRightarrow: "⇒", + overleftharpoon: "↼", + xleftharpoonup: "↼", + overrightharpoon: "⇀", + xrightharpoonup: "⇀", + xLeftarrow: "⇐", + xLeftrightarrow: "⇔", + xhookleftarrow: "↩", + xhookrightarrow: "↪", + xmapsto: "↦", + xrightharpoondown: "⇁", + xleftharpoondown: "↽", + xrightleftharpoons: "⇌", + xleftrightharpoons: "⇋", + xtwoheadleftarrow: "↞", + xtwoheadrightarrow: "↠", + xlongequal: "=", + xtofrom: "⇄", + xrightleftarrows: "⇄", + xrightequilibrium: "⇌", + // Not a perfect match. + xleftequilibrium: "⇋", + // None better available. + "\\cdrightarrow": "→", + "\\cdleftarrow": "←", + "\\cdlongequal": "=" +}, B3 = function(e) { + var t = new U.MathNode("mo", [new U.TextNode(z3[e.replace(/^\\/, "")])]); + return t.setAttribute("stretchy", "true"), t; +}, I3 = { + // path(s), minWidth, height, align + overrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + overleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + underrightarrow: [["rightarrow"], 0.888, 522, "xMaxYMin"], + underleftarrow: [["leftarrow"], 0.888, 522, "xMinYMin"], + xrightarrow: [["rightarrow"], 1.469, 522, "xMaxYMin"], + "\\cdrightarrow": [["rightarrow"], 3, 522, "xMaxYMin"], + // CD minwwidth2.5pc + xleftarrow: [["leftarrow"], 1.469, 522, "xMinYMin"], + "\\cdleftarrow": [["leftarrow"], 3, 522, "xMinYMin"], + Overrightarrow: [["doublerightarrow"], 0.888, 560, "xMaxYMin"], + xRightarrow: [["doublerightarrow"], 1.526, 560, "xMaxYMin"], + xLeftarrow: [["doubleleftarrow"], 1.526, 560, "xMinYMin"], + overleftharpoon: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoonup: [["leftharpoon"], 0.888, 522, "xMinYMin"], + xleftharpoondown: [["leftharpoondown"], 0.888, 522, "xMinYMin"], + overrightharpoon: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoonup: [["rightharpoon"], 0.888, 522, "xMaxYMin"], + xrightharpoondown: [["rightharpoondown"], 0.888, 522, "xMaxYMin"], + xlongequal: [["longequal"], 0.888, 334, "xMinYMin"], + "\\cdlongequal": [["longequal"], 3, 334, "xMinYMin"], + xtwoheadleftarrow: [["twoheadleftarrow"], 0.888, 334, "xMinYMin"], + xtwoheadrightarrow: [["twoheadrightarrow"], 0.888, 334, "xMaxYMin"], + overleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + overbrace: [["leftbrace", "midbrace", "rightbrace"], 1.6, 548], + underbrace: [["leftbraceunder", "midbraceunder", "rightbraceunder"], 1.6, 548], + underleftrightarrow: [["leftarrow", "rightarrow"], 0.888, 522], + xleftrightarrow: [["leftarrow", "rightarrow"], 1.75, 522], + xLeftrightarrow: [["doubleleftarrow", "doublerightarrow"], 1.75, 560], + xrightleftharpoons: [["leftharpoondownplus", "rightharpoonplus"], 1.75, 716], + xleftrightharpoons: [["leftharpoonplus", "rightharpoondownplus"], 1.75, 716], + xhookleftarrow: [["leftarrow", "righthook"], 1.08, 522], + xhookrightarrow: [["lefthook", "rightarrow"], 1.08, 522], + overlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + underlinesegment: [["leftlinesegment", "rightlinesegment"], 0.888, 522], + overgroup: [["leftgroup", "rightgroup"], 0.888, 342], + undergroup: [["leftgroupunder", "rightgroupunder"], 0.888, 342], + xmapsto: [["leftmapsto", "rightarrow"], 1.5, 522], + xtofrom: [["leftToFrom", "rightToFrom"], 1.75, 528], + // The next three arrows are from the mhchem package. + // In mhchem.sty, min-length is 2.0em. But these arrows might appear in the + // document as \xrightarrow or \xrightleftharpoons. Those have + // min-length = 1.75em, so we set min-length on these next three to match. + xrightleftarrows: [["baraboveleftarrow", "rightarrowabovebar"], 1.75, 901], + xrightequilibrium: [["baraboveshortleftharpoon", "rightharpoonaboveshortbar"], 1.75, 716], + xleftequilibrium: [["shortbaraboveleftharpoon", "shortrightharpoonabovebar"], 1.75, 716] +}, L3 = function(e) { + return e.type === "ordgroup" ? e.body.length : 1; +}, N3 = function(e, t) { + function r() { + var s = 4e5, o = e.label.slice(1); + if (re.contains(["widehat", "widecheck", "widetilde", "utilde"], o)) { + var u = e, c = L3(u.base), d, h, p; + if (c > 5) + o === "widehat" || o === "widecheck" ? (d = 420, s = 2364, p = 0.42, h = o + "4") : (d = 312, s = 2340, p = 0.34, h = "tilde4"); + else { + var _ = [1, 1, 2, 2, 3, 3][c]; + o === "widehat" || o === "widecheck" ? (s = [0, 1062, 2364, 2364, 2364][_], d = [0, 239, 300, 360, 420][_], p = [0, 0.24, 0.3, 0.3, 0.36, 0.42][_], h = o + _) : (s = [0, 600, 1033, 2339, 2340][_], d = [0, 260, 286, 306, 312][_], p = [0, 0.26, 0.286, 0.3, 0.306, 0.34][_], h = "tilde" + _); + } + var b = new un(h), D = new Br([b], { + width: "100%", + height: X(p), + viewBox: "0 0 " + s + " " + d, + preserveAspectRatio: "none" + }); + return { + span: R.makeSvgSpan([], [D], t), + minWidth: 0, + height: p + }; + } else { + var y = [], k = I3[o], [w, E, S] = k, T = S / 1e3, C = w.length, F, B; + if (C === 1) { + var I = k[3]; + F = ["hide-tail"], B = [I]; + } else if (C === 2) + F = ["halfarrow-left", "halfarrow-right"], B = ["xMinYMin", "xMaxYMin"]; + else if (C === 3) + F = ["brace-left", "brace-center", "brace-right"], B = ["xMinYMin", "xMidYMin", "xMaxYMin"]; + else + throw new Error(`Correct katexImagesData or update code here to support + ` + C + " children."); + for (var L = 0; L < C; L++) { + var P = new un(w[L]), Z = new Br([P], { + width: "400em", + height: X(T), + viewBox: "0 0 " + s + " " + S, + preserveAspectRatio: B[L] + " slice" + }), O = R.makeSvgSpan([F[L]], [Z], t); + if (C === 1) + return { + span: O, + minWidth: E, + height: T + }; + O.style.height = X(T), y.push(O); + } + return { + span: R.makeSpan(["stretchy"], y, t), + minWidth: E, + height: T + }; + } + } + var { + span: a, + minWidth: i, + height: l + } = r(); + return a.height = l, a.style.height = X(l), i > 0 && (a.style.minWidth = X(i)), a; +}, R3 = function(e, t, r, a, i) { + var l, s = e.height + e.depth + r + a; + if (/fbox|color|angl/.test(t)) { + if (l = R.makeSpan(["stretchy", t], [], i), t === "fbox") { + var o = i.color && i.getColor(); + o && (l.style.borderColor = o); + } + } else { + var u = []; + /^[bx]cancel$/.test(t) && u.push(new Zo({ + x1: "0", + y1: "0", + x2: "100%", + y2: "100%", + "stroke-width": "0.046em" + })), /^x?cancel$/.test(t) && u.push(new Zo({ + x1: "0", + y1: "100%", + x2: "100%", + y2: "0", + "stroke-width": "0.046em" + })); + var c = new Br(u, { + width: "100%", + height: X(s) + }); + l = R.makeSvgSpan([], [c], i); + } + return l.height = s, l.style.height = X(s), l; +}, Lr = { + encloseSpan: R3, + mathMLnode: B3, + svgSpan: N3 +}; +function pe(n, e) { + if (!n || n.type !== e) + throw new Error("Expected node of type " + e + ", but got " + (n ? "node of type " + n.type : String(n))); + return n; +} +function Iu(n) { + var e = Jl(n); + if (!e) + throw new Error("Expected node of symbol group type, but got " + (n ? "node of type " + n.type : String(n))); + return e; +} +function Jl(n) { + return n && (n.type === "atom" || o3.hasOwnProperty(n.type)) ? n : null; +} +var Lu = (n, e) => { + var t, r, a; + n && n.type === "supsub" ? (r = pe(n.base, "accent"), t = r.base, n.base = t, a = l3(Se(n, e)), n.base = r) : (r = pe(n, "accent"), t = r.base); + var i = Se(t, e.havingCrampedStyle()), l = r.isShifty && re.isCharacterBox(t), s = 0; + if (l) { + var o = re.getBaseElem(t), u = Se(o, e.havingCrampedStyle()); + s = J1(u).skew; + } + var c = r.label === "\\c", d = c ? i.height + i.depth : Math.min(i.height, e.fontMetrics().xHeight), h; + if (r.isStretchy) + h = Lr.svgSpan(r, e), h = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: i + }, { + type: "elem", + elem: h, + wrapperClasses: ["svg-align"], + wrapperStyle: s > 0 ? { + width: "calc(100% - " + X(2 * s) + ")", + marginLeft: X(2 * s) + } : void 0 + }] + }, e); + else { + var p, _; + r.label === "\\vec" ? (p = R.staticSvg("vec", e), _ = R.svgData.vec[1]) : (p = R.makeOrd({ + mode: r.mode, + text: r.label + }, e, "textord"), p = J1(p), p.italic = 0, _ = p.width, c && (d += p.depth)), h = R.makeSpan(["accent-body"], [p]); + var b = r.label === "\\textcircled"; + b && (h.classes.push("accent-full"), d = i.height); + var D = s; + b || (D -= _ / 2), h.style.left = X(D), r.label === "\\textcircled" && (h.style.top = ".2em"), h = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: i + }, { + type: "kern", + size: -d + }, { + type: "elem", + elem: h + }] + }, e); + } + var y = R.makeSpan(["mord", "accent"], [h], e); + return a ? (a.children[0] = y, a.height = Math.max(y.height, a.height), a.classes[0] = "mord", a) : y; +}, Hd = (n, e) => { + var t = n.isStretchy ? Lr.mathMLnode(n.label) : new U.MathNode("mo", [T0(n.label, n.mode)]), r = new U.MathNode("mover", [Ie(n.base, e), t]); + return r.setAttribute("accent", "true"), r; +}, O3 = new RegExp(["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring"].map((n) => "\\" + n).join("|")); +Y({ + type: "accent", + names: ["\\acute", "\\grave", "\\ddot", "\\tilde", "\\bar", "\\breve", "\\check", "\\hat", "\\vec", "\\dot", "\\mathring", "\\widecheck", "\\widehat", "\\widetilde", "\\overrightarrow", "\\overleftarrow", "\\Overrightarrow", "\\overleftrightarrow", "\\overgroup", "\\overlinesegment", "\\overleftharpoon", "\\overrightharpoon"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var t = Ml(e[0]), r = !O3.test(n.funcName), a = !r || n.funcName === "\\widehat" || n.funcName === "\\widetilde" || n.funcName === "\\widecheck"; + return { + type: "accent", + mode: n.parser.mode, + label: n.funcName, + isStretchy: r, + isShifty: a, + base: t + }; + }, + htmlBuilder: Lu, + mathmlBuilder: Hd +}); +Y({ + type: "accent", + names: ["\\'", "\\`", "\\^", "\\~", "\\=", "\\u", "\\.", '\\"', "\\c", "\\r", "\\H", "\\v", "\\textcircled"], + props: { + numArgs: 1, + allowedInText: !0, + allowedInMath: !0, + // unless in strict mode + argTypes: ["primitive"] + }, + handler: (n, e) => { + var t = e[0], r = n.parser.mode; + return r === "math" && (n.parser.settings.reportNonstrict("mathVsTextAccents", "LaTeX's accent " + n.funcName + " works only in text mode"), r = "text"), { + type: "accent", + mode: r, + label: n.funcName, + isStretchy: !1, + isShifty: !0, + base: t + }; + }, + htmlBuilder: Lu, + mathmlBuilder: Hd +}); +Y({ + type: "accentUnder", + names: ["\\underleftarrow", "\\underrightarrow", "\\underleftrightarrow", "\\undergroup", "\\underlinesegment", "\\utilde"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "accentUnder", + mode: t.mode, + label: r, + base: a + }; + }, + htmlBuilder: (n, e) => { + var t = Se(n.base, e), r = Lr.svgSpan(n, e), a = n.label === "\\utilde" ? 0.12 : 0, i = R.makeVList({ + positionType: "top", + positionData: t.height, + children: [{ + type: "elem", + elem: r, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: a + }, { + type: "elem", + elem: t + }] + }, e); + return R.makeSpan(["mord", "accentunder"], [i], e); + }, + mathmlBuilder: (n, e) => { + var t = Lr.mathMLnode(n.label), r = new U.MathNode("munder", [Ie(n.base, e), t]); + return r.setAttribute("accentunder", "true"), r; + } +}); +var Ui = (n) => { + var e = new U.MathNode("mpadded", n ? [n] : []); + return e.setAttribute("width", "+0.6em"), e.setAttribute("lspace", "0.3em"), e; +}; +Y({ + type: "xArrow", + names: [ + "\\xleftarrow", + "\\xrightarrow", + "\\xLeftarrow", + "\\xRightarrow", + "\\xleftrightarrow", + "\\xLeftrightarrow", + "\\xhookleftarrow", + "\\xhookrightarrow", + "\\xmapsto", + "\\xrightharpoondown", + "\\xrightharpoonup", + "\\xleftharpoondown", + "\\xleftharpoonup", + "\\xrightleftharpoons", + "\\xleftrightharpoons", + "\\xlongequal", + "\\xtwoheadrightarrow", + "\\xtwoheadleftarrow", + "\\xtofrom", + // The next 3 functions are here to support the mhchem extension. + // Direct use of these functions is discouraged and may break someday. + "\\xrightleftarrows", + "\\xrightequilibrium", + "\\xleftequilibrium", + // The next 3 functions are here only to support the {CD} environment. + "\\\\cdrightarrow", + "\\\\cdleftarrow", + "\\\\cdlongequal" + ], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler(n, e, t) { + var { + parser: r, + funcName: a + } = n; + return { + type: "xArrow", + mode: r.mode, + label: a, + body: e[0], + below: t[0] + }; + }, + // Flow is unable to correctly infer the type of `group`, even though it's + // unambiguously determined from the passed-in `type` above. + htmlBuilder(n, e) { + var t = e.style, r = e.havingStyle(t.sup()), a = R.wrapFragment(Se(n.body, r, e), e), i = n.label.slice(0, 2) === "\\x" ? "x" : "cd"; + a.classes.push(i + "-arrow-pad"); + var l; + n.below && (r = e.havingStyle(t.sub()), l = R.wrapFragment(Se(n.below, r, e), e), l.classes.push(i + "-arrow-pad")); + var s = Lr.svgSpan(n, e), o = -e.fontMetrics().axisHeight + 0.5 * s.height, u = -e.fontMetrics().axisHeight - 0.5 * s.height - 0.111; + (a.depth > 0.25 || n.label === "\\xleftequilibrium") && (u -= a.depth); + var c; + if (l) { + var d = -e.fontMetrics().axisHeight + l.height + 0.5 * s.height + 0.111; + c = R.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: a, + shift: u + }, { + type: "elem", + elem: s, + shift: o + }, { + type: "elem", + elem: l, + shift: d + }] + }, e); + } else + c = R.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: a, + shift: u + }, { + type: "elem", + elem: s, + shift: o + }] + }, e); + return c.children[0].children[0].children[1].classes.push("svg-align"), R.makeSpan(["mrel", "x-arrow"], [c], e); + }, + mathmlBuilder(n, e) { + var t = Lr.mathMLnode(n.label); + t.setAttribute("minsize", n.label.charAt(0) === "x" ? "1.75em" : "3.0em"); + var r; + if (n.body) { + var a = Ui(Ie(n.body, e)); + if (n.below) { + var i = Ui(Ie(n.below, e)); + r = new U.MathNode("munderover", [t, i, a]); + } else + r = new U.MathNode("mover", [t, a]); + } else if (n.below) { + var l = Ui(Ie(n.below, e)); + r = new U.MathNode("munder", [t, l]); + } else + r = Ui(), r = new U.MathNode("mover", [t, r]); + return r; + } +}); +var q3 = R.makeSpan; +function Ud(n, e) { + var t = gt(n.body, e, !0); + return q3([n.mclass], t, e); +} +function Vd(n, e) { + var t, r = a0(n.body, e); + return n.mclass === "minner" ? t = new U.MathNode("mpadded", r) : n.mclass === "mord" ? n.isCharacterBox ? (t = r[0], t.type = "mi") : t = new U.MathNode("mi", r) : (n.isCharacterBox ? (t = r[0], t.type = "mo") : t = new U.MathNode("mo", r), n.mclass === "mbin" ? (t.attributes.lspace = "0.22em", t.attributes.rspace = "0.22em") : n.mclass === "mpunct" ? (t.attributes.lspace = "0em", t.attributes.rspace = "0.17em") : n.mclass === "mopen" || n.mclass === "mclose" ? (t.attributes.lspace = "0em", t.attributes.rspace = "0em") : n.mclass === "minner" && (t.attributes.lspace = "0.0556em", t.attributes.width = "+0.1111em")), t; +} +Y({ + type: "mclass", + names: ["\\mathord", "\\mathbin", "\\mathrel", "\\mathopen", "\\mathclose", "\\mathpunct", "\\mathinner"], + props: { + numArgs: 1, + primitive: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "mclass", + mode: t.mode, + mclass: "m" + r.slice(5), + // TODO(kevinb): don't prefix with 'm' + body: tt(a), + isCharacterBox: re.isCharacterBox(a) + }; + }, + htmlBuilder: Ud, + mathmlBuilder: Vd +}); +var Ql = (n) => { + var e = n.type === "ordgroup" && n.body.length ? n.body[0] : n; + return e.type === "atom" && (e.family === "bin" || e.family === "rel") ? "m" + e.family : "mord"; +}; +Y({ + type: "mclass", + names: ["\\@binrel"], + props: { + numArgs: 2 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "mclass", + mode: t.mode, + mclass: Ql(e[0]), + body: tt(e[1]), + isCharacterBox: re.isCharacterBox(e[1]) + }; + } +}); +Y({ + type: "mclass", + names: ["\\stackrel", "\\overset", "\\underset"], + props: { + numArgs: 2 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[1], i = e[0], l; + r !== "\\stackrel" ? l = Ql(a) : l = "mrel"; + var s = { + type: "op", + mode: a.mode, + limits: !0, + alwaysHandleSupSub: !0, + parentIsSupSub: !1, + symbol: !1, + suppressBaseShift: r !== "\\stackrel", + body: tt(a) + }, o = { + type: "supsub", + mode: i.mode, + base: s, + sup: r === "\\underset" ? null : i, + sub: r === "\\underset" ? i : null + }; + return { + type: "mclass", + mode: t.mode, + mclass: l, + body: [o], + isCharacterBox: re.isCharacterBox(o) + }; + }, + htmlBuilder: Ud, + mathmlBuilder: Vd +}); +Y({ + type: "pmb", + names: ["\\pmb"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "pmb", + mode: t.mode, + mclass: Ql(e[0]), + body: tt(e[0]) + }; + }, + htmlBuilder(n, e) { + var t = gt(n.body, e, !0), r = R.makeSpan([n.mclass], t, e); + return r.style.textShadow = "0.02em 0.01em 0.04px", r; + }, + mathmlBuilder(n, e) { + var t = a0(n.body, e), r = new U.MathNode("mstyle", t); + return r.setAttribute("style", "text-shadow: 0.02em 0.01em 0.04px"), r; + } +}); +var P3 = { + ">": "\\\\cdrightarrow", + "<": "\\\\cdleftarrow", + "=": "\\\\cdlongequal", + A: "\\uparrow", + V: "\\downarrow", + "|": "\\Vert", + ".": "no arrow" +}, ic = () => ({ + type: "styling", + body: [], + mode: "math", + style: "display" +}), lc = (n) => n.type === "textord" && n.text === "@", H3 = (n, e) => (n.type === "mathord" || n.type === "atom") && n.text === e; +function U3(n, e, t) { + var r = P3[n]; + switch (r) { + case "\\\\cdrightarrow": + case "\\\\cdleftarrow": + return t.callFunction(r, [e[0]], [e[1]]); + case "\\uparrow": + case "\\downarrow": { + var a = t.callFunction("\\\\cdleft", [e[0]], []), i = { + type: "atom", + text: r, + mode: "math", + family: "rel" + }, l = t.callFunction("\\Big", [i], []), s = t.callFunction("\\\\cdright", [e[1]], []), o = { + type: "ordgroup", + mode: "math", + body: [a, l, s] + }; + return t.callFunction("\\\\cdparent", [o], []); + } + case "\\\\cdlongequal": + return t.callFunction("\\\\cdlongequal", [], []); + case "\\Vert": { + var u = { + type: "textord", + text: "\\Vert", + mode: "math" + }; + return t.callFunction("\\Big", [u], []); + } + default: + return { + type: "textord", + text: " ", + mode: "math" + }; + } +} +function V3(n) { + var e = []; + for (n.gullet.beginGroup(), n.gullet.macros.set("\\cr", "\\\\\\relax"), n.gullet.beginGroup(); ; ) { + e.push(n.parseExpression(!1, "\\\\")), n.gullet.endGroup(), n.gullet.beginGroup(); + var t = n.fetch().text; + if (t === "&" || t === "\\\\") + n.consume(); + else if (t === "\\end") { + e[e.length - 1].length === 0 && e.pop(); + break; + } else + throw new G("Expected \\\\ or \\cr or \\end", n.nextToken); + } + for (var r = [], a = [r], i = 0; i < e.length; i++) { + for (var l = e[i], s = ic(), o = 0; o < l.length; o++) + if (!lc(l[o])) + s.body.push(l[o]); + else { + r.push(s), o += 1; + var u = Iu(l[o]).text, c = new Array(2); + if (c[0] = { + type: "ordgroup", + mode: "math", + body: [] + }, c[1] = { + type: "ordgroup", + mode: "math", + body: [] + }, !("=|.".indexOf(u) > -1)) if ("<>AV".indexOf(u) > -1) + for (var d = 0; d < 2; d++) { + for (var h = !0, p = o + 1; p < l.length; p++) { + if (H3(l[p], u)) { + h = !1, o = p; + break; + } + if (lc(l[p])) + throw new G("Missing a " + u + " character to complete a CD arrow.", l[p]); + c[d].body.push(l[p]); + } + if (h) + throw new G("Missing a " + u + " character to complete a CD arrow.", l[o]); + } + else + throw new G('Expected one of "<>AV=|." after @', l[o]); + var _ = U3(u, c, n), b = { + type: "styling", + body: [_], + mode: "math", + style: "display" + // CD is always displaystyle. + }; + r.push(b), s = ic(); + } + i % 2 === 0 ? r.push(s) : r.shift(), r = [], a.push(r); + } + n.gullet.endGroup(), n.gullet.endGroup(); + var D = new Array(a[0].length).fill({ + type: "align", + align: "c", + pregap: 0.25, + // CD package sets \enskip between columns. + postgap: 0.25 + // So pre and post each get half an \enskip, i.e. 0.25em. + }); + return { + type: "array", + mode: "math", + body: a, + arraystretch: 1, + addJot: !0, + rowGaps: [null], + cols: D, + colSeparationType: "CD", + hLinesBeforeRow: new Array(a.length + 1).fill([]) + }; +} +Y({ + type: "cdlabel", + names: ["\\\\cdleft", "\\\\cdright"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n; + return { + type: "cdlabel", + mode: t.mode, + side: r.slice(4), + label: e[0] + }; + }, + htmlBuilder(n, e) { + var t = e.havingStyle(e.style.sup()), r = R.wrapFragment(Se(n.label, t, e), e); + return r.classes.push("cd-label-" + n.side), r.style.bottom = X(0.8 - r.depth), r.height = 0, r.depth = 0, r; + }, + mathmlBuilder(n, e) { + var t = new U.MathNode("mrow", [Ie(n.label, e)]); + return t = new U.MathNode("mpadded", [t]), t.setAttribute("width", "0"), n.side === "left" && t.setAttribute("lspace", "-1width"), t.setAttribute("voffset", "0.7em"), t = new U.MathNode("mstyle", [t]), t.setAttribute("displaystyle", "false"), t.setAttribute("scriptlevel", "1"), t; + } +}); +Y({ + type: "cdlabelparent", + names: ["\\\\cdparent"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "cdlabelparent", + mode: t.mode, + fragment: e[0] + }; + }, + htmlBuilder(n, e) { + var t = R.wrapFragment(Se(n.fragment, e), e); + return t.classes.push("cd-vert-arrow"), t; + }, + mathmlBuilder(n, e) { + return new U.MathNode("mrow", [Ie(n.fragment, e)]); + } +}); +Y({ + type: "textord", + names: ["\\@char"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler(n, e) { + for (var { + parser: t + } = n, r = pe(e[0], "ordgroup"), a = r.body, i = "", l = 0; l < a.length; l++) { + var s = pe(a[l], "textord"); + i += s.text; + } + var o = parseInt(i), u; + if (isNaN(o)) + throw new G("\\@char has non-numeric argument " + i); + if (o < 0 || o >= 1114111) + throw new G("\\@char with invalid code point " + i); + return o <= 65535 ? u = String.fromCharCode(o) : (o -= 65536, u = String.fromCharCode((o >> 10) + 55296, (o & 1023) + 56320)), { + type: "textord", + mode: t.mode, + text: u + }; + } +}); +var Gd = (n, e) => { + var t = gt(n.body, e.withColor(n.color), !1); + return R.makeFragment(t); +}, jd = (n, e) => { + var t = a0(n.body, e.withColor(n.color)), r = new U.MathNode("mstyle", t); + return r.setAttribute("mathcolor", n.color), r; +}; +Y({ + type: "color", + names: ["\\textcolor"], + props: { + numArgs: 2, + allowedInText: !0, + argTypes: ["color", "original"] + }, + handler(n, e) { + var { + parser: t + } = n, r = pe(e[0], "color-token").color, a = e[1]; + return { + type: "color", + mode: t.mode, + color: r, + body: tt(a) + }; + }, + htmlBuilder: Gd, + mathmlBuilder: jd +}); +Y({ + type: "color", + names: ["\\color"], + props: { + numArgs: 1, + allowedInText: !0, + argTypes: ["color"] + }, + handler(n, e) { + var { + parser: t, + breakOnTokenText: r + } = n, a = pe(e[0], "color-token").color; + t.gullet.macros.set("\\current@color", a); + var i = t.parseExpression(!0, r); + return { + type: "color", + mode: t.mode, + color: a, + body: i + }; + }, + htmlBuilder: Gd, + mathmlBuilder: jd +}); +Y({ + type: "cr", + names: ["\\\\"], + props: { + numArgs: 0, + numOptionalArgs: 0, + allowedInText: !0 + }, + handler(n, e, t) { + var { + parser: r + } = n, a = r.gullet.future().text === "[" ? r.parseSizeGroup(!0) : null, i = !r.settings.displayMode || !r.settings.useStrictBehavior("newLineInDisplayMode", "In LaTeX, \\\\ or \\newline does nothing in display mode"); + return { + type: "cr", + mode: r.mode, + newLine: i, + size: a && pe(a, "size").value + }; + }, + // The following builders are called only at the top level, + // not within tabular/array environments. + htmlBuilder(n, e) { + var t = R.makeSpan(["mspace"], [], e); + return n.newLine && (t.classes.push("newline"), n.size && (t.style.marginTop = X(Ye(n.size, e)))), t; + }, + mathmlBuilder(n, e) { + var t = new U.MathNode("mspace"); + return n.newLine && (t.setAttribute("linebreak", "newline"), n.size && t.setAttribute("height", X(Ye(n.size, e)))), t; + } +}); +var $o = { + "\\global": "\\global", + "\\long": "\\\\globallong", + "\\\\globallong": "\\\\globallong", + "\\def": "\\gdef", + "\\gdef": "\\gdef", + "\\edef": "\\xdef", + "\\xdef": "\\xdef", + "\\let": "\\\\globallet", + "\\futurelet": "\\\\globalfuture" +}, Wd = (n) => { + var e = n.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(e)) + throw new G("Expected a control sequence", n); + return e; +}, G3 = (n) => { + var e = n.gullet.popToken(); + return e.text === "=" && (e = n.gullet.popToken(), e.text === " " && (e = n.gullet.popToken())), e; +}, Xd = (n, e, t, r) => { + var a = n.gullet.macros.get(t.text); + a == null && (t.noexpand = !0, a = { + tokens: [t], + numArgs: 0, + // reproduce the same behavior in expansion + unexpandable: !n.gullet.isExpandable(t.text) + }), n.gullet.macros.set(e, a, r); +}; +Y({ + type: "internal", + names: [ + "\\global", + "\\long", + "\\\\globallong" + // can’t be entered directly + ], + props: { + numArgs: 0, + allowedInText: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n; + e.consumeSpaces(); + var r = e.fetch(); + if ($o[r.text]) + return (t === "\\global" || t === "\\\\globallong") && (r.text = $o[r.text]), pe(e.parseFunction(), "internal"); + throw new G("Invalid token after macro prefix", r); + } +}); +Y({ + type: "internal", + names: ["\\def", "\\gdef", "\\edef", "\\xdef"], + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = e.gullet.popToken(), a = r.text; + if (/^(?:[\\{}$&#^_]|EOF)$/.test(a)) + throw new G("Expected a control sequence", r); + for (var i = 0, l, s = [[]]; e.gullet.future().text !== "{"; ) + if (r = e.gullet.popToken(), r.text === "#") { + if (e.gullet.future().text === "{") { + l = e.gullet.future(), s[i].push("{"); + break; + } + if (r = e.gullet.popToken(), !/^[1-9]$/.test(r.text)) + throw new G('Invalid argument number "' + r.text + '"'); + if (parseInt(r.text) !== i + 1) + throw new G('Argument number "' + r.text + '" out of order'); + i++, s.push([]); + } else { + if (r.text === "EOF") + throw new G("Expected a macro definition"); + s[i].push(r.text); + } + var { + tokens: o + } = e.gullet.consumeArg(); + return l && o.unshift(l), (t === "\\edef" || t === "\\xdef") && (o = e.gullet.expandTokens(o), o.reverse()), e.gullet.macros.set(a, { + tokens: o, + numArgs: i, + delimiters: s + }, t === $o[t]), { + type: "internal", + mode: e.mode + }; + } +}); +Y({ + type: "internal", + names: [ + "\\let", + "\\\\globallet" + // can’t be entered directly + ], + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = Wd(e.gullet.popToken()); + e.gullet.consumeSpaces(); + var a = G3(e); + return Xd(e, r, a, t === "\\\\globallet"), { + type: "internal", + mode: e.mode + }; + } +}); +Y({ + type: "internal", + names: [ + "\\futurelet", + "\\\\globalfuture" + // can’t be entered directly + ], + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = Wd(e.gullet.popToken()), a = e.gullet.popToken(), i = e.gullet.popToken(); + return Xd(e, r, i, t === "\\\\globalfuture"), e.gullet.pushToken(i), e.gullet.pushToken(a), { + type: "internal", + mode: e.mode + }; + } +}); +var La = function(e, t, r) { + var a = Ne.math[e] && Ne.math[e].replace, i = Cu(a || e, t, r); + if (!i) + throw new Error("Unsupported symbol " + e + " and font size " + t + "."); + return i; +}, Nu = function(e, t, r, a) { + var i = r.havingBaseStyle(t), l = R.makeSpan(a.concat(i.sizingClasses(r)), [e], r), s = i.sizeMultiplier / r.sizeMultiplier; + return l.height *= s, l.depth *= s, l.maxFontSize = i.sizeMultiplier, l; +}, Yd = function(e, t, r) { + var a = t.havingBaseStyle(r), i = (1 - t.sizeMultiplier / a.sizeMultiplier) * t.fontMetrics().axisHeight; + e.classes.push("delimcenter"), e.style.top = X(i), e.height -= i, e.depth += i; +}, j3 = function(e, t, r, a, i, l) { + var s = R.makeSymbol(e, "Main-Regular", i, a), o = Nu(s, t, a, l); + return r && Yd(o, a, t), o; +}, W3 = function(e, t, r, a) { + return R.makeSymbol(e, "Size" + t + "-Regular", r, a); +}, Zd = function(e, t, r, a, i, l) { + var s = W3(e, t, i, a), o = Nu(R.makeSpan(["delimsizing", "size" + t], [s], a), ae.TEXT, a, l); + return r && Yd(o, a, ae.TEXT), o; +}, $s = function(e, t, r) { + var a; + t === "Size1-Regular" ? a = "delim-size1" : a = "delim-size4"; + var i = R.makeSpan(["delimsizinginner", a], [R.makeSpan([], [R.makeSymbol(e, t, r)])]); + return { + type: "elem", + elem: i + }; +}, eo = function(e, t, r) { + var a = rr["Size4-Regular"][e.charCodeAt(0)] ? rr["Size4-Regular"][e.charCodeAt(0)][4] : rr["Size1-Regular"][e.charCodeAt(0)][4], i = new un("inner", Q5(e, Math.round(1e3 * t))), l = new Br([i], { + width: X(a), + height: X(t), + // Override CSS rule `.katex svg { width: 100% }` + style: "width:" + X(a), + viewBox: "0 0 " + 1e3 * a + " " + Math.round(1e3 * t), + preserveAspectRatio: "xMinYMin" + }), s = R.makeSvgSpan([], [l], r); + return s.height = t, s.style.height = X(t), s.style.width = X(a), { + type: "elem", + elem: s + }; +}, eu = 8e-3, Vi = { + type: "kern", + size: -1 * eu +}, X3 = ["|", "\\lvert", "\\rvert", "\\vert"], Y3 = ["\\|", "\\lVert", "\\rVert", "\\Vert"], Kd = function(e, t, r, a, i, l) { + var s, o, u, c, d = "", h = 0; + s = u = c = e, o = null; + var p = "Size1-Regular"; + e === "\\uparrow" ? u = c = "⏐" : e === "\\Uparrow" ? u = c = "‖" : e === "\\downarrow" ? s = u = "⏐" : e === "\\Downarrow" ? s = u = "‖" : e === "\\updownarrow" ? (s = "\\uparrow", u = "⏐", c = "\\downarrow") : e === "\\Updownarrow" ? (s = "\\Uparrow", u = "‖", c = "\\Downarrow") : re.contains(X3, e) ? (u = "∣", d = "vert", h = 333) : re.contains(Y3, e) ? (u = "∥", d = "doublevert", h = 556) : e === "[" || e === "\\lbrack" ? (s = "⎡", u = "⎢", c = "⎣", p = "Size4-Regular", d = "lbrack", h = 667) : e === "]" || e === "\\rbrack" ? (s = "⎤", u = "⎥", c = "⎦", p = "Size4-Regular", d = "rbrack", h = 667) : e === "\\lfloor" || e === "⌊" ? (u = s = "⎢", c = "⎣", p = "Size4-Regular", d = "lfloor", h = 667) : e === "\\lceil" || e === "⌈" ? (s = "⎡", u = c = "⎢", p = "Size4-Regular", d = "lceil", h = 667) : e === "\\rfloor" || e === "⌋" ? (u = s = "⎥", c = "⎦", p = "Size4-Regular", d = "rfloor", h = 667) : e === "\\rceil" || e === "⌉" ? (s = "⎤", u = c = "⎥", p = "Size4-Regular", d = "rceil", h = 667) : e === "(" || e === "\\lparen" ? (s = "⎛", u = "⎜", c = "⎝", p = "Size4-Regular", d = "lparen", h = 875) : e === ")" || e === "\\rparen" ? (s = "⎞", u = "⎟", c = "⎠", p = "Size4-Regular", d = "rparen", h = 875) : e === "\\{" || e === "\\lbrace" ? (s = "⎧", o = "⎨", c = "⎩", u = "⎪", p = "Size4-Regular") : e === "\\}" || e === "\\rbrace" ? (s = "⎫", o = "⎬", c = "⎭", u = "⎪", p = "Size4-Regular") : e === "\\lgroup" || e === "⟮" ? (s = "⎧", c = "⎩", u = "⎪", p = "Size4-Regular") : e === "\\rgroup" || e === "⟯" ? (s = "⎫", c = "⎭", u = "⎪", p = "Size4-Regular") : e === "\\lmoustache" || e === "⎰" ? (s = "⎧", c = "⎭", u = "⎪", p = "Size4-Regular") : (e === "\\rmoustache" || e === "⎱") && (s = "⎫", c = "⎩", u = "⎪", p = "Size4-Regular"); + var _ = La(s, p, i), b = _.height + _.depth, D = La(u, p, i), y = D.height + D.depth, k = La(c, p, i), w = k.height + k.depth, E = 0, S = 1; + if (o !== null) { + var T = La(o, p, i); + E = T.height + T.depth, S = 2; + } + var C = b + w + E, F = Math.max(0, Math.ceil((t - C) / (S * y))), B = C + F * S * y, I = a.fontMetrics().axisHeight; + r && (I *= a.sizeMultiplier); + var L = B / 2 - I, P = []; + if (d.length > 0) { + var Z = B - b - w, O = Math.round(B * 1e3), se = $5(d, Math.round(Z * 1e3)), K = new un(d, se), he = (h / 1e3).toFixed(3) + "em", ue = (O / 1e3).toFixed(3) + "em", Ae = new Br([K], { + width: he, + height: ue, + viewBox: "0 0 " + h + " " + O + }), ye = R.makeSvgSpan([], [Ae], a); + ye.height = O / 1e3, ye.style.width = he, ye.style.height = ue, P.push({ + type: "elem", + elem: ye + }); + } else { + if (P.push($s(c, p, i)), P.push(Vi), o === null) { + var $ = B - b - w + 2 * eu; + P.push(eo(u, $, a)); + } else { + var de = (B - b - w - E) / 2 + 2 * eu; + P.push(eo(u, de, a)), P.push(Vi), P.push($s(o, p, i)), P.push(Vi), P.push(eo(u, de, a)); + } + P.push(Vi), P.push($s(s, p, i)); + } + var ce = a.havingBaseStyle(ae.TEXT), Ce = R.makeVList({ + positionType: "bottom", + positionData: L, + children: P + }, ce); + return Nu(R.makeSpan(["delimsizing", "mult"], [Ce], ce), ae.TEXT, a, l); +}, to = 80, ro = 0.08, no = function(e, t, r, a, i) { + var l = J5(e, a, r), s = new un(e, l), o = new Br([s], { + // Note: 1000:1 ratio of viewBox to document em width. + width: "400em", + height: X(t), + viewBox: "0 0 400000 " + r, + preserveAspectRatio: "xMinYMin slice" + }); + return R.makeSvgSpan(["hide-tail"], [o], i); +}, Z3 = function(e, t) { + var r = t.havingBaseSizing(), a = e4("\\surd", e * r.sizeMultiplier, $d, r), i = r.sizeMultiplier, l = Math.max(0, t.minRuleThickness - t.fontMetrics().sqrtRuleThickness), s, o = 0, u = 0, c = 0, d; + return a.type === "small" ? (c = 1e3 + 1e3 * l + to, e < 1 ? i = 1 : e < 1.4 && (i = 0.7), o = (1 + l + ro) / i, u = (1 + l) / i, s = no("sqrtMain", o, c, l, t), s.style.minWidth = "0.853em", d = 0.833 / i) : a.type === "large" ? (c = (1e3 + to) * qa[a.size], u = (qa[a.size] + l) / i, o = (qa[a.size] + l + ro) / i, s = no("sqrtSize" + a.size, o, c, l, t), s.style.minWidth = "1.02em", d = 1 / i) : (o = e + l + ro, u = e + l, c = Math.floor(1e3 * e + l) + to, s = no("sqrtTall", o, c, l, t), s.style.minWidth = "0.742em", d = 1.056), s.height = u, s.style.height = X(o), { + span: s, + advanceWidth: d, + // Calculate the actual line width. + // This actually should depend on the chosen font -- e.g. \boldmath + // should use the thicker surd symbols from e.g. KaTeX_Main-Bold, and + // have thicker rules. + ruleWidth: (t.fontMetrics().sqrtRuleThickness + l) * i + }; +}, Jd = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "\\surd"], K3 = ["\\uparrow", "\\downarrow", "\\updownarrow", "\\Uparrow", "\\Downarrow", "\\Updownarrow", "|", "\\|", "\\vert", "\\Vert", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱"], Qd = ["<", ">", "\\langle", "\\rangle", "/", "\\backslash", "\\lt", "\\gt"], qa = [0, 1.2, 1.8, 2.4, 3], J3 = function(e, t, r, a, i) { + if (e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle"), re.contains(Jd, e) || re.contains(Qd, e)) + return Zd(e, t, !1, r, a, i); + if (re.contains(K3, e)) + return Kd(e, qa[t], !1, r, a, i); + throw new G("Illegal delimiter: '" + e + "'"); +}, Q3 = [{ + type: "small", + style: ae.SCRIPTSCRIPT +}, { + type: "small", + style: ae.SCRIPT +}, { + type: "small", + style: ae.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}], $3 = [{ + type: "small", + style: ae.SCRIPTSCRIPT +}, { + type: "small", + style: ae.SCRIPT +}, { + type: "small", + style: ae.TEXT +}, { + type: "stack" +}], $d = [{ + type: "small", + style: ae.SCRIPTSCRIPT +}, { + type: "small", + style: ae.SCRIPT +}, { + type: "small", + style: ae.TEXT +}, { + type: "large", + size: 1 +}, { + type: "large", + size: 2 +}, { + type: "large", + size: 3 +}, { + type: "large", + size: 4 +}, { + type: "stack" +}], e6 = function(e) { + if (e.type === "small") + return "Main-Regular"; + if (e.type === "large") + return "Size" + e.size + "-Regular"; + if (e.type === "stack") + return "Size4-Regular"; + throw new Error("Add support for delim type '" + e.type + "' here."); +}, e4 = function(e, t, r, a) { + for (var i = Math.min(2, 3 - a.style.size), l = i; l < r.length && r[l].type !== "stack"; l++) { + var s = La(e, e6(r[l]), "math"), o = s.height + s.depth; + if (r[l].type === "small") { + var u = a.havingBaseStyle(r[l].style); + o *= u.sizeMultiplier; + } + if (o > t) + return r[l]; + } + return r[r.length - 1]; +}, t4 = function(e, t, r, a, i, l) { + e === "<" || e === "\\lt" || e === "⟨" ? e = "\\langle" : (e === ">" || e === "\\gt" || e === "⟩") && (e = "\\rangle"); + var s; + re.contains(Qd, e) ? s = Q3 : re.contains(Jd, e) ? s = $d : s = $3; + var o = e4(e, t, s, a); + return o.type === "small" ? j3(e, o.style, r, a, i, l) : o.type === "large" ? Zd(e, o.size, r, a, i, l) : Kd(e, t, r, a, i, l); +}, t6 = function(e, t, r, a, i, l) { + var s = a.fontMetrics().axisHeight * a.sizeMultiplier, o = 901, u = 5 / a.fontMetrics().ptPerEm, c = Math.max(t - s, r + s), d = Math.max( + // In real TeX, calculations are done using integral values which are + // 65536 per pt, or 655360 per em. So, the division here truncates in + // TeX but doesn't here, producing different results. If we wanted to + // exactly match TeX's calculation, we could do + // Math.floor(655360 * maxDistFromAxis / 500) * + // delimiterFactor / 655360 + // (To see the difference, compare + // x^{x^{\left(\rule{0.1em}{0.68em}\right)}} + // in TeX and KaTeX) + c / 500 * o, + 2 * c - u + ); + return t4(e, d, !0, a, i, l); +}, Cr = { + sqrtImage: Z3, + sizedDelim: J3, + sizeToMaxHeight: qa, + customSizedDelim: t4, + leftRightDelim: t6 +}, sc = { + "\\bigl": { + mclass: "mopen", + size: 1 + }, + "\\Bigl": { + mclass: "mopen", + size: 2 + }, + "\\biggl": { + mclass: "mopen", + size: 3 + }, + "\\Biggl": { + mclass: "mopen", + size: 4 + }, + "\\bigr": { + mclass: "mclose", + size: 1 + }, + "\\Bigr": { + mclass: "mclose", + size: 2 + }, + "\\biggr": { + mclass: "mclose", + size: 3 + }, + "\\Biggr": { + mclass: "mclose", + size: 4 + }, + "\\bigm": { + mclass: "mrel", + size: 1 + }, + "\\Bigm": { + mclass: "mrel", + size: 2 + }, + "\\biggm": { + mclass: "mrel", + size: 3 + }, + "\\Biggm": { + mclass: "mrel", + size: 4 + }, + "\\big": { + mclass: "mord", + size: 1 + }, + "\\Big": { + mclass: "mord", + size: 2 + }, + "\\bigg": { + mclass: "mord", + size: 3 + }, + "\\Bigg": { + mclass: "mord", + size: 4 + } +}, r6 = ["(", "\\lparen", ")", "\\rparen", "[", "\\lbrack", "]", "\\rbrack", "\\{", "\\lbrace", "\\}", "\\rbrace", "\\lfloor", "\\rfloor", "⌊", "⌋", "\\lceil", "\\rceil", "⌈", "⌉", "<", ">", "\\langle", "⟨", "\\rangle", "⟩", "\\lt", "\\gt", "\\lvert", "\\rvert", "\\lVert", "\\rVert", "\\lgroup", "\\rgroup", "⟮", "⟯", "\\lmoustache", "\\rmoustache", "⎰", "⎱", "/", "\\backslash", "|", "\\vert", "\\|", "\\Vert", "\\uparrow", "\\Uparrow", "\\downarrow", "\\Downarrow", "\\updownarrow", "\\Updownarrow", "."]; +function $l(n, e) { + var t = Jl(n); + if (t && re.contains(r6, t.text)) + return t; + throw t ? new G("Invalid delimiter '" + t.text + "' after '" + e.funcName + "'", n) : new G("Invalid delimiter type '" + n.type + "'", n); +} +Y({ + type: "delimsizing", + names: ["\\bigl", "\\Bigl", "\\biggl", "\\Biggl", "\\bigr", "\\Bigr", "\\biggr", "\\Biggr", "\\bigm", "\\Bigm", "\\biggm", "\\Biggm", "\\big", "\\Big", "\\bigg", "\\Bigg"], + props: { + numArgs: 1, + argTypes: ["primitive"] + }, + handler: (n, e) => { + var t = $l(e[0], n); + return { + type: "delimsizing", + mode: n.parser.mode, + size: sc[n.funcName].size, + mclass: sc[n.funcName].mclass, + delim: t.text + }; + }, + htmlBuilder: (n, e) => n.delim === "." ? R.makeSpan([n.mclass]) : Cr.sizedDelim(n.delim, n.size, e, n.mode, [n.mclass]), + mathmlBuilder: (n) => { + var e = []; + n.delim !== "." && e.push(T0(n.delim, n.mode)); + var t = new U.MathNode("mo", e); + n.mclass === "mopen" || n.mclass === "mclose" ? t.setAttribute("fence", "true") : t.setAttribute("fence", "false"), t.setAttribute("stretchy", "true"); + var r = X(Cr.sizeToMaxHeight[n.size]); + return t.setAttribute("minsize", r), t.setAttribute("maxsize", r), t; + } +}); +function oc(n) { + if (!n.body) + throw new Error("Bug: The leftright ParseNode wasn't fully parsed."); +} +Y({ + type: "leftright-right", + names: ["\\right"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var t = n.parser.gullet.macros.get("\\current@color"); + if (t && typeof t != "string") + throw new G("\\current@color set to non-string in \\right"); + return { + type: "leftright-right", + mode: n.parser.mode, + delim: $l(e[0], n).text, + color: t + // undefined if not set via \color + }; + } +}); +Y({ + type: "leftright", + names: ["\\left"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var t = $l(e[0], n), r = n.parser; + ++r.leftrightDepth; + var a = r.parseExpression(!1); + --r.leftrightDepth, r.expect("\\right", !1); + var i = pe(r.parseFunction(), "leftright-right"); + return { + type: "leftright", + mode: r.mode, + body: a, + left: t.text, + right: i.delim, + rightColor: i.color + }; + }, + htmlBuilder: (n, e) => { + oc(n); + for (var t = gt(n.body, e, !0, ["mopen", "mclose"]), r = 0, a = 0, i = !1, l = 0; l < t.length; l++) + t[l].isMiddle ? i = !0 : (r = Math.max(t[l].height, r), a = Math.max(t[l].depth, a)); + r *= e.sizeMultiplier, a *= e.sizeMultiplier; + var s; + if (n.left === "." ? s = Ya(e, ["mopen"]) : s = Cr.leftRightDelim(n.left, r, a, e, n.mode, ["mopen"]), t.unshift(s), i) + for (var o = 1; o < t.length; o++) { + var u = t[o], c = u.isMiddle; + c && (t[o] = Cr.leftRightDelim(c.delim, r, a, c.options, n.mode, [])); + } + var d; + if (n.right === ".") + d = Ya(e, ["mclose"]); + else { + var h = n.rightColor ? e.withColor(n.rightColor) : e; + d = Cr.leftRightDelim(n.right, r, a, h, n.mode, ["mclose"]); + } + return t.push(d), R.makeSpan(["minner"], t, e); + }, + mathmlBuilder: (n, e) => { + oc(n); + var t = a0(n.body, e); + if (n.left !== ".") { + var r = new U.MathNode("mo", [T0(n.left, n.mode)]); + r.setAttribute("fence", "true"), t.unshift(r); + } + if (n.right !== ".") { + var a = new U.MathNode("mo", [T0(n.right, n.mode)]); + a.setAttribute("fence", "true"), n.rightColor && a.setAttribute("mathcolor", n.rightColor), t.push(a); + } + return zu(t); + } +}); +Y({ + type: "middle", + names: ["\\middle"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var t = $l(e[0], n); + if (!n.parser.leftrightDepth) + throw new G("\\middle without preceding \\left", t); + return { + type: "middle", + mode: n.parser.mode, + delim: t.text + }; + }, + htmlBuilder: (n, e) => { + var t; + if (n.delim === ".") + t = Ya(e, []); + else { + t = Cr.sizedDelim(n.delim, 1, e, n.mode, []); + var r = { + delim: n.delim, + options: e + }; + t.isMiddle = r; + } + return t; + }, + mathmlBuilder: (n, e) => { + var t = n.delim === "\\vert" || n.delim === "|" ? T0("|", "text") : T0(n.delim, n.mode), r = new U.MathNode("mo", [t]); + return r.setAttribute("fence", "true"), r.setAttribute("lspace", "0.05em"), r.setAttribute("rspace", "0.05em"), r; + } +}); +var Ru = (n, e) => { + var t = R.wrapFragment(Se(n.body, e), e), r = n.label.slice(1), a = e.sizeMultiplier, i, l = 0, s = re.isCharacterBox(n.body); + if (r === "sout") + i = R.makeSpan(["stretchy", "sout"]), i.height = e.fontMetrics().defaultRuleThickness / a, l = -0.5 * e.fontMetrics().xHeight; + else if (r === "phase") { + var o = Ye({ + number: 0.6, + unit: "pt" + }, e), u = Ye({ + number: 0.35, + unit: "ex" + }, e), c = e.havingBaseSizing(); + a = a / c.sizeMultiplier; + var d = t.height + t.depth + o + u; + t.style.paddingLeft = X(d / 2 + o); + var h = Math.floor(1e3 * d * a), p = Z5(h), _ = new Br([new un("phase", p)], { + width: "400em", + height: X(h / 1e3), + viewBox: "0 0 400000 " + h, + preserveAspectRatio: "xMinYMin slice" + }); + i = R.makeSvgSpan(["hide-tail"], [_], e), i.style.height = X(d), l = t.depth + o + u; + } else { + /cancel/.test(r) ? s || t.classes.push("cancel-pad") : r === "angl" ? t.classes.push("anglpad") : t.classes.push("boxpad"); + var b = 0, D = 0, y = 0; + /box/.test(r) ? (y = Math.max( + e.fontMetrics().fboxrule, + // default + e.minRuleThickness + // User override. + ), b = e.fontMetrics().fboxsep + (r === "colorbox" ? 0 : y), D = b) : r === "angl" ? (y = Math.max(e.fontMetrics().defaultRuleThickness, e.minRuleThickness), b = 4 * y, D = Math.max(0, 0.25 - t.depth)) : (b = s ? 0.2 : 0, D = b), i = Lr.encloseSpan(t, r, b, D, e), /fbox|boxed|fcolorbox/.test(r) ? (i.style.borderStyle = "solid", i.style.borderWidth = X(y)) : r === "angl" && y !== 0.049 && (i.style.borderTopWidth = X(y), i.style.borderRightWidth = X(y)), l = t.depth + D, n.backgroundColor && (i.style.backgroundColor = n.backgroundColor, n.borderColor && (i.style.borderColor = n.borderColor)); + } + var k; + if (n.backgroundColor) + k = R.makeVList({ + positionType: "individualShift", + children: [ + // Put the color background behind inner; + { + type: "elem", + elem: i, + shift: l + }, + { + type: "elem", + elem: t, + shift: 0 + } + ] + }, e); + else { + var w = /cancel|phase/.test(r) ? ["svg-align"] : []; + k = R.makeVList({ + positionType: "individualShift", + children: [ + // Write the \cancel stroke on top of inner. + { + type: "elem", + elem: t, + shift: 0 + }, + { + type: "elem", + elem: i, + shift: l, + wrapperClasses: w + } + ] + }, e); + } + return /cancel/.test(r) && (k.height = t.height, k.depth = t.depth), /cancel/.test(r) && !s ? R.makeSpan(["mord", "cancel-lap"], [k], e) : R.makeSpan(["mord"], [k], e); +}, Ou = (n, e) => { + var t = 0, r = new U.MathNode(n.label.indexOf("colorbox") > -1 ? "mpadded" : "menclose", [Ie(n.body, e)]); + switch (n.label) { + case "\\cancel": + r.setAttribute("notation", "updiagonalstrike"); + break; + case "\\bcancel": + r.setAttribute("notation", "downdiagonalstrike"); + break; + case "\\phase": + r.setAttribute("notation", "phasorangle"); + break; + case "\\sout": + r.setAttribute("notation", "horizontalstrike"); + break; + case "\\fbox": + r.setAttribute("notation", "box"); + break; + case "\\angl": + r.setAttribute("notation", "actuarial"); + break; + case "\\fcolorbox": + case "\\colorbox": + if (t = e.fontMetrics().fboxsep * e.fontMetrics().ptPerEm, r.setAttribute("width", "+" + 2 * t + "pt"), r.setAttribute("height", "+" + 2 * t + "pt"), r.setAttribute("lspace", t + "pt"), r.setAttribute("voffset", t + "pt"), n.label === "\\fcolorbox") { + var a = Math.max( + e.fontMetrics().fboxrule, + // default + e.minRuleThickness + // user override + ); + r.setAttribute("style", "border: " + a + "em solid " + String(n.borderColor)); + } + break; + case "\\xcancel": + r.setAttribute("notation", "updiagonalstrike downdiagonalstrike"); + break; + } + return n.backgroundColor && r.setAttribute("mathbackground", n.backgroundColor), r; +}; +Y({ + type: "enclose", + names: ["\\colorbox"], + props: { + numArgs: 2, + allowedInText: !0, + argTypes: ["color", "text"] + }, + handler(n, e, t) { + var { + parser: r, + funcName: a + } = n, i = pe(e[0], "color-token").color, l = e[1]; + return { + type: "enclose", + mode: r.mode, + label: a, + backgroundColor: i, + body: l + }; + }, + htmlBuilder: Ru, + mathmlBuilder: Ou +}); +Y({ + type: "enclose", + names: ["\\fcolorbox"], + props: { + numArgs: 3, + allowedInText: !0, + argTypes: ["color", "color", "text"] + }, + handler(n, e, t) { + var { + parser: r, + funcName: a + } = n, i = pe(e[0], "color-token").color, l = pe(e[1], "color-token").color, s = e[2]; + return { + type: "enclose", + mode: r.mode, + label: a, + backgroundColor: l, + borderColor: i, + body: s + }; + }, + htmlBuilder: Ru, + mathmlBuilder: Ou +}); +Y({ + type: "enclose", + names: ["\\fbox"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "enclose", + mode: t.mode, + label: "\\fbox", + body: e[0] + }; + } +}); +Y({ + type: "enclose", + names: ["\\cancel", "\\bcancel", "\\xcancel", "\\sout", "\\phase"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "enclose", + mode: t.mode, + label: r, + body: a + }; + }, + htmlBuilder: Ru, + mathmlBuilder: Ou +}); +Y({ + type: "enclose", + names: ["\\angl"], + props: { + numArgs: 1, + argTypes: ["hbox"], + allowedInText: !1 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "enclose", + mode: t.mode, + label: "\\angl", + body: e[0] + }; + } +}); +var r4 = {}; +function dr(n) { + for (var { + type: e, + names: t, + props: r, + handler: a, + htmlBuilder: i, + mathmlBuilder: l + } = n, s = { + type: e, + numArgs: r.numArgs || 0, + allowedInText: !1, + numOptionalArgs: 0, + handler: a + }, o = 0; o < t.length; ++o) + r4[t[o]] = s; + i && (Cl[e] = i), l && (Fl[e] = l); +} +var n4 = {}; +function v(n, e) { + n4[n] = e; +} +function uc(n) { + var e = []; + n.consumeSpaces(); + var t = n.fetch().text; + for (t === "\\relax" && (n.consume(), n.consumeSpaces(), t = n.fetch().text); t === "\\hline" || t === "\\hdashline"; ) + n.consume(), e.push(t === "\\hdashline"), n.consumeSpaces(), t = n.fetch().text; + return e; +} +var es = (n) => { + var e = n.parser.settings; + if (!e.displayMode) + throw new G("{" + n.envName + "} can be used only in display mode."); +}; +function qu(n) { + if (n.indexOf("ed") === -1) + return n.indexOf("*") === -1; +} +function dn(n, e, t) { + var { + hskipBeforeAndAfter: r, + addJot: a, + cols: i, + arraystretch: l, + colSeparationType: s, + autoTag: o, + singleRow: u, + emptySingleRow: c, + maxNumCols: d, + leqno: h + } = e; + if (n.gullet.beginGroup(), u || n.gullet.macros.set("\\cr", "\\\\\\relax"), !l) { + var p = n.gullet.expandMacroAsText("\\arraystretch"); + if (p == null) + l = 1; + else if (l = parseFloat(p), !l || l < 0) + throw new G("Invalid \\arraystretch: " + p); + } + n.gullet.beginGroup(); + var _ = [], b = [_], D = [], y = [], k = o != null ? [] : void 0; + function w() { + o && n.gullet.macros.set("\\@eqnsw", "1", !0); + } + function E() { + k && (n.gullet.macros.get("\\df@tag") ? (k.push(n.subparse([new S0("\\df@tag")])), n.gullet.macros.set("\\df@tag", void 0, !0)) : k.push(!!o && n.gullet.macros.get("\\@eqnsw") === "1")); + } + for (w(), y.push(uc(n)); ; ) { + var S = n.parseExpression(!1, u ? "\\end" : "\\\\"); + n.gullet.endGroup(), n.gullet.beginGroup(), S = { + type: "ordgroup", + mode: n.mode, + body: S + }, t && (S = { + type: "styling", + mode: n.mode, + style: t, + body: [S] + }), _.push(S); + var T = n.fetch().text; + if (T === "&") { + if (d && _.length === d) { + if (u || s) + throw new G("Too many tab characters: &", n.nextToken); + n.settings.reportNonstrict("textEnv", "Too few columns specified in the {array} column argument."); + } + n.consume(); + } else if (T === "\\end") { + E(), _.length === 1 && S.type === "styling" && S.body[0].body.length === 0 && (b.length > 1 || !c) && b.pop(), y.length < b.length + 1 && y.push([]); + break; + } else if (T === "\\\\") { + n.consume(); + var C = void 0; + n.gullet.future().text !== " " && (C = n.parseSizeGroup(!0)), D.push(C ? C.value : null), E(), y.push(uc(n)), _ = [], b.push(_), w(); + } else + throw new G("Expected & or \\\\ or \\cr or \\end", n.nextToken); + } + return n.gullet.endGroup(), n.gullet.endGroup(), { + type: "array", + mode: n.mode, + addJot: a, + arraystretch: l, + body: b, + cols: i, + rowGaps: D, + hskipBeforeAndAfter: r, + hLinesBeforeRow: y, + colSeparationType: s, + tags: k, + leqno: h + }; +} +function Pu(n) { + return n.slice(0, 1) === "d" ? "display" : "text"; +} +var mr = function(e, t) { + var r, a, i = e.body.length, l = e.hLinesBeforeRow, s = 0, o = new Array(i), u = [], c = Math.max( + // From LaTeX \showthe\arrayrulewidth. Equals 0.04 em. + t.fontMetrics().arrayRuleWidth, + t.minRuleThickness + // User override. + ), d = 1 / t.fontMetrics().ptPerEm, h = 5 * d; + if (e.colSeparationType && e.colSeparationType === "small") { + var p = t.havingStyle(ae.SCRIPT).sizeMultiplier; + h = 0.2778 * (p / t.sizeMultiplier); + } + var _ = e.colSeparationType === "CD" ? Ye({ + number: 3, + unit: "ex" + }, t) : 12 * d, b = 3 * d, D = e.arraystretch * _, y = 0.7 * D, k = 0.3 * D, w = 0; + function E(Ot) { + for (var qt = 0; qt < Ot.length; ++qt) + qt > 0 && (w += 0.25), u.push({ + pos: w, + isDashed: Ot[qt] + }); + } + for (E(l[0]), r = 0; r < e.body.length; ++r) { + var S = e.body[r], T = y, C = k; + s < S.length && (s = S.length); + var F = new Array(S.length); + for (a = 0; a < S.length; ++a) { + var B = Se(S[a], t); + C < B.depth && (C = B.depth), T < B.height && (T = B.height), F[a] = B; + } + var I = e.rowGaps[r], L = 0; + I && (L = Ye(I, t), L > 0 && (L += k, C < L && (C = L), L = 0)), e.addJot && (C += b), F.height = T, F.depth = C, w += T, F.pos = w, w += C + L, o[r] = F, E(l[r + 1]); + } + var P = w / 2 + t.fontMetrics().axisHeight, Z = e.cols || [], O = [], se, K, he = []; + if (e.tags && e.tags.some((Ot) => Ot)) + for (r = 0; r < i; ++r) { + var ue = o[r], Ae = ue.pos - P, ye = e.tags[r], $ = void 0; + ye === !0 ? $ = R.makeSpan(["eqn-num"], [], t) : ye === !1 ? $ = R.makeSpan([], [], t) : $ = R.makeSpan([], gt(ye, t, !0), t), $.depth = ue.depth, $.height = ue.height, he.push({ + type: "elem", + elem: $, + shift: Ae + }); + } + for ( + a = 0, K = 0; + // Continue while either there are more columns or more column + // descriptions, so trailing separators don't get lost. + a < s || K < Z.length; + ++a, ++K + ) { + for (var de = Z[K] || {}, ce = !0; de.type === "separator"; ) { + if (ce || (se = R.makeSpan(["arraycolsep"], []), se.style.width = X(t.fontMetrics().doubleRuleSep), O.push(se)), de.separator === "|" || de.separator === ":") { + var Ce = de.separator === "|" ? "solid" : "dashed", V = R.makeSpan(["vertical-separator"], [], t); + V.style.height = X(w), V.style.borderRightWidth = X(c), V.style.borderRightStyle = Ce, V.style.margin = "0 " + X(-c / 2); + var j = w - P; + j && (V.style.verticalAlign = X(-j)), O.push(V); + } else + throw new G("Invalid separator type: " + de.separator); + K++, de = Z[K] || {}, ce = !1; + } + if (!(a >= s)) { + var ge = void 0; + (a > 0 || e.hskipBeforeAndAfter) && (ge = re.deflt(de.pregap, h), ge !== 0 && (se = R.makeSpan(["arraycolsep"], []), se.style.width = X(ge), O.push(se))); + var ke = []; + for (r = 0; r < i; ++r) { + var Te = o[r], ze = Te[a]; + if (ze) { + var Le = Te.pos - P; + ze.depth = Te.depth, ze.height = Te.height, ke.push({ + type: "elem", + elem: ze, + shift: Le + }); + } + } + ke = R.makeVList({ + positionType: "individualShift", + children: ke + }, t), ke = R.makeSpan(["col-align-" + (de.align || "c")], [ke]), O.push(ke), (a < s - 1 || e.hskipBeforeAndAfter) && (ge = re.deflt(de.postgap, h), ge !== 0 && (se = R.makeSpan(["arraycolsep"], []), se.style.width = X(ge), O.push(se))); + } + } + if (o = R.makeSpan(["mtable"], O), u.length > 0) { + for (var je = R.makeLineSpan("hline", t, c), ft = R.makeLineSpan("hdashline", t, c), We = [{ + type: "elem", + elem: o, + shift: 0 + }]; u.length > 0; ) { + var qe = u.pop(), Pe = qe.pos - P; + qe.isDashed ? We.push({ + type: "elem", + elem: ft, + shift: Pe + }) : We.push({ + type: "elem", + elem: je, + shift: Pe + }); + } + o = R.makeVList({ + positionType: "individualShift", + children: We + }, t); + } + if (he.length === 0) + return R.makeSpan(["mord"], [o], t); + var lt = R.makeVList({ + positionType: "individualShift", + children: he + }, t); + return lt = R.makeSpan(["tag"], [lt], t), R.makeFragment([o, lt]); +}, n6 = { + c: "center ", + l: "left ", + r: "right " +}, pr = function(e, t) { + for (var r = [], a = new U.MathNode("mtd", [], ["mtr-glue"]), i = new U.MathNode("mtd", [], ["mml-eqn-num"]), l = 0; l < e.body.length; l++) { + for (var s = e.body[l], o = [], u = 0; u < s.length; u++) + o.push(new U.MathNode("mtd", [Ie(s[u], t)])); + e.tags && e.tags[l] && (o.unshift(a), o.push(a), e.leqno ? o.unshift(i) : o.push(i)), r.push(new U.MathNode("mtr", o)); + } + var c = new U.MathNode("mtable", r), d = e.arraystretch === 0.5 ? 0.1 : 0.16 + e.arraystretch - 1 + (e.addJot ? 0.09 : 0); + c.setAttribute("rowspacing", X(d)); + var h = "", p = ""; + if (e.cols && e.cols.length > 0) { + var _ = e.cols, b = "", D = !1, y = 0, k = _.length; + _[0].type === "separator" && (h += "top ", y = 1), _[_.length - 1].type === "separator" && (h += "bottom ", k -= 1); + for (var w = y; w < k; w++) + _[w].type === "align" ? (p += n6[_[w].align], D && (b += "none "), D = !0) : _[w].type === "separator" && D && (b += _[w].separator === "|" ? "solid " : "dashed ", D = !1); + c.setAttribute("columnalign", p.trim()), /[sd]/.test(b) && c.setAttribute("columnlines", b.trim()); + } + if (e.colSeparationType === "align") { + for (var E = e.cols || [], S = "", T = 1; T < E.length; T++) + S += T % 2 ? "0em " : "1em "; + c.setAttribute("columnspacing", S.trim()); + } else e.colSeparationType === "alignat" || e.colSeparationType === "gather" ? c.setAttribute("columnspacing", "0em") : e.colSeparationType === "small" ? c.setAttribute("columnspacing", "0.2778em") : e.colSeparationType === "CD" ? c.setAttribute("columnspacing", "0.5em") : c.setAttribute("columnspacing", "1em"); + var C = "", F = e.hLinesBeforeRow; + h += F[0].length > 0 ? "left " : "", h += F[F.length - 1].length > 0 ? "right " : ""; + for (var B = 1; B < F.length - 1; B++) + C += F[B].length === 0 ? "none " : F[B][0] ? "dashed " : "solid "; + return /[sd]/.test(C) && c.setAttribute("rowlines", C.trim()), h !== "" && (c = new U.MathNode("menclose", [c]), c.setAttribute("notation", h.trim())), e.arraystretch && e.arraystretch < 1 && (c = new U.MathNode("mstyle", [c]), c.setAttribute("scriptlevel", "1")), c; +}, a4 = function(e, t) { + e.envName.indexOf("ed") === -1 && es(e); + var r = [], a = e.envName.indexOf("at") > -1 ? "alignat" : "align", i = e.envName === "split", l = dn(e.parser, { + cols: r, + addJot: !0, + autoTag: i ? void 0 : qu(e.envName), + emptySingleRow: !0, + colSeparationType: a, + maxNumCols: i ? 2 : void 0, + leqno: e.parser.settings.leqno + }, "display"), s, o = 0, u = { + type: "ordgroup", + mode: e.mode, + body: [] + }; + if (t[0] && t[0].type === "ordgroup") { + for (var c = "", d = 0; d < t[0].body.length; d++) { + var h = pe(t[0].body[d], "textord"); + c += h.text; + } + s = Number(c), o = s * 2; + } + var p = !o; + l.body.forEach(function(y) { + for (var k = 1; k < y.length; k += 2) { + var w = pe(y[k], "styling"), E = pe(w.body[0], "ordgroup"); + E.body.unshift(u); + } + if (p) + o < y.length && (o = y.length); + else { + var S = y.length / 2; + if (s < S) + throw new G("Too many math in a row: " + ("expected " + s + ", but got " + S), y[0]); + } + }); + for (var _ = 0; _ < o; ++_) { + var b = "r", D = 0; + _ % 2 === 1 ? b = "l" : _ > 0 && p && (D = 1), r[_] = { + type: "align", + align: b, + pregap: D, + postgap: 0 + }; + } + return l.colSeparationType = p ? "align" : "alignat", l; +}; +dr({ + type: "array", + names: ["array", "darray"], + props: { + numArgs: 1 + }, + handler(n, e) { + var t = Jl(e[0]), r = t ? [e[0]] : pe(e[0], "ordgroup").body, a = r.map(function(l) { + var s = Iu(l), o = s.text; + if ("lcr".indexOf(o) !== -1) + return { + type: "align", + align: o + }; + if (o === "|") + return { + type: "separator", + separator: "|" + }; + if (o === ":") + return { + type: "separator", + separator: ":" + }; + throw new G("Unknown column alignment: " + o, l); + }), i = { + cols: a, + hskipBeforeAndAfter: !0, + // \@preamble in lttab.dtx + maxNumCols: a.length + }; + return dn(n.parser, i, Pu(n.envName)); + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["matrix", "pmatrix", "bmatrix", "Bmatrix", "vmatrix", "Vmatrix", "matrix*", "pmatrix*", "bmatrix*", "Bmatrix*", "vmatrix*", "Vmatrix*"], + props: { + numArgs: 0 + }, + handler(n) { + var e = { + matrix: null, + pmatrix: ["(", ")"], + bmatrix: ["[", "]"], + Bmatrix: ["\\{", "\\}"], + vmatrix: ["|", "|"], + Vmatrix: ["\\Vert", "\\Vert"] + }[n.envName.replace("*", "")], t = "c", r = { + hskipBeforeAndAfter: !1, + cols: [{ + type: "align", + align: t + }] + }; + if (n.envName.charAt(n.envName.length - 1) === "*") { + var a = n.parser; + if (a.consumeSpaces(), a.fetch().text === "[") { + if (a.consume(), a.consumeSpaces(), t = a.fetch().text, "lcr".indexOf(t) === -1) + throw new G("Expected l or c or r", a.nextToken); + a.consume(), a.consumeSpaces(), a.expect("]"), a.consume(), r.cols = [{ + type: "align", + align: t + }]; + } + } + var i = dn(n.parser, r, Pu(n.envName)), l = Math.max(0, ...i.body.map((s) => s.length)); + return i.cols = new Array(l).fill({ + type: "align", + align: t + }), e ? { + type: "leftright", + mode: n.mode, + body: [i], + left: e[0], + right: e[1], + rightColor: void 0 + // \right uninfluenced by \color in array + } : i; + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["smallmatrix"], + props: { + numArgs: 0 + }, + handler(n) { + var e = { + arraystretch: 0.5 + }, t = dn(n.parser, e, "script"); + return t.colSeparationType = "small", t; + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["subarray"], + props: { + numArgs: 1 + }, + handler(n, e) { + var t = Jl(e[0]), r = t ? [e[0]] : pe(e[0], "ordgroup").body, a = r.map(function(l) { + var s = Iu(l), o = s.text; + if ("lc".indexOf(o) !== -1) + return { + type: "align", + align: o + }; + throw new G("Unknown column alignment: " + o, l); + }); + if (a.length > 1) + throw new G("{subarray} can contain only one column"); + var i = { + cols: a, + hskipBeforeAndAfter: !1, + arraystretch: 0.5 + }; + if (i = dn(n.parser, i, "script"), i.body.length > 0 && i.body[0].length > 1) + throw new G("{subarray} can contain only one column"); + return i; + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["cases", "dcases", "rcases", "drcases"], + props: { + numArgs: 0 + }, + handler(n) { + var e = { + arraystretch: 1.2, + cols: [{ + type: "align", + align: "l", + pregap: 0, + // TODO(kevinb) get the current style. + // For now we use the metrics for TEXT style which is what we were + // doing before. Before attempting to get the current style we + // should look at TeX's behavior especially for \over and matrices. + postgap: 1 + /* 1em quad */ + }, { + type: "align", + align: "l", + pregap: 0, + postgap: 0 + }] + }, t = dn(n.parser, e, Pu(n.envName)); + return { + type: "leftright", + mode: n.mode, + body: [t], + left: n.envName.indexOf("r") > -1 ? "." : "\\{", + right: n.envName.indexOf("r") > -1 ? "\\}" : ".", + rightColor: void 0 + }; + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["align", "align*", "aligned", "split"], + props: { + numArgs: 0 + }, + handler: a4, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["gathered", "gather", "gather*"], + props: { + numArgs: 0 + }, + handler(n) { + re.contains(["gather", "gather*"], n.envName) && es(n); + var e = { + cols: [{ + type: "align", + align: "c" + }], + addJot: !0, + colSeparationType: "gather", + autoTag: qu(n.envName), + emptySingleRow: !0, + leqno: n.parser.settings.leqno + }; + return dn(n.parser, e, "display"); + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["alignat", "alignat*", "alignedat"], + props: { + numArgs: 1 + }, + handler: a4, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["equation", "equation*"], + props: { + numArgs: 0 + }, + handler(n) { + es(n); + var e = { + autoTag: qu(n.envName), + emptySingleRow: !0, + singleRow: !0, + maxNumCols: 1, + leqno: n.parser.settings.leqno + }; + return dn(n.parser, e, "display"); + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +dr({ + type: "array", + names: ["CD"], + props: { + numArgs: 0 + }, + handler(n) { + return es(n), V3(n.parser); + }, + htmlBuilder: mr, + mathmlBuilder: pr +}); +v("\\nonumber", "\\gdef\\@eqnsw{0}"); +v("\\notag", "\\nonumber"); +Y({ + type: "text", + // Doesn't matter what this is. + names: ["\\hline", "\\hdashline"], + props: { + numArgs: 0, + allowedInText: !0, + allowedInMath: !0 + }, + handler(n, e) { + throw new G(n.funcName + " valid only within array environment"); + } +}); +var cc = r4; +Y({ + type: "environment", + names: ["\\begin", "\\end"], + props: { + numArgs: 1, + argTypes: ["text"] + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + if (a.type !== "ordgroup") + throw new G("Invalid environment name", a); + for (var i = "", l = 0; l < a.body.length; ++l) + i += pe(a.body[l], "textord").text; + if (r === "\\begin") { + if (!cc.hasOwnProperty(i)) + throw new G("No such environment: " + i, a); + var s = cc[i], { + args: o, + optArgs: u + } = t.parseArguments("\\begin{" + i + "}", s), c = { + mode: t.mode, + envName: i, + parser: t + }, d = s.handler(c, o, u); + t.expect("\\end", !1); + var h = t.nextToken, p = pe(t.parseFunction(), "environment"); + if (p.name !== i) + throw new G("Mismatch: \\begin{" + i + "} matched by \\end{" + p.name + "}", h); + return d; + } + return { + type: "environment", + mode: t.mode, + name: i, + nameGroup: a + }; + } +}); +var i4 = (n, e) => { + var t = n.font, r = e.withFont(t); + return Se(n.body, r); +}, l4 = (n, e) => { + var t = n.font, r = e.withFont(t); + return Ie(n.body, r); +}, fc = { + "\\Bbb": "\\mathbb", + "\\bold": "\\mathbf", + "\\frak": "\\mathfrak", + "\\bm": "\\boldsymbol" +}; +Y({ + type: "font", + names: [ + // styles, except \boldsymbol defined below + "\\mathrm", + "\\mathit", + "\\mathbf", + "\\mathnormal", + // families + "\\mathbb", + "\\mathcal", + "\\mathfrak", + "\\mathscr", + "\\mathsf", + "\\mathtt", + // aliases, except \bm defined below + "\\Bbb", + "\\bold", + "\\frak" + ], + props: { + numArgs: 1, + allowedInArgument: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = Ml(e[0]), i = r; + return i in fc && (i = fc[i]), { + type: "font", + mode: t.mode, + font: i.slice(1), + body: a + }; + }, + htmlBuilder: i4, + mathmlBuilder: l4 +}); +Y({ + type: "mclass", + names: ["\\boldsymbol", "\\bm"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0], a = re.isCharacterBox(r); + return { + type: "mclass", + mode: t.mode, + mclass: Ql(r), + body: [{ + type: "font", + mode: t.mode, + font: "boldsymbol", + body: r + }], + isCharacterBox: a + }; + } +}); +Y({ + type: "font", + names: ["\\rm", "\\sf", "\\tt", "\\bf", "\\it", "\\cal"], + props: { + numArgs: 0, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r, + breakOnTokenText: a + } = n, { + mode: i + } = t, l = t.parseExpression(!0, a), s = "math" + r.slice(1); + return { + type: "font", + mode: i, + font: s, + body: { + type: "ordgroup", + mode: t.mode, + body: l + } + }; + }, + htmlBuilder: i4, + mathmlBuilder: l4 +}); +var s4 = (n, e) => { + var t = e; + return n === "display" ? t = t.id >= ae.SCRIPT.id ? t.text() : ae.DISPLAY : n === "text" && t.size === ae.DISPLAY.size ? t = ae.TEXT : n === "script" ? t = ae.SCRIPT : n === "scriptscript" && (t = ae.SCRIPTSCRIPT), t; +}, Hu = (n, e) => { + var t = s4(n.size, e.style), r = t.fracNum(), a = t.fracDen(), i; + i = e.havingStyle(r); + var l = Se(n.numer, i, e); + if (n.continued) { + var s = 8.5 / e.fontMetrics().ptPerEm, o = 3.5 / e.fontMetrics().ptPerEm; + l.height = l.height < s ? s : l.height, l.depth = l.depth < o ? o : l.depth; + } + i = e.havingStyle(a); + var u = Se(n.denom, i, e), c, d, h; + n.hasBarLine ? (n.barSize ? (d = Ye(n.barSize, e), c = R.makeLineSpan("frac-line", e, d)) : c = R.makeLineSpan("frac-line", e), d = c.height, h = c.height) : (c = null, d = 0, h = e.fontMetrics().defaultRuleThickness); + var p, _, b; + t.size === ae.DISPLAY.size || n.size === "display" ? (p = e.fontMetrics().num1, d > 0 ? _ = 3 * h : _ = 7 * h, b = e.fontMetrics().denom1) : (d > 0 ? (p = e.fontMetrics().num2, _ = h) : (p = e.fontMetrics().num3, _ = 3 * h), b = e.fontMetrics().denom2); + var D; + if (c) { + var k = e.fontMetrics().axisHeight; + p - l.depth - (k + 0.5 * d) < _ && (p += _ - (p - l.depth - (k + 0.5 * d))), k - 0.5 * d - (u.height - b) < _ && (b += _ - (k - 0.5 * d - (u.height - b))); + var w = -(k - 0.5 * d); + D = R.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: u, + shift: b + }, { + type: "elem", + elem: c, + shift: w + }, { + type: "elem", + elem: l, + shift: -p + }] + }, e); + } else { + var y = p - l.depth - (u.height - b); + y < _ && (p += 0.5 * (_ - y), b += 0.5 * (_ - y)), D = R.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: u, + shift: b + }, { + type: "elem", + elem: l, + shift: -p + }] + }, e); + } + i = e.havingStyle(t), D.height *= i.sizeMultiplier / e.sizeMultiplier, D.depth *= i.sizeMultiplier / e.sizeMultiplier; + var E; + t.size === ae.DISPLAY.size ? E = e.fontMetrics().delim1 : t.size === ae.SCRIPTSCRIPT.size ? E = e.havingStyle(ae.SCRIPT).fontMetrics().delim2 : E = e.fontMetrics().delim2; + var S, T; + return n.leftDelim == null ? S = Ya(e, ["mopen"]) : S = Cr.customSizedDelim(n.leftDelim, E, !0, e.havingStyle(t), n.mode, ["mopen"]), n.continued ? T = R.makeSpan([]) : n.rightDelim == null ? T = Ya(e, ["mclose"]) : T = Cr.customSizedDelim(n.rightDelim, E, !0, e.havingStyle(t), n.mode, ["mclose"]), R.makeSpan(["mord"].concat(i.sizingClasses(e)), [S, R.makeSpan(["mfrac"], [D]), T], e); +}, Uu = (n, e) => { + var t = new U.MathNode("mfrac", [Ie(n.numer, e), Ie(n.denom, e)]); + if (!n.hasBarLine) + t.setAttribute("linethickness", "0px"); + else if (n.barSize) { + var r = Ye(n.barSize, e); + t.setAttribute("linethickness", X(r)); + } + var a = s4(n.size, e.style); + if (a.size !== e.style.size) { + t = new U.MathNode("mstyle", [t]); + var i = a.size === ae.DISPLAY.size ? "true" : "false"; + t.setAttribute("displaystyle", i), t.setAttribute("scriptlevel", "0"); + } + if (n.leftDelim != null || n.rightDelim != null) { + var l = []; + if (n.leftDelim != null) { + var s = new U.MathNode("mo", [new U.TextNode(n.leftDelim.replace("\\", ""))]); + s.setAttribute("fence", "true"), l.push(s); + } + if (l.push(t), n.rightDelim != null) { + var o = new U.MathNode("mo", [new U.TextNode(n.rightDelim.replace("\\", ""))]); + o.setAttribute("fence", "true"), l.push(o); + } + return zu(l); + } + return t; +}; +Y({ + type: "genfrac", + names: [ + "\\dfrac", + "\\frac", + "\\tfrac", + "\\dbinom", + "\\binom", + "\\tbinom", + "\\\\atopfrac", + // can’t be entered directly + "\\\\bracefrac", + "\\\\brackfrac" + // ditto + ], + props: { + numArgs: 2, + allowedInArgument: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0], i = e[1], l, s = null, o = null, u = "auto"; + switch (r) { + case "\\dfrac": + case "\\frac": + case "\\tfrac": + l = !0; + break; + case "\\\\atopfrac": + l = !1; + break; + case "\\dbinom": + case "\\binom": + case "\\tbinom": + l = !1, s = "(", o = ")"; + break; + case "\\\\bracefrac": + l = !1, s = "\\{", o = "\\}"; + break; + case "\\\\brackfrac": + l = !1, s = "[", o = "]"; + break; + default: + throw new Error("Unrecognized genfrac command"); + } + switch (r) { + case "\\dfrac": + case "\\dbinom": + u = "display"; + break; + case "\\tfrac": + case "\\tbinom": + u = "text"; + break; + } + return { + type: "genfrac", + mode: t.mode, + continued: !1, + numer: a, + denom: i, + hasBarLine: l, + leftDelim: s, + rightDelim: o, + size: u, + barSize: null + }; + }, + htmlBuilder: Hu, + mathmlBuilder: Uu +}); +Y({ + type: "genfrac", + names: ["\\cfrac"], + props: { + numArgs: 2 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0], i = e[1]; + return { + type: "genfrac", + mode: t.mode, + continued: !0, + numer: a, + denom: i, + hasBarLine: !0, + leftDelim: null, + rightDelim: null, + size: "display", + barSize: null + }; + } +}); +Y({ + type: "infix", + names: ["\\over", "\\choose", "\\atop", "\\brace", "\\brack"], + props: { + numArgs: 0, + infix: !0 + }, + handler(n) { + var { + parser: e, + funcName: t, + token: r + } = n, a; + switch (t) { + case "\\over": + a = "\\frac"; + break; + case "\\choose": + a = "\\binom"; + break; + case "\\atop": + a = "\\\\atopfrac"; + break; + case "\\brace": + a = "\\\\bracefrac"; + break; + case "\\brack": + a = "\\\\brackfrac"; + break; + default: + throw new Error("Unrecognized infix genfrac command"); + } + return { + type: "infix", + mode: e.mode, + replaceWith: a, + token: r + }; + } +}); +var hc = ["display", "text", "script", "scriptscript"], dc = function(e) { + var t = null; + return e.length > 0 && (t = e, t = t === "." ? null : t), t; +}; +Y({ + type: "genfrac", + names: ["\\genfrac"], + props: { + numArgs: 6, + allowedInArgument: !0, + argTypes: ["math", "math", "size", "text", "math", "math"] + }, + handler(n, e) { + var { + parser: t + } = n, r = e[4], a = e[5], i = Ml(e[0]), l = i.type === "atom" && i.family === "open" ? dc(i.text) : null, s = Ml(e[1]), o = s.type === "atom" && s.family === "close" ? dc(s.text) : null, u = pe(e[2], "size"), c, d = null; + u.isBlank ? c = !0 : (d = u.value, c = d.number > 0); + var h = "auto", p = e[3]; + if (p.type === "ordgroup") { + if (p.body.length > 0) { + var _ = pe(p.body[0], "textord"); + h = hc[Number(_.text)]; + } + } else + p = pe(p, "textord"), h = hc[Number(p.text)]; + return { + type: "genfrac", + mode: t.mode, + numer: r, + denom: a, + continued: !1, + hasBarLine: c, + barSize: d, + leftDelim: l, + rightDelim: o, + size: h + }; + }, + htmlBuilder: Hu, + mathmlBuilder: Uu +}); +Y({ + type: "infix", + names: ["\\above"], + props: { + numArgs: 1, + argTypes: ["size"], + infix: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r, + token: a + } = n; + return { + type: "infix", + mode: t.mode, + replaceWith: "\\\\abovefrac", + size: pe(e[0], "size").value, + token: a + }; + } +}); +Y({ + type: "genfrac", + names: ["\\\\abovefrac"], + props: { + numArgs: 3, + argTypes: ["math", "size", "math"] + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0], i = I5(pe(e[1], "infix").size), l = e[2], s = i.number > 0; + return { + type: "genfrac", + mode: t.mode, + numer: a, + denom: l, + continued: !1, + hasBarLine: s, + barSize: i, + leftDelim: null, + rightDelim: null, + size: "auto" + }; + }, + htmlBuilder: Hu, + mathmlBuilder: Uu +}); +var o4 = (n, e) => { + var t = e.style, r, a; + n.type === "supsub" ? (r = n.sup ? Se(n.sup, e.havingStyle(t.sup()), e) : Se(n.sub, e.havingStyle(t.sub()), e), a = pe(n.base, "horizBrace")) : a = pe(n, "horizBrace"); + var i = Se(a.base, e.havingBaseStyle(ae.DISPLAY)), l = Lr.svgSpan(a, e), s; + if (a.isOver ? (s = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: i + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: l + }] + }, e), s.children[0].children[0].children[1].classes.push("svg-align")) : (s = R.makeVList({ + positionType: "bottom", + positionData: i.depth + 0.1 + l.height, + children: [{ + type: "elem", + elem: l + }, { + type: "kern", + size: 0.1 + }, { + type: "elem", + elem: i + }] + }, e), s.children[0].children[0].children[0].classes.push("svg-align")), r) { + var o = R.makeSpan(["mord", a.isOver ? "mover" : "munder"], [s], e); + a.isOver ? s = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: o + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: r + }] + }, e) : s = R.makeVList({ + positionType: "bottom", + positionData: o.depth + 0.2 + r.height + r.depth, + children: [{ + type: "elem", + elem: r + }, { + type: "kern", + size: 0.2 + }, { + type: "elem", + elem: o + }] + }, e); + } + return R.makeSpan(["mord", a.isOver ? "mover" : "munder"], [s], e); +}, a6 = (n, e) => { + var t = Lr.mathMLnode(n.label); + return new U.MathNode(n.isOver ? "mover" : "munder", [Ie(n.base, e), t]); +}; +Y({ + type: "horizBrace", + names: ["\\overbrace", "\\underbrace"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n; + return { + type: "horizBrace", + mode: t.mode, + label: r, + isOver: /^\\over/.test(r), + base: e[0] + }; + }, + htmlBuilder: o4, + mathmlBuilder: a6 +}); +Y({ + type: "href", + names: ["\\href"], + props: { + numArgs: 2, + argTypes: ["url", "original"], + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[1], a = pe(e[0], "url").url; + return t.settings.isTrusted({ + command: "\\href", + url: a + }) ? { + type: "href", + mode: t.mode, + href: a, + body: tt(r) + } : t.formatUnsupportedCmd("\\href"); + }, + htmlBuilder: (n, e) => { + var t = gt(n.body, e, !1); + return R.makeAnchor(n.href, [], t, e); + }, + mathmlBuilder: (n, e) => { + var t = cn(n.body, e); + return t instanceof y0 || (t = new y0("mrow", [t])), t.setAttribute("href", n.href), t; + } +}); +Y({ + type: "href", + names: ["\\url"], + props: { + numArgs: 1, + argTypes: ["url"], + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = pe(e[0], "url").url; + if (!t.settings.isTrusted({ + command: "\\url", + url: r + })) + return t.formatUnsupportedCmd("\\url"); + for (var a = [], i = 0; i < r.length; i++) { + var l = r[i]; + l === "~" && (l = "\\textasciitilde"), a.push({ + type: "textord", + mode: "text", + text: l + }); + } + var s = { + type: "text", + mode: t.mode, + font: "\\texttt", + body: a + }; + return { + type: "href", + mode: t.mode, + href: r, + body: tt(s) + }; + } +}); +Y({ + type: "hbox", + names: ["\\hbox"], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInText: !0, + primitive: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "hbox", + mode: t.mode, + body: tt(e[0]) + }; + }, + htmlBuilder(n, e) { + var t = gt(n.body, e, !1); + return R.makeFragment(t); + }, + mathmlBuilder(n, e) { + return new U.MathNode("mrow", a0(n.body, e)); + } +}); +Y({ + type: "html", + names: ["\\htmlClass", "\\htmlId", "\\htmlStyle", "\\htmlData"], + props: { + numArgs: 2, + argTypes: ["raw", "original"], + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r, + token: a + } = n, i = pe(e[0], "raw").string, l = e[1]; + t.settings.strict && t.settings.reportNonstrict("htmlExtension", "HTML extension is disabled on strict mode"); + var s, o = {}; + switch (r) { + case "\\htmlClass": + o.class = i, s = { + command: "\\htmlClass", + class: i + }; + break; + case "\\htmlId": + o.id = i, s = { + command: "\\htmlId", + id: i + }; + break; + case "\\htmlStyle": + o.style = i, s = { + command: "\\htmlStyle", + style: i + }; + break; + case "\\htmlData": { + for (var u = i.split(","), c = 0; c < u.length; c++) { + var d = u[c].split("="); + if (d.length !== 2) + throw new G("Error parsing key-value for \\htmlData"); + o["data-" + d[0].trim()] = d[1].trim(); + } + s = { + command: "\\htmlData", + attributes: o + }; + break; + } + default: + throw new Error("Unrecognized html command"); + } + return t.settings.isTrusted(s) ? { + type: "html", + mode: t.mode, + attributes: o, + body: tt(l) + } : t.formatUnsupportedCmd(r); + }, + htmlBuilder: (n, e) => { + var t = gt(n.body, e, !1), r = ["enclosing"]; + n.attributes.class && r.push(...n.attributes.class.trim().split(/\s+/)); + var a = R.makeSpan(r, t, e); + for (var i in n.attributes) + i !== "class" && n.attributes.hasOwnProperty(i) && a.setAttribute(i, n.attributes[i]); + return a; + }, + mathmlBuilder: (n, e) => cn(n.body, e) +}); +Y({ + type: "htmlmathml", + names: ["\\html@mathml"], + props: { + numArgs: 2, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n; + return { + type: "htmlmathml", + mode: t.mode, + html: tt(e[0]), + mathml: tt(e[1]) + }; + }, + htmlBuilder: (n, e) => { + var t = gt(n.html, e, !1); + return R.makeFragment(t); + }, + mathmlBuilder: (n, e) => cn(n.mathml, e) +}); +var ao = function(e) { + if (/^[-+]? *(\d+(\.\d*)?|\.\d+)$/.test(e)) + return { + number: +e, + unit: "bp" + }; + var t = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(e); + if (!t) + throw new G("Invalid size: '" + e + "' in \\includegraphics"); + var r = { + number: +(t[1] + t[2]), + // sign + magnitude, cast to number + unit: t[3] + }; + if (!xd(r)) + throw new G("Invalid unit: '" + r.unit + "' in \\includegraphics."); + return r; +}; +Y({ + type: "includegraphics", + names: ["\\includegraphics"], + props: { + numArgs: 1, + numOptionalArgs: 1, + argTypes: ["raw", "url"], + allowedInText: !1 + }, + handler: (n, e, t) => { + var { + parser: r + } = n, a = { + number: 0, + unit: "em" + }, i = { + number: 0.9, + unit: "em" + }, l = { + number: 0, + unit: "em" + }, s = ""; + if (t[0]) + for (var o = pe(t[0], "raw").string, u = o.split(","), c = 0; c < u.length; c++) { + var d = u[c].split("="); + if (d.length === 2) { + var h = d[1].trim(); + switch (d[0].trim()) { + case "alt": + s = h; + break; + case "width": + a = ao(h); + break; + case "height": + i = ao(h); + break; + case "totalheight": + l = ao(h); + break; + default: + throw new G("Invalid key: '" + d[0] + "' in \\includegraphics."); + } + } + } + var p = pe(e[0], "url").url; + return s === "" && (s = p, s = s.replace(/^.*[\\/]/, ""), s = s.substring(0, s.lastIndexOf("."))), r.settings.isTrusted({ + command: "\\includegraphics", + url: p + }) ? { + type: "includegraphics", + mode: r.mode, + alt: s, + width: a, + height: i, + totalheight: l, + src: p + } : r.formatUnsupportedCmd("\\includegraphics"); + }, + htmlBuilder: (n, e) => { + var t = Ye(n.height, e), r = 0; + n.totalheight.number > 0 && (r = Ye(n.totalheight, e) - t); + var a = 0; + n.width.number > 0 && (a = Ye(n.width, e)); + var i = { + height: X(t + r) + }; + a > 0 && (i.width = X(a)), r > 0 && (i.verticalAlign = X(-r)); + var l = new a3(n.src, n.alt, i); + return l.height = t, l.depth = r, l; + }, + mathmlBuilder: (n, e) => { + var t = new U.MathNode("mglyph", []); + t.setAttribute("alt", n.alt); + var r = Ye(n.height, e), a = 0; + if (n.totalheight.number > 0 && (a = Ye(n.totalheight, e) - r, t.setAttribute("valign", X(-a))), t.setAttribute("height", X(r + a)), n.width.number > 0) { + var i = Ye(n.width, e); + t.setAttribute("width", X(i)); + } + return t.setAttribute("src", n.src), t; + } +}); +Y({ + type: "kern", + names: ["\\kern", "\\mkern", "\\hskip", "\\mskip"], + props: { + numArgs: 1, + argTypes: ["size"], + primitive: !0, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = pe(e[0], "size"); + if (t.settings.strict) { + var i = r[1] === "m", l = a.value.unit === "mu"; + i ? (l || t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " supports only mu units, " + ("not " + a.value.unit + " units")), t.mode !== "math" && t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " works only in math mode")) : l && t.settings.reportNonstrict("mathVsTextUnits", "LaTeX's " + r + " doesn't support mu units"); + } + return { + type: "kern", + mode: t.mode, + dimension: a.value + }; + }, + htmlBuilder(n, e) { + return R.makeGlue(n.dimension, e); + }, + mathmlBuilder(n, e) { + var t = Ye(n.dimension, e); + return new U.SpaceNode(t); + } +}); +Y({ + type: "lap", + names: ["\\mathllap", "\\mathrlap", "\\mathclap"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "lap", + mode: t.mode, + alignment: r.slice(5), + body: a + }; + }, + htmlBuilder: (n, e) => { + var t; + n.alignment === "clap" ? (t = R.makeSpan([], [Se(n.body, e)]), t = R.makeSpan(["inner"], [t], e)) : t = R.makeSpan(["inner"], [Se(n.body, e)]); + var r = R.makeSpan(["fix"], []), a = R.makeSpan([n.alignment], [t, r], e), i = R.makeSpan(["strut"]); + return i.style.height = X(a.height + a.depth), a.depth && (i.style.verticalAlign = X(-a.depth)), a.children.unshift(i), a = R.makeSpan(["thinbox"], [a], e), R.makeSpan(["mord", "vbox"], [a], e); + }, + mathmlBuilder: (n, e) => { + var t = new U.MathNode("mpadded", [Ie(n.body, e)]); + if (n.alignment !== "rlap") { + var r = n.alignment === "llap" ? "-1" : "-0.5"; + t.setAttribute("lspace", r + "width"); + } + return t.setAttribute("width", "0px"), t; + } +}); +Y({ + type: "styling", + names: ["\\(", "$"], + props: { + numArgs: 0, + allowedInText: !0, + allowedInMath: !1 + }, + handler(n, e) { + var { + funcName: t, + parser: r + } = n, a = r.mode; + r.switchMode("math"); + var i = t === "\\(" ? "\\)" : "$", l = r.parseExpression(!1, i); + return r.expect(i), r.switchMode(a), { + type: "styling", + mode: r.mode, + style: "text", + body: l + }; + } +}); +Y({ + type: "text", + // Doesn't matter what this is. + names: ["\\)", "\\]"], + props: { + numArgs: 0, + allowedInText: !0, + allowedInMath: !1 + }, + handler(n, e) { + throw new G("Mismatched " + n.funcName); + } +}); +var mc = (n, e) => { + switch (e.style.size) { + case ae.DISPLAY.size: + return n.display; + case ae.TEXT.size: + return n.text; + case ae.SCRIPT.size: + return n.script; + case ae.SCRIPTSCRIPT.size: + return n.scriptscript; + default: + return n.text; + } +}; +Y({ + type: "mathchoice", + names: ["\\mathchoice"], + props: { + numArgs: 4, + primitive: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n; + return { + type: "mathchoice", + mode: t.mode, + display: tt(e[0]), + text: tt(e[1]), + script: tt(e[2]), + scriptscript: tt(e[3]) + }; + }, + htmlBuilder: (n, e) => { + var t = mc(n, e), r = gt(t, e, !1); + return R.makeFragment(r); + }, + mathmlBuilder: (n, e) => { + var t = mc(n, e); + return cn(t, e); + } +}); +var u4 = (n, e, t, r, a, i, l) => { + n = R.makeSpan([], [n]); + var s = t && re.isCharacterBox(t), o, u; + if (e) { + var c = Se(e, r.havingStyle(a.sup()), r); + u = { + elem: c, + kern: Math.max(r.fontMetrics().bigOpSpacing1, r.fontMetrics().bigOpSpacing3 - c.depth) + }; + } + if (t) { + var d = Se(t, r.havingStyle(a.sub()), r); + o = { + elem: d, + kern: Math.max(r.fontMetrics().bigOpSpacing2, r.fontMetrics().bigOpSpacing4 - d.height) + }; + } + var h; + if (u && o) { + var p = r.fontMetrics().bigOpSpacing5 + o.elem.height + o.elem.depth + o.kern + n.depth + l; + h = R.makeVList({ + positionType: "bottom", + positionData: p, + children: [{ + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: o.elem, + marginLeft: X(-i) + }, { + type: "kern", + size: o.kern + }, { + type: "elem", + elem: n + }, { + type: "kern", + size: u.kern + }, { + type: "elem", + elem: u.elem, + marginLeft: X(i) + }, { + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }] + }, r); + } else if (o) { + var _ = n.height - l; + h = R.makeVList({ + positionType: "top", + positionData: _, + children: [{ + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }, { + type: "elem", + elem: o.elem, + marginLeft: X(-i) + }, { + type: "kern", + size: o.kern + }, { + type: "elem", + elem: n + }] + }, r); + } else if (u) { + var b = n.depth + l; + h = R.makeVList({ + positionType: "bottom", + positionData: b, + children: [{ + type: "elem", + elem: n + }, { + type: "kern", + size: u.kern + }, { + type: "elem", + elem: u.elem, + marginLeft: X(i) + }, { + type: "kern", + size: r.fontMetrics().bigOpSpacing5 + }] + }, r); + } else + return n; + var D = [h]; + if (o && i !== 0 && !s) { + var y = R.makeSpan(["mspace"], [], r); + y.style.marginRight = X(i), D.unshift(y); + } + return R.makeSpan(["mop", "op-limits"], D, r); +}, c4 = ["\\smallint"], ua = (n, e) => { + var t, r, a = !1, i; + n.type === "supsub" ? (t = n.sup, r = n.sub, i = pe(n.base, "op"), a = !0) : i = pe(n, "op"); + var l = e.style, s = !1; + l.size === ae.DISPLAY.size && i.symbol && !re.contains(c4, i.name) && (s = !0); + var o; + if (i.symbol) { + var u = s ? "Size2-Regular" : "Size1-Regular", c = ""; + if ((i.name === "\\oiint" || i.name === "\\oiiint") && (c = i.name.slice(1), i.name = c === "oiint" ? "\\iint" : "\\iiint"), o = R.makeSymbol(i.name, u, "math", e, ["mop", "op-symbol", s ? "large-op" : "small-op"]), c.length > 0) { + var d = o.italic, h = R.staticSvg(c + "Size" + (s ? "2" : "1"), e); + o = R.makeVList({ + positionType: "individualShift", + children: [{ + type: "elem", + elem: o, + shift: 0 + }, { + type: "elem", + elem: h, + shift: s ? 0.08 : 0 + }] + }, e), i.name = "\\" + c, o.classes.unshift("mop"), o.italic = d; + } + } else if (i.body) { + var p = gt(i.body, e, !0); + p.length === 1 && p[0] instanceof x0 ? (o = p[0], o.classes[0] = "mop") : o = R.makeSpan(["mop"], p, e); + } else { + for (var _ = [], b = 1; b < i.name.length; b++) + _.push(R.mathsym(i.name[b], i.mode, e)); + o = R.makeSpan(["mop"], _, e); + } + var D = 0, y = 0; + return (o instanceof x0 || i.name === "\\oiint" || i.name === "\\oiiint") && !i.suppressBaseShift && (D = (o.height - o.depth) / 2 - e.fontMetrics().axisHeight, y = o.italic), a ? u4(o, t, r, e, l, y, D) : (D && (o.style.position = "relative", o.style.top = X(D)), o); +}, ni = (n, e) => { + var t; + if (n.symbol) + t = new y0("mo", [T0(n.name, n.mode)]), re.contains(c4, n.name) && t.setAttribute("largeop", "false"); + else if (n.body) + t = new y0("mo", a0(n.body, e)); + else { + t = new y0("mi", [new Oa(n.name.slice(1))]); + var r = new y0("mo", [T0("⁡", "text")]); + n.parentIsSupSub ? t = new y0("mrow", [t, r]) : t = Od([t, r]); + } + return t; +}, i6 = { + "∏": "\\prod", + "∐": "\\coprod", + "∑": "\\sum", + "⋀": "\\bigwedge", + "⋁": "\\bigvee", + "⋂": "\\bigcap", + "⋃": "\\bigcup", + "⨀": "\\bigodot", + "⨁": "\\bigoplus", + "⨂": "\\bigotimes", + "⨄": "\\biguplus", + "⨆": "\\bigsqcup" +}; +Y({ + type: "op", + names: ["\\coprod", "\\bigvee", "\\bigwedge", "\\biguplus", "\\bigcap", "\\bigcup", "\\intop", "\\prod", "\\sum", "\\bigotimes", "\\bigoplus", "\\bigodot", "\\bigsqcup", "\\smallint", "∏", "∐", "∑", "⋀", "⋁", "⋂", "⋃", "⨀", "⨁", "⨂", "⨄", "⨆"], + props: { + numArgs: 0 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = r; + return a.length === 1 && (a = i6[a]), { + type: "op", + mode: t.mode, + limits: !0, + parentIsSupSub: !1, + symbol: !0, + name: a + }; + }, + htmlBuilder: ua, + mathmlBuilder: ni +}); +Y({ + type: "op", + names: ["\\mathop"], + props: { + numArgs: 1, + primitive: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "op", + mode: t.mode, + limits: !1, + parentIsSupSub: !1, + symbol: !1, + body: tt(r) + }; + }, + htmlBuilder: ua, + mathmlBuilder: ni +}); +var l6 = { + "∫": "\\int", + "∬": "\\iint", + "∭": "\\iiint", + "∮": "\\oint", + "∯": "\\oiint", + "∰": "\\oiiint" +}; +Y({ + type: "op", + names: ["\\arcsin", "\\arccos", "\\arctan", "\\arctg", "\\arcctg", "\\arg", "\\ch", "\\cos", "\\cosec", "\\cosh", "\\cot", "\\cotg", "\\coth", "\\csc", "\\ctg", "\\cth", "\\deg", "\\dim", "\\exp", "\\hom", "\\ker", "\\lg", "\\ln", "\\log", "\\sec", "\\sin", "\\sinh", "\\sh", "\\tan", "\\tanh", "\\tg", "\\th"], + props: { + numArgs: 0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n; + return { + type: "op", + mode: e.mode, + limits: !1, + parentIsSupSub: !1, + symbol: !1, + name: t + }; + }, + htmlBuilder: ua, + mathmlBuilder: ni +}); +Y({ + type: "op", + names: ["\\det", "\\gcd", "\\inf", "\\lim", "\\max", "\\min", "\\Pr", "\\sup"], + props: { + numArgs: 0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n; + return { + type: "op", + mode: e.mode, + limits: !0, + parentIsSupSub: !1, + symbol: !1, + name: t + }; + }, + htmlBuilder: ua, + mathmlBuilder: ni +}); +Y({ + type: "op", + names: ["\\int", "\\iint", "\\iiint", "\\oint", "\\oiint", "\\oiiint", "∫", "∬", "∭", "∮", "∯", "∰"], + props: { + numArgs: 0 + }, + handler(n) { + var { + parser: e, + funcName: t + } = n, r = t; + return r.length === 1 && (r = l6[r]), { + type: "op", + mode: e.mode, + limits: !1, + parentIsSupSub: !1, + symbol: !0, + name: r + }; + }, + htmlBuilder: ua, + mathmlBuilder: ni +}); +var f4 = (n, e) => { + var t, r, a = !1, i; + n.type === "supsub" ? (t = n.sup, r = n.sub, i = pe(n.base, "operatorname"), a = !0) : i = pe(n, "operatorname"); + var l; + if (i.body.length > 0) { + for (var s = i.body.map((d) => { + var h = d.text; + return typeof h == "string" ? { + type: "textord", + mode: d.mode, + text: h + } : d; + }), o = gt(s, e.withFont("mathrm"), !0), u = 0; u < o.length; u++) { + var c = o[u]; + c instanceof x0 && (c.text = c.text.replace(/\u2212/, "-").replace(/\u2217/, "*")); + } + l = R.makeSpan(["mop"], o, e); + } else + l = R.makeSpan(["mop"], [], e); + return a ? u4(l, t, r, e, e.style, 0, 0) : l; +}, s6 = (n, e) => { + for (var t = a0(n.body, e.withFont("mathrm")), r = !0, a = 0; a < t.length; a++) { + var i = t[a]; + if (!(i instanceof U.SpaceNode)) if (i instanceof U.MathNode) + switch (i.type) { + case "mi": + case "mn": + case "ms": + case "mspace": + case "mtext": + break; + case "mo": { + var l = i.children[0]; + i.children.length === 1 && l instanceof U.TextNode ? l.text = l.text.replace(/\u2212/, "-").replace(/\u2217/, "*") : r = !1; + break; + } + default: + r = !1; + } + else + r = !1; + } + if (r) { + var s = t.map((c) => c.toText()).join(""); + t = [new U.TextNode(s)]; + } + var o = new U.MathNode("mi", t); + o.setAttribute("mathvariant", "normal"); + var u = new U.MathNode("mo", [T0("⁡", "text")]); + return n.parentIsSupSub ? new U.MathNode("mrow", [o, u]) : U.newDocumentFragment([o, u]); +}; +Y({ + type: "operatorname", + names: ["\\operatorname@", "\\operatornamewithlimits"], + props: { + numArgs: 1 + }, + handler: (n, e) => { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "operatorname", + mode: t.mode, + body: tt(a), + alwaysHandleSupSub: r === "\\operatornamewithlimits", + limits: !1, + parentIsSupSub: !1 + }; + }, + htmlBuilder: f4, + mathmlBuilder: s6 +}); +v("\\operatorname", "\\@ifstar\\operatornamewithlimits\\operatorname@"); +Bn({ + type: "ordgroup", + htmlBuilder(n, e) { + return n.semisimple ? R.makeFragment(gt(n.body, e, !1)) : R.makeSpan(["mord"], gt(n.body, e, !0), e); + }, + mathmlBuilder(n, e) { + return cn(n.body, e, !0); + } +}); +Y({ + type: "overline", + names: ["\\overline"], + props: { + numArgs: 1 + }, + handler(n, e) { + var { + parser: t + } = n, r = e[0]; + return { + type: "overline", + mode: t.mode, + body: r + }; + }, + htmlBuilder(n, e) { + var t = Se(n.body, e.havingCrampedStyle()), r = R.makeLineSpan("overline-line", e), a = e.fontMetrics().defaultRuleThickness, i = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t + }, { + type: "kern", + size: 3 * a + }, { + type: "elem", + elem: r + }, { + type: "kern", + size: a + }] + }, e); + return R.makeSpan(["mord", "overline"], [i], e); + }, + mathmlBuilder(n, e) { + var t = new U.MathNode("mo", [new U.TextNode("‾")]); + t.setAttribute("stretchy", "true"); + var r = new U.MathNode("mover", [Ie(n.body, e), t]); + return r.setAttribute("accent", "true"), r; + } +}); +Y({ + type: "phantom", + names: ["\\phantom"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "phantom", + mode: t.mode, + body: tt(r) + }; + }, + htmlBuilder: (n, e) => { + var t = gt(n.body, e.withPhantom(), !1); + return R.makeFragment(t); + }, + mathmlBuilder: (n, e) => { + var t = a0(n.body, e); + return new U.MathNode("mphantom", t); + } +}); +Y({ + type: "hphantom", + names: ["\\hphantom"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "hphantom", + mode: t.mode, + body: r + }; + }, + htmlBuilder: (n, e) => { + var t = R.makeSpan([], [Se(n.body, e.withPhantom())]); + if (t.height = 0, t.depth = 0, t.children) + for (var r = 0; r < t.children.length; r++) + t.children[r].height = 0, t.children[r].depth = 0; + return t = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t + }] + }, e), R.makeSpan(["mord"], [t], e); + }, + mathmlBuilder: (n, e) => { + var t = a0(tt(n.body), e), r = new U.MathNode("mphantom", t), a = new U.MathNode("mpadded", [r]); + return a.setAttribute("height", "0px"), a.setAttribute("depth", "0px"), a; + } +}); +Y({ + type: "vphantom", + names: ["\\vphantom"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler: (n, e) => { + var { + parser: t + } = n, r = e[0]; + return { + type: "vphantom", + mode: t.mode, + body: r + }; + }, + htmlBuilder: (n, e) => { + var t = R.makeSpan(["inner"], [Se(n.body, e.withPhantom())]), r = R.makeSpan(["fix"], []); + return R.makeSpan(["mord", "rlap"], [t, r], e); + }, + mathmlBuilder: (n, e) => { + var t = a0(tt(n.body), e), r = new U.MathNode("mphantom", t), a = new U.MathNode("mpadded", [r]); + return a.setAttribute("width", "0px"), a; + } +}); +Y({ + type: "raisebox", + names: ["\\raisebox"], + props: { + numArgs: 2, + argTypes: ["size", "hbox"], + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n, r = pe(e[0], "size").value, a = e[1]; + return { + type: "raisebox", + mode: t.mode, + dy: r, + body: a + }; + }, + htmlBuilder(n, e) { + var t = Se(n.body, e), r = Ye(n.dy, e); + return R.makeVList({ + positionType: "shift", + positionData: -r, + children: [{ + type: "elem", + elem: t + }] + }, e); + }, + mathmlBuilder(n, e) { + var t = new U.MathNode("mpadded", [Ie(n.body, e)]), r = n.dy.number + n.dy.unit; + return t.setAttribute("voffset", r), t; + } +}); +Y({ + type: "internal", + names: ["\\relax"], + props: { + numArgs: 0, + allowedInText: !0 + }, + handler(n) { + var { + parser: e + } = n; + return { + type: "internal", + mode: e.mode + }; + } +}); +Y({ + type: "rule", + names: ["\\rule"], + props: { + numArgs: 2, + numOptionalArgs: 1, + argTypes: ["size", "size", "size"] + }, + handler(n, e, t) { + var { + parser: r + } = n, a = t[0], i = pe(e[0], "size"), l = pe(e[1], "size"); + return { + type: "rule", + mode: r.mode, + shift: a && pe(a, "size").value, + width: i.value, + height: l.value + }; + }, + htmlBuilder(n, e) { + var t = R.makeSpan(["mord", "rule"], [], e), r = Ye(n.width, e), a = Ye(n.height, e), i = n.shift ? Ye(n.shift, e) : 0; + return t.style.borderRightWidth = X(r), t.style.borderTopWidth = X(a), t.style.bottom = X(i), t.width = r, t.height = a + i, t.depth = -i, t.maxFontSize = a * 1.125 * e.sizeMultiplier, t; + }, + mathmlBuilder(n, e) { + var t = Ye(n.width, e), r = Ye(n.height, e), a = n.shift ? Ye(n.shift, e) : 0, i = e.color && e.getColor() || "black", l = new U.MathNode("mspace"); + l.setAttribute("mathbackground", i), l.setAttribute("width", X(t)), l.setAttribute("height", X(r)); + var s = new U.MathNode("mpadded", [l]); + return a >= 0 ? s.setAttribute("height", X(a)) : (s.setAttribute("height", X(a)), s.setAttribute("depth", X(-a))), s.setAttribute("voffset", X(a)), s; + } +}); +function h4(n, e, t) { + for (var r = gt(n, e, !1), a = e.sizeMultiplier / t.sizeMultiplier, i = 0; i < r.length; i++) { + var l = r[i].classes.indexOf("sizing"); + l < 0 ? Array.prototype.push.apply(r[i].classes, e.sizingClasses(t)) : r[i].classes[l + 1] === "reset-size" + e.size && (r[i].classes[l + 1] = "reset-size" + t.size), r[i].height *= a, r[i].depth *= a; + } + return R.makeFragment(r); +} +var pc = ["\\tiny", "\\sixptsize", "\\scriptsize", "\\footnotesize", "\\small", "\\normalsize", "\\large", "\\Large", "\\LARGE", "\\huge", "\\Huge"], o6 = (n, e) => { + var t = e.havingSize(n.size); + return h4(n.body, t, e); +}; +Y({ + type: "sizing", + names: pc, + props: { + numArgs: 0, + allowedInText: !0 + }, + handler: (n, e) => { + var { + breakOnTokenText: t, + funcName: r, + parser: a + } = n, i = a.parseExpression(!1, t); + return { + type: "sizing", + mode: a.mode, + // Figure out what size to use based on the list of functions above + size: pc.indexOf(r) + 1, + body: i + }; + }, + htmlBuilder: o6, + mathmlBuilder: (n, e) => { + var t = e.havingSize(n.size), r = a0(n.body, t), a = new U.MathNode("mstyle", r); + return a.setAttribute("mathsize", X(t.sizeMultiplier)), a; + } +}); +Y({ + type: "smash", + names: ["\\smash"], + props: { + numArgs: 1, + numOptionalArgs: 1, + allowedInText: !0 + }, + handler: (n, e, t) => { + var { + parser: r + } = n, a = !1, i = !1, l = t[0] && pe(t[0], "ordgroup"); + if (l) + for (var s = "", o = 0; o < l.body.length; ++o) { + var u = l.body[o]; + if (s = u.text, s === "t") + a = !0; + else if (s === "b") + i = !0; + else { + a = !1, i = !1; + break; + } + } + else + a = !0, i = !0; + var c = e[0]; + return { + type: "smash", + mode: r.mode, + body: c, + smashHeight: a, + smashDepth: i + }; + }, + htmlBuilder: (n, e) => { + var t = R.makeSpan([], [Se(n.body, e)]); + if (!n.smashHeight && !n.smashDepth) + return t; + if (n.smashHeight && (t.height = 0, t.children)) + for (var r = 0; r < t.children.length; r++) + t.children[r].height = 0; + if (n.smashDepth && (t.depth = 0, t.children)) + for (var a = 0; a < t.children.length; a++) + t.children[a].depth = 0; + var i = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t + }] + }, e); + return R.makeSpan(["mord"], [i], e); + }, + mathmlBuilder: (n, e) => { + var t = new U.MathNode("mpadded", [Ie(n.body, e)]); + return n.smashHeight && t.setAttribute("height", "0px"), n.smashDepth && t.setAttribute("depth", "0px"), t; + } +}); +Y({ + type: "sqrt", + names: ["\\sqrt"], + props: { + numArgs: 1, + numOptionalArgs: 1 + }, + handler(n, e, t) { + var { + parser: r + } = n, a = t[0], i = e[0]; + return { + type: "sqrt", + mode: r.mode, + body: i, + index: a + }; + }, + htmlBuilder(n, e) { + var t = Se(n.body, e.havingCrampedStyle()); + t.height === 0 && (t.height = e.fontMetrics().xHeight), t = R.wrapFragment(t, e); + var r = e.fontMetrics(), a = r.defaultRuleThickness, i = a; + e.style.id < ae.TEXT.id && (i = e.fontMetrics().xHeight); + var l = a + i / 4, s = t.height + t.depth + l + a, { + span: o, + ruleWidth: u, + advanceWidth: c + } = Cr.sqrtImage(s, e), d = o.height - u; + d > t.height + t.depth + l && (l = (l + d - t.height - t.depth) / 2); + var h = o.height - t.height - l - u; + t.style.paddingLeft = X(c); + var p = R.makeVList({ + positionType: "firstBaseline", + children: [{ + type: "elem", + elem: t, + wrapperClasses: ["svg-align"] + }, { + type: "kern", + size: -(t.height + h) + }, { + type: "elem", + elem: o + }, { + type: "kern", + size: u + }] + }, e); + if (n.index) { + var _ = e.havingStyle(ae.SCRIPTSCRIPT), b = Se(n.index, _, e), D = 0.6 * (p.height - p.depth), y = R.makeVList({ + positionType: "shift", + positionData: -D, + children: [{ + type: "elem", + elem: b + }] + }, e), k = R.makeSpan(["root"], [y]); + return R.makeSpan(["mord", "sqrt"], [k, p], e); + } else + return R.makeSpan(["mord", "sqrt"], [p], e); + }, + mathmlBuilder(n, e) { + var { + body: t, + index: r + } = n; + return r ? new U.MathNode("mroot", [Ie(t, e), Ie(r, e)]) : new U.MathNode("msqrt", [Ie(t, e)]); + } +}); +var gc = { + display: ae.DISPLAY, + text: ae.TEXT, + script: ae.SCRIPT, + scriptscript: ae.SCRIPTSCRIPT +}; +Y({ + type: "styling", + names: ["\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle"], + props: { + numArgs: 0, + allowedInText: !0, + primitive: !0 + }, + handler(n, e) { + var { + breakOnTokenText: t, + funcName: r, + parser: a + } = n, i = a.parseExpression(!0, t), l = r.slice(1, r.length - 5); + return { + type: "styling", + mode: a.mode, + // Figure out what style to use by pulling out the style from + // the function name + style: l, + body: i + }; + }, + htmlBuilder(n, e) { + var t = gc[n.style], r = e.havingStyle(t).withFont(""); + return h4(n.body, r, e); + }, + mathmlBuilder(n, e) { + var t = gc[n.style], r = e.havingStyle(t), a = a0(n.body, r), i = new U.MathNode("mstyle", a), l = { + display: ["0", "true"], + text: ["0", "false"], + script: ["1", "false"], + scriptscript: ["2", "false"] + }, s = l[n.style]; + return i.setAttribute("scriptlevel", s[0]), i.setAttribute("displaystyle", s[1]), i; + } +}); +var u6 = function(e, t) { + var r = e.base; + if (r) + if (r.type === "op") { + var a = r.limits && (t.style.size === ae.DISPLAY.size || r.alwaysHandleSupSub); + return a ? ua : null; + } else if (r.type === "operatorname") { + var i = r.alwaysHandleSupSub && (t.style.size === ae.DISPLAY.size || r.limits); + return i ? f4 : null; + } else { + if (r.type === "accent") + return re.isCharacterBox(r.base) ? Lu : null; + if (r.type === "horizBrace") { + var l = !e.sub; + return l === r.isOver ? o4 : null; + } else + return null; + } + else return null; +}; +Bn({ + type: "supsub", + htmlBuilder(n, e) { + var t = u6(n, e); + if (t) + return t(n, e); + var { + base: r, + sup: a, + sub: i + } = n, l = Se(r, e), s, o, u = e.fontMetrics(), c = 0, d = 0, h = r && re.isCharacterBox(r); + if (a) { + var p = e.havingStyle(e.style.sup()); + s = Se(a, p, e), h || (c = l.height - p.fontMetrics().supDrop * p.sizeMultiplier / e.sizeMultiplier); + } + if (i) { + var _ = e.havingStyle(e.style.sub()); + o = Se(i, _, e), h || (d = l.depth + _.fontMetrics().subDrop * _.sizeMultiplier / e.sizeMultiplier); + } + var b; + e.style === ae.DISPLAY ? b = u.sup1 : e.style.cramped ? b = u.sup3 : b = u.sup2; + var D = e.sizeMultiplier, y = X(0.5 / u.ptPerEm / D), k = null; + if (o) { + var w = n.base && n.base.type === "op" && n.base.name && (n.base.name === "\\oiint" || n.base.name === "\\oiiint"); + (l instanceof x0 || w) && (k = X(-l.italic)); + } + var E; + if (s && o) { + c = Math.max(c, b, s.depth + 0.25 * u.xHeight), d = Math.max(d, u.sub2); + var S = u.defaultRuleThickness, T = 4 * S; + if (c - s.depth - (o.height - d) < T) { + d = T - (c - s.depth) + o.height; + var C = 0.8 * u.xHeight - (c - s.depth); + C > 0 && (c += C, d -= C); + } + var F = [{ + type: "elem", + elem: o, + shift: d, + marginRight: y, + marginLeft: k + }, { + type: "elem", + elem: s, + shift: -c, + marginRight: y + }]; + E = R.makeVList({ + positionType: "individualShift", + children: F + }, e); + } else if (o) { + d = Math.max(d, u.sub1, o.height - 0.8 * u.xHeight); + var B = [{ + type: "elem", + elem: o, + marginLeft: k, + marginRight: y + }]; + E = R.makeVList({ + positionType: "shift", + positionData: d, + children: B + }, e); + } else if (s) + c = Math.max(c, b, s.depth + 0.25 * u.xHeight), E = R.makeVList({ + positionType: "shift", + positionData: -c, + children: [{ + type: "elem", + elem: s, + marginRight: y + }] + }, e); + else + throw new Error("supsub must have either sup or sub."); + var I = Jo(l, "right") || "mord"; + return R.makeSpan([I], [l, R.makeSpan(["msupsub"], [E])], e); + }, + mathmlBuilder(n, e) { + var t = !1, r, a; + n.base && n.base.type === "horizBrace" && (a = !!n.sup, a === n.base.isOver && (t = !0, r = n.base.isOver)), n.base && (n.base.type === "op" || n.base.type === "operatorname") && (n.base.parentIsSupSub = !0); + var i = [Ie(n.base, e)]; + n.sub && i.push(Ie(n.sub, e)), n.sup && i.push(Ie(n.sup, e)); + var l; + if (t) + l = r ? "mover" : "munder"; + else if (n.sub) + if (n.sup) { + var u = n.base; + u && u.type === "op" && u.limits && e.style === ae.DISPLAY || u && u.type === "operatorname" && u.alwaysHandleSupSub && (e.style === ae.DISPLAY || u.limits) ? l = "munderover" : l = "msubsup"; + } else { + var o = n.base; + o && o.type === "op" && o.limits && (e.style === ae.DISPLAY || o.alwaysHandleSupSub) || o && o.type === "operatorname" && o.alwaysHandleSupSub && (o.limits || e.style === ae.DISPLAY) ? l = "munder" : l = "msub"; + } + else { + var s = n.base; + s && s.type === "op" && s.limits && (e.style === ae.DISPLAY || s.alwaysHandleSupSub) || s && s.type === "operatorname" && s.alwaysHandleSupSub && (s.limits || e.style === ae.DISPLAY) ? l = "mover" : l = "msup"; + } + return new U.MathNode(l, i); + } +}); +Bn({ + type: "atom", + htmlBuilder(n, e) { + return R.mathsym(n.text, n.mode, e, ["m" + n.family]); + }, + mathmlBuilder(n, e) { + var t = new U.MathNode("mo", [T0(n.text, n.mode)]); + if (n.family === "bin") { + var r = Bu(n, e); + r === "bold-italic" && t.setAttribute("mathvariant", r); + } else n.family === "punct" ? t.setAttribute("separator", "true") : (n.family === "open" || n.family === "close") && t.setAttribute("stretchy", "false"); + return t; + } +}); +var d4 = { + mi: "italic", + mn: "normal", + mtext: "normal" +}; +Bn({ + type: "mathord", + htmlBuilder(n, e) { + return R.makeOrd(n, e, "mathord"); + }, + mathmlBuilder(n, e) { + var t = new U.MathNode("mi", [T0(n.text, n.mode, e)]), r = Bu(n, e) || "italic"; + return r !== d4[t.type] && t.setAttribute("mathvariant", r), t; + } +}); +Bn({ + type: "textord", + htmlBuilder(n, e) { + return R.makeOrd(n, e, "textord"); + }, + mathmlBuilder(n, e) { + var t = T0(n.text, n.mode, e), r = Bu(n, e) || "normal", a; + return n.mode === "text" ? a = new U.MathNode("mtext", [t]) : /[0-9]/.test(n.text) ? a = new U.MathNode("mn", [t]) : n.text === "\\prime" ? a = new U.MathNode("mo", [t]) : a = new U.MathNode("mi", [t]), r !== d4[a.type] && a.setAttribute("mathvariant", r), a; + } +}); +var io = { + "\\nobreak": "nobreak", + "\\allowbreak": "allowbreak" +}, lo = { + " ": {}, + "\\ ": {}, + "~": { + className: "nobreak" + }, + "\\space": {}, + "\\nobreakspace": { + className: "nobreak" + } +}; +Bn({ + type: "spacing", + htmlBuilder(n, e) { + if (lo.hasOwnProperty(n.text)) { + var t = lo[n.text].className || ""; + if (n.mode === "text") { + var r = R.makeOrd(n, e, "textord"); + return r.classes.push(t), r; + } else + return R.makeSpan(["mspace", t], [R.mathsym(n.text, n.mode, e)], e); + } else { + if (io.hasOwnProperty(n.text)) + return R.makeSpan(["mspace", io[n.text]], [], e); + throw new G('Unknown type of space "' + n.text + '"'); + } + }, + mathmlBuilder(n, e) { + var t; + if (lo.hasOwnProperty(n.text)) + t = new U.MathNode("mtext", [new U.TextNode(" ")]); + else { + if (io.hasOwnProperty(n.text)) + return new U.MathNode("mspace"); + throw new G('Unknown type of space "' + n.text + '"'); + } + return t; + } +}); +var _c = () => { + var n = new U.MathNode("mtd", []); + return n.setAttribute("width", "50%"), n; +}; +Bn({ + type: "tag", + mathmlBuilder(n, e) { + var t = new U.MathNode("mtable", [new U.MathNode("mtr", [_c(), new U.MathNode("mtd", [cn(n.body, e)]), _c(), new U.MathNode("mtd", [cn(n.tag, e)])])]); + return t.setAttribute("width", "100%"), t; + } +}); +var vc = { + "\\text": void 0, + "\\textrm": "textrm", + "\\textsf": "textsf", + "\\texttt": "texttt", + "\\textnormal": "textrm" +}, bc = { + "\\textbf": "textbf", + "\\textmd": "textmd" +}, c6 = { + "\\textit": "textit", + "\\textup": "textup" +}, wc = (n, e) => { + var t = n.font; + if (t) { + if (vc[t]) + return e.withTextFontFamily(vc[t]); + if (bc[t]) + return e.withTextFontWeight(bc[t]); + if (t === "\\emph") + return e.fontShape === "textit" ? e.withTextFontShape("textup") : e.withTextFontShape("textit"); + } else return e; + return e.withTextFontShape(c6[t]); +}; +Y({ + type: "text", + names: [ + // Font families + "\\text", + "\\textrm", + "\\textsf", + "\\texttt", + "\\textnormal", + // Font weights + "\\textbf", + "\\textmd", + // Font Shapes + "\\textit", + "\\textup", + "\\emph" + ], + props: { + numArgs: 1, + argTypes: ["text"], + allowedInArgument: !0, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t, + funcName: r + } = n, a = e[0]; + return { + type: "text", + mode: t.mode, + body: tt(a), + font: r + }; + }, + htmlBuilder(n, e) { + var t = wc(n, e), r = gt(n.body, t, !0); + return R.makeSpan(["mord", "text"], r, t); + }, + mathmlBuilder(n, e) { + var t = wc(n, e); + return cn(n.body, t); + } +}); +Y({ + type: "underline", + names: ["\\underline"], + props: { + numArgs: 1, + allowedInText: !0 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "underline", + mode: t.mode, + body: e[0] + }; + }, + htmlBuilder(n, e) { + var t = Se(n.body, e), r = R.makeLineSpan("underline-line", e), a = e.fontMetrics().defaultRuleThickness, i = R.makeVList({ + positionType: "top", + positionData: t.height, + children: [{ + type: "kern", + size: a + }, { + type: "elem", + elem: r + }, { + type: "kern", + size: 3 * a + }, { + type: "elem", + elem: t + }] + }, e); + return R.makeSpan(["mord", "underline"], [i], e); + }, + mathmlBuilder(n, e) { + var t = new U.MathNode("mo", [new U.TextNode("‾")]); + t.setAttribute("stretchy", "true"); + var r = new U.MathNode("munder", [Ie(n.body, e), t]); + return r.setAttribute("accentunder", "true"), r; + } +}); +Y({ + type: "vcenter", + names: ["\\vcenter"], + props: { + numArgs: 1, + argTypes: ["original"], + // In LaTeX, \vcenter can act only on a box. + allowedInText: !1 + }, + handler(n, e) { + var { + parser: t + } = n; + return { + type: "vcenter", + mode: t.mode, + body: e[0] + }; + }, + htmlBuilder(n, e) { + var t = Se(n.body, e), r = e.fontMetrics().axisHeight, a = 0.5 * (t.height - r - (t.depth + r)); + return R.makeVList({ + positionType: "shift", + positionData: a, + children: [{ + type: "elem", + elem: t + }] + }, e); + }, + mathmlBuilder(n, e) { + return new U.MathNode("mpadded", [Ie(n.body, e)], ["vcenter"]); + } +}); +Y({ + type: "verb", + names: ["\\verb"], + props: { + numArgs: 0, + allowedInText: !0 + }, + handler(n, e, t) { + throw new G("\\verb ended by end of line instead of matching delimiter"); + }, + htmlBuilder(n, e) { + for (var t = yc(n), r = [], a = e.havingStyle(e.style.text()), i = 0; i < t.length; i++) { + var l = t[i]; + l === "~" && (l = "\\textasciitilde"), r.push(R.makeSymbol(l, "Typewriter-Regular", n.mode, a, ["mord", "texttt"])); + } + return R.makeSpan(["mord", "text"].concat(a.sizingClasses(e)), R.tryCombineChars(r), a); + }, + mathmlBuilder(n, e) { + var t = new U.TextNode(yc(n)), r = new U.MathNode("mtext", [t]); + return r.setAttribute("mathvariant", "monospace"), r; + } +}); +var yc = (n) => n.body.replace(/ /g, n.star ? "␣" : " "), an = Nd, m4 = `[ \r + ]`, f6 = "\\\\[a-zA-Z@]+", h6 = "\\\\[^\uD800-\uDFFF]", d6 = "(" + f6 + ")" + m4 + "*", m6 = `\\\\( +|[ \r ]+ +?)[ \r ]*`, tu = "[̀-ͯ]", p6 = new RegExp(tu + "+$"), g6 = "(" + m4 + "+)|" + // whitespace +(m6 + "|") + // \whitespace +"([!-\\[\\]-‧‪-퟿豈-￿]" + // single codepoint +(tu + "*") + // ...plus accents +"|[\uD800-\uDBFF][\uDC00-\uDFFF]" + // surrogate pair +(tu + "*") + // ...plus accents +"|\\\\verb\\*([^]).*?\\4|\\\\verb([^*a-zA-Z]).*?\\5" + // \verb unstarred +("|" + d6) + // \macroName + spaces +("|" + h6 + ")"); +class kc { + // Category codes. The lexer only supports comment characters (14) for now. + // MacroExpander additionally distinguishes active (13). + constructor(e, t) { + this.input = void 0, this.settings = void 0, this.tokenRegex = void 0, this.catcodes = void 0, this.input = e, this.settings = t, this.tokenRegex = new RegExp(g6, "g"), this.catcodes = { + "%": 14, + // comment character + "~": 13 + // active character + }; + } + setCatcode(e, t) { + this.catcodes[e] = t; + } + /** + * This function lexes a single token. + */ + lex() { + var e = this.input, t = this.tokenRegex.lastIndex; + if (t === e.length) + return new S0("EOF", new u0(this, t, t)); + var r = this.tokenRegex.exec(e); + if (r === null || r.index !== t) + throw new G("Unexpected character: '" + e[t] + "'", new S0(e[t], new u0(this, t, t + 1))); + var a = r[6] || r[3] || (r[2] ? "\\ " : " "); + if (this.catcodes[a] === 14) { + var i = e.indexOf(` +`, this.tokenRegex.lastIndex); + return i === -1 ? (this.tokenRegex.lastIndex = e.length, this.settings.reportNonstrict("commentAtEnd", "% comment has no terminating newline; LaTeX would fail because of commenting the end of math mode (e.g. $)")) : this.tokenRegex.lastIndex = i + 1, this.lex(); + } + return new S0(a, new u0(this, t, this.tokenRegex.lastIndex)); + } +} +class _6 { + /** + * Both arguments are optional. The first argument is an object of + * built-in mappings which never change. The second argument is an object + * of initial (global-level) mappings, which will constantly change + * according to any global/top-level `set`s done. + */ + constructor(e, t) { + e === void 0 && (e = {}), t === void 0 && (t = {}), this.current = void 0, this.builtins = void 0, this.undefStack = void 0, this.current = t, this.builtins = e, this.undefStack = []; + } + /** + * Start a new nested group, affecting future local `set`s. + */ + beginGroup() { + this.undefStack.push({}); + } + /** + * End current nested group, restoring values before the group began. + */ + endGroup() { + if (this.undefStack.length === 0) + throw new G("Unbalanced namespace destruction: attempt to pop global namespace; please report this as a bug"); + var e = this.undefStack.pop(); + for (var t in e) + e.hasOwnProperty(t) && (e[t] == null ? delete this.current[t] : this.current[t] = e[t]); + } + /** + * Ends all currently nested groups (if any), restoring values before the + * groups began. Useful in case of an error in the middle of parsing. + */ + endGroups() { + for (; this.undefStack.length > 0; ) + this.endGroup(); + } + /** + * Detect whether `name` has a definition. Equivalent to + * `get(name) != null`. + */ + has(e) { + return this.current.hasOwnProperty(e) || this.builtins.hasOwnProperty(e); + } + /** + * Get the current value of a name, or `undefined` if there is no value. + * + * Note: Do not use `if (namespace.get(...))` to detect whether a macro + * is defined, as the definition may be the empty string which evaluates + * to `false` in JavaScript. Use `if (namespace.get(...) != null)` or + * `if (namespace.has(...))`. + */ + get(e) { + return this.current.hasOwnProperty(e) ? this.current[e] : this.builtins[e]; + } + /** + * Set the current value of a name, and optionally set it globally too. + * Local set() sets the current value and (when appropriate) adds an undo + * operation to the undo stack. Global set() may change the undo + * operation at every level, so takes time linear in their number. + * A value of undefined means to delete existing definitions. + */ + set(e, t, r) { + if (r === void 0 && (r = !1), r) { + for (var a = 0; a < this.undefStack.length; a++) + delete this.undefStack[a][e]; + this.undefStack.length > 0 && (this.undefStack[this.undefStack.length - 1][e] = t); + } else { + var i = this.undefStack[this.undefStack.length - 1]; + i && !i.hasOwnProperty(e) && (i[e] = this.current[e]); + } + t == null ? delete this.current[e] : this.current[e] = t; + } +} +var v6 = n4; +v("\\noexpand", function(n) { + var e = n.popToken(); + return n.isExpandable(e.text) && (e.noexpand = !0, e.treatAsRelax = !0), { + tokens: [e], + numArgs: 0 + }; +}); +v("\\expandafter", function(n) { + var e = n.popToken(); + return n.expandOnce(!0), { + tokens: [e], + numArgs: 0 + }; +}); +v("\\@firstoftwo", function(n) { + var e = n.consumeArgs(2); + return { + tokens: e[0], + numArgs: 0 + }; +}); +v("\\@secondoftwo", function(n) { + var e = n.consumeArgs(2); + return { + tokens: e[1], + numArgs: 0 + }; +}); +v("\\@ifnextchar", function(n) { + var e = n.consumeArgs(3); + n.consumeSpaces(); + var t = n.future(); + return e[0].length === 1 && e[0][0].text === t.text ? { + tokens: e[1], + numArgs: 0 + } : { + tokens: e[2], + numArgs: 0 + }; +}); +v("\\@ifstar", "\\@ifnextchar *{\\@firstoftwo{#1}}"); +v("\\TextOrMath", function(n) { + var e = n.consumeArgs(2); + return n.mode === "text" ? { + tokens: e[0], + numArgs: 0 + } : { + tokens: e[1], + numArgs: 0 + }; +}); +var Dc = { + 0: 0, + 1: 1, + 2: 2, + 3: 3, + 4: 4, + 5: 5, + 6: 6, + 7: 7, + 8: 8, + 9: 9, + a: 10, + A: 10, + b: 11, + B: 11, + c: 12, + C: 12, + d: 13, + D: 13, + e: 14, + E: 14, + f: 15, + F: 15 +}; +v("\\char", function(n) { + var e = n.popToken(), t, r = ""; + if (e.text === "'") + t = 8, e = n.popToken(); + else if (e.text === '"') + t = 16, e = n.popToken(); + else if (e.text === "`") + if (e = n.popToken(), e.text[0] === "\\") + r = e.text.charCodeAt(1); + else { + if (e.text === "EOF") + throw new G("\\char` missing argument"); + r = e.text.charCodeAt(0); + } + else + t = 10; + if (t) { + if (r = Dc[e.text], r == null || r >= t) + throw new G("Invalid base-" + t + " digit " + e.text); + for (var a; (a = Dc[n.future().text]) != null && a < t; ) + r *= t, r += a, n.popToken(); + } + return "\\@char{" + r + "}"; +}); +var Vu = (n, e, t) => { + var r = n.consumeArg().tokens; + if (r.length !== 1) + throw new G("\\newcommand's first argument must be a macro name"); + var a = r[0].text, i = n.isDefined(a); + if (i && !e) + throw new G("\\newcommand{" + a + "} attempting to redefine " + (a + "; use \\renewcommand")); + if (!i && !t) + throw new G("\\renewcommand{" + a + "} when command " + a + " does not yet exist; use \\newcommand"); + var l = 0; + if (r = n.consumeArg().tokens, r.length === 1 && r[0].text === "[") { + for (var s = "", o = n.expandNextToken(); o.text !== "]" && o.text !== "EOF"; ) + s += o.text, o = n.expandNextToken(); + if (!s.match(/^\s*[0-9]+\s*$/)) + throw new G("Invalid number of arguments: " + s); + l = parseInt(s), r = n.consumeArg().tokens; + } + return n.macros.set(a, { + tokens: r, + numArgs: l + }), ""; +}; +v("\\newcommand", (n) => Vu(n, !1, !0)); +v("\\renewcommand", (n) => Vu(n, !0, !1)); +v("\\providecommand", (n) => Vu(n, !0, !0)); +v("\\message", (n) => { + var e = n.consumeArgs(1)[0]; + return console.log(e.reverse().map((t) => t.text).join("")), ""; +}); +v("\\errmessage", (n) => { + var e = n.consumeArgs(1)[0]; + return console.error(e.reverse().map((t) => t.text).join("")), ""; +}); +v("\\show", (n) => { + var e = n.popToken(), t = e.text; + return console.log(e, n.macros.get(t), an[t], Ne.math[t], Ne.text[t]), ""; +}); +v("\\bgroup", "{"); +v("\\egroup", "}"); +v("~", "\\nobreakspace"); +v("\\lq", "`"); +v("\\rq", "'"); +v("\\aa", "\\r a"); +v("\\AA", "\\r A"); +v("\\textcopyright", "\\html@mathml{\\textcircled{c}}{\\char`©}"); +v("\\copyright", "\\TextOrMath{\\textcopyright}{\\text{\\textcopyright}}"); +v("\\textregistered", "\\html@mathml{\\textcircled{\\scriptsize R}}{\\char`®}"); +v("ℬ", "\\mathscr{B}"); +v("ℰ", "\\mathscr{E}"); +v("ℱ", "\\mathscr{F}"); +v("ℋ", "\\mathscr{H}"); +v("ℐ", "\\mathscr{I}"); +v("ℒ", "\\mathscr{L}"); +v("ℳ", "\\mathscr{M}"); +v("ℛ", "\\mathscr{R}"); +v("ℭ", "\\mathfrak{C}"); +v("ℌ", "\\mathfrak{H}"); +v("ℨ", "\\mathfrak{Z}"); +v("\\Bbbk", "\\Bbb{k}"); +v("·", "\\cdotp"); +v("\\llap", "\\mathllap{\\textrm{#1}}"); +v("\\rlap", "\\mathrlap{\\textrm{#1}}"); +v("\\clap", "\\mathclap{\\textrm{#1}}"); +v("\\mathstrut", "\\vphantom{(}"); +v("\\underbar", "\\underline{\\text{#1}}"); +v("\\not", '\\html@mathml{\\mathrel{\\mathrlap\\@not}}{\\char"338}'); +v("\\neq", "\\html@mathml{\\mathrel{\\not=}}{\\mathrel{\\char`≠}}"); +v("\\ne", "\\neq"); +v("≠", "\\neq"); +v("\\notin", "\\html@mathml{\\mathrel{{\\in}\\mathllap{/\\mskip1mu}}}{\\mathrel{\\char`∉}}"); +v("∉", "\\notin"); +v("≘", "\\html@mathml{\\mathrel{=\\kern{-1em}\\raisebox{0.4em}{$\\scriptsize\\frown$}}}{\\mathrel{\\char`≘}}"); +v("≙", "\\html@mathml{\\stackrel{\\tiny\\wedge}{=}}{\\mathrel{\\char`≘}}"); +v("≚", "\\html@mathml{\\stackrel{\\tiny\\vee}{=}}{\\mathrel{\\char`≚}}"); +v("≛", "\\html@mathml{\\stackrel{\\scriptsize\\star}{=}}{\\mathrel{\\char`≛}}"); +v("≝", "\\html@mathml{\\stackrel{\\tiny\\mathrm{def}}{=}}{\\mathrel{\\char`≝}}"); +v("≞", "\\html@mathml{\\stackrel{\\tiny\\mathrm{m}}{=}}{\\mathrel{\\char`≞}}"); +v("≟", "\\html@mathml{\\stackrel{\\tiny?}{=}}{\\mathrel{\\char`≟}}"); +v("⟂", "\\perp"); +v("‼", "\\mathclose{!\\mkern-0.8mu!}"); +v("∌", "\\notni"); +v("⌜", "\\ulcorner"); +v("⌝", "\\urcorner"); +v("⌞", "\\llcorner"); +v("⌟", "\\lrcorner"); +v("©", "\\copyright"); +v("®", "\\textregistered"); +v("️", "\\textregistered"); +v("\\ulcorner", '\\html@mathml{\\@ulcorner}{\\mathop{\\char"231c}}'); +v("\\urcorner", '\\html@mathml{\\@urcorner}{\\mathop{\\char"231d}}'); +v("\\llcorner", '\\html@mathml{\\@llcorner}{\\mathop{\\char"231e}}'); +v("\\lrcorner", '\\html@mathml{\\@lrcorner}{\\mathop{\\char"231f}}'); +v("\\vdots", "\\mathord{\\varvdots\\rule{0pt}{15pt}}"); +v("⋮", "\\vdots"); +v("\\varGamma", "\\mathit{\\Gamma}"); +v("\\varDelta", "\\mathit{\\Delta}"); +v("\\varTheta", "\\mathit{\\Theta}"); +v("\\varLambda", "\\mathit{\\Lambda}"); +v("\\varXi", "\\mathit{\\Xi}"); +v("\\varPi", "\\mathit{\\Pi}"); +v("\\varSigma", "\\mathit{\\Sigma}"); +v("\\varUpsilon", "\\mathit{\\Upsilon}"); +v("\\varPhi", "\\mathit{\\Phi}"); +v("\\varPsi", "\\mathit{\\Psi}"); +v("\\varOmega", "\\mathit{\\Omega}"); +v("\\substack", "\\begin{subarray}{c}#1\\end{subarray}"); +v("\\colon", "\\nobreak\\mskip2mu\\mathpunct{}\\mathchoice{\\mkern-3mu}{\\mkern-3mu}{}{}{:}\\mskip6mu\\relax"); +v("\\boxed", "\\fbox{$\\displaystyle{#1}$}"); +v("\\iff", "\\DOTSB\\;\\Longleftrightarrow\\;"); +v("\\implies", "\\DOTSB\\;\\Longrightarrow\\;"); +v("\\impliedby", "\\DOTSB\\;\\Longleftarrow\\;"); +var Ac = { + ",": "\\dotsc", + "\\not": "\\dotsb", + // \keybin@ checks for the following: + "+": "\\dotsb", + "=": "\\dotsb", + "<": "\\dotsb", + ">": "\\dotsb", + "-": "\\dotsb", + "*": "\\dotsb", + ":": "\\dotsb", + // Symbols whose definition starts with \DOTSB: + "\\DOTSB": "\\dotsb", + "\\coprod": "\\dotsb", + "\\bigvee": "\\dotsb", + "\\bigwedge": "\\dotsb", + "\\biguplus": "\\dotsb", + "\\bigcap": "\\dotsb", + "\\bigcup": "\\dotsb", + "\\prod": "\\dotsb", + "\\sum": "\\dotsb", + "\\bigotimes": "\\dotsb", + "\\bigoplus": "\\dotsb", + "\\bigodot": "\\dotsb", + "\\bigsqcup": "\\dotsb", + "\\And": "\\dotsb", + "\\longrightarrow": "\\dotsb", + "\\Longrightarrow": "\\dotsb", + "\\longleftarrow": "\\dotsb", + "\\Longleftarrow": "\\dotsb", + "\\longleftrightarrow": "\\dotsb", + "\\Longleftrightarrow": "\\dotsb", + "\\mapsto": "\\dotsb", + "\\longmapsto": "\\dotsb", + "\\hookrightarrow": "\\dotsb", + "\\doteq": "\\dotsb", + // Symbols whose definition starts with \mathbin: + "\\mathbin": "\\dotsb", + // Symbols whose definition starts with \mathrel: + "\\mathrel": "\\dotsb", + "\\relbar": "\\dotsb", + "\\Relbar": "\\dotsb", + "\\xrightarrow": "\\dotsb", + "\\xleftarrow": "\\dotsb", + // Symbols whose definition starts with \DOTSI: + "\\DOTSI": "\\dotsi", + "\\int": "\\dotsi", + "\\oint": "\\dotsi", + "\\iint": "\\dotsi", + "\\iiint": "\\dotsi", + "\\iiiint": "\\dotsi", + "\\idotsint": "\\dotsi", + // Symbols whose definition starts with \DOTSX: + "\\DOTSX": "\\dotsx" +}; +v("\\dots", function(n) { + var e = "\\dotso", t = n.expandAfterFuture().text; + return t in Ac ? e = Ac[t] : (t.slice(0, 4) === "\\not" || t in Ne.math && re.contains(["bin", "rel"], Ne.math[t].group)) && (e = "\\dotsb"), e; +}); +var Gu = { + // \rightdelim@ checks for the following: + ")": !0, + "]": !0, + "\\rbrack": !0, + "\\}": !0, + "\\rbrace": !0, + "\\rangle": !0, + "\\rceil": !0, + "\\rfloor": !0, + "\\rgroup": !0, + "\\rmoustache": !0, + "\\right": !0, + "\\bigr": !0, + "\\biggr": !0, + "\\Bigr": !0, + "\\Biggr": !0, + // \extra@ also tests for the following: + $: !0, + // \extrap@ checks for the following: + ";": !0, + ".": !0, + ",": !0 +}; +v("\\dotso", function(n) { + var e = n.future().text; + return e in Gu ? "\\ldots\\," : "\\ldots"; +}); +v("\\dotsc", function(n) { + var e = n.future().text; + return e in Gu && e !== "," ? "\\ldots\\," : "\\ldots"; +}); +v("\\cdots", function(n) { + var e = n.future().text; + return e in Gu ? "\\@cdots\\," : "\\@cdots"; +}); +v("\\dotsb", "\\cdots"); +v("\\dotsm", "\\cdots"); +v("\\dotsi", "\\!\\cdots"); +v("\\dotsx", "\\ldots\\,"); +v("\\DOTSI", "\\relax"); +v("\\DOTSB", "\\relax"); +v("\\DOTSX", "\\relax"); +v("\\tmspace", "\\TextOrMath{\\kern#1#3}{\\mskip#1#2}\\relax"); +v("\\,", "\\tmspace+{3mu}{.1667em}"); +v("\\thinspace", "\\,"); +v("\\>", "\\mskip{4mu}"); +v("\\:", "\\tmspace+{4mu}{.2222em}"); +v("\\medspace", "\\:"); +v("\\;", "\\tmspace+{5mu}{.2777em}"); +v("\\thickspace", "\\;"); +v("\\!", "\\tmspace-{3mu}{.1667em}"); +v("\\negthinspace", "\\!"); +v("\\negmedspace", "\\tmspace-{4mu}{.2222em}"); +v("\\negthickspace", "\\tmspace-{5mu}{.277em}"); +v("\\enspace", "\\kern.5em "); +v("\\enskip", "\\hskip.5em\\relax"); +v("\\quad", "\\hskip1em\\relax"); +v("\\qquad", "\\hskip2em\\relax"); +v("\\tag", "\\@ifstar\\tag@literal\\tag@paren"); +v("\\tag@paren", "\\tag@literal{({#1})}"); +v("\\tag@literal", (n) => { + if (n.macros.get("\\df@tag")) + throw new G("Multiple \\tag"); + return "\\gdef\\df@tag{\\text{#1}}"; +}); +v("\\bmod", "\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}\\mathbin{\\rm mod}\\mathchoice{\\mskip1mu}{\\mskip1mu}{\\mskip5mu}{\\mskip5mu}"); +v("\\pod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern8mu}{\\mkern8mu}{\\mkern8mu}(#1)"); +v("\\pmod", "\\pod{{\\rm mod}\\mkern6mu#1}"); +v("\\mod", "\\allowbreak\\mathchoice{\\mkern18mu}{\\mkern12mu}{\\mkern12mu}{\\mkern12mu}{\\rm mod}\\,\\,#1"); +v("\\newline", "\\\\\\relax"); +v("\\TeX", "\\textrm{\\html@mathml{T\\kern-.1667em\\raisebox{-.5ex}{E}\\kern-.125emX}{TeX}}"); +var p4 = X(rr["Main-Regular"][84][1] - 0.7 * rr["Main-Regular"][65][1]); +v("\\LaTeX", "\\textrm{\\html@mathml{" + ("L\\kern-.36em\\raisebox{" + p4 + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{LaTeX}}"); +v("\\KaTeX", "\\textrm{\\html@mathml{" + ("K\\kern-.17em\\raisebox{" + p4 + "}{\\scriptstyle A}") + "\\kern-.15em\\TeX}{KaTeX}}"); +v("\\hspace", "\\@ifstar\\@hspacer\\@hspace"); +v("\\@hspace", "\\hskip #1\\relax"); +v("\\@hspacer", "\\rule{0pt}{0pt}\\hskip #1\\relax"); +v("\\ordinarycolon", ":"); +v("\\vcentcolon", "\\mathrel{\\mathop\\ordinarycolon}"); +v("\\dblcolon", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-.9mu}\\vcentcolon}}{\\mathop{\\char"2237}}'); +v("\\coloneqq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2254}}'); +v("\\Coloneqq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}=}}{\\mathop{\\char"2237\\char"3d}}'); +v("\\coloneq", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"3a\\char"2212}}'); +v("\\Coloneq", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\mathrel{-}}}{\\mathop{\\char"2237\\char"2212}}'); +v("\\eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2255}}'); +v("\\Eqqcolon", '\\html@mathml{\\mathrel{=\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"3d\\char"2237}}'); +v("\\eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\vcentcolon}}{\\mathop{\\char"2239}}'); +v("\\Eqcolon", '\\html@mathml{\\mathrel{\\mathrel{-}\\mathrel{\\mkern-1.2mu}\\dblcolon}}{\\mathop{\\char"2212\\char"2237}}'); +v("\\colonapprox", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"3a\\char"2248}}'); +v("\\Colonapprox", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\approx}}{\\mathop{\\char"2237\\char"2248}}'); +v("\\colonsim", '\\html@mathml{\\mathrel{\\vcentcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"3a\\char"223c}}'); +v("\\Colonsim", '\\html@mathml{\\mathrel{\\dblcolon\\mathrel{\\mkern-1.2mu}\\sim}}{\\mathop{\\char"2237\\char"223c}}'); +v("∷", "\\dblcolon"); +v("∹", "\\eqcolon"); +v("≔", "\\coloneqq"); +v("≕", "\\eqqcolon"); +v("⩴", "\\Coloneqq"); +v("\\ratio", "\\vcentcolon"); +v("\\coloncolon", "\\dblcolon"); +v("\\colonequals", "\\coloneqq"); +v("\\coloncolonequals", "\\Coloneqq"); +v("\\equalscolon", "\\eqqcolon"); +v("\\equalscoloncolon", "\\Eqqcolon"); +v("\\colonminus", "\\coloneq"); +v("\\coloncolonminus", "\\Coloneq"); +v("\\minuscolon", "\\eqcolon"); +v("\\minuscoloncolon", "\\Eqcolon"); +v("\\coloncolonapprox", "\\Colonapprox"); +v("\\coloncolonsim", "\\Colonsim"); +v("\\simcolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +v("\\simcoloncolon", "\\mathrel{\\sim\\mathrel{\\mkern-1.2mu}\\dblcolon}"); +v("\\approxcolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\vcentcolon}"); +v("\\approxcoloncolon", "\\mathrel{\\approx\\mathrel{\\mkern-1.2mu}\\dblcolon}"); +v("\\notni", "\\html@mathml{\\not\\ni}{\\mathrel{\\char`∌}}"); +v("\\limsup", "\\DOTSB\\operatorname*{lim\\,sup}"); +v("\\liminf", "\\DOTSB\\operatorname*{lim\\,inf}"); +v("\\injlim", "\\DOTSB\\operatorname*{inj\\,lim}"); +v("\\projlim", "\\DOTSB\\operatorname*{proj\\,lim}"); +v("\\varlimsup", "\\DOTSB\\operatorname*{\\overline{lim}}"); +v("\\varliminf", "\\DOTSB\\operatorname*{\\underline{lim}}"); +v("\\varinjlim", "\\DOTSB\\operatorname*{\\underrightarrow{lim}}"); +v("\\varprojlim", "\\DOTSB\\operatorname*{\\underleftarrow{lim}}"); +v("\\gvertneqq", "\\html@mathml{\\@gvertneqq}{≩}"); +v("\\lvertneqq", "\\html@mathml{\\@lvertneqq}{≨}"); +v("\\ngeqq", "\\html@mathml{\\@ngeqq}{≱}"); +v("\\ngeqslant", "\\html@mathml{\\@ngeqslant}{≱}"); +v("\\nleqq", "\\html@mathml{\\@nleqq}{≰}"); +v("\\nleqslant", "\\html@mathml{\\@nleqslant}{≰}"); +v("\\nshortmid", "\\html@mathml{\\@nshortmid}{∤}"); +v("\\nshortparallel", "\\html@mathml{\\@nshortparallel}{∦}"); +v("\\nsubseteqq", "\\html@mathml{\\@nsubseteqq}{⊈}"); +v("\\nsupseteqq", "\\html@mathml{\\@nsupseteqq}{⊉}"); +v("\\varsubsetneq", "\\html@mathml{\\@varsubsetneq}{⊊}"); +v("\\varsubsetneqq", "\\html@mathml{\\@varsubsetneqq}{⫋}"); +v("\\varsupsetneq", "\\html@mathml{\\@varsupsetneq}{⊋}"); +v("\\varsupsetneqq", "\\html@mathml{\\@varsupsetneqq}{⫌}"); +v("\\imath", "\\html@mathml{\\@imath}{ı}"); +v("\\jmath", "\\html@mathml{\\@jmath}{ȷ}"); +v("\\llbracket", "\\html@mathml{\\mathopen{[\\mkern-3.2mu[}}{\\mathopen{\\char`⟦}}"); +v("\\rrbracket", "\\html@mathml{\\mathclose{]\\mkern-3.2mu]}}{\\mathclose{\\char`⟧}}"); +v("⟦", "\\llbracket"); +v("⟧", "\\rrbracket"); +v("\\lBrace", "\\html@mathml{\\mathopen{\\{\\mkern-3.2mu[}}{\\mathopen{\\char`⦃}}"); +v("\\rBrace", "\\html@mathml{\\mathclose{]\\mkern-3.2mu\\}}}{\\mathclose{\\char`⦄}}"); +v("⦃", "\\lBrace"); +v("⦄", "\\rBrace"); +v("\\minuso", "\\mathbin{\\html@mathml{{\\mathrlap{\\mathchoice{\\kern{0.145em}}{\\kern{0.145em}}{\\kern{0.1015em}}{\\kern{0.0725em}}\\circ}{-}}}{\\char`⦵}}"); +v("⦵", "\\minuso"); +v("\\darr", "\\downarrow"); +v("\\dArr", "\\Downarrow"); +v("\\Darr", "\\Downarrow"); +v("\\lang", "\\langle"); +v("\\rang", "\\rangle"); +v("\\uarr", "\\uparrow"); +v("\\uArr", "\\Uparrow"); +v("\\Uarr", "\\Uparrow"); +v("\\N", "\\mathbb{N}"); +v("\\R", "\\mathbb{R}"); +v("\\Z", "\\mathbb{Z}"); +v("\\alef", "\\aleph"); +v("\\alefsym", "\\aleph"); +v("\\Alpha", "\\mathrm{A}"); +v("\\Beta", "\\mathrm{B}"); +v("\\bull", "\\bullet"); +v("\\Chi", "\\mathrm{X}"); +v("\\clubs", "\\clubsuit"); +v("\\cnums", "\\mathbb{C}"); +v("\\Complex", "\\mathbb{C}"); +v("\\Dagger", "\\ddagger"); +v("\\diamonds", "\\diamondsuit"); +v("\\empty", "\\emptyset"); +v("\\Epsilon", "\\mathrm{E}"); +v("\\Eta", "\\mathrm{H}"); +v("\\exist", "\\exists"); +v("\\harr", "\\leftrightarrow"); +v("\\hArr", "\\Leftrightarrow"); +v("\\Harr", "\\Leftrightarrow"); +v("\\hearts", "\\heartsuit"); +v("\\image", "\\Im"); +v("\\infin", "\\infty"); +v("\\Iota", "\\mathrm{I}"); +v("\\isin", "\\in"); +v("\\Kappa", "\\mathrm{K}"); +v("\\larr", "\\leftarrow"); +v("\\lArr", "\\Leftarrow"); +v("\\Larr", "\\Leftarrow"); +v("\\lrarr", "\\leftrightarrow"); +v("\\lrArr", "\\Leftrightarrow"); +v("\\Lrarr", "\\Leftrightarrow"); +v("\\Mu", "\\mathrm{M}"); +v("\\natnums", "\\mathbb{N}"); +v("\\Nu", "\\mathrm{N}"); +v("\\Omicron", "\\mathrm{O}"); +v("\\plusmn", "\\pm"); +v("\\rarr", "\\rightarrow"); +v("\\rArr", "\\Rightarrow"); +v("\\Rarr", "\\Rightarrow"); +v("\\real", "\\Re"); +v("\\reals", "\\mathbb{R}"); +v("\\Reals", "\\mathbb{R}"); +v("\\Rho", "\\mathrm{P}"); +v("\\sdot", "\\cdot"); +v("\\sect", "\\S"); +v("\\spades", "\\spadesuit"); +v("\\sub", "\\subset"); +v("\\sube", "\\subseteq"); +v("\\supe", "\\supseteq"); +v("\\Tau", "\\mathrm{T}"); +v("\\thetasym", "\\vartheta"); +v("\\weierp", "\\wp"); +v("\\Zeta", "\\mathrm{Z}"); +v("\\argmin", "\\DOTSB\\operatorname*{arg\\,min}"); +v("\\argmax", "\\DOTSB\\operatorname*{arg\\,max}"); +v("\\plim", "\\DOTSB\\mathop{\\operatorname{plim}}\\limits"); +v("\\bra", "\\mathinner{\\langle{#1}|}"); +v("\\ket", "\\mathinner{|{#1}\\rangle}"); +v("\\braket", "\\mathinner{\\langle{#1}\\rangle}"); +v("\\Bra", "\\left\\langle#1\\right|"); +v("\\Ket", "\\left|#1\\right\\rangle"); +var g4 = (n) => (e) => { + var t = e.consumeArg().tokens, r = e.consumeArg().tokens, a = e.consumeArg().tokens, i = e.consumeArg().tokens, l = e.macros.get("|"), s = e.macros.get("\\|"); + e.macros.beginGroup(); + var o = (d) => (h) => { + n && (h.macros.set("|", l), a.length && h.macros.set("\\|", s)); + var p = d; + if (!d && a.length) { + var _ = h.future(); + _.text === "|" && (h.popToken(), p = !0); + } + return { + tokens: p ? a : r, + numArgs: 0 + }; + }; + e.macros.set("|", o(!1)), a.length && e.macros.set("\\|", o(!0)); + var u = e.consumeArg().tokens, c = e.expandTokens([ + ...i, + ...u, + ...t + // reversed + ]); + return e.macros.endGroup(), { + tokens: c.reverse(), + numArgs: 0 + }; +}; +v("\\bra@ket", g4(!1)); +v("\\bra@set", g4(!0)); +v("\\Braket", "\\bra@ket{\\left\\langle}{\\,\\middle\\vert\\,}{\\,\\middle\\vert\\,}{\\right\\rangle}"); +v("\\Set", "\\bra@set{\\left\\{\\:}{\\;\\middle\\vert\\;}{\\;\\middle\\Vert\\;}{\\:\\right\\}}"); +v("\\set", "\\bra@set{\\{\\,}{\\mid}{}{\\,\\}}"); +v("\\angln", "{\\angl n}"); +v("\\blue", "\\textcolor{##6495ed}{#1}"); +v("\\orange", "\\textcolor{##ffa500}{#1}"); +v("\\pink", "\\textcolor{##ff00af}{#1}"); +v("\\red", "\\textcolor{##df0030}{#1}"); +v("\\green", "\\textcolor{##28ae7b}{#1}"); +v("\\gray", "\\textcolor{gray}{#1}"); +v("\\purple", "\\textcolor{##9d38bd}{#1}"); +v("\\blueA", "\\textcolor{##ccfaff}{#1}"); +v("\\blueB", "\\textcolor{##80f6ff}{#1}"); +v("\\blueC", "\\textcolor{##63d9ea}{#1}"); +v("\\blueD", "\\textcolor{##11accd}{#1}"); +v("\\blueE", "\\textcolor{##0c7f99}{#1}"); +v("\\tealA", "\\textcolor{##94fff5}{#1}"); +v("\\tealB", "\\textcolor{##26edd5}{#1}"); +v("\\tealC", "\\textcolor{##01d1c1}{#1}"); +v("\\tealD", "\\textcolor{##01a995}{#1}"); +v("\\tealE", "\\textcolor{##208170}{#1}"); +v("\\greenA", "\\textcolor{##b6ffb0}{#1}"); +v("\\greenB", "\\textcolor{##8af281}{#1}"); +v("\\greenC", "\\textcolor{##74cf70}{#1}"); +v("\\greenD", "\\textcolor{##1fab54}{#1}"); +v("\\greenE", "\\textcolor{##0d923f}{#1}"); +v("\\goldA", "\\textcolor{##ffd0a9}{#1}"); +v("\\goldB", "\\textcolor{##ffbb71}{#1}"); +v("\\goldC", "\\textcolor{##ff9c39}{#1}"); +v("\\goldD", "\\textcolor{##e07d10}{#1}"); +v("\\goldE", "\\textcolor{##a75a05}{#1}"); +v("\\redA", "\\textcolor{##fca9a9}{#1}"); +v("\\redB", "\\textcolor{##ff8482}{#1}"); +v("\\redC", "\\textcolor{##f9685d}{#1}"); +v("\\redD", "\\textcolor{##e84d39}{#1}"); +v("\\redE", "\\textcolor{##bc2612}{#1}"); +v("\\maroonA", "\\textcolor{##ffbde0}{#1}"); +v("\\maroonB", "\\textcolor{##ff92c6}{#1}"); +v("\\maroonC", "\\textcolor{##ed5fa6}{#1}"); +v("\\maroonD", "\\textcolor{##ca337c}{#1}"); +v("\\maroonE", "\\textcolor{##9e034e}{#1}"); +v("\\purpleA", "\\textcolor{##ddd7ff}{#1}"); +v("\\purpleB", "\\textcolor{##c6b9fc}{#1}"); +v("\\purpleC", "\\textcolor{##aa87ff}{#1}"); +v("\\purpleD", "\\textcolor{##7854ab}{#1}"); +v("\\purpleE", "\\textcolor{##543b78}{#1}"); +v("\\mintA", "\\textcolor{##f5f9e8}{#1}"); +v("\\mintB", "\\textcolor{##edf2df}{#1}"); +v("\\mintC", "\\textcolor{##e0e5cc}{#1}"); +v("\\grayA", "\\textcolor{##f6f7f7}{#1}"); +v("\\grayB", "\\textcolor{##f0f1f2}{#1}"); +v("\\grayC", "\\textcolor{##e3e5e6}{#1}"); +v("\\grayD", "\\textcolor{##d6d8da}{#1}"); +v("\\grayE", "\\textcolor{##babec2}{#1}"); +v("\\grayF", "\\textcolor{##888d93}{#1}"); +v("\\grayG", "\\textcolor{##626569}{#1}"); +v("\\grayH", "\\textcolor{##3b3e40}{#1}"); +v("\\grayI", "\\textcolor{##21242c}{#1}"); +v("\\kaBlue", "\\textcolor{##314453}{#1}"); +v("\\kaGreen", "\\textcolor{##71B307}{#1}"); +var _4 = { + "^": !0, + // Parser.js + _: !0, + // Parser.js + "\\limits": !0, + // Parser.js + "\\nolimits": !0 + // Parser.js +}; +class b6 { + constructor(e, t, r) { + this.settings = void 0, this.expansionCount = void 0, this.lexer = void 0, this.macros = void 0, this.stack = void 0, this.mode = void 0, this.settings = t, this.expansionCount = 0, this.feed(e), this.macros = new _6(v6, t.macros), this.mode = r, this.stack = []; + } + /** + * Feed a new input string to the same MacroExpander + * (with existing macros etc.). + */ + feed(e) { + this.lexer = new kc(e, this.settings); + } + /** + * Switches between "text" and "math" modes. + */ + switchMode(e) { + this.mode = e; + } + /** + * Start a new group nesting within all namespaces. + */ + beginGroup() { + this.macros.beginGroup(); + } + /** + * End current group nesting within all namespaces. + */ + endGroup() { + this.macros.endGroup(); + } + /** + * Ends all currently nested groups (if any), restoring values before the + * groups began. Useful in case of an error in the middle of parsing. + */ + endGroups() { + this.macros.endGroups(); + } + /** + * Returns the topmost token on the stack, without expanding it. + * Similar in behavior to TeX's `\futurelet`. + */ + future() { + return this.stack.length === 0 && this.pushToken(this.lexer.lex()), this.stack[this.stack.length - 1]; + } + /** + * Remove and return the next unexpanded token. + */ + popToken() { + return this.future(), this.stack.pop(); + } + /** + * Add a given token to the token stack. In particular, this get be used + * to put back a token returned from one of the other methods. + */ + pushToken(e) { + this.stack.push(e); + } + /** + * Append an array of tokens to the token stack. + */ + pushTokens(e) { + this.stack.push(...e); + } + /** + * Find an macro argument without expanding tokens and append the array of + * tokens to the token stack. Uses Token as a container for the result. + */ + scanArgument(e) { + var t, r, a; + if (e) { + if (this.consumeSpaces(), this.future().text !== "[") + return null; + t = this.popToken(), { + tokens: a, + end: r + } = this.consumeArg(["]"]); + } else + ({ + tokens: a, + start: t, + end: r + } = this.consumeArg()); + return this.pushToken(new S0("EOF", r.loc)), this.pushTokens(a), t.range(r, ""); + } + /** + * Consume all following space tokens, without expansion. + */ + consumeSpaces() { + for (; ; ) { + var e = this.future(); + if (e.text === " ") + this.stack.pop(); + else + break; + } + } + /** + * Consume an argument from the token stream, and return the resulting array + * of tokens and start/end token. + */ + consumeArg(e) { + var t = [], r = e && e.length > 0; + r || this.consumeSpaces(); + var a = this.future(), i, l = 0, s = 0; + do { + if (i = this.popToken(), t.push(i), i.text === "{") + ++l; + else if (i.text === "}") { + if (--l, l === -1) + throw new G("Extra }", i); + } else if (i.text === "EOF") + throw new G("Unexpected end of input in a macro argument, expected '" + (e && r ? e[s] : "}") + "'", i); + if (e && r) + if ((l === 0 || l === 1 && e[s] === "{") && i.text === e[s]) { + if (++s, s === e.length) { + t.splice(-s, s); + break; + } + } else + s = 0; + } while (l !== 0 || r); + return a.text === "{" && t[t.length - 1].text === "}" && (t.pop(), t.shift()), t.reverse(), { + tokens: t, + start: a, + end: i + }; + } + /** + * Consume the specified number of (delimited) arguments from the token + * stream and return the resulting array of arguments. + */ + consumeArgs(e, t) { + if (t) { + if (t.length !== e + 1) + throw new G("The length of delimiters doesn't match the number of args!"); + for (var r = t[0], a = 0; a < r.length; a++) { + var i = this.popToken(); + if (r[a] !== i.text) + throw new G("Use of the macro doesn't match its definition", i); + } + } + for (var l = [], s = 0; s < e; s++) + l.push(this.consumeArg(t && t[s + 1]).tokens); + return l; + } + /** + * Increment `expansionCount` by the specified amount. + * Throw an error if it exceeds `maxExpand`. + */ + countExpansion(e) { + if (this.expansionCount += e, this.expansionCount > this.settings.maxExpand) + throw new G("Too many expansions: infinite loop or need to increase maxExpand setting"); + } + /** + * Expand the next token only once if possible. + * + * If the token is expanded, the resulting tokens will be pushed onto + * the stack in reverse order, and the number of such tokens will be + * returned. This number might be zero or positive. + * + * If not, the return value is `false`, and the next token remains at the + * top of the stack. + * + * In either case, the next token will be on the top of the stack, + * or the stack will be empty (in case of empty expansion + * and no other tokens). + * + * Used to implement `expandAfterFuture` and `expandNextToken`. + * + * If expandableOnly, only expandable tokens are expanded and + * an undefined control sequence results in an error. + */ + expandOnce(e) { + var t = this.popToken(), r = t.text, a = t.noexpand ? null : this._getExpansion(r); + if (a == null || e && a.unexpandable) { + if (e && a == null && r[0] === "\\" && !this.isDefined(r)) + throw new G("Undefined control sequence: " + r); + return this.pushToken(t), !1; + } + this.countExpansion(1); + var i = a.tokens, l = this.consumeArgs(a.numArgs, a.delimiters); + if (a.numArgs) { + i = i.slice(); + for (var s = i.length - 1; s >= 0; --s) { + var o = i[s]; + if (o.text === "#") { + if (s === 0) + throw new G("Incomplete placeholder at end of macro body", o); + if (o = i[--s], o.text === "#") + i.splice(s + 1, 1); + else if (/^[1-9]$/.test(o.text)) + i.splice(s, 2, ...l[+o.text - 1]); + else + throw new G("Not a valid argument number", o); + } + } + } + return this.pushTokens(i), i.length; + } + /** + * Expand the next token only once (if possible), and return the resulting + * top token on the stack (without removing anything from the stack). + * Similar in behavior to TeX's `\expandafter\futurelet`. + * Equivalent to expandOnce() followed by future(). + */ + expandAfterFuture() { + return this.expandOnce(), this.future(); + } + /** + * Recursively expand first token, then return first non-expandable token. + */ + expandNextToken() { + for (; ; ) + if (this.expandOnce() === !1) { + var e = this.stack.pop(); + return e.treatAsRelax && (e.text = "\\relax"), e; + } + throw new Error(); + } + /** + * Fully expand the given macro name and return the resulting list of + * tokens, or return `undefined` if no such macro is defined. + */ + expandMacro(e) { + return this.macros.has(e) ? this.expandTokens([new S0(e)]) : void 0; + } + /** + * Fully expand the given token stream and return the resulting list of + * tokens. Note that the input tokens are in reverse order, but the + * output tokens are in forward order. + */ + expandTokens(e) { + var t = [], r = this.stack.length; + for (this.pushTokens(e); this.stack.length > r; ) + if (this.expandOnce(!0) === !1) { + var a = this.stack.pop(); + a.treatAsRelax && (a.noexpand = !1, a.treatAsRelax = !1), t.push(a); + } + return this.countExpansion(t.length), t; + } + /** + * Fully expand the given macro name and return the result as a string, + * or return `undefined` if no such macro is defined. + */ + expandMacroAsText(e) { + var t = this.expandMacro(e); + return t && t.map((r) => r.text).join(""); + } + /** + * Returns the expanded macro as a reversed array of tokens and a macro + * argument count. Or returns `null` if no such macro. + */ + _getExpansion(e) { + var t = this.macros.get(e); + if (t == null) + return t; + if (e.length === 1) { + var r = this.lexer.catcodes[e]; + if (r != null && r !== 13) + return; + } + var a = typeof t == "function" ? t(this) : t; + if (typeof a == "string") { + var i = 0; + if (a.indexOf("#") !== -1) + for (var l = a.replace(/##/g, ""); l.indexOf("#" + (i + 1)) !== -1; ) + ++i; + for (var s = new kc(a, this.settings), o = [], u = s.lex(); u.text !== "EOF"; ) + o.push(u), u = s.lex(); + o.reverse(); + var c = { + tokens: o, + numArgs: i + }; + return c; + } + return a; + } + /** + * Determine whether a command is currently "defined" (has some + * functionality), meaning that it's a macro (in the current group), + * a function, a symbol, or one of the special commands listed in + * `implicitCommands`. + */ + isDefined(e) { + return this.macros.has(e) || an.hasOwnProperty(e) || Ne.math.hasOwnProperty(e) || Ne.text.hasOwnProperty(e) || _4.hasOwnProperty(e); + } + /** + * Determine whether a command is expandable. + */ + isExpandable(e) { + var t = this.macros.get(e); + return t != null ? typeof t == "string" || typeof t == "function" || !t.unexpandable : an.hasOwnProperty(e) && !an[e].primitive; + } +} +var Ec = /^[₊₋₌₍₎₀₁₂₃₄₅₆₇₈₉ₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓᵦᵧᵨᵩᵪ]/, Gi = Object.freeze({ + "₊": "+", + "₋": "-", + "₌": "=", + "₍": "(", + "₎": ")", + "₀": "0", + "₁": "1", + "₂": "2", + "₃": "3", + "₄": "4", + "₅": "5", + "₆": "6", + "₇": "7", + "₈": "8", + "₉": "9", + "ₐ": "a", + "ₑ": "e", + "ₕ": "h", + "ᵢ": "i", + "ⱼ": "j", + "ₖ": "k", + "ₗ": "l", + "ₘ": "m", + "ₙ": "n", + "ₒ": "o", + "ₚ": "p", + "ᵣ": "r", + "ₛ": "s", + "ₜ": "t", + "ᵤ": "u", + "ᵥ": "v", + "ₓ": "x", + "ᵦ": "β", + "ᵧ": "γ", + "ᵨ": "ρ", + "ᵩ": "ϕ", + "ᵪ": "χ", + "⁺": "+", + "⁻": "-", + "⁼": "=", + "⁽": "(", + "⁾": ")", + "⁰": "0", + "¹": "1", + "²": "2", + "³": "3", + "⁴": "4", + "⁵": "5", + "⁶": "6", + "⁷": "7", + "⁸": "8", + "⁹": "9", + "ᴬ": "A", + "ᴮ": "B", + "ᴰ": "D", + "ᴱ": "E", + "ᴳ": "G", + "ᴴ": "H", + "ᴵ": "I", + "ᴶ": "J", + "ᴷ": "K", + "ᴸ": "L", + "ᴹ": "M", + "ᴺ": "N", + "ᴼ": "O", + "ᴾ": "P", + "ᴿ": "R", + "ᵀ": "T", + "ᵁ": "U", + "ⱽ": "V", + "ᵂ": "W", + "ᵃ": "a", + "ᵇ": "b", + "ᶜ": "c", + "ᵈ": "d", + "ᵉ": "e", + "ᶠ": "f", + "ᵍ": "g", + ʰ: "h", + "ⁱ": "i", + ʲ: "j", + "ᵏ": "k", + ˡ: "l", + "ᵐ": "m", + ⁿ: "n", + "ᵒ": "o", + "ᵖ": "p", + ʳ: "r", + ˢ: "s", + "ᵗ": "t", + "ᵘ": "u", + "ᵛ": "v", + ʷ: "w", + ˣ: "x", + ʸ: "y", + "ᶻ": "z", + "ᵝ": "β", + "ᵞ": "γ", + "ᵟ": "δ", + "ᵠ": "ϕ", + "ᵡ": "χ", + "ᶿ": "θ" +}), so = { + "́": { + text: "\\'", + math: "\\acute" + }, + "̀": { + text: "\\`", + math: "\\grave" + }, + "̈": { + text: '\\"', + math: "\\ddot" + }, + "̃": { + text: "\\~", + math: "\\tilde" + }, + "̄": { + text: "\\=", + math: "\\bar" + }, + "̆": { + text: "\\u", + math: "\\breve" + }, + "̌": { + text: "\\v", + math: "\\check" + }, + "̂": { + text: "\\^", + math: "\\hat" + }, + "̇": { + text: "\\.", + math: "\\dot" + }, + "̊": { + text: "\\r", + math: "\\mathring" + }, + "̋": { + text: "\\H" + }, + "̧": { + text: "\\c" + } +}, Sc = { + á: "á", + à: "à", + ä: "ä", + ǟ: "ǟ", + ã: "ã", + ā: "ā", + ă: "ă", + ắ: "ắ", + ằ: "ằ", + ẵ: "ẵ", + ǎ: "ǎ", + â: "â", + ấ: "ấ", + ầ: "ầ", + ẫ: "ẫ", + ȧ: "ȧ", + ǡ: "ǡ", + å: "å", + ǻ: "ǻ", + ḃ: "ḃ", + ć: "ć", + ḉ: "ḉ", + č: "č", + ĉ: "ĉ", + ċ: "ċ", + ç: "ç", + ď: "ď", + ḋ: "ḋ", + ḑ: "ḑ", + é: "é", + è: "è", + ë: "ë", + ẽ: "ẽ", + ē: "ē", + ḗ: "ḗ", + ḕ: "ḕ", + ĕ: "ĕ", + ḝ: "ḝ", + ě: "ě", + ê: "ê", + ế: "ế", + ề: "ề", + ễ: "ễ", + ė: "ė", + ȩ: "ȩ", + ḟ: "ḟ", + ǵ: "ǵ", + ḡ: "ḡ", + ğ: "ğ", + ǧ: "ǧ", + ĝ: "ĝ", + ġ: "ġ", + ģ: "ģ", + ḧ: "ḧ", + ȟ: "ȟ", + ĥ: "ĥ", + ḣ: "ḣ", + ḩ: "ḩ", + í: "í", + ì: "ì", + ï: "ï", + ḯ: "ḯ", + ĩ: "ĩ", + ī: "ī", + ĭ: "ĭ", + ǐ: "ǐ", + î: "î", + ǰ: "ǰ", + ĵ: "ĵ", + ḱ: "ḱ", + ǩ: "ǩ", + ķ: "ķ", + ĺ: "ĺ", + ľ: "ľ", + ļ: "ļ", + ḿ: "ḿ", + ṁ: "ṁ", + ń: "ń", + ǹ: "ǹ", + ñ: "ñ", + ň: "ň", + ṅ: "ṅ", + ņ: "ņ", + ó: "ó", + ò: "ò", + ö: "ö", + ȫ: "ȫ", + õ: "õ", + ṍ: "ṍ", + ṏ: "ṏ", + ȭ: "ȭ", + ō: "ō", + ṓ: "ṓ", + ṑ: "ṑ", + ŏ: "ŏ", + ǒ: "ǒ", + ô: "ô", + ố: "ố", + ồ: "ồ", + ỗ: "ỗ", + ȯ: "ȯ", + ȱ: "ȱ", + ő: "ő", + ṕ: "ṕ", + ṗ: "ṗ", + ŕ: "ŕ", + ř: "ř", + ṙ: "ṙ", + ŗ: "ŗ", + ś: "ś", + ṥ: "ṥ", + š: "š", + ṧ: "ṧ", + ŝ: "ŝ", + ṡ: "ṡ", + ş: "ş", + ẗ: "ẗ", + ť: "ť", + ṫ: "ṫ", + ţ: "ţ", + ú: "ú", + ù: "ù", + ü: "ü", + ǘ: "ǘ", + ǜ: "ǜ", + ǖ: "ǖ", + ǚ: "ǚ", + ũ: "ũ", + ṹ: "ṹ", + ū: "ū", + ṻ: "ṻ", + ŭ: "ŭ", + ǔ: "ǔ", + û: "û", + ů: "ů", + ű: "ű", + ṽ: "ṽ", + ẃ: "ẃ", + ẁ: "ẁ", + ẅ: "ẅ", + ŵ: "ŵ", + ẇ: "ẇ", + ẘ: "ẘ", + ẍ: "ẍ", + ẋ: "ẋ", + ý: "ý", + ỳ: "ỳ", + ÿ: "ÿ", + ỹ: "ỹ", + ȳ: "ȳ", + ŷ: "ŷ", + ẏ: "ẏ", + ẙ: "ẙ", + ź: "ź", + ž: "ž", + ẑ: "ẑ", + ż: "ż", + Á: "Á", + À: "À", + Ä: "Ä", + Ǟ: "Ǟ", + Ã: "Ã", + Ā: "Ā", + Ă: "Ă", + Ắ: "Ắ", + Ằ: "Ằ", + Ẵ: "Ẵ", + Ǎ: "Ǎ", + Â: "Â", + Ấ: "Ấ", + Ầ: "Ầ", + Ẫ: "Ẫ", + Ȧ: "Ȧ", + Ǡ: "Ǡ", + Å: "Å", + Ǻ: "Ǻ", + Ḃ: "Ḃ", + Ć: "Ć", + Ḉ: "Ḉ", + Č: "Č", + Ĉ: "Ĉ", + Ċ: "Ċ", + Ç: "Ç", + Ď: "Ď", + Ḋ: "Ḋ", + Ḑ: "Ḑ", + É: "É", + È: "È", + Ë: "Ë", + Ẽ: "Ẽ", + Ē: "Ē", + Ḗ: "Ḗ", + Ḕ: "Ḕ", + Ĕ: "Ĕ", + Ḝ: "Ḝ", + Ě: "Ě", + Ê: "Ê", + Ế: "Ế", + Ề: "Ề", + Ễ: "Ễ", + Ė: "Ė", + Ȩ: "Ȩ", + Ḟ: "Ḟ", + Ǵ: "Ǵ", + Ḡ: "Ḡ", + Ğ: "Ğ", + Ǧ: "Ǧ", + Ĝ: "Ĝ", + Ġ: "Ġ", + Ģ: "Ģ", + Ḧ: "Ḧ", + Ȟ: "Ȟ", + Ĥ: "Ĥ", + Ḣ: "Ḣ", + Ḩ: "Ḩ", + Í: "Í", + Ì: "Ì", + Ï: "Ï", + Ḯ: "Ḯ", + Ĩ: "Ĩ", + Ī: "Ī", + Ĭ: "Ĭ", + Ǐ: "Ǐ", + Î: "Î", + İ: "İ", + Ĵ: "Ĵ", + Ḱ: "Ḱ", + Ǩ: "Ǩ", + Ķ: "Ķ", + Ĺ: "Ĺ", + Ľ: "Ľ", + Ļ: "Ļ", + Ḿ: "Ḿ", + Ṁ: "Ṁ", + Ń: "Ń", + Ǹ: "Ǹ", + Ñ: "Ñ", + Ň: "Ň", + Ṅ: "Ṅ", + Ņ: "Ņ", + Ó: "Ó", + Ò: "Ò", + Ö: "Ö", + Ȫ: "Ȫ", + Õ: "Õ", + Ṍ: "Ṍ", + Ṏ: "Ṏ", + Ȭ: "Ȭ", + Ō: "Ō", + Ṓ: "Ṓ", + Ṑ: "Ṑ", + Ŏ: "Ŏ", + Ǒ: "Ǒ", + Ô: "Ô", + Ố: "Ố", + Ồ: "Ồ", + Ỗ: "Ỗ", + Ȯ: "Ȯ", + Ȱ: "Ȱ", + Ő: "Ő", + Ṕ: "Ṕ", + Ṗ: "Ṗ", + Ŕ: "Ŕ", + Ř: "Ř", + Ṙ: "Ṙ", + Ŗ: "Ŗ", + Ś: "Ś", + Ṥ: "Ṥ", + Š: "Š", + Ṧ: "Ṧ", + Ŝ: "Ŝ", + Ṡ: "Ṡ", + Ş: "Ş", + Ť: "Ť", + Ṫ: "Ṫ", + Ţ: "Ţ", + Ú: "Ú", + Ù: "Ù", + Ü: "Ü", + Ǘ: "Ǘ", + Ǜ: "Ǜ", + Ǖ: "Ǖ", + Ǚ: "Ǚ", + Ũ: "Ũ", + Ṹ: "Ṹ", + Ū: "Ū", + Ṻ: "Ṻ", + Ŭ: "Ŭ", + Ǔ: "Ǔ", + Û: "Û", + Ů: "Ů", + Ű: "Ű", + Ṽ: "Ṽ", + Ẃ: "Ẃ", + Ẁ: "Ẁ", + Ẅ: "Ẅ", + Ŵ: "Ŵ", + Ẇ: "Ẇ", + Ẍ: "Ẍ", + Ẋ: "Ẋ", + Ý: "Ý", + Ỳ: "Ỳ", + Ÿ: "Ÿ", + Ỹ: "Ỹ", + Ȳ: "Ȳ", + Ŷ: "Ŷ", + Ẏ: "Ẏ", + Ź: "Ź", + Ž: "Ž", + Ẑ: "Ẑ", + Ż: "Ż", + ά: "ά", + ὰ: "ὰ", + ᾱ: "ᾱ", + ᾰ: "ᾰ", + έ: "έ", + ὲ: "ὲ", + ή: "ή", + ὴ: "ὴ", + ί: "ί", + ὶ: "ὶ", + ϊ: "ϊ", + ΐ: "ΐ", + ῒ: "ῒ", + ῑ: "ῑ", + ῐ: "ῐ", + ό: "ό", + ὸ: "ὸ", + ύ: "ύ", + ὺ: "ὺ", + ϋ: "ϋ", + ΰ: "ΰ", + ῢ: "ῢ", + ῡ: "ῡ", + ῠ: "ῠ", + ώ: "ώ", + ὼ: "ὼ", + Ύ: "Ύ", + Ὺ: "Ὺ", + Ϋ: "Ϋ", + Ῡ: "Ῡ", + Ῠ: "Ῠ", + Ώ: "Ώ", + Ὼ: "Ὼ" +}; +class ts { + constructor(e, t) { + this.mode = void 0, this.gullet = void 0, this.settings = void 0, this.leftrightDepth = void 0, this.nextToken = void 0, this.mode = "math", this.gullet = new b6(e, t, this.mode), this.settings = t, this.leftrightDepth = 0; + } + /** + * Checks a result to make sure it has the right type, and throws an + * appropriate error otherwise. + */ + expect(e, t) { + if (t === void 0 && (t = !0), this.fetch().text !== e) + throw new G("Expected '" + e + "', got '" + this.fetch().text + "'", this.fetch()); + t && this.consume(); + } + /** + * Discards the current lookahead token, considering it consumed. + */ + consume() { + this.nextToken = null; + } + /** + * Return the current lookahead token, or if there isn't one (at the + * beginning, or if the previous lookahead token was consume()d), + * fetch the next token as the new lookahead token and return it. + */ + fetch() { + return this.nextToken == null && (this.nextToken = this.gullet.expandNextToken()), this.nextToken; + } + /** + * Switches between "text" and "math" modes. + */ + switchMode(e) { + this.mode = e, this.gullet.switchMode(e); + } + /** + * Main parsing function, which parses an entire input. + */ + parse() { + this.settings.globalGroup || this.gullet.beginGroup(), this.settings.colorIsTextColor && this.gullet.macros.set("\\color", "\\textcolor"); + try { + var e = this.parseExpression(!1); + return this.expect("EOF"), this.settings.globalGroup || this.gullet.endGroup(), e; + } finally { + this.gullet.endGroups(); + } + } + /** + * Fully parse a separate sequence of tokens as a separate job. + * Tokens should be specified in reverse order, as in a MacroDefinition. + */ + subparse(e) { + var t = this.nextToken; + this.consume(), this.gullet.pushToken(new S0("}")), this.gullet.pushTokens(e); + var r = this.parseExpression(!1); + return this.expect("}"), this.nextToken = t, r; + } + /** + * Parses an "expression", which is a list of atoms. + * + * `breakOnInfix`: Should the parsing stop when we hit infix nodes? This + * happens when functions have higher precedence han infix + * nodes in implicit parses. + * + * `breakOnTokenText`: The text of the token that the expression should end + * with, or `null` if something else should end the + * expression. + */ + parseExpression(e, t) { + for (var r = []; ; ) { + this.mode === "math" && this.consumeSpaces(); + var a = this.fetch(); + if (ts.endOfExpression.indexOf(a.text) !== -1 || t && a.text === t || e && an[a.text] && an[a.text].infix) + break; + var i = this.parseAtom(t); + if (i) { + if (i.type === "internal") + continue; + } else break; + r.push(i); + } + return this.mode === "text" && this.formLigatures(r), this.handleInfixNodes(r); + } + /** + * Rewrites infix operators such as \over with corresponding commands such + * as \frac. + * + * There can only be one infix operator per group. If there's more than one + * then the expression is ambiguous. This can be resolved by adding {}. + */ + handleInfixNodes(e) { + for (var t = -1, r, a = 0; a < e.length; a++) + if (e[a].type === "infix") { + if (t !== -1) + throw new G("only one infix operator per group", e[a].token); + t = a, r = e[a].replaceWith; + } + if (t !== -1 && r) { + var i, l, s = e.slice(0, t), o = e.slice(t + 1); + s.length === 1 && s[0].type === "ordgroup" ? i = s[0] : i = { + type: "ordgroup", + mode: this.mode, + body: s + }, o.length === 1 && o[0].type === "ordgroup" ? l = o[0] : l = { + type: "ordgroup", + mode: this.mode, + body: o + }; + var u; + return r === "\\\\abovefrac" ? u = this.callFunction(r, [i, e[t], l], []) : u = this.callFunction(r, [i, l], []), [u]; + } else + return e; + } + /** + * Handle a subscript or superscript with nice errors. + */ + handleSupSubscript(e) { + var t = this.fetch(), r = t.text; + this.consume(), this.consumeSpaces(); + var a = this.parseGroup(e); + if (!a) + throw new G("Expected group after '" + r + "'", t); + return a; + } + /** + * Converts the textual input of an unsupported command into a text node + * contained within a color node whose color is determined by errorColor + */ + formatUnsupportedCmd(e) { + for (var t = [], r = 0; r < e.length; r++) + t.push({ + type: "textord", + mode: "text", + text: e[r] + }); + var a = { + type: "text", + mode: this.mode, + body: t + }, i = { + type: "color", + mode: this.mode, + color: this.settings.errorColor, + body: [a] + }; + return i; + } + /** + * Parses a group with optional super/subscripts. + */ + parseAtom(e) { + var t = this.parseGroup("atom", e); + if (this.mode === "text") + return t; + for (var r, a; ; ) { + this.consumeSpaces(); + var i = this.fetch(); + if (i.text === "\\limits" || i.text === "\\nolimits") { + if (t && t.type === "op") { + var l = i.text === "\\limits"; + t.limits = l, t.alwaysHandleSupSub = !0; + } else if (t && t.type === "operatorname") + t.alwaysHandleSupSub && (t.limits = i.text === "\\limits"); + else + throw new G("Limit controls must follow a math operator", i); + this.consume(); + } else if (i.text === "^") { + if (r) + throw new G("Double superscript", i); + r = this.handleSupSubscript("superscript"); + } else if (i.text === "_") { + if (a) + throw new G("Double subscript", i); + a = this.handleSupSubscript("subscript"); + } else if (i.text === "'") { + if (r) + throw new G("Double superscript", i); + var s = { + type: "textord", + mode: this.mode, + text: "\\prime" + }, o = [s]; + for (this.consume(); this.fetch().text === "'"; ) + o.push(s), this.consume(); + this.fetch().text === "^" && o.push(this.handleSupSubscript("superscript")), r = { + type: "ordgroup", + mode: this.mode, + body: o + }; + } else if (Gi[i.text]) { + var u = Ec.test(i.text), c = []; + for (c.push(new S0(Gi[i.text])), this.consume(); ; ) { + var d = this.fetch().text; + if (!Gi[d] || Ec.test(d) !== u) + break; + c.unshift(new S0(Gi[d])), this.consume(); + } + var h = this.subparse(c); + u ? a = { + type: "ordgroup", + mode: "math", + body: h + } : r = { + type: "ordgroup", + mode: "math", + body: h + }; + } else + break; + } + return r || a ? { + type: "supsub", + mode: this.mode, + base: t, + sup: r, + sub: a + } : t; + } + /** + * Parses an entire function, including its base and all of its arguments. + */ + parseFunction(e, t) { + var r = this.fetch(), a = r.text, i = an[a]; + if (!i) + return null; + if (this.consume(), t && t !== "atom" && !i.allowedInArgument) + throw new G("Got function '" + a + "' with no arguments" + (t ? " as " + t : ""), r); + if (this.mode === "text" && !i.allowedInText) + throw new G("Can't use function '" + a + "' in text mode", r); + if (this.mode === "math" && i.allowedInMath === !1) + throw new G("Can't use function '" + a + "' in math mode", r); + var { + args: l, + optArgs: s + } = this.parseArguments(a, i); + return this.callFunction(a, l, s, r, e); + } + /** + * Call a function handler with a suitable context and arguments. + */ + callFunction(e, t, r, a, i) { + var l = { + funcName: e, + parser: this, + token: a, + breakOnTokenText: i + }, s = an[e]; + if (s && s.handler) + return s.handler(l, t, r); + throw new G("No function handler for " + e); + } + /** + * Parses the arguments of a function or environment + */ + parseArguments(e, t) { + var r = t.numArgs + t.numOptionalArgs; + if (r === 0) + return { + args: [], + optArgs: [] + }; + for (var a = [], i = [], l = 0; l < r; l++) { + var s = t.argTypes && t.argTypes[l], o = l < t.numOptionalArgs; + (t.primitive && s == null || // \sqrt expands into primitive if optional argument doesn't exist + t.type === "sqrt" && l === 1 && i[0] == null) && (s = "primitive"); + var u = this.parseGroupOfType("argument to '" + e + "'", s, o); + if (o) + i.push(u); + else if (u != null) + a.push(u); + else + throw new G("Null argument, please report this as a bug"); + } + return { + args: a, + optArgs: i + }; + } + /** + * Parses a group when the mode is changing. + */ + parseGroupOfType(e, t, r) { + switch (t) { + case "color": + return this.parseColorGroup(r); + case "size": + return this.parseSizeGroup(r); + case "url": + return this.parseUrlGroup(r); + case "math": + case "text": + return this.parseArgumentGroup(r, t); + case "hbox": { + var a = this.parseArgumentGroup(r, "text"); + return a != null ? { + type: "styling", + mode: a.mode, + body: [a], + style: "text" + // simulate \textstyle + } : null; + } + case "raw": { + var i = this.parseStringGroup("raw", r); + return i != null ? { + type: "raw", + mode: "text", + string: i.text + } : null; + } + case "primitive": { + if (r) + throw new G("A primitive argument cannot be optional"); + var l = this.parseGroup(e); + if (l == null) + throw new G("Expected group as " + e, this.fetch()); + return l; + } + case "original": + case null: + case void 0: + return this.parseArgumentGroup(r); + default: + throw new G("Unknown group type as " + e, this.fetch()); + } + } + /** + * Discard any space tokens, fetching the next non-space token. + */ + consumeSpaces() { + for (; this.fetch().text === " "; ) + this.consume(); + } + /** + * Parses a group, essentially returning the string formed by the + * brace-enclosed tokens plus some position information. + */ + parseStringGroup(e, t) { + var r = this.gullet.scanArgument(t); + if (r == null) + return null; + for (var a = "", i; (i = this.fetch()).text !== "EOF"; ) + a += i.text, this.consume(); + return this.consume(), r.text = a, r; + } + /** + * Parses a regex-delimited group: the largest sequence of tokens + * whose concatenated strings match `regex`. Returns the string + * formed by the tokens plus some position information. + */ + parseRegexGroup(e, t) { + for (var r = this.fetch(), a = r, i = "", l; (l = this.fetch()).text !== "EOF" && e.test(i + l.text); ) + a = l, i += a.text, this.consume(); + if (i === "") + throw new G("Invalid " + t + ": '" + r.text + "'", r); + return r.range(a, i); + } + /** + * Parses a color description. + */ + parseColorGroup(e) { + var t = this.parseStringGroup("color", e); + if (t == null) + return null; + var r = /^(#[a-f0-9]{3}|#?[a-f0-9]{6}|[a-z]+)$/i.exec(t.text); + if (!r) + throw new G("Invalid color: '" + t.text + "'", t); + var a = r[0]; + return /^[0-9a-f]{6}$/i.test(a) && (a = "#" + a), { + type: "color-token", + mode: this.mode, + color: a + }; + } + /** + * Parses a size specification, consisting of magnitude and unit. + */ + parseSizeGroup(e) { + var t, r = !1; + if (this.gullet.consumeSpaces(), !e && this.gullet.future().text !== "{" ? t = this.parseRegexGroup(/^[-+]? *(?:$|\d+|\d+\.\d*|\.\d*) *[a-z]{0,2} *$/, "size") : t = this.parseStringGroup("size", e), !t) + return null; + !e && t.text.length === 0 && (t.text = "0pt", r = !0); + var a = /([-+]?) *(\d+(?:\.\d*)?|\.\d+) *([a-z]{2})/.exec(t.text); + if (!a) + throw new G("Invalid size: '" + t.text + "'", t); + var i = { + number: +(a[1] + a[2]), + // sign + magnitude, cast to number + unit: a[3] + }; + if (!xd(i)) + throw new G("Invalid unit: '" + i.unit + "'", t); + return { + type: "size", + mode: this.mode, + value: i, + isBlank: r + }; + } + /** + * Parses an URL, checking escaped letters and allowed protocols, + * and setting the catcode of % as an active character (as in \hyperref). + */ + parseUrlGroup(e) { + this.gullet.lexer.setCatcode("%", 13), this.gullet.lexer.setCatcode("~", 12); + var t = this.parseStringGroup("url", e); + if (this.gullet.lexer.setCatcode("%", 14), this.gullet.lexer.setCatcode("~", 13), t == null) + return null; + var r = t.text.replace(/\\([#$%&~_^{}])/g, "$1"); + return { + type: "url", + mode: this.mode, + url: r + }; + } + /** + * Parses an argument with the mode specified. + */ + parseArgumentGroup(e, t) { + var r = this.gullet.scanArgument(e); + if (r == null) + return null; + var a = this.mode; + t && this.switchMode(t), this.gullet.beginGroup(); + var i = this.parseExpression(!1, "EOF"); + this.expect("EOF"), this.gullet.endGroup(); + var l = { + type: "ordgroup", + mode: this.mode, + loc: r.loc, + body: i + }; + return t && this.switchMode(a), l; + } + /** + * Parses an ordinary group, which is either a single nucleus (like "x") + * or an expression in braces (like "{x+y}") or an implicit group, a group + * that starts at the current position, and ends right before a higher explicit + * group ends, or at EOF. + */ + parseGroup(e, t) { + var r = this.fetch(), a = r.text, i; + if (a === "{" || a === "\\begingroup") { + this.consume(); + var l = a === "{" ? "}" : "\\endgroup"; + this.gullet.beginGroup(); + var s = this.parseExpression(!1, l), o = this.fetch(); + this.expect(l), this.gullet.endGroup(), i = { + type: "ordgroup", + mode: this.mode, + loc: u0.range(r, o), + body: s, + // A group formed by \begingroup...\endgroup is a semi-simple group + // which doesn't affect spacing in math mode, i.e., is transparent. + // https://tex.stackexchange.com/questions/1930/when-should-one- + // use-begingroup-instead-of-bgroup + semisimple: a === "\\begingroup" || void 0 + }; + } else if (i = this.parseFunction(t, e) || this.parseSymbol(), i == null && a[0] === "\\" && !_4.hasOwnProperty(a)) { + if (this.settings.throwOnError) + throw new G("Undefined control sequence: " + a, r); + i = this.formatUnsupportedCmd(a), this.consume(); + } + return i; + } + /** + * Form ligature-like combinations of characters for text mode. + * This includes inputs like "--", "---", "``" and "''". + * The result will simply replace multiple textord nodes with a single + * character in each value by a single textord node having multiple + * characters in its value. The representation is still ASCII source. + * The group will be modified in place. + */ + formLigatures(e) { + for (var t = e.length - 1, r = 0; r < t; ++r) { + var a = e[r], i = a.text; + i === "-" && e[r + 1].text === "-" && (r + 1 < t && e[r + 2].text === "-" ? (e.splice(r, 3, { + type: "textord", + mode: "text", + loc: u0.range(a, e[r + 2]), + text: "---" + }), t -= 2) : (e.splice(r, 2, { + type: "textord", + mode: "text", + loc: u0.range(a, e[r + 1]), + text: "--" + }), t -= 1)), (i === "'" || i === "`") && e[r + 1].text === i && (e.splice(r, 2, { + type: "textord", + mode: "text", + loc: u0.range(a, e[r + 1]), + text: i + i + }), t -= 1); + } + } + /** + * Parse a single symbol out of the string. Here, we handle single character + * symbols and special functions like \verb. + */ + parseSymbol() { + var e = this.fetch(), t = e.text; + if (/^\\verb[^a-zA-Z]/.test(t)) { + this.consume(); + var r = t.slice(5), a = r.charAt(0) === "*"; + if (a && (r = r.slice(1)), r.length < 2 || r.charAt(0) !== r.slice(-1)) + throw new G(`\\verb assertion failed -- + please report what input caused this bug`); + return r = r.slice(1, -1), { + type: "verb", + mode: "text", + body: r, + star: a + }; + } + Sc.hasOwnProperty(t[0]) && !Ne[this.mode][t[0]] && (this.settings.strict && this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Accented Unicode text character "' + t[0] + '" used in math mode', e), t = Sc[t[0]] + t.slice(1)); + var i = p6.exec(t); + i && (t = t.substring(0, i.index), t === "i" ? t = "ı" : t === "j" && (t = "ȷ")); + var l; + if (Ne[this.mode][t]) { + this.settings.strict && this.mode === "math" && Ko.indexOf(t) >= 0 && this.settings.reportNonstrict("unicodeTextInMathMode", 'Latin-1/Unicode text character "' + t[0] + '" used in math mode', e); + var s = Ne[this.mode][t].group, o = u0.range(e), u; + if (s3.hasOwnProperty(s)) { + var c = s; + u = { + type: "atom", + mode: this.mode, + family: c, + loc: o, + text: t + }; + } else + u = { + type: s, + mode: this.mode, + loc: o, + text: t + }; + l = u; + } else if (t.charCodeAt(0) >= 128) + this.settings.strict && (Sd(t.charCodeAt(0)) ? this.mode === "math" && this.settings.reportNonstrict("unicodeTextInMathMode", 'Unicode text character "' + t[0] + '" used in math mode', e) : this.settings.reportNonstrict("unknownSymbol", 'Unrecognized Unicode character "' + t[0] + '"' + (" (" + t.charCodeAt(0) + ")"), e)), l = { + type: "textord", + mode: "text", + loc: u0.range(e), + text: t + }; + else + return null; + if (this.consume(), i) + for (var d = 0; d < i[0].length; d++) { + var h = i[0][d]; + if (!so[h]) + throw new G("Unknown accent ' " + h + "'", e); + var p = so[h][this.mode] || so[h].text; + if (!p) + throw new G("Accent " + h + " unsupported in " + this.mode + " mode", e); + l = { + type: "accent", + mode: this.mode, + loc: u0.range(e), + label: p, + isStretchy: !1, + isShifty: !0, + // $FlowFixMe + base: l + }; + } + return l; + } +} +ts.endOfExpression = ["}", "\\endgroup", "\\end", "\\right", "&"]; +var ju = function(e, t) { + if (!(typeof e == "string" || e instanceof String)) + throw new TypeError("KaTeX can only parse string typed expression"); + var r = new ts(e, t); + delete r.gullet.macros.current["\\df@tag"]; + var a = r.parse(); + if (delete r.gullet.macros.current["\\current@color"], delete r.gullet.macros.current["\\color"], r.gullet.macros.get("\\df@tag")) { + if (!t.displayMode) + throw new G("\\tag works only in display equations"); + a = [{ + type: "tag", + mode: "text", + body: a, + tag: r.subparse([new S0("\\df@tag")]) + }]; + } + return a; +}, v4 = function(e, t, r) { + t.textContent = ""; + var a = Wu(e, r).toNode(); + t.appendChild(a); +}; +typeof document < "u" && document.compatMode !== "CSS1Compat" && (typeof console < "u" && console.warn("Warning: KaTeX doesn't work in quirks mode. Make sure your website has a suitable doctype."), v4 = function() { + throw new G("KaTeX doesn't work in quirks mode."); +}); +var w6 = function(e, t) { + var r = Wu(e, t).toMarkup(); + return r; +}, y6 = function(e, t) { + var r = new xu(t); + return ju(e, r); +}, b4 = function(e, t, r) { + if (r.throwOnError || !(e instanceof G)) + throw e; + var a = R.makeSpan(["katex-error"], [new x0(t)]); + return a.setAttribute("title", e.toString()), a.setAttribute("style", "color:" + r.errorColor), a; +}, Wu = function(e, t) { + var r = new xu(t); + try { + var a = ju(e, r); + return F3(a, e, r); + } catch (i) { + return b4(i, e, r); + } +}, k6 = function(e, t) { + var r = new xu(t); + try { + var a = ju(e, r); + return M3(a, e, r); + } catch (i) { + return b4(i, e, r); + } +}, ru = { + /** + * Current KaTeX version + */ + version: "0.16.11", + /** + * Renders the given LaTeX into an HTML+MathML combination, and adds + * it as a child to the specified DOM node. + */ + render: v4, + /** + * Renders the given LaTeX into an HTML+MathML combination string, + * for sending to the client. + */ + renderToString: w6, + /** + * KaTeX error, usually during parsing. + */ + ParseError: G, + /** + * The shema of Settings + */ + SETTINGS_SCHEMA: gl, + /** + * Parses the given LaTeX into KaTeX's internal parse tree structure, + * without rendering to HTML or MathML. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __parse: y6, + /** + * Renders the given LaTeX into an HTML+MathML internal DOM tree + * representation, without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToDomTree: Wu, + /** + * Renders the given LaTeX into an HTML internal DOM tree representation, + * without MathML and without flattening that representation to a string. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __renderToHTMLTree: k6, + /** + * extends internal font metrics object with a new object + * each key in the new object represents a font name + */ + __setFontMetrics: e3, + /** + * adds a new symbol to builtin symbols table + */ + __defineSymbol: f, + /** + * adds a new function to builtin function list, + * which directly produce parse tree elements + * and have their own html/mathml builders + */ + __defineFunction: Y, + /** + * adds a new macro to builtin macro list + */ + __defineMacro: v, + /** + * Expose the dom tree node types, which can be useful for type checking nodes. + * + * NOTE: This method is not currently recommended for public use. + * The internal tree representation is unstable and is very likely + * to change. Use at your own risk. + */ + __domTree: { + Span: ri, + Anchor: Fu, + SymbolNode: x0, + SvgNode: Br, + PathNode: un, + LineNode: Zo + } +}; +const ry = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + default: ru +}, Symbol.toStringTag, { value: "Module" })); +var D6 = function(e, t, r) { + for (var a = r, i = 0, l = e.length; a < t.length; ) { + var s = t[a]; + if (i <= 0 && t.slice(a, a + l) === e) + return a; + s === "\\" ? a++ : s === "{" ? i++ : s === "}" && i--, a++; + } + return -1; +}, A6 = function(e) { + return e.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); +}, E6 = /^\\begin{/, S6 = function(e, t) { + for (var r, a = [], i = new RegExp("(" + t.map((u) => A6(u.left)).join("|") + ")"); r = e.search(i), r !== -1; ) { + r > 0 && (a.push({ + type: "text", + data: e.slice(0, r) + }), e = e.slice(r)); + var l = t.findIndex((u) => e.startsWith(u.left)); + if (r = D6(t[l].right, e, t[l].left.length), r === -1) + break; + var s = e.slice(0, r + t[l].right.length), o = E6.test(s) ? s : e.slice(t[l].left.length, r); + a.push({ + type: "math", + data: o, + rawData: s, + display: t[l].display + }), e = e.slice(r + t[l].right.length); + } + return e !== "" && a.push({ + type: "text", + data: e + }), a; +}, x6 = function(e, t) { + var r = S6(e, t.delimiters); + if (r.length === 1 && r[0].type === "text") + return null; + for (var a = document.createDocumentFragment(), i = 0; i < r.length; i++) + if (r[i].type === "text") + a.appendChild(document.createTextNode(r[i].data)); + else { + var l = document.createElement("span"), s = r[i].data; + t.displayMode = r[i].display; + try { + t.preProcess && (s = t.preProcess(s)), ru.render(s, l, t); + } catch (o) { + if (!(o instanceof ru.ParseError)) + throw o; + t.errorCallback("KaTeX auto-render: Failed to parse `" + r[i].data + "` with ", o), a.appendChild(document.createTextNode(r[i].rawData)); + continue; + } + a.appendChild(l); + } + return a; +}, T6 = function n(e, t) { + for (var r = 0; r < e.childNodes.length; r++) { + var a = e.childNodes[r]; + if (a.nodeType === 3) { + for (var i = a.textContent, l = a.nextSibling, s = 0; l && l.nodeType === Node.TEXT_NODE; ) + i += l.textContent, l = l.nextSibling, s++; + var o = x6(i, t); + if (o) { + for (var u = 0; u < s; u++) + a.nextSibling.remove(); + r += o.childNodes.length - 1, e.replaceChild(o, a); + } else + r += s; + } else a.nodeType === 1 && function() { + var c = " " + a.className + " ", d = t.ignoredTags.indexOf(a.nodeName.toLowerCase()) === -1 && t.ignoredClasses.every((h) => c.indexOf(" " + h + " ") === -1); + d && n(a, t); + }(); + } +}, C6 = function(e, t) { + if (!e) + throw new Error("No element provided to render"); + var r = {}; + for (var a in t) + t.hasOwnProperty(a) && (r[a] = t[a]); + r.delimiters = r.delimiters || [ + { + left: "$$", + right: "$$", + display: !0 + }, + { + left: "\\(", + right: "\\)", + display: !1 + }, + // LaTeX uses $…$, but it ruins the display of normal `$` in text: + // {left: "$", right: "$", display: false}, + // $ must come after $$ + // Render AMS environments even if outside $$…$$ delimiters. + { + left: "\\begin{equation}", + right: "\\end{equation}", + display: !0 + }, + { + left: "\\begin{align}", + right: "\\end{align}", + display: !0 + }, + { + left: "\\begin{alignat}", + right: "\\end{alignat}", + display: !0 + }, + { + left: "\\begin{gather}", + right: "\\end{gather}", + display: !0 + }, + { + left: "\\begin{CD}", + right: "\\end{CD}", + display: !0 + }, + { + left: "\\[", + right: "\\]", + display: !0 + } + ], r.ignoredTags = r.ignoredTags || ["script", "noscript", "style", "textarea", "pre", "code", "option"], r.ignoredClasses = r.ignoredClasses || [], r.errorCallback = r.errorCallback || console.error, r.macros = r.macros || {}, T6(e, r); +}; +function Xu() { + return { + async: !1, + breaks: !1, + extensions: null, + gfm: !0, + hooks: null, + pedantic: !1, + renderer: null, + silent: !1, + tokenizer: null, + walkTokens: null + }; +} +let In = Xu(); +function w4(n) { + In = n; +} +const y4 = /[&<>"']/, F6 = new RegExp(y4.source, "g"), k4 = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, M6 = new RegExp(k4.source, "g"), z6 = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" +}, xc = (n) => z6[n]; +function c0(n, e) { + if (e) { + if (y4.test(n)) + return n.replace(F6, xc); + } else if (k4.test(n)) + return n.replace(M6, xc); + return n; +} +const B6 = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig; +function I6(n) { + return n.replace(B6, (e, t) => (t = t.toLowerCase(), t === "colon" ? ":" : t.charAt(0) === "#" ? t.charAt(1) === "x" ? String.fromCharCode(parseInt(t.substring(2), 16)) : String.fromCharCode(+t.substring(1)) : "")); +} +const L6 = /(^|[^\[])\^/g; +function Me(n, e) { + let t = typeof n == "string" ? n : n.source; + e = e || ""; + const r = { + replace: (a, i) => { + let l = typeof i == "string" ? i : i.source; + return l = l.replace(L6, "$1"), t = t.replace(a, l), r; + }, + getRegex: () => new RegExp(t, e) + }; + return r; +} +function Tc(n) { + try { + n = encodeURI(n).replace(/%25/g, "%"); + } catch { + return null; + } + return n; +} +const Pa = { exec: () => null }; +function Cc(n, e) { + const t = n.replace(/\|/g, (i, l, s) => { + let o = !1, u = l; + for (; --u >= 0 && s[u] === "\\"; ) + o = !o; + return o ? "|" : " |"; + }), r = t.split(/ \|/); + let a = 0; + if (r[0].trim() || r.shift(), r.length > 0 && !r[r.length - 1].trim() && r.pop(), e) + if (r.length > e) + r.splice(e); + else + for (; r.length < e; ) + r.push(""); + for (; a < r.length; a++) + r[a] = r[a].trim().replace(/\\\|/g, "|"); + return r; +} +function ji(n, e, t) { + const r = n.length; + if (r === 0) + return ""; + let a = 0; + for (; a < r; ) { + const i = n.charAt(r - a - 1); + if (i === e && !t) + a++; + else if (i !== e && t) + a++; + else + break; + } + return n.slice(0, r - a); +} +function N6(n, e) { + if (n.indexOf(e[1]) === -1) + return -1; + let t = 0; + for (let r = 0; r < n.length; r++) + if (n[r] === "\\") + r++; + else if (n[r] === e[0]) + t++; + else if (n[r] === e[1] && (t--, t < 0)) + return r; + return -1; +} +function Fc(n, e, t, r) { + const a = e.href, i = e.title ? c0(e.title) : null, l = n[1].replace(/\\([\[\]])/g, "$1"); + if (n[0].charAt(0) !== "!") { + r.state.inLink = !0; + const s = { + type: "link", + raw: t, + href: a, + title: i, + text: l, + tokens: r.inlineTokens(l) + }; + return r.state.inLink = !1, s; + } + return { + type: "image", + raw: t, + href: a, + title: i, + text: c0(l) + }; +} +function R6(n, e) { + const t = n.match(/^(\s+)(?:```)/); + if (t === null) + return e; + const r = t[1]; + return e.split(` +`).map((a) => { + const i = a.match(/^\s+/); + if (i === null) + return a; + const [l] = i; + return l.length >= r.length ? a.slice(r.length) : a; + }).join(` +`); +} +class zl { + // set by the lexer + constructor(e) { + Oe(this, "options"); + Oe(this, "rules"); + // set by the lexer + Oe(this, "lexer"); + this.options = e || In; + } + space(e) { + const t = this.rules.block.newline.exec(e); + if (t && t[0].length > 0) + return { + type: "space", + raw: t[0] + }; + } + code(e) { + const t = this.rules.block.code.exec(e); + if (t) { + const r = t[0].replace(/^ {1,4}/gm, ""); + return { + type: "code", + raw: t[0], + codeBlockStyle: "indented", + text: this.options.pedantic ? r : ji(r, ` +`) + }; + } + } + fences(e) { + const t = this.rules.block.fences.exec(e); + if (t) { + const r = t[0], a = R6(r, t[3] || ""); + return { + type: "code", + raw: r, + lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], + text: a + }; + } + } + heading(e) { + const t = this.rules.block.heading.exec(e); + if (t) { + let r = t[2].trim(); + if (/#$/.test(r)) { + const a = ji(r, "#"); + (this.options.pedantic || !a || / $/.test(a)) && (r = a.trim()); + } + return { + type: "heading", + raw: t[0], + depth: t[1].length, + text: r, + tokens: this.lexer.inline(r) + }; + } + } + hr(e) { + const t = this.rules.block.hr.exec(e); + if (t) + return { + type: "hr", + raw: t[0] + }; + } + blockquote(e) { + const t = this.rules.block.blockquote.exec(e); + if (t) { + let r = t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, ` + $1`); + r = ji(r.replace(/^ *>[ \t]?/gm, ""), ` +`); + const a = this.lexer.state.top; + this.lexer.state.top = !0; + const i = this.lexer.blockTokens(r); + return this.lexer.state.top = a, { + type: "blockquote", + raw: t[0], + tokens: i, + text: r + }; + } + } + list(e) { + let t = this.rules.block.list.exec(e); + if (t) { + let r = t[1].trim(); + const a = r.length > 1, i = { + type: "list", + raw: "", + ordered: a, + start: a ? +r.slice(0, -1) : "", + loose: !1, + items: [] + }; + r = a ? `\\d{1,9}\\${r.slice(-1)}` : `\\${r}`, this.options.pedantic && (r = a ? r : "[*+-]"); + const l = new RegExp(`^( {0,3}${r})((?:[ ][^\\n]*)?(?:\\n|$))`); + let s = "", o = "", u = !1; + for (; e; ) { + let c = !1; + if (!(t = l.exec(e)) || this.rules.block.hr.test(e)) + break; + s = t[0], e = e.substring(s.length); + let d = t[2].split(` +`, 1)[0].replace(/^\t+/, (y) => " ".repeat(3 * y.length)), h = e.split(` +`, 1)[0], p = 0; + this.options.pedantic ? (p = 2, o = d.trimStart()) : (p = t[2].search(/[^ ]/), p = p > 4 ? 1 : p, o = d.slice(p), p += t[1].length); + let _ = !1; + if (!d && /^ *$/.test(h) && (s += h + ` +`, e = e.substring(h.length + 1), c = !0), !c) { + const y = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`), k = new RegExp(`^ {0,${Math.min(3, p - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`), w = new RegExp(`^ {0,${Math.min(3, p - 1)}}(?:\`\`\`|~~~)`), E = new RegExp(`^ {0,${Math.min(3, p - 1)}}#`); + for (; e; ) { + const S = e.split(` +`, 1)[0]; + if (h = S, this.options.pedantic && (h = h.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ")), w.test(h) || E.test(h) || y.test(h) || k.test(e)) + break; + if (h.search(/[^ ]/) >= p || !h.trim()) + o += ` +` + h.slice(p); + else { + if (_ || d.search(/[^ ]/) >= 4 || w.test(d) || E.test(d) || k.test(d)) + break; + o += ` +` + h; + } + !_ && !h.trim() && (_ = !0), s += S + ` +`, e = e.substring(S.length + 1), d = h.slice(p); + } + } + i.loose || (u ? i.loose = !0 : /\n *\n *$/.test(s) && (u = !0)); + let b = null, D; + this.options.gfm && (b = /^\[[ xX]\] /.exec(o), b && (D = b[0] !== "[ ] ", o = o.replace(/^\[[ xX]\] +/, ""))), i.items.push({ + type: "list_item", + raw: s, + task: !!b, + checked: D, + loose: !1, + text: o, + tokens: [] + }), i.raw += s; + } + i.items[i.items.length - 1].raw = s.trimEnd(), i.items[i.items.length - 1].text = o.trimEnd(), i.raw = i.raw.trimEnd(); + for (let c = 0; c < i.items.length; c++) + if (this.lexer.state.top = !1, i.items[c].tokens = this.lexer.blockTokens(i.items[c].text, []), !i.loose) { + const d = i.items[c].tokens.filter((p) => p.type === "space"), h = d.length > 0 && d.some((p) => /\n.*\n/.test(p.raw)); + i.loose = h; + } + if (i.loose) + for (let c = 0; c < i.items.length; c++) + i.items[c].loose = !0; + return i; + } + } + html(e) { + const t = this.rules.block.html.exec(e); + if (t) + return { + type: "html", + block: !0, + raw: t[0], + pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", + text: t[0] + }; + } + def(e) { + const t = this.rules.block.def.exec(e); + if (t) { + const r = t[1].toLowerCase().replace(/\s+/g, " "), a = t[2] ? t[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", i = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3]; + return { + type: "def", + tag: r, + raw: t[0], + href: a, + title: i + }; + } + } + table(e) { + const t = this.rules.block.table.exec(e); + if (!t || !/[:|]/.test(t[2])) + return; + const r = Cc(t[1]), a = t[2].replace(/^\||\| *$/g, "").split("|"), i = t[3] && t[3].trim() ? t[3].replace(/\n[ \t]*$/, "").split(` +`) : [], l = { + type: "table", + raw: t[0], + header: [], + align: [], + rows: [] + }; + if (r.length === a.length) { + for (const s of a) + /^ *-+: *$/.test(s) ? l.align.push("right") : /^ *:-+: *$/.test(s) ? l.align.push("center") : /^ *:-+ *$/.test(s) ? l.align.push("left") : l.align.push(null); + for (const s of r) + l.header.push({ + text: s, + tokens: this.lexer.inline(s) + }); + for (const s of i) + l.rows.push(Cc(s, l.header.length).map((o) => ({ + text: o, + tokens: this.lexer.inline(o) + }))); + return l; + } + } + lheading(e) { + const t = this.rules.block.lheading.exec(e); + if (t) + return { + type: "heading", + raw: t[0], + depth: t[2].charAt(0) === "=" ? 1 : 2, + text: t[1], + tokens: this.lexer.inline(t[1]) + }; + } + paragraph(e) { + const t = this.rules.block.paragraph.exec(e); + if (t) { + const r = t[1].charAt(t[1].length - 1) === ` +` ? t[1].slice(0, -1) : t[1]; + return { + type: "paragraph", + raw: t[0], + text: r, + tokens: this.lexer.inline(r) + }; + } + } + text(e) { + const t = this.rules.block.text.exec(e); + if (t) + return { + type: "text", + raw: t[0], + text: t[0], + tokens: this.lexer.inline(t[0]) + }; + } + escape(e) { + const t = this.rules.inline.escape.exec(e); + if (t) + return { + type: "escape", + raw: t[0], + text: c0(t[1]) + }; + } + tag(e) { + const t = this.rules.inline.tag.exec(e); + if (t) + return !this.lexer.state.inLink && /^/i.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0]) && (this.lexer.state.inRawBlock = !1), { + type: "html", + raw: t[0], + inLink: this.lexer.state.inLink, + inRawBlock: this.lexer.state.inRawBlock, + block: !1, + text: t[0] + }; + } + link(e) { + const t = this.rules.inline.link.exec(e); + if (t) { + const r = t[2].trim(); + if (!this.options.pedantic && /^$/.test(r)) + return; + const l = ji(r.slice(0, -1), "\\"); + if ((r.length - l.length) % 2 === 0) + return; + } else { + const l = N6(t[2], "()"); + if (l > -1) { + const o = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + l; + t[2] = t[2].substring(0, l), t[0] = t[0].substring(0, o).trim(), t[3] = ""; + } + } + let a = t[2], i = ""; + if (this.options.pedantic) { + const l = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(a); + l && (a = l[1], i = l[3]); + } else + i = t[3] ? t[3].slice(1, -1) : ""; + return a = a.trim(), /^$/.test(r) ? a = a.slice(1) : a = a.slice(1, -1)), Fc(t, { + href: a && a.replace(this.rules.inline.anyPunctuation, "$1"), + title: i && i.replace(this.rules.inline.anyPunctuation, "$1") + }, t[0], this.lexer); + } + } + reflink(e, t) { + let r; + if ((r = this.rules.inline.reflink.exec(e)) || (r = this.rules.inline.nolink.exec(e))) { + const a = (r[2] || r[1]).replace(/\s+/g, " "), i = t[a.toLowerCase()]; + if (!i) { + const l = r[0].charAt(0); + return { + type: "text", + raw: l, + text: l + }; + } + return Fc(r, i, r[0], this.lexer); + } + } + emStrong(e, t, r = "") { + let a = this.rules.inline.emStrongLDelim.exec(e); + if (!a || a[3] && r.match(/[\p{L}\p{N}]/u)) + return; + if (!(a[1] || a[2] || "") || !r || this.rules.inline.punctuation.exec(r)) { + const l = [...a[0]].length - 1; + let s, o, u = l, c = 0; + const d = a[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd; + for (d.lastIndex = 0, t = t.slice(-1 * e.length + l); (a = d.exec(t)) != null; ) { + if (s = a[1] || a[2] || a[3] || a[4] || a[5] || a[6], !s) + continue; + if (o = [...s].length, a[3] || a[4]) { + u += o; + continue; + } else if ((a[5] || a[6]) && l % 3 && !((l + o) % 3)) { + c += o; + continue; + } + if (u -= o, u > 0) + continue; + o = Math.min(o, o + u + c); + const h = [...a[0]][0].length, p = e.slice(0, l + a.index + h + o); + if (Math.min(l, o) % 2) { + const b = p.slice(1, -1); + return { + type: "em", + raw: p, + text: b, + tokens: this.lexer.inlineTokens(b) + }; + } + const _ = p.slice(2, -2); + return { + type: "strong", + raw: p, + text: _, + tokens: this.lexer.inlineTokens(_) + }; + } + } + } + codespan(e) { + const t = this.rules.inline.code.exec(e); + if (t) { + let r = t[2].replace(/\n/g, " "); + const a = /[^ ]/.test(r), i = /^ /.test(r) && / $/.test(r); + return a && i && (r = r.substring(1, r.length - 1)), r = c0(r, !0), { + type: "codespan", + raw: t[0], + text: r + }; + } + } + br(e) { + const t = this.rules.inline.br.exec(e); + if (t) + return { + type: "br", + raw: t[0] + }; + } + del(e) { + const t = this.rules.inline.del.exec(e); + if (t) + return { + type: "del", + raw: t[0], + text: t[2], + tokens: this.lexer.inlineTokens(t[2]) + }; + } + autolink(e) { + const t = this.rules.inline.autolink.exec(e); + if (t) { + let r, a; + return t[2] === "@" ? (r = c0(t[1]), a = "mailto:" + r) : (r = c0(t[1]), a = r), { + type: "link", + raw: t[0], + text: r, + href: a, + tokens: [ + { + type: "text", + raw: r, + text: r + } + ] + }; + } + } + url(e) { + var r; + let t; + if (t = this.rules.inline.url.exec(e)) { + let a, i; + if (t[2] === "@") + a = c0(t[0]), i = "mailto:" + a; + else { + let l; + do + l = t[0], t[0] = ((r = this.rules.inline._backpedal.exec(t[0])) == null ? void 0 : r[0]) ?? ""; + while (l !== t[0]); + a = c0(t[0]), t[1] === "www." ? i = "http://" + t[0] : i = t[0]; + } + return { + type: "link", + raw: t[0], + text: a, + href: i, + tokens: [ + { + type: "text", + raw: a, + text: a + } + ] + }; + } + } + inlineText(e) { + const t = this.rules.inline.text.exec(e); + if (t) { + let r; + return this.lexer.state.inRawBlock ? r = t[0] : r = c0(t[0]), { + type: "text", + raw: t[0], + text: r + }; + } + } +} +const O6 = /^(?: *(?:\n|$))+/, q6 = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/, P6 = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, ai = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, H6 = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, D4 = /(?:[*+-]|\d{1,9}[.)])/, A4 = Me(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, D4).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex(), Yu = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/, U6 = /^[^\n]+/, Zu = /(?!\s*\])(?:\\.|[^\[\]\\])+/, V6 = Me(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", Zu).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), G6 = Me(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, D4).getRegex(), rs = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", Ku = /|$))/, j6 = Me("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", Ku).replace("tag", rs).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), E4 = Me(Yu).replace("hr", ai).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", rs).getRegex(), W6 = Me(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", E4).getRegex(), Ju = { + blockquote: W6, + code: q6, + def: V6, + fences: P6, + heading: H6, + hr: ai, + html: j6, + lheading: A4, + list: G6, + newline: O6, + paragraph: E4, + table: Pa, + text: U6 +}, Mc = Me("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", ai).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", rs).getRegex(), X6 = { + ...Ju, + table: Mc, + paragraph: Me(Yu).replace("hr", ai).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", Mc).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", ")|<(?:script|pre|style|textarea|!--)").replace("tag", rs).getRegex() +}, Y6 = { + ...Ju, + html: Me(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", Ku).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), + def: /^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, + heading: /^(#{1,6})(.*)(?:\n+|$)/, + fences: Pa, + // fences not supported + lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, + paragraph: Me(Yu).replace("hr", ai).replace("heading", ` *#{1,6} *[^ +]`).replace("lheading", A4).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() +}, S4 = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, Z6 = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, x4 = /^( {2,}|\\)\n(?!\s*$)/, K6 = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g, $6 = Me(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, ii).getRegex(), e7 = Me("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, ii).getRegex(), t7 = Me("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, ii).getRegex(), r7 = Me(/\\([punct])/, "gu").replace(/punct/g, ii).getRegex(), n7 = Me(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), a7 = Me(Ku).replace("(?:-->|$)", "-->").getRegex(), i7 = Me("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment", a7).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Bl = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/, l7 = Me(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", Bl).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), T4 = Me(/^!?\[(label)\]\[(ref)\]/).replace("label", Bl).replace("ref", Zu).getRegex(), C4 = Me(/^!?\[(ref)\](?:\[\])?/).replace("ref", Zu).getRegex(), s7 = Me("reflink|nolink(?!\\()", "g").replace("reflink", T4).replace("nolink", C4).getRegex(), Qu = { + _backpedal: Pa, + // only used for GFM url + anyPunctuation: r7, + autolink: n7, + blockSkip: Q6, + br: x4, + code: Z6, + del: Pa, + emStrongLDelim: $6, + emStrongRDelimAst: e7, + emStrongRDelimUnd: t7, + escape: S4, + link: l7, + nolink: C4, + punctuation: J6, + reflink: T4, + reflinkSearch: s7, + tag: i7, + text: K6, + url: Pa +}, o7 = { + ...Qu, + link: Me(/^!?\[(label)\]\((.*?)\)/).replace("label", Bl).getRegex(), + reflink: Me(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Bl).getRegex() +}, nu = { + ...Qu, + escape: Me(S4).replace("])", "~|])").getRegex(), + url: Me(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(), + _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, + del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/, + text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\ o + " ".repeat(u.length)); + let r, a, i, l; + for (; e; ) + if (!(this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((s) => (r = s.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))) { + if (r = this.tokenizer.space(e)) { + e = e.substring(r.raw.length), r.raw.length === 1 && t.length > 0 ? t[t.length - 1].raw += ` +` : t.push(r); + continue; + } + if (r = this.tokenizer.code(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += ` +` + r.raw, a.text += ` +` + r.text, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r); + continue; + } + if (r = this.tokenizer.fences(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.heading(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.hr(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.blockquote(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.list(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.html(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.def(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && (a.type === "paragraph" || a.type === "text") ? (a.raw += ` +` + r.raw, a.text += ` +` + r.raw, this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : this.tokens.links[r.tag] || (this.tokens.links[r.tag] = { + href: r.href, + title: r.title + }); + continue; + } + if (r = this.tokenizer.table(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.lheading(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (i = e, this.options.extensions && this.options.extensions.startBlock) { + let s = 1 / 0; + const o = e.slice(1); + let u; + this.options.extensions.startBlock.forEach((c) => { + u = c.call({ lexer: this }, o), typeof u == "number" && u >= 0 && (s = Math.min(s, u)); + }), s < 1 / 0 && s >= 0 && (i = e.substring(0, s + 1)); + } + if (this.state.top && (r = this.tokenizer.paragraph(i))) { + a = t[t.length - 1], l && a.type === "paragraph" ? (a.raw += ` +` + r.raw, a.text += ` +` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r), l = i.length !== e.length, e = e.substring(r.raw.length); + continue; + } + if (r = this.tokenizer.text(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && a.type === "text" ? (a.raw += ` +` + r.raw, a.text += ` +` + r.text, this.inlineQueue.pop(), this.inlineQueue[this.inlineQueue.length - 1].src = a.text) : t.push(r); + continue; + } + if (e) { + const s = "Infinite loop on byte: " + e.charCodeAt(0); + if (this.options.silent) { + console.error(s); + break; + } else + throw new Error(s); + } + } + return this.state.top = !0, t; + } + inline(e, t = []) { + return this.inlineQueue.push({ src: e, tokens: t }), t; + } + /** + * Lexing/Compiling + */ + inlineTokens(e, t = []) { + let r, a, i, l = e, s, o, u; + if (this.tokens.links) { + const c = Object.keys(this.tokens.links); + if (c.length > 0) + for (; (s = this.tokenizer.rules.inline.reflinkSearch.exec(l)) != null; ) + c.includes(s[0].slice(s[0].lastIndexOf("[") + 1, -1)) && (l = l.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + l.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex)); + } + for (; (s = this.tokenizer.rules.inline.blockSkip.exec(l)) != null; ) + l = l.slice(0, s.index) + "[" + "a".repeat(s[0].length - 2) + "]" + l.slice(this.tokenizer.rules.inline.blockSkip.lastIndex); + for (; (s = this.tokenizer.rules.inline.anyPunctuation.exec(l)) != null; ) + l = l.slice(0, s.index) + "++" + l.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex); + for (; e; ) + if (o || (u = ""), o = !1, !(this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((c) => (r = c.call({ lexer: this }, e, t)) ? (e = e.substring(r.raw.length), t.push(r), !0) : !1))) { + if (r = this.tokenizer.escape(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.tag(e)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && r.type === "text" && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r); + continue; + } + if (r = this.tokenizer.link(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.reflink(e, this.tokens.links)) { + e = e.substring(r.raw.length), a = t[t.length - 1], a && r.type === "text" && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r); + continue; + } + if (r = this.tokenizer.emStrong(e, l, u)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.codespan(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.br(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.del(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (r = this.tokenizer.autolink(e)) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (!this.state.inLink && (r = this.tokenizer.url(e))) { + e = e.substring(r.raw.length), t.push(r); + continue; + } + if (i = e, this.options.extensions && this.options.extensions.startInline) { + let c = 1 / 0; + const d = e.slice(1); + let h; + this.options.extensions.startInline.forEach((p) => { + h = p.call({ lexer: this }, d), typeof h == "number" && h >= 0 && (c = Math.min(c, h)); + }), c < 1 / 0 && c >= 0 && (i = e.substring(0, c + 1)); + } + if (r = this.tokenizer.inlineText(i)) { + e = e.substring(r.raw.length), r.raw.slice(-1) !== "_" && (u = r.raw.slice(-1)), o = !0, a = t[t.length - 1], a && a.type === "text" ? (a.raw += r.raw, a.text += r.text) : t.push(r); + continue; + } + if (e) { + const c = "Infinite loop on byte: " + e.charCodeAt(0); + if (this.options.silent) { + console.error(c); + break; + } else + throw new Error(c); + } + } + return t; + } +} +class Il { + constructor(e) { + Oe(this, "options"); + this.options = e || In; + } + code(e, t, r) { + var i; + const a = (i = (t || "").match(/^\S*/)) == null ? void 0 : i[0]; + return e = e.replace(/\n$/, "") + ` +`, a ? '
' + (r ? e : c0(e, !0)) + `
+` : "
" + (r ? e : c0(e, !0)) + `
+`; + } + blockquote(e) { + return `
+${e}
+`; + } + html(e, t) { + return e; + } + heading(e, t, r) { + return `${e} +`; + } + hr() { + return `
+`; + } + list(e, t, r) { + const a = t ? "ol" : "ul", i = t && r !== 1 ? ' start="' + r + '"' : ""; + return "<" + a + i + `> +` + e + " +`; + } + listitem(e, t, r) { + return `
  • ${e}
  • +`; + } + checkbox(e) { + return "'; + } + paragraph(e) { + return `

    ${e}

    +`; + } + table(e, t) { + return t && (t = `${t}`), ` + +` + e + ` +` + t + `
    +`; + } + tablerow(e) { + return ` +${e} +`; + } + tablecell(e, t) { + const r = t.header ? "th" : "td"; + return (t.align ? `<${r} align="${t.align}">` : `<${r}>`) + e + ` +`; + } + /** + * span level renderer + */ + strong(e) { + return `${e}`; + } + em(e) { + return `${e}`; + } + codespan(e) { + return `${e}`; + } + br() { + return "
    "; + } + del(e) { + return `${e}`; + } + link(e, t, r) { + const a = Tc(e); + if (a === null) + return r; + e = a; + let i = '
    ", i; + } + image(e, t, r) { + const a = Tc(e); + if (a === null) + return r; + e = a; + let i = `${r} 0 && h.tokens[0].type === "paragraph" ? (h.tokens[0].text = D + " " + h.tokens[0].text, h.tokens[0].tokens && h.tokens[0].tokens.length > 0 && h.tokens[0].tokens[0].type === "text" && (h.tokens[0].tokens[0].text = D + " " + h.tokens[0].tokens[0].text)) : h.tokens.unshift({ + type: "text", + text: D + " " + }) : b += D + " "; + } + b += this.parse(h.tokens, u), c += this.renderer.listitem(b, _, !!p); + } + r += this.renderer.list(c, s, o); + continue; + } + case "html": { + const l = i; + r += this.renderer.html(l.text, l.block); + continue; + } + case "paragraph": { + const l = i; + r += this.renderer.paragraph(this.parseInline(l.tokens)); + continue; + } + case "text": { + let l = i, s = l.tokens ? this.parseInline(l.tokens) : l.text; + for (; a + 1 < e.length && e[a + 1].type === "text"; ) + l = e[++a], s += ` +` + (l.tokens ? this.parseInline(l.tokens) : l.text); + r += t ? this.renderer.paragraph(s) : s; + continue; + } + default: { + const l = 'Token with "' + i.type + '" type was not found.'; + if (this.options.silent) + return console.error(l), ""; + throw new Error(l); + } + } + } + return r; + } + /** + * Parse Inline Tokens + */ + parseInline(e, t) { + t = t || this.renderer; + let r = ""; + for (let a = 0; a < e.length; a++) { + const i = e[a]; + if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[i.type]) { + const l = this.options.extensions.renderers[i.type].call({ parser: this }, i); + if (l !== !1 || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(i.type)) { + r += l || ""; + continue; + } + } + switch (i.type) { + case "escape": { + const l = i; + r += t.text(l.text); + break; + } + case "html": { + const l = i; + r += t.html(l.text); + break; + } + case "link": { + const l = i; + r += t.link(l.href, l.title, this.parseInline(l.tokens, t)); + break; + } + case "image": { + const l = i; + r += t.image(l.href, l.title, l.text); + break; + } + case "strong": { + const l = i; + r += t.strong(this.parseInline(l.tokens, t)); + break; + } + case "em": { + const l = i; + r += t.em(this.parseInline(l.tokens, t)); + break; + } + case "codespan": { + const l = i; + r += t.codespan(l.text); + break; + } + case "br": { + r += t.br(); + break; + } + case "del": { + const l = i; + r += t.del(this.parseInline(l.tokens, t)); + break; + } + case "text": { + const l = i; + r += t.text(l.text); + break; + } + default: { + const l = 'Token with "' + i.type + '" type was not found.'; + if (this.options.silent) + return console.error(l), ""; + throw new Error(l); + } + } + } + return r; + } +} +class Ha { + constructor(e) { + Oe(this, "options"); + this.options = e || In; + } + /** + * Process markdown before marked + */ + preprocess(e) { + return e; + } + /** + * Process HTML after marked is finished + */ + postprocess(e) { + return e; + } + /** + * Process all tokens before walk tokens + */ + processAllTokens(e) { + return e; + } +} +Oe(Ha, "passThroughHooks", /* @__PURE__ */ new Set([ + "preprocess", + "postprocess", + "processAllTokens" +])); +var zn, au, M4; +class F4 { + constructor(...e) { + S1(this, zn); + Oe(this, "defaults", Xu()); + Oe(this, "options", this.setOptions); + Oe(this, "parse", yi(this, zn, au).call(this, nr.lex, ar.parse)); + Oe(this, "parseInline", yi(this, zn, au).call(this, nr.lexInline, ar.parseInline)); + Oe(this, "Parser", ar); + Oe(this, "Renderer", Il); + Oe(this, "TextRenderer", $u); + Oe(this, "Lexer", nr); + Oe(this, "Tokenizer", zl); + Oe(this, "Hooks", Ha); + this.use(...e); + } + /** + * Run callback for every token + */ + walkTokens(e, t) { + var a, i; + let r = []; + for (const l of e) + switch (r = r.concat(t.call(this, l)), l.type) { + case "table": { + const s = l; + for (const o of s.header) + r = r.concat(this.walkTokens(o.tokens, t)); + for (const o of s.rows) + for (const u of o) + r = r.concat(this.walkTokens(u.tokens, t)); + break; + } + case "list": { + const s = l; + r = r.concat(this.walkTokens(s.items, t)); + break; + } + default: { + const s = l; + (i = (a = this.defaults.extensions) == null ? void 0 : a.childTokens) != null && i[s.type] ? this.defaults.extensions.childTokens[s.type].forEach((o) => { + const u = s[o].flat(1 / 0); + r = r.concat(this.walkTokens(u, t)); + }) : s.tokens && (r = r.concat(this.walkTokens(s.tokens, t))); + } + } + return r; + } + use(...e) { + const t = this.defaults.extensions || { renderers: {}, childTokens: {} }; + return e.forEach((r) => { + const a = { ...r }; + if (a.async = this.defaults.async || a.async || !1, r.extensions && (r.extensions.forEach((i) => { + if (!i.name) + throw new Error("extension name required"); + if ("renderer" in i) { + const l = t.renderers[i.name]; + l ? t.renderers[i.name] = function(...s) { + let o = i.renderer.apply(this, s); + return o === !1 && (o = l.apply(this, s)), o; + } : t.renderers[i.name] = i.renderer; + } + if ("tokenizer" in i) { + if (!i.level || i.level !== "block" && i.level !== "inline") + throw new Error("extension level must be 'block' or 'inline'"); + const l = t[i.level]; + l ? l.unshift(i.tokenizer) : t[i.level] = [i.tokenizer], i.start && (i.level === "block" ? t.startBlock ? t.startBlock.push(i.start) : t.startBlock = [i.start] : i.level === "inline" && (t.startInline ? t.startInline.push(i.start) : t.startInline = [i.start])); + } + "childTokens" in i && i.childTokens && (t.childTokens[i.name] = i.childTokens); + }), a.extensions = t), r.renderer) { + const i = this.defaults.renderer || new Il(this.defaults); + for (const l in r.renderer) { + if (!(l in i)) + throw new Error(`renderer '${l}' does not exist`); + if (l === "options") + continue; + const s = l, o = r.renderer[s], u = i[s]; + i[s] = (...c) => { + let d = o.apply(i, c); + return d === !1 && (d = u.apply(i, c)), d || ""; + }; + } + a.renderer = i; + } + if (r.tokenizer) { + const i = this.defaults.tokenizer || new zl(this.defaults); + for (const l in r.tokenizer) { + if (!(l in i)) + throw new Error(`tokenizer '${l}' does not exist`); + if (["options", "rules", "lexer"].includes(l)) + continue; + const s = l, o = r.tokenizer[s], u = i[s]; + i[s] = (...c) => { + let d = o.apply(i, c); + return d === !1 && (d = u.apply(i, c)), d; + }; + } + a.tokenizer = i; + } + if (r.hooks) { + const i = this.defaults.hooks || new Ha(); + for (const l in r.hooks) { + if (!(l in i)) + throw new Error(`hook '${l}' does not exist`); + if (l === "options") + continue; + const s = l, o = r.hooks[s], u = i[s]; + Ha.passThroughHooks.has(l) ? i[s] = (c) => { + if (this.defaults.async) + return Promise.resolve(o.call(i, c)).then((h) => u.call(i, h)); + const d = o.call(i, c); + return u.call(i, d); + } : i[s] = (...c) => { + let d = o.apply(i, c); + return d === !1 && (d = u.apply(i, c)), d; + }; + } + a.hooks = i; + } + if (r.walkTokens) { + const i = this.defaults.walkTokens, l = r.walkTokens; + a.walkTokens = function(s) { + let o = []; + return o.push(l.call(this, s)), i && (o = o.concat(i.call(this, s))), o; + }; + } + this.defaults = { ...this.defaults, ...a }; + }), this; + } + setOptions(e) { + return this.defaults = { ...this.defaults, ...e }, this; + } + lexer(e, t) { + return nr.lex(e, t ?? this.defaults); + } + parser(e, t) { + return ar.parse(e, t ?? this.defaults); + } +} +zn = new WeakSet(), au = function(e, t) { + return (r, a) => { + const i = { ...a }, l = { ...this.defaults, ...i }; + this.defaults.async === !0 && i.async === !1 && (l.silent || console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored."), l.async = !0); + const s = yi(this, zn, M4).call(this, !!l.silent, !!l.async); + if (typeof r > "u" || r === null) + return s(new Error("marked(): input parameter is undefined or null")); + if (typeof r != "string") + return s(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(r) + ", string expected")); + if (l.hooks && (l.hooks.options = l), l.async) + return Promise.resolve(l.hooks ? l.hooks.preprocess(r) : r).then((o) => e(o, l)).then((o) => l.hooks ? l.hooks.processAllTokens(o) : o).then((o) => l.walkTokens ? Promise.all(this.walkTokens(o, l.walkTokens)).then(() => o) : o).then((o) => t(o, l)).then((o) => l.hooks ? l.hooks.postprocess(o) : o).catch(s); + try { + l.hooks && (r = l.hooks.preprocess(r)); + let o = e(r, l); + l.hooks && (o = l.hooks.processAllTokens(o)), l.walkTokens && this.walkTokens(o, l.walkTokens); + let u = t(o, l); + return l.hooks && (u = l.hooks.postprocess(u)), u; + } catch (o) { + return s(o); + } + }; +}, M4 = function(e, t) { + return (r) => { + if (r.message += ` +Please report this to https://github.com/markedjs/marked.`, e) { + const a = "

    An error occurred:

    " + c0(r.message + "", !0) + "
    "; + return t ? Promise.resolve(a) : a; + } + if (t) + return Promise.reject(r); + throw r; + }; +}; +const Fn = new F4(); +function Fe(n, e) { + return Fn.parse(n, e); +} +Fe.options = Fe.setOptions = function(n) { + return Fn.setOptions(n), Fe.defaults = Fn.defaults, w4(Fe.defaults), Fe; +}; +Fe.getDefaults = Xu; +Fe.defaults = In; +Fe.use = function(...n) { + return Fn.use(...n), Fe.defaults = Fn.defaults, w4(Fe.defaults), Fe; +}; +Fe.walkTokens = function(n, e) { + return Fn.walkTokens(n, e); +}; +Fe.parseInline = Fn.parseInline; +Fe.Parser = ar; +Fe.parser = ar.parse; +Fe.Renderer = Il; +Fe.TextRenderer = $u; +Fe.Lexer = nr; +Fe.lexer = nr.lex; +Fe.Tokenizer = zl; +Fe.Hooks = Ha; +Fe.parse = Fe; +Fe.options; +Fe.setOptions; +Fe.use; +Fe.walkTokens; +Fe.parseInline; +ar.parse; +nr.lex; +function c7(n) { + if (typeof n == "function" && (n = { + highlight: n + }), !n || typeof n.highlight != "function") + throw new Error("Must provide highlight function"); + return typeof n.langPrefix != "string" && (n.langPrefix = "language-"), typeof n.emptyLangClass != "string" && (n.emptyLangClass = ""), { + async: !!n.async, + walkTokens(e) { + if (e.type !== "code") + return; + const t = zc(e.lang); + if (n.async) + return Promise.resolve(n.highlight(e.text, t, e.lang || "")).then(Bc(e)); + const r = n.highlight(e.text, t, e.lang || ""); + if (r instanceof Promise) + throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function."); + Bc(e)(r); + }, + useNewRenderer: !0, + renderer: { + code(e, t, r) { + typeof e == "object" && (r = e.escaped, t = e.lang, e = e.text); + const a = zc(t), i = a ? n.langPrefix + Lc(a) : n.emptyLangClass, l = i ? ` class="${i}"` : ""; + return e = e.replace(/\n$/, ""), `
    ${r ? e : Lc(e, !0)}
    +
    `; + } + } + }; +} +function zc(n) { + return (n || "").match(/\S*/)[0]; +} +function Bc(n) { + return (e) => { + typeof e == "string" && e !== n.text && (n.escaped = !0, n.text = e); + }; +} +const z4 = /[&<>"']/, f7 = new RegExp(z4.source, "g"), B4 = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, h7 = new RegExp(B4.source, "g"), d7 = { + "&": "&", + "<": "<", + ">": ">", + '"': """, + "'": "'" +}, Ic = (n) => d7[n]; +function Lc(n, e) { + if (e) { + if (z4.test(n)) + return n.replace(f7, Ic); + } else if (B4.test(n)) + return n.replace(h7, Ic); + return n; +} +const m7 = /[\0-\x1F!-,\.\/:-@\[-\^`\{-\xA9\xAB-\xB4\xB6-\xB9\xBB-\xBF\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0378\u0379\u037E\u0380-\u0385\u0387\u038B\u038D\u03A2\u03F6\u0482\u0530\u0557\u0558\u055A-\u055F\u0589-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u05CF\u05EB-\u05EE\u05F3-\u060F\u061B-\u061F\u066A-\u066D\u06D4\u06DD\u06DE\u06E9\u06FD\u06FE\u0700-\u070F\u074B\u074C\u07B2-\u07BF\u07F6-\u07F9\u07FB\u07FC\u07FE\u07FF\u082E-\u083F\u085C-\u085F\u086B-\u089F\u08B5\u08C8-\u08D2\u08E2\u0964\u0965\u0970\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09F2-\u09FB\u09FD\u09FF\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF0-\u0AF8\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B54\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B70\u0B72-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BF0-\u0BFF\u0C0D\u0C11\u0C29\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5B-\u0C5F\u0C64\u0C65\u0C70-\u0C7F\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0CFF\u0D0D\u0D11\u0D45\u0D49\u0D4F-\u0D53\u0D58-\u0D5E\u0D64\u0D65\u0D70-\u0D79\u0D80\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DE5\u0DF0\u0DF1\u0DF4-\u0E00\u0E3B-\u0E3F\u0E4F\u0E5A-\u0E80\u0E83\u0E85\u0E8B\u0EA4\u0EA6\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F01-\u0F17\u0F1A-\u0F1F\u0F2A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F48\u0F6D-\u0F70\u0F85\u0F98\u0FBD-\u0FC5\u0FC7-\u0FFF\u104A-\u104F\u109E\u109F\u10C6\u10C8-\u10CC\u10CE\u10CF\u10FB\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u1360-\u137F\u1390-\u139F\u13F6\u13F7\u13FE-\u1400\u166D\u166E\u1680\u169B-\u169F\u16EB-\u16ED\u16F9-\u16FF\u170D\u1715-\u171F\u1735-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17D4-\u17D6\u17D8-\u17DB\u17DE\u17DF\u17EA-\u180A\u180E\u180F\u181A-\u181F\u1879-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191F\u192C-\u192F\u193C-\u1945\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DA-\u19FF\u1A1C-\u1A1F\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1AA6\u1AA8-\u1AAF\u1AC1-\u1AFF\u1B4C-\u1B4F\u1B5A-\u1B6A\u1B74-\u1B7F\u1BF4-\u1BFF\u1C38-\u1C3F\u1C4A-\u1C4C\u1C7E\u1C7F\u1C89-\u1C8F\u1CBB\u1CBC\u1CC0-\u1CCF\u1CD3\u1CFB-\u1CFF\u1DFA\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FBD\u1FBF-\u1FC1\u1FC5\u1FCD-\u1FCF\u1FD4\u1FD5\u1FDC-\u1FDF\u1FED-\u1FF1\u1FF5\u1FFD-\u203E\u2041-\u2053\u2055-\u2070\u2072-\u207E\u2080-\u208F\u209D-\u20CF\u20F1-\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F-\u215F\u2189-\u24B5\u24EA-\u2BFF\u2C2F\u2C5F\u2CE5-\u2CEA\u2CF4-\u2CFF\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D70-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E00-\u2E2E\u2E30-\u3004\u3008-\u3020\u3030\u3036\u3037\u303D-\u3040\u3097\u3098\u309B\u309C\u30A0\u30FB\u3100-\u3104\u3130\u318F-\u319F\u31C0-\u31EF\u3200-\u33FF\u4DC0-\u4DFF\u9FFD-\u9FFF\uA48D-\uA4CF\uA4FE\uA4FF\uA60D-\uA60F\uA62C-\uA63F\uA673\uA67E\uA6F2-\uA716\uA720\uA721\uA789\uA78A\uA7C0\uA7C1\uA7CB-\uA7F4\uA828-\uA82B\uA82D-\uA83F\uA874-\uA87F\uA8C6-\uA8CF\uA8DA-\uA8DF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA954-\uA95F\uA97D-\uA97F\uA9C1-\uA9CE\uA9DA-\uA9DF\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A-\uAA5F\uAA77-\uAA79\uAAC3-\uAADA\uAADE\uAADF\uAAF0\uAAF1\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F\uAB5B\uAB6A-\uAB6F\uABEB\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB29\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBB2-\uFBD2\uFD3E-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFC-\uFDFF\uFE10-\uFE1F\uFE30-\uFE32\uFE35-\uFE4C\uFE50-\uFE6F\uFE75\uFEFD-\uFF0F\uFF1A-\uFF20\uFF3B-\uFF3E\uFF40\uFF5B-\uFF65\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFFF]|\uD800[\uDC0C\uDC27\uDC3B\uDC3E\uDC4E\uDC4F\uDC5E-\uDC7F\uDCFB-\uDD3F\uDD75-\uDDFC\uDDFE-\uDE7F\uDE9D-\uDE9F\uDED1-\uDEDF\uDEE1-\uDEFF\uDF20-\uDF2C\uDF4B-\uDF4F\uDF7B-\uDF7F\uDF9E\uDF9F\uDFC4-\uDFC7\uDFD0\uDFD6-\uDFFF]|\uD801[\uDC9E\uDC9F\uDCAA-\uDCAF\uDCD4-\uDCD7\uDCFC-\uDCFF\uDD28-\uDD2F\uDD64-\uDDFF\uDF37-\uDF3F\uDF56-\uDF5F\uDF68-\uDFFF]|\uD802[\uDC06\uDC07\uDC09\uDC36\uDC39-\uDC3B\uDC3D\uDC3E\uDC56-\uDC5F\uDC77-\uDC7F\uDC9F-\uDCDF\uDCF3\uDCF6-\uDCFF\uDD16-\uDD1F\uDD3A-\uDD7F\uDDB8-\uDDBD\uDDC0-\uDDFF\uDE04\uDE07-\uDE0B\uDE14\uDE18\uDE36\uDE37\uDE3B-\uDE3E\uDE40-\uDE5F\uDE7D-\uDE7F\uDE9D-\uDEBF\uDEC8\uDEE7-\uDEFF\uDF36-\uDF3F\uDF56-\uDF5F\uDF73-\uDF7F\uDF92-\uDFFF]|\uD803[\uDC49-\uDC7F\uDCB3-\uDCBF\uDCF3-\uDCFF\uDD28-\uDD2F\uDD3A-\uDE7F\uDEAA\uDEAD-\uDEAF\uDEB2-\uDEFF\uDF1D-\uDF26\uDF28-\uDF2F\uDF51-\uDFAF\uDFC5-\uDFDF\uDFF7-\uDFFF]|\uD804[\uDC47-\uDC65\uDC70-\uDC7E\uDCBB-\uDCCF\uDCE9-\uDCEF\uDCFA-\uDCFF\uDD35\uDD40-\uDD43\uDD48-\uDD4F\uDD74\uDD75\uDD77-\uDD7F\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDFF\uDE12\uDE38-\uDE3D\uDE3F-\uDE7F\uDE87\uDE89\uDE8E\uDE9E\uDEA9-\uDEAF\uDEEB-\uDEEF\uDEFA-\uDEFF\uDF04\uDF0D\uDF0E\uDF11\uDF12\uDF29\uDF31\uDF34\uDF3A\uDF45\uDF46\uDF49\uDF4A\uDF4E\uDF4F\uDF51-\uDF56\uDF58-\uDF5C\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC4B-\uDC4F\uDC5A-\uDC5D\uDC62-\uDC7F\uDCC6\uDCC8-\uDCCF\uDCDA-\uDD7F\uDDB6\uDDB7\uDDC1-\uDDD7\uDDDE-\uDDFF\uDE41-\uDE43\uDE45-\uDE4F\uDE5A-\uDE7F\uDEB9-\uDEBF\uDECA-\uDEFF\uDF1B\uDF1C\uDF2C-\uDF2F\uDF3A-\uDFFF]|\uD806[\uDC3B-\uDC9F\uDCEA-\uDCFE\uDD07\uDD08\uDD0A\uDD0B\uDD14\uDD17\uDD36\uDD39\uDD3A\uDD44-\uDD4F\uDD5A-\uDD9F\uDDA8\uDDA9\uDDD8\uDDD9\uDDE2\uDDE5-\uDDFF\uDE3F-\uDE46\uDE48-\uDE4F\uDE9A-\uDE9C\uDE9E-\uDEBF\uDEF9-\uDFFF]|\uD807[\uDC09\uDC37\uDC41-\uDC4F\uDC5A-\uDC71\uDC90\uDC91\uDCA8\uDCB7-\uDCFF\uDD07\uDD0A\uDD37-\uDD39\uDD3B\uDD3E\uDD48-\uDD4F\uDD5A-\uDD5F\uDD66\uDD69\uDD8F\uDD92\uDD99-\uDD9F\uDDAA-\uDEDF\uDEF7-\uDFAF\uDFB1-\uDFFF]|\uD808[\uDF9A-\uDFFF]|\uD809[\uDC6F-\uDC7F\uDD44-\uDFFF]|[\uD80A\uD80B\uD80E-\uD810\uD812-\uD819\uD824-\uD82B\uD82D\uD82E\uD830-\uD833\uD837\uD839\uD83D\uD83F\uD87B-\uD87D\uD87F\uD885-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD80D[\uDC2F-\uDFFF]|\uD811[\uDE47-\uDFFF]|\uD81A[\uDE39-\uDE3F\uDE5F\uDE6A-\uDECF\uDEEE\uDEEF\uDEF5-\uDEFF\uDF37-\uDF3F\uDF44-\uDF4F\uDF5A-\uDF62\uDF78-\uDF7C\uDF90-\uDFFF]|\uD81B[\uDC00-\uDE3F\uDE80-\uDEFF\uDF4B-\uDF4E\uDF88-\uDF8E\uDFA0-\uDFDF\uDFE2\uDFE5-\uDFEF\uDFF2-\uDFFF]|\uD821[\uDFF8-\uDFFF]|\uD823[\uDCD6-\uDCFF\uDD09-\uDFFF]|\uD82C[\uDD1F-\uDD4F\uDD53-\uDD63\uDD68-\uDD6F\uDEFC-\uDFFF]|\uD82F[\uDC6B-\uDC6F\uDC7D-\uDC7F\uDC89-\uDC8F\uDC9A-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD835[\uDC55\uDC9D\uDCA0\uDCA1\uDCA3\uDCA4\uDCA7\uDCA8\uDCAD\uDCBA\uDCBC\uDCC4\uDD06\uDD0B\uDD0C\uDD15\uDD1D\uDD3A\uDD3F\uDD45\uDD47-\uDD49\uDD51\uDEA6\uDEA7\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3\uDFCC\uDFCD]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDCFF\uDD2D-\uDD2F\uDD3E\uDD3F\uDD4A-\uDD4D\uDD4F-\uDEBF\uDEFA-\uDFFF]|\uD83A[\uDCC5-\uDCCF\uDCD7-\uDCFF\uDD4C-\uDD4F\uDD5A-\uDFFF]|\uD83B[\uDC00-\uDDFF\uDE04\uDE20\uDE23\uDE25\uDE26\uDE28\uDE33\uDE38\uDE3A\uDE3C-\uDE41\uDE43-\uDE46\uDE48\uDE4A\uDE4C\uDE50\uDE53\uDE55\uDE56\uDE58\uDE5A\uDE5C\uDE5E\uDE60\uDE63\uDE65\uDE66\uDE6B\uDE73\uDE78\uDE7D\uDE7F\uDE8A\uDE9C-\uDEA0\uDEA4\uDEAA\uDEBC-\uDFFF]|\uD83C[\uDC00-\uDD2F\uDD4A-\uDD4F\uDD6A-\uDD6F\uDD8A-\uDFFF]|\uD83E[\uDC00-\uDFEF\uDFFA-\uDFFF]|\uD869[\uDEDE-\uDEFF]|\uD86D[\uDF35-\uDF3F]|\uD86E[\uDC1E\uDC1F]|\uD873[\uDEA2-\uDEAF]|\uD87A[\uDFE1-\uDFFF]|\uD87E[\uDE1E-\uDFFF]|\uD884[\uDF4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]/g, p7 = Object.hasOwnProperty; +class ns { + /** + * Create a new slug class. + */ + constructor() { + this.occurrences, this.reset(); + } + /** + * Generate a unique slug. + * + * Tracks previously generated slugs: repeated calls with the same value + * will result in different slugs. + * Use the `slug` function to get same slugs. + * + * @param {string} value + * String of text to slugify + * @param {boolean} [maintainCase=false] + * Keep the current case, otherwise make all lowercase + * @return {string} + * A unique slug string + */ + slug(e, t) { + const r = this; + let a = g7(e, t === !0); + const i = a; + for (; p7.call(r.occurrences, a); ) + r.occurrences[i]++, a = i + "-" + r.occurrences[i]; + return r.occurrences[a] = 0, a; + } + /** + * Reset - Forget all previous slugs + * + * @return void + */ + reset() { + this.occurrences = /* @__PURE__ */ Object.create(null); + } +} +function g7(n, e) { + return typeof n != "string" ? "" : (e || (n = n.toLowerCase()), n.replace(m7, "").replace(/ /g, "-")); +} +let I4 = new ns(), L4 = []; +function _7({ prefix: n = "", globalSlugs: e = !1 } = {}) { + return { + headerIds: !1, + // prevent deprecation warning; remove this once headerIds option is removed + hooks: { + preprocess(t) { + return e || v7(), t; + } + }, + renderer: { + heading(t, r, a) { + a = a.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi, ""); + const i = `${n}${I4.slug(a)}`, l = { level: r, text: t, id: i }; + return L4.push(l), `${t} +`; + } + } + }; +} +function v7() { + L4 = [], I4 = new ns(); +} +var Nc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; +function ny(n) { + return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n; +} +var N4 = { exports: {} }; +(function(n) { + var e = typeof window < "u" ? window : typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : {}; + /** + * Prism: Lightweight, robust, elegant syntax highlighting + * + * @license MIT + * @author Lea Verou + * @namespace + * @public + */ + var t = function(r) { + var a = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i, i = 0, l = {}, s = { + /** + * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the + * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load + * additional languages or plugins yourself. + * + * By setting this value to `true`, Prism will not automatically highlight all code elements on the page. + * + * You obviously have to change this value before the automatic highlighting started. To do this, you can add an + * empty Prism object into the global scope before loading the Prism script like this: + * + * ```js + * window.Prism = window.Prism || {}; + * Prism.manual = true; + * // add a new + + + \ No newline at end of file diff --git a/demo/talk_to_gemini/README.md b/demo/talk_to_gemini/README.md index b6fbbcc..d55d0c0 100644 --- a/demo/talk_to_gemini/README.md +++ b/demo/talk_to_gemini/README.md @@ -9,7 +9,7 @@ app_file: app.py pinned: false license: mit short_description: Talk to Gemini using Google's multimodal API -tags: [webrtc, websocket, gradio, secret|TWILIO_ACCOUNT_SID, secret|TWILIO_AUTH_TOKEN, secret|GEMINI_API_KEY] +tags: [webrtc, websocket, gradio, secret|HF_TOKEN, secret|GEMINI_API_KEY] --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/demo/talk_to_gemini/README_gradio.md b/demo/talk_to_gemini/README_gradio.md index a224a1a..fa347db 100644 --- a/demo/talk_to_gemini/README_gradio.md +++ b/demo/talk_to_gemini/README_gradio.md @@ -9,7 +9,7 @@ app_file: app.py pinned: false license: mit short_description: Talk to Gemini (Gradio UI) -tags: [webrtc, websocket, gradio, secret|TWILIO_ACCOUNT_SID, secret|TWILIO_AUTH_TOKEN, secret|GEMINI_API_KEY] +tags: [webrtc, websocket, gradio, secret|HF_TOKEN, secret|GEMINI_API_KEY] --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/demo/talk_to_gemini/app.py b/demo/talk_to_gemini/app.py index 7e8929c..69e2cfe 100644 --- a/demo/talk_to_gemini/app.py +++ b/demo/talk_to_gemini/app.py @@ -3,7 +3,8 @@ import base64 import json import os import pathlib -from typing import AsyncGenerator, Literal +from collections.abc import AsyncGenerator +from typing import Literal import gradio as gr import numpy as np @@ -13,7 +14,7 @@ from fastapi.responses import HTMLResponse from fastrtc import ( AsyncStreamHandler, Stream, - get_twilio_turn_credentials, + get_cloudflare_turn_credentials_async, wait_for_item, ) from google import genai @@ -116,7 +117,7 @@ stream = Stream( modality="audio", mode="send-receive", handler=GeminiHandler(), - rtc_configuration=get_twilio_turn_credentials() if get_space() else None, + rtc_configuration=get_cloudflare_turn_credentials_async if get_space() else None, concurrency_limit=5 if get_space() else None, time_limit=90 if get_space() else None, additional_inputs=[ @@ -159,7 +160,7 @@ async def _(body: InputData): @app.get("/") async def index(): - rtc_config = get_twilio_turn_credentials() if get_space() else None + rtc_config = await get_cloudflare_turn_credentials_async() if get_space() else None html_content = (current_dir / "index.html").read_text() html_content = html_content.replace("__RTC_CONFIGURATION__", json.dumps(rtc_config)) return HTMLResponse(content=html_content) diff --git a/demo/talk_to_gemini/index.html b/demo/talk_to_gemini/index.html index a6ae8be..c7f18e4 100644 --- a/demo/talk_to_gemini/index.html +++ b/demo/talk_to_gemini/index.html @@ -98,6 +98,11 @@ font-weight: 600; cursor: pointer; transition: all 0.2s ease; + display: flex; + align-items: center; + justify-content: center; + gap: 12px; + min-width: 180px; } button:hover { @@ -134,7 +139,6 @@ align-items: center; justify-content: center; gap: 12px; - min-width: 180px; } .pulse-circle { @@ -171,6 +175,23 @@ background-color: #ffd700; color: black; } + + /* Add styles for the mute toggle */ + .mute-toggle { + width: 24px; + height: 24px; + cursor: pointer; + flex-shrink: 0; + } + + .mute-toggle svg { + display: block; + } + + #start-button { + margin-left: auto; + margin-right: auto; + } @@ -221,6 +242,11 @@ let dataChannel; let isRecording = false; let webrtc_id; + let isMuted = false; + let analyser_input, dataArray_input; + let analyser, dataArray; + let source_input = null; + let source_output = null; const startButton = document.getElementById('start-button'); const apiKeyInput = document.getElementById('api-key'); @@ -235,7 +261,28 @@ boxContainer.appendChild(box); } + // SVG Icons + const micIconSVG = ` + + + + + + `; + + const micMutedIconSVG = ` + + + + + + + `; + function updateButtonState() { + startButton.innerHTML = ''; + startButton.onclick = null; + if (peerConnection && (peerConnection.connectionState === 'connecting' || peerConnection.connectionState === 'new')) { startButton.innerHTML = `
    @@ -243,15 +290,28 @@ Connecting...
    `; + startButton.disabled = true; } else if (peerConnection && peerConnection.connectionState === 'connected') { - startButton.innerHTML = ` -
    -
    - Stop Recording -
    + const pulseContainer = document.createElement('div'); + pulseContainer.className = 'pulse-container'; + pulseContainer.innerHTML = ` +
    + Stop Recording `; + + const muteToggle = document.createElement('div'); + muteToggle.className = 'mute-toggle'; + muteToggle.title = isMuted ? 'Unmute' : 'Mute'; + muteToggle.innerHTML = isMuted ? micMutedIconSVG : micIconSVG; + muteToggle.addEventListener('click', toggleMute); + + startButton.appendChild(pulseContainer); + startButton.appendChild(muteToggle); + startButton.disabled = false; + } else { startButton.innerHTML = 'Start Recording'; + startButton.disabled = false; } } @@ -267,6 +327,23 @@ }, 5000); } + function toggleMute(event) { + event.stopPropagation(); + if (!peerConnection || peerConnection.connectionState !== 'connected') return; + + isMuted = !isMuted; + console.log("Mute toggled:", isMuted); + + peerConnection.getSenders().forEach(sender => { + if (sender.track && sender.track.kind === 'audio') { + sender.track.enabled = !isMuted; + console.log(`Audio track ${sender.track.id} enabled: ${!isMuted}`); + } + }); + + updateButtonState(); + } + async function setupWebRTC() { const config = __RTC_CONFIGURATION__; peerConnection = new RTCPeerConnection(config); @@ -288,58 +365,74 @@ const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); stream.getTracks().forEach(track => peerConnection.addTrack(track, stream)); - // Update audio visualization setup - audioContext = new AudioContext(); + if (!audioContext || audioContext.state === 'closed') { + audioContext = new AudioContext(); + } + if (source_input) { + try { source_input.disconnect(); } catch (e) { console.warn("Error disconnecting previous input source:", e); } + source_input = null; + } + source_input = audioContext.createMediaStreamSource(stream); analyser_input = audioContext.createAnalyser(); - const source = audioContext.createMediaStreamSource(stream); - source.connect(analyser_input); + source_input.connect(analyser_input); analyser_input.fftSize = 64; dataArray_input = new Uint8Array(analyser_input.frequencyBinCount); - - function updateAudioLevel() { - analyser_input.getByteFrequencyData(dataArray_input); - const average = Array.from(dataArray_input).reduce((a, b) => a + b, 0) / dataArray_input.length; - const audioLevel = average / 255; - - const pulseCircle = document.querySelector('.pulse-circle'); - if (pulseCircle) { - console.log("audioLevel", audioLevel); - pulseCircle.style.setProperty('--audio-level', 1 + audioLevel); - } - - animationId = requestAnimationFrame(updateAudioLevel); - } updateAudioLevel(); - // Add connection state change listener peerConnection.addEventListener('connectionstatechange', () => { console.log('connectionstatechange', peerConnection.connectionState); if (peerConnection.connectionState === 'connected') { clearTimeout(timeoutId); const toast = document.getElementById('error-toast'); toast.style.display = 'none'; + if (analyser_input) updateAudioLevel(); + if (analyser) updateVisualization(); + } else if (['disconnected', 'failed', 'closed'].includes(peerConnection.connectionState)) { + // Explicitly stop animations if connection drops unexpectedly + // Note: stopWebRTC() handles the normal stop case } updateButtonState(); }); - // Handle incoming audio - peerConnection.addEventListener('track', (evt) => { - if (audioOutput && audioOutput.srcObject !== evt.streams[0]) { - audioOutput.srcObject = evt.streams[0]; - audioOutput.play(); + peerConnection.onicecandidate = ({ candidate }) => { + if (candidate) { + console.debug("Sending ICE candidate", candidate); + fetch('/webrtc/offer', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + candidate: candidate.toJSON(), + webrtc_id: webrtc_id, + type: "ice-candidate", + }) + }) + } + }; - // Set up audio visualization on the output stream - audioContext = new AudioContext(); - analyser = audioContext.createAnalyser(); - const source = audioContext.createMediaStreamSource(evt.streams[0]); - source.connect(analyser); - analyser.fftSize = 2048; - dataArray = new Uint8Array(analyser.frequencyBinCount); - updateVisualization(); + peerConnection.addEventListener('track', (evt) => { + if (evt.track.kind === 'audio' && audioOutput) { + if (audioOutput.srcObject !== evt.streams[0]) { + audioOutput.srcObject = evt.streams[0]; + audioOutput.play().catch(e => console.error("Audio play failed:", e)); + + if (!audioContext || audioContext.state === 'closed') { + console.warn("AudioContext not ready for output track analysis."); + return; + } + if (source_output) { + try { source_output.disconnect(); } catch (e) { console.warn("Error disconnecting previous output source:", e); } + source_output = null; + } + source_output = audioContext.createMediaStreamSource(evt.streams[0]); + analyser = audioContext.createAnalyser(); + source_output.connect(analyser); + analyser.fftSize = 2048; + dataArray = new Uint8Array(analyser.frequencyBinCount); + updateVisualization(); + } } }); - // Create data channel for messages dataChannel = peerConnection.createDataChannel('text'); dataChannel.onmessage = (event) => { const eventJson = JSON.parse(event.data); @@ -360,24 +453,9 @@ } }; - // Create and send offer const offer = await peerConnection.createOffer(); await peerConnection.setLocalDescription(offer); - await new Promise((resolve) => { - if (peerConnection.iceGatheringState === "complete") { - resolve(); - } else { - const checkState = () => { - if (peerConnection.iceGatheringState === "complete") { - peerConnection.removeEventListener("icegatheringstatechange", checkState); - resolve(); - } - }; - peerConnection.addEventListener("icegatheringstatechange", checkState); - } - }); - const response = await fetch('/webrtc/offer', { method: 'POST', headers: { 'Content-Type': 'application/json' }, @@ -394,7 +472,7 @@ showError(serverResponse.meta.error === 'concurrency_limit_reached' ? `Too many connections. Maximum limit is ${serverResponse.meta.limit}` : serverResponse.meta.error); - stop(); + stopWebRTC(); startButton.textContent = 'Start Recording'; return; } @@ -404,13 +482,17 @@ clearTimeout(timeoutId); console.error('Error setting up WebRTC:', err); showError('Failed to establish connection. Please try again.'); - stop(); + stopWebRTC(); startButton.textContent = 'Start Recording'; } } function updateVisualization() { - if (!analyser) return; + if (!analyser || !peerConnection || !['connected', 'connecting'].includes(peerConnection.connectionState)) { + const bars = document.querySelectorAll('.box'); + bars.forEach(bar => bar.style.transform = 'scaleY(0.1)'); + return; + } analyser.getByteFrequencyData(dataArray); const bars = document.querySelectorAll('.box'); @@ -420,32 +502,114 @@ bars[i].style.transform = `scaleY(${Math.max(0.1, barHeight)})`; } - animationId = requestAnimationFrame(updateVisualization); + requestAnimationFrame(updateVisualization); + } + + function updateAudioLevel() { + if (!analyser_input || !peerConnection || !['connected', 'connecting'].includes(peerConnection.connectionState)) { + const pulseCircle = document.querySelector('.pulse-circle'); + if (pulseCircle) { + pulseCircle.style.setProperty('--audio-level', 1); + } + return; + } + analyser_input.getByteFrequencyData(dataArray_input); + const average = Array.from(dataArray_input).reduce((a, b) => a + b, 0) / dataArray_input.length; + const audioLevel = average / 255; + + const pulseCircle = document.querySelector('.pulse-circle'); + if (pulseCircle) { + pulseCircle.style.setProperty('--audio-level', 1 + audioLevel); + } + + requestAnimationFrame(updateAudioLevel); } function stopWebRTC() { + console.log("Running stopWebRTC"); if (peerConnection) { - peerConnection.close(); + peerConnection.getSenders().forEach(sender => { + if (sender.track) { + sender.track.stop(); + } + }); + peerConnection.ontrack = null; + peerConnection.onicegatheringstatechange = null; + peerConnection.onconnectionstatechange = null; + + if (dataChannel) { + dataChannel.onmessage = null; + try { dataChannel.close(); } catch (e) { console.warn("Error closing data channel:", e); } + dataChannel = null; + } + try { peerConnection.close(); } catch (e) { console.warn("Error closing peer connection:", e); } + peerConnection = null; } - if (animationId) { - cancelAnimationFrame(animationId); + + if (audioOutput) { + audioOutput.pause(); + audioOutput.srcObject = null; } - if (audioContext) { - audioContext.close(); + + if (source_input) { + try { source_input.disconnect(); } catch (e) { console.warn("Error disconnecting input source:", e); } + source_input = null; } + if (source_output) { + try { source_output.disconnect(); } catch (e) { console.warn("Error disconnecting output source:", e); } + source_output = null; + } + + if (audioContext && audioContext.state !== 'closed') { + audioContext.close().then(() => { + console.log("AudioContext closed successfully."); + audioContext = null; + }).catch(e => { + console.error("Error closing AudioContext:", e); + audioContext = null; + }); + } else { + audioContext = null; + } + + analyser_input = null; + dataArray_input = null; + analyser = null; + dataArray = null; + + isMuted = false; + isRecording = false; updateButtonState(); + + const bars = document.querySelectorAll('.box'); + bars.forEach(bar => bar.style.transform = 'scaleY(0.1)'); + const pulseCircle = document.querySelector('.pulse-circle'); + if (pulseCircle) { + pulseCircle.style.setProperty('--audio-level', 1); + } } - startButton.addEventListener('click', () => { - if (!isRecording) { - setupWebRTC(); - startButton.classList.add('recording'); - } else { - stopWebRTC(); - startButton.classList.remove('recording'); + startButton.addEventListener('click', (event) => { + if (event.target.closest('.mute-toggle')) { + return; + } + + if (peerConnection && peerConnection.connectionState === 'connected') { + console.log("Stop button clicked"); + stopWebRTC(); + } else if (!peerConnection || ['new', 'closed', 'failed', 'disconnected'].includes(peerConnection.connectionState)) { + console.log("Start button clicked"); + if (!apiKeyInput.value) { + showError("Please enter your API Key."); + return; + } + setupWebRTC(); + isRecording = true; + updateButtonState(); } - isRecording = !isRecording; }); + + updateButtonState(); diff --git a/demo/talk_to_gemini/requirements.txt b/demo/talk_to_gemini/requirements.txt index e8cbeb2..ba9caa6 100644 --- a/demo/talk_to_gemini/requirements.txt +++ b/demo/talk_to_gemini/requirements.txt @@ -1,4 +1,4 @@ -fastrtc +fastrtc[vad]==0.0.20.rc2 python-dotenv google-genai twilio diff --git a/demo/talk_to_llama4/AV_Huggy.png b/demo/talk_to_llama4/AV_Huggy.png new file mode 100644 index 0000000..6a9fb74 Binary files /dev/null and b/demo/talk_to_llama4/AV_Huggy.png differ diff --git a/demo/talk_to_llama4/README.md b/demo/talk_to_llama4/README.md new file mode 100644 index 0000000..1e73774 --- /dev/null +++ b/demo/talk_to_llama4/README.md @@ -0,0 +1,15 @@ +--- +title: Talk to Llama 4 +emoji: 🦙 +colorFrom: purple +colorTo: red +sdk: gradio +sdk_version: 5.23.3 +app_file: app.py +pinned: false +license: mit +short_description: Talk to Llama 4 using Groq + Cloudflare +tags: [webrtc, websocket, gradio, secret|HF_TOKEN, secret|GROQ_API_KEY] +--- + +Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/demo/talk_to_llama4/app.py b/demo/talk_to_llama4/app.py new file mode 100644 index 0000000..4010fc5 --- /dev/null +++ b/demo/talk_to_llama4/app.py @@ -0,0 +1,136 @@ +import json +import os +from pathlib import Path + +import gradio as gr +import numpy as np +from dotenv import load_dotenv +from fastapi import FastAPI +from fastapi.responses import HTMLResponse, StreamingResponse +from fastrtc import ( + AdditionalOutputs, + CartesiaTTSOptions, + ReplyOnPause, + Stream, + get_cloudflare_turn_credentials_async, + get_current_context, + get_stt_model, + get_tts_model, +) +from groq import Groq +from numpy.typing import NDArray + +curr_dir = Path(__file__).parent +load_dotenv() + +tts_model = get_tts_model( + model="cartesia", cartesia_api_key=os.getenv("CARTESIA_API_KEY") +) +groq = Groq(api_key=os.getenv("GROQ_API_KEY")) +stt_model = get_stt_model() + +conversations: dict[str, list[dict[str, str]]] = {} + + +def response(user_audio: tuple[int, NDArray[np.int16]]): + context = get_current_context() + if context.webrtc_id not in conversations: + conversations[context.webrtc_id] = [ + { + "role": "system", + "content": ( + "You are a helpful assistant that can answer questions and help with tasks." + 'Please return a short (that will be converted to audio using a text-to-speech model) response and long response to this question. They can be the same if appropriate. Please return in JSON format\n\n{"short":, "long"}\n\n' + ), + } + ] + messages = conversations[context.webrtc_id] + + transcription = stt_model.stt(user_audio) + messages.append({"role": "user", "content": transcription}) + + completion = groq.chat.completions.create( # type: ignore + model="meta-llama/llama-4-scout-17b-16e-instruct", + messages=messages, # type: ignore + temperature=1, + max_completion_tokens=1024, + top_p=1, + stream=False, + response_format={"type": "json_object"}, + stop=None, + ) + response = completion.choices[0].message.content + response = json.loads(response) + short_response = response["short"] + long_response = response["long"] + messages.append({"role": "assistant", "content": long_response}) + conversations[context.webrtc_id] = messages + yield from tts_model.stream_tts_sync( + short_response, options=CartesiaTTSOptions(sample_rate=24_000) + ) + yield AdditionalOutputs(messages) + + +stream = Stream( + ReplyOnPause(response), + modality="audio", + mode="send-receive", + additional_outputs=[gr.Chatbot(type="messages")], + additional_outputs_handler=lambda old, new: new, + rtc_configuration=None, + ui_args={"hide_title": True}, +) + +with gr.Blocks() as demo: + gr.HTML( + f""" +

    + AV Huggy FastRTC + Cartesia TTS = Blazing Fast LLM Audio +

    + """ + ) + stream.ui.render() + +stream.ui = demo + +app = FastAPI() +stream.mount(app) + + +@app.get("/") +async def _(): + rtc_config = await get_cloudflare_turn_credentials_async() + html_content = (curr_dir / "index.html").read_text() + html_content = html_content.replace("__RTC_CONFIGURATION__", json.dumps(rtc_config)) + return HTMLResponse(content=html_content) + + +@app.get("/outputs") +async def _(webrtc_id: str): + async def output_stream(): + async for output in stream.output_stream(webrtc_id): + state = output.args[0] + for msg in state[-2:]: + data = { + "message": msg, + } + yield f"event: output\ndata: {json.dumps(data)}\n\n" + + return StreamingResponse(output_stream(), media_type="text/event-stream") + + +if __name__ == "__main__": + import os + from pathlib import Path + + if (mode := os.getenv("MODE")) == "UI": + stream.ui.launch( + server_port=7860, + allowed_paths=[str((Path(__file__).parent / "AV_Huggy.png").resolve())], + ) + elif mode == "PHONE": + raise ValueError("Phone mode not supported") + else: + import uvicorn + + uvicorn.run(app, host="0.0.0.0", port=7860) diff --git a/demo/talk_to_llama4/index.html b/demo/talk_to_llama4/index.html new file mode 100644 index 0000000..1b5ea12 --- /dev/null +++ b/demo/talk_to_llama4/index.html @@ -0,0 +1,839 @@ + + + + + + + Talk to Llama 4 + + + + +
    + +
    + +
    +

    Talk to LLaMA 4

    +

    Experience seamless real-time conversation thanks to Cloudflare and Hugging Face's FastRTC.

    +
    +
    + +
    +
    + +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    + +
    +
    + +
    + +
    +
    + + + + + + + \ No newline at end of file diff --git a/demo/talk_to_llama4/requirements.txt b/demo/talk_to_llama4/requirements.txt new file mode 100644 index 0000000..eabcb95 --- /dev/null +++ b/demo/talk_to_llama4/requirements.txt @@ -0,0 +1,3 @@ +fastrtc[vad, tts]==0.0.20.rc2 +groq +python-dotenv \ No newline at end of file diff --git a/demo/talk_to_openai/README.md b/demo/talk_to_openai/README.md index 7efde7d..e2f04a7 100644 --- a/demo/talk_to_openai/README.md +++ b/demo/talk_to_openai/README.md @@ -9,7 +9,7 @@ app_file: app.py pinned: false license: mit short_description: Talk to OpenAI using their multimodal API -tags: [webrtc, websocket, gradio, secret|TWILIO_ACCOUNT_SID, secret|TWILIO_AUTH_TOKEN, secret|OPENAI_API_KEY] +tags: [webrtc, websocket, gradio, secret|HF_TOKEN, secret|OPENAI_API_KEY] --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/demo/talk_to_openai/README_gradio.md b/demo/talk_to_openai/README_gradio.md index f495327..3f6fcc2 100644 --- a/demo/talk_to_openai/README_gradio.md +++ b/demo/talk_to_openai/README_gradio.md @@ -9,7 +9,7 @@ app_file: app.py pinned: false license: mit short_description: Talk to OpenAI (Gradio UI) -tags: [webrtc, websocket, gradio, secret|TWILIO_ACCOUNT_SID, secret|TWILIO_AUTH_TOKEN, secret|OPENAI_API_KEY] +tags: [webrtc, websocket, gradio, secret|HF_TOKEN, secret|OPENAI_API_KEY] --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/demo/talk_to_openai/app.py b/demo/talk_to_openai/app.py index 2bf13ab..3d05992 100644 --- a/demo/talk_to_openai/app.py +++ b/demo/talk_to_openai/app.py @@ -17,7 +17,6 @@ from fastrtc import ( wait_for_item, ) from gradio.utils import get_space -from openai.types.beta.realtime import ResponseAudioTranscriptDoneEvent load_dotenv() @@ -50,12 +49,32 @@ class OpenAIHandler(AsyncStreamHandler): model="gpt-4o-mini-realtime-preview-2024-12-17" ) as conn: await conn.session.update( - session={"turn_detection": {"type": "server_vad"}} + session={ + "turn_detection": {"type": "server_vad"}, + "input_audio_transcription": { + "model": "whisper-1", + "language": "en", + }, + } ) self.connection = conn async for event in self.connection: + # Handle interruptions + if event.type == "input_audio_buffer.speech_started": + self.clear_queue() + if ( + event.type + == "conversation.item.input_audio_transcription.completed" + ): + await self.output_queue.put( + AdditionalOutputs({"role": "user", "content": event.transcript}) + ) if event.type == "response.audio_transcript.done": - await self.output_queue.put(AdditionalOutputs(event)) + await self.output_queue.put( + AdditionalOutputs( + {"role": "assistant", "content": event.transcript} + ) + ) if event.type == "response.audio.delta": await self.output_queue.put( ( @@ -83,8 +102,8 @@ class OpenAIHandler(AsyncStreamHandler): self.connection = None -def update_chatbot(chatbot: list[dict], response: ResponseAudioTranscriptDoneEvent): - chatbot.append({"role": "assistant", "content": response.transcript}) +def update_chatbot(chatbot: list[dict], response: dict): + chatbot.append(response) return chatbot @@ -121,7 +140,7 @@ def _(webrtc_id: str): import json async for output in stream.output_stream(webrtc_id): - s = json.dumps({"role": "assistant", "content": output.args[0].transcript}) + s = json.dumps(output.args[0]) yield f"event: output\ndata: {s}\n\n" return StreamingResponse(output_stream(), media_type="text/event-stream") diff --git a/demo/talk_to_openai/index.html b/demo/talk_to_openai/index.html index 8ba7876..bad8825 100644 --- a/demo/talk_to_openai/index.html +++ b/demo/talk_to_openai/index.html @@ -45,20 +45,26 @@ .message { margin-bottom: 20px; - padding: 12px; - border-radius: 4px; + padding: 12px 16px; + border-radius: 8px; font-size: 16px; line-height: 1.5; + max-width: 70%; + clear: both; } .message.user { - background-color: #1a1a1a; - margin-left: 20%; + background-color: #2c2c2c; + float: right; + border-bottom-right-radius: 2px; + border: 1px solid #404040; } .message.assistant { background-color: #262626; - margin-right: 20%; + float: left; + border-bottom-left-radius: 2px; + border: 1px solid #333; } .controls { @@ -67,16 +73,21 @@ } button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 10px; + padding: 12px 24px; background-color: transparent; color: #ffffff; border: 1px solid #ffffff; - padding: 12px 24px; font-family: inherit; font-size: 16px; cursor: pointer; transition: all 0.3s; text-transform: uppercase; letter-spacing: 1px; + position: relative; } button:hover { @@ -116,9 +127,7 @@ .pulse-container { display: flex; align-items: center; - justify-content: center; gap: 12px; - min-width: 180px; } .pulse-circle { @@ -128,10 +137,47 @@ background-color: #ffffff; opacity: 0.2; flex-shrink: 0; - transform: translateX(-0%) scale(var(--audio-level, 1)); + transform: scale(var(--audio-level, 1)); transition: transform 0.1s ease; } + /* Fix button layout */ + button { + display: inline-flex; + align-items: center; + justify-content: center; + gap: 10px; + padding: 12px 24px; + background-color: transparent; + color: #ffffff; + border: 1px solid #ffffff; + font-family: inherit; + font-size: 16px; + cursor: pointer; + transition: all 0.3s; + text-transform: uppercase; + letter-spacing: 1px; + position: relative; + } + + .mute-toggle { + width: 24px; + height: 24px; + cursor: pointer; + flex-shrink: 0; + } + + .mute-toggle svg { + display: block; + width: 100%; + height: 100%; + } + + #start-button { + margin-left: auto; + margin-right: auto; + } + /* Add styles for toast notifications */ .toast { position: fixed; @@ -177,6 +223,7 @@ diff --git a/demo/talk_to_sambanova/requirements.txt b/demo/talk_to_sambanova/requirements.txt index 5642a08..02d70d3 100644 --- a/demo/talk_to_sambanova/requirements.txt +++ b/demo/talk_to_sambanova/requirements.txt @@ -1,4 +1,4 @@ -fastrtc[vad, stt] +fastrtc[vad, stt]==0.0.20.rc2 python-dotenv huggingface_hub>=0.29.0 twilio \ No newline at end of file diff --git a/demo/talk_to_smolagents/app.py b/demo/talk_to_smolagents/app.py index 0638c7b..66332db 100644 --- a/demo/talk_to_smolagents/app.py +++ b/demo/talk_to_smolagents/app.py @@ -1,5 +1,4 @@ from pathlib import Path -from typing import Dict, List from dotenv import load_dotenv from fastrtc import ( @@ -22,11 +21,11 @@ stt_model = get_stt_model() tts_model = get_tts_model() # Conversation state to maintain history -conversation_state: List[Dict[str, str]] = [] +conversation_state: list[dict[str, str]] = [] # System prompt for agent system_prompt = """You are a helpful assistant that can helps with finding places to -workremotely from. You should specifically check against reviews and ratings of the +work remotely from. You should specifically check against reviews and ratings of the place. You should use this criteria to find the best place to work from: - Price - Reviews @@ -78,9 +77,7 @@ def process_response(audio): response_content = agent.run(input_text) # Convert response to audio using TTS model - for audio_chunk in tts_model.stream_tts_sync(response_content or ""): - # Yield the audio chunk - yield audio_chunk + yield from tts_model.stream_tts_sync(response_content or "") stream = Stream( diff --git a/demo/webrtc_vs_websocket/app.py b/demo/webrtc_vs_websocket/app.py index 36e4e5b..a7c7479 100644 --- a/demo/webrtc_vs_websocket/app.py +++ b/demo/webrtc_vs_websocket/app.py @@ -76,14 +76,14 @@ def response( ) for chunk in aggregate_bytes_to_16bit(iterator): audio_array = np.frombuffer(chunk, dtype=np.int16).reshape(1, -1) - yield (24000, audio_array, "mono") + yield (24000, audio_array) chatbot = gr.Chatbot(type="messages") stream = Stream( modality="audio", mode="send-receive", - handler=ReplyOnPause(response), + handler=ReplyOnPause(response, input_sample_rate=24_000, output_sample_rate=24_000), additional_outputs_handler=lambda a, b: b, additional_inputs=[chatbot], additional_outputs=[chatbot], diff --git a/demo/webrtc_vs_websocket/index.html b/demo/webrtc_vs_websocket/index.html index cbc72b0..869e06f 100644 --- a/demo/webrtc_vs_websocket/index.html +++ b/demo/webrtc_vs_websocket/index.html @@ -390,35 +390,8 @@ rttValues: [] }; - // Load mu-law library - - // Add load promise to track when the script is ready - - - function resample(audioData, fromSampleRate, toSampleRate) { - const ratio = fromSampleRate / toSampleRate; - const newLength = Math.round(audioData.length / ratio); - const result = new Float32Array(newLength); - - for (let i = 0; i < newLength; i++) { - const position = i * ratio; - const index = Math.floor(position); - const fraction = position - index; - - if (index + 1 < audioData.length) { - result[i] = audioData[index] * (1 - fraction) + audioData[index + 1] * fraction; - } else { - result[i] = audioData[index]; - } - } - return result; - } function convertToMulaw(audioData, sampleRate) { - // Resample to 8000 Hz if needed - if (sampleRate !== 8000) { - audioData = resample(audioData, sampleRate, 8000); - } // Convert float32 [-1,1] to int16 [-32768,32767] const int16Data = new Int16Array(audioData.length); @@ -449,7 +422,7 @@ wsMetrics.startTime = performance.now(); // Create audio context and analyser for visualization - const audioContext = new AudioContext(); + const audioContext = new AudioContext({ sampleRate: 24000 }); const analyser = audioContext.createAnalyser(); const source = audioContext.createMediaStreamSource(stream); source.connect(analyser); diff --git a/demo/whisper_realtime/README.md b/demo/whisper_realtime/README.md index ec7e6cc..01d5cb5 100644 --- a/demo/whisper_realtime/README.md +++ b/demo/whisper_realtime/README.md @@ -9,7 +9,7 @@ app_file: app.py pinned: false license: mit short_description: Transcribe audio in realtime with Whisper -tags: [webrtc, websocket, gradio, secret|TWILIO_ACCOUNT_SID, secret|TWILIO_AUTH_TOKEN, secret|GROQ_API_KEY] +tags: [webrtc, websocket, gradio, secret|HF_TOKEN, secret|GROQ_API_KEY] --- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference \ No newline at end of file diff --git a/demo/whisper_realtime/README_gradio.md b/demo/whisper_realtime/README_gradio.md index 37b8d2f..fee69a4 100644 --- a/demo/whisper_realtime/README_gradio.md +++ b/demo/whisper_realtime/README_gradio.md @@ -12,8 +12,7 @@ tags: - webrtc - websocket - gradio -- secret|TWILIO_ACCOUNT_SID -- secret|TWILIO_AUTH_TOKEN +- secret|HF_TOKEN - secret|GROQ_API_KEY title: Whisper Realtime Transcription (Gradio UI) --- diff --git a/demo/whisper_realtime/index.html b/demo/whisper_realtime/index.html index d757040..696a69a 100644 --- a/demo/whisper_realtime/index.html +++ b/demo/whisper_realtime/index.html @@ -9,14 +9,21 @@ :root { --primary-gradient: linear-gradient(135deg, #f9a45c 0%, #e66465 100%); --background-cream: #faf8f5; + --background-cream-end: #f7f5f2; + /* Slightly warmer end color for body gradient */ --text-dark: #2d2d2d; + --transcript-bg: #ffffff; + /* White background for transcript area */ + --transcript-border: #e0e0e0; + /* Light border for transcript items */ } body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif; margin: 0; padding: 0; - background-color: var(--background-cream); + /* Apply a subtle vertical gradient to the body */ + background: linear-gradient(to bottom, var(--background-cream), var(--background-cream-end)); color: var(--text-dark); min-height: 100vh; } @@ -43,18 +50,26 @@ .container { max-width: 1000px; - margin: 1.5rem auto; + margin: 2.5rem auto; + /* Increased top/bottom margin */ padding: 0 2rem; } .transcript-container { - border-radius: 8px; - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06); + border-radius: 12px; + /* Slightly larger radius */ + box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08); + /* Enhanced shadow */ padding: 1.5rem; - height: 300px; + height: 350px; + /* Increased height */ overflow-y: auto; - margin-bottom: 1.5rem; - border: 1px solid rgba(0, 0, 0, 0.1); + margin-bottom: 2rem; + /* Increased margin */ + border: 1px solid rgba(0, 0, 0, 0.05); + /* Softer border */ + background-color: var(--transcript-bg); + /* Use the new variable */ } .controls { @@ -73,6 +88,8 @@ transition: all 0.2s ease; font-weight: 500; min-width: 180px; + position: relative; + padding-right: 50px; } button:hover { @@ -86,22 +103,39 @@ /* Transcript text styling */ .transcript-container p { - margin: 0.4rem 0; - padding: 0.6rem; + margin: 0.6rem 0; + /* Increased vertical margin */ + padding: 0.8rem 1rem; + /* Increased padding */ background: var(--background-cream); - border-radius: 4px; - line-height: 1.4; - font-size: 0.95rem; + /* Use the lighter cream for contrast */ + border-radius: 6px; + /* Slightly larger radius */ + line-height: 1.5; + /* Improved line spacing */ + font-size: 0.98rem; + /* Slightly larger font */ + border-left: 3px solid var(--transcript-border); + /* Add a subtle left border */ + transition: background-color 0.2s ease; + /* Smooth hover effect */ } - /* Custom scrollbar - made thinner */ + .transcript-container p:hover { + background-color: #fdfbf9; + /* Slightly change background on hover */ + } + + /* Custom scrollbar - update track color */ .transcript-container::-webkit-scrollbar { - width: 6px; + width: 8px; + /* Slightly wider scrollbar */ } .transcript-container::-webkit-scrollbar-track { - background: var(--background-cream); - border-radius: 3px; + background: var(--background-cream-end); + /* Match body end gradient */ + border-radius: 4px; } .transcript-container::-webkit-scrollbar-thumb { @@ -176,6 +210,40 @@ transition: transform 0.1s ease; } + /* Styles for the mute button */ + .mute-toggle { + position: absolute; + right: 10px; + top: 50%; + transform: translateY(-50%); + width: 24px; + height: 24px; + cursor: pointer; + display: flex; + align-items: center; + justify-content: center; + } + + .mute-toggle svg { + width: 20px; + height: 20px; + stroke: white; + } + + /* Adjust layout for button content when mute is present */ + .button-content { + display: flex; + align-items: center; + justify-content: center; + width: calc(100% - 40px); + margin-right: 40px; + } + + .icon-with-spinner, + .pulse-container { + width: 100%; + } + @keyframes spin { to { transform: rotate(360deg); @@ -206,10 +274,29 @@ let audioContext, analyser, audioSource; let audioLevel = 0; let animationFrame; + let isMuted = false; const startButton = document.getElementById('start-button'); const transcriptDiv = document.getElementById('transcript'); + // SVG Icons + const micIconSVG = ` + + + + + + `; + + const micMutedIconSVG = ` + + + + + + + `; + function showError(message) { const toast = document.getElementById('error-toast'); toast.textContent = message; @@ -241,25 +328,63 @@ } function updateButtonState() { + // Remove existing mute listener if present + const existingMuteButton = startButton.querySelector('.mute-toggle'); + if (existingMuteButton) { + existingMuteButton.removeEventListener('click', toggleMute); + existingMuteButton.remove(); + } + if (peerConnection && (peerConnection.connectionState === 'connecting' || peerConnection.connectionState === 'new')) { startButton.innerHTML = ` -
    -
    - Connecting... +
    +
    +
    + Connecting... +
    `; + startButton.disabled = true; } else if (peerConnection && peerConnection.connectionState === 'connected') { startButton.innerHTML = ` -
    -
    - Stop Recording +
    +
    +
    + Stop Recording +
    +
    +
    + ${isMuted ? micMutedIconSVG : micIconSVG}
    `; + startButton.disabled = false; + const muteButton = startButton.querySelector('.mute-toggle'); + if (muteButton) { + muteButton.addEventListener('click', toggleMute); + } } else { startButton.innerHTML = 'Start Recording'; + startButton.disabled = false; } } + function toggleMute(event) { + event.stopPropagation(); + if (!peerConnection || peerConnection.connectionState !== 'connected') return; + + isMuted = !isMuted; + console.log("Mute toggled:", isMuted); + + peerConnection.getSenders().forEach(sender => { + if (sender.track && sender.track.kind === 'audio') { + sender.track.enabled = !isMuted; + console.log(`Audio track ${sender.track.id} enabled: ${!isMuted}`); + } + }); + + updateButtonState(); + } + function setupAudioVisualization(stream) { audioContext = new (window.AudioContext || window.webkitAudioContext)(); analyser = audioContext.createAnalyser(); @@ -321,6 +446,21 @@ updateButtonState(); }); + peerConnection.onicecandidate = ({ candidate }) => { + if (candidate) { + console.debug("Sending ICE candidate", candidate); + fetch('/webrtc/offer', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + candidate: candidate.toJSON(), + webrtc_id: webrtc_id, + type: "ice-candidate", + }) + }) + } + }; + // Create data channel for messages const dataChannel = peerConnection.createDataChannel('text'); dataChannel.onmessage = handleMessage; @@ -329,20 +469,6 @@ const offer = await peerConnection.createOffer(); await peerConnection.setLocalDescription(offer); - await new Promise((resolve) => { - if (peerConnection.iceGatheringState === "complete") { - resolve(); - } else { - const checkState = () => { - if (peerConnection.iceGatheringState === "complete") { - peerConnection.removeEventListener("icegatheringstatechange", checkState); - resolve(); - } - }; - peerConnection.addEventListener("icegatheringstatechange", checkState); - } - }); - webrtc_id = Math.random().toString(36).substring(7); const response = await fetch('/webrtc/offer', { @@ -392,41 +518,45 @@ function stop() { if (animationFrame) { cancelAnimationFrame(animationFrame); + animationFrame = null; } if (audioContext) { - audioContext.close(); + audioContext.close().catch(e => console.error("Error closing AudioContext:", e)); audioContext = null; analyser = null; audioSource = null; } if (peerConnection) { - if (peerConnection.getTransceivers) { - peerConnection.getTransceivers().forEach(transceiver => { - if (transceiver.stop) { - transceiver.stop(); + if (peerConnection.getSenders) { + peerConnection.getSenders().forEach(sender => { + if (sender.track) { + sender.track.stop(); + console.log(`Track ${sender.track.id} stopped.`); } }); } - - if (peerConnection.getSenders) { - peerConnection.getSenders().forEach(sender => { - if (sender.track && sender.track.stop) sender.track.stop(); - }); - } - - setTimeout(() => { - peerConnection.close(); - }, 500); + peerConnection.close(); + peerConnection = null; + console.log("Peer connection closed."); } audioLevel = 0; + isMuted = false; updateButtonState(); } - startButton.addEventListener('click', () => { - if (startButton.textContent === 'Start Recording') { - setupWebRTC(); - } else { + startButton.addEventListener('click', (event) => { + if (event.target.closest('.mute-toggle')) { + return; + } + + if (peerConnection && peerConnection.connectionState === 'connected') { + console.log("Stop button clicked"); stop(); + } else if (!peerConnection || ['new', 'closed', 'failed', 'disconnected'].includes(peerConnection.connectionState)) { + console.log("Start button clicked"); + transcriptDiv.innerHTML = ''; + setupWebRTC(); + updateButtonState(); } }); diff --git a/demo/whisper_realtime/requirements.txt b/demo/whisper_realtime/requirements.txt index 5ade2d4..c4e7301 100644 --- a/demo/whisper_realtime/requirements.txt +++ b/demo/whisper_realtime/requirements.txt @@ -1,4 +1,3 @@ -fastrtc[vad] +fastrtc[vad]==0.0.20.rc2 groq -python-dotenv -twilio \ No newline at end of file +python-dotenv \ No newline at end of file diff --git a/docs/advanced-configuration.md b/docs/advanced-configuration.md index 7e3fd8b..615ab79 100644 --- a/docs/advanced-configuration.md +++ b/docs/advanced-configuration.md @@ -108,7 +108,7 @@ stream = Stream( ## Audio Icon You can display an icon of your choice instead of the default wave animation for audio streaming. -Pass any local path or url to an image (svg, png, jpeg) to the components `icon` parameter. This will display the icon as a circular button. When audio is sent or recevied (depending on the `mode` parameter) a pulse animation will emanate from the button. +Pass any local path or url to an image (svg, png, jpeg) to the components `icon` parameter. This will display the icon as a circular button. When audio is sent or received (depending on the `mode` parameter) a pulse animation will emanate from the button. You can control the button color and pulse color with `icon_button_color` and `pulse_color` parameters. They can take any valid css color. diff --git a/docs/cookbook.md b/docs/cookbook.md index 98a968f..47f8055 100644 --- a/docs/cookbook.md +++ b/docs/cookbook.md @@ -23,6 +23,7 @@ A collection of applications built with FastRTC. Click on the tags below to find + @@ -61,6 +62,32 @@ document.querySelectorAll('.tag-button').forEach(button => {
    +- :speaking_head:{ .lg .middle }:llama:{ .lg .middle } __Talk to Llama 4__ +{: data-tags="audio,llm,voice-chat"} + + --- + + Talk to Llama 4 using Groq + Cloudflare. + + + + [:octicons-arrow-right-24: Demo](https://huggingface.co/spaces/fastrtc/talk-to-llama4) + + [:octicons-code-16: Code](https://huggingface.co/spaces/fastrtc/talk-to-llama4/blob/main/app.py) + +- :speaking_head:{ .lg .middle }:llama:{ .lg .middle } __Integrated Textbox__ +{: data-tags="audio,llm,text,voice-chat"} + + --- + + Talk or type to any LLM with FastRTC's integrated audio + text textbox. + + + + [:octicons-arrow-right-24: Demo](https://huggingface.co/spaces/fastrtc/integrated-textbox) + + [:octicons-code-16: Code](https://huggingface.co/spaces/fastrtc/integrated-textbox/blob/main/app.py) + - :speaking_head:{ .lg .middle }:eyes:{ .lg .middle } __Gemini Audio Video Chat__ {: data-tags="audio,video,real-time-api"} diff --git a/docs/deployment.md b/docs/deployment.md index 5f14448..0b88e3b 100644 --- a/docs/deployment.md +++ b/docs/deployment.md @@ -3,27 +3,78 @@ When deploying in cloud environments with firewalls (like Hugging Face Spaces, R !!! tip The `rtc_configuration` parameter of the `Stream` class also be passed to the [`WebRTC`](../userguide/gradio) component directly if you're building a standalone gradio app. -## Community Server -Hugging Face graciously provides a TURN server for the community. +## Cloudflare Calls API + +Cloudflare also offers a managed TURN server with [Cloudflare Calls](https://www.cloudflare.com/en-au/developer-platform/products/cloudflare-calls/). + +### With a Hugging Face Token + +Cloudflare and Hugging Face have partnered to allow you to stream 10gb of WebRTC traffic per month for free with a Hugging Face account! + +```python +from fastrtc import Stream, get_cloudflare_turn_credentials_async, get_cloudflare_turn_credentials + +# Make sure the HF_TOKEN environment variable is set +# Or pass in a callable with all arguments set + +# make sure you don't commit your token to git! +TOKEN = "hf_..." +async def get_credentials(): + return await get_cloudflare_turn_credentials_async(hf_token=TOKEN) + +stream = Stream( + handler=..., + rtc_configuration=get_credentials, + server_rtc_configuration=get_cloudflare_turn_credentials(ttl=360_000) + modality="audio", + mode="send-receive", +) +``` + +!!! tip + Setting an rtc configuration in the server is recommended but not required. It's a good practice to set short lived credentials in the client (default `ttl` value of 10 minutes when calling `get_cloudflare_turn_credentials*`) but you can share the same credentials between server and client. + +### With a Cloudflare API Token + +Once you have exhausted your monthly quota, you can create a **free** Cloudflare account. + +Create an [account](https://developers.cloudflare.com/fundamentals/setup/account/create-account/) and head to the [Calls section in your dashboard](https://dash.cloudflare.com/?to=/:account/calls). + +Choose `Create -> TURN App`, give it a name (like `fastrtc-demo`), and then hit the Create button. + +Take note of the Turn Token ID (often exported as `TURN_KEY_ID`) and API Token (exported as `TURN_KEY_API_TOKEN`). + +You can then connect from the WebRTC component like so: + +```python +from fastrtc import Stream, get_cloudflare_turn_credentials_async + +# Make sure the TURN_KEY_ID and TURN_KEY_API_TOKEN environment variables are set +stream = Stream( + handler=..., + rtc_configuration=get_cloudflare_turn_credentials_async, + modality="audio", + mode="send-receive", +) +``` + +## Community Server (Deprecated) + +Hugging Face graciously provides 10gb of TURN traffic through Cloudflare's global network. In order to use it, you need to first create a Hugging Face account by going to [huggingface.co](https://huggingface.co/). - -Then navigate to this [space](https://huggingface.co/spaces/fastrtc/turn-server-login) and follow the instructions on the page. You just have to click the "Log in" button and then the "Sign Up" button. - -![turn_login](https://github.com/user-attachments/assets/cefa8dec-487e-47d8-bb96-1a14a701f6e5) +Then you can create an [access token](https://huggingface.co/docs/hub/en/security-tokens). Then you can use the `get_hf_turn_credentials` helper to get your credentials: ```python from fastrtc import get_hf_turn_credentials, Stream -# Pass a valid access token for your Hugging Face account -# or set the HF_TOKEN environment variable -credentials = get_hf_turn_credentials(token=None) +# Make sure the HF_TOKEN environment variable is set Stream( handler=..., - rtc_configuration=credentials, + rtc_configuration=get_hf_turn_credentials, modality="audio", mode="send-receive" ) @@ -31,15 +82,14 @@ Stream( !!! warning - This is a shared resource so we make no latency/availability guarantees. - For more robust options, see the Twilio, Cloudflare and self-hosting options below. + This function is now deprecated. Please use `get_cloudflare_turn_credentials` instead. ## Twilio API An easy way to do this is to use a service like Twilio. -Create a **free** [account](https://login.twilio.com/u/signup) and the install the `twilio` package with pip (`pip install twilio`). You can then connect from the WebRTC component like so: +Create a **free** [account](https://login.twilio.com/u/signup) and then install the `twilio` package with pip (`pip install twilio`). You can then connect from the WebRTC component like so: ```python from fastrtc import Stream @@ -78,50 +128,6 @@ Stream( rtc_configuration = get_twilio_turn_credentials() ``` -## Cloudflare Calls API - -Cloudflare also offers a managed TURN server with [Cloudflare Calls](https://www.cloudflare.com/en-au/developer-platform/products/cloudflare-calls/). - -Create a **free** [account](https://developers.cloudflare.com/fundamentals/setup/account/create-account/) and head to the [Calls section in your dashboard](https://dash.cloudflare.com/?to=/:account/calls). - -Choose `Create -> TURN App`, give it a name (like `fastrtc-demo`), and then hit the Create button. - -Take note of the Turn Token ID (often exported as `TURN_KEY_ID`) and API Token (exported as `TURN_KEY_API_TOKEN`). - -You can then connect from the WebRTC component like so: - -```python -from fastrtc import Stream -import requests -import os - -turn_key_id = os.environ.get("TURN_KEY_ID") -turn_key_api_token = os.environ.get("TURN_KEY_API_TOKEN") -ttl = 86400 # Can modify TTL, here it's set to 24 hours - -response = requests.post( - f"https://rtc.live.cloudflare.com/v1/turn/keys/{turn_key_id}/credentials/generate-ice-servers", - headers={ - "Authorization": f"Bearer {turn_key_api_token}", - "Content-Type": "application/json", - }, - json={"ttl": ttl}, -) -if response.ok: - rtc_configuration = response.json() -else: - raise Exception( - f"Failed to get TURN credentials: {response.status_code} {response.text}" - ) - -stream = Stream( - handler=..., - rtc_configuration=rtc_configuration, - modality="audio", - mode="send-receive", -) -``` - ## Self Hosting We have developed a script that can automatically deploy a TURN server to Amazon Web Services (AWS). You can follow the instructions [here](https://github.com/freddyaboulton/turn-server-deploy) or this guide. diff --git a/docs/index.md b/docs/index.md index 300f4e9..58a6dba 100644 --- a/docs/index.md +++ b/docs/index.md @@ -8,7 +8,7 @@
    Static Badge -Static Badge +Static Badge

    @@ -184,7 +184,7 @@ Learn more about the [Stream](userguide/streams) in the user guide. ## Examples See the [cookbook](/cookbook). -Follow and join or [organization](https://huggingface.co/fastrtc) on Hugging Face! +Follow and join our [organization](https://huggingface.co/fastrtc) on Hugging Face!
    diff --git a/docs/reference/credentials.md b/docs/reference/credentials.md new file mode 100644 index 0000000..21356ec --- /dev/null +++ b/docs/reference/credentials.md @@ -0,0 +1,267 @@ +# TURN Credential Utils + +## `get_turn_credentials_async` + +```python +async def get_turn_credentials_async( + method: Literal["hf", "twilio", "cloudflare"] = "cloudflare", + **kwargs +): +``` + +Retrieves TURN credentials from the specified provider. +This can be passed directly to the Stream class and it will be called for each +unique WebRTC connection via the Gradio UI. When mounting to FastAPI, call this function +yourself to return the credentials to the frontend client, for example, in the +index route, you can call this function and embed the credentials in the source code of the index.html. +See the FastRTC spaces at hf.co/fastrtc for an example. + +Acts as a dispatcher function to call the appropriate credential retrieval +function based on the method specified. + +Args: +``` +method: Literal["hf", "twilio", "cloudflare"] | None + The provider to use. 'hf' uses the deprecated Hugging Face endpoint. + 'cloudflare' uses either Cloudflare keys or the HF endpoint. + 'twilio' uses the Twilio API. Defaults to "cloudflare". +**kwargs: + Additional keyword arguments passed directly to the underlying + provider-specific function (e.g., `token`, `ttl` for 'hf'; + `twilio_sid`, `twilio_token` for 'twilio'; `turn_key_id`, + `turn_key_api_token`, `hf_token`, `ttl` for 'cloudflare'). +``` + +Returns: +``` +dict: + A dictionary containing the TURN credentials from the chosen provider. +``` + +Raises: +``` +ValueError: + If an invalid method is specified. + Also raises exceptions from the underlying provider functions (see their + docstrings). +``` + +Example +```python +>>> from fastrtc import get_turn_credentials_async, Stream +>>> credentials = await get_turn_credentials_async() +>>> print(credentials) +>>> # Can pass directly to stream class +>>> stream = Stream(..., rtc_configuration=get_turn_credentials_async) +``` + +## `get_turn_credentials` + +```python +def get_turn_credentials( + method: Literal["hf", "twilio", "cloudflare"] = "cloudflare", + **kwargs +): +``` + +Retrieves TURN credentials from the specified provider. +This can be passed directly to the Stream class and it will be called for each +unique WebRTC connection via the Gradio UI. When mounting to FastAPI, call this function +yourself to return the credentials to the frontend client, for example, in the +index route, you can call this function and embed the credentials in the source code of the index.html. +See the FastRTC spaces at hf.co/fastrtc for an example. + +Acts as a dispatcher function to call the appropriate credential retrieval +function based on the method specified. + +Args: +``` +method: Literal["hf", "twilio", "cloudflare"] | None + The provider to use. 'hf' uses the deprecated Hugging Face endpoint. + 'cloudflare' uses either Cloudflare keys or the HF endpoint. + 'twilio' uses the Twilio API. Defaults to "cloudflare". +**kwargs: + Additional keyword arguments passed directly to the underlying + provider-specific function (e.g., `token`, `ttl` for 'hf'; + `twilio_sid`, `twilio_token` for 'twilio'; `turn_key_id`, + `turn_key_api_token`, `hf_token`, `ttl` for 'cloudflare'). +``` + +Returns: +``` +dict: + A dictionary containing the TURN credentials from the chosen provider. +``` + +Raises: +``` +ValueError: + If an invalid method is specified. + Also raises exceptions from the underlying provider functions (see their + docstrings). +``` + +Example +```python +>>> from fastrtc import get_turn_credentials, Stream +>>> credentials = get_turn_credentials() +>>> print(credentials) +>>> # Can pass directly to stream class +>>> stream = Stream(..., rtc_configuration=get_turn_credentials_async) +``` + +## `get_cloudflare_turn_credentials_async` + +```python +async def get_cloudflare_turn_credentials_async( + turn_key_id=None, + turn_key_api_token=None, + hf_token=None, + ttl=600, + client: httpx.AsyncClient | None = None, +): +``` + +Asynchronously retrieves TURN credentials from Cloudflare or Hugging Face. + +Asynchronously fetches TURN server credentials either directly from Cloudflare +using API keys or via the Hugging Face TURN endpoint using an HF token. The HF +token method takes precedence if provided. + +Args: +``` +turn_key_id (str, optional): + Cloudflare TURN key ID. Defaults to None, + in which case the CLOUDFLARE_TURN_KEY_ID environment variable is used. +turn_key_api_token (str, optional): + Cloudflare TURN key API token. + Defaults to None, in which case the CLOUDFLARE_TURN_KEY_API_TOKEN + environment variable is used. +hf_token (str, optional): + Hugging Face API token. If provided, this method + is used instead of Cloudflare keys. + Defaults to None, in which case the HF_TOKEN environment variable is used. +ttl (int, optional): Time-to-live for the credentials in seconds. + Defaults to 600. +client (httpx.AsyncClient | None, optional): An existing httpx async client + to use for the request. If None, a new client is created per request. + Defaults to None. +``` + +Returns: +``` +dict: A dictionary containing the TURN credentials (ICE servers). +``` + +Raises: +``` +ValueError: If neither HF token nor Cloudflare keys (either as arguments + or environment variables) are provided. +Exception: If the request to the credential server fails. +``` + +Example +```python +>>> from fastrtc import get_cloudflare_turn_crendials_async, Stream +>>> credentials = await get_cloudflare_turn_credentials_async() +>>> print(credentials) +>>> # Can pass directly to stream class +>>> stream = Stream(..., rtc_configuration=get_turn_credentials_async) +``` + + +## `get_cloudflare_turn_credentials` + +```python +def get_cloudflare_turn_credentials( + turn_key_id=None, + turn_key_api_token=None, + hf_token=None, + ttl=600, + client: httpx.AsyncClient | None = None, +): +``` + +Retrieves TURN credentials from Cloudflare or Hugging Face. + +Fetches TURN server credentials either directly from Cloudflare using API keys +or via the Hugging Face TURN endpoint using an HF token. The HF token method +takes precedence if provided. + +Args: +``` +turn_key_id (str, optional): + Cloudflare TURN key ID. Defaults to None, + in which case the CLOUDFLARE_TURN_KEY_ID environment variable is used. +turn_key_api_token (str, optional): + Cloudflare TURN key API token. + Defaults to None, in which case the CLOUDFLARE_TURN_KEY_API_TOKEN + environment variable is used. +hf_token (str, optional): + Hugging Face API token. If provided, this method + is used instead of Cloudflare keys. + Defaults to None, in which case the HF_TOKEN environment variable is used. +ttl (int, optional): Time-to-live for the credentials in seconds. + Defaults to 600. +client (httpx.AsyncClient | None, optional): An existing httpx async client + to use for the request. If None, a new client is created per request. + Defaults to None. +``` + +Returns: +``` +dict: A dictionary containing the TURN credentials (ICE servers). +``` + +Raises: +``` +ValueError: If neither HF token nor Cloudflare keys (either as arguments + or environment variables) are provided. +Exception: If the request to the credential server fails. +``` + +Example +```python +>>> from fastrtc import get_cloudflare_turn_crendials_async, Stream +>>> credentials = await get_cloudflare_turn_credentials_async() +>>> print(credentials) +>>> # Can pass directly to stream class +>>> stream = Stream(..., rtc_configuration=get_turn_credentials_async) +``` + +## `get_twilio_turn_credentials` + +```python +def get_twilio_turn_credentials( + twilio_sid=None, + twilio_token=None): +``` + +Retrieves TURN credentials from Twilio. + +Uses the Twilio REST API to generate temporary TURN credentials. Requires +the `twilio` package to be installed. + +Args: +``` +twilio_sid (str, optional): + Twilio Account SID. Defaults to None, in which + case the TWILIO_ACCOUNT_SID environment variable is used. +twilio_token (str, optional): + Twilio Auth Token. Defaults to None, in which + case the TWILIO_AUTH_TOKEN environment variable is used. +``` +Returns: +``` +dict: + A dictionary containing the TURN credentials formatted for WebRTC, + including 'iceServers' and 'iceTransportPolicy'. +``` + +Raises: +``` +ImportError: If the `twilio` package is not installed. +ValueError: If Twilio credentials (SID and token) are not provided either + as arguments or environment variables. +TwilioRestException: If the Twilio API request fails. +``` \ No newline at end of file diff --git a/docs/reference/reply_on_pause.md b/docs/reference/reply_on_pause.md new file mode 100644 index 0000000..3429020 --- /dev/null +++ b/docs/reference/reply_on_pause.md @@ -0,0 +1,326 @@ +## `ReplyOnPause` Class + +```python +ReplyOnPause( + fn: ReplyFnGenerator, + startup_fn: Callable | None = None, + algo_options: AlgoOptions | None = None, + model_options: ModelOptions | None = None, + can_interrupt: bool = True, + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, + model: PauseDetectionModel | None = None, +) +``` + +A stream handler that processes incoming audio, detects pauses, and triggers a reply function (`fn`) when a pause is detected. + +This handler accumulates audio chunks, uses a Voice Activity Detection (VAD) model to determine speech segments, and identifies pauses based on configurable thresholds. Once a pause is detected after speech has started, it calls the provided generator function `fn` with the accumulated audio. + +It can optionally run a `startup_fn` at the beginning and supports interruption of the reply function if new audio arrives. + +### Methods + +#### `__init__` + +```python +__init__( + fn: ReplyFnGenerator, + startup_fn: Callable | None = None, + algo_options: AlgoOptions | None = None, + model_options: ModelOptions | None = None, + can_interrupt: bool = True, + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, + model: PauseDetectionModel | None = None, +) +``` + +Initializes the ReplyOnPause handler. + +**Args:** + +| Name | Type | Description | +| :------------------- | :---------------------------------- | :------------------------------------------------------------------------------------------------------- | +| `fn` | `ReplyFnGenerator` | The generator function to execute upon pause detection. It receives `(sample_rate, audio_array)` and optionally `*args`. | +| `startup_fn` | `Callable | None` | An optional function to run once at the beginning. | +| `algo_options` | `AlgoOptions | None` | Options for the pause detection algorithm. | +| `model_options` | `ModelOptions | None` | Options for the VAD model. | +| `can_interrupt` | `bool` | If True, incoming audio during `fn` execution will stop the generator and process the new audio. | +| `expected_layout` | `Literal["mono", "stereo"]` | Expected input audio layout ('mono' or 'stereo'). | +| `output_sample_rate` | `int` | The sample rate expected for audio yielded by `fn`. | +| `output_frame_size` | `int | None` | Deprecated. | +| `input_sample_rate` | `int` | The expected sample rate of incoming audio. | +| `model` | `PauseDetectionModel | None` | An optional pre-initialized VAD model instance. | + +--- + +#### `receive` + +```python +receive(frame: tuple[int, np.ndarray]) -> None +``` + +Receives an audio frame from the stream. Processes the audio frame using `process_audio`. If a pause is detected, it sets the event. If interruption is enabled and a reply is ongoing, it closes the current generator and clears the processing queue. + +**Args:** + +| Name | Type | Description | +| :------ | :--------------------- | :---------------------------------------------------------------- | +| `frame` | `tuple[int, np.ndarray]` | A tuple containing the sample rate and the audio frame data. | + +--- + +#### `emit` + +```python +emit() -> EmitType | None +``` + +Produces the next output chunk from the reply generator (`fn`). + +This method is called repeatedly after a pause is detected (event is set). If the generator is not already running, it initializes it by calling `fn` with the accumulated audio and any required additional arguments. It then yields the next item from the generator. Handles both sync and async generators. Resets the state upon generator completion or error. + +**Returns:** + +| Type | Description | +| :--------------- | :------------------------------------------------------------------------------- | +| `EmitType | None` | The next output item from the generator, or None if no pause event has occurred or the generator is exhausted. | + +**Raises:** + +* **`Exception`**: Re-raises exceptions occurring within the `fn` generator. + +--- + + +#### `start_up` + +```python +start_up() +``` + +Executes the startup function `startup_fn` if provided. Waits for additional arguments if needed before calling `startup_fn`. + +--- + +#### `copy` + +```python +copy() -> ReplyOnPause +``` + +Creates a new instance of ReplyOnPause with the same configuration. + +**Returns:** + +| Type | Description | +| :------------- | :---------------------------------------------------- | +| `ReplyOnPause` | A new `ReplyOnPause` instance with identical settings. | + +--- + +#### `determine_pause` + +```python +determine_pause(audio: np.ndarray, sampling_rate: int, state: AppState) -> bool +``` + +Analyzes an audio chunk to detect if a significant pause occurred after speech. + +Uses the VAD model to measure speech duration within the chunk. Updates the application state (`state`) regarding whether talking has started and accumulates speech segments. + +**Args:** + +| Name | Type | Description | +| :-------------- | :----------- | :-------------------------------------- | +| `audio` | `np.ndarray` | The numpy array containing the audio chunk. | +| `sampling_rate` | `int` | The sample rate of the audio chunk. | +| `state` | `AppState` | The current application state. | + +**Returns:** + +| Type | Description | +| :----- | :------------------------------------------------------------------------------------------------------ | +| `bool` | True if a pause satisfying the configured thresholds is detected after speech has started, False otherwise. | + +--- + +#### `process_audio` + +```python +process_audio(audio: tuple[int, np.ndarray], state: AppState) -> None +``` + +Processes an incoming audio frame. Appends the frame to the buffer, runs pause detection on the buffer, and updates the application state. + +**Args:** + +| Name | Type | Description | +| :------ | :--------------------- | :---------------------------------------------------------------- | +| `audio` | `tuple[int, np.ndarray]` | A tuple containing the sample rate and the audio frame data. | +| `state` | `AppState` | The current application state to update. | + +--- + +#### `reset` + +```python +reset() +``` + +Resets the handler state to its initial condition. Clears accumulated audio, resets state flags, closes any active generator, and clears the event flag. + +--- + +#### `trigger_response` + +```python +trigger_response() +``` + +Manually triggers the response generation process. Sets the event flag, effectively simulating a pause detection. Initializes the stream buffer if it's empty. + +--- + + + +## `ReplyOnStopWords` Class + +```python +ReplyOnStopWords( + fn: ReplyFnGenerator, + stop_words: list[str], + startup_fn: Callable | None = None, + algo_options: AlgoOptions | None = None, + model_options: ModelOptions | None = None, + can_interrupt: bool = True, + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, + model: PauseDetectionModel | None = None, +) +``` + +A stream handler that extends `ReplyOnPause` to trigger based on stop words followed by a pause. + +This handler listens to the incoming audio stream, performs Speech-to-Text (STT) to detect predefined stop words. Once a stop word is detected, it waits for a subsequent pause in speech (using the VAD model) before triggering the reply function (`fn`) with the audio recorded *after* the stop word. + +### Methods + +#### `__init__` + +```python +__init__( + fn: ReplyFnGenerator, + stop_words: list[str], + startup_fn: Callable | None = None, + algo_options: AlgoOptions | None = None, + model_options: ModelOptions | None = None, + can_interrupt: bool = True, + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, + model: PauseDetectionModel | None = None, +) +``` + +Initializes the ReplyOnStopWords handler. + +**Args:** + +*(Inherits Args from `ReplyOnPause.__init__`)* + +| Name | Type | Description | +| :----------- | :---------- | :------------------------------------------------------------------------------------------------------- | +| `stop_words` | `list[str]` | A list of strings (words or phrases) to listen for. Detection is case-insensitive and ignores punctuation. | + +--- + +#### `stop_word_detected` + +```python +stop_word_detected(text: str) -> bool +``` + +Checks if any of the configured stop words are present in the text. Performs a case-insensitive search, treating multi-word stop phrases correctly and ignoring basic punctuation. + +**Args:** + +| Name | Type | Description | +| :----- | :----- | :----------------------------------- | +| `text` | `str` | The text transcribed from the audio. | + +**Returns:** + +| Type | Description | +| :----- | :---------------------------------------- | +| `bool` | True if a stop word is found, False otherwise. | + +--- + +#### `send_stopword` + +```python +send_stopword() +``` + +Sends a 'stopword' message asynchronously via the communication channel (if configured). + +--- + +#### `determine_pause` + +```python +determine_pause(audio: np.ndarray, sampling_rate: int, state: ReplyOnStopWordsState) -> bool +``` + +Analyzes an audio chunk to detect stop words and subsequent pauses. Overrides the `ReplyOnPause.determine_pause` method. First, it performs STT on the audio buffer to detect stop words. Once a stop word is detected (`state.stop_word_detected` is True), it then uses the VAD model to detect a pause in the audio *following* the stop word. + +**Args:** + +| Name | Type | Description | +| :-------------- | :---------------------- | :--------------------------------------------------- | +| `audio` | `np.ndarray` | The numpy array containing the audio chunk. | +| `sampling_rate` | `int` | The sample rate of the audio chunk. | +| `state` | `ReplyOnStopWordsState` | The current application state (ReplyOnStopWordsState). | + +**Returns:** + +| Type | Description | +| :----- | :------------------------------------------------------------------------------------------------------------------------------------- | +| `bool` | True if a stop word has been detected and a subsequent pause satisfying the configured thresholds is detected, False otherwise. | + +--- + +#### `reset` + +```python +reset() +``` + +Resets the handler state to its initial condition. Clears accumulated audio, resets state flags (including stop word state), closes any active generator, and clears the event flag. + +--- + +#### `copy` + +```python +copy() -> ReplyOnStopWords +``` + +Creates a new instance of ReplyOnStopWords with the same configuration. + +**Returns:** + +| Type | Description | +| :----------------- | :------------------------------------------------------- | +| `ReplyOnStopWords` | A new `ReplyOnStopWords` instance with identical settings. | + +*(Inherits other public methods like `start_up`, `process_audio`, `receive`, `trigger_response`, `async_iterate`, `emit` from `ReplyOnPause`)* diff --git a/docs/reference/stream.md b/docs/reference/stream.md new file mode 100644 index 0000000..df5c634 --- /dev/null +++ b/docs/reference/stream.md @@ -0,0 +1,196 @@ +# `Stream` Class + +```python +Stream( + handler: HandlerType, + *, + additional_outputs_handler: Callable | None = None, + mode: Literal["send-receive", "receive", "send"] = "send-receive", + modality: Literal["video", "audio", "audio-video"] = "video", + concurrency_limit: int | None | Literal["default"] = "default", + time_limit: float | None = None, + allow_extra_tracks: bool = False, + rtp_params: dict[str, Any] | None = None, + rtc_configuration: dict[str, Any] | None = None, + track_constraints: dict[str, Any] | None = None, + additional_inputs: list[Component] | None = None, + additional_outputs: list[Component] | None = None, + ui_args: UIArgs | None = None +) +``` + +Define an audio or video stream with a built-in UI, mountable on a FastAPI app. + +This class encapsulates the logic for handling real-time communication (WebRTC) streams, including setting up peer connections, managing tracks, generating a Gradio user interface, and integrating with FastAPI for API endpoints. It supports different modes (send, receive, send-receive) and modalities (audio, video, audio-video), and can optionally handle additional Gradio input/output components alongside the stream. It also provides functionality for telephone integration via the FastPhone service. + +## Attributes + +| Name | Type | Description | +| :----------------------------- | :-------------------------------------------- | :----------------------------------------------------------------------- | +| `mode` | `Literal["send-receive", "receive", "send"]` | The direction of the stream. | +| `modality` | `Literal["video", "audio", "audio-video"]` | The type of media stream. | +| `rtp_params` | `dict[str, Any] \| None` | Parameters for RTP encoding. | +| `event_handler` | `HandlerType` | The main function to process stream data. | +| `concurrency_limit` | `int` | The maximum number of concurrent connections allowed. | +| `time_limit` | `float \| None` | Time limit in seconds for the event handler execution. | +| `allow_extra_tracks` | `bool` | Whether to allow extra tracks beyond the specified modality. | +| `additional_output_components` | `list[Component] \| None` | Extra Gradio output components. | +| `additional_input_components` | `list[Component] \| None` | Extra Gradio input components. | +| `additional_outputs_handler` | `Callable \| None` | Handler for additional outputs. | +| `track_constraints` | `dict[str, Any] \| None` | Constraints for media tracks (e.g., resolution). | +| `webrtc_component` | `WebRTC` | The underlying Gradio WebRTC component instance. | +| `rtc_configuration` | `dict[str, Any] \| None \| Callable` | Configuration for the RTCPeerConnection (e.g., ICE servers). | +| `server_rtc_configuration` | `dict[str, Any] \| None` | Configuration for the RTCPeerConnection (e.g., ICE servers) to be used in the server | +| `_ui` | `Blocks` | The Gradio Blocks UI instance. | + +## Methods + +### `mount` + +```python +mount(app: FastAPI, path: str = "") +``` + +Mount the stream's API endpoints onto a FastAPI application. + +This method adds the necessary routes (`/webrtc/offer`, `/telephone/handler`, `/telephone/incoming`, `/websocket/offer`) to the provided FastAPI app, prefixed with the optional `path`. It also injects a startup message into the app's lifespan. + +**Args:** + +| Name | Type | Description | +| :----- | :-------- | :----------------------------------------------- | +| `app` | `FastAPI` | The FastAPI application instance. | +| `path` | `str` | An optional URL prefix for the mounted routes. | + +--- + +### `fastphone` + +```python +fastphone( + token: str | None = None, + host: str = "127.0.0.1", + port: int = 8000, + **kwargs +) +``` + +Launch the FastPhone service for telephone integration. + +Starts a local FastAPI server, mounts the stream, creates a public tunnel (using Gradio's tunneling), registers the tunnel URL with the FastPhone backend service, and prints the assigned phone number and access code. This allows users to call the phone number and interact with the stream handler. + +**Args:** + +| Name | Type | Description | +| :------- | :-------------- | :--------------------------------------------------------------------------------------------------------- | +| `token` | `str \| None` | Optional Hugging Face Hub token for authentication with the FastPhone service. If None, attempts to find one automatically. | +| `host` | `str` | The local host address to bind the server to. | +| `port` | `int` | The local port to bind the server to. | +| `**kwargs` | | Additional keyword arguments passed to `uvicorn.run`. | + +**Raises:** + +* **`httpx.HTTPStatusError`**: If registration with the FastPhone service fails. +* **`RuntimeError`**: If running in Colab/Spaces without `rtc_configuration`. + +### `offer` + +```python +async offer(body: Body) +``` + +Handle an incoming WebRTC offer via HTTP POST. + +Processes the SDP offer and ICE candidates from the client to establish a WebRTC connection. + +**Args:** + +| Name | Type | Description | +| :----- | :----- | :------------------------------------------------------------------------------------------------------ | +| `body` | `Body` | A Pydantic model containing the SDP offer, optional ICE candidate, type ('offer'), and a unique WebRTC ID. | + +**Returns:** + +* A dictionary containing the SDP answer generated by the server. + +--- + +### `handle_incoming_call` + +```python +async handle_incoming_call(request: Request) +``` + +Handle incoming telephone calls (e.g., via Twilio). + +Generates TwiML instructions to connect the incoming call to the WebSocket handler (`/telephone/handler`) for audio streaming. + +**Args:** + +| Name | Type | Description | +| :-------- | :-------- | :----------------------------------------------------------- | +| `request` | `Request` | The FastAPI Request object for the incoming call webhook. | + +**Returns:** + +* An `HTMLResponse` containing the TwiML instructions as XML. + +--- + +### `telephone_handler` + +```python +async telephone_handler(websocket: WebSocket) +``` + +The websocket endpoint for streaming audio over Twilio phone. + +**Args:** + +| Name | Type | Description | +| :---------- | :---------- | :-------------------------------------- | +| `websocket` | `WebSocket` | The incoming WebSocket connection object. | + +--- + +### `websocket_offer` + +```python +async websocket_offer(websocket: WebSocket) +``` + +Establish a Websocket connection to the Stream.. + +**Args:** + +| Name | Type | Description | +| :---------- | :---------- | :-------------------------------------- | +| `websocket` | `WebSocket` | The incoming WebSocket connection object. | + +## Properties + +### `ui` + +```python +@property +ui() -> Blocks +``` + +Get the Gradio Blocks UI instance associated with this stream. + +**Returns:** + +* The `gradio.Blocks` UI instance. + +```python +@ui.setter +ui(blocks: Blocks) +``` + +Set a custom Gradio Blocks UI for this stream. + +**Args:** + +| Name | Type | Description | +| :------- | :------- | :----------------------------------------------- | +| `blocks` | `Blocks` | The `gradio.Blocks` instance to use as the UI. | \ No newline at end of file diff --git a/docs/reference/stream_handlers.md b/docs/reference/stream_handlers.md new file mode 100644 index 0000000..2bf8593 --- /dev/null +++ b/docs/reference/stream_handlers.md @@ -0,0 +1,420 @@ +# Stream Handlers + +These abstract base classes define the core interfaces for handling audio and video streams within FastRTC. Concrete handlers like `ReplyOnPause` inherit from these. + +## `StreamHandlerBase` Class + +```python +StreamHandlerBase( + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, +) +``` + +Base class for handling media streams in FastRTC. + +Provides common attributes and methods for managing stream state, communication channels, and basic configuration. This class is intended to be subclassed by concrete stream handlers like `StreamHandler` or `AsyncStreamHandler`. + +### Attributes + +| Name | Type | Description | +| :------------------- | :---------------------------- | :----------------------------------------------------------------------- | +| `expected_layout` | `Literal["mono", "stereo"]` | The expected channel layout of the input audio ('mono' or 'stereo'). | +| `output_sample_rate` | `int` | The target sample rate for the output audio. | +| `output_frame_size` | `int` | The desired number of samples per output audio frame. | +| `input_sample_rate` | `int` | The expected sample rate of the input audio. | +| `channel` | `DataChannel \| None` | The WebRTC data channel for communication. | +| `channel_set` | `asyncio.Event` | Event indicating if the data channel is set. | +| `args_set` | `asyncio.Event` | Event indicating if additional arguments are set. | +| `latest_args` | `str \| list[Any]` | Stores the latest arguments received. | +| `loop` | `asyncio.AbstractEventLoop` | The asyncio event loop. | +| `phone_mode` | `bool` | Flag indicating if operating in telephone mode. | + +### Methods + +#### `__init__` + +```python +__init__( + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, +) +``` + +Initializes the StreamHandlerBase. + +**Args:** + +| Name | Type | Description | +| :------------------- | :-------------------------- | :------------------------------------------------------------------- | +| `expected_layout` | `Literal["mono", "stereo"]` | Expected input audio layout ('mono' or 'stereo'). | +| `output_sample_rate` | `int` | Target output audio sample rate. | +| `output_frame_size` | `int \| None` | Deprecated. Frame size is now derived from sample rate. | +| `input_sample_rate` | `int` | Expected input audio sample rate. | + +--- + +#### `clear_queue` + +```python +clear_queue() +``` + +Clears the internal processing queue via the registered callback. + +--- + +#### `send_message` + +```python +async send_message(msg: str) +``` + +Asynchronously sends a message over the data channel. + +**Args:** + +| Name | Type | Description | +| :---- | :----- | :------------------------ | +| `msg` | `str` | The string message to send. | + +--- + +#### `send_message_sync` + +```python +send_message_sync(msg: str) +``` + +Synchronously sends a message over the data channel. Runs the async `send_message` in the event loop and waits for completion. + +**Args:** + +| Name | Type | Description | +| :---- | :----- | :------------------------ | +| `msg` | `str` | The string message to send. | + +--- + + +#### `reset` + +```python +reset() +``` + +Resets the argument set event. + +--- + +#### `shutdown` + +```python +shutdown() +``` + +Placeholder for shutdown logic. Subclasses can override. + +--- + +## `StreamHandler` Class + +```python +StreamHandler( + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, +) +``` + +Abstract base class for synchronous stream handlers. + +Inherits from `StreamHandlerBase` and defines the core synchronous interface for processing audio streams. Subclasses must implement `receive`, `emit`, and `copy`. + +*(Inherits Attributes and Methods from `StreamHandlerBase`)* + +### Abstract Methods + +#### `receive` + +```python +@abstractmethod +receive(frame: tuple[int, npt.NDArray[np.int16]]) -> None +``` + +Process an incoming audio frame synchronously. + +**Args:** + +| Name | Type | Description | +| :------ | :------------------------------------ | :----------------------------------------------------------------------- | +| `frame` | `tuple[int, npt.NDArray[np.int16]]` | A tuple containing the sample rate (int) and the audio data as a numpy array (int16). | + +--- + +#### `emit` + +```python +@abstractmethod +emit() -> EmitType +``` + +Produce the next output chunk synchronously. This method is called repeatedly to generate the output to be sent back over the stream. + +**Returns:** + +| Type | Description | +| :--------- | :------------------------------------------------------------------------------------------------------------------------------------- | +| `EmitType` | An output item conforming to `EmitType`, which could be audio data, additional outputs, control signals (like `CloseStream`), or None. | + +--- + +#### `copy` + +```python +@abstractmethod +copy() -> StreamHandler +``` + +Create a copy of this synchronous stream handler instance. Used to create a new handler for each connection. + +**Returns:** + +| Type | Description | +| :-------------- | :----------------------------------------------------------- | +| `StreamHandler` | A new instance of the concrete StreamHandler subclass. | + +--- + +#### `start_up` + +```python +start_up() +``` + +Optional synchronous startup logic. + +--- + +## `AsyncStreamHandler` Class + +```python +AsyncStreamHandler( + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, +) +``` + +Abstract base class for asynchronous stream handlers. + +Inherits from `StreamHandlerBase` and defines the core asynchronous interface using coroutines (`async def`) for processing audio streams. Subclasses must implement `receive`, `emit`, and `copy`. The `start_up` method must also be a coroutine. + +*(Inherits Attributes and Methods from `StreamHandlerBase`)* + +### Abstract Methods + +#### `receive` + +```python +@abstractmethod +async receive(frame: tuple[int, npt.NDArray[np.int16]]) -> None +``` + +Process an incoming audio frame asynchronously. + +**Args:** + +| Name | Type | Description | +| :------ | :------------------------------------ | :----------------------------------------------------------------------- | +| `frame` | `tuple[int, npt.NDArray[np.int16]]` | A tuple containing the sample rate (int) and the audio data as a numpy array (int16). | + +--- + +#### `emit` + +```python +@abstractmethod +async emit() -> EmitType +``` + +Produce the next output chunk asynchronously. This coroutine is called to generate the output to be sent back over the stream. + +**Returns:** + +| Type | Description | +| :--------- | :------------------------------------------------------------------------------------------------------------------------------------- | +| `EmitType` | An output item conforming to `EmitType`, which could be audio data, additional outputs, control signals (like `CloseStream`), or None. | + +--- + +#### `copy` + +```python +@abstractmethod +copy() -> AsyncStreamHandler +``` + +Create a copy of this asynchronous stream handler instance. Used to create a new handler for each connection. + +**Returns:** + +| Type | Description | +| :------------------- | :--------------------------------------------------------------- | +| `AsyncStreamHandler` | A new instance of the concrete AsyncStreamHandler subclass. | + +--- + +#### `start_up` + +```python +async start_up() +``` + +Optional asynchronous startup logic. Must be a coroutine (`async def`). + +--- + +## `AudioVideoStreamHandler` Class + +```python +AudioVideoStreamHandler( + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, +) +``` + +Abstract base class for synchronous handlers processing both audio and video. + +Inherits from `StreamHandler` (synchronous audio) and adds abstract methods for handling video frames synchronously. Subclasses must implement the audio methods (`receive`, `emit`) and the video methods (`video_receive`, `video_emit`), as well as `copy`. + +*(Inherits Attributes and Methods from `StreamHandler`)* + +### Abstract Methods + +#### `video_receive` + +```python +@abstractmethod +video_receive(frame: VideoFrame) -> None +``` + +Process an incoming video frame synchronously. + +**Args:** + +| Name | Type | Description | +| :------ | :----------- | :---------------------------- | +| `frame` | `VideoFrame` | The incoming aiortc `VideoFrame`. | + +--- + +#### `video_emit` + +```python +@abstractmethod +video_emit() -> VideoEmitType +``` + +Produce the next output video frame synchronously. + +**Returns:** + +| Type | Description | +| :-------------- | :------------------------------------------------------------------------------------------------------- | +| `VideoEmitType` | An output item conforming to `VideoEmitType`, typically a numpy array representing the video frame, or None. | + +--- + +#### `copy` + +```python +@abstractmethod +copy() -> AudioVideoStreamHandler +``` + +Create a copy of this audio-video stream handler instance. + +**Returns:** + +| Type | Description | +| :---------------------- | :------------------------------------------------------------------- | +| `AudioVideoStreamHandler` | A new instance of the concrete AudioVideoStreamHandler subclass. | + +--- + +## `AsyncAudioVideoStreamHandler` Class + +```python +AsyncAudioVideoStreamHandler( + expected_layout: Literal["mono", "stereo"] = "mono", + output_sample_rate: int = 24000, + output_frame_size: int | None = None, # Deprecated + input_sample_rate: int = 48000, +) +``` + +Abstract base class for asynchronous handlers processing both audio and video. + +Inherits from `AsyncStreamHandler` (asynchronous audio) and adds abstract coroutines for handling video frames asynchronously. Subclasses must implement the async audio methods (`receive`, `emit`, `start_up`) and the async video methods (`video_receive`, `video_emit`), as well as `copy`. + +*(Inherits Attributes and Methods from `AsyncStreamHandler`)* + +### Abstract Methods + +#### `video_receive` + +```python +@abstractmethod +async video_receive(frame: npt.NDArray[np.float32]) -> None +``` + +Process an incoming video frame asynchronously. + +**Args:** + +| Name | Type | Description | +| :------ | :----------------------- | :------------------------------------------------------------------------------------------------------- | +| `frame` | `npt.NDArray[np.float32]` | The video frame data as a numpy array (float32). Note: The type hint differs from the synchronous version. | + +--- + +#### `video_emit` + +```python +@abstractmethod +async video_emit() -> VideoEmitType +``` + +Produce the next output video frame asynchronously. + +**Returns:** + +| Type | Description | +| :-------------- | :------------------------------------------------------------------------------------------------------- | +| `VideoEmitType` | An output item conforming to `VideoEmitType`, typically a numpy array representing the video frame, or None. | + +--- + +#### `copy` + +```python +@abstractmethod +copy() -> AsyncAudioVideoStreamHandler +``` + +Create a copy of this asynchronous audio-video stream handler instance. + +**Returns:** + +| Type | Description | +| :--------------------------- | :----------------------------------------------------------------------- | +| `AsyncAudioVideoStreamHandler` | A new instance of the concrete AsyncAudioVideoStreamHandler subclass. | diff --git a/docs/reference/utils.md b/docs/reference/utils.md new file mode 100644 index 0000000..cb64ab6 --- /dev/null +++ b/docs/reference/utils.md @@ -0,0 +1,123 @@ +# Utils + +## `audio_to_bytes` + +Convert an audio tuple containing sample rate and numpy array data into bytes. +Useful for sending data to external APIs from `ReplyOnPause` handler. + +Parameters +``` +audio : tuple[int, np.ndarray] + A tuple containing: + - sample_rate (int): The audio sample rate in Hz + - data (np.ndarray): The audio data as a numpy array +``` + +Returns +``` +bytes + The audio data encoded as bytes, suitable for transmission or storage +``` + +Example +```python +>>> sample_rate = 44100 +>>> audio_data = np.array([0.1, -0.2, 0.3]) # Example audio samples +>>> audio_tuple = (sample_rate, audio_data) +>>> audio_bytes = audio_to_bytes(audio_tuple) +``` + +## `audio_to_file` + +Save an audio tuple containing sample rate and numpy array data to a file. + +Parameters +``` +audio : tuple[int, np.ndarray] + A tuple containing: + - sample_rate (int): The audio sample rate in Hz + - data (np.ndarray): The audio data as a numpy array +``` +Returns +``` +str + The path to the saved audio file +``` +Example +``` +```python +>>> sample_rate = 44100 +>>> audio_data = np.array([0.1, -0.2, 0.3]) # Example audio samples +>>> audio_tuple = (sample_rate, audio_data) +>>> file_path = audio_to_file(audio_tuple) +>>> print(f"Audio saved to: {file_path}") +``` + +## `aggregate_bytes_to_16bit` +Aggregate bytes to 16-bit audio samples. + +This function takes an iterator of chunks and aggregates them into 16-bit audio samples. +It handles incomplete samples and combines them with the next chunk. + +Parameters +``` +chunks_iterator : Iterator[bytes] + An iterator of byte chunks to aggregate +``` +Returns +``` +Iterator[NDArray[np.int16]] + An iterator of 16-bit audio samples +``` +Example +```python +>>> chunks_iterator = [b'\x00\x01', b'\x02\x03', b'\x04\x05'] +>>> for chunk in aggregate_bytes_to_16bit(chunks_iterator): +>>> print(chunk) +``` + +## `async_aggregate_bytes_to_16bit` + +Aggregate bytes to 16-bit audio samples asynchronously. + +Parameters +``` +chunks_iterator : Iterator[bytes] + An iterator of byte chunks to aggregate +``` +Returns +``` +Iterator[NDArray[np.int16]] + An iterator of 16-bit audio samples +``` +Example +```python +>>> chunks_iterator = [b'\x00\x01', b'\x02\x03', b'\x04\x05'] +>>> for chunk in async_aggregate_bytes_to_16bit(chunks_iterator): +>>> print(chunk) +``` + +## `wait_for_item` + +Wait for an item from an asyncio.Queue with a timeout. + +Parameters +``` +queue : asyncio.Queue + The queue to wait for an item from +timeout : float + The timeout in seconds +``` +Returns +``` +Any + The item from the queue or None if the timeout is reached +``` + +Example +```python +>>> queue = asyncio.Queue() +>>> queue.put_nowait(1) +>>> item = await wait_for_item(queue) +>>> print(item) +``` \ No newline at end of file diff --git a/docs/speech_to_text_gallery.md b/docs/speech_to_text_gallery.md index d0c03d2..95ac36a 100644 --- a/docs/speech_to_text_gallery.md +++ b/docs/speech_to_text_gallery.md @@ -53,7 +53,7 @@ document.querySelectorAll('.tag-button').forEach(button => { --- Description: - [Distil-whisper](https://github.com/huggingface/distil-whisper) from Hugging Face wraped in a pypi package for plug and play! + [Distil-whisper](https://github.com/huggingface/distil-whisper) from Hugging Face wrapped in a pypi package for plug and play! Install Instructions ```python @@ -82,6 +82,21 @@ document.querySelectorAll('.tag-button').forEach(button => { [:octicons-code-16: Repository](https://github.com/sgarg26/fastrtc-kroko) +- :speaking_head:{ .lg .middle }:eyes:{ .lg .middle } fastrtc-whisper-cpp +{: data-tags="whisper-cpp"} + + --- + + Description: + [whisper.cpp](https://huggingface.co/ggerganov/whisper.cpp) is the ggml version of OpenAI's Whisper model. + + Install Instructions + ```python + pip install fastrtc-whisper-cpp + ``` + Check out the fastrtc-whisper-cpp docs for examples! + + [:octicons-code-16: Repository](https://github.com/mahimairaja/fastrtc-whisper-cpp) - :speaking_head:{ .lg .middle }:eyes:{ .lg .middle } __Your STT Model__ {: data-tags="pytorch"} @@ -131,4 +146,4 @@ document.querySelectorAll('.tag-button').forEach(button => { stream.ui.launch() ``` -3. Open a [PR](https://github.com/freddyaboulton/fastrtc/edit/main/docs/speech_to_text_gallery.md) to add your model to the gallery! Ideally you model package should be pip installable so other can try it out easily. +3. Open a [PR](https://github.com/freddyaboulton/fastrtc/edit/main/docs/speech_to_text_gallery.md) to add your model to the gallery! Ideally your model package should be pip installable so others can try it out easily. diff --git a/docs/text_to_speech_gallery.md b/docs/text_to_speech_gallery.md index 1c4996f..68b7a80 100644 --- a/docs/text_to_speech_gallery.md +++ b/docs/text_to_speech_gallery.md @@ -62,7 +62,7 @@ document.querySelectorAll('.tag-button').forEach(button => { - [:octicons-code-16: Repository]([Orpheus.cpp](https://github.com/freddyaboulton/orpheus-cpp)) + [:octicons-code-16: Repository](https://github.com/freddyaboulton/orpheus-cpp) - :speaking_head:{ .lg .middle }:eyes:{ .lg .middle } __Your TTS Model__ {: data-tags="pytorch"} @@ -125,4 +125,4 @@ document.querySelectorAll('.tag-button').forEach(button => { stream.ui.launch() ``` -3. Open a [PR](https://github.com/freddyaboulton/fastrtc/edit/main/docs/text_to_speech_gallery.md) to add your model to the gallery! Ideally your model package should be pip installable so other can try it out easily. \ No newline at end of file +3. Open a [PR](https://github.com/freddyaboulton/fastrtc/edit/main/docs/text_to_speech_gallery.md) to add your model to the gallery! Ideally your model package should be pip installable so others can try it out easily. diff --git a/docs/turn_taking_gallery.md b/docs/turn_taking_gallery.md index bc4a0ba..c0b94b1 100644 --- a/docs/turn_taking_gallery.md +++ b/docs/turn_taking_gallery.md @@ -165,7 +165,7 @@ In this gallery, you can find a collection of turn-taking algorithms and VAD mod stream.ui.launch() ``` -3. Open a [PR](https://github.com/freddyaboulton/fastrtc/edit/main/docs/turn_taking_gallery.md) to add your model to the gallery! Ideally you model package should be pip installable so other can try it out easily. +3. Open a [PR](https://github.com/freddyaboulton/fastrtc/edit/main/docs/turn_taking_gallery.md) to add your model to the gallery! Ideally your model package should be pip installable so others can try it out easily. !!! tip "Package Naming Convention" It is recommended to name your package `fastrtc-` so developers can easily find it on [pypi](https://pypi.org/search/?q=fastrtc-). diff --git a/docs/userguide/api.md b/docs/userguide/api.md index aa344da..b912650 100644 --- a/docs/userguide/api.md +++ b/docs/userguide/api.md @@ -55,7 +55,7 @@ The `ReplyOnPause` handler can also send the following `log` messages. ```json { "type": "log", - "data": "pause_detected" | "response_starting" + "data": "pause_detected" | "response_starting" | "started_talking" } ``` @@ -403,6 +403,9 @@ WebSocket connections are currently only supported for audio in send-receive mod To connect to the server via WebSocket, you'll need to establish a WebSocket connection and handle audio processing. The code below assumes there is an HTML audio element for output playback. +The input audio must be mu-law encoded with a sample rate equal to the input_sample_rate of the handler you are connecting to. By default it is 48k Hz. +The out audio will also be mulaw encoded and the sample rate will be equal to the output_sample_rate of the handler. By default it is 48k Hz. + \`\`\`javascript // Setup audio context and stream const audioContext = new AudioContext(); @@ -441,6 +444,40 @@ ws.onopen = () => { } }; }; + +ws.onmessage = (event) => { + const data = JSON.parse(event.data); + if (data?.type === "send_input") { + fetch('/input_hook', { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + // Send additional input data here + body: JSON.stringify({ webrtc_id: wsId }) + }); + } + if (data.event === "media") { + // Process received audio + const audioData = atob(data.media.payload); + const mulawData = new Uint8Array(audioData.length); + for (let i = 0; i < audioData.length; i++) { + mulawData[i] = audioData.charCodeAt(i); + } + + // Convert mu-law to linear PCM + const linearData = alawmulaw.mulaw.decode(mulawData); + + // Create an AudioBuffer + const audioBuffer = outputContext.createBuffer(1, linearData.length, sampleRate); + const channelData = audioBuffer.getChannelData(0); + + // Fill the buffer with the decoded data + for (let i = 0; i < linearData.length; i++) { + channelData[i] = linearData[i] / 32768.0; + } + + // Do something with Audio Buffer + } +}; \`\`\` {{?}} `); diff --git a/docs/userguide/audio.md b/docs/userguide/audio.md index e012d31..a5c1400 100644 --- a/docs/userguide/audio.md +++ b/docs/userguide/audio.md @@ -78,7 +78,7 @@ stream = Stream( ### Startup Function -You can pass in a `startup_fn` to the `ReplyOnPause` class. This function will be called when the connection is first established. It is helpful for generating intial responses. +You can pass in a `startup_fn` to the `ReplyOnPause` class. This function will be called when the connection is first established. It is helpful for generating initial responses. ```python from fastrtc import get_tts_model, Stream, ReplyOnPause @@ -138,7 +138,7 @@ The API is similar to `ReplyOnPause` with the addition of a `stop_words` paramet 1. The `stop_words` can be single words or pairs of words. Be sure to include common misspellings of your word for more robust detection, e.g. "llama", "lamma". In my experience, it's best to use two very distinct words like "ok computer" or "hello iris". !!! tip "Extra Dependencies" - The `ReplyOnStopWords` class requires the the `stopword` extra. Run `pip install fastrtc[stopword]` to install it. + The `ReplyOnStopWords` class requires the `stopword` extra. Run `pip install fastrtc[stopword]` to install it. !!! warning "English Only" The `ReplyOnStopWords` class is currently only supported for English. @@ -200,7 +200,7 @@ The API is similar to `ReplyOnPause` with the addition of a `stop_words` paramet It is also possible to create asynchronous stream handlers. This is very convenient for accessing async APIs from major LLM developers, like Google and OpenAI. The main difference is that `receive`, `emit`, and `start_up` are now defined with `async def`. -Here is aa simple example of using `AsyncStreamHandler`: +Here is a simple example of using `AsyncStreamHandler`: === "Code" ``` py @@ -262,7 +262,7 @@ audio = model.tts("Hello, world!") ``` !!! tip - You can customize the audio by passing in an instace of `KokoroTTSOptions` to the method. + You can customize the audio by passing in an instance of `KokoroTTSOptions` to the method. See [here](https://huggingface.co/hexgrad/Kokoro-82M/blob/main/VOICES.md) for a list of available voices. ```python from fastrtc import KokoroTTSOptions, get_tts_model @@ -386,3 +386,48 @@ stream.mount(app) # run with `uvicorn main:app` ``` + +### Outbound calls with Twilio + +Here's a simple example to call someone using the twilio-python module: + +```py +app = FastAPI() + +@app.post("/call") +async def start_call(req: Request): + body = await req.json() + from_no = body.get("from") + to_no = body.get("to") + account_sid = os.getenv("TWILIO_ACCOUNT_SID") + auth_token = os.getenv("TWILIO_AUTH_TOKEN") + client = Client(account_sid, auth_token) + + # Use the public URL of your application + # here we're using ngrok to expose an app + # running locally + call = client.calls.create( + to=to_no, + from_=from_no, + url="https://[your_ngrok_subdomain].ngrok.app/incoming-call" + ) + + return {"sid": f"{call.sid}"} + +@app.api_route("/incoming-call", methods=["GET", "POST"]) +async def handle_incoming_call(req: Request): + from twilio.twiml.voice_response import VoiceResponse, Connect + response = VoiceResponse() + response.say("Connecting to AI assistant") + connect = Connect() + connect.stream(url=f'wss://{req.url.hostname}/media-stream') + response.append(connect) + return HTMLResponse(content=str(response), media_type="application/xml") + +@app.websocket("/media-stream") +async def handle_media_stream(websocket: WebSocket): + # stream is a FastRTC stream defined elsewhere + await stream.telephone_handler(websocket) + +app = gr.mount_gradio_app(app, stream.ui, path="/") +``` diff --git a/docs/userguide/gradio.md b/docs/userguide/gradio.md index ba1682b..76740fd 100644 --- a/docs/userguide/gradio.md +++ b/docs/userguide/gradio.md @@ -93,4 +93,24 @@ This is common for displaying a multimodal text/audio conversation in a Chatbot === "Notes" 1. Pass your data to `AdditionalOutputs` and yield it. 2. In this case, no audio is being returned, so we set `mode="send"`. However, if we set `mode="send-receive"`, we could also yield generated audio and `AdditionalOutputs`. - 3. The `on_additional_outputs` event does not take `inputs`. It's common practice to not run this event on the queue since it is just a quick UI update. \ No newline at end of file + 3. The `on_additional_outputs` event does not take `inputs`. It's common practice to not run this event on the queue since it is just a quick UI update. + + +## Integrated Textbox + +For audio usecases, you may want to allow your users to type or speak. You can set the `variant="textbox"` argument in the WebRTC component to place a Textbox with a microphone input in the UI. See the `Integrated Textbox` demo in the cookbook or in the `demo` directory of the github repository. + + ``` py +webrtc = WebRTC( + modality="audio", + mode="send-receive", + variant="textbox", +) + ``` + + +!!! tip "Stream Class" + To use the "textbox" variant via the `Stream` class, set it in the `UIArgs` class and pass it to the stream via the `ui_args` parameter. + + + diff --git a/docs/userguide/video.md b/docs/userguide/video.md index 8d1b6ef..70a881e 100644 --- a/docs/userguide/video.md +++ b/docs/userguide/video.md @@ -40,6 +40,7 @@ and set the `mode="receive"` in the `WebRTC` component. === "Code" ``` py title="Server-To-Client" from fastrtc import Stream + import cv2 def generation(): url = "https://download.tsi.telecom-paristech.fr/gpac/dataset/dash/uhd/mux_sources/hevcds_720p30_2M.mp4" diff --git a/frontend/Index.svelte b/frontend/Index.svelte index 5abae61..dffd2a7 100644 --- a/frontend/Index.svelte +++ b/frontend/Index.svelte @@ -14,10 +14,10 @@ export let avatar_type: string = "" export let avatar_ws_route: string = "" export let avatar_assets_path: string = "" + import type { WebRTCValue } from "./shared/utils"; export let elem_id = ""; export let elem_classes: string[] = []; export let visible = true; - export let value: string = "__webrtc_value__"; export let button_labels: { start: string; stop: string; waiting: string }; export let label: string; @@ -28,6 +28,9 @@ export let width: number | undefined; export let server: { offer: (body: any) => Promise; + turn: () => Promise; + trigger_response: (body: any) => Promise; + quit_output_stream: (body: any) => Promise; }; export let container = false; @@ -44,20 +47,37 @@ export let icon_button_color: string = "var(--color-accent)"; export let pulse_color: string = "var(--color-accent)"; export let icon_radius: number = 50; + export let variant: "textbox" | "wave" = "wave"; + + export let value: WebRTCValue | string = + variant === "textbox" || + ((mode === "send-receive" || mode == "send") && modality === "audio") + ? { + textbox: "", + webrtc_id: "__webrtc_value__", + } + : "__webrtc_value__"; const on_change_cb = (msg: "change" | "tick" | any) => { + console.log("on_change_cb in index.svelte", msg); if ( msg?.type === "info" || msg?.type === "warning" || msg?.type === "error" ) { - gradio.dispatch(msg?.type === "error" ? "error" : "warning", msg.message); + gradio.dispatch( + msg?.type === "error" ? "error" : "warning", + msg?.data || msg?.message, + ); } else if (msg?.type === "end_stream") { gradio.dispatch("warning", msg.data); } else if (msg?.type === "fetch_output") { gradio.dispatch("state_change"); } else if (msg?.type === "send_input") { gradio.dispatch("tick"); + } else if (msg?.type === "submit") { + console.log("submit in index.svelte", msg.data); + gradio.dispatch("submit", msg.data); } else if (msg?.type === "connection_timeout") { gradio.dispatch( "warning", @@ -78,6 +98,11 @@ "error", `Too many concurrent connections. Please try again later!`, ); + } else if ( + msg.status === "failed" && + msg.meta?.error === "connection_already_exists" + ) { + gradio.dispatch("error", "Connection already exists"); } else { gradio.dispatch("error", "Unexpected server error"); } @@ -226,6 +251,9 @@ {icon_radius} {pulse_color} {button_labels} + {variant} + on:start_recording={() => gradio.dispatch("start_recording")} + on:stop_recording={() => gradio.dispatch("stop_recording")} on:tick={() => gradio.dispatch("tick")} on:error={({ detail }) => gradio.dispatch("error", detail)} on:warning={({ detail }) => gradio.dispatch("warning", detail)} diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a5236cb..8982de5 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -17,6 +17,7 @@ "@gradio/image": "0.16.4", "@gradio/markdown": "^0.10.3", "@gradio/statustracker": "0.9.1", + "@gradio/textbox": "^0.10.10", "@gradio/upload": "0.13.3", "@gradio/utils": "0.7.0", "@gradio/wasm": "0.14.2", @@ -57,6 +58,28 @@ "node": ">=6.0.0" } }, + "node_modules/@antfu/install-pkg": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@antfu/install-pkg/-/install-pkg-1.1.0.tgz", + "integrity": "sha512-MGQsmw10ZyI+EJo45CdSER4zEb+p31LpDAFp2Z3gkSd1yqVZGi0Ebx++YTEMonJy4oChEMLsxZ64j8FH6sSqtQ==", + "license": "MIT", + "dependencies": { + "package-manager-detector": "^1.3.0", + "tinyexec": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@antfu/utils": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/@antfu/utils/-/utils-8.1.1.tgz", + "integrity": "sha512-Mex9nXf9vR6AhcXmMrlz/HVgYYZpVGJ6YlPgwl7UnaFpnshXs6EK/oa5Gpf3CzENMjkvEx2tQtntGnb7UtSTOQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/@babel/helper-string-parser": { "version": "7.25.7", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz", @@ -104,6 +127,12 @@ "node": ">=6.9.0" } }, + "node_modules/@braintree/sanitize-url": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/@braintree/sanitize-url/-/sanitize-url-7.1.1.tgz", + "integrity": "sha512-i1L7noDNxtFyL5DmZafWy1wRVhGehQmzZaz1HiN5e7iylJMSZR7ekOV7NsIqa5qBldlLrsKv4HbgFUVlQrz8Mw==", + "license": "MIT" + }, "node_modules/@bundled-es-modules/cookie": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.0.tgz", @@ -143,6 +172,45 @@ "node": ">=6" } }, + "node_modules/@chevrotain/cst-dts-gen": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-11.0.3.tgz", + "integrity": "sha512-BvIKpRLeS/8UbfxXxgC33xOumsacaeCKAjAeLyOn7Pcp95HiRbrpl14S+9vaZLolnbssPIUuiUd8IvgkRyt6NQ==", + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/gast": "11.0.3", + "@chevrotain/types": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/@chevrotain/gast": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-11.0.3.tgz", + "integrity": "sha512-+qNfcoNk70PyS/uxmj3li5NiECO+2YKZZQMbmjTqRI3Qchu8Hig/Q9vgkHpI3alNjr7M+a2St5pw5w5F6NL5/Q==", + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/types": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/@chevrotain/regexp-to-ast": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/regexp-to-ast/-/regexp-to-ast-11.0.3.tgz", + "integrity": "sha512-1fMHaBZxLFvWI067AVbGJav1eRY7N8DDvYCTwGBiE/ytKBgP8azTdgyrKyWZ9Mfh09eHWb5PgTSO8wi7U824RA==", + "license": "Apache-2.0" + }, + "node_modules/@chevrotain/types": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-11.0.3.tgz", + "integrity": "sha512-gsiM3G8b58kZC2HaWR50gu6Y1440cHiJ+i3JUvcp/35JchYejb2+5MVeJK0iKThYpAa/P2PYFV4hoi44HD+aHQ==", + "license": "Apache-2.0" + }, + "node_modules/@chevrotain/utils": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-11.0.3.tgz", + "integrity": "sha512-YslZMgtJUyuMbZ+aKvfF3x1f5liK4mWNxghFRv7jqRR9C3R3fAOGTTKvxXDa2Y1s9zSbcpuO0cAxDYsc9SrXoQ==", + "license": "Apache-2.0" + }, "node_modules/@esbuild/aix-ppc64": { "version": "0.19.12", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.19.12.tgz", @@ -646,6 +714,29 @@ "svelte": "^4.0.0" } }, + "node_modules/@gradio/markdown-code": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@gradio/markdown-code/-/markdown-code-0.4.3.tgz", + "integrity": "sha512-o/qDUUCWZNyl8nuMkgciCeBngyfdLXWOm2yJocpaTrMXGvJJxm80LkBfdHBDwvIcBaPc7zuPRAn7MIJXFQKbyQ==", + "license": "ISC", + "dependencies": { + "@gradio/sanitize": "^0.1.3", + "@types/dompurify": "^3.0.2", + "@types/katex": "^0.16.0", + "@types/prismjs": "1.26.4", + "github-slugger": "^2.0.0", + "isomorphic-dompurify": "^2.14.0", + "katex": "^0.16.7", + "marked": "^12.0.0", + "marked-gfm-heading-id": "^3.1.2", + "marked-highlight": "^2.0.1", + "mermaid": "^11.5.0", + "prismjs": "1.29.0" + }, + "peerDependencies": { + "svelte": "^4.0.0" + } + }, "node_modules/@gradio/preview": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/@gradio/preview/-/preview-0.12.0.tgz", @@ -703,9 +794,10 @@ } }, "node_modules/@gradio/sanitize": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/@gradio/sanitize/-/sanitize-0.1.1.tgz", - "integrity": "sha512-7OpCtsFSlAcpEQwRLrWvJVWJrvjrEL/eE4JzBc0PATm2rV5hbKbEHq42QqNubOyrvJTQN41u0B+nxQMrrGruLA==", + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@gradio/sanitize/-/sanitize-0.1.3.tgz", + "integrity": "sha512-IQXf1/dqOaUSrJMO9hh9jH03lK+MA2UH977guQIvSXts7rXqorD+ChCVn7WUrAQ9Mf0DYPhRH9NMIp0s1xPZmg==", + "license": "ISC", "dependencies": { "amuchina": "^1.0.12", "sanitize-html": "^2.13.0" @@ -726,6 +818,79 @@ "svelte": "^4.0.0" } }, + "node_modules/@gradio/textbox": { + "version": "0.10.10", + "resolved": "https://registry.npmjs.org/@gradio/textbox/-/textbox-0.10.10.tgz", + "integrity": "sha512-hNpkq8K1TXBoX4guZAwBm5Qwor7kIvVSjf5xCx5xdB4tn8W5/0N9UVKTeWzDz6w8Yd3j8nuQAnsm2zO52GI2Xw==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.16.0", + "@gradio/icons": "^0.12.0", + "@gradio/statustracker": "^0.10.10", + "@gradio/utils": "^0.10.2" + }, + "peerDependencies": { + "svelte": "^4.0.0" + } + }, + "node_modules/@gradio/textbox/node_modules/@gradio/atoms": { + "version": "0.16.0", + "resolved": "https://registry.npmjs.org/@gradio/atoms/-/atoms-0.16.0.tgz", + "integrity": "sha512-qGaKr9F8LEUXfpEpU8E40QlCghl7aHFC6ydAb9lWwhH8Lka6HUa/01AEmdzky7lfVe2wyDo/lDlPvF5K6pUGbQ==", + "license": "ISC", + "dependencies": { + "@gradio/icons": "^0.12.0", + "@gradio/markdown-code": "^0.4.3", + "@gradio/utils": "^0.10.2" + }, + "peerDependencies": { + "svelte": "^4.0.0" + } + }, + "node_modules/@gradio/textbox/node_modules/@gradio/icons": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@gradio/icons/-/icons-0.12.0.tgz", + "integrity": "sha512-QQuEcYpJwIBrwxmjjx13qL3abVR5Uma/wdbhOCUqX/eowGBCDo8TKn8mX3oRkBMoCSKAuEI4tClikPTAQg/ozg==", + "license": "ISC", + "peerDependencies": { + "svelte": "^4.0.0" + } + }, + "node_modules/@gradio/textbox/node_modules/@gradio/statustracker": { + "version": "0.10.10", + "resolved": "https://registry.npmjs.org/@gradio/statustracker/-/statustracker-0.10.10.tgz", + "integrity": "sha512-GzjUIGu+qybITlR1wWuBkDGcNEc/lbqCFMVXABUXgYHW0KMETdilxJ+PHP7KQ4l0qJFDM2KS13y6Tvx+q+0ZDQ==", + "license": "ISC", + "dependencies": { + "@gradio/atoms": "^0.16.0", + "@gradio/icons": "^0.12.0", + "@gradio/utils": "^0.10.2", + "@types/dompurify": "^3.0.2", + "dompurify": "^3.0.3" + }, + "peerDependencies": { + "svelte": "^4.0.0" + } + }, + "node_modules/@gradio/textbox/node_modules/@gradio/theme": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@gradio/theme/-/theme-0.4.0.tgz", + "integrity": "sha512-O/zkP7D/4U9+vFQN821YJvSemjWzi8b8ezkaJ5/ikMm2XySoAXEqafUHAZ8MEnGYXR/CLeDcoyYG1OrJxS0fnw==", + "license": "ISC", + "peerDependencies": { + "svelte": "^4.0.0" + } + }, + "node_modules/@gradio/textbox/node_modules/@gradio/utils": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/@gradio/utils/-/utils-0.10.2.tgz", + "integrity": "sha512-ldGDEqL9kVKPrfnFzfPriCqbtTOe1/IK4FHEhXCGOeqwegqnxjmummWPk633e2Yub2lT3fjEjuyDLJ7Y7vYy3w==", + "license": "ISC", + "dependencies": { + "@gradio/theme": "^0.4.0", + "svelte-i18n": "^3.6.0" + } + }, "node_modules/@gradio/theme": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/@gradio/theme/-/theme-0.3.0.tgz", @@ -771,6 +936,28 @@ "svelte": "^4.0.0" } }, + "node_modules/@iconify/types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@iconify/types/-/types-2.0.0.tgz", + "integrity": "sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==", + "license": "MIT" + }, + "node_modules/@iconify/utils": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@iconify/utils/-/utils-2.3.0.tgz", + "integrity": "sha512-GmQ78prtwYW6EtzXRU1rY+KwOKfz32PD7iJh6Iyqw68GiKuoZ2A6pRtzWONz5VQJbp50mEjXh/7NkumtrAgRKA==", + "license": "MIT", + "dependencies": { + "@antfu/install-pkg": "^1.0.0", + "@antfu/utils": "^8.1.0", + "@iconify/types": "^2.0.0", + "debug": "^4.4.0", + "globals": "^15.14.0", + "kolorist": "^1.8.0", + "local-pkg": "^1.0.0", + "mlly": "^1.7.4" + } + }, "node_modules/@inquirer/confirm": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-3.2.0.tgz", @@ -974,6 +1161,15 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@mermaid-js/parser": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@mermaid-js/parser/-/parser-0.4.0.tgz", + "integrity": "sha512-wla8XOWvQAwuqy+gxiZqY+c7FokraOTHRWMsbB4AgRx9Sy7zKslNyejy7E+a77qHfey5GXw/ik3IXv/NHMJgaA==", + "license": "MIT", + "dependencies": { + "langium": "3.3.1" + } + }, "node_modules/@mswjs/interceptors": { "version": "0.35.9", "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.35.9.tgz", @@ -1596,6 +1792,259 @@ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" }, + "node_modules/@types/d3": { + "version": "7.4.3", + "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz", + "integrity": "sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==", + "license": "MIT", + "dependencies": { + "@types/d3-array": "*", + "@types/d3-axis": "*", + "@types/d3-brush": "*", + "@types/d3-chord": "*", + "@types/d3-color": "*", + "@types/d3-contour": "*", + "@types/d3-delaunay": "*", + "@types/d3-dispatch": "*", + "@types/d3-drag": "*", + "@types/d3-dsv": "*", + "@types/d3-ease": "*", + "@types/d3-fetch": "*", + "@types/d3-force": "*", + "@types/d3-format": "*", + "@types/d3-geo": "*", + "@types/d3-hierarchy": "*", + "@types/d3-interpolate": "*", + "@types/d3-path": "*", + "@types/d3-polygon": "*", + "@types/d3-quadtree": "*", + "@types/d3-random": "*", + "@types/d3-scale": "*", + "@types/d3-scale-chromatic": "*", + "@types/d3-selection": "*", + "@types/d3-shape": "*", + "@types/d3-time": "*", + "@types/d3-time-format": "*", + "@types/d3-timer": "*", + "@types/d3-transition": "*", + "@types/d3-zoom": "*" + } + }, + "node_modules/@types/d3-array": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/@types/d3-array/-/d3-array-3.2.1.tgz", + "integrity": "sha512-Y2Jn2idRrLzUfAKV2LyRImR+y4oa2AntrgID95SHJxuMUrkNXmanDSed71sRNZysveJVt1hLLemQZIady0FpEg==", + "license": "MIT" + }, + "node_modules/@types/d3-axis": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.6.tgz", + "integrity": "sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-brush": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.6.tgz", + "integrity": "sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-chord": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.6.tgz", + "integrity": "sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==", + "license": "MIT" + }, + "node_modules/@types/d3-color": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@types/d3-color/-/d3-color-3.1.3.tgz", + "integrity": "sha512-iO90scth9WAbmgv7ogoq57O9YpKmFBbmoEoCHDB2xMBY0+/KVrqAaCDyCE16dUspeOvIxFFRI+0sEtqDqy2b4A==", + "license": "MIT" + }, + "node_modules/@types/d3-contour": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-3.0.6.tgz", + "integrity": "sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==", + "license": "MIT", + "dependencies": { + "@types/d3-array": "*", + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==", + "license": "MIT" + }, + "node_modules/@types/d3-dispatch": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.6.tgz", + "integrity": "sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==", + "license": "MIT" + }, + "node_modules/@types/d3-drag": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.7.tgz", + "integrity": "sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-dsv": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.7.tgz", + "integrity": "sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==", + "license": "MIT" + }, + "node_modules/@types/d3-ease": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-ease/-/d3-ease-3.0.2.tgz", + "integrity": "sha512-NcV1JjO5oDzoK26oMzbILE6HW7uVXOHLQvHshBUW4UMdZGfiY6v5BeQwh9a9tCzv+CeefZQHJt5SRgK154RtiA==", + "license": "MIT" + }, + "node_modules/@types/d3-fetch": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-3.0.7.tgz", + "integrity": "sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==", + "license": "MIT", + "dependencies": { + "@types/d3-dsv": "*" + } + }, + "node_modules/@types/d3-force": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.10.tgz", + "integrity": "sha512-ZYeSaCF3p73RdOKcjj+swRlZfnYpK1EbaDiYICEEp5Q6sUiqFaFQ9qgoshp5CzIyyb/yD09kD9o2zEltCexlgw==", + "license": "MIT" + }, + "node_modules/@types/d3-format": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.4.tgz", + "integrity": "sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==", + "license": "MIT" + }, + "node_modules/@types/d3-geo": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.1.0.tgz", + "integrity": "sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==", + "license": "MIT", + "dependencies": { + "@types/geojson": "*" + } + }, + "node_modules/@types/d3-hierarchy": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.1.7.tgz", + "integrity": "sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg==", + "license": "MIT" + }, + "node_modules/@types/d3-interpolate": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-interpolate/-/d3-interpolate-3.0.4.tgz", + "integrity": "sha512-mgLPETlrpVV1YRJIglr4Ez47g7Yxjl1lj7YKsiMCb27VJH9W8NVM6Bb9d8kkpG/uAQS5AmbA48q2IAolKKo1MA==", + "license": "MIT", + "dependencies": { + "@types/d3-color": "*" + } + }, + "node_modules/@types/d3-path": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@types/d3-path/-/d3-path-3.1.1.tgz", + "integrity": "sha512-VMZBYyQvbGmWyWVea0EHs/BwLgxc+MKi1zLDCONksozI4YJMcTt8ZEuIR4Sb1MMTE8MMW49v0IwI5+b7RmfWlg==", + "license": "MIT" + }, + "node_modules/@types/d3-polygon": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.2.tgz", + "integrity": "sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==", + "license": "MIT" + }, + "node_modules/@types/d3-quadtree": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz", + "integrity": "sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==", + "license": "MIT" + }, + "node_modules/@types/d3-random": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.3.tgz", + "integrity": "sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==", + "license": "MIT" + }, + "node_modules/@types/d3-scale": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-scale/-/d3-scale-4.0.9.tgz", + "integrity": "sha512-dLmtwB8zkAeO/juAMfnV+sItKjlsw2lKdZVVy6LRr0cBmegxSABiLEpGVmSJJ8O08i4+sGR6qQtb6WtuwJdvVw==", + "license": "MIT", + "dependencies": { + "@types/d3-time": "*" + } + }, + "node_modules/@types/d3-scale-chromatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", + "integrity": "sha512-iWMJgwkK7yTRmWqRB5plb1kadXyQ5Sj8V/zYlFGMUBbIPKQScw+Dku9cAAMgJG+z5GYDoMjWGLVOvjghDEFnKQ==", + "license": "MIT" + }, + "node_modules/@types/d3-selection": { + "version": "3.0.11", + "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.11.tgz", + "integrity": "sha512-bhAXu23DJWsrI45xafYpkQ4NtcKMwWnAC/vKrd2l+nxMFuvOT3XMYTIj2opv8vq8AO5Yh7Qac/nSeP/3zjTK0w==", + "license": "MIT" + }, + "node_modules/@types/d3-shape": { + "version": "3.1.7", + "resolved": "https://registry.npmjs.org/@types/d3-shape/-/d3-shape-3.1.7.tgz", + "integrity": "sha512-VLvUQ33C+3J+8p+Daf+nYSOsjB4GXp19/S/aGo60m9h1v6XaxjiT82lKVWJCfzhtuZ3yD7i/TPeC/fuKLLOSmg==", + "license": "MIT", + "dependencies": { + "@types/d3-path": "*" + } + }, + "node_modules/@types/d3-time": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/d3-time/-/d3-time-3.0.4.tgz", + "integrity": "sha512-yuzZug1nkAAaBlBBikKZTgzCeA+k1uy4ZFwWANOfKw5z5LRhV0gNA7gNkKm7HoK+HRN0wX3EkxGk0fpbWhmB7g==", + "license": "MIT" + }, + "node_modules/@types/d3-time-format": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.3.tgz", + "integrity": "sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==", + "license": "MIT" + }, + "node_modules/@types/d3-timer": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@types/d3-timer/-/d3-timer-3.0.2.tgz", + "integrity": "sha512-Ps3T8E8dZDam6fUyNiMkekK3XUsaUEik+idO9/YjPtfj2qruF8tFBXS7XhtE4iIXBLxhmLjP3SXpLhVf21I9Lw==", + "license": "MIT" + }, + "node_modules/@types/d3-transition": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.9.tgz", + "integrity": "sha512-uZS5shfxzO3rGlu0cC3bjmMFKsXv+SmZZcgp0KD22ts4uGXp5EVYGzu/0YdwZeKmddhcAccYtREJKkPfXkZuCg==", + "license": "MIT", + "dependencies": { + "@types/d3-selection": "*" + } + }, + "node_modules/@types/d3-zoom": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.8.tgz", + "integrity": "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==", + "license": "MIT", + "dependencies": { + "@types/d3-interpolate": "*", + "@types/d3-selection": "*" + } + }, "node_modules/@types/dompurify": { "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.0.5.tgz", @@ -1614,6 +2063,12 @@ "resolved": "https://registry.npmjs.org/@types/eventsource/-/eventsource-1.1.15.tgz", "integrity": "sha512-XQmGcbnxUNa06HR3VBVkc9+A2Vpi9ZyLJcdS5dwaQQ/4ZMWFO+5c90FnMUpbtMZwB/FChoYHwuVg8TvkECacTA==" }, + "node_modules/@types/geojson": { + "version": "7946.0.16", + "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.16.tgz", + "integrity": "sha512-6C8nqWur3j98U6+lXDfTUWIfgvZU+EumvpHKcYjujKH7woYyLj2sUmff0tRhrqM7BohUw7Pz3ZB1jj2gW9Fvmg==", + "license": "MIT" + }, "node_modules/@types/katex": { "version": "0.16.7", "resolved": "https://registry.npmjs.org/@types/katex/-/katex-0.16.7.tgz", @@ -1953,6 +2408,32 @@ "is-regex": "^1.0.3" } }, + "node_modules/chevrotain": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-11.0.3.tgz", + "integrity": "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==", + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/cst-dts-gen": "11.0.3", + "@chevrotain/gast": "11.0.3", + "@chevrotain/regexp-to-ast": "11.0.3", + "@chevrotain/types": "11.0.3", + "@chevrotain/utils": "11.0.3", + "lodash-es": "4.17.21" + } + }, + "node_modules/chevrotain-allstar": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/chevrotain-allstar/-/chevrotain-allstar-0.3.1.tgz", + "integrity": "sha512-b7g+y9A0v4mxCW1qUhf3BSVPg+/NvGErk/dOkrDaHA0nQIQGAtrOjlX//9OQtRlSCy+x9rfB5N8yC71lH1nvMw==", + "license": "MIT", + "dependencies": { + "lodash-es": "^4.17.21" + }, + "peerDependencies": { + "chevrotain": "^11.0.0" + } + }, "node_modules/chokidar": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.1.tgz", @@ -2105,6 +2586,12 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/confbox": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.2.tgz", + "integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==", + "license": "MIT" + }, "node_modules/constantinople": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/constantinople/-/constantinople-4.0.1.tgz", @@ -2123,17 +2610,13 @@ "node": ">= 0.6" } }, - "node_modules/copy-anything": { - "version": "2.0.6", - "resolved": "https://registry.anpm.alibaba-inc.com/copy-anything/-/copy-anything-2.0.6.tgz", - "integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==", - "dev": true, + "node_modules/cose-base": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/cose-base/-/cose-base-1.0.3.tgz", + "integrity": "sha512-s9whTXInMSgAp/NVXVNuVxVKzGH2qck3aQlVHxDCdAEPgtMKwc4Wq6/QKhgdEdgbLSi9rBTAcPoRa6JpiG4ksg==", "license": "MIT", "dependencies": { - "is-what": "^3.14.1" - }, - "funding": { - "url": "https://github.com/sponsors/mesqueeb" + "layout-base": "^1.0.0" } }, "node_modules/cropperjs": { @@ -2223,6 +2706,54 @@ "node": ">=18" } }, + "node_modules/cytoscape": { + "version": "3.32.0", + "resolved": "https://registry.npmjs.org/cytoscape/-/cytoscape-3.32.0.tgz", + "integrity": "sha512-5JHBC9n75kz5851jeklCPmZWcg3hUe6sjqJvyk3+hVqFaKcHwHgxsjeN1yLmggoUc6STbtm9/NQyabQehfjvWQ==", + "license": "MIT", + "engines": { + "node": ">=0.10" + } + }, + "node_modules/cytoscape-cose-bilkent": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/cytoscape-cose-bilkent/-/cytoscape-cose-bilkent-4.1.0.tgz", + "integrity": "sha512-wgQlVIUJF13Quxiv5e1gstZ08rnZj2XaLHGoFMYXz7SkNfCDOOteKBE6SYRfA9WxxI/iBc3ajfDoc6hb/MRAHQ==", + "license": "MIT", + "dependencies": { + "cose-base": "^1.0.0" + }, + "peerDependencies": { + "cytoscape": "^3.2.0" + } + }, + "node_modules/cytoscape-fcose": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cytoscape-fcose/-/cytoscape-fcose-2.2.0.tgz", + "integrity": "sha512-ki1/VuRIHFCzxWNrsshHYPs6L7TvLu3DL+TyIGEsRcvVERmxokbf5Gdk7mFxZnTdiGtnA4cfSmjZJMviqSuZrQ==", + "license": "MIT", + "dependencies": { + "cose-base": "^2.2.0" + }, + "peerDependencies": { + "cytoscape": "^3.2.0" + } + }, + "node_modules/cytoscape-fcose/node_modules/cose-base": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cose-base/-/cose-base-2.2.0.tgz", + "integrity": "sha512-AzlgcsCbUMymkADOJtQm3wO9S3ltPfYOFD5033keQn9NJzIbtnZj+UdBJe7DYml/8TdbtHJW3j58SOnKhWY/5g==", + "license": "MIT", + "dependencies": { + "layout-base": "^2.0.0" + } + }, + "node_modules/cytoscape-fcose/node_modules/layout-base": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/layout-base/-/layout-base-2.0.1.tgz", + "integrity": "sha512-dp3s92+uNI1hWIpPGH3jK2kxE2lMjdXdr+DH8ynZHpd6PUlH6x6cbuXnoMmiNumznqaNO31xu9e79F0uuZ0JFg==", + "license": "MIT" + }, "node_modules/d": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/d/-/d-1.0.2.tgz", @@ -2235,6 +2766,466 @@ "node": ">=0.12" } }, + "node_modules/d3": { + "version": "7.9.0", + "resolved": "https://registry.npmjs.org/d3/-/d3-7.9.0.tgz", + "integrity": "sha512-e1U46jVP+w7Iut8Jt8ri1YsPOvFpg46k+K8TpCb0P+zjCkjkPnV7WzfDJzMHy1LnA+wj5pLT1wjO901gLXeEhA==", + "license": "ISC", + "dependencies": { + "d3-array": "3", + "d3-axis": "3", + "d3-brush": "3", + "d3-chord": "3", + "d3-color": "3", + "d3-contour": "4", + "d3-delaunay": "6", + "d3-dispatch": "3", + "d3-drag": "3", + "d3-dsv": "3", + "d3-ease": "3", + "d3-fetch": "3", + "d3-force": "3", + "d3-format": "3", + "d3-geo": "3", + "d3-hierarchy": "3", + "d3-interpolate": "3", + "d3-path": "3", + "d3-polygon": "3", + "d3-quadtree": "3", + "d3-random": "3", + "d3-scale": "4", + "d3-scale-chromatic": "3", + "d3-selection": "3", + "d3-shape": "3", + "d3-time": "3", + "d3-time-format": "4", + "d3-timer": "3", + "d3-transition": "3", + "d3-zoom": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-array": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-3.2.4.tgz", + "integrity": "sha512-tdQAmyA18i4J7wprpYq8ClcxZy3SC31QMeByyCFyRt7BVHdREQZ5lpzoe5mFEYZUWe+oq8HBvk9JjpibyEV4Jg==", + "license": "ISC", + "dependencies": { + "internmap": "1 - 2" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-axis": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-axis/-/d3-axis-3.0.0.tgz", + "integrity": "sha512-IH5tgjV4jE/GhHkRV0HiVYPDtvfjHQlQfJHs0usq7M30XcSBvOotpmH1IgkcXsO/5gEQZD43B//fc7SRT5S+xw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-brush": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-brush/-/d3-brush-3.0.0.tgz", + "integrity": "sha512-ALnjWlVYkXsVIGlOsuWH1+3udkYFI48Ljihfnh8FZPF2QS9o+PzGLBslO0PjzVoHLZ2KCVgAM8NVkXPJB2aNnQ==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "3", + "d3-transition": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-chord": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-chord/-/d3-chord-3.0.1.tgz", + "integrity": "sha512-VE5S6TNa+j8msksl7HwjxMHDM2yNK3XCkusIlpX5kwauBfXuyLAtNg9jCp/iHH61tgI4sb6R/EIMWCqEIdjT/g==", + "license": "ISC", + "dependencies": { + "d3-path": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-color": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-color/-/d3-color-3.1.0.tgz", + "integrity": "sha512-zg/chbXyeBtMQ1LbD/WSoW2DpC3I0mpmPdW+ynRTj/x2DAWYrIY7qeZIHidozwV24m4iavr15lNwIwLxRmOxhA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-contour": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-contour/-/d3-contour-4.0.2.tgz", + "integrity": "sha512-4EzFTRIikzs47RGmdxbeUvLWtGedDUNkTcmzoeyg4sP/dvCexO47AaQL7VKy/gul85TOxw+IBgA8US2xwbToNA==", + "license": "ISC", + "dependencies": { + "d3-array": "^3.2.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-delaunay": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/d3-delaunay/-/d3-delaunay-6.0.4.tgz", + "integrity": "sha512-mdjtIZ1XLAM8bm/hx3WwjfHt6Sggek7qH043O8KEjDXN40xi3vx/6pYSVTwLjEgiXQTbvaouWKynLBiUZ6SK6A==", + "license": "ISC", + "dependencies": { + "delaunator": "5" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dispatch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dispatch/-/d3-dispatch-3.0.1.tgz", + "integrity": "sha512-rzUyPU/S7rwUflMyLc1ETDeBj0NRuHKKAcvukozwhshr6g6c5d8zh4c2gQjY2bZ0dXeGLWc1PF174P2tVvKhfg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-drag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-drag/-/d3-drag-3.0.0.tgz", + "integrity": "sha512-pWbUJLdETVA8lQNJecMxoXfH6x+mO2UQo8rSmZ+QqxcbyA3hfeprFgIT//HW2nlHChWeIIMwS2Fq+gEARkhTkg==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-selection": "3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-dsv/-/d3-dsv-3.0.1.tgz", + "integrity": "sha512-UG6OvdI5afDIFP9w4G0mNq50dSOsXHJaRE8arAS5o9ApWnIElp8GZw1Dun8vP8OyHOZ/QJUKUJwxiiCCnUwm+Q==", + "license": "ISC", + "dependencies": { + "commander": "7", + "iconv-lite": "0.6", + "rw": "1" + }, + "bin": { + "csv2json": "bin/dsv2json.js", + "csv2tsv": "bin/dsv2dsv.js", + "dsv2dsv": "bin/dsv2dsv.js", + "dsv2json": "bin/dsv2json.js", + "json2csv": "bin/json2dsv.js", + "json2dsv": "bin/json2dsv.js", + "json2tsv": "bin/json2dsv.js", + "tsv2csv": "bin/dsv2dsv.js", + "tsv2json": "bin/dsv2json.js" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-dsv/node_modules/commander": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", + "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/d3-ease": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-ease/-/d3-ease-3.0.1.tgz", + "integrity": "sha512-wR/XK3D3XcLIZwpbvQwQ5fK+8Ykds1ip7A2Txe0yxncXSdq1L9skcG7blcedkOX+ZcgxGAmLX1FrRGbADwzi0w==", + "license": "BSD-3-Clause", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-fetch": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-fetch/-/d3-fetch-3.0.1.tgz", + "integrity": "sha512-kpkQIM20n3oLVBKGg6oHrUchHM3xODkTzjMoj7aWQFq5QEM+R6E4WkzT5+tojDY7yjez8KgCBRoj4aEr99Fdqw==", + "license": "ISC", + "dependencies": { + "d3-dsv": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-force": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-force/-/d3-force-3.0.0.tgz", + "integrity": "sha512-zxV/SsA+U4yte8051P4ECydjD/S+qeYtnaIyAs9tgHCqfguma/aAQDjo85A9Z6EKhBirHRJHXIgJUlffT4wdLg==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-quadtree": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-format": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-format/-/d3-format-3.1.0.tgz", + "integrity": "sha512-YyUI6AEuY/Wpt8KWLgZHsIU86atmikuoOmCfommt0LYHiQSPjvX2AcFc38PX0CBpr2RCyZhjex+NS/LPOv6YqA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-geo": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/d3-geo/-/d3-geo-3.1.1.tgz", + "integrity": "sha512-637ln3gXKXOwhalDzinUgY83KzNWZRKbYubaG+fGVuc/dxO64RRljtCTnf5ecMyE1RIdtqpkVcq0IbtU2S8j2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2.5.0 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-hierarchy": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/d3-hierarchy/-/d3-hierarchy-3.1.2.tgz", + "integrity": "sha512-FX/9frcub54beBdugHjDCdikxThEqjnR93Qt7PvQTOHxyiNCAlvMrHhclk3cD5VeAaq9fxmfRp+CnWw9rEMBuA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-interpolate": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-interpolate/-/d3-interpolate-3.0.1.tgz", + "integrity": "sha512-3bYs1rOD33uo8aqJfKP3JWPAibgw8Zm2+L9vBKEHJ2Rg+viTR7o5Mmv5mZcieN+FRYaAOWX5SJATX6k1PWz72g==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-3.1.0.tgz", + "integrity": "sha512-p3KP5HCf/bvjBSSKuXid6Zqijx7wIfNW+J/maPs+iwR35at5JCbLUT0LzF1cnjbCHWhqzQTIN2Jpe8pRebIEFQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-polygon": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-polygon/-/d3-polygon-3.0.1.tgz", + "integrity": "sha512-3vbA7vXYwfe1SYhED++fPUQlWSYTTGmFmQiany/gdbiWgU/iEyQzyymwL9SkJjFFuCS4902BSzewVGsHHmHtXg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-quadtree": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-quadtree/-/d3-quadtree-3.0.1.tgz", + "integrity": "sha512-04xDrxQTDTCFwP5H6hRhsRcb9xxv2RzkcsygFzmkSIOJy3PeRJP7sNk3VRIbKXcog561P9oU0/rVH6vDROAgUw==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-random": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-random/-/d3-random-3.0.1.tgz", + "integrity": "sha512-FXMe9GfxTxqd5D6jFsQ+DJ8BJS4E/fT5mqqdjovykEB2oFbTMDVdg1MGFxfQW+FBOGoB++k8swBrgwSHT1cUXQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-sankey": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/d3-sankey/-/d3-sankey-0.12.3.tgz", + "integrity": "sha512-nQhsBRmM19Ax5xEIPLMY9ZmJ/cDvd1BG3UVvt5h3WRxKg5zGRbvnteTyWAbzeSvlh3tW7ZEmq4VwR5mB3tutmQ==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-array": "1 - 2", + "d3-shape": "^1.2.0" + } + }, + "node_modules/d3-sankey/node_modules/d3-array": { + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/d3-array/-/d3-array-2.12.1.tgz", + "integrity": "sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ==", + "license": "BSD-3-Clause", + "dependencies": { + "internmap": "^1.0.0" + } + }, + "node_modules/d3-sankey/node_modules/d3-path": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/d3-path/-/d3-path-1.0.9.tgz", + "integrity": "sha512-VLaYcn81dtHVTjEHd8B+pbe9yHWpXKZUC87PzoFmsFrJqgFwDe/qxfp5MlfsfM1V5E/iVt0MmEbWQ7FVIXh/bg==", + "license": "BSD-3-Clause" + }, + "node_modules/d3-sankey/node_modules/d3-shape": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-1.3.7.tgz", + "integrity": "sha512-EUkvKjqPFUAZyOlhY5gzCxCeI0Aep04LwIRpsZ/mLFelJiUfnK56jo5JMDSE7yyP2kLSb6LtF+S5chMk7uqPqw==", + "license": "BSD-3-Clause", + "dependencies": { + "d3-path": "1" + } + }, + "node_modules/d3-sankey/node_modules/internmap": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-1.0.1.tgz", + "integrity": "sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw==", + "license": "ISC" + }, + "node_modules/d3-scale": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/d3-scale/-/d3-scale-4.0.2.tgz", + "integrity": "sha512-GZW464g1SH7ag3Y7hXjf8RoUuAFIqklOAq3MRl4OaWabTFJY9PN/E1YklhXLh+OQ3fM9yS2nOkCoS+WLZ6kvxQ==", + "license": "ISC", + "dependencies": { + "d3-array": "2.10.0 - 3", + "d3-format": "1 - 3", + "d3-interpolate": "1.2.0 - 3", + "d3-time": "2.1.1 - 3", + "d3-time-format": "2 - 4" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-scale-chromatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-scale-chromatic/-/d3-scale-chromatic-3.1.0.tgz", + "integrity": "sha512-A3s5PWiZ9YCXFye1o246KoscMWqf8BsD9eRiJ3He7C9OBaxKhAd5TFCdEx/7VbKtxxTsu//1mMJFrEt572cEyQ==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3", + "d3-interpolate": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-selection": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-selection/-/d3-selection-3.0.0.tgz", + "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-shape": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/d3-shape/-/d3-shape-3.2.0.tgz", + "integrity": "sha512-SaLBuwGm3MOViRq2ABk3eLoxwZELpH6zhl3FbAoJ7Vm1gofKx6El1Ib5z23NUEhF9AsGl7y+dzLe5Cw2AArGTA==", + "license": "ISC", + "dependencies": { + "d3-path": "^3.1.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/d3-time/-/d3-time-3.1.0.tgz", + "integrity": "sha512-VqKjzBLejbSMT4IgbmVgDjpkYrNWUYJnbCGo874u7MMKIWsILRX+OpX/gTk8MqjpT1A/c6HY2dCA77ZN0lkQ2Q==", + "license": "ISC", + "dependencies": { + "d3-array": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-time-format": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/d3-time-format/-/d3-time-format-4.1.0.tgz", + "integrity": "sha512-dJxPBlzC7NugB2PDLwo9Q8JiTR3M3e4/XANkreKSUxF8vvXKqm1Yfq4Q5dl8budlunRVlUUaDUgFt7eA8D6NLg==", + "license": "ISC", + "dependencies": { + "d3-time": "1 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-timer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-timer/-/d3-timer-3.0.1.tgz", + "integrity": "sha512-ndfJ/JxxMd3nw31uyKoY2naivF+r29V+Lc0svZxe1JvvIRmi8hUsrMvdOwgS1o6uBHmiz91geQ0ylPP0aj1VUA==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/d3-transition": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/d3-transition/-/d3-transition-3.0.1.tgz", + "integrity": "sha512-ApKvfjsSR6tg06xrL434C0WydLr7JewBB3V+/39RMHsaXTOG0zmt/OAXeng5M5LBm0ojmxJrpomQVZ1aPvBL4w==", + "license": "ISC", + "dependencies": { + "d3-color": "1 - 3", + "d3-dispatch": "1 - 3", + "d3-ease": "1 - 3", + "d3-interpolate": "1 - 3", + "d3-timer": "1 - 3" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "d3-selection": "2 - 3" + } + }, + "node_modules/d3-zoom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/d3-zoom/-/d3-zoom-3.0.0.tgz", + "integrity": "sha512-b8AmV3kfQaqWAuacbPuNbL6vahnOJflOhexLzMMNLga62+/nh0JzvJ0aO/5a5MVgUFGS7Hu1P9P03o3fJkDCyw==", + "license": "ISC", + "dependencies": { + "d3-dispatch": "1 - 3", + "d3-drag": "2 - 3", + "d3-interpolate": "1 - 3", + "d3-selection": "2 - 3", + "d3-transition": "2 - 3" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/dagre-d3-es": { + "version": "7.0.11", + "resolved": "https://registry.npmjs.org/dagre-d3-es/-/dagre-d3-es-7.0.11.tgz", + "integrity": "sha512-tvlJLyQf834SylNKax8Wkzco/1ias1OPw8DcUMDE7oUIoSEW25riQVuiu/0OWEFqT0cxHT3Pa9/D82Jr47IONw==", + "license": "MIT", + "dependencies": { + "d3": "^7.9.0", + "lodash-es": "^4.17.21" + } + }, "node_modules/data-urls": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", @@ -2247,10 +3238,17 @@ "node": ">=18" } }, + "node_modules/dayjs": { + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", + "license": "MIT" + }, "node_modules/debug": { - "version": "4.3.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz", - "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.1.tgz", + "integrity": "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ==", + "license": "MIT", "dependencies": { "ms": "^2.1.3" }, @@ -2304,6 +3302,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/delaunator": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/delaunator/-/delaunator-5.0.1.tgz", + "integrity": "sha512-8nvh+XBe96aCESrGOqMp/84b13H9cdKbG5P2ejQCh4d4sK9RL4371qou9drQjMhvnPmhWl5hnmqbEE0fXr9Xnw==", + "license": "ISC", + "dependencies": { + "robust-predicates": "^3.0.2" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -2383,9 +3390,13 @@ } }, "node_modules/dompurify": { - "version": "3.1.7", - "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.1.7.tgz", - "integrity": "sha512-VaTstWtsneJY8xzy7DekmYWEOZcmzIe3Qb3zPd4STve1OBTa+e+WmS1ITQec1fZYXI3HCsOZZiSMpG6oxoWMWQ==" + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.5.tgz", + "integrity": "sha512-mLPd29uoRe9HpvwP2TxClGQBzGXeEC/we/q+bFlmPPmj2p2Ugl3r6ATu/UU1v77DXNcehiBg9zsr1dREyA/dJQ==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } }, "node_modules/domutils": { "version": "3.1.0", @@ -2928,6 +3939,12 @@ "node": ">=12.0.0" } }, + "node_modules/exsolve": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.5.tgz", + "integrity": "sha512-pz5dvkYYKQ1AHVrgOzBKWeP4u4FRb3a6DNK2ucr0OoNwYIU4QWsJ+NM36LLzORT+z845MzKHHhpXiUF5nvQoJg==", + "license": "MIT" + }, "node_modules/ext": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/ext/-/ext-1.7.0.tgz", @@ -3073,6 +4090,18 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/globals": { + "version": "15.15.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz", + "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/globalyzer": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/globalyzer/-/globalyzer-0.1.0.tgz", @@ -3109,6 +4138,12 @@ "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } }, + "node_modules/hachure-fill": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/hachure-fill/-/hachure-fill-0.5.2.tgz", + "integrity": "sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==", + "license": "MIT" + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3311,6 +4346,15 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, + "node_modules/internmap": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/internmap/-/internmap-2.0.3.tgz", + "integrity": "sha512-5Hh7Y1wQbvY5ooGgPbDaL5iYLAPzMTUrjMulskHLH6wnv/A+1q5rgEaiuqEjB+oxGXIVZs1FF+R/KPN3ZSQYYg==", + "license": "ISC", + "engines": { + "node": ">=12" + } + }, "node_modules/intl-messageformat": { "version": "9.13.0", "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-9.13.0.tgz", @@ -3546,6 +4590,11 @@ "katex": "cli.js" } }, + "node_modules/khroma": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/khroma/-/khroma-2.1.0.tgz", + "integrity": "sha512-Ls993zuzfayK269Svk9hzpeGUKob/sIgZzyHYdjQoAdQetRKpOLj+k/QQQ/6Qi0Yz65mlROrfd+Ev+1+7dz9Kw==" + }, "node_modules/kleur": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", @@ -3555,6 +4604,34 @@ "node": ">=6" } }, + "node_modules/kolorist": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/kolorist/-/kolorist-1.8.0.tgz", + "integrity": "sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==", + "license": "MIT" + }, + "node_modules/langium": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/langium/-/langium-3.3.1.tgz", + "integrity": "sha512-QJv/h939gDpvT+9SiLVlY7tZC3xB2qK57v0J04Sh9wpMb6MP1q8gB21L3WIo8T5P1MSMg3Ep14L7KkDCFG3y4w==", + "license": "MIT", + "dependencies": { + "chevrotain": "~11.0.3", + "chevrotain-allstar": "~0.3.0", + "vscode-languageserver": "~9.0.1", + "vscode-languageserver-textdocument": "~1.0.11", + "vscode-uri": "~3.0.8" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/layout-base": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/layout-base/-/layout-base-1.0.2.tgz", + "integrity": "sha512-8h2oVEZNktL4BH2JCOI90iD1yXwL6iNW7KcCKT2QZgQJR2vbqDsldCTPRU9NifTCqHZci57XvQQ15YTu+sTYPg==", + "license": "MIT" + }, "node_modules/lazy-brush": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/lazy-brush/-/lazy-brush-1.0.1.tgz", @@ -3832,16 +4909,33 @@ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", "dev": true }, + "node_modules/local-pkg": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-1.1.1.tgz", + "integrity": "sha512-WunYko2W1NcdfAFpuLUoucsgULmgDBRkdxHxWQ7mK0cQqwPiy8E1enjuRBrhLtZkB5iScJ1XIPdhVEFK8aOLSg==", + "license": "MIT", + "dependencies": { + "mlly": "^1.7.4", + "pkg-types": "^2.0.1", + "quansync": "^0.2.8" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, "node_modules/locate-character": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/locate-character/-/locate-character-3.0.0.tgz", "integrity": "sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==" }, - "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.anpm.alibaba-inc.com/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==", - "license": "Apache-2.0" + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", + "license": "MIT" }, "node_modules/lru-cache": { "version": "10.4.3", @@ -3944,6 +5038,46 @@ "node": ">=0.12" } }, + "node_modules/mermaid": { + "version": "11.6.0", + "resolved": "https://registry.npmjs.org/mermaid/-/mermaid-11.6.0.tgz", + "integrity": "sha512-PE8hGUy1LDlWIHWBP05SFdqUHGmRcCcK4IzpOKPE35eOw+G9zZgcnMpyunJVUEOgb//KBORPjysKndw8bFLuRg==", + "license": "MIT", + "dependencies": { + "@braintree/sanitize-url": "^7.0.4", + "@iconify/utils": "^2.1.33", + "@mermaid-js/parser": "^0.4.0", + "@types/d3": "^7.4.3", + "cytoscape": "^3.29.3", + "cytoscape-cose-bilkent": "^4.1.0", + "cytoscape-fcose": "^2.2.0", + "d3": "^7.9.0", + "d3-sankey": "^0.12.3", + "dagre-d3-es": "7.0.11", + "dayjs": "^1.11.13", + "dompurify": "^3.2.4", + "katex": "^0.16.9", + "khroma": "^2.1.0", + "lodash-es": "^4.17.21", + "marked": "^15.0.7", + "roughjs": "^4.6.6", + "stylis": "^4.3.6", + "ts-dedent": "^2.2.0", + "uuid": "^11.1.0" + } + }, + "node_modules/mermaid/node_modules/marked": { + "version": "15.0.11", + "resolved": "https://registry.npmjs.org/marked/-/marked-15.0.11.tgz", + "integrity": "sha512-1BEXAU2euRCG3xwgLVT1y0xbJEld1XOrmRJpUwRCcy7rxhSCwMrmEu9LXoPhHSCJG41V7YcQ2mjKRr5BA3ITIA==", + "license": "MIT", + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/micromatch": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", @@ -4041,6 +5175,47 @@ "mkdirp": "bin/cmd.js" } }, + "node_modules/mlly": { + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.7.4.tgz", + "integrity": "sha512-qmdSIPC4bDJXgZTCR7XosJiNKySV7O215tsPtDN9iEO/7q/76b/ijtgRu/+epFXSJhijtTCCGp3DWS549P3xKw==", + "license": "MIT", + "dependencies": { + "acorn": "^8.14.0", + "pathe": "^2.0.1", + "pkg-types": "^1.3.0", + "ufo": "^1.5.4" + } + }, + "node_modules/mlly/node_modules/acorn": { + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", + "license": "MIT", + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/mlly/node_modules/confbox": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz", + "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==", + "license": "MIT" + }, + "node_modules/mlly/node_modules/pkg-types": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz", + "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==", + "license": "MIT", + "dependencies": { + "confbox": "^0.1.8", + "mlly": "^1.7.4", + "pathe": "^2.0.1" + } + }, "node_modules/mri": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/mri/-/mri-1.2.0.tgz", @@ -4241,15 +5416,11 @@ "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", "dev": true }, - "node_modules/parse-node-version": { - "version": "1.0.1", - "resolved": "https://registry.anpm.alibaba-inc.com/parse-node-version/-/parse-node-version-1.0.1.tgz", - "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 0.10" - } + "node_modules/package-manager-detector": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/package-manager-detector/-/package-manager-detector-1.3.0.tgz", + "integrity": "sha512-ZsEbbZORsyHuO00lY1kV3/t72yp6Ysay6Pd17ZAlNGuGwmWDLCJxFpRs0IzfXfj1o4icJOkUEioexFHzyPurSQ==", + "license": "MIT" }, "node_modules/parse-srcset": { "version": "1.0.2", @@ -4272,6 +5443,12 @@ "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" }, + "node_modules/path-data-parser": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/path-data-parser/-/path-data-parser-0.1.0.tgz", + "integrity": "sha512-NOnmBpt5Y2RWbuv0LMzsayp3lVylAHLPUTut412ZA3l+C4uw4ZVkQbjShYCQ8TCpUMdPapr4YjUqLYD6v68j+w==", + "license": "MIT" + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -4317,6 +5494,12 @@ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==" }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "license": "MIT" + }, "node_modules/periscopic": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/periscopic/-/periscopic-3.1.0.tgz", @@ -4372,6 +5555,33 @@ "node": ">= 6" } }, + "node_modules/pkg-types": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.1.0.tgz", + "integrity": "sha512-wmJwA+8ihJixSoHKxZJRBQG1oY8Yr9pGLzRmSsNms0iNWyHHAlZCa7mmKiFR10YPZuz/2k169JiS/inOjBCZ2A==", + "license": "MIT", + "dependencies": { + "confbox": "^0.2.1", + "exsolve": "^1.0.1", + "pathe": "^2.0.3" + } + }, + "node_modules/points-on-curve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/points-on-curve/-/points-on-curve-0.2.0.tgz", + "integrity": "sha512-0mYKnYYe9ZcqMCWhUjItv/oHjvgEsfKvnUTg8sAtnHr3GVy7rGkXCb6d5cSyqrWqL4k81b9CPg3urd+T7aop3A==", + "license": "MIT" + }, + "node_modules/points-on-path": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/points-on-path/-/points-on-path-0.2.1.tgz", + "integrity": "sha512-25ClnWWuw7JbWZcgqY/gJ4FQWadKxGWk+3kR/7kD0tCaDtPPMj7oHu2ToLaVhfpnHrZzYby2w6tUA0eOIuUg8g==", + "license": "MIT", + "dependencies": { + "path-data-parser": "0.1.0", + "points-on-curve": "0.2.0" + } + }, "node_modules/postcss": { "version": "8.4.47", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", @@ -4599,14 +5809,21 @@ "node": ">=18.0.0" } }, - "node_modules/python-struct": { - "version": "1.1.3", - "resolved": "https://registry.anpm.alibaba-inc.com/python-struct/-/python-struct-1.1.3.tgz", - "integrity": "sha512-UsI/mNvk25jRpGKYI38Nfbv84z48oiIWwG67DLVvjRhy8B/0aIK+5Ju5WOHgw/o9rnEmbAS00v4rgKFQeC332Q==", - "license": "MIT", - "dependencies": { - "long": "^4.0.0" - } + "node_modules/quansync": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.10.tgz", + "integrity": "sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/antfu" + }, + { + "type": "individual", + "url": "https://github.com/sponsors/sxzz" + } + ], + "license": "MIT" }, "node_modules/querystringify": { "version": "2.2.0", @@ -4674,6 +5891,12 @@ "rimraf": "bin.js" } }, + "node_modules/robust-predicates": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-3.0.2.tgz", + "integrity": "sha512-IXgzBWvWQwE6PrDI05OvmXUIruQTcoMDzRsOd5CDvHCVLcLHMTSYvOK5Cm46kWqlV3yAbuSpBZdJ5oP5OUoStg==", + "license": "Unlicense" + }, "node_modules/rollup": { "version": "4.24.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.24.0.tgz", @@ -4709,11 +5932,29 @@ "fsevents": "~2.3.2" } }, + "node_modules/roughjs": { + "version": "4.6.6", + "resolved": "https://registry.npmjs.org/roughjs/-/roughjs-4.6.6.tgz", + "integrity": "sha512-ZUz/69+SYpFN/g/lUlo2FXcIjRkSu3nDarreVdGGndHEBJ6cXPdKguS8JGxwj5HA5xIbVKSmLgr5b3AWxtRfvQ==", + "license": "MIT", + "dependencies": { + "hachure-fill": "^0.5.2", + "path-data-parser": "^0.1.0", + "points-on-curve": "^0.2.0", + "points-on-path": "^0.2.1" + } + }, "node_modules/rrweb-cssom": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz", "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==" }, + "node_modules/rw": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/rw/-/rw-1.3.3.tgz", + "integrity": "sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ==", + "license": "BSD-3-Clause" + }, "node_modules/sade": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/sade/-/sade-1.8.1.tgz", @@ -4981,6 +6222,12 @@ "node": ">=8" } }, + "node_modules/stylis": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/stylis/-/stylis-4.3.6.tgz", + "integrity": "sha512-yQ3rwFWRfwNUY7H5vpU0wfdkNSnvnJinhF9830Swlaxl03zsOjCfmX0ugac+3LtK0lYSgwL/KXc8oYL3mG4YFQ==", + "license": "MIT" + }, "node_modules/stylus": { "version": "0.55.0", "resolved": "https://registry.npmjs.org/stylus/-/stylus-0.55.0.tgz", @@ -5402,6 +6649,12 @@ "globrex": "^0.1.2" } }, + "node_modules/tinyexec": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.1.tgz", + "integrity": "sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw==", + "license": "MIT" + }, "node_modules/tldts": { "version": "6.1.52", "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.52.tgz", @@ -5467,6 +6720,15 @@ "node": ">=18" } }, + "node_modules/ts-dedent": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/ts-dedent/-/ts-dedent-2.2.0.tgz", + "integrity": "sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==", + "license": "MIT", + "engines": { + "node": ">=6.10" + } + }, "node_modules/ts-interface-checker": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", @@ -5506,6 +6768,12 @@ "node": ">=14.17" } }, + "node_modules/ufo": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", + "integrity": "sha512-9a4/uxlTWJ4+a5i0ooc1rU7C7YOw3wT+UGqdeNNHWnOF9qcMBgLRS+4IYUqbczewFx4mLEig6gawh7X6mFlEkA==", + "license": "MIT" + }, "node_modules/undici-types": { "version": "6.19.8", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.19.8.tgz", @@ -5528,6 +6796,19 @@ "requires-port": "^1.0.0" } }, + "node_modules/uuid": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", + "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "license": "MIT", + "bin": { + "uuid": "dist/esm/bin/uuid" + } + }, "node_modules/vite": { "version": "5.4.9", "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.9.tgz", @@ -6016,6 +7297,55 @@ "node": ">=0.10.0" } }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageserver": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-9.0.1.tgz", + "integrity": "sha512-woByF3PDpkHFUreUa7Hos7+pUWdeWMXRd26+ZX2A8cFx6v/JPTtd4/uN0/jB6XQHYaOlHbio03NTHCqrgG5n7g==", + "license": "MIT", + "dependencies": { + "vscode-languageserver-protocol": "3.17.5" + }, + "bin": { + "installServerIntoExtension": "bin/installServerIntoExtension" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "license": "MIT", + "dependencies": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==", + "license": "MIT" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==", + "license": "MIT" + }, + "node_modules/vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==", + "license": "MIT" + }, "node_modules/w3c-xmlserializer": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz", diff --git a/frontend/package.json b/frontend/package.json index 47e515a..a505561 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { - "name": "gradio_webrtc", - "version": "0.11.0-beta.3", + "name": "@freddyaboulton/fastrtc-component", + "version": "0.0.1", "description": "Gradio UI packages", "type": "module", "author": "", @@ -15,6 +15,7 @@ "@gradio/image": "0.16.4", "@gradio/markdown": "^0.10.3", "@gradio/statustracker": "0.9.1", + "@gradio/textbox": "^0.10.10", "@gradio/upload": "0.13.3", "@gradio/utils": "0.7.0", "@gradio/wasm": "0.14.2", @@ -53,7 +54,7 @@ "main_changeset": true, "repository": { "type": "git", - "url": "git+https://github.com/gradio-app/gradio.git", - "directory": "js/video" + "url": "git+https://github.com/gradio-app/fastrtc.git", + "directory": "fastrtc/frontend" } } diff --git a/frontend/shared/InteractiveAudio.svelte b/frontend/shared/InteractiveAudio.svelte index 4f48de4..51715cf 100644 --- a/frontend/shared/InteractiveAudio.svelte +++ b/frontend/shared/InteractiveAudio.svelte @@ -15,14 +15,16 @@ Microphone, } from "@gradio/icons"; import MicrophoneMuted from "./MicrophoneMuted.svelte"; + import type { WebRTCValue } from "./utils"; import { start, stop } from "./webrtc_utils"; import { get_devices, set_available_devices } from "./stream_utils"; import AudioWave from "./AudioWave.svelte"; + import TextboxWithMic from "./TextboxWithMic.svelte"; import WebcamPermissions from "./WebcamPermissions.svelte"; import PulsingIcon from "./PulsingIcon.svelte"; export let mode: "send-receive" | "send"; - export let value: string | null = null; + export let value: WebRTCValue | null = null; export let label: string | undefined = undefined; export let show_label = true; export let rtc_configuration: Object | null = null; @@ -37,6 +39,8 @@ export let pulse_color: string = "var(--color-accent)"; export let icon_radius: number = 50; export let button_labels: { start: string; stop: string; waiting: string }; + export let variant: "textbox" | "wave" = "wave"; + let pending = false; let stopword_recognized = false; @@ -44,7 +48,7 @@ let notification_sound; onMount(() => { - if (value === "__webrtc_value__") { + if (value?.webrtc_id === "__webrtc_value__") { notification_sound = new Audio( "https://huggingface.co/datasets/freddyaboulton/bucket/resolve/main/pop-sounds.mp3", ); @@ -73,6 +77,9 @@ export let server: { offer: (body: any) => Promise; + turn: () => Promise; + trigger_response: (body: any) => Promise; + quit_output_stream: (body: any) => Promise; }; let stream_state: "open" | "closed" | "waiting" = "closed"; @@ -97,6 +104,8 @@ error: string; play: undefined; stop: undefined; + start_recording: undefined; + stop_recording: undefined; }>(); async function access_mic(): Promise { @@ -140,15 +149,29 @@ async function start_stream(): Promise { if (stream_state === "open") { + dispatch("stop_recording"); stop(pc); stream_state = "closed"; _time_limit = null; await access_mic(); + await server.quit_output_stream({ webrtc_id: _webrtc_id }); return; } + + dispatch("start_recording"); _webrtc_id = Math.random().toString(36).substring(2); - value = _webrtc_id; + value.webrtc_id = _webrtc_id; + stream_state = "waiting"; + await server.turn().then((rtc_configuration_) => { + if (rtc_configuration_.error) { + dispatch("error", rtc_configuration_.error); + return; + } + rtc_configuration = rtc_configuration_; + console.info("rtc_configuration", rtc_configuration_); + }); pc = new RTCPeerConnection(rtc_configuration); + console.info("created"); pc.addEventListener("connectionstatechange", async (event) => { switch (pc.connectionState) { case "connected": @@ -173,7 +196,6 @@ break; } }); - stream_state = "waiting"; stream = null; try { @@ -204,7 +226,7 @@ const timeoutId = setTimeout(() => { // @ts-ignore _on_change_cb({ type: "connection_timeout" }); - }, 5000); + }, 10000); start( stream, @@ -286,24 +308,50 @@ $: if (stopword_recognized) { notification_sound.play(); } + + function input_audio_source_callback(): MediaStream { + return stream; + } - +{#if variant !== "textbox"} + +{/if}