diff --git a/CHANGELOG b/CHANGELOG index bad6f531..ed317762 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,10 @@ # Change Log +## 2.2.21 10/05/2021 + +* Release Web-Ui v2.2.21 +* Improvements for get symbol dimensions endpoint. Ref #1885 + ## 2.2.20 09/04/2021 * Release Web UI version 2.2.20 diff --git a/README.rst b/README.rst index bb4c9138..3c70ede9 100644 --- a/README.rst +++ b/README.rst @@ -76,14 +76,16 @@ Finally these commands will install the server as well as the rest of the depend .. code:: bash cd gns3-server-master + python3 -m venv venv-gns3server + source venv-gns3server/bin/activate sudo python3 setup.py install - gns3server + python3 -m gns3server --local To run tests use: .. code:: bash - py.test -v + python3 -m pytest tests Docker container diff --git a/conf/gns3_server.conf b/conf/gns3_server.conf index 85c795be..8560d59d 100644 --- a/conf/gns3_server.conf +++ b/conf/gns3_server.conf @@ -64,6 +64,14 @@ user = gns3 ; Password for HTTP authentication. password = gns3 +; Initial default super admin username +; It cannot be changed once the server has started once +default_admin_username = "admin" + +; Initial default super admin username +; It cannot be changed once the server has started once +default_admin_password = "admin" + ; Only allow these interfaces to be used by GNS3, for the Cloud node for example (Linux/OSX only) ; Do not forget to allow virbr0 in order for the NAT node to work allowed_interfaces = eth0,eth1,virbr0 diff --git a/dev-requirements.txt b/dev-requirements.txt index 3f17e10b..d6cfcd64 100644 --- a/dev-requirements.txt +++ b/dev-requirements.txt @@ -1,8 +1,8 @@ -r requirements.txt -pytest==6.2.3 -flake8==3.9.0 +pytest==6.2.4 +flake8==3.9.1 pytest-timeout==1.4.2 -pytest-asyncio==0.14.0 +pytest-asyncio==0.15.1 requests==2.25.1 -httpx==0.17.1 +httpx==0.18.1 diff --git a/gns3server/api/routes/compute/images.py b/gns3server/api/routes/compute/images.py index b5103aaf..e556c1d3 100644 --- a/gns3server/api/routes/compute/images.py +++ b/gns3server/api/routes/compute/images.py @@ -69,13 +69,15 @@ async def download_dynamips_image(filename: str) -> FileResponse: Download a Dynamips IOS image. """ - dynamips_manager = Dynamips.instance() filename = urllib.parse.unquote(filename) - image_path = dynamips_manager.get_abs_image_path(filename) - if filename[0] == ".": + # Raise error if user try to escape + if filename[0] == "." or os.path.sep in filename: raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) + dynamips_manager = Dynamips.instance() + image_path = dynamips_manager.get_abs_image_path(filename) + if not os.path.exists(image_path): raise HTTPException(status_code=status.HTTP_404_NOT_FOUND) @@ -108,13 +110,14 @@ async def download_iou_image(filename: str) -> FileResponse: Download an IOU image. """ - iou_manager = IOU.instance() filename = urllib.parse.unquote(filename) - image_path = iou_manager.get_abs_image_path(filename) - if filename[0] == ".": + # Raise error if user try to escape + if filename[0] == "." or os.path.sep in filename: raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) + iou_manager = IOU.instance() + image_path = iou_manager.get_abs_image_path(filename) if not os.path.exists(image_path): raise HTTPException(status_code=status.HTTP_404_NOT_FOUND) @@ -138,13 +141,13 @@ async def upload_qemu_image(filename: str, request: Request) -> None: @router.get("/qemu/images/{filename:path}") async def download_qemu_image(filename: str) -> FileResponse: - qemu_manager = Qemu.instance() filename = urllib.parse.unquote(filename) # Raise error if user try to escape - if filename[0] == ".": + if filename[0] == "." or os.path.sep in filename: raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) + qemu_manager = Qemu.instance() image_path = qemu_manager.get_abs_image_path(filename) if not os.path.exists(image_path): diff --git a/gns3server/api/routes/compute/projects.py b/gns3server/api/routes/compute/projects.py index 8d9fe3b8..a1ddbfc4 100644 --- a/gns3server/api/routes/compute/projects.py +++ b/gns3server/api/routes/compute/projects.py @@ -19,6 +19,7 @@ API routes for projects. """ import os +import urllib.parse import logging @@ -32,6 +33,7 @@ from uuid import UUID from gns3server.compute.project_manager import ProjectManager from gns3server.compute.project import Project +from gns3server.utils.path import is_safe_path from gns3server import schemas @@ -197,10 +199,11 @@ async def get_compute_project_file(file_path: str, project: Project = Depends(de Get a file from a project. """ + file_path = urllib.parse.unquote(file_path) path = os.path.normpath(file_path) # Raise error if user try to escape - if path[0] == ".": + if not is_safe_path(path, project.path): raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) path = os.path.join(project.path, path) @@ -213,10 +216,11 @@ async def get_compute_project_file(file_path: str, project: Project = Depends(de @router.post("/projects/{project_id}/files/{file_path:path}", status_code=status.HTTP_204_NO_CONTENT) async def write_compute_project_file(file_path: str, request: Request, project: Project = Depends(dep_project)) -> None: + file_path = urllib.parse.unquote(file_path) path = os.path.normpath(file_path) # Raise error if user try to escape - if path[0] == ".": + if not is_safe_path(path, project.path): raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) path = os.path.join(project.path, path) diff --git a/gns3server/api/routes/controller/__init__.py b/gns3server/api/routes/controller/__init__.py index cb1e6ddc..9a2dc526 100644 --- a/gns3server/api/routes/controller/__init__.py +++ b/gns3server/api/routes/controller/__init__.py @@ -29,6 +29,7 @@ from . import snapshots from . import symbols from . import templates from . import users +from . import groups from .dependencies.authentication import get_current_active_user @@ -37,6 +38,13 @@ router = APIRouter() router.include_router(controller.router, tags=["Controller"]) router.include_router(users.router, prefix="/users", tags=["Users"]) +router.include_router( + groups.router, + dependencies=[Depends(get_current_active_user)], + prefix="/groups", + tags=["Users groups"] +) + router.include_router( appliances.router, dependencies=[Depends(get_current_active_user)], @@ -59,6 +67,7 @@ router.include_router( router.include_router( gns3vm.router, + deprecated=True, dependencies=[Depends(get_current_active_user)], prefix="/gns3vm", tags=["GNS3 VM"] diff --git a/gns3server/api/routes/controller/appliances.py b/gns3server/api/routes/controller/appliances.py index 0a2dfc7e..89dbe281 100644 --- a/gns3server/api/routes/controller/appliances.py +++ b/gns3server/api/routes/controller/appliances.py @@ -25,7 +25,7 @@ router = APIRouter() @router.get("") -async def get_appliances(update: Optional[bool] = None, symbol_theme: Optional[str] = "Classic") -> List[dict]: +async def get_appliances(update: Optional[bool] = False, symbol_theme: Optional[str] = "Classic") -> List[dict]: """ Return all appliances known by the controller. """ diff --git a/gns3server/api/routes/controller/groups.py b/gns3server/api/routes/controller/groups.py new file mode 100644 index 00000000..b3a96f66 --- /dev/null +++ b/gns3server/api/routes/controller/groups.py @@ -0,0 +1,184 @@ +#!/usr/bin/env python +# +# Copyright (C) 2021 GNS3 Technologies Inc. +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +""" +API routes for user groups. +""" + +from fastapi import APIRouter, Depends, status +from uuid import UUID +from typing import List + +from gns3server import schemas +from gns3server.controller.controller_error import ( + ControllerBadRequestError, + ControllerNotFoundError, + ControllerForbiddenError, +) + +from gns3server.db.repositories.users import UsersRepository +from .dependencies.database import get_repository + +import logging + +log = logging.getLogger(__name__) + +router = APIRouter() + + +@router.get("", response_model=List[schemas.UserGroup]) +async def get_user_groups( + users_repo: UsersRepository = Depends(get_repository(UsersRepository)) +) -> List[schemas.UserGroup]: + """ + Get all user groups. + """ + + return await users_repo.get_user_groups() + + +@router.post( + "", + response_model=schemas.UserGroup, + status_code=status.HTTP_201_CREATED +) +async def create_user_group( + user_group_create: schemas.UserGroupCreate, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)) +) -> schemas.UserGroup: + """ + Create a new user group. + """ + + if await users_repo.get_user_group_by_name(user_group_create.name): + raise ControllerBadRequestError(f"User group '{user_group_create.name}' already exists") + + return await users_repo.create_user_group(user_group_create) + + +@router.get("/{user_group_id}", response_model=schemas.UserGroup) +async def get_user_group( + user_group_id: UUID, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)), +) -> schemas.UserGroup: + """ + Get an user group. + """ + + user_group = await users_repo.get_user_group(user_group_id) + if not user_group: + raise ControllerNotFoundError(f"User group '{user_group_id}' not found") + return user_group + + +@router.put("/{user_group_id}", response_model=schemas.UserGroup) +async def update_user_group( + user_group_id: UUID, + user_group_update: schemas.UserGroupUpdate, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)) +) -> schemas.UserGroup: + """ + Update an user group. + """ + user_group = await users_repo.get_user_group(user_group_id) + if not user_group: + raise ControllerNotFoundError(f"User group '{user_group_id}' not found") + + if not user_group.is_updatable: + raise ControllerForbiddenError(f"User group '{user_group_id}' cannot be updated") + + return await users_repo.update_user_group(user_group_id, user_group_update) + + +@router.delete( + "/{user_group_id}", + status_code=status.HTTP_204_NO_CONTENT +) +async def delete_user_group( + user_group_id: UUID, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)), +) -> None: + """ + Delete an user group + """ + + user_group = await users_repo.get_user_group(user_group_id) + if not user_group: + raise ControllerNotFoundError(f"User group '{user_group_id}' not found") + + if not user_group.is_updatable: + raise ControllerForbiddenError(f"User group '{user_group_id}' cannot be deleted") + + success = await users_repo.delete_user_group(user_group_id) + if not success: + raise ControllerNotFoundError(f"User group '{user_group_id}' could not be deleted") + + +@router.get("/{user_group_id}/members", response_model=List[schemas.User]) +async def get_user_group_members( + user_group_id: UUID, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)) +) -> List[schemas.User]: + """ + Get all user group members. + """ + + return await users_repo.get_user_group_members(user_group_id) + + +@router.put( + "/{user_group_id}/members/{user_id}", + status_code=status.HTTP_204_NO_CONTENT +) +async def add_member_to_group( + user_group_id: UUID, + user_id: UUID, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)) +) -> None: + """ + Add member to an user group. + """ + + user = await users_repo.get_user(user_id) + if not user: + raise ControllerNotFoundError(f"User '{user_id}' not found") + + user_group = await users_repo.add_member_to_user_group(user_group_id, user) + if not user_group: + raise ControllerNotFoundError(f"User group '{user_group_id}' not found") + + +@router.delete( + "/{user_group_id}/members/{user_id}", + status_code=status.HTTP_204_NO_CONTENT +) +async def remove_member_from_group( + user_group_id: UUID, + user_id: UUID, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)), +) -> None: + """ + Remove member from an user group. + """ + + user = await users_repo.get_user(user_id) + if not user: + raise ControllerNotFoundError(f"User '{user_id}' not found") + + user_group = await users_repo.remove_member_from_user_group(user_group_id, user) + if not user_group: + raise ControllerNotFoundError(f"User group '{user_group_id}' not found") diff --git a/gns3server/api/routes/controller/nodes.py b/gns3server/api/routes/controller/nodes.py index 899e9a31..3016d84f 100644 --- a/gns3server/api/routes/controller/nodes.py +++ b/gns3server/api/routes/controller/nodes.py @@ -305,11 +305,11 @@ async def get_file(file_path: str, node: Node = Depends(dep_node)) -> Response: path = f"/project-files/{node_type}/{node.id}/{path}" res = await node.compute.http_query("GET", f"/projects/{node.project.id}/files{path}", timeout=None, raw=True) - return Response(res.body, media_type="application/octet-stream") + return Response(res.body, media_type="application/octet-stream", status_code=res.status) @router.post("/{node_id}/files/{file_path:path}", status_code=status.HTTP_201_CREATED) -async def post_file(file_path: str, request: Request, node: Node = Depends(dep_node)) -> dict: +async def post_file(file_path: str, request: Request, node: Node = Depends(dep_node)): """ Write a file in the node directory. """ @@ -324,8 +324,8 @@ async def post_file(file_path: str, request: Request, node: Node = Depends(dep_n path = f"/project-files/{node_type}/{node.id}/{path}" data = await request.body() # FIXME: are we handling timeout or large files correctly? - await node.compute.http_query("POST", f"/projects/{node.project.id}/files{path}", data=data, timeout=None, raw=True) + # FIXME: response with correct status code (from compute) @router.websocket("/{node_id}/console/ws") diff --git a/gns3server/api/routes/controller/notifications.py b/gns3server/api/routes/controller/notifications.py index 3634a7d4..79e99328 100644 --- a/gns3server/api/routes/controller/notifications.py +++ b/gns3server/api/routes/controller/notifications.py @@ -18,12 +18,15 @@ API routes for controller notifications. """ -from fastapi import APIRouter, WebSocket, WebSocketDisconnect +from fastapi import APIRouter, Depends, Query, WebSocket, WebSocketDisconnect, HTTPException from fastapi.responses import StreamingResponse from websockets.exceptions import ConnectionClosed, WebSocketException +from gns3server.services import auth_service from gns3server.controller import Controller +from .dependencies.authentication import get_current_active_user + import logging log = logging.getLogger(__name__) @@ -31,7 +34,7 @@ log = logging.getLogger(__name__) router = APIRouter() -@router.get("") +@router.get("", dependencies=[Depends(get_current_active_user)]) async def http_notification() -> StreamingResponse: """ Receive controller notifications about the controller from HTTP stream. @@ -41,18 +44,26 @@ async def http_notification() -> StreamingResponse: with Controller.instance().notification.controller_queue() as queue: while True: msg = await queue.get_json(5) - yield (f"{msg}\n").encode("utf-8") + yield f"{msg}\n".encode("utf-8") return StreamingResponse(event_stream(), media_type="application/json") @router.websocket("/ws") -async def notification_ws(websocket: WebSocket) -> None: +async def notification_ws(websocket: WebSocket, token: str = Query(None)) -> None: """ Receive project notifications about the controller from WebSocket. """ - await websocket.accept() + + if token: + try: + username = auth_service.get_username_from_token(token) + except HTTPException: + log.error("Invalid token received") + await websocket.close(code=1008) + return + log.info(f"New client {websocket.client.host}:{websocket.client.port} has connected to controller WebSocket") try: with Controller.instance().notification.controller_queue() as queue: diff --git a/gns3server/api/routes/controller/projects.py b/gns3server/api/routes/controller/projects.py index c8936f5f..5e8022c8 100644 --- a/gns3server/api/routes/controller/projects.py +++ b/gns3server/api/routes/controller/projects.py @@ -24,6 +24,7 @@ import tempfile import zipfile import aiofiles import time +import urllib.parse import logging @@ -44,6 +45,7 @@ from gns3server.controller.controller_error import ControllerError, ControllerFo from gns3server.controller.import_project import import_project as import_controller_project from gns3server.controller.export_project import export_project as export_controller_project from gns3server.utils.asyncio import aiozipstream +from gns3server.utils.path import is_safe_path from gns3server.config import Config responses = {404: {"model": schemas.ErrorMessage, "description": "Could not find project"}} @@ -368,10 +370,11 @@ async def get_file(file_path: str, project: Project = Depends(dep_project)) -> F Return a file from a project. """ - path = os.path.normpath(file_path).strip("/") + file_path = urllib.parse.unquote(file_path) + path = os.path.normpath(file_path) # Raise error if user try to escape - if path[0] == ".": + if not is_safe_path(path, project.path): raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) path = os.path.join(project.path, path) @@ -387,10 +390,11 @@ async def write_file(file_path: str, request: Request, project: Project = Depend Write a file from a project. """ - path = os.path.normpath(file_path).strip("/") + file_path = urllib.parse.unquote(file_path) + path = os.path.normpath(file_path) # Raise error if user try to escape - if path[0] == ".": + if not is_safe_path(path, project.path): raise HTTPException(status_code=status.HTTP_403_FORBIDDEN) path = os.path.join(project.path, path) diff --git a/gns3server/api/routes/controller/templates.py b/gns3server/api/routes/controller/templates.py index bb2c5ae9..ee54fdc7 100644 --- a/gns3server/api/routes/controller/templates.py +++ b/gns3server/api/routes/controller/templates.py @@ -139,7 +139,7 @@ async def create_node_from_template( Create a new node from a template. """ - template = TemplatesService(templates_repo).get_template(template_id) + template = await TemplatesService(templates_repo).get_template(template_id) controller = Controller.instance() project = controller.get_project(str(project_id)) node = await project.add_node_from_template( diff --git a/gns3server/api/routes/controller/users.py b/gns3server/api/routes/controller/users.py index c830c8b5..e3fc578e 100644 --- a/gns3server/api/routes/controller/users.py +++ b/gns3server/api/routes/controller/users.py @@ -153,22 +153,29 @@ async def update_user( return user -@router.delete("/{user_id}", status_code=status.HTTP_204_NO_CONTENT) +@router.delete( + "/{user_id}", + dependencies=[Depends(get_current_active_user)], + status_code=status.HTTP_204_NO_CONTENT +) async def delete_user( user_id: UUID, users_repo: UsersRepository = Depends(get_repository(UsersRepository)), - current_user: schemas.User = Depends(get_current_active_user), ) -> None: """ Delete an user. """ - if current_user.is_superadmin: + user = await users_repo.get_user(user_id) + if not user: + raise ControllerNotFoundError(f"User '{user_id}' not found") + + if user.is_superadmin: raise ControllerForbiddenError("The super admin cannot be deleted") success = await users_repo.delete_user(user_id) if not success: - raise ControllerNotFoundError(f"User '{user_id}' not found") + raise ControllerNotFoundError(f"User '{user_id}' could not be deleted") @router.get("/me/", response_model=schemas.User) @@ -178,3 +185,19 @@ async def get_current_active_user(current_user: schemas.User = Depends(get_curre """ return current_user + + +@router.get( + "/{user_id}/groups", + dependencies=[Depends(get_current_active_user)], + response_model=List[schemas.UserGroup] +) +async def get_user_memberships( + user_id: UUID, + users_repo: UsersRepository = Depends(get_repository(UsersRepository)) +) -> List[schemas.UserGroup]: + """ + Get user memberships. + """ + + return await users_repo.get_user_memberships(user_id) diff --git a/gns3server/api/server.py b/gns3server/api/server.py index da948299..1529c065 100644 --- a/gns3server/api/server.py +++ b/gns3server/api/server.py @@ -25,6 +25,7 @@ from fastapi import FastAPI, Request from starlette.exceptions import HTTPException as StarletteHTTPException from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import JSONResponse +from sqlalchemy.exc import SQLAlchemyError from uvicorn.main import Server as UvicornServer from gns3server.controller.controller_error import ( @@ -55,6 +56,8 @@ def get_application() -> FastAPI: origins = [ "http://127.0.0.1", "http://localhost", + "http://localhost:4200", + "http://127.0.0.1:4200" "http://127.0.0.1:8080", "http://localhost:8080", "http://127.0.0.1:3080", @@ -158,6 +161,15 @@ async def http_exception_handler(request: Request, exc: StarletteHTTPException): ) +@app.exception_handler(SQLAlchemyError) +async def sqlalchemry_error_handler(request: Request, exc: SQLAlchemyError): + log.error(f"Controller database error: {exc}") + return JSONResponse( + status_code=500, + content={"message": "Database error detected, please check logs to find details"}, + ) + + @app.middleware("http") async def add_extra_headers(request: Request, call_next): start_time = time.time() diff --git a/gns3server/appliances/arista-veos.gns3a b/gns3server/appliances/arista-veos.gns3a index ea6a5aeb..7d49517e 100644 --- a/gns3server/appliances/arista-veos.gns3a +++ b/gns3server/appliances/arista-veos.gns3a @@ -27,10 +27,10 @@ }, "images": [ { - "filename": "vEOS-lab-4.25.0F.vmdk", - "version": "4.25.0F", - "md5sum": "d420763fdf3bc50e7e5b88418bd9d1fd", - "filesize": 468779008, + "filename": "vEOS-lab-4.25.3M.vmdk", + "version": "4.25.3M", + "md5sum": "2f196969036b4d283e86f15118d59c26", + "filesize": 451543040, "download_url": "https://www.arista.com/en/support/software-download" }, { @@ -211,10 +211,10 @@ ], "versions": [ { - "name": "4.25.0F", + "name": "4.25.3M", "images": { "hda_disk_image": "Aboot-veos-serial-8.0.0.iso", - "hdb_disk_image": "vEOS-lab-4.25.0F.vmdk" + "hdb_disk_image": "vEOS-lab-4.25.3M.vmdk" } }, { diff --git a/gns3server/appliances/cisco-c8000v.gns3a b/gns3server/appliances/cisco-c8000v.gns3a new file mode 100644 index 00000000..d10c4a58 --- /dev/null +++ b/gns3server/appliances/cisco-c8000v.gns3a @@ -0,0 +1,55 @@ +{ + "name": "Cisco Catalyst 8000V", + "category": "router", + "description": "The Cisco Catalyst 8000V Edge Software is a virtual, form-factor router deployed on a virtual machine (VM) running on an x86 server hardware.", + "vendor_name": "Cisco", + "vendor_url": "http://www.cisco.com/", + "documentation_url": "https://www.cisco.com/c/en/us/td/docs/routers/C8000V/Configuration/c8000v-installation-configuration-guide.html", + "product_name": "c8000v", + "product_url": "https://www.cisco.com/c/en/us/support/routers/catalyst-8000v-edge-software/series.html", + "registry_version": 3, + "status": "stable", + "maintainer": "GNS3 Team", + "maintainer_email": "developers@gns3.net", + "usage": "There is no default password and enable password. A default configuration is present.", + "port_name_format": "Gi{port1}", + "qemu": { + "adapter_type": "vmxnet3", + "adapters": 4, + "ram": 4096, + "hda_disk_interface": "ide", + "arch": "x86_64", + "console_type": "telnet", + "kvm": "require" + }, + "images": [ + { + "filename": "c8000v-universalk9_8G_serial.17.04.01a.qcow2", + "version": "17.04.01a 8G", + "md5sum": "5c1dd1d3757ea43b5b02e0af7a010525", + "filesize": 1623130112, + "download_url": "https://software.cisco.com/download/home/286327102/type/282046477/release/Bengaluru-17.4.1a" + }, + { + "filename": "c8000v-universalk9_8G_serial.17.04.01b.qcow2", + "version": "17.04.01b 8G", + "md5sum": "84aebb7f5f38bdd4df8e7607643027be", + "filesize": 1623130112, + "download_url": "https://software.cisco.com/download/home/286327102/type/282046477/release/Bengaluru-17.4.1b" + } + ], + "versions": [ + { + "name": "17.04.01a 8G", + "images": { + "hda_disk_image": "c8000v-universalk9_8G_serial.17.04.01a.qcow2" + } + }, + { + "name": "17.04.01b 8G", + "images": { + "hda_disk_image": "c8000v-universalk9_8G_serial.17.04.01b.qcow2" + } + } + ] +} diff --git a/gns3server/appliances/cisco-nxosv9k.gns3a b/gns3server/appliances/cisco-nxosv9k.gns3a index 5fde4058..ae3c6e84 100644 --- a/gns3server/appliances/cisco-nxosv9k.gns3a +++ b/gns3server/appliances/cisco-nxosv9k.gns3a @@ -25,6 +25,20 @@ "kvm": "require" }, "images": [ + { + "filename": "nexus9500v64.10.1.1.qcow2", + "version": "9500v 10.1.1", + "md5sum": "35672370b0f43e725d5b2d92488524f0", + "filesize": 1592000512, + "download_url": "https://software.cisco.com/download/home/286312239/type/282088129/release/10.1(1)" + }, + { + "filename": "nexus9500v.9.3.7.qcow2", + "version": "9500v 9.3.7", + "md5sum": "65f669e0dd379a05a8cdbb9d7592a064", + "filesize": 1986068480, + "download_url": "https://software.cisco.com/download/home/286312239/type/282088129/release/9.3(7)" + }, { "filename": "nexus9500v.9.3.3.qcow2", "version": "9500v 9.3.3", @@ -148,6 +162,20 @@ } ], "versions": [ + { + "name": "9500v 10.1.1", + "images": { + "bios_image": "OVMF-20160813.fd", + "hda_disk_image": "nexus9500v64.10.1.1.qcow2" + } + }, + { + "name": "9500v 9.3.7", + "images": { + "bios_image": "OVMF-20160813.fd", + "hda_disk_image": "nexus9500v.9.3.7.qcow2" + } + }, { "name": "9500v 9.3.3", "images": { diff --git a/gns3server/appliances/danos.gns3a b/gns3server/appliances/danos.gns3a index 8739db48..bb9ed3d3 100644 --- a/gns3server/appliances/danos.gns3a +++ b/gns3server/appliances/danos.gns3a @@ -11,29 +11,29 @@ "status": "stable", "maintainer": "GNS3 Team", "maintainer_email": "developers@gns3.net", - "usage": "Default username/password is vyatta/vyatta. DANOS will live boot and drop into a shell. DANOS can then be installed inside the VM by typing install image. Defaults to using a telnet console, but the vnc console can provide additional help if it's not booting.", + "usage": "Default username / password is tmpuser / tmppwd. DANOS will live boot and drop into a shell. DANOS can then be installed inside the VM by typing install image. Defaults to using a telnet console, but the vnc console can provide additional help if it's not booting.", "symbol": ":/symbols/affinity/circle/gray/router_cloud.svg", - "port_name_format": "dp0p{1}s{0}", + "port_name_format": "dp0s{3}", "qemu": { "adapter_type": "virtio-net-pci", - "adapters": 3, + "adapters": 8, "ram": 4096, - "cpus": 2, + "cpus": 4, "hda_disk_interface": "ide", "arch": "x86_64", "console_type": "telnet", - "boot_priority": "dc", - "kvm": "allow", + "boot_priority": "cd", + "kvm": "require", "options": "-cpu host" }, "images": [ { - "filename": "danos-1908-amd64-vrouter.iso", - "version": "1908", - "md5sum": "e850b6aa2859de1075c11b9149fa50f4", - "filesize": 409993216, - "download_url": "https://danosproject.atlassian.net/wiki/spaces/DAN/pages/753667/DANOS+1908", - "direct_download_url": "http://repos.danosproject.org.s3-website-us-west-1.amazonaws.com/images/danos-1908-amd64-vrouter.iso" + "filename": "danos-2012-base-amd64.iso", + "version": "2012", + "md5sum": "fb7a60dc9afecdb274464832b3ab1ccb", + "filesize": 441450496, + "download_url": "https://danosproject.atlassian.net/wiki/spaces/DAN/pages/892141595/DANOS+2012", + "direct_download_url": "https://s3-us-west-1.amazonaws.com/2012.repos.danosproject.org/2012/iso/danos-2012-base-amd64.iso" }, { "filename": "empty8G.qcow2", @@ -46,10 +46,10 @@ ], "versions": [ { - "name": "1908", + "name": "2012", "images": { "hda_disk_image": "empty8G.qcow2", - "cdrom_image": "danos-1908-amd64-vrouter.iso" + "cdrom_image": "danos-2012-base-amd64.iso" } } ] diff --git a/gns3server/appliances/kali-linux.gns3a b/gns3server/appliances/kali-linux.gns3a index 2661c8a5..06288bd7 100644 --- a/gns3server/appliances/kali-linux.gns3a +++ b/gns3server/appliances/kali-linux.gns3a @@ -28,96 +28,96 @@ "version": "2019.3", "md5sum": "9c6fb00558f78ed06992d89f745ef975", "filesize": 3037736960, - "download_url": "https://www.kali.org/downloads/", - "direct_download_url": "http://cdimage.kali.org/kali-2019.3/kali-linux-2019.3-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2019.3", + "direct_download_url": "http://old.kali.org/kali-images/kali-2019.3/kali-linux-2019.3-amd64.iso" }, { "filename": "kali-linux-2019.2-amd64.iso", "version": "2019.2", "md5sum": "0f89b6225d7ea9c18682f7cc541c1179", "filesize": 3353227264, - "download_url": "https://www.kali.org/downloads/", - "direct_download_url": "http://cdimage.kali.org/kali-2019.2/kali-linux-2019.2-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2019.2", + "direct_download_url": "http://old.kali.org/kali-images/kali-2019.2/kali-linux-2019.2-amd64.iso" }, { "filename": "kali-linux-mate-2019.2-amd64.iso", "version": "2019.2 (MATE)", "md5sum": "fec8dd7009f932c51a74323df965a709", "filesize": 3313217536, - "download_url": "https://www.kali.org/downloads/", - "direct_download_url": "http://cdimage.kali.org/kali-2019.2/kali-linux-mate-2019.2-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2019.2", + "direct_download_url": "http://old.kali.org/kali-images/kali-2019.2/kali-linux-mate-2019.2-amd64.iso" }, { "filename": "kali-linux-2019.1a-amd64.iso", "version": "2019.1a", "md5sum": "58c6111ed0be1919ea87267e7e65ab0f", "filesize": 3483873280, - "download_url": "https://www.kali.org/downloads/", - "direct_download_url": "http://cdimage.kali.org/kali-2019.1a/kali-linux-2019.1a-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2019.1a", + "direct_download_url": "http://old.kali.org/kali-images/kali-2019.1a/kali-linux-2019.1a-amd64.iso" }, { "filename": "kali-linux-2018.4-amd64.iso", "version": "2018.4", "md5sum": "1b2d598bb8d2003e6207c119c0ba42fe", "filesize": 3139436544, - "download_url": "https://www.kali.org/downloads/", - "direct_download_url": "http://cdimage.kali.org/kali-2018.4/kali-linux-2018.4-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2018.4", + "direct_download_url": "http://old.kali.org/kali-images/kali-2018.4/kali-linux-2018.4-amd64.iso" }, { "filename": "kali-linux-2018.3a-amd64.iso", "version": "2018.3a", "md5sum": "2da675d016bd690c05e180e33aa98b94", "filesize": 3192651776, - "download_url": "https://www.kali.org/downloads/", - "direct_download_url": "http://cdimage.kali.org/kali-2018.3a/kali-linux-2018.3a-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2018.3a", + "direct_download_url": "http://old.kali.org/kali-images/kali-2018.3a/kali-linux-2018.3a-amd64.iso" }, { "filename": "kali-linux-2018.1-amd64.iso", "version": "2018.1", "md5sum": "a3feb90df5b71b3c7f4a02bdddf221d7", "filesize": 3028500480, - "download_url": "https://www.kali.org/downloads/", - "direct_download_url": "http://cdimage.kali.org/kali-2018.1/kali-linux-2018.1-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2018.1", + "direct_download_url": "http://old.kali.org/kali-images/kali-2018.1/kali-linux-2018.1-amd64.iso" }, { "filename": "kali-linux-2017.3-amd64.iso", "version": "2017.3", "md5sum": "b465580c897e94675ac1daf031fa66b9", "filesize": 2886402048, - "download_url": "http://cdimage.kali.org/kali-2017.3/", - "direct_download_url": "http://cdimage.kali.org/kali-2017.3/kali-linux-2017.3-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2017.3/", + "direct_download_url": "http://old.kali.org/kali-images/kali-2017.3/kali-linux-2017.3-amd64.iso" }, { "filename": "kali-linux-2017.2-amd64.iso", "version": "2017.2", "md5sum": "541654f8f818450dc0db866a0a0f6eec", "filesize": 3020619776, - "download_url": "http://cdimage.kali.org/kali-2017.2/", - "direct_download_url": "http://cdimage.kali.org/kali-2017.2/kali-linux-2017.2-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2017.2/", + "direct_download_url": "http://old.kali.org/kali-images/kali-2017.2/kali-linux-2017.2-amd64.iso" }, { "filename": "kali-linux-2017.1-amd64.iso", "version": "2017.1", "md5sum": "c8e742283929d7a12dbe7c58e398ff08", "filesize": 2794307584, - "download_url": "http://cdimage.kali.org/kali-2017.1/", - "direct_download_url": "http://cdimage.kali.org/kali-2017.1/kali-linux-2017.1-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2017.1/", + "direct_download_url": "http://old.kali.org/kali-images/kali-2017.1/kali-linux-2017.1-amd64.iso" }, { "filename": "kali-linux-2016.2-amd64.iso", "version": "2016.2", "md5sum": "3d163746bc5148e61ad689d94bc263f9", "filesize": 3076767744, - "download_url": "http://cdimage.kali.org/kali-2016.2/", - "direct_download_url": "http://cdimage.kali.org/kali-2016.2/kali-linux-2016.2-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2016.2/", + "direct_download_url": "http://old.kali.org/kali-images/kali-2016.2/kali-linux-2016.2-amd64.iso" }, { "filename": "kali-linux-2016.1-amd64.iso", "version": "2016.1", "md5sum": "2e1230dc14036935b3279dfe3e49ad39", "filesize": 2945482752, - "download_url": "http://cdimage.kali.org/kali-2016.1/", - "direct_download_url": "http://cdimage.kali.org/kali-2016.1/kali-linux-2016.1-amd64.iso" + "download_url": "http://old.kali.org/kali-images/kali-2016.1/", + "direct_download_url": "http://old.kali.org/kali-images/kali-2016.1/kali-linux-2016.1-amd64.iso" }, { "filename": "kali-linux-2.0-amd64.iso", diff --git a/gns3server/appliances/mcjoin.gns3a b/gns3server/appliances/mcjoin.gns3a new file mode 100644 index 00000000..74515a34 --- /dev/null +++ b/gns3server/appliances/mcjoin.gns3a @@ -0,0 +1,18 @@ +{ + "name": "mcjoin", + "category": "guest", + "description": "mcjoin is a very simple and easy-to-use tool to test IPv4 and IPv6 multicast.", + "vendor_name": "Joachim Nilsson", + "vendor_url": "https://github.com/troglobit", + "product_name": "mcjoin", + "registry_version": 3, + "status": "stable", + "maintainer": "GNS3 Team", + "maintainer_email": "developers@gns3.net", + "symbol": "linux_guest.svg", + "docker": { + "adapters": 1, + "image": "troglobit/mcjoin:latest", + "console_type": "telnet" + } +} diff --git a/gns3server/appliances/openbsd.gns3a b/gns3server/appliances/openbsd.gns3a index 71c7a3ce..87bd0738 100644 --- a/gns3server/appliances/openbsd.gns3a +++ b/gns3server/appliances/openbsd.gns3a @@ -11,7 +11,7 @@ "maintainer": "GNS3 Team", "maintainer_email": "developers@gns3.net", "usage": "User root, password gns3", - "first_port_name": "fxp0", + "first_port_name": "em0", "port_name_format": "em{0}", "qemu": { "adapter_type": "e1000", diff --git a/gns3server/compute/base_manager.py b/gns3server/compute/base_manager.py index 57c7e252..82f206d9 100644 --- a/gns3server/compute/base_manager.py +++ b/gns3server/compute/base_manager.py @@ -417,7 +417,7 @@ class BaseManager: if not path or path == ".": return "" - orig_path = path + orig_path = os.path.normpath(path) img_directory = self.get_images_directory() valid_directory_prefices = images_directories(self._NODE_TYPE) @@ -431,7 +431,8 @@ class BaseManager: f"'{path}' is not allowed on this remote server. Please only use a file from '{img_directory}'" ) - if not os.path.isabs(path): + if not os.path.isabs(orig_path): + for directory in valid_directory_prefices: log.debug(f"Searching for image '{orig_path}' in '{directory}'") path = self._recursive_search_file_in_directory(directory, orig_path) @@ -475,7 +476,7 @@ class BaseManager: for root, dirs, files in os.walk(directory): for file in files: # If filename is the same - if s[1] == file and (s[0] == "" or s[0] == os.path.basename(root)): + if s[1] == file and (s[0] == '' or os.path.basename(s[0]) == os.path.basename(root)): path = os.path.normpath(os.path.join(root, s[1])) if os.path.exists(path): return path diff --git a/gns3server/config.py b/gns3server/config.py index 022a3ce1..3388ed97 100644 --- a/gns3server/config.py +++ b/gns3server/config.py @@ -153,8 +153,6 @@ class Config: Return the settings. """ - if self._settings is None: - return ServerConfig() return self._settings def listen_for_config_changes(self, callback): @@ -273,6 +271,7 @@ class Config: return if not parsed_files: log.warning("No configuration file could be found or read") + self._settings = ServerConfig() return for file in parsed_files: diff --git a/gns3server/controller/__init__.py b/gns3server/controller/__init__.py index 2774dd0f..22be7f8d 100644 --- a/gns3server/controller/__init__.py +++ b/gns3server/controller/__init__.py @@ -17,7 +17,6 @@ import os import sys -import json import uuid import socket import shutil @@ -30,7 +29,6 @@ from .appliance_manager import ApplianceManager from .compute import Compute, ComputeError from .notification import Notification from .symbols import Symbols -from ..version import __version__ from .topology import load_topology from .gns3vm import GNS3VM from ..utils.get_resource import get_resource @@ -205,7 +203,7 @@ class Controller: if iou_config.iourc_path: iourc_path = iou_config.iourc_path else: - os.makedirs(os.path.dirname(server_config.secrets_dir), exist_ok=True) + os.makedirs(server_config.secrets_dir, exist_ok=True) iourc_path = os.path.join(server_config.secrets_dir, "gns3_iourc_license") try: @@ -215,9 +213,17 @@ class Controller: except OSError as e: log.error(f"Cannot write IOU license file '{iourc_path}': {e}") - # if self._appliance_manager.appliances_etag: - # config._config.set("Controller", "appliances_etag", self._appliance_manager.appliances_etag) - # config.write_config() + if self._appliance_manager.appliances_etag: + etag_directory = os.path.dirname(Config.instance().server_config) + os.makedirs(etag_directory, exist_ok=True) + etag_appliances_path = os.path.join(etag_directory, "gns3_appliances_etag") + + try: + with open(etag_appliances_path, "w+") as f: + f.write(self._appliance_manager.appliances_etag) + log.info(f"etag appliances file '{etag_appliances_path}' saved") + except OSError as e: + log.error(f"Cannot write Etag appliance file '{etag_appliances_path}': {e}") def _load_controller_settings(self): """ @@ -263,8 +269,19 @@ class Controller: log.error(f"Cannot read IOU license file '{iourc_path}': {e}") self._iou_license_settings["license_check"] = iou_config.license_check - # self._appliance_manager.appliances_etag = controller_config.get("appliances_etag", None) - # self._appliance_manager.load_appliances() + + etag_directory = os.path.dirname(Config.instance().server_config) + etag_appliances_path = os.path.join(etag_directory, "gns3_appliances_etag") + self._appliance_manager.appliances_etag = None + if os.path.exists(etag_appliances_path): + try: + with open(etag_appliances_path) as f: + self._appliance_manager.appliances_etag = f.read() + log.info(f"etag appliances file '{etag_appliances_path}' loaded") + except OSError as e: + log.error(f"Cannot read Etag appliance file '{etag_appliances_path}': {e}") + + self._appliance_manager.load_appliances() self._config_loaded = True async def load_projects(self): diff --git a/gns3server/controller/compute.py b/gns3server/controller/compute.py index ebe969b7..e3c1cca5 100644 --- a/gns3server/controller/compute.py +++ b/gns3server/controller/compute.py @@ -487,7 +487,7 @@ class Compute: # Try to reconnect after 1 second if server unavailable only if not during tests (otherwise we create a ressources usage bomb) from gns3server.api.server import app - if not app.state.exiting and not hasattr(sys, "_called_from_test") or not sys._called_from_test: + if not app.state.exiting and not hasattr(sys, "_called_from_test"): log.info(f"Reconnecting to to compute '{self._id}' WebSocket '{ws_url}'") asyncio.get_event_loop().call_later(1, lambda: asyncio.ensure_future(self.connect())) diff --git a/gns3server/controller/topology.py b/gns3server/controller/topology.py index 80f63129..3b1f4473 100644 --- a/gns3server/controller/topology.py +++ b/gns3server/controller/topology.py @@ -50,7 +50,7 @@ class DynamipsNodeValidation(DynamipsCreate): name: Optional[str] = None -def _check_topology_schema(topo): +def _check_topology_schema(topo, path): try: Topology.parse_obj(topo) @@ -60,7 +60,7 @@ def _check_topology_schema(topo): DynamipsNodeValidation.parse_obj(node.get("properties", {})) except pydantic.ValidationError as e: - error = f"Invalid data in topology file: {e}" + error = f"Invalid data in topology file {path}: {e}" log.critical(error) raise ControllerError(error) @@ -117,7 +117,7 @@ def project_to_topology(project): data["topology"]["computes"].append(compute) elif isinstance(compute, dict): data["topology"]["computes"].append(compute) - _check_topology_schema(data) + _check_topology_schema(data, project.path) return data @@ -187,7 +187,7 @@ def load_topology(path): topo["variables"] = [var for var in variables if var.get("name")] try: - _check_topology_schema(topo) + _check_topology_schema(topo, path) except ControllerError as e: log.error("Can't load the topology %s", path) raise e diff --git a/gns3server/crash_report.py b/gns3server/crash_report.py index 012806e6..8c48494f 100644 --- a/gns3server/crash_report.py +++ b/gns3server/crash_report.py @@ -59,7 +59,7 @@ class CrashReport: Report crash to a third party service """ - DSN = "https://d8001b95f4f244fe82ea720c9d4f0c09:690d4fe9fe3b4aa9aab004bc9e76cb8a@o19455.ingest.sentry.io/38482" + DSN = "https://ccd9829f1391432c900aa835e7eb1050:83d10f4d74654e2b8428129a62cf31cf@o19455.ingest.sentry.io/38482" _instance = None def __init__(self): diff --git a/gns3server/db/models/__init__.py b/gns3server/db/models/__init__.py index 71ead9d8..1c644f72 100644 --- a/gns3server/db/models/__init__.py +++ b/gns3server/db/models/__init__.py @@ -16,7 +16,7 @@ # along with this program. If not, see . from .base import Base -from .users import User +from .users import User, UserGroup from .computes import Compute from .templates import ( Template, diff --git a/gns3server/db/models/base.py b/gns3server/db/models/base.py index 17c68f76..1dbae1af 100644 --- a/gns3server/db/models/base.py +++ b/gns3server/db/models/base.py @@ -43,6 +43,7 @@ class GUID(TypeDecorator): """ impl = CHAR + cache_ok = True def load_dialect_impl(self, dialect): if dialect.name == "postgresql": @@ -75,8 +76,8 @@ class BaseTable(Base): __abstract__ = True - created_at = Column(DateTime, default=func.current_timestamp()) - updated_at = Column(DateTime, default=func.current_timestamp(), onupdate=func.current_timestamp()) + created_at = Column(DateTime, server_default=func.current_timestamp()) + updated_at = Column(DateTime, server_default=func.current_timestamp(), onupdate=func.current_timestamp()) def generate_uuid(): diff --git a/gns3server/db/models/templates.py b/gns3server/db/models/templates.py index e39e0695..470b88cb 100644 --- a/gns3server/db/models/templates.py +++ b/gns3server/db/models/templates.py @@ -45,7 +45,7 @@ class CloudTemplate(Template): __tablename__ = "cloud_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) ports_mapping = Column(PickleType) remote_console_host = Column(String) remote_console_port = Column(Integer) @@ -59,7 +59,7 @@ class DockerTemplate(Template): __tablename__ = "docker_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) image = Column(String) adapters = Column(Integer) start_command = Column(String) @@ -83,7 +83,7 @@ class DynamipsTemplate(Template): __tablename__ = "dynamips_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) platform = Column(String) chassis = Column(String) image = Column(String) @@ -126,7 +126,7 @@ class EthernetHubTemplate(Template): __tablename__ = "ethernet_hub_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) ports_mapping = Column(PickleType) __mapper_args__ = {"polymorphic_identity": "ethernet_hub", "polymorphic_load": "selectin"} @@ -136,7 +136,7 @@ class EthernetSwitchTemplate(Template): __tablename__ = "ethernet_switch_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) ports_mapping = Column(PickleType) console_type = Column(String) @@ -147,7 +147,7 @@ class IOUTemplate(Template): __tablename__ = "iou_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) path = Column(String) ethernet_adapters = Column(Integer) serial_adapters = Column(Integer) @@ -167,7 +167,7 @@ class QemuTemplate(Template): __tablename__ = "qemu_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) qemu_path = Column(String) platform = Column(String) linked_clone = Column(Boolean) @@ -213,7 +213,7 @@ class VirtualBoxTemplate(Template): __tablename__ = "virtualbox_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) vmname = Column(String) ram = Column(Integer) linked_clone = Column(Boolean) @@ -236,7 +236,7 @@ class VMwareTemplate(Template): __tablename__ = "vmware_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) vmx_path = Column(String) linked_clone = Column(Boolean) first_port_name = Column(String) @@ -258,7 +258,7 @@ class VPCSTemplate(Template): __tablename__ = "vpcs_templates" - template_id = Column(GUID, ForeignKey("templates.template_id"), primary_key=True) + template_id = Column(GUID, ForeignKey("templates.template_id", ondelete="CASCADE"), primary_key=True) base_script_file = Column(String) console_type = Column(String) console_auto_start = Column(Boolean, default=False) diff --git a/gns3server/db/models/users.py b/gns3server/db/models/users.py index 6f9400ba..046ec5c4 100644 --- a/gns3server/db/models/users.py +++ b/gns3server/db/models/users.py @@ -15,15 +15,24 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -from sqlalchemy import Boolean, Column, String, event +from sqlalchemy import Table, Boolean, Column, String, ForeignKey, event +from sqlalchemy.orm import relationship -from .base import BaseTable, generate_uuid, GUID +from .base import Base, BaseTable, generate_uuid, GUID +from gns3server.config import Config from gns3server.services import auth_service import logging log = logging.getLogger(__name__) +users_group_members = Table( + "users_group_members", + Base.metadata, + Column("user_id", GUID, ForeignKey("users.user_id", ondelete="CASCADE")), + Column("user_group_id", GUID, ForeignKey("users_group.user_group_id", ondelete="CASCADE")) +) + class User(BaseTable): @@ -36,14 +45,18 @@ class User(BaseTable): hashed_password = Column(String) is_active = Column(Boolean, default=True) is_superadmin = Column(Boolean, default=False) + groups = relationship("UserGroup", secondary=users_group_members, back_populates="users") @event.listens_for(User.__table__, 'after_create') def create_default_super_admin(target, connection, **kw): - hashed_password = auth_service.hash_password("admin") + config = Config.instance().settings + default_admin_username = config.Server.default_admin_username + default_admin_password = config.Server.default_admin_password.get_secret_value() + hashed_password = auth_service.hash_password(default_admin_password) stmt = target.insert().values( - username="admin", + username=default_admin_username, full_name="Super Administrator", hashed_password=hashed_password, is_superadmin=True @@ -51,3 +64,46 @@ def create_default_super_admin(target, connection, **kw): connection.execute(stmt) connection.commit() log.info("The default super admin account has been created in the database") + + +class UserGroup(BaseTable): + + __tablename__ = "users_group" + + user_group_id = Column(GUID, primary_key=True, default=generate_uuid) + name = Column(String, unique=True, index=True) + is_updatable = Column(Boolean, default=True) + users = relationship("User", secondary=users_group_members, back_populates="groups") + + +@event.listens_for(UserGroup.__table__, 'after_create') +def create_default_user_groups(target, connection, **kw): + + default_groups = [ + {"name": "Administrators", "is_updatable": False}, + {"name": "Editors", "is_updatable": False}, + {"name": "Users", "is_updatable": False} + ] + + stmt = target.insert().values(default_groups) + connection.execute(stmt) + connection.commit() + log.info("The default user groups have been created in the database") + + +@event.listens_for(users_group_members, 'after_create') +def add_admin_to_group(target, connection, **kw): + + users_group_table = UserGroup.__table__ + stmt = users_group_table.select().where(users_group_table.c.name == "Administrators") + result = connection.execute(stmt) + user_group_id = result.first().user_group_id + + users_table = User.__table__ + stmt = users_table.select().where(users_table.c.is_superadmin.is_(True)) + result = connection.execute(stmt) + user_id = result.first().user_id + + stmt = target.insert().values(user_id=user_id, user_group_id=user_group_id) + connection.execute(stmt) + connection.commit() diff --git a/gns3server/db/repositories/users.py b/gns3server/db/repositories/users.py index 96576cfc..c93c741e 100644 --- a/gns3server/db/repositories/users.py +++ b/gns3server/db/repositories/users.py @@ -16,9 +16,10 @@ # along with this program. If not, see . from uuid import UUID -from typing import Optional, List +from typing import Optional, List, Union from sqlalchemy import select, update, delete from sqlalchemy.ext.asyncio import AsyncSession +from sqlalchemy.orm import selectinload from .base import BaseRepository @@ -107,3 +108,105 @@ class UsersRepository(BaseRepository): if not self._auth_service.verify_password(password, user.hashed_password): return None return user + + async def get_user_memberships(self, user_id: UUID) -> List[models.UserGroup]: + + query = select(models.UserGroup).\ + join(models.UserGroup.users).\ + filter(models.User.user_id == user_id) + + result = await self._db_session.execute(query) + return result.scalars().all() + + async def get_user_group(self, user_group_id: UUID) -> Optional[models.UserGroup]: + + query = select(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id) + result = await self._db_session.execute(query) + return result.scalars().first() + + async def get_user_group_by_name(self, name: str) -> Optional[models.UserGroup]: + + query = select(models.UserGroup).where(models.UserGroup.name == name) + result = await self._db_session.execute(query) + return result.scalars().first() + + async def get_user_groups(self) -> List[models.UserGroup]: + + query = select(models.UserGroup) + result = await self._db_session.execute(query) + return result.scalars().all() + + async def create_user_group(self, user_group: schemas.UserGroupCreate) -> models.UserGroup: + + db_user_group = models.UserGroup(name=user_group.name) + self._db_session.add(db_user_group) + await self._db_session.commit() + await self._db_session.refresh(db_user_group) + return db_user_group + + async def update_user_group( + self, + user_group_id: UUID, + user_group_update: schemas.UserGroupUpdate + ) -> Optional[models.UserGroup]: + + update_values = user_group_update.dict(exclude_unset=True) + query = update(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id).values(update_values) + + await self._db_session.execute(query) + await self._db_session.commit() + return await self.get_user_group(user_group_id) + + async def delete_user_group(self, user_group_id: UUID) -> bool: + + query = delete(models.UserGroup).where(models.UserGroup.user_group_id == user_group_id) + result = await self._db_session.execute(query) + await self._db_session.commit() + return result.rowcount > 0 + + async def add_member_to_user_group( + self, + user_group_id: UUID, + user: models.User + ) -> Union[None, models.UserGroup]: + + query = select(models.UserGroup).\ + options(selectinload(models.UserGroup.users)).\ + where(models.UserGroup.user_group_id == user_group_id) + result = await self._db_session.execute(query) + user_group_db = result.scalars().first() + if not user_group_db: + return None + + user_group_db.users.append(user) + await self._db_session.commit() + await self._db_session.refresh(user_group_db) + return user_group_db + + async def remove_member_from_user_group( + self, + user_group_id: UUID, + user: models.User + ) -> Union[None, models.UserGroup]: + + query = select(models.UserGroup).\ + options(selectinload(models.UserGroup.users)).\ + where(models.UserGroup.user_group_id == user_group_id) + result = await self._db_session.execute(query) + user_group_db = result.scalars().first() + if not user_group_db: + return None + + user_group_db.users.remove(user) + await self._db_session.commit() + await self._db_session.refresh(user_group_db) + return user_group_db + + async def get_user_group_members(self, user_group_id: UUID) -> List[models.User]: + + query = select(models.User).\ + join(models.User.groups).\ + filter(models.UserGroup.user_group_id == user_group_id) + + result = await self._db_session.execute(query) + return result.scalars().all() diff --git a/gns3server/db/tasks.py b/gns3server/db/tasks.py index fb53ed4f..c3c5ec0c 100644 --- a/gns3server/db/tasks.py +++ b/gns3server/db/tasks.py @@ -22,6 +22,8 @@ from fastapi.encoders import jsonable_encoder from pydantic import ValidationError from typing import List +from sqlalchemy import event +from sqlalchemy.engine import Engine from sqlalchemy.exc import SQLAlchemyError from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession from gns3server.db.repositories.computes import ComputesRepository @@ -41,12 +43,22 @@ async def connect_to_db(app: FastAPI) -> None: db_url = os.environ.get("GNS3_DATABASE_URI", f"sqlite+aiosqlite:///{db_path}") engine = create_async_engine(db_url, connect_args={"check_same_thread": False}, future=True) try: - async with engine.begin() as conn: + async with engine.connect() as conn: await conn.run_sync(Base.metadata.create_all) log.info(f"Successfully connected to database '{db_url}'") app.state._db_engine = engine except SQLAlchemyError as e: - log.error(f"Error while connecting to database '{db_url}: {e}") + log.fatal(f"Error while connecting to database '{db_url}: {e}") + + +@event.listens_for(Engine, "connect") +def set_sqlite_pragma(dbapi_connection, connection_record): + + # Enable SQL foreign key support for SQLite + # https://docs.sqlalchemy.org/en/14/dialects/sqlite.html#foreign-key-support + cursor = dbapi_connection.cursor() + cursor.execute("PRAGMA foreign_keys=ON") + cursor.close() async def get_computes(app: FastAPI) -> List[dict]: diff --git a/gns3server/logger.py b/gns3server/logger.py index 592d9ada..74cd2093 100644 --- a/gns3server/logger.py +++ b/gns3server/logger.py @@ -111,7 +111,7 @@ class LogFilter: """ def filter(record): - if "/settings" in record.msg and "200" in record.msg: + if isinstance(record.msg, str) and "/settings" in record.msg and "200" in record.msg: return 0 return 1 diff --git a/gns3server/schemas/__init__.py b/gns3server/schemas/__init__.py index 838141f8..f32985a5 100644 --- a/gns3server/schemas/__init__.py +++ b/gns3server/schemas/__init__.py @@ -27,7 +27,7 @@ from .controller.drawings import Drawing from .controller.gns3vm import GNS3VM from .controller.nodes import NodeCreate, NodeUpdate, NodeDuplicate, NodeCapture, Node from .controller.projects import ProjectCreate, ProjectUpdate, ProjectDuplicate, Project, ProjectFile -from .controller.users import UserCreate, UserUpdate, User, Credentials +from .controller.users import UserCreate, UserUpdate, User, Credentials, UserGroupCreate, UserGroupUpdate, UserGroup from .controller.tokens import Token from .controller.snapshots import SnapshotCreate, Snapshot from .controller.iou_license import IOULicense diff --git a/gns3server/schemas/config.py b/gns3server/schemas/config.py index 80f52add..ec671823 100644 --- a/gns3server/schemas/config.py +++ b/gns3server/schemas/config.py @@ -134,6 +134,8 @@ class ServerSettings(BaseModel): user: str = None password: SecretStr = None enable_http_auth: bool = False + default_admin_username: str = "admin" + default_admin_password: SecretStr = SecretStr("admin") allowed_interfaces: List[str] = Field(default_factory=list) default_nat_interface: str = None allow_remote_console: bool = False diff --git a/gns3server/schemas/controller/computes.py b/gns3server/schemas/controller/computes.py index f84bb527..00343e64 100644 --- a/gns3server/schemas/controller/computes.py +++ b/gns3server/schemas/controller/computes.py @@ -14,9 +14,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import uuid + from pydantic import BaseModel, Field, SecretStr, validator from typing import List, Optional, Union -from uuid import UUID, uuid4 from enum import Enum from .nodes import NodeType @@ -49,7 +50,7 @@ class ComputeCreate(ComputeBase): Data to create a compute. """ - compute_id: Union[str, UUID] = Field(default_factory=uuid4) + compute_id: Union[str, uuid.UUID] = None password: Optional[SecretStr] = None class Config: @@ -63,7 +64,18 @@ class ComputeCreate(ComputeBase): } } - @validator("name", always=True) + @validator("compute_id", pre=True, always=True) + def default_compute_id(cls, v, values): + + if v is not None: + return v + else: + protocol = values.get("protocol") + host = values.get("host") + port = values.get("port") + return uuid.uuid5(uuid.NAMESPACE_URL, f"{protocol}://{host}:{port}") + + @validator("name", pre=True, always=True) def generate_name(cls, name, values): if name is not None: @@ -119,7 +131,7 @@ class Compute(DateTimeModelMixin, ComputeBase): Data returned for a compute. """ - compute_id: Union[str, UUID] + compute_id: Union[str, uuid.UUID] name: str connected: Optional[bool] = Field(None, description="Whether the controller is connected to the compute or not") cpu_usage_percent: Optional[float] = Field(None, description="CPU usage of the compute", ge=0, le=100) diff --git a/gns3server/schemas/controller/users.py b/gns3server/schemas/controller/users.py index 3fa0a551..28d40688 100644 --- a/gns3server/schemas/controller/users.py +++ b/gns3server/schemas/controller/users.py @@ -58,6 +58,39 @@ class User(DateTimeModelMixin, UserBase): orm_mode = True +class UserGroupBase(BaseModel): + """ + Common user group properties. + """ + + name: Optional[str] = Field(None, min_length=3, regex="[a-zA-Z0-9_-]+$") + + +class UserGroupCreate(UserGroupBase): + """ + Properties to create an user group. + """ + + name: Optional[str] = Field(..., min_length=3, regex="[a-zA-Z0-9_-]+$") + + +class UserGroupUpdate(UserGroupBase): + """ + Properties to update an user group. + """ + + pass + + +class UserGroup(DateTimeModelMixin, UserGroupBase): + + user_group_id: UUID + is_updatable: bool + + class Config: + orm_mode = True + + class Credentials(BaseModel): username: str diff --git a/gns3server/server.py b/gns3server/server.py index 3c7dedb1..e52f0834 100644 --- a/gns3server/server.py +++ b/gns3server/server.py @@ -319,6 +319,7 @@ class Server: access_log=access_log, ssl_certfile=config.Server.certfile, ssl_keyfile=config.Server.certkey, + lifespan="on" ) # overwrite uvicorn loggers with our own logger diff --git a/gns3server/static/web-ui/index.html b/gns3server/static/web-ui/index.html index 8a91932b..6f9c282d 100644 --- a/gns3server/static/web-ui/index.html +++ b/gns3server/static/web-ui/index.html @@ -25,7 +25,7 @@ - + @@ -41,12 +41,12 @@ - + diff --git a/gns3server/static/web-ui/main.2f0314a517dded67879c.js b/gns3server/static/web-ui/main.2f0314a517dded67879c.js new file mode 100644 index 00000000..d2d18ec9 --- /dev/null +++ b/gns3server/static/web-ui/main.2f0314a517dded67879c.js @@ -0,0 +1 @@ +(window.webpackJsonp=window.webpackJsonp||[]).push([[1],{"+/L5":function(e,t,n){var r=n("t1UP").isCustomProperty,i=n("vd7W").TYPE,o=n("4njK").mode,a=i.Ident,s=i.Hash,c=i.Colon,l=i.Semicolon,u=i.Delim;function h(e){return this.Raw(e,o.exclamationMarkOrSemicolon,!0)}function d(e){return this.Raw(e,o.exclamationMarkOrSemicolon,!1)}function f(){var e=this.scanner.tokenIndex,t=this.Value();return"Raw"!==t.type&&!1===this.scanner.eof&&this.scanner.tokenType!==l&&!1===this.scanner.isDelim(33)&&!1===this.scanner.isBalanceEdge(e)&&this.error(),t}function p(){var e=this.scanner.tokenStart;if(this.scanner.tokenType===u)switch(this.scanner.source.charCodeAt(this.scanner.tokenStart)){case 42:case 36:case 43:case 35:case 38:this.scanner.next();break;case 47:this.scanner.next(),this.scanner.isDelim(47)&&this.scanner.next()}return this.eat(this.scanner.tokenType===s?s:a),this.scanner.substrToCursor(e)}function m(){this.eat(u),this.scanner.skipSC();var e=this.consume(a);return"important"===e||e}e.exports={name:"Declaration",structure:{important:[Boolean,String],property:String,value:["Value","Raw"]},parse:function(){var e,t=this.scanner.tokenStart,n=this.scanner.tokenIndex,i=p.call(this),o=r(i),a=o?this.parseCustomProperty:this.parseValue,s=o?d:h,u=!1;return this.scanner.skipSC(),this.eat(c),o||this.scanner.skipSC(),e=a?this.parseWithFallback(f,s):s.call(this,this.scanner.tokenIndex),this.scanner.isDelim(33)&&(u=m.call(this),this.scanner.skipSC()),!1===this.scanner.eof&&this.scanner.tokenType!==l&&!1===this.scanner.isBalanceEdge(n)&&this.error(),{type:"Declaration",loc:this.getLocation(t,this.scanner.tokenStart),important:u,property:i,value:e}},generate:function(e){this.chunk(e.property),this.chunk(":"),this.node(e.value),e.important&&this.chunk(!0===e.important?"!important":"!"+e.important)},walkContext:"declaration"}},"+4/i":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("odkN");r.Observable.prototype.let=i.letProto,r.Observable.prototype.letBind=i.letProto},"+EXs":function(e,t,n){"use strict";function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}n.d(t,"a",function(){return o});var i=n("JL25");function o(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?Object(i.a)(e):t}},"+Kd2":function(e,t,n){var r=n("vd7W").TYPE,i=n("4njK").mode,o=r.Comma;e.exports=function(){var e=this.createList();return this.scanner.skipSC(),e.push(this.Identifier()),this.scanner.skipSC(),this.scanner.tokenType===o&&(e.push(this.Operator()),e.push(this.parseCustomProperty?this.Value(null):this.Raw(this.scanner.tokenIndex,i.exclamationMarkOrSemicolon,!1))),e}},"+Wds":function(e,t,n){"use strict";var r=String.prototype.indexOf;e.exports=function(e){return r.call(this,e,arguments[1])>-1}},"+XMV":function(e,t,n){"use strict";e.exports=n("GOzd")()?String.prototype.contains:n("+Wds")},"+oeQ":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("H+DX");r.Observable.prototype.observeOn=i.observeOn},"+psR":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("16Oq");r.Observable.prototype.retry=i.retry},"+qxJ":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("GsYY");r.Observable.prototype.distinctUntilChanged=i.distinctUntilChanged},"+v8i":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp");r.Observable.concat=r.concat},"+wdc":function(e,t,n){"use strict";var r,i,o,a;if("object"==typeof performance&&"function"==typeof performance.now){var s=performance;t.unstable_now=function(){return s.now()}}else{var c=Date,l=c.now();t.unstable_now=function(){return c.now()-l}}if("undefined"==typeof window||"function"!=typeof MessageChannel){var u=null,h=null,d=function e(){if(null!==u)try{var n=t.unstable_now();u(!0,n),u=null}catch(r){throw setTimeout(e,0),r}};r=function(e){null!==u?setTimeout(r,0,e):(u=e,setTimeout(d,0))},i=function(e,t){h=setTimeout(e,t)},o=function(){clearTimeout(h)},t.unstable_shouldYield=function(){return!1},a=t.unstable_forceFrameRate=function(){}}else{var f=window.setTimeout,p=window.clearTimeout;if("undefined"!=typeof console){var m=window.cancelAnimationFrame;"function"!=typeof window.requestAnimationFrame&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),"function"!=typeof m&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")}var g=!1,v=null,b=-1,y=5,_=0;t.unstable_shouldYield=function(){return t.unstable_now()>=_},a=function(){},t.unstable_forceFrameRate=function(e){0>e||125>>1,i=e[r];if(!(void 0!==i&&0O(a,n))void 0!==c&&0>O(c,a)?(e[r]=c,e[s]=n,r=s):(e[r]=a,e[o]=n,r=o);else{if(!(void 0!==c&&0>O(c,n)))break e;e[r]=c,e[s]=n,r=s}}}return t}return null}function O(e,t){var n=e.sortIndex-t.sortIndex;return 0!==n?n:e.id-t.id}var M=[],T=[],E=1,P=null,j=3,I=!1,A=!1,D=!1;function R(e){for(var t=S(T);null!==t;){if(null===t.callback)x(T);else{if(!(t.startTime<=e))break;x(T),t.sortIndex=t.expirationTime,C(M,t)}t=S(T)}}function L(e){if(D=!1,R(e),!A)if(null!==S(M))A=!0,r(N);else{var t=S(T);null!==t&&i(L,t.startTime-e)}}function N(e,n){A=!1,D&&(D=!1,o()),I=!0;var r=j;try{for(R(n),P=S(M);null!==P&&(!(P.expirationTime>n)||e&&!t.unstable_shouldYield());){var a=P.callback;if("function"==typeof a){P.callback=null,j=P.priorityLevel;var s=a(P.expirationTime<=n);n=t.unstable_now(),"function"==typeof s?P.callback=s:P===S(M)&&x(M),R(n)}else x(M);P=S(M)}if(null!==P)var c=!0;else{var l=S(T);null!==l&&i(L,l.startTime-n),c=!1}return c}finally{P=null,j=r,I=!1}}var F=a;t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){A||I||(A=!0,r(N))},t.unstable_getCurrentPriorityLevel=function(){return j},t.unstable_getFirstCallbackNode=function(){return S(M)},t.unstable_next=function(e){switch(j){case 1:case 2:case 3:var t=3;break;default:t=j}var n=j;j=t;try{return e()}finally{j=n}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=F,t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=j;j=e;try{return t()}finally{j=n}},t.unstable_scheduleCallback=function(e,n,a){var s=t.unstable_now();switch(a="object"==typeof a&&null!==a&&"number"==typeof(a=a.delay)&&0s?(e.sortIndex=a,C(T,e),null===S(M)&&e===S(T)&&(D?o():D=!0,i(L,a-s))):(e.sortIndex=c,C(M,e),A||I||(A=!0,r(N))),e},t.unstable_wrapCallback=function(e){var t=j;return function(){var n=j;j=t;try{return e.apply(this,arguments)}finally{j=n}}}},"/+5V":function(e,t){function n(e){function t(e){return null!==e&&("Type"===e.type||"Property"===e.type||"Keyword"===e.type)}var n=null;return null!==this.matched&&function r(i){if(Array.isArray(i.match)){for(var o=0;oe;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()},t.prototype._createAccessibilityTreeNode=function(){var e=document.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e},t.prototype._onTab=function(e){for(var t=0;t0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,"\n"===e&&(this._liveRegionLineCount++,21===this._liveRegionLineCount&&(this._liveRegion.textContent+=o.tooMuchOutput)),a.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(function(){t._accessibilityTreeRoot.appendChild(t._liveRegion)},0))},t.prototype._clearLiveRegion=function(){this._liveRegion.textContent="",this._liveRegionLineCount=0,a.isMac&&h.removeElementFromParent(this._liveRegion)},t.prototype._onKey=function(e){this._clearLiveRegion(),this._charsToConsume.push(e)},t.prototype._refreshRows=function(e,t){this._renderRowsDebouncer.refresh(e,t,this._terminal.rows)},t.prototype._renderRows=function(e,t){for(var n=this._terminal.buffer,r=n.lines.length.toString(),i=e;i<=t;i++){var o=n.translateBufferLineToString(n.ydisp+i,!0),a=(n.ydisp+i+1).toString(),s=this._rowElements[i];s&&(0===o.length?s.innerText="\xa0":s.textContent=o,s.setAttribute("aria-posinset",a),s.setAttribute("aria-setsize",r))}this._announceCharacters()},t.prototype._refreshRowsDimensions=function(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(var e=0;e>>0}}(n=t.channels||(t.channels={})),(r=t.color||(t.color={})).blend=function(e,t){var r=(255&t.rgba)/255;if(1===r)return{css:t.css,rgba:t.rgba};var i=t.rgba>>16&255,o=t.rgba>>8&255,a=e.rgba>>24&255,s=e.rgba>>16&255,c=e.rgba>>8&255,l=a+Math.round(((t.rgba>>24&255)-a)*r),u=s+Math.round((i-s)*r),h=c+Math.round((o-c)*r);return{css:n.toCss(l,u,h),rgba:n.toRgba(l,u,h)}},r.isOpaque=function(e){return 255==(255&e.rgba)},r.ensureContrastRatio=function(e,t,n){var r=o.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return o.toColor(r>>24&255,r>>16&255,r>>8&255)},r.opaque=function(e){var t=(255|e.rgba)>>>0,r=o.toChannels(t);return{css:n.toCss(r[0],r[1],r[2]),rgba:t}},r.opacity=function(e,t){var r=Math.round(255*t),i=o.toChannels(e.rgba),a=i[0],s=i[1],c=i[2];return{css:n.toCss(a,s,c,r),rgba:n.toRgba(a,s,c,r)}},(t.css||(t.css={})).toColor=function(e){switch(e.length){case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}throw new Error("css.toColor: Unsupported css format")},function(e){function t(e,t,n){var r=e/255,i=t/255,o=n/255;return.2126*(r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))+.7152*(i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4))+.0722*(o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4))}e.relativeLuminance=function(e){return t(e>>16&255,e>>8&255,255&e)},e.relativeLuminance2=t}(i=t.rgb||(t.rgb={})),function(e){function t(e,t,n){for(var r=e>>24&255,o=e>>16&255,a=e>>8&255,c=t>>24&255,l=t>>16&255,u=t>>8&255,h=s(i.relativeLuminance2(c,u,l),i.relativeLuminance2(r,o,a));h0||l>0||u>0);)c-=Math.max(0,Math.ceil(.1*c)),l-=Math.max(0,Math.ceil(.1*l)),u-=Math.max(0,Math.ceil(.1*u)),h=s(i.relativeLuminance2(c,u,l),i.relativeLuminance2(r,o,a));return(c<<24|l<<16|u<<8|255)>>>0}function r(e,t,n){for(var r=e>>24&255,o=e>>16&255,a=e>>8&255,c=t>>24&255,l=t>>16&255,u=t>>8&255,h=s(i.relativeLuminance2(c,u,l),i.relativeLuminance2(r,o,a));h>>0}e.ensureContrastRatio=function(e,n,o){var a=i.relativeLuminance(e>>8),c=i.relativeLuminance(n>>8);if(s(a,c)>24&255,e>>16&255,e>>8&255,255&e]},e.toColor=function(e,t,r){return{css:n.toCss(e,t,r),rgba:n.toRgba(e,t,r)}}}(o=t.rgba||(t.rgba={})),t.toPaddedHex=a,t.contrastRatio=s},7239:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorContrastCache=void 0;var n=function(){function e(){this._color={},this._rgba={}}return e.prototype.clear=function(){this._color={},this._rgba={}},e.prototype.setCss=function(e,t,n){this._rgba[e]||(this._rgba[e]={}),this._rgba[e][t]=n},e.prototype.getCss=function(e,t){return this._rgba[e]?this._rgba[e][t]:void 0},e.prototype.setColor=function(e,t,n){this._color[e]||(this._color[e]={}),this._color[e][t]=n},e.prototype.getColor=function(e,t){return this._color[e]?this._color[e][t]:void 0},e}();t.ColorContrastCache=n},5680:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.ColorManager=t.DEFAULT_ANSI_COLORS=void 0;var r=n(4774),i=n(7239),o=r.css.toColor("#ffffff"),a=r.css.toColor("#000000"),s=r.css.toColor("#ffffff"),c=r.css.toColor("#000000"),l={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};t.DEFAULT_ANSI_COLORS=Object.freeze(function(){for(var e=[r.css.toColor("#2e3436"),r.css.toColor("#cc0000"),r.css.toColor("#4e9a06"),r.css.toColor("#c4a000"),r.css.toColor("#3465a4"),r.css.toColor("#75507b"),r.css.toColor("#06989a"),r.css.toColor("#d3d7cf"),r.css.toColor("#555753"),r.css.toColor("#ef2929"),r.css.toColor("#8ae234"),r.css.toColor("#fce94f"),r.css.toColor("#729fcf"),r.css.toColor("#ad7fa8"),r.css.toColor("#34e2e2"),r.css.toColor("#eeeeec")],t=[0,95,135,175,215,255],n=0;n<216;n++){var i=t[n/36%6|0],o=t[n/6%6|0],a=t[n%6];e.push({css:r.channels.toCss(i,o,a),rgba:r.channels.toRgba(i,o,a)})}for(n=0;n<24;n++){var s=8+10*n;e.push({css:r.channels.toCss(s,s,s),rgba:r.channels.toRgba(s,s,s)})}return e}());var u=function(){function e(e,n){this.allowTransparency=n;var u=e.createElement("canvas");u.width=1,u.height=1;var h=u.getContext("2d");if(!h)throw new Error("Could not get rendering context");this._ctx=h,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new i.ColorContrastCache,this.colors={foreground:o,background:a,cursor:s,cursorAccent:c,selectionTransparent:l,selectionOpaque:r.color.blend(a,l),ansi:t.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache}}return e.prototype.onOptionsChange=function(e){"minimumContrastRatio"===e&&this._contrastCache.clear()},e.prototype.setTheme=function(e){void 0===e&&(e={}),this.colors.foreground=this._parseColor(e.foreground,o),this.colors.background=this._parseColor(e.background,a),this.colors.cursor=this._parseColor(e.cursor,s,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,c,!0),this.colors.selectionTransparent=this._parseColor(e.selection,l,!0),this.colors.selectionOpaque=r.color.blend(this.colors.background,this.colors.selectionTransparent),r.color.isOpaque(this.colors.selectionTransparent)&&(this.colors.selectionTransparent=r.color.opacity(this.colors.selectionTransparent,.3)),this.colors.ansi[0]=this._parseColor(e.black,t.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,t.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,t.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,t.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,t.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,t.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,t.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,t.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,t.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,t.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,t.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,t.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,t.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,t.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,t.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,t.DEFAULT_ANSI_COLORS[15]),this._contrastCache.clear()},e.prototype._parseColor=function(e,t,n){if(void 0===n&&(n=this.allowTransparency),void 0===e)return t;if(this._ctx.fillStyle=this._litmusColor,this._ctx.fillStyle=e,"string"!=typeof this._ctx.fillStyle)return console.warn("Color: "+e+" is invalid using fallback "+t.css),t;this._ctx.fillRect(0,0,1,1);var i=this._ctx.getImageData(0,0,1,1).data;if(255!==i[3]){if(!n)return console.warn("Color: "+e+" is using transparency, but allowTransparency is false. Using fallback "+t.css+"."),t;var o=this._ctx.fillStyle.substring(5,this._ctx.fillStyle.length-1).split(",").map(function(e){return Number(e)}),a=o[0],s=o[1],c=o[2],l=Math.round(255*o[3]);return{rgba:r.channels.toRgba(a,s,c,l),css:e}}return{css:this._ctx.fillStyle,rgba:r.channels.toRgba(i[0],i[1],i[2],i[3])}},e}();t.ColorManager=u},9631:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.removeElementFromParent=void 0,t.removeElementFromParent=function(){for(var e,t=[],n=0;n=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZone=t.Linkifier=void 0;var o=n(8460),a=n(2585),s=function(){function e(e,t,n){this._bufferService=e,this._logService=t,this._unicodeService=n,this._linkMatchers=[],this._nextLinkMatcherId=0,this._onShowLinkUnderline=new o.EventEmitter,this._onHideLinkUnderline=new o.EventEmitter,this._onLinkTooltip=new o.EventEmitter,this._rowsToLinkify={start:void 0,end:void 0}}return Object.defineProperty(e.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onLinkTooltip",{get:function(){return this._onLinkTooltip.event},enumerable:!1,configurable:!0}),e.prototype.attachToDom=function(e,t){this._element=e,this._mouseZoneManager=t},e.prototype.linkifyRows=function(t,n){var r=this;this._mouseZoneManager&&(void 0===this._rowsToLinkify.start||void 0===this._rowsToLinkify.end?(this._rowsToLinkify.start=t,this._rowsToLinkify.end=n):(this._rowsToLinkify.start=Math.min(this._rowsToLinkify.start,t),this._rowsToLinkify.end=Math.max(this._rowsToLinkify.end,n)),this._mouseZoneManager.clearAll(t,n),this._rowsTimeoutId&&clearTimeout(this._rowsTimeoutId),this._rowsTimeoutId=setTimeout(function(){return r._linkifyRows()},e._timeBeforeLatency))},e.prototype._linkifyRows=function(){this._rowsTimeoutId=void 0;var e=this._bufferService.buffer;if(void 0!==this._rowsToLinkify.start&&void 0!==this._rowsToLinkify.end){var t=e.ydisp+this._rowsToLinkify.start;if(!(t>=e.lines.length)){for(var n=e.ydisp+Math.min(this._rowsToLinkify.end,this._bufferService.rows)+1,r=Math.ceil(2e3/this._bufferService.cols),i=this._bufferService.buffer.iterator(!1,t,n,r,r);i.hasNext();)for(var o=i.next(),a=0;a=0;t--)if(e.priority<=this._linkMatchers[t].priority)return void this._linkMatchers.splice(t+1,0,e);this._linkMatchers.splice(0,0,e)}else this._linkMatchers.push(e)},e.prototype.deregisterLinkMatcher=function(e){for(var t=0;t>9&511:void 0;n.validationCallback?n.validationCallback(s,function(e){i._rowsTimeoutId||e&&i._addLink(l[1],l[0]-i._bufferService.buffer.ydisp,s,n,d)}):c._addLink(l[1],l[0]-c._bufferService.buffer.ydisp,s,n,d)},c=this;null!==(r=o.exec(t))&&"break"!==s(););},e.prototype._addLink=function(e,t,n,r,i){var o=this;if(this._mouseZoneManager&&this._element){var a=this._unicodeService.getStringCellWidth(n),s=e%this._bufferService.cols,l=t+Math.floor(e/this._bufferService.cols),u=(s+a)%this._bufferService.cols,h=l+Math.floor((s+a)/this._bufferService.cols);0===u&&(u=this._bufferService.cols,h--),this._mouseZoneManager.add(new c(s+1,l+1,u+1,h+1,function(e){if(r.handler)return r.handler(e,n);var t=window.open();t?(t.opener=null,t.location.href=n):console.warn("Opening link blocked as opener could not be cleared")},function(){o._onShowLinkUnderline.fire(o._createLinkHoverEvent(s,l,u,h,i)),o._element.classList.add("xterm-cursor-pointer")},function(e){o._onLinkTooltip.fire(o._createLinkHoverEvent(s,l,u,h,i)),r.hoverTooltipCallback&&r.hoverTooltipCallback(e,n,{start:{x:s,y:l},end:{x:u,y:h}})},function(){o._onHideLinkUnderline.fire(o._createLinkHoverEvent(s,l,u,h,i)),o._element.classList.remove("xterm-cursor-pointer"),r.hoverLeaveCallback&&r.hoverLeaveCallback()},function(e){return!r.willLinkActivate||r.willLinkActivate(e,n)}))}},e.prototype._createLinkHoverEvent=function(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}},e._timeBeforeLatency=200,e=r([i(0,a.IBufferService),i(1,a.ILogService),i(2,a.IUnicodeService)],e)}();t.Linkifier=s;var c=function(e,t,n,r,i,o,a,s,c){this.x1=e,this.y1=t,this.x2=n,this.y2=r,this.clickCallback=i,this.hoverCallback=o,this.tooltipCallback=a,this.leaveCallback=s,this.willLinkActivate=c};t.MouseZone=c},6465:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Linkifier2=void 0;var s=n(2585),c=n(8460),l=n(844),u=n(3656),h=function(e){function t(t){var n=e.call(this)||this;return n._bufferService=t,n._linkProviders=[],n._linkCacheDisposables=[],n._isMouseOut=!0,n._activeLine=-1,n._onShowLinkUnderline=n.register(new c.EventEmitter),n._onHideLinkUnderline=n.register(new c.EventEmitter),n.register(l.getDisposeArrayDisposable(n._linkCacheDisposables)),n}return i(t,e),Object.defineProperty(t.prototype,"onShowLinkUnderline",{get:function(){return this._onShowLinkUnderline.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onHideLinkUnderline",{get:function(){return this._onHideLinkUnderline.event},enumerable:!1,configurable:!0}),t.prototype.registerLinkProvider=function(e){var t=this;return this._linkProviders.push(e),{dispose:function(){var n=t._linkProviders.indexOf(e);-1!==n&&t._linkProviders.splice(n,1)}}},t.prototype.attachToDom=function(e,t,n){var r=this;this._element=e,this._mouseService=t,this._renderService=n,this.register(u.addDisposableDomListener(this._element,"mouseleave",function(){r._isMouseOut=!0,r._clearCurrentLink()})),this.register(u.addDisposableDomListener(this._element,"mousemove",this._onMouseMove.bind(this))),this.register(u.addDisposableDomListener(this._element,"click",this._onClick.bind(this)))},t.prototype._onMouseMove=function(e){if(this._lastMouseEvent=e,this._element&&this._mouseService){var t=this._positionFromMouseEvent(e,this._element,this._mouseService);if(t){this._isMouseOut=!1;for(var n=e.composedPath(),r=0;re?this._bufferService.cols:a.link.range.end.x,c=a.link.range.start.y=e&&this._currentLink.link.range.end.y<=t)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,l.disposeArray(this._linkCacheDisposables))},t.prototype._handleNewLink=function(e){var t=this;if(this._element&&this._lastMouseEvent&&this._mouseService){var n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._linkAtPosition(e.link,n)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:void 0===e.link.decorations||e.link.decorations.underline,pointerCursor:void 0===e.link.decorations||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:function(){var e,n;return null===(n=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===n?void 0:n.decorations.pointerCursor},set:function(e){var n,r;(null===(n=t._currentLink)||void 0===n?void 0:n.state)&&t._currentLink.state.decorations.pointerCursor!==e&&(t._currentLink.state.decorations.pointerCursor=e,t._currentLink.state.isHovered&&(null===(r=t._element)||void 0===r||r.classList.toggle("xterm-cursor-pointer",e)))}},underline:{get:function(){var e,n;return null===(n=null===(e=t._currentLink)||void 0===e?void 0:e.state)||void 0===n?void 0:n.decorations.underline},set:function(n){var r,i,o;(null===(r=t._currentLink)||void 0===r?void 0:r.state)&&(null===(o=null===(i=t._currentLink)||void 0===i?void 0:i.state)||void 0===o?void 0:o.decorations.underline)!==n&&(t._currentLink.state.decorations.underline=n,t._currentLink.state.isHovered&&t._fireUnderlineEvent(e.link,n))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedBufferChange(function(e){t._clearCurrentLink(0===e.start?0:e.start+1+t._bufferService.buffer.ydisp,e.end+1+t._bufferService.buffer.ydisp)})))}},t.prototype._linkHover=function(e,t,n){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),t.hover&&t.hover(n,t.text)},t.prototype._fireUnderlineEvent=function(e,t){var n=e.range,r=this._bufferService.buffer.ydisp,i=this._createLinkUnderlineEvent(n.start.x-1,n.start.y-r-1,n.end.x,n.end.y-r-1,void 0);(t?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(i)},t.prototype._linkLeave=function(e,t,n){var r;(null===(r=this._currentLink)||void 0===r?void 0:r.state)&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(t,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),t.leave&&t.leave(n,t.text)},t.prototype._linkAtPosition=function(e,t){var n=e.range.start.yt.y;return(e.range.start.y===e.range.end.y&&e.range.start.x<=t.x&&e.range.end.x>=t.x||n&&e.range.end.x>=t.x||r&&e.range.start.x<=t.x||n&&r)&&e.range.start.y<=t.y&&e.range.end.y>=t.y},t.prototype._positionFromMouseEvent=function(e,t,n){var r=n.getCoords(e,t,this._bufferService.cols,this._bufferService.rows);if(r)return{x:r[0],y:r[1]+this._bufferService.buffer.ydisp}},t.prototype._createLinkUnderlineEvent=function(e,t,n,r,i){return{x1:e,y1:t,x2:n,y2:r,cols:this._bufferService.cols,fg:i}},o([a(0,s.IBufferService)],t)}(l.Disposable);t.Linkifier2=h},9042:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.tooMuchOutput=t.promptLabel=void 0,t.promptLabel="Terminal input",t.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},6954:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseZoneManager=void 0;var s=n(844),c=n(3656),l=n(4725),u=n(2585),h=function(e){function t(t,n,r,i,o,a){var s=e.call(this)||this;return s._element=t,s._screenElement=n,s._bufferService=r,s._mouseService=i,s._selectionService=o,s._optionsService=a,s._zones=[],s._areZonesActive=!1,s._lastHoverCoords=[void 0,void 0],s._initialSelectionLength=0,s.register(c.addDisposableDomListener(s._element,"mousedown",function(e){return s._onMouseDown(e)})),s._mouseMoveListener=function(e){return s._onMouseMove(e)},s._mouseLeaveListener=function(e){return s._onMouseLeave(e)},s._clickListener=function(e){return s._onClick(e)},s}return i(t,e),t.prototype.dispose=function(){e.prototype.dispose.call(this),this._deactivate()},t.prototype.add=function(e){this._zones.push(e),1===this._zones.length&&this._activate()},t.prototype.clearAll=function(e,t){if(0!==this._zones.length){e&&t||(e=0,t=this._bufferService.rows-1);for(var n=0;ne&&r.y1<=t+1||r.y2>e&&r.y2<=t+1||r.y1t+1)&&(this._currentZone&&this._currentZone===r&&(this._currentZone.leaveCallback(),this._currentZone=void 0),this._zones.splice(n--,1))}0===this._zones.length&&this._deactivate()}},t.prototype._activate=function(){this._areZonesActive||(this._areZonesActive=!0,this._element.addEventListener("mousemove",this._mouseMoveListener),this._element.addEventListener("mouseleave",this._mouseLeaveListener),this._element.addEventListener("click",this._clickListener))},t.prototype._deactivate=function(){this._areZonesActive&&(this._areZonesActive=!1,this._element.removeEventListener("mousemove",this._mouseMoveListener),this._element.removeEventListener("mouseleave",this._mouseLeaveListener),this._element.removeEventListener("click",this._clickListener))},t.prototype._onMouseMove=function(e){this._lastHoverCoords[0]===e.pageX&&this._lastHoverCoords[1]===e.pageY||(this._onHover(e),this._lastHoverCoords=[e.pageX,e.pageY])},t.prototype._onHover=function(e){var t=this,n=this._findZoneEventAt(e);n!==this._currentZone&&(this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout)),n&&(this._currentZone=n,n.hoverCallback&&n.hoverCallback(e),this._tooltipTimeout=window.setTimeout(function(){return t._onTooltip(e)},this._optionsService.options.linkTooltipHoverDuration)))},t.prototype._onTooltip=function(e){this._tooltipTimeout=void 0;var t=this._findZoneEventAt(e);t&&t.tooltipCallback&&t.tooltipCallback(e)},t.prototype._onMouseDown=function(e){if(this._initialSelectionLength=this._getSelectionLength(),this._areZonesActive){var t=this._findZoneEventAt(e);(null==t?void 0:t.willLinkActivate(e))&&(e.preventDefault(),e.stopImmediatePropagation())}},t.prototype._onMouseLeave=function(e){this._currentZone&&(this._currentZone.leaveCallback(),this._currentZone=void 0,this._tooltipTimeout&&clearTimeout(this._tooltipTimeout))},t.prototype._onClick=function(e){var t=this._findZoneEventAt(e),n=this._getSelectionLength();t&&n===this._initialSelectionLength&&(t.clickCallback(e),e.preventDefault(),e.stopImmediatePropagation())},t.prototype._getSelectionLength=function(){var e=this._selectionService.selectionText;return e?e.length:0},t.prototype._findZoneEventAt=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows);if(t)for(var n=t[0],r=t[1],i=0;i=o.x1&&n=o.x1||r===o.y2&&no.y1&&r4)&&t._coreMouseService.triggerMouseEvent({col:i.x-33,row:i.y-33,button:n,action:r,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey})}var i={mouseup:null,wheel:null,mousedrag:null,mousemove:null},o=function(t){return r(t),t.buttons||(e._document.removeEventListener("mouseup",i.mouseup),i.mousedrag&&e._document.removeEventListener("mousemove",i.mousedrag)),e.cancel(t)},a=function(t){return r(t),t.preventDefault(),e.cancel(t)},s=function(e){e.buttons&&r(e)},l=function(e){e.buttons||r(e)};this.register(this._coreMouseService.onProtocolChange(function(t){t?("debug"===e.optionsService.options.logLevel&&e._logService.debug("Binding to mouse events:",e._coreMouseService.explainEvents(t)),e.element.classList.add("enable-mouse-events"),e._selectionService.disable()):(e._logService.debug("Unbinding from mouse events."),e.element.classList.remove("enable-mouse-events"),e._selectionService.enable()),8&t?i.mousemove||(n.addEventListener("mousemove",l),i.mousemove=l):(n.removeEventListener("mousemove",i.mousemove),i.mousemove=null),16&t?i.wheel||(n.addEventListener("wheel",a,{passive:!1}),i.wheel=a):(n.removeEventListener("wheel",i.wheel),i.wheel=null),2&t?i.mouseup||(i.mouseup=o):(e._document.removeEventListener("mouseup",i.mouseup),i.mouseup=null),4&t?i.mousedrag||(i.mousedrag=s):(e._document.removeEventListener("mousemove",i.mousedrag),i.mousedrag=null)})),this._coreMouseService.activeProtocol=this._coreMouseService.activeProtocol,this.register(p.addDisposableDomListener(n,"mousedown",function(t){if(t.preventDefault(),e.focus(),e._coreMouseService.areMouseEventsActive&&!e._selectionService.shouldForceSelection(t))return r(t),i.mouseup&&e._document.addEventListener("mouseup",i.mouseup),i.mousedrag&&e._document.addEventListener("mousemove",i.mousedrag),e.cancel(t)})),this.register(p.addDisposableDomListener(n,"wheel",function(t){if(i.wheel);else if(!e.buffer.hasScrollback){var n=e.viewport.getLinesScrolled(t);if(0===n)return;for(var r=c.C0.ESC+(e._coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(t.deltaY<0?"A":"B"),o="",a=0;a47)},t.prototype._keyUp=function(e){this._customKeyEventHandler&&!1===this._customKeyEventHandler(e)||(function(e){return 16===e.keyCode||17===e.keyCode||18===e.keyCode}(e)||this.focus(),this.updateCursorStyle(e))},t.prototype._keyPress=function(e){var t;if(this._keyDownHandled)return!1;if(this._customKeyEventHandler&&!1===this._customKeyEventHandler(e))return!1;if(this.cancel(e),e.charCode)t=e.charCode;else if(null==e.which)t=e.keyCode;else{if(0===e.which||0===e.charCode)return!1;t=e.which}return!(!t||(e.altKey||e.ctrlKey||e.metaKey)&&!this._isThirdLevelShift(this.browser,e)||(t=String.fromCharCode(t),this._onKey.fire({key:t,domEvent:e}),this._showCursor(),this._coreService.triggerDataEvent(t,!0),0))},t.prototype.bell=function(){this._soundBell()&&this._soundService.playBellSound()},t.prototype.resize=function(t,n){t!==this.cols||n!==this.rows?e.prototype.resize.call(this,t,n):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()},t.prototype._afterResize=function(e,t){var n,r;null===(n=this._charSizeService)||void 0===n||n.measure(),null===(r=this.viewport)||void 0===r||r.syncScrollArea(!0)},t.prototype.clear=function(){if(0!==this.buffer.ybase||0!==this.buffer.y){this.buffer.lines.set(0,this.buffer.lines.get(this.buffer.ybase+this.buffer.y)),this.buffer.lines.length=1,this.buffer.ydisp=0,this.buffer.ybase=0,this.buffer.y=0;for(var e=1;e=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Viewport=void 0;var s=n(844),c=n(3656),l=n(4725),u=n(2585),h=function(e){function t(t,n,r,i,o,a,s){var l=e.call(this)||this;return l._scrollLines=t,l._viewportElement=n,l._scrollArea=r,l._bufferService=i,l._optionsService=o,l._charSizeService=a,l._renderService=s,l.scrollBarWidth=0,l._currentRowHeight=0,l._lastRecordedBufferLength=0,l._lastRecordedViewportHeight=0,l._lastRecordedBufferHeight=0,l._lastTouchY=0,l._lastScrollTop=0,l._wheelPartialScroll=0,l._refreshAnimationFrame=null,l._ignoreNextScrollEvent=!1,l.scrollBarWidth=l._viewportElement.offsetWidth-l._scrollArea.offsetWidth||15,l.register(c.addDisposableDomListener(l._viewportElement,"scroll",l._onScroll.bind(l))),setTimeout(function(){return l.syncScrollArea()},0),l}return i(t,e),t.prototype.onThemeChange=function(e){this._viewportElement.style.backgroundColor=e.background.css},t.prototype._refresh=function(e){var t=this;if(e)return this._innerRefresh(),void(null!==this._refreshAnimationFrame&&cancelAnimationFrame(this._refreshAnimationFrame));null===this._refreshAnimationFrame&&(this._refreshAnimationFrame=requestAnimationFrame(function(){return t._innerRefresh()}))},t.prototype._innerRefresh=function(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;var e=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==e&&(this._lastRecordedBufferHeight=e,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}var t=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==t&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=t),this._refreshAnimationFrame=null},t.prototype.syncScrollArea=function(e){if(void 0===e&&(e=!1),this._lastRecordedBufferLength!==this._bufferService.buffer.lines.length)return this._lastRecordedBufferLength=this._bufferService.buffer.lines.length,void this._refresh(e);this._lastRecordedViewportHeight===this._renderService.dimensions.canvasHeight&&this._lastScrollTop===this._bufferService.buffer.ydisp*this._currentRowHeight&&this._lastScrollTop===this._viewportElement.scrollTop&&this._renderService.dimensions.scaledCellHeight/window.devicePixelRatio===this._currentRowHeight||this._refresh(e)},t.prototype._onScroll=function(e){if(this._lastScrollTop=this._viewportElement.scrollTop,this._viewportElement.offsetParent)if(this._ignoreNextScrollEvent)this._ignoreNextScrollEvent=!1;else{var t=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(t,!0)}},t.prototype._bubbleScroll=function(e,t){return!(t<0&&0!==this._viewportElement.scrollTop||t>0&&this._viewportElement.scrollTop+this._lastRecordedViewportHeight0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(t*=this._bufferService.rows),t},t.prototype._applyScrollModifier=function(e,t){var n=this._optionsService.options.fastScrollModifier;return"alt"===n&&t.altKey||"ctrl"===n&&t.ctrlKey||"shift"===n&&t.shiftKey?e*this._optionsService.options.fastScrollSensitivity*this._optionsService.options.scrollSensitivity:e*this._optionsService.options.scrollSensitivity},t.prototype.onTouchStart=function(e){this._lastTouchY=e.touches[0].pageY},t.prototype.onTouchMove=function(e){var t=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,0!==t&&(this._viewportElement.scrollTop+=t,this._bubbleScroll(e,t))},o([a(3,u.IBufferService),a(4,u.IOptionsService),a(5,l.ICharSizeService),a(6,l.IRenderService)],t)}(s.Disposable);t.Viewport=h},2950:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CompositionHelper=void 0;var o=n(4725),a=n(2585),s=function(){function e(e,t,n,r,i,o){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._charSizeService=i,this._coreService=o,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}return Object.defineProperty(e.prototype,"isComposing",{get:function(){return this._isComposing},enumerable:!1,configurable:!0}),e.prototype.compositionstart=function(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")},e.prototype.compositionupdate=function(e){var t=this;this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(function(){t._compositionPosition.end=t._textarea.value.length},0)},e.prototype.compositionend=function(){this._finalizeComposition(!0)},e.prototype.keydown=function(e){if(this._isComposing||this._isSendingComposition){if(229===e.keyCode)return!1;if(16===e.keyCode||17===e.keyCode||18===e.keyCode)return!1;this._finalizeComposition(!1)}return 229!==e.keyCode||(this._handleAnyTextareaChanges(),!1)},e.prototype._finalizeComposition=function(e){var t=this;if(this._compositionView.classList.remove("active"),this._isComposing=!1,e){var n={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(function(){var e;t._isSendingComposition&&(t._isSendingComposition=!1,n.start+=t._dataAlreadySent.length,(e=t._isComposing?t._textarea.value.substring(n.start,n.end):t._textarea.value.substring(n.start)).length>0&&t._coreService.triggerDataEvent(e,!0))},0)}else{this._isSendingComposition=!1;var r=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(r,!0)}},e.prototype._handleAnyTextareaChanges=function(){var e=this,t=this._textarea.value;setTimeout(function(){if(!e._isComposing){var n=e._textarea.value.replace(t,"");n.length>0&&(e._dataAlreadySent=n,e._coreService.triggerDataEvent(n,!0))}},0)},e.prototype.updateCompositionElements=function(e){var t=this;if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){var n=Math.ceil(this._charSizeService.height*this._optionsService.options.lineHeight),r=this._bufferService.buffer.y*n,i=this._bufferService.buffer.x*this._charSizeService.width;this._compositionView.style.left=i+"px",this._compositionView.style.top=r+"px",this._compositionView.style.height=n+"px",this._compositionView.style.lineHeight=n+"px",this._compositionView.style.fontFamily=this._optionsService.options.fontFamily,this._compositionView.style.fontSize=this._optionsService.options.fontSize+"px";var o=this._compositionView.getBoundingClientRect();this._textarea.style.left=i+"px",this._textarea.style.top=r+"px",this._textarea.style.width=o.width+"px",this._textarea.style.height=o.height+"px",this._textarea.style.lineHeight=o.height+"px"}e||setTimeout(function(){return t.updateCompositionElements(!0)},0)}},r([i(2,a.IBufferService),i(3,a.IOptionsService),i(4,o.ICharSizeService),i(5,a.ICoreService)],e)}();t.CompositionHelper=s},9806:function(e,t){function n(e,t){var n=t.getBoundingClientRect();return[e.clientX-n.left,e.clientY-n.top]}Object.defineProperty(t,"__esModule",{value:!0}),t.getRawByteCoords=t.getCoords=t.getCoordsRelativeToElement=void 0,t.getCoordsRelativeToElement=n,t.getCoords=function(e,t,r,i,o,a,s,c){if(o){var l=n(e,t);if(l)return l[0]=Math.ceil((l[0]+(c?a/2:0))/a),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+(c?1:0)),l[1]=Math.min(Math.max(l[1],1),i),l}},t.getRawByteCoords=function(e){if(e)return{x:e[0]+32,y:e[1]+32}}},9504:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.moveToCellSequence=void 0;var r=n(2584);function i(e,t,n,r){var i=e-o(n,e),s=t-o(n,t);return l(Math.abs(i-s)-function(e,t,n){for(var r=0,i=e-o(n,e),s=t-o(n,t),c=0;c=0&&tt?"A":"B"}function s(e,t,n,r,i,o){for(var a=e,s=t,c="";a!==n||s!==r;)a+=i?1:-1,i&&a>o.cols-1?(c+=o.buffer.translateBufferLineToString(s,!1,e,a),a=0,e=0,s++):!i&&a<0&&(c+=o.buffer.translateBufferLineToString(s,!1,0,e+1),e=a=o.cols-1,s--);return c+o.buffer.translateBufferLineToString(s,!1,e,a)}function c(e,t){return r.C0.ESC+(t?"O":"[")+e}function l(e,t){e=Math.floor(e);for(var n="",r=0;r0?r-o(a,r):t;var d=r,f=function(e,t,n,r,a,s){var c;return c=i(n,r,a,s).length>0?r-o(a,r):t,e=n&&ce?"D":"C",l(Math.abs(u-e),c(a,r));a=h>t?"D":"C";var d=Math.abs(h-t);return l(function(e,t){return t.cols-e}(h>t?e:u,n)+(d-1)*n.cols+1+((h>t?u:e)-1),c(a,r))}},244:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.AddonManager=void 0;var n=function(){function e(){this._addons=[]}return e.prototype.dispose=function(){for(var e=this._addons.length-1;e>=0;e--)this._addons[e].instance.dispose()},e.prototype.loadAddon=function(e,t){var n=this,r={instance:t,dispose:t.dispose,isDisposed:!1};this._addons.push(r),t.dispose=function(){return n._wrappedAddonDispose(r)},t.activate(e)},e.prototype._wrappedAddonDispose=function(e){if(!e.isDisposed){for(var t=-1,n=0;n=this._line.length))return t?(this._line.loadCell(e,t),t):this._line.loadCell(e,new r.CellData)},e.prototype.translateToString=function(e,t,n){return this._line.translateToString(e,t,n)},e}(),d=function(){function e(e){this._core=e}return e.prototype.registerCsiHandler=function(e,t){return this._core.addCsiHandler(e,function(e){return t(e.toArray())})},e.prototype.addCsiHandler=function(e,t){return this.registerCsiHandler(e,t)},e.prototype.registerDcsHandler=function(e,t){return this._core.addDcsHandler(e,function(e,n){return t(e,n.toArray())})},e.prototype.addDcsHandler=function(e,t){return this.registerDcsHandler(e,t)},e.prototype.registerEscHandler=function(e,t){return this._core.addEscHandler(e,t)},e.prototype.addEscHandler=function(e,t){return this.registerEscHandler(e,t)},e.prototype.registerOscHandler=function(e,t){return this._core.addOscHandler(e,t)},e.prototype.addOscHandler=function(e,t){return this.registerOscHandler(e,t)},e}(),f=function(){function e(e){this._core=e}return e.prototype.register=function(e){this._core.unicodeService.register(e)},Object.defineProperty(e.prototype,"versions",{get:function(){return this._core.unicodeService.versions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"activeVersion",{get:function(){return this._core.unicodeService.activeVersion},set:function(e){this._core.unicodeService.activeVersion=e},enumerable:!1,configurable:!0}),e}()},1546:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRenderLayer=void 0;var r=n(643),i=n(8803),o=n(1420),a=n(3734),s=n(1752),c=n(4774),l=n(9631),u=function(){function e(e,t,n,r,i,o,a,s){this._container=e,this._alpha=r,this._colors=i,this._rendererId=o,this._bufferService=a,this._optionsService=s,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._currentGlyphIdentifier={chars:"",code:0,bg:0,fg:0,bold:!1,dim:!1,italic:!1},this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-"+t+"-layer"),this._canvas.style.zIndex=n.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}return e.prototype.dispose=function(){var e;l.removeElementFromParent(this._canvas),null===(e=this._charAtlas)||void 0===e||e.dispose()},e.prototype._initCanvas=function(){this._ctx=s.throwIfFalsy(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()},e.prototype.onOptionsChanged=function(){},e.prototype.onBlur=function(){},e.prototype.onFocus=function(){},e.prototype.onCursorMove=function(){},e.prototype.onGridChanged=function(e,t){},e.prototype.onSelectionChanged=function(e,t,n){void 0===n&&(n=!1)},e.prototype.setColors=function(e){this._refreshCharAtlas(e)},e.prototype._setTransparency=function(e){if(e!==this._alpha){var t=this._canvas;this._alpha=e,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,t),this._refreshCharAtlas(this._colors),this.onGridChanged(0,this._bufferService.rows-1)}},e.prototype._refreshCharAtlas=function(e){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=o.acquireCharAtlas(this._optionsService.options,this._rendererId,e,this._scaledCharWidth,this._scaledCharHeight),this._charAtlas.warmUp())},e.prototype.resize=function(e){this._scaledCellWidth=e.scaledCellWidth,this._scaledCellHeight=e.scaledCellHeight,this._scaledCharWidth=e.scaledCharWidth,this._scaledCharHeight=e.scaledCharHeight,this._scaledCharLeft=e.scaledCharLeft,this._scaledCharTop=e.scaledCharTop,this._canvas.width=e.scaledCanvasWidth,this._canvas.height=e.scaledCanvasHeight,this._canvas.style.width=e.canvasWidth+"px",this._canvas.style.height=e.canvasHeight+"px",this._alpha||this._clearAll(),this._refreshCharAtlas(this._colors)},e.prototype._fillCells=function(e,t,n,r){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,n*this._scaledCellWidth,r*this._scaledCellHeight)},e.prototype._fillBottomLineAtCells=function(e,t,n){void 0===n&&(n=1),this._ctx.fillRect(e*this._scaledCellWidth,(t+1)*this._scaledCellHeight-window.devicePixelRatio-1,n*this._scaledCellWidth,window.devicePixelRatio)},e.prototype._fillLeftLineAtCell=function(e,t,n){this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,window.devicePixelRatio*n,this._scaledCellHeight)},e.prototype._strokeRectAtCell=function(e,t,n,r){this._ctx.lineWidth=window.devicePixelRatio,this._ctx.strokeRect(e*this._scaledCellWidth+window.devicePixelRatio/2,t*this._scaledCellHeight+window.devicePixelRatio/2,n*this._scaledCellWidth-window.devicePixelRatio,r*this._scaledCellHeight-window.devicePixelRatio)},e.prototype._clearAll=function(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))},e.prototype._clearCells=function(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._scaledCellWidth,t*this._scaledCellHeight,n*this._scaledCellWidth,r*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(e*this._scaledCellWidth,t*this._scaledCellHeight,n*this._scaledCellWidth,r*this._scaledCellHeight))},e.prototype._fillCharTrueColor=function(e,t,n){this._ctx.font=this._getFont(!1,!1),this._ctx.textBaseline="middle",this._clipRow(n),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,n*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2)},e.prototype._drawChars=function(e,t,n){var o,a,s=this._getContrastColor(e);s||e.isFgRGB()||e.isBgRGB()?this._drawUncachedChars(e,t,n,s):(e.isInverse()?(o=e.isBgDefault()?i.INVERTED_DEFAULT_COLOR:e.getBgColor(),a=e.isFgDefault()?i.INVERTED_DEFAULT_COLOR:e.getFgColor()):(a=e.isBgDefault()?r.DEFAULT_COLOR:e.getBgColor(),o=e.isFgDefault()?r.DEFAULT_COLOR:e.getFgColor()),o+=this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8?8:0,this._currentGlyphIdentifier.chars=e.getChars()||r.WHITESPACE_CELL_CHAR,this._currentGlyphIdentifier.code=e.getCode()||r.WHITESPACE_CELL_CODE,this._currentGlyphIdentifier.bg=a,this._currentGlyphIdentifier.fg=o,this._currentGlyphIdentifier.bold=!!e.isBold(),this._currentGlyphIdentifier.dim=!!e.isDim(),this._currentGlyphIdentifier.italic=!!e.isItalic(),this._charAtlas&&this._charAtlas.draw(this._ctx,this._currentGlyphIdentifier,t*this._scaledCellWidth+this._scaledCharLeft,n*this._scaledCellHeight+this._scaledCharTop)||this._drawUncachedChars(e,t,n))},e.prototype._drawUncachedChars=function(e,t,n,r){if(this._ctx.save(),this._ctx.font=this._getFont(!!e.isBold(),!!e.isItalic()),this._ctx.textBaseline="middle",e.isInverse())if(r)this._ctx.fillStyle=r.css;else if(e.isBgDefault())this._ctx.fillStyle=c.color.opaque(this._colors.background).css;else if(e.isBgRGB())this._ctx.fillStyle="rgb("+a.AttributeData.toColorRGB(e.getBgColor()).join(",")+")";else{var o=e.getBgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&o<8&&(o+=8),this._ctx.fillStyle=this._colors.ansi[o].css}else if(r)this._ctx.fillStyle=r.css;else if(e.isFgDefault())this._ctx.fillStyle=this._colors.foreground.css;else if(e.isFgRGB())this._ctx.fillStyle="rgb("+a.AttributeData.toColorRGB(e.getFgColor()).join(",")+")";else{var s=e.getFgColor();this._optionsService.options.drawBoldTextInBrightColors&&e.isBold()&&s<8&&(s+=8),this._ctx.fillStyle=this._colors.ansi[s].css}this._clipRow(n),e.isDim()&&(this._ctx.globalAlpha=i.DIM_OPACITY),this._ctx.fillText(e.getChars(),t*this._scaledCellWidth+this._scaledCharLeft,n*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight/2),this._ctx.restore()},e.prototype._clipRow=function(e){this._ctx.beginPath(),this._ctx.rect(0,e*this._scaledCellHeight,this._bufferService.cols*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()},e.prototype._getFont=function(e,t){return(t?"italic":"")+" "+(e?this._optionsService.options.fontWeightBold:this._optionsService.options.fontWeight)+" "+this._optionsService.options.fontSize*window.devicePixelRatio+"px "+this._optionsService.options.fontFamily},e.prototype._getContrastColor=function(e){if(1!==this._optionsService.options.minimumContrastRatio){var t=this._colors.contrastCache.getColor(e.bg,e.fg);if(void 0!==t)return t||void 0;var n=e.getFgColor(),r=e.getFgColorMode(),i=e.getBgColor(),o=e.getBgColorMode(),a=!!e.isInverse(),s=!!e.isInverse();if(a){var l=n;n=i,i=l;var u=r;r=o,o=u}var h=this._resolveBackgroundRgba(o,i,a),d=this._resolveForegroundRgba(r,n,a,s),f=c.rgba.ensureContrastRatio(h,d,this._optionsService.options.minimumContrastRatio);if(f){var p={css:c.channels.toCss(f>>24&255,f>>16&255,f>>8&255),rgba:f};return this._colors.contrastCache.setColor(e.bg,e.fg,p),p}this._colors.contrastCache.setColor(e.bg,e.fg,null)}},e.prototype._resolveBackgroundRgba=function(e,t,n){switch(e){case 16777216:case 33554432:return this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return n?this._colors.foreground.rgba:this._colors.background.rgba}},e.prototype._resolveForegroundRgba=function(e,t,n,r){switch(e){case 16777216:case 33554432:return this._optionsService.options.drawBoldTextInBrightColors&&r&&t<8&&(t+=8),this._colors.ansi[t].rgba;case 50331648:return t<<8;case 0:default:return n?this._colors.background.rgba:this._colors.foreground.rgba}},e}();t.BaseRenderLayer=u},5879:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterJoinerRegistry=t.JoinedCellData=void 0;var o=n(3734),a=n(643),s=n(511),c=function(e){function t(t,n,r){var i=e.call(this)||this;return i.content=0,i.combinedData="",i.fg=t.fg,i.bg=t.bg,i.combinedData=n,i._width=r,i}return i(t,e),t.prototype.isCombined=function(){return 2097152},t.prototype.getWidth=function(){return this._width},t.prototype.getChars=function(){return this.combinedData},t.prototype.getCode=function(){return 2097151},t.prototype.setFromCharData=function(e){throw new Error("not implemented")},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(o.AttributeData);t.JoinedCellData=c;var l=function(){function e(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new s.CellData}return e.prototype.registerCharacterJoiner=function(e){var t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id},e.prototype.deregisterCharacterJoiner=function(e){for(var t=0;t1)for(var h=this._getJoinedRanges(r,s,o,t,i),d=0;d1)for(h=this._getJoinedRanges(r,s,o,t,i),d=0;d=this._bufferService.rows)this._clearCursor();else{var r=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1);if(this._bufferService.buffer.lines.get(t).loadCell(r,this._cell),void 0!==this._cell.content){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;var i=this._optionsService.options.cursorStyle;return i&&"block"!==i?this._cursorRenderers[i](r,n,this._cell):this._renderBlurCursor(r,n,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=n,this._state.isFocused=!1,this._state.style=i,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===r&&this._state.y===n&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===this._optionsService.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[this._optionsService.options.cursorStyle||"block"](r,n,this._cell),this._ctx.restore(),this._state.x=r,this._state.y=n,this._state.isFocused=!1,this._state.style=this._optionsService.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}}else this._clearCursor()},t.prototype._clearCursor=function(){this._state&&(this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})},t.prototype._renderBarCursor=function(e,t,n){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(e,t,this._optionsService.options.cursorWidth),this._ctx.restore()},t.prototype._renderBlockCursor=function(e,t,n){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(e,t,n.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(n,e,t),this._ctx.restore()},t.prototype._renderUnderlineCursor=function(e,t,n){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(e,t),this._ctx.restore()},t.prototype._renderBlurCursor=function(e,t,n){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(e,t,n.getWidth(),1),this._ctx.restore()},t}(o.BaseRenderLayer);t.CursorRenderLayer=c;var l=function(){function e(e,t){this._renderCallback=t,this.isCursorVisible=!0,e&&this._restartInterval()}return Object.defineProperty(e.prototype,"isPaused",{get:function(){return!(this._blinkStartTimeout||this._blinkInterval)},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.restartBlinkAnimation=function(){var e=this;this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=window.requestAnimationFrame(function(){e._renderCallback(),e._animationFrame=void 0})))},e.prototype._restartInterval=function(e){var t=this;void 0===e&&(e=s),this._blinkInterval&&window.clearInterval(this._blinkInterval),this._blinkStartTimeout=window.setTimeout(function(){if(t._animationTimeRestarted){var e=s-(Date.now()-t._animationTimeRestarted);if(t._animationTimeRestarted=void 0,e>0)return void t._restartInterval(e)}t.isCursorVisible=!1,t._animationFrame=window.requestAnimationFrame(function(){t._renderCallback(),t._animationFrame=void 0}),t._blinkInterval=window.setInterval(function(){if(t._animationTimeRestarted){var e=s-(Date.now()-t._animationTimeRestarted);return t._animationTimeRestarted=void 0,void t._restartInterval(e)}t.isCursorVisible=!t.isCursorVisible,t._animationFrame=window.requestAnimationFrame(function(){t._renderCallback(),t._animationFrame=void 0})},s)},e)},e.prototype.pause=function(){this.isCursorVisible=!0,this._blinkInterval&&(window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)},e.prototype.resume=function(){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation()},e}()},3700:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.GridCache=void 0;var n=function(){function e(){this.cache=[]}return e.prototype.resize=function(e,t){for(var n=0;n0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}},t.prototype._onShowLinkUnderline=function(e){if(this._ctx.fillStyle=e.fg===a.INVERTED_DEFAULT_COLOR?this._colors.background.css:e.fg&&s.is256Color(e.fg)?this._colors.ansi[e.fg].css:this._colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(var t=e.y1+1;t=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.Renderer=void 0;var s=n(9596),c=n(4149),l=n(2512),u=n(5098),h=n(5879),d=n(844),f=n(4725),p=n(2585),m=n(1420),g=n(8460),v=1,b=function(e){function t(t,n,r,i,o,a,d,f,p){var m=e.call(this)||this;m._colors=t,m._screenElement=n,m._bufferService=o,m._charSizeService=a,m._optionsService=d,m._id=v++,m._onRequestRedraw=new g.EventEmitter;var b=m._optionsService.options.allowTransparency;return m._characterJoinerRegistry=new h.CharacterJoinerRegistry(m._bufferService),m._renderLayers=[new s.TextRenderLayer(m._screenElement,0,m._colors,m._characterJoinerRegistry,b,m._id,m._bufferService,d),new c.SelectionRenderLayer(m._screenElement,1,m._colors,m._id,m._bufferService,d),new u.LinkRenderLayer(m._screenElement,2,m._colors,m._id,r,i,m._bufferService,d),new l.CursorRenderLayer(m._screenElement,3,m._colors,m._id,m._onRequestRedraw,m._bufferService,d,f,p)],m.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},m._devicePixelRatio=window.devicePixelRatio,m._updateDimensions(),m.onOptionsChanged(),m}return i(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRequestRedraw.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){for(var t=0,n=this._renderLayers;t=this._bufferService.rows||a<0)this._state.ydisp=this._bufferService.buffer.ydisp;else{if(this._ctx.fillStyle=this._colors.selectionTransparent.css,n){var s=e[0];this._fillCells(s,o,t[0]-s,a-o+1)}else{this._fillCells(s=r===o?e[0]:0,o,(o===i?t[0]:this._bufferService.cols)-s,1);var c=Math.max(a-o-1,0);this._fillCells(0,o+1,this._bufferService.cols,c),o!==a&&this._fillCells(0,a,i===a?t[0]:this._bufferService.cols,1)}this._state.start=[e[0],e[1]],this._state.end=[t[0],t[1]],this._state.columnSelectMode=n,this._state.ydisp=this._bufferService.buffer.ydisp}}else this._clearState()},t.prototype._didStateChange=function(e,t,n,r){return!this._areCoordinatesEqual(e,this._state.start)||!this._areCoordinatesEqual(t,this._state.end)||n!==this._state.columnSelectMode||r!==this._state.ydisp},t.prototype._areCoordinatesEqual=function(e,t){return!(!e||!t)&&e[0]===t[0]&&e[1]===t[1]},t}(n(1546).BaseRenderLayer);t.SelectionRenderLayer=o},9596:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.TextRenderLayer=void 0;var o=n(3700),a=n(1546),s=n(3734),c=n(643),l=n(5879),u=n(511),h=function(e){function t(t,n,r,i,a,s,c,l){var h=e.call(this,t,"text",n,a,r,s,c,l)||this;return h._characterWidth=0,h._characterFont="",h._characterOverlapCache={},h._workCell=new u.CellData,h._state=new o.GridCache,h._characterJoinerRegistry=i,h}return i(t,e),t.prototype.resize=function(t){e.prototype.resize.call(this,t);var n=this._getFont(!1,!1);this._characterWidth===t.scaledCharWidth&&this._characterFont===n||(this._characterWidth=t.scaledCharWidth,this._characterFont=n,this._characterOverlapCache={}),this._state.clear(),this._state.resize(this._bufferService.cols,this._bufferService.rows)},t.prototype.reset=function(){this._state.clear(),this._clearAll()},t.prototype._forEachCell=function(e,t,n,r){for(var i=e;i<=t;i++)for(var o=i+this._bufferService.buffer.ydisp,a=this._bufferService.buffer.lines.get(o),s=n?n.getJoinedCharacters(o):[],u=0;u0&&u===s[0][0]){d=!0;var p=s.shift();h=new l.JoinedCellData(this._workCell,a.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1}!d&&this._isOverlapping(h)&&fthis._characterWidth;return this._ctx.restore(),this._characterOverlapCache[t]=n,n},t}(a.BaseRenderLayer);t.TextRenderLayer=h},9616:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.BaseCharAtlas=void 0;var n=function(){function e(){this._didWarmUp=!1}return e.prototype.dispose=function(){},e.prototype.warmUp=function(){this._didWarmUp||(this._doWarmUp(),this._didWarmUp=!0)},e.prototype._doWarmUp=function(){},e.prototype.beginFrame=function(){},e}();t.BaseCharAtlas=n},1420:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.removeTerminalFromCache=t.acquireCharAtlas=void 0;var r=n(2040),i=n(1906),o=[];t.acquireCharAtlas=function(e,t,n,a,s){for(var c=r.generateConfig(a,s,e,n),l=0;l=0){if(r.configEquals(h.config,c))return h.atlas;1===h.ownedBy.length?(h.atlas.dispose(),o.splice(l,1)):h.ownedBy.splice(u,1);break}}for(l=0;l>>24,i=t.rgba>>>16&255,o=t.rgba>>>8&255,a=0;a=this.capacity)this._unlinkNode(n=this._head),delete this._map[n.key],n.key=e,n.value=t,this._map[e]=n;else{var r=this._nodePool;r.length>0?((n=r.pop()).key=e,n.value=t):n={prev:null,next:null,key:e,value:t},this._map[e]=n,this.size++}this._appendNode(n)},e}();t.LRUMap=n},1296:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DomRenderer=void 0;var s=n(3787),c=n(8803),l=n(844),u=n(4725),h=n(2585),d=n(8460),f=n(4774),p=n(9631),m="xterm-dom-renderer-owner-",g="xterm-fg-",v="xterm-bg-",b="xterm-focus",y=1,_=function(e){function t(t,n,r,i,o,a,c,l,u){var h=e.call(this)||this;return h._colors=t,h._element=n,h._screenElement=r,h._viewportElement=i,h._linkifier=o,h._linkifier2=a,h._charSizeService=c,h._optionsService=l,h._bufferService=u,h._terminalClass=y++,h._rowElements=[],h._rowContainer=document.createElement("div"),h._rowContainer.classList.add("xterm-rows"),h._rowContainer.style.lineHeight="normal",h._rowContainer.setAttribute("aria-hidden","true"),h._refreshRowElements(h._bufferService.cols,h._bufferService.rows),h._selectionContainer=document.createElement("div"),h._selectionContainer.classList.add("xterm-selection"),h._selectionContainer.setAttribute("aria-hidden","true"),h.dimensions={scaledCharWidth:0,scaledCharHeight:0,scaledCellWidth:0,scaledCellHeight:0,scaledCharLeft:0,scaledCharTop:0,scaledCanvasWidth:0,scaledCanvasHeight:0,canvasWidth:0,canvasHeight:0,actualCellWidth:0,actualCellHeight:0},h._updateDimensions(),h._injectCss(),h._rowFactory=new s.DomRendererRowFactory(document,h._optionsService,h._colors),h._element.classList.add(m+h._terminalClass),h._screenElement.appendChild(h._rowContainer),h._screenElement.appendChild(h._selectionContainer),h._linkifier.onShowLinkUnderline(function(e){return h._onLinkHover(e)}),h._linkifier.onHideLinkUnderline(function(e){return h._onLinkLeave(e)}),h._linkifier2.onShowLinkUnderline(function(e){return h._onLinkHover(e)}),h._linkifier2.onHideLinkUnderline(function(e){return h._onLinkLeave(e)}),h}return i(t,e),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return(new d.EventEmitter).event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._element.classList.remove(m+this._terminalClass),p.removeElementFromParent(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),e.prototype.dispose.call(this)},t.prototype._updateDimensions=function(){this.dimensions.scaledCharWidth=this._charSizeService.width*window.devicePixelRatio,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*window.devicePixelRatio),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.options.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.options.lineHeight),this.dimensions.scaledCharLeft=0,this.dimensions.scaledCharTop=0,this.dimensions.scaledCanvasWidth=this.dimensions.scaledCellWidth*this._bufferService.cols,this.dimensions.scaledCanvasHeight=this.dimensions.scaledCellHeight*this._bufferService.rows,this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/window.devicePixelRatio),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/window.devicePixelRatio),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(var e=0,t=this._rowElements;et;)this._rowContainer.removeChild(this._rowElements.pop())},t.prototype.onResize=function(e,t){this._refreshRowElements(e,t),this._updateDimensions()},t.prototype.onCharSizeChanged=function(){this._updateDimensions()},t.prototype.onBlur=function(){this._rowContainer.classList.remove(b)},t.prototype.onFocus=function(){this._rowContainer.classList.add(b)},t.prototype.onSelectionChanged=function(e,t,n){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(e&&t){var r=e[1]-this._bufferService.buffer.ydisp,i=t[1]-this._bufferService.buffer.ydisp,o=Math.max(r,0),a=Math.min(i,this._bufferService.rows-1);if(!(o>=this._bufferService.rows||a<0)){var s=document.createDocumentFragment();n?s.appendChild(this._createSelectionElement(o,e[0],t[0],a-o+1)):(s.appendChild(this._createSelectionElement(o,r===o?e[0]:0,o===i?t[0]:this._bufferService.cols)),s.appendChild(this._createSelectionElement(o+1,0,this._bufferService.cols,a-o-1)),o!==a&&s.appendChild(this._createSelectionElement(a,0,i===a?t[0]:this._bufferService.cols))),this._selectionContainer.appendChild(s)}}},t.prototype._createSelectionElement=function(e,t,n,r){void 0===r&&(r=1);var i=document.createElement("div");return i.style.height=r*this.dimensions.actualCellHeight+"px",i.style.top=e*this.dimensions.actualCellHeight+"px",i.style.left=t*this.dimensions.actualCellWidth+"px",i.style.width=this.dimensions.actualCellWidth*(n-t)+"px",i},t.prototype.onCursorMove=function(){},t.prototype.onOptionsChanged=function(){this._updateDimensions(),this._injectCss()},t.prototype.clear=function(){for(var e=0,t=this._rowElements;e=i&&(e=0,n++)}},o([a(6,u.ICharSizeService),a(7,h.IOptionsService),a(8,h.IBufferService)],t)}(l.Disposable);t.DomRenderer=_},3787:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DomRendererRowFactory=t.CURSOR_STYLE_UNDERLINE_CLASS=t.CURSOR_STYLE_BAR_CLASS=t.CURSOR_STYLE_BLOCK_CLASS=t.CURSOR_BLINK_CLASS=t.CURSOR_CLASS=t.UNDERLINE_CLASS=t.ITALIC_CLASS=t.DIM_CLASS=t.BOLD_CLASS=void 0;var r=n(8803),i=n(643),o=n(511),a=n(4774);t.BOLD_CLASS="xterm-bold",t.DIM_CLASS="xterm-dim",t.ITALIC_CLASS="xterm-italic",t.UNDERLINE_CLASS="xterm-underline",t.CURSOR_CLASS="xterm-cursor",t.CURSOR_BLINK_CLASS="xterm-cursor-blink",t.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",t.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",t.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";var s=function(){function e(e,t,n){this._document=e,this._optionsService=t,this._colors=n,this._workCell=new o.CellData}return e.prototype.setColors=function(e){this._colors=e},e.prototype.createRow=function(e,n,o,s,l,u,h){for(var d=this._document.createDocumentFragment(),f=0,p=Math.min(e.length,h)-1;p>=0;p--)if(e.loadCell(p,this._workCell).getCode()!==i.NULL_CELL_CODE||n&&p===s){f=p+1;break}for(p=0;p1&&(g.style.width=u*m+"px"),n&&p===s)switch(g.classList.add(t.CURSOR_CLASS),l&&g.classList.add(t.CURSOR_BLINK_CLASS),o){case"bar":g.classList.add(t.CURSOR_STYLE_BAR_CLASS);break;case"underline":g.classList.add(t.CURSOR_STYLE_UNDERLINE_CLASS);break;default:g.classList.add(t.CURSOR_STYLE_BLOCK_CLASS)}this._workCell.isBold()&&g.classList.add(t.BOLD_CLASS),this._workCell.isItalic()&&g.classList.add(t.ITALIC_CLASS),this._workCell.isDim()&&g.classList.add(t.DIM_CLASS),this._workCell.isUnderline()&&g.classList.add(t.UNDERLINE_CLASS),g.textContent=this._workCell.isInvisible()?i.WHITESPACE_CELL_CHAR:this._workCell.getChars()||i.WHITESPACE_CELL_CHAR;var v=this._workCell.getFgColor(),b=this._workCell.getFgColorMode(),y=this._workCell.getBgColor(),_=this._workCell.getBgColorMode(),w=!!this._workCell.isInverse();if(w){var k=v;v=y,y=k;var C=b;b=_,_=C}switch(b){case 16777216:case 33554432:this._workCell.isBold()&&v<8&&this._optionsService.options.drawBoldTextInBrightColors&&(v+=8),this._applyMinimumContrast(g,this._colors.background,this._colors.ansi[v])||g.classList.add("xterm-fg-"+v);break;case 50331648:var S=a.rgba.toColor(v>>16&255,v>>8&255,255&v);this._applyMinimumContrast(g,this._colors.background,S)||this._addStyle(g,"color:#"+c(v.toString(16),"0",6));break;case 0:default:this._applyMinimumContrast(g,this._colors.background,this._colors.foreground)||w&&g.classList.add("xterm-fg-"+r.INVERTED_DEFAULT_COLOR)}switch(_){case 16777216:case 33554432:g.classList.add("xterm-bg-"+y);break;case 50331648:this._addStyle(g,"background-color:#"+c(y.toString(16),"0",6));break;case 0:default:w&&g.classList.add("xterm-bg-"+r.INVERTED_DEFAULT_COLOR)}d.appendChild(g)}}return d},e.prototype._applyMinimumContrast=function(e,t,n){if(1===this._optionsService.options.minimumContrastRatio)return!1;var r=this._colors.contrastCache.getColor(this._workCell.bg,this._workCell.fg);return void 0===r&&(r=a.color.ensureContrastRatio(t,n,this._optionsService.options.minimumContrastRatio),this._colors.contrastCache.setColor(this._workCell.bg,this._workCell.fg,null!=r?r:null)),!!r&&(this._addStyle(e,"color:"+r.css),!0)},e.prototype._addStyle=function(e,t){e.setAttribute("style",""+(e.getAttribute("style")||"")+t+";")},e}();function c(e,t,n){for(;e.lengththis._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}return this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]?[Math.max(this.selectionStart[0]+this.selectionStartLength,this.selectionEnd[0]),this.selectionEnd[1]]:this.selectionEnd}},enumerable:!1,configurable:!0}),e.prototype.areSelectionValuesReversed=function(){var e=this.selectionStart,t=this.selectionEnd;return!(!e||!t)&&(e[1]>t[1]||e[1]===t[1]&&e[0]>t[0])},e.prototype.onTrim=function(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)},e}();t.SelectionModel=n},428:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CharSizeService=void 0;var o=n(2585),a=n(8460),s=function(){function e(e,t,n){this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=new a.EventEmitter,this._measureStrategy=new c(e,t,this._optionsService)}return Object.defineProperty(e.prototype,"hasValidSize",{get:function(){return this.width>0&&this.height>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onCharSizeChange",{get:function(){return this._onCharSizeChange.event},enumerable:!1,configurable:!0}),e.prototype.measure=function(){var e=this._measureStrategy.measure();e.width===this.width&&e.height===this.height||(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())},r([i(2,o.IOptionsService)],e)}();t.CharSizeService=s;var c=function(){function e(e,t,n){this._document=e,this._parentElement=t,this._optionsService=n,this._result={width:0,height:0},this._measureElement=this._document.createElement("span"),this._measureElement.classList.add("xterm-char-measure-element"),this._measureElement.textContent="W",this._measureElement.setAttribute("aria-hidden","true"),this._parentElement.appendChild(this._measureElement)}return e.prototype.measure=function(){this._measureElement.style.fontFamily=this._optionsService.options.fontFamily,this._measureElement.style.fontSize=this._optionsService.options.fontSize+"px";var e=this._measureElement.getBoundingClientRect();return 0!==e.width&&0!==e.height&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result},e}()},5114:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.CoreBrowserService=void 0;var n=function(){function e(e){this._textarea=e}return Object.defineProperty(e.prototype,"isFocused",{get:function(){return(this._textarea.getRootNode?this._textarea.getRootNode():document).activeElement===this._textarea&&document.hasFocus()},enumerable:!1,configurable:!0}),e}();t.CoreBrowserService=n},8934:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.MouseService=void 0;var o=n(4725),a=n(9806),s=function(){function e(e,t){this._renderService=e,this._charSizeService=t}return e.prototype.getCoords=function(e,t,n,r,i){return a.getCoords(e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,i)},e.prototype.getRawByteCoords=function(e,t,n,r){var i=this.getCoords(e,t,n,r);return a.getRawByteCoords(i)},r([i(0,o.IRenderService),i(1,o.ICharSizeService)],e)}();t.MouseService=s},3230:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.RenderService=void 0;var s=n(6193),c=n(8460),l=n(844),u=n(5596),h=n(3656),d=n(2585),f=n(4725),p=function(e){function t(t,n,r,i,o,a){var l=e.call(this)||this;if(l._renderer=t,l._rowCount=n,l._charSizeService=o,l._isPaused=!1,l._needsFullRefresh=!1,l._isNextRenderRedrawOnly=!0,l._needsSelectionRefresh=!1,l._canvasWidth=0,l._canvasHeight=0,l._selectionState={start:void 0,end:void 0,columnSelectMode:!1},l._onDimensionsChange=new c.EventEmitter,l._onRender=new c.EventEmitter,l._onRefreshRequest=new c.EventEmitter,l.register({dispose:function(){return l._renderer.dispose()}}),l._renderDebouncer=new s.RenderDebouncer(function(e,t){return l._renderRows(e,t)}),l.register(l._renderDebouncer),l._screenDprMonitor=new u.ScreenDprMonitor,l._screenDprMonitor.setListener(function(){return l.onDevicePixelRatioChange()}),l.register(l._screenDprMonitor),l.register(a.onResize(function(e){return l._fullRefresh()})),l.register(i.onOptionChange(function(){return l._renderer.onOptionsChanged()})),l.register(l._charSizeService.onCharSizeChange(function(){return l.onCharSizeChanged()})),l._renderer.onRequestRedraw(function(e){return l.refreshRows(e.start,e.end,!0)}),l.register(h.addDisposableDomListener(window,"resize",function(){return l.onDevicePixelRatioChange()})),"IntersectionObserver"in window){var d=new IntersectionObserver(function(e){return l._onIntersectionChange(e[e.length-1])},{threshold:0});d.observe(r),l.register({dispose:function(){return d.disconnect()}})}return l}return i(t,e),Object.defineProperty(t.prototype,"onDimensionsChange",{get:function(){return this._onDimensionsChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRenderedBufferChange",{get:function(){return this._onRender.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRefreshRequest",{get:function(){return this._onRefreshRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dimensions",{get:function(){return this._renderer.dimensions},enumerable:!1,configurable:!0}),t.prototype._onIntersectionChange=function(e){this._isPaused=void 0===e.isIntersecting?0===e.intersectionRatio:!e.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)},t.prototype.refreshRows=function(e,t,n){void 0===n&&(n=!1),this._isPaused?this._needsFullRefresh=!0:(n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount))},t.prototype._renderRows=function(e,t){this._renderer.renderRows(e,t),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0},t.prototype.resize=function(e,t){this._rowCount=t,this._fireOnCanvasResize()},t.prototype.changeOptions=function(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()},t.prototype._fireOnCanvasResize=function(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)},t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.setRenderer=function(e){var t=this;this._renderer.dispose(),this._renderer=e,this._renderer.onRequestRedraw(function(e){return t.refreshRows(e.start,e.end,!0)}),this._needsSelectionRefresh=!0,this._fullRefresh()},t.prototype._fullRefresh=function(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)},t.prototype.setColors=function(e){this._renderer.setColors(e),this._fullRefresh()},t.prototype.onDevicePixelRatioChange=function(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)},t.prototype.onResize=function(e,t){this._renderer.onResize(e,t),this._fullRefresh()},t.prototype.onCharSizeChanged=function(){this._renderer.onCharSizeChanged()},t.prototype.onBlur=function(){this._renderer.onBlur()},t.prototype.onFocus=function(){this._renderer.onFocus()},t.prototype.onSelectionChanged=function(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.onSelectionChanged(e,t,n)},t.prototype.onCursorMove=function(){this._renderer.onCursorMove()},t.prototype.clear=function(){this._renderer.clear()},t.prototype.registerCharacterJoiner=function(e){return this._renderer.registerCharacterJoiner(e)},t.prototype.deregisterCharacterJoiner=function(e){return this._renderer.deregisterCharacterJoiner(e)},o([a(3,d.IOptionsService),a(4,f.ICharSizeService),a(5,d.IBufferService)],t)}(l.Disposable);t.RenderService=p},9312:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SelectionService=void 0;var s=n(6114),c=n(456),l=n(511),u=n(8460),h=n(4725),d=n(2585),f=n(9806),p=n(9504),m=n(844),g=String.fromCharCode(160),v=new RegExp(g,"g"),b=function(e){function t(t,n,r,i,o,a,s){var h=e.call(this)||this;return h._element=t,h._screenElement=n,h._bufferService=r,h._coreService=i,h._mouseService=o,h._optionsService=a,h._renderService=s,h._dragScrollAmount=0,h._enabled=!0,h._workCell=new l.CellData,h._mouseDownTimeStamp=0,h._oldHasSelection=!1,h._oldSelectionStart=void 0,h._oldSelectionEnd=void 0,h._onLinuxMouseSelection=h.register(new u.EventEmitter),h._onRedrawRequest=h.register(new u.EventEmitter),h._onSelectionChange=h.register(new u.EventEmitter),h._onRequestScrollLines=h.register(new u.EventEmitter),h._mouseMoveListener=function(e){return h._onMouseMove(e)},h._mouseUpListener=function(e){return h._onMouseUp(e)},h._coreService.onUserInput(function(){h.hasSelection&&h.clearSelection()}),h._trimListener=h._bufferService.buffer.lines.onTrim(function(e){return h._onTrim(e)}),h.register(h._bufferService.buffers.onBufferActivate(function(e){return h._onBufferActivate(e)})),h.enable(),h._model=new c.SelectionModel(h._bufferService),h._activeSelectionMode=0,h}return i(t,e),Object.defineProperty(t.prototype,"onLinuxMouseSelection",{get:function(){return this._onLinuxMouseSelection.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRedraw",{get:function(){return this._onRedrawRequest.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onSelectionChange",{get:function(){return this._onSelectionChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScrollLines",{get:function(){return this._onRequestScrollLines.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this._removeMouseDownListeners()},t.prototype.reset=function(){this.clearSelection()},t.prototype.disable=function(){this.clearSelection(),this._enabled=!1},t.prototype.enable=function(){this._enabled=!0},Object.defineProperty(t.prototype,"selectionStart",{get:function(){return this._model.finalSelectionStart},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionEnd",{get:function(){return this._model.finalSelectionEnd},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSelection",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!(!e||!t||e[0]===t[0]&&e[1]===t[1])},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"selectionText",{get:function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return"";var n=this._bufferService.buffer,r=[];if(3===this._activeSelectionMode){if(e[0]===t[0])return"";for(var i=e[1];i<=t[1];i++){var o=n.translateBufferLineToString(i,!0,e[0],t[0]);r.push(o)}}else{for(r.push(n.translateBufferLineToString(e[1],!0,e[0],e[1]===t[1]?t[0]:void 0)),i=e[1]+1;i<=t[1]-1;i++){var a=n.lines.get(i);o=n.translateBufferLineToString(i,!0),a&&a.isWrapped?r[r.length-1]+=o:r.push(o)}e[1]!==t[1]&&(a=n.lines.get(t[1]),o=n.translateBufferLineToString(t[1],!0,0,t[0]),a&&a.isWrapped?r[r.length-1]+=o:r.push(o))}return r.map(function(e){return e.replace(v," ")}).join(s.isWindows?"\r\n":"\n")},enumerable:!1,configurable:!0}),t.prototype.clearSelection=function(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()},t.prototype.refresh=function(e){var t=this;this._refreshAnimationFrame||(this._refreshAnimationFrame=window.requestAnimationFrame(function(){return t._refresh()})),s.isLinux&&e&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)},t.prototype._refresh=function(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:3===this._activeSelectionMode})},t.prototype._isClickInSelection=function(e){var t=this._getMouseBufferCoords(e),n=this._model.finalSelectionStart,r=this._model.finalSelectionEnd;return!!(n&&r&&t)&&this._areCoordsInSelection(t,n,r)},t.prototype._areCoordsInSelection=function(e,t,n){return e[1]>t[1]&&e[1]=t[0]&&e[0]=t[0]},t.prototype._selectWordAtCursor=function(e){var t=this._getMouseBufferCoords(e);t&&(this._selectWordAt(t,!1),this._model.selectionEnd=void 0,this.refresh(!0))},t.prototype.selectAll=function(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()},t.prototype.selectLines=function(e,t){this._model.clearSelection(),e=Math.max(e,0),t=Math.min(t,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,e],this._model.selectionEnd=[this._bufferService.cols,t],this.refresh(),this._onSelectionChange.fire()},t.prototype._onTrim=function(e){this._model.onTrim(e)&&this.refresh()},t.prototype._getMouseBufferCoords=function(e){var t=this._mouseService.getCoords(e,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(t)return t[0]--,t[1]--,t[1]+=this._bufferService.buffer.ydisp,t},t.prototype._getMouseEventScrollAmount=function(e){var t=f.getCoordsRelativeToElement(e,this._screenElement)[1],n=this._renderService.dimensions.canvasHeight;return t>=0&&t<=n?0:(t>n&&(t-=n),t=Math.min(Math.max(t,-50),50),(t/=50)/Math.abs(t)+Math.round(14*t))},t.prototype.shouldForceSelection=function(e){return s.isMac?e.altKey&&this._optionsService.options.macOptionClickForcesSelection:e.shiftKey},t.prototype.onMouseDown=function(e){if(this._mouseDownTimeStamp=e.timeStamp,(2!==e.button||!this.hasSelection)&&0===e.button){if(!this._enabled){if(!this.shouldForceSelection(e))return;e.stopPropagation()}e.preventDefault(),this._dragScrollAmount=0,this._enabled&&e.shiftKey?this._onIncrementalClick(e):1===e.detail?this._onSingleClick(e):2===e.detail?this._onDoubleClick(e):3===e.detail&&this._onTripleClick(e),this._addMouseDownListeners(),this.refresh(!0)}},t.prototype._addMouseDownListeners=function(){var e=this;this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=window.setInterval(function(){return e._dragScroll()},50)},t.prototype._removeMouseDownListeners=function(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0},t.prototype._onIncrementalClick=function(e){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(e))},t.prototype._onSingleClick=function(e){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(e)?3:0,this._model.selectionStart=this._getMouseBufferCoords(e),this._model.selectionStart){this._model.selectionEnd=void 0;var t=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);t&&t.length!==this._model.selectionStart[0]&&0===t.hasWidth(this._model.selectionStart[0])&&this._model.selectionStart[0]++}},t.prototype._onDoubleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=1,this._selectWordAt(t,!0))},t.prototype._onTripleClick=function(e){var t=this._getMouseBufferCoords(e);t&&(this._activeSelectionMode=2,this._selectLineAt(t[1]))},t.prototype.shouldColumnSelect=function(e){return e.altKey&&!(s.isMac&&this._optionsService.options.macOptionClickForcesSelection)},t.prototype._onMouseMove=function(e){if(e.stopImmediatePropagation(),this._model.selectionStart){var t=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(e),this._model.selectionEnd){2===this._activeSelectionMode?this._model.selectionEnd[0]=this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));var n=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(e.ydisp+this._bufferService.rows,e.lines.length-1)):(3!==this._activeSelectionMode&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=e.ydisp),this.refresh()}},t.prototype._onMouseUp=function(e){var t=e.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&t<500&&e.altKey&&this._optionsService.getOption("altClickMovesCursor")){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){var n=this._mouseService.getCoords(e,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(n&&void 0!==n[0]&&void 0!==n[1]){var r=p.moveToCellSequence(n[0]-1,n[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(r,!0)}}}else this._fireEventIfSelectionChanged()},t.prototype._fireEventIfSelectionChanged=function(){var e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd,n=!(!e||!t||e[0]===t[0]&&e[1]===t[1]);n?e&&t&&(this._oldSelectionStart&&this._oldSelectionEnd&&e[0]===this._oldSelectionStart[0]&&e[1]===this._oldSelectionStart[1]&&t[0]===this._oldSelectionEnd[0]&&t[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(e,t,n)):this._oldHasSelection&&this._fireOnSelectionChange(e,t,n)},t.prototype._fireOnSelectionChange=function(e,t,n){this._oldSelectionStart=e,this._oldSelectionEnd=t,this._oldHasSelection=n,this._onSelectionChange.fire()},t.prototype._onBufferActivate=function(e){var t=this;this.clearSelection(),this._trimListener.dispose(),this._trimListener=e.activeBuffer.lines.onTrim(function(e){return t._onTrim(e)})},t.prototype._convertViewportColToCharacterIndex=function(e,t){for(var n=t[0],r=0;t[0]>=r;r++){var i=e.loadCell(r,this._workCell).getChars().length;0===this._workCell.getWidth()?n--:i>1&&t[0]!==r&&(n+=i-1)}return n},t.prototype.setSelection=function(e,t,n){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[e,t],this._model.selectionStartLength=n,this.refresh()},t.prototype.rightClickSelect=function(e){this._isClickInSelection(e)||(this._selectWordAtCursor(e),this._fireEventIfSelectionChanged())},t.prototype._getWordAt=function(e,t,n,r){if(void 0===n&&(n=!0),void 0===r&&(r=!0),!(e[0]>=this._bufferService.cols)){var i=this._bufferService.buffer,o=i.lines.get(e[1]);if(o){var a=i.translateBufferLineToString(e[1],!1),s=this._convertViewportColToCharacterIndex(o,e),c=s,l=e[0]-s,u=0,h=0,d=0,f=0;if(" "===a.charAt(s)){for(;s>0&&" "===a.charAt(s-1);)s--;for(;c1&&(f+=g-1,c+=g-1);p>0&&s>0&&!this._isCharWordSeparator(o.loadCell(p-1,this._workCell));){o.loadCell(p-1,this._workCell);var v=this._workCell.getChars().length;0===this._workCell.getWidth()?(u++,p--):v>1&&(d+=v-1,s-=v-1),s--,p--}for(;m1&&(f+=b-1,c+=b-1),c++,m++}}c++;var y=s+l-u+d,_=Math.min(this._bufferService.cols,c-s+u+h-d-f);if(t||""!==a.slice(s,c).trim()){if(n&&0===y&&32!==o.getCodePoint(0)){var w=i.lines.get(e[1]-1);if(w&&o.isWrapped&&32!==w.getCodePoint(this._bufferService.cols-1)){var k=this._getWordAt([this._bufferService.cols-1,e[1]-1],!1,!0,!1);if(k){var C=this._bufferService.cols-k.start;y-=C,_+=C}}}if(r&&y+_===this._bufferService.cols&&32!==o.getCodePoint(this._bufferService.cols-1)){var S=i.lines.get(e[1]+1);if(S&&S.isWrapped&&32!==S.getCodePoint(0)){var x=this._getWordAt([0,e[1]+1],!1,!1,!0);x&&(_+=x.length)}}return{start:y,length:_}}}}},t.prototype._selectWordAt=function(e,t){var n=this._getWordAt(e,t);if(n){for(;n.start<0;)n.start+=this._bufferService.cols,e[1]--;this._model.selectionStart=[n.start,e[1]],this._model.selectionStartLength=n.length}},t.prototype._selectToWordAt=function(e){var t=this._getWordAt(e,!0);if(t){for(var n=e[1];t.start<0;)t.start+=this._bufferService.cols,n--;if(!this._model.areSelectionValuesReversed())for(;t.start+t.length>this._bufferService.cols;)t.length-=this._bufferService.cols,n++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?t.start:t.start+t.length,n]}},t.prototype._isCharWordSeparator=function(e){return 0!==e.getWidth()&&this._optionsService.options.wordSeparator.indexOf(e.getChars())>=0},t.prototype._selectLineAt=function(e){var t=this._bufferService.buffer.getWrappedRangeForLine(e);this._model.selectionStart=[0,t.first],this._model.selectionEnd=[this._bufferService.cols,t.last],this._model.selectionStartLength=0},o([a(2,d.IBufferService),a(3,d.ICoreService),a(4,h.IMouseService),a(5,d.IOptionsService),a(6,h.IRenderService)],t)}(m.Disposable);t.SelectionService=b},4725:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.ISoundService=t.ISelectionService=t.IRenderService=t.IMouseService=t.ICoreBrowserService=t.ICharSizeService=void 0;var r=n(8343);t.ICharSizeService=r.createDecorator("CharSizeService"),t.ICoreBrowserService=r.createDecorator("CoreBrowserService"),t.IMouseService=r.createDecorator("MouseService"),t.IRenderService=r.createDecorator("RenderService"),t.ISelectionService=r.createDecorator("SelectionService"),t.ISoundService=r.createDecorator("SoundService")},357:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.SoundService=void 0;var o=n(2585),a=function(){function e(e){this._optionsService=e}return Object.defineProperty(e,"audioContext",{get:function(){if(!e._audioContext){var t=window.AudioContext||window.webkitAudioContext;if(!t)return console.warn("Web Audio API is not supported by this browser. Consider upgrading to the latest version"),null;e._audioContext=new t}return e._audioContext},enumerable:!1,configurable:!0}),e.prototype.playBellSound=function(){var t=e.audioContext;if(t){var n=t.createBufferSource();t.decodeAudioData(this._base64ToArrayBuffer(this._removeMimeType(this._optionsService.options.bellSound)),function(e){n.buffer=e,n.connect(t.destination),n.start(0)})}},e.prototype._base64ToArrayBuffer=function(e){for(var t=window.atob(e),n=t.length,r=new Uint8Array(n),i=0;ithis._length)for(var t=this._length;t=e;i--)this._array[this._getCyclicIndex(i+n.length)]=this._array[this._getCyclicIndex(i)];for(i=0;ithis._maxLength){var o=this._length+n.length-this._maxLength;this._startIndex+=o,this._length=this._maxLength,this.onTrimEmitter.fire(o)}else this._length+=n.length},e.prototype.trimStart=function(e){e>this._length&&(e=this._length),this._startIndex+=e,this._length-=e,this.onTrimEmitter.fire(e)},e.prototype.shiftElements=function(e,t,n){if(!(t<=0)){if(e<0||e>=this._length)throw new Error("start argument out of range");if(e+n<0)throw new Error("Cannot shift elements in list beyond index 0");if(n>0){for(var r=t-1;r>=0;r--)this.set(e+r+n,this.get(e+r));var i=e+t+n-this._length;if(i>0)for(this._length+=i;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(r=0;r=n.ybase&&(this._bufferService.isUserScrolling=!1);var r=n.ydisp;n.ydisp=Math.max(Math.min(n.ydisp+e,n.ybase),0),r!==n.ydisp&&(t||this._onScroll.fire(n.ydisp))},t.prototype.scrollPages=function(e){this.scrollLines(e*(this.rows-1))},t.prototype.scrollToTop=function(){this.scrollLines(-this._bufferService.buffer.ydisp)},t.prototype.scrollToBottom=function(){this.scrollLines(this._bufferService.buffer.ybase-this._bufferService.buffer.ydisp)},t.prototype.scrollToLine=function(e){var t=e-this._bufferService.buffer.ydisp;0!==t&&this.scrollLines(t)},t.prototype.addEscHandler=function(e,t){return this._inputHandler.addEscHandler(e,t)},t.prototype.addDcsHandler=function(e,t){return this._inputHandler.addDcsHandler(e,t)},t.prototype.addCsiHandler=function(e,t){return this._inputHandler.addCsiHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._inputHandler.addOscHandler(e,t)},t.prototype._setup=function(){this.optionsService.options.windowsMode&&this._enableWindowsMode()},t.prototype.reset=function(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this._coreService.reset(),this._coreMouseService.reset()},t.prototype._updateOptions=function(e){var t;switch(e){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.options.windowsMode?this._enableWindowsMode():(null===(t=this._windowsMode)||void 0===t||t.dispose(),this._windowsMode=void 0)}},t.prototype._enableWindowsMode=function(){var e=this;if(!this._windowsMode){var t=[];t.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),t.push(this.addCsiHandler({final:"H"},function(){return v.updateWindowsModeWrappedState(e._bufferService),!1})),this._windowsMode={dispose:function(){for(var e=0,n=t;e24)return t.setWinLines||!1;switch(e){case 1:return!!t.restoreWin;case 2:return!!t.minimizeWin;case 3:return!!t.setWinPosition;case 4:return!!t.setWinSizePixels;case 5:return!!t.raiseWin;case 6:return!!t.lowerWin;case 7:return!!t.refreshWin;case 8:return!!t.setWinSizeChars;case 9:return!!t.maximizeWin;case 10:return!!t.fullscreenWin;case 11:return!!t.getWinState;case 13:return!!t.getWinPosition;case 14:return!!t.getWinSizePixels;case 15:return!!t.getScreenSizePixels;case 16:return!!t.getCellSizePixels;case 18:return!!t.getWinSizeChars;case 19:return!!t.getScreenSizeChars;case 20:return!!t.getIconTitle;case 21:return!!t.getWinTitle;case 22:return!!t.pushTitle;case 23:return!!t.popTitle;case 24:return!!t.setWinLines}return!1}!function(e){e[e.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",e[e.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"}(o=t.WindowsOptionsReportType||(t.WindowsOptionsReportType={}));var k=function(){function e(e,t,n,r){this._bufferService=e,this._coreService=t,this._logService=n,this._optionsService=r,this._data=new Uint32Array(0)}return e.prototype.hook=function(e){this._data=new Uint32Array(0)},e.prototype.put=function(e,t,n){this._data=u.concat(this._data,e.subarray(t,n))},e.prototype.unhook=function(e){if(!e)return this._data=new Uint32Array(0),!0;var t=h.utf32ToString(this._data);switch(this._data=new Uint32Array(0),t){case'"q':this._coreService.triggerDataEvent(a.C0.ESC+'P1$r0"q'+a.C0.ESC+"\\");break;case'"p':this._coreService.triggerDataEvent(a.C0.ESC+'P1$r61;1"p'+a.C0.ESC+"\\");break;case"r":this._coreService.triggerDataEvent(a.C0.ESC+"P1$r"+(this._bufferService.buffer.scrollTop+1)+";"+(this._bufferService.buffer.scrollBottom+1)+"r"+a.C0.ESC+"\\");break;case"m":this._coreService.triggerDataEvent(a.C0.ESC+"P1$r0m"+a.C0.ESC+"\\");break;case" q":var n={block:2,underline:4,bar:6}[this._optionsService.options.cursorStyle];this._coreService.triggerDataEvent(a.C0.ESC+"P1$r"+(n-=this._optionsService.options.cursorBlink?1:0)+" q"+a.C0.ESC+"\\");break;default:this._logService.debug("Unknown DCS $q %s",t),this._coreService.triggerDataEvent(a.C0.ESC+"P0$r"+a.C0.ESC+"\\")}return!0},e}(),C=function(e){function t(t,n,r,i,o,l,u,p,g){void 0===g&&(g=new c.EscapeSequenceParser);var b=e.call(this)||this;b._bufferService=t,b._charsetService=n,b._coreService=r,b._dirtyRowService=i,b._logService=o,b._optionsService=l,b._coreMouseService=u,b._unicodeService=p,b._parser=g,b._parseBuffer=new Uint32Array(4096),b._stringDecoder=new h.StringToUtf32,b._utf8Decoder=new h.Utf8ToUtf32,b._workCell=new m.CellData,b._windowTitle="",b._iconName="",b._windowTitleStack=[],b._iconNameStack=[],b._curAttrData=d.DEFAULT_ATTR_DATA.clone(),b._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone(),b._onRequestBell=new f.EventEmitter,b._onRequestRefreshRows=new f.EventEmitter,b._onRequestReset=new f.EventEmitter,b._onRequestScroll=new f.EventEmitter,b._onRequestSyncScrollBar=new f.EventEmitter,b._onRequestWindowsOptionsReport=new f.EventEmitter,b._onA11yChar=new f.EventEmitter,b._onA11yTab=new f.EventEmitter,b._onCursorMove=new f.EventEmitter,b._onLineFeed=new f.EventEmitter,b._onScroll=new f.EventEmitter,b._onTitleChange=new f.EventEmitter,b._onAnsiColorChange=new f.EventEmitter,b.register(b._parser),b._parser.setCsiHandlerFallback(function(e,t){b._logService.debug("Unknown CSI code: ",{identifier:b._parser.identToString(e),params:t.toArray()})}),b._parser.setEscHandlerFallback(function(e){b._logService.debug("Unknown ESC code: ",{identifier:b._parser.identToString(e)})}),b._parser.setExecuteHandlerFallback(function(e){b._logService.debug("Unknown EXECUTE code: ",{code:e})}),b._parser.setOscHandlerFallback(function(e,t,n){b._logService.debug("Unknown OSC code: ",{identifier:e,action:t,data:n})}),b._parser.setDcsHandlerFallback(function(e,t,n){"HOOK"===t&&(n=n.toArray()),b._logService.debug("Unknown DCS code: ",{identifier:b._parser.identToString(e),action:t,payload:n})}),b._parser.setPrintHandler(function(e,t,n){return b.print(e,t,n)}),b._parser.registerCsiHandler({final:"@"},function(e){return b.insertChars(e)}),b._parser.registerCsiHandler({intermediates:" ",final:"@"},function(e){return b.scrollLeft(e)}),b._parser.registerCsiHandler({final:"A"},function(e){return b.cursorUp(e)}),b._parser.registerCsiHandler({intermediates:" ",final:"A"},function(e){return b.scrollRight(e)}),b._parser.registerCsiHandler({final:"B"},function(e){return b.cursorDown(e)}),b._parser.registerCsiHandler({final:"C"},function(e){return b.cursorForward(e)}),b._parser.registerCsiHandler({final:"D"},function(e){return b.cursorBackward(e)}),b._parser.registerCsiHandler({final:"E"},function(e){return b.cursorNextLine(e)}),b._parser.registerCsiHandler({final:"F"},function(e){return b.cursorPrecedingLine(e)}),b._parser.registerCsiHandler({final:"G"},function(e){return b.cursorCharAbsolute(e)}),b._parser.registerCsiHandler({final:"H"},function(e){return b.cursorPosition(e)}),b._parser.registerCsiHandler({final:"I"},function(e){return b.cursorForwardTab(e)}),b._parser.registerCsiHandler({final:"J"},function(e){return b.eraseInDisplay(e)}),b._parser.registerCsiHandler({prefix:"?",final:"J"},function(e){return b.eraseInDisplay(e)}),b._parser.registerCsiHandler({final:"K"},function(e){return b.eraseInLine(e)}),b._parser.registerCsiHandler({prefix:"?",final:"K"},function(e){return b.eraseInLine(e)}),b._parser.registerCsiHandler({final:"L"},function(e){return b.insertLines(e)}),b._parser.registerCsiHandler({final:"M"},function(e){return b.deleteLines(e)}),b._parser.registerCsiHandler({final:"P"},function(e){return b.deleteChars(e)}),b._parser.registerCsiHandler({final:"S"},function(e){return b.scrollUp(e)}),b._parser.registerCsiHandler({final:"T"},function(e){return b.scrollDown(e)}),b._parser.registerCsiHandler({final:"X"},function(e){return b.eraseChars(e)}),b._parser.registerCsiHandler({final:"Z"},function(e){return b.cursorBackwardTab(e)}),b._parser.registerCsiHandler({final:"`"},function(e){return b.charPosAbsolute(e)}),b._parser.registerCsiHandler({final:"a"},function(e){return b.hPositionRelative(e)}),b._parser.registerCsiHandler({final:"b"},function(e){return b.repeatPrecedingCharacter(e)}),b._parser.registerCsiHandler({final:"c"},function(e){return b.sendDeviceAttributesPrimary(e)}),b._parser.registerCsiHandler({prefix:">",final:"c"},function(e){return b.sendDeviceAttributesSecondary(e)}),b._parser.registerCsiHandler({final:"d"},function(e){return b.linePosAbsolute(e)}),b._parser.registerCsiHandler({final:"e"},function(e){return b.vPositionRelative(e)}),b._parser.registerCsiHandler({final:"f"},function(e){return b.hVPosition(e)}),b._parser.registerCsiHandler({final:"g"},function(e){return b.tabClear(e)}),b._parser.registerCsiHandler({final:"h"},function(e){return b.setMode(e)}),b._parser.registerCsiHandler({prefix:"?",final:"h"},function(e){return b.setModePrivate(e)}),b._parser.registerCsiHandler({final:"l"},function(e){return b.resetMode(e)}),b._parser.registerCsiHandler({prefix:"?",final:"l"},function(e){return b.resetModePrivate(e)}),b._parser.registerCsiHandler({final:"m"},function(e){return b.charAttributes(e)}),b._parser.registerCsiHandler({final:"n"},function(e){return b.deviceStatus(e)}),b._parser.registerCsiHandler({prefix:"?",final:"n"},function(e){return b.deviceStatusPrivate(e)}),b._parser.registerCsiHandler({intermediates:"!",final:"p"},function(e){return b.softReset(e)}),b._parser.registerCsiHandler({intermediates:" ",final:"q"},function(e){return b.setCursorStyle(e)}),b._parser.registerCsiHandler({final:"r"},function(e){return b.setScrollRegion(e)}),b._parser.registerCsiHandler({final:"s"},function(e){return b.saveCursor(e)}),b._parser.registerCsiHandler({final:"t"},function(e){return b.windowOptions(e)}),b._parser.registerCsiHandler({final:"u"},function(e){return b.restoreCursor(e)}),b._parser.registerCsiHandler({intermediates:"'",final:"}"},function(e){return b.insertColumns(e)}),b._parser.registerCsiHandler({intermediates:"'",final:"~"},function(e){return b.deleteColumns(e)}),b._parser.setExecuteHandler(a.C0.BEL,function(){return b.bell()}),b._parser.setExecuteHandler(a.C0.LF,function(){return b.lineFeed()}),b._parser.setExecuteHandler(a.C0.VT,function(){return b.lineFeed()}),b._parser.setExecuteHandler(a.C0.FF,function(){return b.lineFeed()}),b._parser.setExecuteHandler(a.C0.CR,function(){return b.carriageReturn()}),b._parser.setExecuteHandler(a.C0.BS,function(){return b.backspace()}),b._parser.setExecuteHandler(a.C0.HT,function(){return b.tab()}),b._parser.setExecuteHandler(a.C0.SO,function(){return b.shiftOut()}),b._parser.setExecuteHandler(a.C0.SI,function(){return b.shiftIn()}),b._parser.setExecuteHandler(a.C1.IND,function(){return b.index()}),b._parser.setExecuteHandler(a.C1.NEL,function(){return b.nextLine()}),b._parser.setExecuteHandler(a.C1.HTS,function(){return b.tabSet()}),b._parser.registerOscHandler(0,new v.OscHandler(function(e){return b.setTitle(e),b.setIconName(e),!0})),b._parser.registerOscHandler(1,new v.OscHandler(function(e){return b.setIconName(e)})),b._parser.registerOscHandler(2,new v.OscHandler(function(e){return b.setTitle(e)})),b._parser.registerOscHandler(4,new v.OscHandler(function(e){return b.setAnsiColor(e)})),b._parser.registerEscHandler({final:"7"},function(){return b.saveCursor()}),b._parser.registerEscHandler({final:"8"},function(){return b.restoreCursor()}),b._parser.registerEscHandler({final:"D"},function(){return b.index()}),b._parser.registerEscHandler({final:"E"},function(){return b.nextLine()}),b._parser.registerEscHandler({final:"H"},function(){return b.tabSet()}),b._parser.registerEscHandler({final:"M"},function(){return b.reverseIndex()}),b._parser.registerEscHandler({final:"="},function(){return b.keypadApplicationMode()}),b._parser.registerEscHandler({final:">"},function(){return b.keypadNumericMode()}),b._parser.registerEscHandler({final:"c"},function(){return b.fullReset()}),b._parser.registerEscHandler({final:"n"},function(){return b.setgLevel(2)}),b._parser.registerEscHandler({final:"o"},function(){return b.setgLevel(3)}),b._parser.registerEscHandler({final:"|"},function(){return b.setgLevel(3)}),b._parser.registerEscHandler({final:"}"},function(){return b.setgLevel(2)}),b._parser.registerEscHandler({final:"~"},function(){return b.setgLevel(1)}),b._parser.registerEscHandler({intermediates:"%",final:"@"},function(){return b.selectDefaultCharset()}),b._parser.registerEscHandler({intermediates:"%",final:"G"},function(){return b.selectDefaultCharset()});var y=function(e){_._parser.registerEscHandler({intermediates:"(",final:e},function(){return b.selectCharset("("+e)}),_._parser.registerEscHandler({intermediates:")",final:e},function(){return b.selectCharset(")"+e)}),_._parser.registerEscHandler({intermediates:"*",final:e},function(){return b.selectCharset("*"+e)}),_._parser.registerEscHandler({intermediates:"+",final:e},function(){return b.selectCharset("+"+e)}),_._parser.registerEscHandler({intermediates:"-",final:e},function(){return b.selectCharset("-"+e)}),_._parser.registerEscHandler({intermediates:".",final:e},function(){return b.selectCharset("."+e)}),_._parser.registerEscHandler({intermediates:"/",final:e},function(){return b.selectCharset("/"+e)})},_=this;for(var w in s.CHARSETS)y(w);return b._parser.registerEscHandler({intermediates:"#",final:"8"},function(){return b.screenAlignmentPattern()}),b._parser.setErrorHandler(function(e){return b._logService.error("Parsing error: ",e),e}),b._parser.registerDcsHandler({intermediates:"$",final:"q"},new k(b._bufferService,b._coreService,b._logService,b._optionsService)),b}return i(t,e),Object.defineProperty(t.prototype,"onRequestBell",{get:function(){return this._onRequestBell.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestRefreshRows",{get:function(){return this._onRequestRefreshRows.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestReset",{get:function(){return this._onRequestReset.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestScroll",{get:function(){return this._onRequestScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestSyncScrollBar",{get:function(){return this._onRequestSyncScrollBar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onRequestWindowsOptionsReport",{get:function(){return this._onRequestWindowsOptionsReport.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yChar",{get:function(){return this._onA11yChar.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onA11yTab",{get:function(){return this._onA11yTab.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onCursorMove",{get:function(){return this._onCursorMove.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onLineFeed",{get:function(){return this._onLineFeed.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onScroll",{get:function(){return this._onScroll.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onTitleChange",{get:function(){return this._onTitleChange.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onAnsiColorChange",{get:function(){return this._onAnsiColorChange.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){e.prototype.dispose.call(this)},t.prototype.parse=function(e){var t=this._bufferService.buffer,n=t.x,r=t.y;if(this._logService.debug("parsing data",e),this._parseBuffer.length_)for(var i=0;i0&&2===f.getWidth(o.x-1)&&f.setCellFromCodePoint(o.x-1,0,1,d.fg,d.bg,d.extended);for(var m=t;m=c)if(l){for(;o.x=this._bufferService.rows&&(o.y=this._bufferService.rows-1),o.lines.get(o.ybase+o.y).isWrapped=!0),f=o.lines.get(o.ybase+o.y)}else if(o.x=c-1,2===i)continue;if(u&&(f.insertCells(o.x,i,o.getNullCell(d),d),2===f.getWidth(c-1)&&f.setCellFromCodePoint(c-1,p.NULL_CELL_CODE,p.NULL_CELL_WIDTH,d.fg,d.bg,d.extended)),f.setCellFromCodePoint(o.x++,r,i,d.fg,d.bg,d.extended),i>0)for(;--i;)f.setCellFromCodePoint(o.x++,0,0,d.fg,d.bg,d.extended)}else f.getWidth(o.x-1)?f.addCodepointToCell(o.x-1,r):f.addCodepointToCell(o.x-2,r)}n-t>0&&(f.loadCell(o.x-1,this._workCell),this._parser.precedingCodepoint=2===this._workCell.getWidth()||this._workCell.getCode()>65535?0:this._workCell.isCombined()?this._workCell.getChars().charCodeAt(0):this._workCell.content),o.x0&&0===f.getWidth(o.x)&&!f.hasContent(o.x)&&f.setCellFromCodePoint(o.x,0,1,d.fg,d.bg,d.extended),this._dirtyRowService.markDirty(o.y)},t.prototype.addCsiHandler=function(e,t){var n=this;return this._parser.registerCsiHandler(e,"t"!==e.final||e.prefix||e.intermediates?t:function(e){return!w(e.params[0],n._optionsService.options.windowOptions)||t(e)})},t.prototype.addDcsHandler=function(e,t){return this._parser.registerDcsHandler(e,new b.DcsHandler(t))},t.prototype.addEscHandler=function(e,t){return this._parser.registerEscHandler(e,t)},t.prototype.addOscHandler=function(e,t){return this._parser.registerOscHandler(e,new v.OscHandler(t))},t.prototype.bell=function(){return this._onRequestBell.fire(),!0},t.prototype.lineFeed=function(){var e=this._bufferService.buffer;return this._dirtyRowService.markDirty(e.y),this._optionsService.options.convertEol&&(e.x=0),e.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),e.x>=this._bufferService.cols&&e.x--,this._dirtyRowService.markDirty(e.y),this._onLineFeed.fire(),!0},t.prototype.carriageReturn=function(){return this._bufferService.buffer.x=0,!0},t.prototype.backspace=function(){var e,t=this._bufferService.buffer;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),t.x>0&&t.x--,!0;if(this._restrictCursor(this._bufferService.cols),t.x>0)t.x--;else if(0===t.x&&t.y>t.scrollTop&&t.y<=t.scrollBottom&&(null===(e=t.lines.get(t.ybase+t.y))||void 0===e?void 0:e.isWrapped)){t.lines.get(t.ybase+t.y).isWrapped=!1,t.y--,t.x=this._bufferService.cols-1;var n=t.lines.get(t.ybase+t.y);n.hasWidth(t.x)&&!n.hasContent(t.x)&&t.x--}return this._restrictCursor(),!0},t.prototype.tab=function(){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;var e=this._bufferService.buffer.x;return this._bufferService.buffer.x=this._bufferService.buffer.nextStop(),this._optionsService.options.screenReaderMode&&this._onA11yTab.fire(this._bufferService.buffer.x-e),!0},t.prototype.shiftOut=function(){return this._charsetService.setgLevel(1),!0},t.prototype.shiftIn=function(){return this._charsetService.setgLevel(0),!0},t.prototype._restrictCursor=function(e){void 0===e&&(e=this._bufferService.cols-1),this._bufferService.buffer.x=Math.min(e,Math.max(0,this._bufferService.buffer.x)),this._bufferService.buffer.y=this._coreService.decPrivateModes.origin?Math.min(this._bufferService.buffer.scrollBottom,Math.max(this._bufferService.buffer.scrollTop,this._bufferService.buffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._bufferService.buffer.y)),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._setCursor=function(e,t){this._dirtyRowService.markDirty(this._bufferService.buffer.y),this._coreService.decPrivateModes.origin?(this._bufferService.buffer.x=e,this._bufferService.buffer.y=this._bufferService.buffer.scrollTop+t):(this._bufferService.buffer.x=e,this._bufferService.buffer.y=t),this._restrictCursor(),this._dirtyRowService.markDirty(this._bufferService.buffer.y)},t.prototype._moveCursor=function(e,t){this._restrictCursor(),this._setCursor(this._bufferService.buffer.x+e,this._bufferService.buffer.y+t)},t.prototype.cursorUp=function(e){var t=this._bufferService.buffer.y-this._bufferService.buffer.scrollTop;return this._moveCursor(0,t>=0?-Math.min(t,e.params[0]||1):-(e.params[0]||1)),!0},t.prototype.cursorDown=function(e){var t=this._bufferService.buffer.scrollBottom-this._bufferService.buffer.y;return this._moveCursor(0,t>=0?Math.min(t,e.params[0]||1):e.params[0]||1),!0},t.prototype.cursorForward=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.cursorBackward=function(e){return this._moveCursor(-(e.params[0]||1),0),!0},t.prototype.cursorNextLine=function(e){return this.cursorDown(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorPrecedingLine=function(e){return this.cursorUp(e),this._bufferService.buffer.x=0,!0},t.prototype.cursorCharAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.cursorPosition=function(e){return this._setCursor(e.length>=2?(e.params[1]||1)-1:0,(e.params[0]||1)-1),!0},t.prototype.charPosAbsolute=function(e){return this._setCursor((e.params[0]||1)-1,this._bufferService.buffer.y),!0},t.prototype.hPositionRelative=function(e){return this._moveCursor(e.params[0]||1,0),!0},t.prototype.linePosAbsolute=function(e){return this._setCursor(this._bufferService.buffer.x,(e.params[0]||1)-1),!0},t.prototype.vPositionRelative=function(e){return this._moveCursor(0,e.params[0]||1),!0},t.prototype.hVPosition=function(e){return this.cursorPosition(e),!0},t.prototype.tabClear=function(e){var t=e.params[0];return 0===t?delete this._bufferService.buffer.tabs[this._bufferService.buffer.x]:3===t&&(this._bufferService.buffer.tabs={}),!0},t.prototype.cursorForwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1;t--;)this._bufferService.buffer.x=this._bufferService.buffer.nextStop();return!0},t.prototype.cursorBackwardTab=function(e){if(this._bufferService.buffer.x>=this._bufferService.cols)return!0;for(var t=e.params[0]||1,n=this._bufferService.buffer;t--;)n.x=n.prevStop();return!0},t.prototype._eraseInBufferLine=function(e,t,n,r){void 0===r&&(r=!1);var i=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);i.replaceCells(t,n,this._bufferService.buffer.getNullCell(this._eraseAttrData()),this._eraseAttrData()),r&&(i.isWrapped=!1)},t.prototype._resetBufferLine=function(e){var t=this._bufferService.buffer.lines.get(this._bufferService.buffer.ybase+e);t.fill(this._bufferService.buffer.getNullCell(this._eraseAttrData())),t.isWrapped=!1},t.prototype.eraseInDisplay=function(e){var t;switch(this._restrictCursor(),e.params[0]){case 0:for(this._dirtyRowService.markDirty(t=this._bufferService.buffer.y),this._eraseInBufferLine(t++,this._bufferService.buffer.x,this._bufferService.cols,0===this._bufferService.buffer.x);t=this._bufferService.cols&&(this._bufferService.buffer.lines.get(t+1).isWrapped=!1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 2:for(this._dirtyRowService.markDirty((t=this._bufferService.rows)-1);t--;)this._resetBufferLine(t);this._dirtyRowService.markDirty(0);break;case 3:var n=this._bufferService.buffer.lines.length-this._bufferService.rows;n>0&&(this._bufferService.buffer.lines.trimStart(n),this._bufferService.buffer.ybase=Math.max(this._bufferService.buffer.ybase-n,0),this._bufferService.buffer.ydisp=Math.max(this._bufferService.buffer.ydisp-n,0),this._onScroll.fire(0))}return!0},t.prototype.eraseInLine=function(e){switch(this._restrictCursor(),e.params[0]){case 0:this._eraseInBufferLine(this._bufferService.buffer.y,this._bufferService.buffer.x,this._bufferService.cols);break;case 1:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.buffer.x+1);break;case 2:this._eraseInBufferLine(this._bufferService.buffer.y,0,this._bufferService.cols)}return this._dirtyRowService.markDirty(this._bufferService.buffer.y),!0},t.prototype.insertLines=function(e){this._restrictCursor();var t=e.params[0]||1,n=this._bufferService.buffer;if(n.y>n.scrollBottom||n.yn.scrollBottom||n.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.yt.scrollBottom||t.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(a.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(a.C0.ESC+"[?6c")),!0},t.prototype.sendDeviceAttributesSecondary=function(e){return e.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(a.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(a.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(e.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(a.C0.ESC+"[>83;40003;0c")),!0},t.prototype._is=function(e){return 0===(this._optionsService.options.termName+"").indexOf(e)},t.prototype.setMode=function(e){for(var t=0;t=2||2===r[1]&&o+i>=5)break;r[1]&&(i=1)}while(++o+t5)&&(e=1),t.extended.underlineStyle=e,t.fg|=268435456,0===e&&(t.fg&=-268435457),t.updateExtended()},t.prototype.charAttributes=function(e){if(1===e.length&&0===e.params[0])return this._curAttrData.fg=d.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=d.DEFAULT_ATTR_DATA.bg,!0;for(var t,n=e.length,r=this._curAttrData,i=0;i=30&&t<=37?(r.fg&=-50331904,r.fg|=16777216|t-30):t>=40&&t<=47?(r.bg&=-50331904,r.bg|=16777216|t-40):t>=90&&t<=97?(r.fg&=-50331904,r.fg|=16777224|t-90):t>=100&&t<=107?(r.bg&=-50331904,r.bg|=16777224|t-100):0===t?(r.fg=d.DEFAULT_ATTR_DATA.fg,r.bg=d.DEFAULT_ATTR_DATA.bg):1===t?r.fg|=134217728:3===t?r.bg|=67108864:4===t?(r.fg|=268435456,this._processUnderline(e.hasSubParams(i)?e.getSubParams(i)[0]:1,r)):5===t?r.fg|=536870912:7===t?r.fg|=67108864:8===t?r.fg|=1073741824:2===t?r.bg|=134217728:21===t?this._processUnderline(2,r):22===t?(r.fg&=-134217729,r.bg&=-134217729):23===t?r.bg&=-67108865:24===t?r.fg&=-268435457:25===t?r.fg&=-536870913:27===t?r.fg&=-67108865:28===t?r.fg&=-1073741825:39===t?(r.fg&=-67108864,r.fg|=16777215&d.DEFAULT_ATTR_DATA.fg):49===t?(r.bg&=-67108864,r.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):38===t||48===t||58===t?i+=this._extractColor(e,i,r):59===t?(r.extended=r.extended.clone(),r.extended.underlineColor=-1,r.updateExtended()):100===t?(r.fg&=-67108864,r.fg|=16777215&d.DEFAULT_ATTR_DATA.fg,r.bg&=-67108864,r.bg|=16777215&d.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",t);return!0},t.prototype.deviceStatus=function(e){switch(e.params[0]){case 5:this._coreService.triggerDataEvent(a.C0.ESC+"[0n");break;case 6:this._coreService.triggerDataEvent(a.C0.ESC+"["+(this._bufferService.buffer.y+1)+";"+(this._bufferService.buffer.x+1)+"R")}return!0},t.prototype.deviceStatusPrivate=function(e){switch(e.params[0]){case 6:this._coreService.triggerDataEvent(a.C0.ESC+"[?"+(this._bufferService.buffer.y+1)+";"+(this._bufferService.buffer.x+1)+"R")}return!0},t.prototype.softReset=function(e){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._bufferService.buffer.scrollTop=0,this._bufferService.buffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._bufferService.buffer.savedX=0,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0},t.prototype.setCursorStyle=function(e){var t=e.params[0]||1;switch(t){case 1:case 2:this._optionsService.options.cursorStyle="block";break;case 3:case 4:this._optionsService.options.cursorStyle="underline";break;case 5:case 6:this._optionsService.options.cursorStyle="bar"}return this._optionsService.options.cursorBlink=t%2==1,!0},t.prototype.setScrollRegion=function(e){var t,n=e.params[0]||1;return(e.length<2||(t=e.params[1])>this._bufferService.rows||0===t)&&(t=this._bufferService.rows),t>n&&(this._bufferService.buffer.scrollTop=n-1,this._bufferService.buffer.scrollBottom=t-1,this._setCursor(0,0)),!0},t.prototype.windowOptions=function(e){if(!w(e.params[0],this._optionsService.options.windowOptions))return!0;var t=e.length>1?e.params[1]:0;switch(e.params[0]){case 14:2!==t&&this._onRequestWindowsOptionsReport.fire(o.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(o.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(a.C0.ESC+"[8;"+this._bufferService.rows+";"+this._bufferService.cols+"t");break;case 22:0!==t&&2!==t||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),0!==t&&1!==t||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:0!==t&&2!==t||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),0!==t&&1!==t||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0},t.prototype.saveCursor=function(e){return this._bufferService.buffer.savedX=this._bufferService.buffer.x,this._bufferService.buffer.savedY=this._bufferService.buffer.ybase+this._bufferService.buffer.y,this._bufferService.buffer.savedCurAttrData.fg=this._curAttrData.fg,this._bufferService.buffer.savedCurAttrData.bg=this._curAttrData.bg,this._bufferService.buffer.savedCharset=this._charsetService.charset,!0},t.prototype.restoreCursor=function(e){return this._bufferService.buffer.x=this._bufferService.buffer.savedX||0,this._bufferService.buffer.y=Math.max(this._bufferService.buffer.savedY-this._bufferService.buffer.ybase,0),this._curAttrData.fg=this._bufferService.buffer.savedCurAttrData.fg,this._curAttrData.bg=this._bufferService.buffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._bufferService.buffer.savedCharset&&(this._charsetService.charset=this._bufferService.buffer.savedCharset),this._restrictCursor(),!0},t.prototype.setTitle=function(e){return this._windowTitle=e,this._onTitleChange.fire(e),!0},t.prototype.setIconName=function(e){return this._iconName=e,!0},t.prototype._parseAnsiColorChange=function(e){for(var t,n={colors:[]},r=/(\d+);rgb:([0-9a-f]{2})\/([0-9a-f]{2})\/([0-9a-f]{2})/gi;null!==(t=r.exec(e));)n.colors.push({colorIndex:parseInt(t[1]),red:parseInt(t[2],16),green:parseInt(t[3],16),blue:parseInt(t[4],16)});return 0===n.colors.length?null:n},t.prototype.setAnsiColor=function(e){var t=this._parseAnsiColorChange(e);return t?this._onAnsiColorChange.fire(t):this._logService.warn("Expected format ;rgb:// but got data: "+e),!0},t.prototype.nextLine=function(){return this._bufferService.buffer.x=0,this.index(),!0},t.prototype.keypadApplicationMode=function(){return this._logService.debug("Serial port requested application keypad."),this._coreService.decPrivateModes.applicationKeypad=!0,this._onRequestSyncScrollBar.fire(),!0},t.prototype.keypadNumericMode=function(){return this._logService.debug("Switching back to normal keypad."),this._coreService.decPrivateModes.applicationKeypad=!1,this._onRequestSyncScrollBar.fire(),!0},t.prototype.selectDefaultCharset=function(){return this._charsetService.setgLevel(0),this._charsetService.setgCharset(0,s.DEFAULT_CHARSET),!0},t.prototype.selectCharset=function(e){return 2!==e.length?(this.selectDefaultCharset(),!0):("/"===e[0]||this._charsetService.setgCharset(y[e[0]],s.CHARSETS[e[1]]||s.DEFAULT_CHARSET),!0)},t.prototype.index=function(){this._restrictCursor();var e=this._bufferService.buffer;return this._bufferService.buffer.y++,e.y===e.scrollBottom+1?(e.y--,this._onRequestScroll.fire(this._eraseAttrData())):e.y>=this._bufferService.rows&&(e.y=this._bufferService.rows-1),this._restrictCursor(),!0},t.prototype.tabSet=function(){return this._bufferService.buffer.tabs[this._bufferService.buffer.x]=!0,!0},t.prototype.reverseIndex=function(){this._restrictCursor();var e=this._bufferService.buffer;return e.y===e.scrollTop?(e.lines.shiftElements(e.ybase+e.y,e.scrollBottom-e.scrollTop,1),e.lines.set(e.ybase+e.y,e.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(e.scrollTop,e.scrollBottom)):(e.y--,this._restrictCursor()),!0},t.prototype.fullReset=function(){return this._parser.reset(),this._onRequestReset.fire(),!0},t.prototype.reset=function(){this._curAttrData=d.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=d.DEFAULT_ATTR_DATA.clone()},t.prototype._eraseAttrData=function(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal},t.prototype.setgLevel=function(e){return this._charsetService.setgLevel(e),!0},t.prototype.screenAlignmentPattern=function(){var e=new m.CellData;e.content=1<<22|"E".charCodeAt(0),e.fg=this._curAttrData.fg,e.bg=this._curAttrData.bg;var t=this._bufferService.buffer;this._setCursor(0,0);for(var n=0;n=0},8273:function(e,t){function n(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=e.length),n>=e.length)return e;r=r>=e.length?e.length:(e.length+r)%e.length;for(var i=n=(e.length+n)%e.length;i>>16&255,e>>>8&255,255&e]},e.fromColorRGB=function(e){return(255&e[0])<<16|(255&e[1])<<8|255&e[2]},e.prototype.clone=function(){var t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t},e.prototype.isInverse=function(){return 67108864&this.fg},e.prototype.isBold=function(){return 134217728&this.fg},e.prototype.isUnderline=function(){return 268435456&this.fg},e.prototype.isBlink=function(){return 536870912&this.fg},e.prototype.isInvisible=function(){return 1073741824&this.fg},e.prototype.isItalic=function(){return 67108864&this.bg},e.prototype.isDim=function(){return 134217728&this.bg},e.prototype.getFgColorMode=function(){return 50331648&this.fg},e.prototype.getBgColorMode=function(){return 50331648&this.bg},e.prototype.isFgRGB=function(){return 50331648==(50331648&this.fg)},e.prototype.isBgRGB=function(){return 50331648==(50331648&this.bg)},e.prototype.isFgPalette=function(){return 16777216==(50331648&this.fg)||33554432==(50331648&this.fg)},e.prototype.isBgPalette=function(){return 16777216==(50331648&this.bg)||33554432==(50331648&this.bg)},e.prototype.isFgDefault=function(){return 0==(50331648&this.fg)},e.prototype.isBgDefault=function(){return 0==(50331648&this.bg)},e.prototype.isAttributeDefault=function(){return 0===this.fg&&0===this.bg},e.prototype.getFgColor=function(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}},e.prototype.getBgColor=function(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}},e.prototype.hasExtendedAttrs=function(){return 268435456&this.bg},e.prototype.updateExtended=function(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456},e.prototype.getUnderlineColor=function(){if(268435456&this.bg&&~this.extended.underlineColor)switch(50331648&this.extended.underlineColor){case 16777216:case 33554432:return 255&this.extended.underlineColor;case 50331648:return 16777215&this.extended.underlineColor;default:return this.getFgColor()}return this.getFgColor()},e.prototype.getUnderlineColorMode=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()},e.prototype.isUnderlineColorRGB=function(){return 268435456&this.bg&&~this.extended.underlineColor?50331648==(50331648&this.extended.underlineColor):this.isFgRGB()},e.prototype.isUnderlineColorPalette=function(){return 268435456&this.bg&&~this.extended.underlineColor?16777216==(50331648&this.extended.underlineColor)||33554432==(50331648&this.extended.underlineColor):this.isFgPalette()},e.prototype.isUnderlineColorDefault=function(){return 268435456&this.bg&&~this.extended.underlineColor?0==(50331648&this.extended.underlineColor):this.isFgDefault()},e.prototype.getUnderlineStyle=function(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0},e}();t.AttributeData=n;var r=function(){function e(e,t){void 0===e&&(e=0),void 0===t&&(t=-1),this.underlineStyle=e,this.underlineColor=t}return e.prototype.clone=function(){return new e(this.underlineStyle,this.underlineColor)},e.prototype.isEmpty=function(){return 0===this.underlineStyle},e}();t.ExtendedAttrs=r},9092:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferStringIterator=t.Buffer=t.MAX_BUFFER_SIZE=void 0;var r=n(6349),i=n(8437),o=n(511),a=n(643),s=n(4634),c=n(4863),l=n(7116),u=n(3734);t.MAX_BUFFER_SIZE=4294967295;var h=function(){function e(e,t,n){this._hasScrollback=e,this._optionsService=t,this._bufferService=n,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=i.DEFAULT_ATTR_DATA.clone(),this.savedCharset=l.DEFAULT_CHARSET,this.markers=[],this._nullCell=o.CellData.fromCharData([0,a.NULL_CELL_CHAR,a.NULL_CELL_WIDTH,a.NULL_CELL_CODE]),this._whitespaceCell=o.CellData.fromCharData([0,a.WHITESPACE_CELL_CHAR,a.WHITESPACE_CELL_WIDTH,a.WHITESPACE_CELL_CODE]),this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}return e.prototype.getNullCell=function(e){return e?(this._nullCell.fg=e.fg,this._nullCell.bg=e.bg,this._nullCell.extended=e.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new u.ExtendedAttrs),this._nullCell},e.prototype.getWhitespaceCell=function(e){return e?(this._whitespaceCell.fg=e.fg,this._whitespaceCell.bg=e.bg,this._whitespaceCell.extended=e.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new u.ExtendedAttrs),this._whitespaceCell},e.prototype.getBlankLine=function(e,t){return new i.BufferLine(this._bufferService.cols,this.getNullCell(e),t)},Object.defineProperty(e.prototype,"hasScrollback",{get:function(){return this._hasScrollback&&this.lines.maxLength>this._rows},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCursorInViewport",{get:function(){var e=this.ybase+this.y-this.ydisp;return e>=0&&et.MAX_BUFFER_SIZE?t.MAX_BUFFER_SIZE:n},e.prototype.fillViewportRows=function(e){if(0===this.lines.length){void 0===e&&(e=i.DEFAULT_ATTR_DATA);for(var t=this._rows;t--;)this.lines.push(this.getBlankLine(e))}},e.prototype.clear=function(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new r.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()},e.prototype.resize=function(e,t){var n=this.getNullCell(i.DEFAULT_ATTR_DATA),r=this._getCorrectBufferLength(t);if(r>this.lines.maxLength&&(this.lines.maxLength=r),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+a+1?(this.ybase--,a++,this.ydisp>0&&this.ydisp--):this.lines.push(new i.BufferLine(e,n)));else for(s=this._rows;s>t;s--)this.lines.length>t+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(r0&&(this.lines.trimStart(c),this.ybase=Math.max(this.ybase-c,0),this.ydisp=Math.max(this.ydisp-c,0),this.savedY=Math.max(this.savedY-c,0)),this.lines.maxLength=r}this.x=Math.min(this.x,e-1),this.y=Math.min(this.y,t-1),a&&(this.y+=a),this.savedX=Math.min(this.savedX,e-1),this.scrollTop=0}if(this.scrollBottom=t-1,this._isReflowEnabled&&(this._reflow(e,t),this._cols>e))for(o=0;othis._cols?this._reflowLarger(e,t):this._reflowSmaller(e,t))},e.prototype._reflowLarger=function(e,t){var n=s.reflowLargerGetLinesToRemove(this.lines,this._cols,e,this.ybase+this.y,this.getNullCell(i.DEFAULT_ATTR_DATA));if(n.length>0){var r=s.reflowLargerCreateNewLayout(this.lines,n);s.reflowLargerApplyNewLayout(this.lines,r.layout),this._reflowLargerAdjustViewport(e,t,r.countRemoved)}},e.prototype._reflowLargerAdjustViewport=function(e,t,n){for(var r=this.getNullCell(i.DEFAULT_ATTR_DATA),o=n;o-- >0;)0===this.ybase?(this.y>0&&this.y--,this.lines.length=0;a--){var c=this.lines.get(a);if(!(!c||!c.isWrapped&&c.getTrimmedLength()<=e)){for(var l=[c];c.isWrapped&&a>0;)c=this.lines.get(--a),l.unshift(c);var u=this.ybase+this.y;if(!(u>=a&&u0&&(r.push({start:a+l.length+o,newLines:m}),o+=m.length),l.push.apply(l,m);var b=f.length-1,y=f[b];0===y&&(y=f[--b]);for(var _=l.length-p-1,w=d;_>=0;){var k=Math.min(w,y);if(l[b].copyCellsFrom(l[_],w-k,y-k,k,!0),0==(y-=k)&&(y=f[--b]),0==(w-=k)){_--;var C=Math.max(_,0);w=s.getWrappedLineTrimmedLength(l,C,this._cols)}}for(g=0;g0;)0===this.ybase?this.y0){var x=[],O=[];for(g=0;g=0;g--)if(P&&P.start>T+j){for(var I=P.newLines.length-1;I>=0;I--)this.lines.set(g--,P.newLines[I]);g++,x.push({index:T+1,amount:P.newLines.length}),j+=P.newLines.length,P=r[++E]}else this.lines.set(g,O[T--]);var A=0;for(g=x.length-1;g>=0;g--)x[g].index+=A,this.lines.onInsertEmitter.fire(x[g]),A+=x[g].amount;var D=Math.max(0,M+o-this.lines.maxLength);D>0&&this.lines.onTrimEmitter.fire(D)}},e.prototype.stringIndexToBufferIndex=function(e,t,n){for(void 0===n&&(n=!1);t;){var r=this.lines.get(e);if(!r)return[-1,-1];for(var i=n?r.getTrimmedLength():r.length,o=0;o0&&this.lines.get(t).isWrapped;)t--;for(;n+10;);return e>=this._cols?this._cols-1:e<0?0:e},e.prototype.nextStop=function(e){for(null==e&&(e=this.x);!this.tabs[++e]&&e=this._cols?this._cols-1:e<0?0:e},e.prototype.addMarker=function(e){var t=this,n=new c.Marker(e);return this.markers.push(n),n.register(this.lines.onTrim(function(e){n.line-=e,n.line<0&&n.dispose()})),n.register(this.lines.onInsert(function(e){n.line>=e.index&&(n.line+=e.amount)})),n.register(this.lines.onDelete(function(e){n.line>=e.index&&n.linee.index&&(n.line-=e.amount)})),n.register(n.onDispose(function(){return t._removeMarker(n)})),n},e.prototype._removeMarker=function(e){this.markers.splice(this.markers.indexOf(e),1)},e.prototype.iterator=function(e,t,n,r,i){return new d(this,e,t,n,r,i)},e}();t.Buffer=h;var d=function(){function e(e,t,n,r,i,o){void 0===n&&(n=0),void 0===r&&(r=e.lines.length),void 0===i&&(i=0),void 0===o&&(o=0),this._buffer=e,this._trimRight=t,this._startIndex=n,this._endIndex=r,this._startOverscan=i,this._endOverscan=o,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}return e.prototype.hasNext=function(){return this._currentthis._endIndex+this._endOverscan&&(e.last=this._endIndex+this._endOverscan),e.first=Math.max(e.first,0),e.last=Math.min(e.last,this._buffer.lines.length);for(var t="",n=e.first;n<=e.last;++n)t+=this._buffer.translateBufferLineToString(n,this._trimRight);return this._current=e.last+1,{range:e,content:t}},e}();t.BufferStringIterator=d},8437:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.BufferLine=t.DEFAULT_ATTR_DATA=void 0;var r=n(482),i=n(643),o=n(511),a=n(3734);t.DEFAULT_ATTR_DATA=Object.freeze(new a.AttributeData);var s=function(){function e(e,t,n){void 0===n&&(n=!1),this.isWrapped=n,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);for(var r=t||o.CellData.fromCharData([0,i.NULL_CELL_CHAR,i.NULL_CELL_WIDTH,i.NULL_CELL_CODE]),a=0;a>22,2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):n]},e.prototype.set=function(e,t){this._data[3*e+1]=t[i.CHAR_DATA_ATTR_INDEX],t[i.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=t[1],this._data[3*e+0]=2097152|e|t[i.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=t[i.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|t[i.CHAR_DATA_WIDTH_INDEX]<<22},e.prototype.getWidth=function(e){return this._data[3*e+0]>>22},e.prototype.hasWidth=function(e){return 12582912&this._data[3*e+0]},e.prototype.getFg=function(e){return this._data[3*e+1]},e.prototype.getBg=function(e){return this._data[3*e+2]},e.prototype.hasContent=function(e){return 4194303&this._data[3*e+0]},e.prototype.getCodePoint=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&t},e.prototype.isCombined=function(e){return 2097152&this._data[3*e+0]},e.prototype.getString=function(e){var t=this._data[3*e+0];return 2097152&t?this._combined[e]:2097151&t?r.stringFromCodePoint(2097151&t):""},e.prototype.loadCell=function(e,t){var n=3*e;return t.content=this._data[n+0],t.fg=this._data[n+1],t.bg=this._data[n+2],2097152&t.content&&(t.combinedData=this._combined[e]),268435456&t.bg&&(t.extended=this._extendedAttrs[e]),t},e.prototype.setCell=function(e,t){2097152&t.content&&(this._combined[e]=t.combinedData),268435456&t.bg&&(this._extendedAttrs[e]=t.extended),this._data[3*e+0]=t.content,this._data[3*e+1]=t.fg,this._data[3*e+2]=t.bg},e.prototype.setCellFromCodePoint=function(e,t,n,r,i,o){268435456&i&&(this._extendedAttrs[e]=o),this._data[3*e+0]=t|n<<22,this._data[3*e+1]=r,this._data[3*e+2]=i},e.prototype.addCodepointToCell=function(e,t){var n=this._data[3*e+0];2097152&n?this._combined[e]+=r.stringFromCodePoint(t):(2097151&n?(this._combined[e]=r.stringFromCodePoint(2097151&n)+r.stringFromCodePoint(t),n&=-2097152,n|=2097152):n=t|1<<22,this._data[3*e+0]=n)},e.prototype.insertCells=function(e,t,n,r){if((e%=this.length)&&2===this.getWidth(e-1)&&this.setCellFromCodePoint(e-1,0,1,(null==r?void 0:r.fg)||0,(null==r?void 0:r.bg)||0,(null==r?void 0:r.extended)||new a.ExtendedAttrs),t=0;--s)this.setCell(e+t+s,this.loadCell(e+s,i));for(s=0;sthis.length){var n=new Uint32Array(3*e);this.length&&n.set(3*e=e&&delete this._combined[o]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}},e.prototype.fill=function(e){this._combined={},this._extendedAttrs={};for(var t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0},e.prototype.copyCellsFrom=function(e,t,n,r,i){var o=e._data;if(i)for(var a=r-1;a>=0;a--)for(var s=0;s<3;s++)this._data[3*(n+a)+s]=o[3*(t+a)+s];else for(a=0;a=t&&(this._combined[l-t+n]=e._combined[l])}},e.prototype.translateToString=function(e,t,n){void 0===e&&(e=!1),void 0===t&&(t=0),void 0===n&&(n=this.length),e&&(n=Math.min(n,this.getTrimmedLength()));for(var o="";t>22||1}return o},e}();t.BufferLine=s},4634:function(e,t){function n(e,t,n){if(t===e.length-1)return e[t].getTrimmedLength();var r=!e[t].hasContent(n-1)&&1===e[t].getWidth(n-1),i=2===e[t+1].getWidth(0);return r&&i?n-1:n}Object.defineProperty(t,"__esModule",{value:!0}),t.getWrappedLineTrimmedLength=t.reflowSmallerGetNewLineLengths=t.reflowLargerApplyNewLayout=t.reflowLargerCreateNewLayout=t.reflowLargerGetLinesToRemove=void 0,t.reflowLargerGetLinesToRemove=function(e,t,r,i,o){for(var a=[],s=0;s=s&&i0&&(b>h||0===u[b].getTrimmedLength());b--)v++;v>0&&(a.push(s+u.length-v),a.push(v)),s+=u.length-1}}}return a},t.reflowLargerCreateNewLayout=function(e,t){for(var n=[],r=0,i=t[r],o=0,a=0;al&&(a-=l,s++);var u=2===e[s].getWidth(a-1);u&&a--;var h=u?r-1:r;i.push(h),c+=h}return i},t.getWrappedLineTrimmedLength=n},5295:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.BufferSet=void 0;var o=n(9092),a=n(8460),s=function(e){function t(t,n){var r=e.call(this)||this;return r._optionsService=t,r._bufferService=n,r._onBufferActivate=r.register(new a.EventEmitter),r.reset(),r}return i(t,e),Object.defineProperty(t.prototype,"onBufferActivate",{get:function(){return this._onBufferActivate.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this._normal=new o.Buffer(!0,this._optionsService,this._bufferService),this._normal.fillViewportRows(),this._alt=new o.Buffer(!1,this._optionsService,this._bufferService),this._activeBuffer=this._normal,this.setupTabStops()},Object.defineProperty(t.prototype,"alt",{get:function(){return this._alt},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"active",{get:function(){return this._activeBuffer},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"normal",{get:function(){return this._normal},enumerable:!1,configurable:!0}),t.prototype.activateNormalBuffer=function(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))},t.prototype.activateAltBuffer=function(e){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(e),this._alt.x=this._normal.x,this._alt.y=this._normal.y,this._activeBuffer=this._alt,this._onBufferActivate.fire({activeBuffer:this._alt,inactiveBuffer:this._normal}))},t.prototype.resize=function(e,t){this._normal.resize(e,t),this._alt.resize(e,t)},t.prototype.setupTabStops=function(e){this._normal.setupTabStops(e),this._alt.setupTabStops(e)},t}(n(844).Disposable);t.BufferSet=s},511:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CellData=void 0;var o=n(482),a=n(643),s=n(3734),c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.content=0,t.fg=0,t.bg=0,t.extended=new s.ExtendedAttrs,t.combinedData="",t}return i(t,e),t.fromCharData=function(e){var n=new t;return n.setFromCharData(e),n},t.prototype.isCombined=function(){return 2097152&this.content},t.prototype.getWidth=function(){return this.content>>22},t.prototype.getChars=function(){return 2097152&this.content?this.combinedData:2097151&this.content?o.stringFromCodePoint(2097151&this.content):""},t.prototype.getCode=function(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content},t.prototype.setFromCharData=function(e){this.fg=e[a.CHAR_DATA_ATTR_INDEX],this.bg=0;var t=!1;if(e[a.CHAR_DATA_CHAR_INDEX].length>2)t=!0;else if(2===e[a.CHAR_DATA_CHAR_INDEX].length){var n=e[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=n&&n<=56319){var r=e[a.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=r&&r<=57343?this.content=1024*(n-55296)+r-56320+65536|e[a.CHAR_DATA_WIDTH_INDEX]<<22:t=!0}else t=!0}else this.content=e[a.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|e[a.CHAR_DATA_WIDTH_INDEX]<<22;t&&(this.combinedData=e[a.CHAR_DATA_CHAR_INDEX],this.content=2097152|e[a.CHAR_DATA_WIDTH_INDEX]<<22)},t.prototype.getAsCharData=function(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]},t}(s.AttributeData);t.CellData=c},643:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.WHITESPACE_CELL_CODE=t.WHITESPACE_CELL_WIDTH=t.WHITESPACE_CELL_CHAR=t.NULL_CELL_CODE=t.NULL_CELL_WIDTH=t.NULL_CELL_CHAR=t.CHAR_DATA_CODE_INDEX=t.CHAR_DATA_WIDTH_INDEX=t.CHAR_DATA_CHAR_INDEX=t.CHAR_DATA_ATTR_INDEX=t.DEFAULT_ATTR=t.DEFAULT_COLOR=void 0,t.DEFAULT_COLOR=256,t.DEFAULT_ATTR=256|t.DEFAULT_COLOR<<9,t.CHAR_DATA_ATTR_INDEX=0,t.CHAR_DATA_CHAR_INDEX=1,t.CHAR_DATA_WIDTH_INDEX=2,t.CHAR_DATA_CODE_INDEX=3,t.NULL_CELL_CHAR="",t.NULL_CELL_WIDTH=1,t.NULL_CELL_CODE=0,t.WHITESPACE_CELL_CHAR=" ",t.WHITESPACE_CELL_WIDTH=1,t.WHITESPACE_CELL_CODE=32},4863:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.Marker=void 0;var o=n(8460),a=function(e){function t(n){var r=e.call(this)||this;return r.line=n,r._id=t._nextId++,r.isDisposed=!1,r._onDispose=new o.EventEmitter,r}return i(t,e),Object.defineProperty(t.prototype,"id",{get:function(){return this._id},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onDispose",{get:function(){return this._onDispose.event},enumerable:!1,configurable:!0}),t.prototype.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),e.prototype.dispose.call(this))},t._nextId=1,t}(n(844).Disposable);t.Marker=a},7116:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_CHARSET=t.CHARSETS=void 0,t.CHARSETS={},t.DEFAULT_CHARSET=t.CHARSETS.B,t.CHARSETS[0]={"`":"\u25c6",a:"\u2592",b:"\u2409",c:"\u240c",d:"\u240d",e:"\u240a",f:"\xb0",g:"\xb1",h:"\u2424",i:"\u240b",j:"\u2518",k:"\u2510",l:"\u250c",m:"\u2514",n:"\u253c",o:"\u23ba",p:"\u23bb",q:"\u2500",r:"\u23bc",s:"\u23bd",t:"\u251c",u:"\u2524",v:"\u2534",w:"\u252c",x:"\u2502",y:"\u2264",z:"\u2265","{":"\u03c0","|":"\u2260","}":"\xa3","~":"\xb7"},t.CHARSETS.A={"#":"\xa3"},t.CHARSETS.B=void 0,t.CHARSETS[4]={"#":"\xa3","@":"\xbe","[":"ij","\\":"\xbd","]":"|","{":"\xa8","|":"f","}":"\xbc","~":"\xb4"},t.CHARSETS.C=t.CHARSETS[5]={"[":"\xc4","\\":"\xd6","]":"\xc5","^":"\xdc","`":"\xe9","{":"\xe4","|":"\xf6","}":"\xe5","~":"\xfc"},t.CHARSETS.R={"#":"\xa3","@":"\xe0","[":"\xb0","\\":"\xe7","]":"\xa7","{":"\xe9","|":"\xf9","}":"\xe8","~":"\xa8"},t.CHARSETS.Q={"@":"\xe0","[":"\xe2","\\":"\xe7","]":"\xea","^":"\xee","`":"\xf4","{":"\xe9","|":"\xf9","}":"\xe8","~":"\xfb"},t.CHARSETS.K={"@":"\xa7","[":"\xc4","\\":"\xd6","]":"\xdc","{":"\xe4","|":"\xf6","}":"\xfc","~":"\xdf"},t.CHARSETS.Y={"#":"\xa3","@":"\xa7","[":"\xb0","\\":"\xe7","]":"\xe9","`":"\xf9","{":"\xe0","|":"\xf2","}":"\xe8","~":"\xec"},t.CHARSETS.E=t.CHARSETS[6]={"@":"\xc4","[":"\xc6","\\":"\xd8","]":"\xc5","^":"\xdc","`":"\xe4","{":"\xe6","|":"\xf8","}":"\xe5","~":"\xfc"},t.CHARSETS.Z={"#":"\xa3","@":"\xa7","[":"\xa1","\\":"\xd1","]":"\xbf","{":"\xb0","|":"\xf1","}":"\xe7"},t.CHARSETS.H=t.CHARSETS[7]={"@":"\xc9","[":"\xc4","\\":"\xd6","]":"\xc5","^":"\xdc","`":"\xe9","{":"\xe4","|":"\xf6","}":"\xe5","~":"\xfc"},t.CHARSETS["="]={"#":"\xf9","@":"\xe0","[":"\xe9","\\":"\xe7","]":"\xea","^":"\xee",_:"\xe8","`":"\xf4","{":"\xe4","|":"\xf6","}":"\xfc","~":"\xfb"}},2584:function(e,t){var n,r;Object.defineProperty(t,"__esModule",{value:!0}),t.C1=t.C0=void 0,(r=t.C0||(t.C0={})).NUL="\0",r.SOH="\x01",r.STX="\x02",r.ETX="\x03",r.EOT="\x04",r.ENQ="\x05",r.ACK="\x06",r.BEL="\x07",r.BS="\b",r.HT="\t",r.LF="\n",r.VT="\v",r.FF="\f",r.CR="\r",r.SO="\x0e",r.SI="\x0f",r.DLE="\x10",r.DC1="\x11",r.DC2="\x12",r.DC3="\x13",r.DC4="\x14",r.NAK="\x15",r.SYN="\x16",r.ETB="\x17",r.CAN="\x18",r.EM="\x19",r.SUB="\x1a",r.ESC="\x1b",r.FS="\x1c",r.GS="\x1d",r.RS="\x1e",r.US="\x1f",r.SP=" ",r.DEL="\x7f",(n=t.C1||(t.C1={})).PAD="\x80",n.HOP="\x81",n.BPH="\x82",n.NBH="\x83",n.IND="\x84",n.NEL="\x85",n.SSA="\x86",n.ESA="\x87",n.HTS="\x88",n.HTJ="\x89",n.VTS="\x8a",n.PLD="\x8b",n.PLU="\x8c",n.RI="\x8d",n.SS2="\x8e",n.SS3="\x8f",n.DCS="\x90",n.PU1="\x91",n.PU2="\x92",n.STS="\x93",n.CCH="\x94",n.MW="\x95",n.SPA="\x96",n.EPA="\x97",n.SOS="\x98",n.SGCI="\x99",n.SCI="\x9a",n.CSI="\x9b",n.ST="\x9c",n.OSC="\x9d",n.PM="\x9e",n.APC="\x9f"},7399:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateKeyboardEvent=void 0;var r=n(2584),i={48:["0",")"],49:["1","!"],50:["2","@"],51:["3","#"],52:["4","$"],53:["5","%"],54:["6","^"],55:["7","&"],56:["8","*"],57:["9","("],186:[";",":"],187:["=","+"],188:[",","<"],189:["-","_"],190:[".",">"],191:["/","?"],192:["`","~"],219:["[","{"],220:["\\","|"],221:["]","}"],222:["'",'"']};t.evaluateKeyboardEvent=function(e,t,n,o){var a={type:0,cancel:!1,key:void 0},s=(e.shiftKey?1:0)|(e.altKey?2:0)|(e.ctrlKey?4:0)|(e.metaKey?8:0);switch(e.keyCode){case 0:"UIKeyInputUpArrow"===e.key?a.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A":"UIKeyInputLeftArrow"===e.key?a.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D":"UIKeyInputRightArrow"===e.key?a.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C":"UIKeyInputDownArrow"===e.key&&(a.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B");break;case 8:if(e.shiftKey){a.key=r.C0.BS;break}if(e.altKey){a.key=r.C0.ESC+r.C0.DEL;break}a.key=r.C0.DEL;break;case 9:if(e.shiftKey){a.key=r.C0.ESC+"[Z";break}a.key=r.C0.HT,a.cancel=!0;break;case 13:a.key=e.altKey?r.C0.ESC+r.C0.CR:r.C0.CR,a.cancel=!0;break;case 27:a.key=r.C0.ESC,e.altKey&&(a.key=r.C0.ESC+r.C0.ESC),a.cancel=!0;break;case 37:if(e.metaKey)break;s?(a.key=r.C0.ESC+"[1;"+(s+1)+"D",a.key===r.C0.ESC+"[1;3D"&&(a.key=r.C0.ESC+(n?"b":"[1;5D"))):a.key=t?r.C0.ESC+"OD":r.C0.ESC+"[D";break;case 39:if(e.metaKey)break;s?(a.key=r.C0.ESC+"[1;"+(s+1)+"C",a.key===r.C0.ESC+"[1;3C"&&(a.key=r.C0.ESC+(n?"f":"[1;5C"))):a.key=t?r.C0.ESC+"OC":r.C0.ESC+"[C";break;case 38:if(e.metaKey)break;s?(a.key=r.C0.ESC+"[1;"+(s+1)+"A",n||a.key!==r.C0.ESC+"[1;3A"||(a.key=r.C0.ESC+"[1;5A")):a.key=t?r.C0.ESC+"OA":r.C0.ESC+"[A";break;case 40:if(e.metaKey)break;s?(a.key=r.C0.ESC+"[1;"+(s+1)+"B",n||a.key!==r.C0.ESC+"[1;3B"||(a.key=r.C0.ESC+"[1;5B")):a.key=t?r.C0.ESC+"OB":r.C0.ESC+"[B";break;case 45:e.shiftKey||e.ctrlKey||(a.key=r.C0.ESC+"[2~");break;case 46:a.key=s?r.C0.ESC+"[3;"+(s+1)+"~":r.C0.ESC+"[3~";break;case 36:a.key=s?r.C0.ESC+"[1;"+(s+1)+"H":t?r.C0.ESC+"OH":r.C0.ESC+"[H";break;case 35:a.key=s?r.C0.ESC+"[1;"+(s+1)+"F":t?r.C0.ESC+"OF":r.C0.ESC+"[F";break;case 33:e.shiftKey?a.type=2:a.key=r.C0.ESC+"[5~";break;case 34:e.shiftKey?a.type=3:a.key=r.C0.ESC+"[6~";break;case 112:a.key=s?r.C0.ESC+"[1;"+(s+1)+"P":r.C0.ESC+"OP";break;case 113:a.key=s?r.C0.ESC+"[1;"+(s+1)+"Q":r.C0.ESC+"OQ";break;case 114:a.key=s?r.C0.ESC+"[1;"+(s+1)+"R":r.C0.ESC+"OR";break;case 115:a.key=s?r.C0.ESC+"[1;"+(s+1)+"S":r.C0.ESC+"OS";break;case 116:a.key=s?r.C0.ESC+"[15;"+(s+1)+"~":r.C0.ESC+"[15~";break;case 117:a.key=s?r.C0.ESC+"[17;"+(s+1)+"~":r.C0.ESC+"[17~";break;case 118:a.key=s?r.C0.ESC+"[18;"+(s+1)+"~":r.C0.ESC+"[18~";break;case 119:a.key=s?r.C0.ESC+"[19;"+(s+1)+"~":r.C0.ESC+"[19~";break;case 120:a.key=s?r.C0.ESC+"[20;"+(s+1)+"~":r.C0.ESC+"[20~";break;case 121:a.key=s?r.C0.ESC+"[21;"+(s+1)+"~":r.C0.ESC+"[21~";break;case 122:a.key=s?r.C0.ESC+"[23;"+(s+1)+"~":r.C0.ESC+"[23~";break;case 123:a.key=s?r.C0.ESC+"[24;"+(s+1)+"~":r.C0.ESC+"[24~";break;default:if(!e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)if(n&&!o||!e.altKey||e.metaKey)!n||e.altKey||e.ctrlKey||e.shiftKey||!e.metaKey?e.key&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&e.keyCode>=48&&1===e.key.length?a.key=e.key:e.key&&e.ctrlKey&&"_"===e.key&&(a.key=r.C0.US):65===e.keyCode&&(a.type=1);else{var c=i[e.keyCode],l=c&&c[e.shiftKey?1:0];l?a.key=r.C0.ESC+l:e.keyCode>=65&&e.keyCode<=90&&(a.key=r.C0.ESC+String.fromCharCode(e.ctrlKey?e.keyCode-64:e.keyCode+32))}else e.keyCode>=65&&e.keyCode<=90?a.key=String.fromCharCode(e.keyCode-64):32===e.keyCode?a.key=r.C0.NUL:e.keyCode>=51&&e.keyCode<=55?a.key=String.fromCharCode(e.keyCode-51+27):56===e.keyCode?a.key=r.C0.DEL:219===e.keyCode?a.key=r.C0.ESC:220===e.keyCode?a.key=r.C0.FS:221===e.keyCode&&(a.key=r.C0.GS)}return a}},482:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Utf8ToUtf32=t.StringToUtf32=t.utf32ToString=t.stringFromCodePoint=void 0,t.stringFromCodePoint=function(e){return e>65535?(e-=65536,String.fromCharCode(55296+(e>>10))+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)},t.utf32ToString=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=e.length);for(var r="",i=t;i65535?(o-=65536,r+=String.fromCharCode(55296+(o>>10))+String.fromCharCode(o%1024+56320)):r+=String.fromCharCode(o)}return r};var n=function(){function e(){this._interim=0}return e.prototype.clear=function(){this._interim=0},e.prototype.decode=function(e,t){var n=e.length;if(!n)return 0;var r=0,i=0;this._interim&&(56320<=(s=e.charCodeAt(i++))&&s<=57343?t[r++]=1024*(this._interim-55296)+s-56320+65536:(t[r++]=this._interim,t[r++]=s),this._interim=0);for(var o=i;o=n)return this._interim=a,r;var s;56320<=(s=e.charCodeAt(o))&&s<=57343?t[r++]=1024*(a-55296)+s-56320+65536:(t[r++]=a,t[r++]=s)}else 65279!==a&&(t[r++]=a)}return r},e}();t.StringToUtf32=n;var r=function(){function e(){this.interim=new Uint8Array(3)}return e.prototype.clear=function(){this.interim.fill(0)},e.prototype.decode=function(e,t){var n=e.length;if(!n)return 0;var r,i,o,a,s=0,c=0,l=0;if(this.interim[0]){var u=!1,h=this.interim[0];h&=192==(224&h)?31:224==(240&h)?15:7;for(var d=0,f=void 0;(f=63&this.interim[++d])&&d<4;)h<<=6,h|=f;for(var p=192==(224&this.interim[0])?2:224==(240&this.interim[0])?3:4,m=p-d;l=n)return 0;if(128!=(192&(f=e[l++]))){l--,u=!0;break}this.interim[d++]=f,h<<=6,h|=63&f}u||(2===p?h<128?l--:t[s++]=h:3===p?h<2048||h>=55296&&h<=57343||65279===h||(t[s++]=h):h<65536||h>1114111||(t[s++]=h)),this.interim.fill(0)}for(var g=n-4,v=l;v=n)return this.interim[0]=r,s;if(128!=(192&(i=e[v++]))){v--;continue}if((c=(31&r)<<6|63&i)<128){v--;continue}t[s++]=c}else if(224==(240&r)){if(v>=n)return this.interim[0]=r,s;if(128!=(192&(i=e[v++]))){v--;continue}if(v>=n)return this.interim[0]=r,this.interim[1]=i,s;if(128!=(192&(o=e[v++]))){v--;continue}if((c=(15&r)<<12|(63&i)<<6|63&o)<2048||c>=55296&&c<=57343||65279===c)continue;t[s++]=c}else if(240==(248&r)){if(v>=n)return this.interim[0]=r,s;if(128!=(192&(i=e[v++]))){v--;continue}if(v>=n)return this.interim[0]=r,this.interim[1]=i,s;if(128!=(192&(o=e[v++]))){v--;continue}if(v>=n)return this.interim[0]=r,this.interim[1]=i,this.interim[2]=o,s;if(128!=(192&(a=e[v++]))){v--;continue}if((c=(7&r)<<18|(63&i)<<12|(63&o)<<6|63&a)<65536||c>1114111)continue;t[s++]=c}}return s},e}();t.Utf8ToUtf32=r},225:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.UnicodeV6=void 0;var r,i=n(8273),o=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],a=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],s=function(){function e(){if(this.version="6",!r){r=new Uint8Array(65536),i.fill(r,1),r[0]=0,i.fill(r,0,1,32),i.fill(r,0,127,160),i.fill(r,2,4352,4448),r[9001]=2,r[9002]=2,i.fill(r,2,11904,42192),r[12351]=1,i.fill(r,2,44032,55204),i.fill(r,2,63744,64256),i.fill(r,2,65040,65050),i.fill(r,2,65072,65136),i.fill(r,2,65280,65377),i.fill(r,2,65504,65511);for(var e=0;et[i][1])return!1;for(;i>=r;)if(e>t[n=r+i>>1][1])r=n+1;else{if(!(e=131072&&e<=196605||e>=196608&&e<=262141?2:1},e}();t.UnicodeV6=s},5981:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.WriteBuffer=void 0;var n=function(){function e(e){this._action=e,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0}return e.prototype.writeSync=function(e){if(this._writeBuffer.length){for(var t=this._bufferOffset;t5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(function(){return n._innerWrite()})),this._pendingData+=e.length,this._writeBuffer.push(e),this._callbacks.push(t)},e.prototype._innerWrite=function(){for(var e=this,t=Date.now();this._writeBuffer.length>this._bufferOffset;){var n=this._writeBuffer[this._bufferOffset],r=this._callbacks[this._bufferOffset];if(this._bufferOffset++,this._action(n),this._pendingData-=n.length,r&&r(),Date.now()-t>=12)break}this._writeBuffer.length>this._bufferOffset?(this._bufferOffset>50&&(this._writeBuffer=this._writeBuffer.slice(this._bufferOffset),this._callbacks=this._callbacks.slice(this._bufferOffset),this._bufferOffset=0),setTimeout(function(){return e._innerWrite()},0)):(this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0)},e}();t.WriteBuffer=n},5770:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.PAYLOAD_LIMIT=void 0,t.PAYLOAD_LIMIT=1e7},6351:function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.DcsHandler=t.DcsParser=void 0;var r=n(482),i=n(8742),o=n(5770),a=[],s=function(){function e(){this._handlers=Object.create(null),this._active=a,this._ident=0,this._handlerFb=function(){}}return e.prototype.dispose=function(){this._handlers=Object.create(null),this._handlerFb=function(){},this._active=a},e.prototype.registerHandler=function(e,t){void 0===this._handlers[e]&&(this._handlers[e]=[]);var n=this._handlers[e];return n.push(t),{dispose:function(){var e=n.indexOf(t);-1!==e&&n.splice(e,1)}}},e.prototype.clearHandler=function(e){this._handlers[e]&&delete this._handlers[e]},e.prototype.setHandlerFallback=function(e){this._handlerFb=e},e.prototype.reset=function(){this._active.length&&this.unhook(!1),this._active=a,this._ident=0},e.prototype.hook=function(e,t){if(this.reset(),this._ident=e,this._active=this._handlers[e]||a,this._active.length)for(var n=this._active.length-1;n>=0;n--)this._active[n].hook(t);else this._handlerFb(this._ident,"HOOK",t)},e.prototype.put=function(e,t,n){if(this._active.length)for(var i=this._active.length-1;i>=0;i--)this._active[i].put(e,t,n);else this._handlerFb(this._ident,"PUT",r.utf32ToString(e,t,n))},e.prototype.unhook=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].unhook(e);t--);for(t--;t>=0;t--)this._active[t].unhook(!1)}else this._handlerFb(this._ident,"UNHOOK",e);this._active=a,this._ident=0},e}();t.DcsParser=s;var c=new i.Params;c.addParam(0);var l=function(){function e(e){this._handler=e,this._data="",this._params=c,this._hitLimit=!1}return e.prototype.hook=function(e){this._params=e.length>1||e.params[0]?e.clone():c,this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,n){this._hitLimit||(this._data+=r.utf32ToString(e,t,n),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.unhook=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data,this._params)),this._params=c,this._data="",this._hitLimit=!1,t},e}();t.DcsHandler=l},2015:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.EscapeSequenceParser=t.VT500_TRANSITION_TABLE=t.TransitionTable=void 0;var o=n(844),a=n(8273),s=n(8742),c=n(6242),l=n(6351),u=function(){function e(e){this.table=new Uint8Array(e)}return e.prototype.setDefault=function(e,t){a.fill(this.table,e<<4|t)},e.prototype.add=function(e,t,n,r){this.table[t<<8|e]=n<<4|r},e.prototype.addMany=function(e,t,n,r){for(var i=0;i1)throw new Error("only one byte as prefix supported");if((n=e.prefix.charCodeAt(0))&&60>n||n>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(e.intermediates){if(e.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(var r=0;ri||i>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");n<<=8,n|=i}}if(1!==e.final.length)throw new Error("final must be a single byte");var o=e.final.charCodeAt(0);if(t[0]>o||o>t[1])throw new Error("final must be in range "+t[0]+" .. "+t[1]);return(n<<=8)|o},n.prototype.identToString=function(e){for(var t=[];e;)t.push(String.fromCharCode(255&e)),e>>=8;return t.reverse().join("")},n.prototype.dispose=function(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()},n.prototype.setPrintHandler=function(e){this._printHandler=e},n.prototype.clearPrintHandler=function(){this._printHandler=this._printHandlerFb},n.prototype.registerEscHandler=function(e,t){var n=this._identifier(e,[48,126]);void 0===this._escHandlers[n]&&(this._escHandlers[n]=[]);var r=this._escHandlers[n];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},n.prototype.clearEscHandler=function(e){this._escHandlers[this._identifier(e,[48,126])]&&delete this._escHandlers[this._identifier(e,[48,126])]},n.prototype.setEscHandlerFallback=function(e){this._escHandlerFb=e},n.prototype.setExecuteHandler=function(e,t){this._executeHandlers[e.charCodeAt(0)]=t},n.prototype.clearExecuteHandler=function(e){this._executeHandlers[e.charCodeAt(0)]&&delete this._executeHandlers[e.charCodeAt(0)]},n.prototype.setExecuteHandlerFallback=function(e){this._executeHandlerFb=e},n.prototype.registerCsiHandler=function(e,t){var n=this._identifier(e);void 0===this._csiHandlers[n]&&(this._csiHandlers[n]=[]);var r=this._csiHandlers[n];return r.push(t),{dispose:function(){var e=r.indexOf(t);-1!==e&&r.splice(e,1)}}},n.prototype.clearCsiHandler=function(e){this._csiHandlers[this._identifier(e)]&&delete this._csiHandlers[this._identifier(e)]},n.prototype.setCsiHandlerFallback=function(e){this._csiHandlerFb=e},n.prototype.registerDcsHandler=function(e,t){return this._dcsParser.registerHandler(this._identifier(e),t)},n.prototype.clearDcsHandler=function(e){this._dcsParser.clearHandler(this._identifier(e))},n.prototype.setDcsHandlerFallback=function(e){this._dcsParser.setHandlerFallback(e)},n.prototype.registerOscHandler=function(e,t){return this._oscParser.registerHandler(e,t)},n.prototype.clearOscHandler=function(e){this._oscParser.clearHandler(e)},n.prototype.setOscHandlerFallback=function(e){this._oscParser.setHandlerFallback(e)},n.prototype.setErrorHandler=function(e){this._errorHandler=e},n.prototype.clearErrorHandler=function(){this._errorHandler=this._errorHandlerFb},n.prototype.reset=function(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0},n.prototype.parse=function(e,t){for(var n=0,r=0,i=this.currentState,o=this._oscParser,a=this._dcsParser,s=this._collect,c=this._params,l=this._transitions.table,u=0;u>4){case 2:for(var d=u+1;;++d){if(d>=t||(n=e[d])<32||n>126&&n=t||(n=e[d])<32||n>126&&n=t||(n=e[d])<32||n>126&&n=t||(n=e[d])<32||n>126&&n=0&&!f[p](c);p--);p<0&&this._csiHandlerFb(s<<8|n,c),this.precedingCodepoint=0;break;case 8:do{switch(n){case 59:c.addParam(0);break;case 58:c.addSubParam(-1);break;default:c.addDigit(n-48)}}while(++u47&&n<60);u--;break;case 9:s<<=8,s|=n;break;case 10:for(var m=this._escHandlers[s<<8|n],g=m?m.length-1:-1;g>=0&&!m[g]();g--);g<0&&this._escHandlerFb(s<<8|n),this.precedingCodepoint=0;break;case 11:c.reset(),c.addParam(0),s=0;break;case 12:a.hook(s<<8|n,c);break;case 13:for(var v=u+1;;++v)if(v>=t||24===(n=e[v])||26===n||27===n||n>127&&n=t||(n=e[b])<32||n>127&&n=0;e--)this._active[e].start();else this._handlerFb(this._id,"START")},e.prototype._put=function(e,t,n){if(this._active.length)for(var r=this._active.length-1;r>=0;r--)this._active[r].put(e,t,n);else this._handlerFb(this._id,"PUT",i.utf32ToString(e,t,n))},e.prototype._end=function(e){if(this._active.length){for(var t=this._active.length-1;t>=0&&!this._active[t].end(e);t--);for(t--;t>=0;t--)this._active[t].end(!1)}else this._handlerFb(this._id,"END",e)},e.prototype.start=function(){this.reset(),this._state=1},e.prototype.put=function(e,t,n){if(3!==this._state){if(1===this._state)for(;t0&&this._put(e,t,n)}},e.prototype.end=function(e){0!==this._state&&(3!==this._state&&(1===this._state&&this._start(),this._end(e)),this._active=o,this._id=-1,this._state=0)},e}();t.OscParser=a;var s=function(){function e(e){this._handler=e,this._data="",this._hitLimit=!1}return e.prototype.start=function(){this._data="",this._hitLimit=!1},e.prototype.put=function(e,t,n){this._hitLimit||(this._data+=i.utf32ToString(e,t,n),this._data.length>r.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))},e.prototype.end=function(e){var t=!1;return this._hitLimit?t=!1:e&&(t=this._handler(this._data)),this._data="",this._hitLimit=!1,t},e}();t.OscHandler=s},8742:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.Params=void 0;var n=2147483647,r=function(){function e(e,t){if(void 0===e&&(e=32),void 0===t&&(t=32),this.maxLength=e,this.maxSubParamsLength=t,t>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(e),this.length=0,this._subParams=new Int32Array(t),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(e),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}return e.fromArray=function(t){var n=new e;if(!t.length)return n;for(var r=t[0]instanceof Array?1:0;r>8,r=255&this._subParamsIdx[t];r-n>0&&e.push(Array.prototype.slice.call(this._subParams,n,r))}return e},e.prototype.reset=function(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1},e.prototype.addParam=function(e){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=e>n?n:e}},e.prototype.addSubParam=function(e){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(e<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=e>n?n:e,this._subParamsIdx[this.length-1]++}},e.prototype.hasSubParams=function(e){return(255&this._subParamsIdx[e])-(this._subParamsIdx[e]>>8)>0},e.prototype.getSubParams=function(e){var t=this._subParamsIdx[e]>>8,n=255&this._subParamsIdx[e];return n-t>0?this._subParams.subarray(t,n):null},e.prototype.getSubParamsAll=function(){for(var e={},t=0;t>8,r=255&this._subParamsIdx[t];r-n>0&&(e[t]=this._subParams.slice(n,r))}return e},e.prototype.addDigit=function(e){var t;if(!(this._rejectDigits||!(t=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)){var r=this._digitIsSub?this._subParams:this.params,i=r[t-1];r[t-1]=~i?Math.min(10*i+e,n):e}},e}();t.Params=r},744:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.BufferService=t.MINIMUM_ROWS=t.MINIMUM_COLS=void 0;var s=n(2585),c=n(5295),l=n(8460),u=n(844);t.MINIMUM_COLS=2,t.MINIMUM_ROWS=1;var h=function(e){function n(n){var r=e.call(this)||this;return r._optionsService=n,r.isUserScrolling=!1,r._onResize=new l.EventEmitter,r.cols=Math.max(n.options.cols,t.MINIMUM_COLS),r.rows=Math.max(n.options.rows,t.MINIMUM_ROWS),r.buffers=new c.BufferSet(n,r),r}return i(n,e),Object.defineProperty(n.prototype,"onResize",{get:function(){return this._onResize.event},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"buffer",{get:function(){return this.buffers.active},enumerable:!1,configurable:!0}),n.prototype.dispose=function(){e.prototype.dispose.call(this),this.buffers.dispose()},n.prototype.resize=function(e,t){this.cols=e,this.rows=t,this.buffers.resize(e,t),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:t})},n.prototype.reset=function(){this.buffers.reset(),this.isUserScrolling=!1},o([a(0,s.IOptionsService)],n)}(u.Disposable);t.BufferService=h},7994:function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.CharsetService=void 0;var n=function(){function e(){this.glevel=0,this._charsets=[]}return e.prototype.reset=function(){this.charset=void 0,this._charsets=[],this.glevel=0},e.prototype.setgLevel=function(e){this.glevel=e,this.charset=this._charsets[e]},e.prototype.setgCharset=function(e,t){this._charsets[e]=t,this.glevel===e&&(this.charset=t)},e}();t.CharsetService=n},1753:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreMouseService=void 0;var o=n(2585),a=n(8460),s={NONE:{events:0,restrict:function(){return!1}},X10:{events:1,restrict:function(e){return 4!==e.button&&1===e.action&&(e.ctrl=!1,e.alt=!1,e.shift=!1,!0)}},VT200:{events:19,restrict:function(e){return 32!==e.action}},DRAG:{events:23,restrict:function(e){return 32!==e.action||3!==e.button}},ANY:{events:31,restrict:function(e){return!0}}};function c(e,t){var n=(e.ctrl?16:0)|(e.shift?4:0)|(e.alt?8:0);return 4===e.button?(n|=64,n|=e.action):(n|=3&e.button,4&e.button&&(n|=64),8&e.button&&(n|=128),32===e.action?n|=32:0!==e.action||t||(n|=3)),n}var l=String.fromCharCode,u={DEFAULT:function(e){var t=[c(e,!1)+32,e.col+32,e.row+32];return t[0]>255||t[1]>255||t[2]>255?"":"\x1b[M"+l(t[0])+l(t[1])+l(t[2])},SGR:function(e){var t=0===e.action&&4!==e.button?"m":"M";return"\x1b[<"+c(e,!0)+";"+e.col+";"+e.row+t}},h=function(){function e(e,t){this._bufferService=e,this._coreService=t,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new a.EventEmitter,this._lastEvent=null;for(var n=0,r=Object.keys(s);n=this._bufferService.cols||e.row<0||e.row>=this._bufferService.rows)return!1;if(4===e.button&&32===e.action)return!1;if(3===e.button&&32!==e.action)return!1;if(4!==e.button&&(2===e.action||3===e.action))return!1;if(e.col++,e.row++,32===e.action&&this._lastEvent&&this._compareEvents(this._lastEvent,e))return!1;if(!this._protocols[this._activeProtocol].restrict(e))return!1;var t=this._encodings[this._activeEncoding](e);return t&&("DEFAULT"===this._activeEncoding?this._coreService.triggerBinaryEvent(t):this._coreService.triggerDataEvent(t,!0)),this._lastEvent=e,!0},e.prototype.explainEvents=function(e){return{down:!!(1&e),up:!!(2&e),drag:!!(4&e),move:!!(8&e),wheel:!!(16&e)}},e.prototype._compareEvents=function(e,t){return e.col===t.col&&e.row===t.row&&e.button===t.button&&e.action===t.action&&e.ctrl===t.ctrl&&e.alt===t.alt&&e.shift===t.shift},r([i(0,o.IBufferService),i(1,o.ICoreService)],e)}();t.CoreMouseService=h},6975:function(e,t,n){var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),o=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},a=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.CoreService=void 0;var s=n(2585),c=n(8460),l=n(1439),u=n(844),h=Object.freeze({insertMode:!1}),d=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0}),f=function(e){function t(t,n,r,i){var o=e.call(this)||this;return o._bufferService=n,o._logService=r,o._optionsService=i,o.isCursorInitialized=!1,o.isCursorHidden=!1,o._onData=o.register(new c.EventEmitter),o._onUserInput=o.register(new c.EventEmitter),o._onBinary=o.register(new c.EventEmitter),o._scrollToBottom=t,o.register({dispose:function(){return o._scrollToBottom=void 0}}),o.modes=l.clone(h),o.decPrivateModes=l.clone(d),o}return i(t,e),Object.defineProperty(t.prototype,"onData",{get:function(){return this._onData.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onUserInput",{get:function(){return this._onUserInput.event},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"onBinary",{get:function(){return this._onBinary.event},enumerable:!1,configurable:!0}),t.prototype.reset=function(){this.modes=l.clone(h),this.decPrivateModes=l.clone(d)},t.prototype.triggerDataEvent=function(e,t){if(void 0===t&&(t=!1),!this._optionsService.options.disableStdin){var n=this._bufferService.buffer;n.ybase!==n.ydisp&&this._scrollToBottom(),t&&this._onUserInput.fire(),this._logService.debug('sending data "'+e+'"',function(){return e.split("").map(function(e){return e.charCodeAt(0)})}),this._onData.fire(e)}},t.prototype.triggerBinaryEvent=function(e){this._optionsService.options.disableStdin||(this._logService.debug('sending binary "'+e+'"',function(){return e.split("").map(function(e){return e.charCodeAt(0)})}),this._onBinary.fire(e))},o([a(1,s.IBufferService),a(2,s.ILogService),a(3,s.IOptionsService)],t)}(u.Disposable);t.CoreService=f},3730:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}};Object.defineProperty(t,"__esModule",{value:!0}),t.DirtyRowService=void 0;var o=n(2585),a=function(){function e(e){this._bufferService=e,this.clearRange()}return Object.defineProperty(e.prototype,"start",{get:function(){return this._start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this._end},enumerable:!1,configurable:!0}),e.prototype.clearRange=function(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y},e.prototype.markDirty=function(e){ethis._end&&(this._end=e)},e.prototype.markRangeDirty=function(e,t){if(e>t){var n=e;e=t,t=n}ethis._end&&(this._end=t)},e.prototype.markAllDirty=function(){this.markRangeDirty(0,this._bufferService.rows-1)},r([i(0,o.IBufferService)],e)}();t.DirtyRowService=a},4348:function(e,t,n){var r=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t0?i[0].index:t.length;if(t.length!==h)throw new Error("[createInstance] First service dependency of "+e.name+" at position "+(h+1)+" conflicts with "+t.length+" static arguments");return new(e.bind.apply(e,r([void 0],r(t,a))))},e}();t.InstantiationService=s},7866:function(e,t,n){var r=this&&this.__decorate||function(e,t,n,r){var i,o=arguments.length,a=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a},i=this&&this.__param||function(e,t){return function(n,r){t(n,r,e)}},o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t=n)return t+this.wcwidth(i);var o=e.charCodeAt(r);56320<=o&&o<=57343?i=1024*(i-55296)+o-56320+65536:t+=this.wcwidth(o)}t+=this.wcwidth(i)}return t},e}();t.UnicodeService=o}},t={};return function n(r){if(t[r])return t[r].exports;var i=t[r]={exports:{}};return e[r].call(i.exports,i,i.exports,n),i.exports}(4389)}()},"/slF":function(e,t,n){var r=n("vd7W").isDigit,i=n("vd7W").cmpChar,o=n("vd7W").TYPE,a=o.Delim,s=o.WhiteSpace,c=o.Comment,l=o.Ident,u=o.Number,h=o.Dimension,d=45,f=!0;function p(e,t){return null!==e&&e.type===a&&e.value.charCodeAt(0)===t}function m(e,t,n){for(;null!==e&&(e.type===s||e.type===c);)e=n(++t);return t}function g(e,t,n,i){if(!e)return 0;var o=e.value.charCodeAt(t);if(43===o||o===d){if(n)return 0;t++}for(;t100&&(u=a-60+3,a=58);for(var h=s;h<=c;h++)h>=0&&h0&&r[h].length>u?"\u2026":"")+r[h].substr(u,98)+(r[h].length>u+100-1?"\u2026":""));return[n(s,o),new Array(a+l+2).join("-")+"^",n(o,c)].filter(Boolean).join("\n")}e.exports=function(e,t,n,i,a){var s=r("SyntaxError",e);return s.source=t,s.offset=n,s.line=i,s.column=a,s.sourceFragment=function(e){return o(s,isNaN(e)?0:e)},Object.defineProperty(s,"formattedMessage",{get:function(){return"Parse error: "+s.message+"\n"+o(s,2)}}),s.parseError={offset:n,line:i,column:a},s}},"1gRP":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("kU1M");t.materialize=function(){return r.materialize()(this)}},"1uah":function(e,t,n){"use strict";n.d(t,"b",function(){return d}),n.d(t,"a",function(){return f});var r=n("mvVQ"),i=n("/E8u"),o=n("MGFw"),a=n("WtWf"),s=n("yCtX"),c=n("DH7j"),l=n("7o/Q"),u=n("Lhse"),h=n("zx2A");function d(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]||Object.create(null),Object(o.a)(this,n),(i=t.call(this,e)).resultSelector=r,i.iterators=[],i.active=0,i.resultSelector="function"==typeof r?r:void 0,i}return Object(a.a)(n,[{key:"_next",value:function(e){var t=this.iterators;Object(c.a)(e)?t.push(new g(e)):t.push("function"==typeof e[u.a]?new m(e[u.a]()):new v(this.destination,this,e))}},{key:"_complete",value:function(){var e=this.iterators,t=e.length;if(this.unsubscribe(),0!==t){this.active=t;for(var n=0;nthis.index}},{key:"hasCompleted",value:function(){return this.array.length===this.index}}]),e}(),v=function(e){Object(r.a)(n,e);var t=Object(i.a)(n);function n(e,r,i){var a;return Object(o.a)(this,n),(a=t.call(this,e)).parent=r,a.observable=i,a.stillUnsubscribed=!0,a.buffer=[],a.isComplete=!1,a}return Object(a.a)(n,[{key:u.a,value:function(){return this}},{key:"next",value:function(){var e=this.buffer;return 0===e.length&&this.isComplete?{value:null,done:!0}:{value:e.shift(),done:!1}}},{key:"hasValue",value:function(){return this.buffer.length>0}},{key:"hasCompleted",value:function(){return 0===this.buffer.length&&this.isComplete}},{key:"notifyComplete",value:function(){this.buffer.length>0?(this.isComplete=!0,this.parent.notifyInactive()):this.destination.complete()}},{key:"notifyNext",value:function(e){this.buffer.push(e),this.parent.checkIterators()}},{key:"subscribe",value:function(){return Object(h.c)(this.observable,new h.a(this))}}]),n}(h.b)},"2+DN":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("uMcE");r.Observable.prototype.shareReplay=i.shareReplay},"2Gxe":function(e,t,n){var r=n("vd7W").TYPE,i=r.Ident,o=r.String,a=r.Colon,s=r.LeftSquareBracket,c=r.RightSquareBracket;function l(){this.scanner.eof&&this.error("Unexpected end of input");var e=this.scanner.tokenStart,t=!1,n=!0;return this.scanner.isDelim(42)?(t=!0,n=!1,this.scanner.next()):this.scanner.isDelim(124)||this.eat(i),this.scanner.isDelim(124)?61!==this.scanner.source.charCodeAt(this.scanner.tokenStart+1)?(this.scanner.next(),this.eat(i)):t&&this.error("Identifier is expected",this.scanner.tokenEnd):t&&this.error("Vertical line is expected"),n&&this.scanner.tokenType===a&&(this.scanner.next(),this.eat(i)),{type:"Identifier",loc:this.getLocation(e,this.scanner.tokenStart),name:this.scanner.substrToCursor(e)}}function u(){var e=this.scanner.tokenStart,t=this.scanner.source.charCodeAt(e);return 61!==t&&126!==t&&94!==t&&36!==t&&42!==t&&124!==t&&this.error("Attribute selector (=, ~=, ^=, $=, *=, |=) is expected"),this.scanner.next(),61!==t&&(this.scanner.isDelim(61)||this.error("Equal sign is expected"),this.scanner.next()),this.scanner.substrToCursor(e)}e.exports={name:"AttributeSelector",structure:{name:"Identifier",matcher:[String,null],value:["String","Identifier",null],flags:[String,null]},parse:function(){var e,t=this.scanner.tokenStart,n=null,r=null,a=null;return this.eat(s),this.scanner.skipSC(),e=l.call(this),this.scanner.skipSC(),this.scanner.tokenType!==c&&(this.scanner.tokenType!==i&&(n=u.call(this),this.scanner.skipSC(),r=this.scanner.tokenType===o?this.String():this.Identifier(),this.scanner.skipSC()),this.scanner.tokenType===i&&(a=this.scanner.getTokenValue(),this.scanner.next(),this.scanner.skipSC())),this.eat(c),{type:"AttributeSelector",loc:this.getLocation(t,this.scanner.tokenStart),name:e,matcher:n,value:r,flags:a}},generate:function(e){var t=" ";this.chunk("["),this.node(e.name),null!==e.matcher&&(this.chunk(e.matcher),null!==e.value&&(this.node(e.value),"String"===e.value.type&&(t=""))),null!==e.flags&&(this.chunk(t),this.chunk(e.flags)),this.chunk("]")}}},"2IC2":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("j5kd");r.Observable.prototype.windowTime=i.windowTime},"2QA8":function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},"2TAq":function(e,t,n){var r=n("vd7W").isHexDigit,i=n("vd7W").cmpChar,o=n("vd7W").TYPE,a=o.Ident,s=o.Delim,c=o.Number,l=o.Dimension;function u(e,t){return null!==e&&e.type===s&&e.value.charCodeAt(0)===t}function h(e,t){return e.value.charCodeAt(0)===t}function d(e,t,n){for(var i=t,o=0;i0?6:0;if(!r(a))return 0;if(++o>6)return 0}return o}function f(e,t,n){if(!e)return 0;for(;u(n(t),63);){if(++e>6)return 0;t++}return t}e.exports=function(e,t){var n=0;if(null===e||e.type!==a||!i(e.value,0,117))return 0;if(null===(e=t(++n)))return 0;if(u(e,43))return null===(e=t(++n))?0:e.type===a?f(d(e,0,!0),++n,t):u(e,63)?f(1,++n,t):0;if(e.type===c){if(!h(e,43))return 0;var r=d(e,1,!0);return 0===r?0:null===(e=t(++n))?n:e.type===l||e.type===c?h(e,45)&&d(e,1,!1)?n+1:0:f(r,n,t)}return e.type===l&&h(e,43)?f(d(e,1,!0),++n,t):0}},"2Vo4":function(e,t,n){"use strict";n.d(t,"a",function(){return h});var r=n("MGFw"),i=n("WtWf"),o=n("t9bE"),a=n("KUzl"),s=n("mvVQ"),c=n("/E8u"),l=n("XNiG"),u=n("9ppp"),h=function(e){Object(s.a)(n,e);var t=Object(c.a)(n);function n(e){var i;return Object(r.a)(this,n),(i=t.call(this))._value=e,i}return Object(i.a)(n,[{key:"value",get:function(){return this.getValue()}},{key:"_subscribe",value:function(e){var t=Object(o.a)(Object(a.a)(n.prototype),"_subscribe",this).call(this,e);return t&&!t.closed&&e.next(this._value),t}},{key:"getValue",value:function(){if(this.hasError)throw this.thrownError;if(this.closed)throw new u.a;return this._value}},{key:"next",value:function(e){Object(o.a)(Object(a.a)(n.prototype),"next",this).call(this,this._value=e)}}]),n}(l.b)},"2W6z":function(e,t,n){"use strict";e.exports=function(){}},"2fFW":function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=!1,i={Promise:void 0,set useDeprecatedSynchronousErrorHandling(e){if(e){var t=new Error;console.warn("DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n"+t.stack)}else r&&console.log("RxJS: Back to a better error behavior. Thank you. <3");r=e},get useDeprecatedSynchronousErrorHandling(){return r}}},"2pxp":function(e,t){e.exports={parse:function(){return this.createSingleNodeList(this.SelectorList())}}},"338f":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("kU1M");t.concatMap=function(e){return r.concatMap(e)(this)}},"33Dm":function(e,t,n){var r=n("vd7W").TYPE,i=r.WhiteSpace,o=r.Comment,a=r.Ident,s=r.LeftParenthesis;e.exports={name:"MediaQuery",structure:{children:[["Identifier","MediaFeature","WhiteSpace"]]},parse:function(){this.scanner.skipSC();var e=this.createList(),t=null,n=null;e:for(;!this.scanner.eof;){switch(this.scanner.tokenType){case o:this.scanner.next();continue;case i:n=this.WhiteSpace();continue;case a:t=this.Identifier();break;case s:t=this.MediaFeature();break;default:break e}null!==n&&(e.push(n),n=null),e.push(t)}return null===t&&this.error("Identifier or parenthesis is expected"),{type:"MediaQuery",loc:this.getLocationFromList(e),children:e}},generate:function(e){this.children(e)}}},"37L2":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("338f");r.Observable.prototype.concatMap=i.concatMap},"3E0/":function(e,t,n){"use strict";n.d(t,"a",function(){return h});var r=n("mvVQ"),i=n("/E8u"),o=n("MGFw"),a=n("WtWf"),s=n("D0XW"),c=n("mlxB"),l=n("7o/Q"),u=n("WMd4");function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s.a,n=Object(c.a)(e),r=n?+e-t.now():Math.abs(e);return function(e){return e.lift(new d(r,t))}}var d=function(){function e(t,n){Object(o.a)(this,e),this.delay=t,this.scheduler=n}return Object(a.a)(e,[{key:"call",value:function(e,t){return t.subscribe(new f(e,this.delay,this.scheduler))}}]),e}(),f=function(e){Object(r.a)(n,e);var t=Object(i.a)(n);function n(e,r,i){var a;return Object(o.a)(this,n),(a=t.call(this,e)).delay=r,a.scheduler=i,a.queue=[],a.active=!1,a.errored=!1,a}return Object(a.a)(n,[{key:"_schedule",value:function(e){this.active=!0,this.destination.add(e.schedule(n.dispatch,this.delay,{source:this,destination:this.destination,scheduler:e}))}},{key:"scheduleNotification",value:function(e){if(!0!==this.errored){var t=this.scheduler,n=new p(t.now()+this.delay,e);this.queue.push(n),!1===this.active&&this._schedule(t)}}},{key:"_next",value:function(e){this.scheduleNotification(u.a.createNext(e))}},{key:"_error",value:function(e){this.errored=!0,this.queue=[],this.destination.error(e),this.unsubscribe()}},{key:"_complete",value:function(){this.scheduleNotification(u.a.createComplete()),this.unsubscribe()}}],[{key:"dispatch",value:function(e){for(var t=e.source,n=t.queue,r=e.scheduler,i=e.destination;n.length>0&&n[0].time-r.now()<=0;)n.shift().notification.observe(i);if(n.length>0){var o=Math.max(0,n[0].time-r.now());this.schedule(e,o)}else this.unsubscribe(),t.active=!1}}]),n}(l.a),p=function e(t,n){Object(o.a)(this,e),this.time=t,this.notification=n}},"3EiV":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp"),i=n("dL1u");r.Observable.prototype.buffer=i.buffer},"3N8a":function(e,t,n){"use strict";n.d(t,"a",function(){return s});var r=n("MGFw"),i=n("WtWf"),o=n("mvVQ"),a=n("/E8u"),s=function(e){Object(o.a)(n,e);var t=Object(a.a)(n);function n(e,i){var o;return Object(r.a)(this,n),(o=t.call(this,e,i)).scheduler=e,o.work=i,o.pending=!1,o}return Object(i.a)(n,[{key:"schedule",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(this.closed)return this;this.state=e;var n=this.id,r=this.scheduler;return null!=n&&(this.id=this.recycleAsyncId(r,n,t)),this.pending=!0,this.delay=t,this.id=this.id||this.requestAsyncId(r,this.id,t),this}},{key:"requestAsyncId",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return setInterval(e.flush.bind(e,this),n)}},{key:"recycleAsyncId",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(null!==n&&this.delay===n&&!1===this.pending)return t;clearInterval(t)}},{key:"execute",value:function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))}},{key:"_execute",value:function(e,t){var n=!1,r=void 0;try{this.work(e)}catch(i){n=!0,r=!!i&&i||new Error(i)}if(n)return this.unsubscribe(),r}},{key:"_unsubscribe",value:function(){var e=this.id,t=this.scheduler,n=t.actions,r=n.indexOf(this);this.work=null,this.state=null,this.pending=!1,this.scheduler=null,-1!==r&&n.splice(r,1),null!=e&&(this.id=this.recycleAsyncId(t,e,null)),this.delay=null}}]),n}(function(e){Object(o.a)(n,e);var t=Object(a.a)(n);function n(e,i){return Object(r.a)(this,n),t.call(this)}return Object(i.a)(n,[{key:"schedule",value:function(e){return this}}]),n}(n("quSY").a))},"3Qpg":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("qCKp");r.Observable.fromPromise=r.from},"3UWI":function(e,t,n){"use strict";n.d(t,"a",function(){return a});var r=n("D0XW"),i=n("tnsW"),o=n("PqYM");function a(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:r.a;return Object(i.a)(function(){return Object(o.a)(e,t)})}},"3XNy":function(e,t){function n(e){return e>=48&&e<=57}function r(e){return e>=65&&e<=90}function i(e){return e>=97&&e<=122}function o(e){return r(e)||i(e)}function a(e){return e>=128}function s(e){return o(e)||a(e)||95===e}function c(e){return e>=0&&e<=8||11===e||e>=14&&e<=31||127===e}function l(e){return 10===e||13===e||12===e}function u(e){return l(e)||32===e||9===e}function h(e,t){return 92===e&&!l(t)&&0!==t}var d=new Array(128);p.Eof=128,p.WhiteSpace=130,p.Digit=131,p.NameStart=132,p.NonPrintable=133;for(var f=0;f=65&&e<=70||e>=97&&e<=102},isUppercaseLetter:r,isLowercaseLetter:i,isLetter:o,isNonAscii:a,isNameStart:s,isName:function(e){return s(e)||n(e)||45===e},isNonPrintable:c,isNewline:l,isWhiteSpace:u,isValidEscape:h,isIdentifierStart:function(e,t,n){return 45===e?s(t)||45===t||h(t,n):!!s(e)||92===e&&h(e,t)},isNumberStart:function(e,t,r){return 43===e||45===e?n(t)?2:46===t&&n(r)?3:0:46===e?n(t)?2:0:n(e)?1:0},isBOM:function(e){return 65279===e||65534===e?1:0},charCodeCategory:p}},"3uOa":function(e,t,n){"use strict";n.r(t);var r=n("lcII");n.d(t,"webSocket",function(){return r.a});var i=n("wxn8");n.d(t,"WebSocketSubject",function(){return i.a})},"4AtU":function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n("kU1M");t.expand=function(e,t,n){return void 0===t&&(t=Number.POSITIVE_INFINITY),void 0===n&&(n=void 0),r.expand(e,t=(t||0)<1?Number.POSITIVE_INFINITY:t,n)(this)}},"4D8k":function(e,t,n){"use strict";var r=n("9Qh4"),i=n("fEpb").Symbol;e.exports=function(e){return Object.defineProperties(e,{hasInstance:r("",i&&i.hasInstance||e("hasInstance")),isConcatSpreadable:r("",i&&i.isConcatSpreadable||e("isConcatSpreadable")),iterator:r("",i&&i.iterator||e("iterator")),match:r("",i&&i.match||e("match")),replace:r("",i&&i.replace||e("replace")),search:r("",i&&i.search||e("search")),species:r("",i&&i.species||e("species")),split:r("",i&&i.split||e("split")),toPrimitive:r("",i&&i.toPrimitive||e("toPrimitive")),toStringTag:r("",i&&i.toStringTag||e("toStringTag")),unscopables:r("",i&&i.unscopables||e("unscopables"))})}},"4HHr":function(e,t){var n=Object.prototype.hasOwnProperty,r=function(){};function i(e){return"function"==typeof e?e:r}function o(e,t){return function(n,r,i){n.type===t&&e.call(this,n,r,i)}}function a(e,t){var r=t.structure,i=[];for(var o in r)if(!1!==n.call(r,o)){var a=r[o],s={name:o,type:!1,nullable:!1};Array.isArray(r[o])||(a=[r[o]]);for(var c=0;c>>((3&t)<<3)&255;return i}}},"4hIw":function(e,t,n){"use strict";n.d(t,"b",function(){return c}),n.d(t,"a",function(){return l});var r=n("MGFw"),i=n("D0XW"),o=n("Kqap"),a=n("NXyV"),s=n("lJxs");function c(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i.a;return function(t){return Object(a.a)(function(){return t.pipe(Object(o.a)(function(t,n){var r=t.current;return{value:n,current:e.now(),last:r}},{current:e.now(),value:void 0,last:void 0}),Object(s.a)(function(e){return new l(e.value,e.current-e.last)}))})}}var l=function e(t,n){Object(r.a)(this,e),this.value=t,this.interval=n}},"4njK":function(e,t,n){var r=n("vd7W").TYPE,i=r.WhiteSpace,o=r.Semicolon,a=r.LeftCurlyBracket,s=r.Delim;function c(){return this.scanner.tokenIndex>0&&this.scanner.lookupType(-1)===i?this.scanner.tokenIndex>1?this.scanner.getTokenStart(this.scanner.tokenIndex-1):this.scanner.firstCharOffset:this.scanner.tokenStart}function l(){return 0}e.exports={name:"Raw",structure:{value:String},parse:function(e,t,n){var r,i=this.scanner.getTokenStart(e);return this.scanner.skip(this.scanner.getRawLength(e,t||l)),r=n&&this.scanner.tokenStart>i?c.call(this):this.scanner.tokenStart,{type:"Raw",loc:this.getLocation(i,r),value:this.scanner.source.substring(i,r)}},generate:function(e){this.chunk(e.value)},mode:{default:l,leftCurlyBracket:function(e){return e===a?1:0},leftCurlyBracketOrSemicolon:function(e){return e===a||e===o?1:0},exclamationMarkOrSemicolon:function(e,t,n){return e===s&&33===t.charCodeAt(n)||e===o?1:0},semicolonIncluded:function(e){return e===o?2:0}}}},"4vYp":function(e){e.exports=JSON.parse('{"generic":true,"types":{"absolute-size":"xx-small|x-small|small|medium|large|x-large|xx-large","alpha-value":"|","angle-percentage":"|","angular-color-hint":"","angular-color-stop":"&&?","angular-color-stop-list":"[ [, ]?]# , ","animateable-feature":"scroll-position|contents|","attachment":"scroll|fixed|local","attr()":"attr( ? [, ]? )","attr-matcher":"[\'~\'|\'|\'|\'^\'|\'$\'|\'*\']? \'=\'","attr-modifier":"i|s","attribute-selector":"\'[\' \']\'|\'[\' [|] ? \']\'","auto-repeat":"repeat( [auto-fill|auto-fit] , [? ]+ ? )","auto-track-list":"[? [|]]* ? [? [|]]* ?","baseline-position":"[first|last]? baseline","basic-shape":"|||","bg-image":"none|","bg-layer":"|| [/ ]?||||||||","bg-position":"[[left|center|right|top|bottom|]|[left|center|right|] [top|center|bottom|]|[center|[left|right] ?]&&[center|[top|bottom] ?]]","bg-size":"[|auto]{1,2}|cover|contain","blur()":"blur( )","blend-mode":"normal|multiply|screen|overlay|darken|lighten|color-dodge|color-burn|hard-light|soft-light|difference|exclusion|hue|saturation|color|luminosity","box":"border-box|padding-box|content-box","brightness()":"brightness( )","calc()":"calc( )","calc-sum":" [[\'+\'|\'-\'] ]*","calc-product":" [\'*\' |\'/\' ]*","calc-value":"|||( )","cf-final-image":"|","cf-mixing-image":"?&&","circle()":"circle( []? [at ]? )","clamp()":"clamp( #{3} )","class-selector":"\'.\' ","clip-source":"","color":"||||||currentcolor|","color-stop":"|","color-stop-angle":"{1,2}","color-stop-length":"{1,2}","color-stop-list":"[ [, ]?]# , ","combinator":"\'>\'|\'+\'|\'~\'|[\'||\']","common-lig-values":"[common-ligatures|no-common-ligatures]","compat":"searchfield|textarea|push-button|button-bevel|slider-horizontal|checkbox|radio|square-button|menulist|menulist-button|listbox|meter|progress-bar","composite-style":"clear|copy|source-over|source-in|source-out|source-atop|destination-over|destination-in|destination-out|destination-atop|xor","compositing-operator":"add|subtract|intersect|exclude","compound-selector":"[? * [ *]*]!","compound-selector-list":"#","complex-selector":" [? ]*","complex-selector-list":"#","conic-gradient()":"conic-gradient( [from ]? [at ]? , )","contextual-alt-values":"[contextual|no-contextual]","content-distribution":"space-between|space-around|space-evenly|stretch","content-list":"[|contents||||counter( , <\'list-style-type\'>? )]+","content-position":"center|start|end|flex-start|flex-end","content-replacement":"","contrast()":"contrast( [] )","counter()":"counter( , [|none]? )","counter-style":"|symbols( )","counter-style-name":"","counters()":"counters( , , [|none]? )","cross-fade()":"cross-fade( , ? )","cubic-bezier-timing-function":"ease|ease-in|ease-out|ease-in-out|cubic-bezier( , , , )","deprecated-system-color":"ActiveBorder|ActiveCaption|AppWorkspace|Background|ButtonFace|ButtonHighlight|ButtonShadow|ButtonText|CaptionText|GrayText|Highlight|HighlightText|InactiveBorder|InactiveCaption|InactiveCaptionText|InfoBackground|InfoText|Menu|MenuText|Scrollbar|ThreeDDarkShadow|ThreeDFace|ThreeDHighlight|ThreeDLightShadow|ThreeDShadow|Window|WindowFrame|WindowText","discretionary-lig-values":"[discretionary-ligatures|no-discretionary-ligatures]","display-box":"contents|none","display-inside":"flow|flow-root|table|flex|grid|ruby","display-internal":"table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption|ruby-base|ruby-text|ruby-base-container|ruby-text-container","display-legacy":"inline-block|inline-list-item|inline-table|inline-flex|inline-grid","display-listitem":"?&&[flow|flow-root]?&&list-item","display-outside":"block|inline|run-in","drop-shadow()":"drop-shadow( {2,3} ? )","east-asian-variant-values":"[jis78|jis83|jis90|jis04|simplified|traditional]","east-asian-width-values":"[full-width|proportional-width]","element()":"element( )","ellipse()":"ellipse( [{2}]? [at ]? )","ending-shape":"circle|ellipse","env()":"env( , ? )","explicit-track-list":"[? ]+ ?","family-name":"|+","feature-tag-value":" [|on|off]?","feature-type":"@stylistic|@historical-forms|@styleset|@character-variant|@swash|@ornaments|@annotation","feature-value-block":" \'{\' \'}\'","feature-value-block-list":"+","feature-value-declaration":" : + ;","feature-value-declaration-list":"","feature-value-name":"","fill-rule":"nonzero|evenodd","filter-function":"|||||||||","filter-function-list":"[|]+","final-bg-layer":"<\'background-color\'>|||| [/ ]?||||||||","fit-content()":"fit-content( [|] )","fixed-breadth":"","fixed-repeat":"repeat( [] , [? ]+ ? )","fixed-size":"|minmax( , )|minmax( , )","font-stretch-absolute":"normal|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded|","font-variant-css21":"[normal|small-caps]","font-weight-absolute":"normal|bold|","frequency-percentage":"|","general-enclosed":"[ )]|( )","generic-family":"serif|sans-serif|cursive|fantasy|monospace|-apple-system","generic-name":"serif|sans-serif|cursive|fantasy|monospace","geometry-box":"|fill-box|stroke-box|view-box","gradient":"|||||<-legacy-gradient>","grayscale()":"grayscale( )","grid-line":"auto||[&&?]|[span&&[||]]","historical-lig-values":"[historical-ligatures|no-historical-ligatures]","hsl()":"hsl( [/ ]? )|hsl( , , , ? )","hsla()":"hsla( [/ ]? )|hsla( , , , ? )","hue":"|","hue-rotate()":"hue-rotate( )","image":"|||||","image()":"image( ? [? , ?]! )","image-set()":"image-set( # )","image-set-option":"[|] ","image-src":"|","image-tags":"ltr|rtl","inflexible-breadth":"||min-content|max-content|auto","inset()":"inset( {1,4} [round <\'border-radius\'>]? )","invert()":"invert( )","keyframes-name":"|","keyframe-block":"# { }","keyframe-block-list":"+","keyframe-selector":"from|to|","leader()":"leader( )","leader-type":"dotted|solid|space|","length-percentage":"|","line-names":"\'[\' * \']\'","line-name-list":"[|]+","line-style":"none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset","line-width":"|thin|medium|thick","linear-color-hint":"","linear-color-stop":" ?","linear-gradient()":"linear-gradient( [|to ]? , )","mask-layer":"|| [/ ]?||||||[|no-clip]||||","mask-position":"[|left|center|right] [|top|center|bottom]?","mask-reference":"none||","mask-source":"","masking-mode":"alpha|luminance|match-source","matrix()":"matrix( #{6} )","matrix3d()":"matrix3d( #{16} )","max()":"max( # )","media-and":" [and ]+","media-condition":"|||","media-condition-without-or":"||","media-feature":"( [||] )","media-in-parens":"( )||","media-not":"not ","media-or":" [or ]+","media-query":"|[not|only]? [and ]?","media-query-list":"#","media-type":"","mf-boolean":"","mf-name":"","mf-plain":" : ","mf-range":" [\'<\'|\'>\']? \'=\'? | [\'<\'|\'>\']? \'=\'? | \'<\' \'=\'? \'<\' \'=\'? | \'>\' \'=\'? \'>\' \'=\'? ","mf-value":"|||","min()":"min( # )","minmax()":"minmax( [|||min-content|max-content|auto] , [|||min-content|max-content|auto] )","named-color":"transparent|aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkgrey|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkslategrey|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dimgrey|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|grey|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgray|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightslategrey|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|rebeccapurple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|slategrey|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|violet|wheat|white|whitesmoke|yellow|yellowgreen|<-non-standard-color>","namespace-prefix":"","ns-prefix":"[|\'*\']? \'|\'","number-percentage":"|","numeric-figure-values":"[lining-nums|oldstyle-nums]","numeric-fraction-values":"[diagonal-fractions|stacked-fractions]","numeric-spacing-values":"[proportional-nums|tabular-nums]","nth":"|even|odd","opacity()":"opacity( [] )","overflow-position":"unsafe|safe","outline-radius":"|","page-body":"? [; ]?| ","page-margin-box":" \'{\' \'}\'","page-margin-box-type":"@top-left-corner|@top-left|@top-center|@top-right|@top-right-corner|@bottom-left-corner|@bottom-left|@bottom-center|@bottom-right|@bottom-right-corner|@left-top|@left-middle|@left-bottom|@right-top|@right-middle|@right-bottom","page-selector-list":"[#]?","page-selector":"+| *","perspective()":"perspective( )","polygon()":"polygon( ? , [ ]# )","position":"[[left|center|right]||[top|center|bottom]|[left|center|right|] [top|center|bottom|]?|[[left|right] ]&&[[top|bottom] ]]","pseudo-class-selector":"\':\' |\':\' \')\'","pseudo-element-selector":"\':\' ","pseudo-page":": [left|right|first|blank]","quote":"open-quote|close-quote|no-open-quote|no-close-quote","radial-gradient()":"radial-gradient( [||]? [at ]? , )","relative-selector":"? ","relative-selector-list":"#","relative-size":"larger|smaller","repeat-style":"repeat-x|repeat-y|[repeat|space|round|no-repeat]{1,2}","repeating-linear-gradient()":"repeating-linear-gradient( [|to ]? , )","repeating-radial-gradient()":"repeating-radial-gradient( [||]? [at ]? , )","rgb()":"rgb( {3} [/ ]? )|rgb( {3} [/ ]? )|rgb( #{3} , ? )|rgb( #{3} , ? )","rgba()":"rgba( {3} [/ ]? )|rgba( {3} [/ ]? )|rgba( #{3} , ? )|rgba( #{3} , ? )","rotate()":"rotate( [|] )","rotate3d()":"rotate3d( , , , [|] )","rotateX()":"rotateX( [|] )","rotateY()":"rotateY( [|] )","rotateZ()":"rotateZ( [|] )","saturate()":"saturate( )","scale()":"scale( , ? )","scale3d()":"scale3d( , , )","scaleX()":"scaleX( )","scaleY()":"scaleY( )","scaleZ()":"scaleZ( )","self-position":"center|start|end|self-start|self-end|flex-start|flex-end","shape-radius":"|closest-side|farthest-side","skew()":"skew( [|] , [|]? )","skewX()":"skewX( [|] )","skewY()":"skewY( [|] )","sepia()":"sepia( )","shadow":"inset?&&{2,4}&&?","shadow-t":"[{2,3}&&?]","shape":"rect( , , , )|rect( )","shape-box":"|margin-box","side-or-corner":"[left|right]||[top|bottom]","single-animation":"