diff --git a/.github/workflows/build-async-profiler.yml b/.github/workflows/build-async-profiler.yml index 009385dd436..8d1652eb8b1 100644 --- a/.github/workflows/build-async-profiler.yml +++ b/.github/workflows/build-async-profiler.yml @@ -25,26 +25,26 @@ jobs: with: distribution: "liberica" java-version: "11" - # 从 async-profiler 源码编译出 libasyncProfiler-mac.so(兼容 arthas-core 中 ProfilerCommand.java 固定的 so 文件名称未使用 libasyncProfiler.dylib) + # 从 async-profiler 源码编译出 libasyncProfiler-mac.dylib(兼容 arthas-core 中 ProfilerCommand.java 固定的 so 文件名称未使用 libasyncProfiler.dylib) # grep -m1 PROFILER_VERSION Makefile 用于输出 async-profiler 版本, 下同 - name: Execute compile inside macOS 12 environment run: | grep -m1 PROFILER_VERSION Makefile echo "JAVA_HOME=${JAVA_HOME}" java -version - echo "FAT_BINARY variable that make libasyncProfiler-mac.so works both on macOS x86-64 and arm64" + echo "FAT_BINARY variable that make libasyncProfiler-mac.dylib works both on macOS x86-64 and arm64" make FAT_BINARY=true LIB_PROFILER_PATH=$(find build -type f \( -name libasyncProfiler.so -o -name libasyncProfiler.dylib \) 2>/dev/null) [ -z "${LIB_PROFILER_PATH}" ] && echo "Can not find libasyncProfiler.so or libasyncProfiler.dylib file under build directory." && exit 1 echo "LIB_PROFILER_PATH=${LIB_PROFILER_PATH}" file ${LIB_PROFILER_PATH} otool -L ${LIB_PROFILER_PATH} - cp ${LIB_PROFILER_PATH} libasyncProfiler-mac.so - # 暂存编译出来的 libasyncProfiler-mac.so 文件 + cp ${LIB_PROFILER_PATH} libasyncProfiler-mac.dylib + # 暂存编译出来的 libasyncProfiler-mac.dylib 文件 - uses: actions/upload-artifact@v3 with: name: async-profiler - path: libasyncProfiler-mac.so + path: libasyncProfiler-mac.dylib if-no-files-found: error build-generic-linux-x64: @@ -143,89 +143,6 @@ jobs: if-no-files-found: error - build-alpine-linux-x64: - runs-on: ubuntu-20.04 - if: ${{ inputs.async-profiler-tag-name }} - steps: - # 检出 async-profiler/async-profiler 项目指定的 tag - - uses: actions/checkout@v3 - with: - repository: async-profiler/async-profiler - fetch-depth: 0 - - name: Checkout the async-profiler repository by input tag name ${{ inputs.async-profiler-tag-name }} - run: git checkout ${{ inputs.async-profiler-tag-name }} - - name: Setup Alpine Linux x86-64 environment - uses: jirutka/setup-alpine@v1 - with: - arch: x86_64 - branch: v3.15 - shell-name: alpine-x86_64.sh - packages: > - build-base linux-headers openjdk11 - # 从 async-profiler 源码编译出适用于 musl-based Linux 主机的 libasyncProfiler-linux-musl-x64.so - # grep -m1 PROFILER_VERSION Makefile 用于输出 async-profiler 版本, 下同 - - name: Run script inside Alpine Linux x86-64 environment - run: | - grep -m1 PROFILER_VERSION Makefile - JAVA_HOME=/usr/lib/jvm/java-11-openjdk - java -version - which java - echo "Append -static-libgcc -static-libstdc++ options to CXXFLAGS for user no need to install libstdc++ and libgcc manually." - sed -i 's/CXXFLAGS=/CXXFLAGS=-static-libgcc -static-libstdc++ /' Makefile && make - LIB_PROFILER_PATH=$(find build -type f -name libasyncProfiler.so 2>/dev/null) - [ -z "${LIB_PROFILER_PATH}" ] && echo "Can not find libasyncProfiler.so file under build directory." && exit 1 - echo "LIB_PROFILER_PATH=${LIB_PROFILER_PATH}" - file ${LIB_PROFILER_PATH} - ldd ${LIB_PROFILER_PATH} - cp ${LIB_PROFILER_PATH} libasyncProfiler-linux-musl-x64.so - shell: alpine-x86_64.sh {0} - - uses: actions/upload-artifact@v3 - with: - name: async-profiler - path: libasyncProfiler-linux-musl-x64.so - if-no-files-found: error - - build-alpine-linux-arm64: - runs-on: ubuntu-20.04 - if: ${{ inputs.async-profiler-tag-name }} - steps: - # 检出 async-profiler/async-profiler 项目指定的 tag - - uses: actions/checkout@v3 - with: - repository: async-profiler/async-profiler - fetch-depth: 0 - - name: Checkout the async-profiler repository by input tag name ${{ inputs.async-profiler-tag-name }} - run: git checkout ${{ inputs.async-profiler-tag-name }} - - name: Setup Alpine Linux aarch64 environment - uses: jirutka/setup-alpine@v1 - with: - arch: aarch64 - branch: v3.15 - shell-name: alpine-aarch64.sh - packages: > - build-base linux-headers openjdk11 - # 从 async-profiler 源码编译出适用于 musl-based Linux 主机的 libasyncProfiler-linux-musl-arm64.so - # grep -m1 PROFILER_VERSION Makefile 用于输出 async-profiler 版本, 下同 - - name: Run script inside Alpine Linux aarch64 environment - run: | - grep -m1 PROFILER_VERSION Makefile - JAVA_HOME=/usr/lib/jvm/java-11-openjdk - java -version - which java - echo "Append -static-libgcc -static-libstdc++ options to CXXFLAGS for user no need to install libstdc++ and libgcc manually." - sed -i 's/CXXFLAGS=/CXXFLAGS=-static-libgcc -static-libstdc++ /' Makefile && make - LIB_PROFILER_PATH=$(find build -type f -name libasyncProfiler.so 2>/dev/null) - [ -z "${LIB_PROFILER_PATH}" ] && echo "Can not find libasyncProfiler.so file under build directory." && exit 1 - echo "LIB_PROFILER_PATH=${LIB_PROFILER_PATH}" - file ${LIB_PROFILER_PATH} - ldd ${LIB_PROFILER_PATH} - cp ${LIB_PROFILER_PATH} libasyncProfiler-linux-musl-arm64.so - shell: alpine-aarch64.sh {0} - - uses: actions/upload-artifact@v3 - with: - name: async-profiler - path: libasyncProfiler-linux-musl-arm64.so - if-no-files-found: error upload-libasyncProfiler-files: runs-on: ubuntu-20.04 diff --git a/.github/workflows/build-vmtool.yaml b/.github/workflows/build-vmtool.yaml index efb07451b57..8559748598b 100644 --- a/.github/workflows/build-vmtool.yaml +++ b/.github/workflows/build-vmtool.yaml @@ -14,7 +14,7 @@ jobs: java-version: '8' distribution: 'adopt' - name: Build with Maven - run: ./mvnw package + run: ./mvnw -V -ntp package - uses: actions/upload-artifact@v3 with: name: lib @@ -30,7 +30,7 @@ jobs: java-version: '8' distribution: 'adopt' - name: Build with Maven - run: ./mvnw package + run: ./mvnw -V -ntp package - uses: actions/upload-artifact@v3 with: name: lib @@ -46,7 +46,7 @@ jobs: java-version: '8' distribution: 'adopt' - name: Build with Maven - run: ./mvnw package + run: ./mvnw -V -ntp package - uses: actions/upload-artifact@v3 with: name: lib @@ -73,7 +73,7 @@ jobs: run: | apt update && apt install openjdk-8-jdk g++ -y - ./mvnw package -pl common,arthas-vmtool + ./mvnw -V -ntp package -pl common,arthas-vmtool cp arthas-vmtool/target/libArthas* lib/ - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/push-docker.yaml b/.github/workflows/push-docker.yaml new file mode 100644 index 00000000000..e5ff306224a --- /dev/null +++ b/.github/workflows/push-docker.yaml @@ -0,0 +1,34 @@ +name: Push arthas images to Docker Hub + +on: + workflow_dispatch: + inputs: + version: + description: "The version number to push (e.g., 4.0.3)" + required: true + +jobs: + build-and-push: + runs-on: ubuntu-latest + + steps: + # 步骤 1:检出 master 分支的代码 + - name: Checkout gh-pages branch + uses: actions/checkout@v3 + with: + ref: master + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build Docker image + run: | + VERSION="${{ github.event.inputs.version }}" + docker buildx build . --build-arg ARTHAS_VERSION=$VERSION --build-arg MIRROR=true -t hengyunabc/arthas:$VERSION -t hengyunabc/arthas:latest --platform=linux/arm64,linux/amd64 --push + docker buildx build . --build-arg ARTHAS_VERSION=$VERSION --build-arg MIRROR=true -f Dockerfile-No-Jdk -t hengyunabc/arthas:$VERSION-no-jdk --platform=linux/arm64,linux/amd64 --push diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8c0e117a6ec..e14c5d846e7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,7 +16,7 @@ jobs: java-version: '8' distribution: 'adopt' - name: Build with Maven - run: mvn clean package -P full + run: mvn -V -ntp clean package -P full - name: Release uses: softprops/action-gh-release@v1 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1a7535d5269..69757223bbe 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -17,7 +17,7 @@ jobs: distribution: 'zulu' cache: 'maven' - name: Build with Maven - run: mvn clean install -P full + run: mvn -V -ntp clean install -P full windows_build: runs-on: windows-2019 @@ -33,7 +33,7 @@ jobs: distribution: 'zulu' cache: 'maven' - name: Build with Maven - run: mvn clean install -P full + run: mvn -V -ntp clean install -P full macos_build: runs-on: ${{ matrix.os }} @@ -52,4 +52,4 @@ jobs: distribution: 'zulu' cache: 'maven' - name: Build with Maven - run: mvn clean install -P full \ No newline at end of file + run: mvn -V -ntp clean install -P full \ No newline at end of file diff --git a/.github/workflows/update-doc.yaml b/.github/workflows/update-doc.yaml new file mode 100644 index 00000000000..7202ea0f62b --- /dev/null +++ b/.github/workflows/update-doc.yaml @@ -0,0 +1,80 @@ +name: Update docs on gh-pages + +on: + workflow_dispatch: + inputs: + version: + description: "The version number to download and update (e.g., 4.0.3)" + required: true + +jobs: + update-assets: + runs-on: ubuntu-latest + + steps: + # 步骤 1:检出 gh-pages 分支的代码 + - name: Checkout gh-pages branch + uses: actions/checkout@v3 + with: + ref: gh-pages + + # 步骤 2:下载指定版本的文档 ZIP 文件到 /tmp 目录 + - name: Download documentation ZIP file + run: | + VERSION="${{ github.event.inputs.version }}" + DOC_DOWNLOAD_URL="https://repo1.maven.org/maven2/com/taobao/arthas/arthas-packaging/${VERSION}/arthas-packaging-${VERSION}-doc.zip" + echo "Downloading documentation from $DOC_DOWNLOAD_URL" + curl -L "$DOC_DOWNLOAD_URL" -o "/tmp/arthas-doc.zip" + + # 步骤 3:解压文档 ZIP 文件 + - name: Unzip documentation file + run: | + unzip -o /tmp/arthas-doc.zip -d /tmp/arthas-doc + + # 步骤 4:删除仓库中的 assets 目录 + - name: Remove assets directory + run: | + rm -rf assets + + # 步骤 5:复制解压后的文档文件到仓库 + - name: Copy documentation files to repository + run: | + cp -r /tmp/arthas-doc/* ./ + + # 步骤 6:下载指定版本的二进制 ZIP 文件到 /tmp 目录 + - name: Download binary ZIP file + run: | + VERSION="${{ github.event.inputs.version }}" + BIN_DOWNLOAD_URL="https://repo1.maven.org/maven2/com/taobao/arthas/arthas-packaging/${VERSION}/arthas-packaging-${VERSION}-bin.zip" + echo "Downloading binary files from $BIN_DOWNLOAD_URL" + curl -L "$BIN_DOWNLOAD_URL" -o "/tmp/arthas-bin.zip" + + # 步骤 7:解压二进制 ZIP 文件 + - name: Unzip binary file + run: | + unzip -o /tmp/arthas-bin.zip -d /tmp/arthas-bin + + # 步骤 8:复制指定文件到仓库目录 + - name: Copy binary files to repository + run: | + cp /tmp/arthas-bin/as.sh ./ + cp /tmp/arthas-bin/arthas-boot.jar ./ + cp /tmp/arthas-bin/math-game.jar ./ + + # 步骤 9:赋予 as.sh 可执行权限 + - name: Make as.sh executable + run: | + chmod +x as.sh + + # 步骤 10:设置 Git 用户信息 + - name: Set Git user + run: | + git config user.name "${{ github.actor }}" + git config user.email "${{ github.actor }}@users.noreply.github.com" + + # 步骤 11:提交并推送更改到远程仓库 + - name: Commit and push changes + run: | + git add . + git commit -m "Update docs to version ${{ github.event.inputs.version }}" + git push origin gh-pages diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index b901097f2db..00000000000 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2007-present the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.Properties; - -public class MavenWrapperDownloader { - - private static final String WRAPPER_VERSION = "0.5.6"; - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" - + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if(mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if(mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if(!outputFile.getParentFile().exists()) { - if(!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { - String username = System.getenv("MVNW_USERNAME"); - char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); - Authenticator.setDefault(new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(username, password); - } - }); - } - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 2cc7d4a55c0..00000000000 Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 642d572ce90..d58dfb70bab 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,19 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +wrapperVersion=3.3.2 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cf2a7a8ea9a..7d99d8b499e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -135,6 +135,7 @@ Tip: you can use `--versions` to list all available versions. * 如果 arthas-vmtool 有更新,则需要手动触发action,构建后会把新的动态库文件提交到 lib 目录。 https://github.com/alibaba/arthas/actions/workflows/build-vmtool.yaml * 修改`as.sh`里的版本,最后修改日期, `Bootstrap.java`里的版本,Dockerfile里的版本 * 修改本地的maven settings.xml +* 执行一次 gpg --sign /tmp/2.txt ,让 gpg 后台进程启动,否则打包可能失败 * mvn clean deploy -DskipTests -P full -P release * 到 https://oss.sonatype.org/ 上,“Staging Repositories”然后close掉自己的,再release @@ -146,15 +147,11 @@ Tip: you can use `--versions` to list all available versions. 版本号信息地址: https://maven.aliyun.com/repository/public/com/taobao/arthas/arthas-packaging/maven-metadata.xml * 打上tag,push tag到仓库上 -* 需要更新 gh-pages 分支下面的 arthas-boot.jar/math-game.jar/as.sh ,下载 doc.zip,解压覆盖掉文档的更新 +* 需要更新 gh-pages 分支下面的 arthas-boot.jar/math-game.jar/as.sh ,下载 doc.zip,解压覆盖掉文档的更新,可以通过 github action 更新: https://github.com/alibaba/arthas/actions/workflows/update-doc.yaml * 需要更新docker镜像,push新的tag:https://hub.docker.com/r/hengyunabc/arthas/tags?page=1&ordering=last_updated - 以 3.6.5 版本为例: - ``` - docker buildx build . --build-arg ARTHAS_VERSION=3.6.5 --build-arg MIRROR=true -t hengyunabc/arthas:3.6.5 -t hengyunabc/arthas:latest --platform=linux/arm64,linux/amd64 --push + 可以通过 github action push: https://github.com/alibaba/arthas/actions/workflows/push-docker.yaml - docker buildx build . --build-arg ARTHAS_VERSION=3.6.5 --build-arg MIRROR=true -f Dockerfile-No-Jdk -t hengyunabc/arthas:3.6.5-no-jdk --platform=linux/arm64,linux/amd64 --push - ``` * 更新README.md,比如增加了新命令,要加上说明,更新wiki的链接 * 更新release页面的 issue信息,修改信息等 * 更新 https://arthas.aliyun.com/api/latest_version api diff --git a/Dockerfile b/Dockerfile index 6246b42af8c..bb02aaa9964 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM openjdk:8-jdk-alpine -ARG ARTHAS_VERSION="3.6.8" +ARG ARTHAS_VERSION="4.0.5" ARG MIRROR=false ENV MAVEN_HOST=https://repo1.maven.org/maven2 \ diff --git a/Dockerfile-No-Jdk b/Dockerfile-No-Jdk index 3a69c824ff2..ac8232c3313 100644 --- a/Dockerfile-No-Jdk +++ b/Dockerfile-No-Jdk @@ -1,15 +1,20 @@ -FROM alpine +# Stage 1: Build +FROM openjdk:8-jdk-alpine AS builder -ARG ARTHAS_VERSION="3.6.8" +ARG ARTHAS_VERSION="4.0.5" ARG MIRROR=false - ENV MAVEN_HOST=https://repo1.maven.org/maven2 \ MIRROR_MAVEN_HOST=https://maven.aliyun.com/repository/public # if use mirror change to aliyun mirror site -RUN if $MIRROR; then MAVEN_HOST=${MIRROR_MAVEN_HOST} ; fi && \ +RUN if [ "$MIRROR" = "true" ]; then MAVEN_HOST=${MIRROR_MAVEN_HOST} ; fi && \ # download & install arthas wget -qO /tmp/arthas.zip "${MAVEN_HOST}/com/taobao/arthas/arthas-packaging/${ARTHAS_VERSION}/arthas-packaging-${ARTHAS_VERSION}-bin.zip" && \ mkdir -p /opt/arthas && \ unzip /tmp/arthas.zip -d /opt/arthas && \ rm /tmp/arthas.zip + +# Stage 2: Final +FROM alpine + +COPY --from=builder /opt/arthas /opt/arthas \ No newline at end of file diff --git a/README.md b/README.md index 2cc3c3e5d74..e12d47232d2 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Arthas was built to solve these issues. A developer can troubleshoot your produc * Supports telnet and websocket, which enables both local and remote diagnostics with command line and browsers. * Supports profiler/Flame Graph * Support get objects in the heap that are instances of the specified class. -* Supports JDK 6+. +* Supports JDK 6+ (version 4.x no longer supports JDK 6 and JDK 7). * Supports Linux/Mac/Windows. diff --git a/README_CN.md b/README_CN.md index 11cd2af5bf6..296f772b46e 100644 --- a/README_CN.md +++ b/README_CN.md @@ -27,7 +27,7 @@ English version goes [here](README.md). 0. 怎么快速定位应用的热点,生成火焰图? 0. 怎样直接从JVM内查找某个类的实例? -`Arthas`支持JDK 6+,支持Linux/Mac/Windows,采用命令行交互模式,同时提供丰富的 `Tab` 自动补全功能,进一步方便进行问题的定位和诊断。 +`Arthas`支持JDK 6+(4.x 版本不再支持 JDK 6 和 JDK 7),支持Linux/Mac/Windows,采用命令行交互模式,同时提供丰富的 `Tab` 自动补全功能,进一步方便进行问题的定位和诊断。 ### 在线教程(推荐) diff --git a/USERS.md b/USERS.md index 760c04201d4..c0e20dc4518 100644 --- a/USERS.md +++ b/USERS.md @@ -134,6 +134,7 @@ Welcome to register the company name in this issue: https://github.com/alibaba/a ![滴滴出行](static/didiglobal.jpg) ![兑观科技](static/videt.png) ![高德红外](static/guideir.jpg) +![明源云](static/mingyuanyun.jpg) * 网易云 * 派迩信息技术 @@ -163,3 +164,4 @@ Welcome to register the company name in this issue: https://github.com/alibaba/a * 云管书 * 兑观 * 高德红外 +* 明源云 diff --git a/async-profiler/libasyncProfiler-linux-arm64.so b/async-profiler/libasyncProfiler-linux-arm64.so old mode 100755 new mode 100644 index 8b78d7575c3..1b2a5d2903f Binary files a/async-profiler/libasyncProfiler-linux-arm64.so and b/async-profiler/libasyncProfiler-linux-arm64.so differ diff --git a/async-profiler/libasyncProfiler-linux-musl-arm64.so b/async-profiler/libasyncProfiler-linux-musl-arm64.so deleted file mode 100755 index 16f416a2ec4..00000000000 Binary files a/async-profiler/libasyncProfiler-linux-musl-arm64.so and /dev/null differ diff --git a/async-profiler/libasyncProfiler-linux-musl-x64.so b/async-profiler/libasyncProfiler-linux-musl-x64.so deleted file mode 100755 index 631b3776584..00000000000 Binary files a/async-profiler/libasyncProfiler-linux-musl-x64.so and /dev/null differ diff --git a/async-profiler/libasyncProfiler-linux-x64.so b/async-profiler/libasyncProfiler-linux-x64.so old mode 100755 new mode 100644 index 5dd8a1e942e..55aa036d82c Binary files a/async-profiler/libasyncProfiler-linux-x64.so and b/async-profiler/libasyncProfiler-linux-x64.so differ diff --git a/async-profiler/libasyncProfiler-mac.dylib b/async-profiler/libasyncProfiler-mac.dylib new file mode 100644 index 00000000000..f22474b1e0d Binary files /dev/null and b/async-profiler/libasyncProfiler-mac.dylib differ diff --git a/async-profiler/libasyncProfiler-mac.so b/async-profiler/libasyncProfiler-mac.so deleted file mode 100755 index 0334fb1e6d9..00000000000 Binary files a/async-profiler/libasyncProfiler-mac.so and /dev/null differ diff --git a/bin/as.sh b/bin/as.sh index 15537fb592e..0f0c78992b6 100755 --- a/bin/as.sh +++ b/bin/as.sh @@ -8,10 +8,10 @@ # program : Arthas # author : Core Engine @ Taobao.com -# date : 2023-04-19 +# date : 2025-03-11 # current arthas script version -ARTHAS_SCRIPT_VERSION=3.6.8 +ARTHAS_SCRIPT_VERSION=4.0.5 # SYNOPSIS # rreadlink @@ -436,6 +436,8 @@ Usage: [--use-version ] [--repo-mirror ] [--versions] [--use-http] [--attach-only] [-c ] [-f ] [-v] [pid] +NOTE: Arthas 4 supports JDK 8+. If you need to diagnose applications running on JDK 6/7, you can use Arthas 3. + Options and Arguments: -h,--help Print usage --target-ip The target jvm listen ip, default 127.0.0.1 @@ -474,7 +476,7 @@ EXAMPLES: ./as.sh --stat-url 'http://192.168.10.11:8080/api/stat' ./as.sh -c 'sysprop; thread' ./as.sh -f batch.as - ./as.sh --use-version 3.6.8 + ./as.sh --use-version 4.0.5 ./as.sh --session-timeout 3600 ./as.sh --attach-only ./as.sh --disabled-commands stop,dump diff --git a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java index 80cfb823609..bdfbf8afa25 100644 --- a/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java +++ b/boot/src/main/java/com/taobao/arthas/boot/Bootstrap.java @@ -45,7 +45,8 @@ */ @Name("arthas-boot") @Summary("Bootstrap Arthas") -@Description("EXAMPLES:\n" + " java -jar arthas-boot.jar \n" +@Description("NOTE: Arthas 4 supports JDK 8+. If you need to diagnose applications running on JDK 6/7, you can use Arthas 3.\n\n" + +"EXAMPLES:\n" + " java -jar arthas-boot.jar \n" + " java -jar arthas-boot.jar --telnet-port 9999 --http-port -1\n" + " java -jar arthas-boot.jar --username admin --password \n" + " java -jar arthas-boot.jar --tunnel-server 'ws://192.168.10.11:7777/ws' --app-name demoapp\n" @@ -53,7 +54,7 @@ + " java -jar arthas-boot.jar --stat-url 'http://192.168.10.11:8080/api/stat'\n" + " java -jar arthas-boot.jar -c 'sysprop; thread' \n" + " java -jar arthas-boot.jar -f batch.as \n" - + " java -jar arthas-boot.jar --use-version 3.6.8\n" + + " java -jar arthas-boot.jar --use-version 4.0.5\n" + " java -jar arthas-boot.jar --versions\n" + " java -jar arthas-boot.jar --select math-game\n" + " java -jar arthas-boot.jar --session-timeout 3600\n" + " java -jar arthas-boot.jar --attach-only\n" @@ -428,14 +429,14 @@ public static void main(String[] args) throws ParserConfigurationException, SAXE + File.separator + bootstrap.getUseVersion() + File.separator + "arthas"); if (!specialVersionDir.exists()) { // try to download arthas from remote server. - DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isuseHttp(), + DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isUseHttp(), bootstrap.getUseVersion(), ARTHAS_LIB_DIR.getAbsolutePath()); } verifyArthasHome(specialVersionDir.getAbsolutePath()); arthasHomeDir = specialVersionDir; } - // Try set the directory where arthas-boot.jar is located to arhtas home + // Try set the directory where arthas-boot.jar is located to arthas home if (arthasHomeDir == null) { CodeSource codeSource = Bootstrap.class.getProtectionDomain().getCodeSource(); if (codeSource != null) { @@ -469,16 +470,16 @@ public static void main(String[] args) throws ParserConfigurationException, SAXE List versionList = listNames(ARTHAS_LIB_DIR); Collections.sort(versionList); - String localLastestVersion = null; + String localLatestVersion = null; if (!versionList.isEmpty()) { - localLastestVersion = versionList.get(versionList.size() - 1); + localLatestVersion = versionList.get(versionList.size() - 1); } - String remoteLastestVersion = DownloadUtils.readLatestReleaseVersion(); + String remoteLatestVersion = DownloadUtils.readLatestReleaseVersion(); boolean needDownload = false; - if (localLastestVersion == null) { - if (remoteLastestVersion == null) { + if (localLatestVersion == null) { + if (remoteLatestVersion == null) { // exit AnsiLog.error("Can not find Arthas under local: {} and remote repo mirror: {}", ARTHAS_LIB_DIR, bootstrap.getRepoMirror()); @@ -489,23 +490,23 @@ public static void main(String[] args) throws ParserConfigurationException, SAXE needDownload = true; } } else { - if (remoteLastestVersion != null) { - if (localLastestVersion.compareTo(remoteLastestVersion) < 0) { - AnsiLog.info("local lastest version: {}, remote lastest version: {}, try to download from remote.", - localLastestVersion, remoteLastestVersion); + if (remoteLatestVersion != null) { + if (localLatestVersion.compareTo(remoteLatestVersion) < 0) { + AnsiLog.info("local latest version: {}, remote latest version: {}, try to download from remote.", + localLatestVersion, remoteLatestVersion); needDownload = true; } } } if (needDownload) { // try to download arthas from remote server. - DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isuseHttp(), - remoteLastestVersion, ARTHAS_LIB_DIR.getAbsolutePath()); - localLastestVersion = remoteLastestVersion; + DownloadUtils.downArthasPackaging(bootstrap.getRepoMirror(), bootstrap.isUseHttp(), + remoteLatestVersion, ARTHAS_LIB_DIR.getAbsolutePath()); + localLatestVersion = remoteLatestVersion; } // get the latest version - arthasHomeDir = new File(ARTHAS_LIB_DIR, localLastestVersion + File.separator + "arthas"); + arthasHomeDir = new File(ARTHAS_LIB_DIR, localLatestVersion + File.separator + "arthas"); } verifyArthasHome(arthasHomeDir.getAbsolutePath()); @@ -784,7 +785,7 @@ public String getRepoMirror() { return repoMirror; } - public boolean isuseHttp() { + public boolean isUseHttp() { return useHttp; } diff --git a/common/src/main/java/com/taobao/arthas/common/PidUtils.java b/common/src/main/java/com/taobao/arthas/common/PidUtils.java index f13facd7170..245a692fd25 100644 --- a/common/src/main/java/com/taobao/arthas/common/PidUtils.java +++ b/common/src/main/java/com/taobao/arthas/common/PidUtils.java @@ -1,7 +1,6 @@ package com.taobao.arthas.common; import java.lang.management.ManagementFactory; -import java.util.Map; /** * @@ -29,10 +28,7 @@ public class PidUtils { } try { - for (final Map.Entry entry : System.getenv().entrySet()) { - if (entry.getKey().startsWith("JAVA_MAIN_CLASS")) // like JAVA_MAIN_CLASS_13328 - MAIN_CLASS = entry.getValue(); - } + MAIN_CLASS = System.getProperty("sun.java.command", ""); } catch (Throwable e) { // ignore } diff --git a/core/pom.xml b/core/pom.xml index cfda902b71d..69c39b47e04 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ org.apache.maven.plugins maven-shade-plugin - 3.2.3 + 3.6.0 package diff --git a/core/src/main/java/com/taobao/arthas/core/GlobalOptions.java b/core/src/main/java/com/taobao/arthas/core/GlobalOptions.java index 6e623e00c0c..f9b9f0df36c 100644 --- a/core/src/main/java/com/taobao/arthas/core/GlobalOptions.java +++ b/core/src/main/java/com/taobao/arthas/core/GlobalOptions.java @@ -1,6 +1,11 @@ package com.taobao.arthas.core; +import java.lang.reflect.Field; + import com.taobao.arthas.common.JavaVersionUtils; +import com.taobao.arthas.common.UnsafeUtils; + +import ognl.OgnlRuntime; /** * 全局开关 @@ -128,7 +133,8 @@ public class GlobalOptions { public static volatile boolean verbose = false; /** - * 是否打开strict 开关 + * 是否打开strict 开关。更新时注意 ognl 里的配置需要同步修改 + * @see ognl.OgnlRuntime#getUseStricterInvocationValue() */ @Option(level = 1, name = "strict", @@ -136,4 +142,20 @@ public class GlobalOptions { description = STRICT_MESSAGE ) public static volatile boolean strict = true; + + public static void updateOnglStrict(boolean strict) { + try { + Field field = OgnlRuntime.class.getDeclaredField("_useStricterInvocation"); + field.setAccessible(true); + // 获取字段的内存偏移量和基址 + Object staticFieldBase = UnsafeUtils.UNSAFE.staticFieldBase(field); + long staticFieldOffset = UnsafeUtils.UNSAFE.staticFieldOffset(field); + + // 修改字段的值 + UnsafeUtils.UNSAFE.putBoolean(staticFieldBase, staticFieldOffset, strict); + } catch (NoSuchFieldException | SecurityException e) { + // ignore + } + } + } diff --git a/core/src/main/java/com/taobao/arthas/core/advisor/AdviceListenerManager.java b/core/src/main/java/com/taobao/arthas/core/advisor/AdviceListenerManager.java index 13c1896c4b5..a56b4abf5f3 100644 --- a/core/src/main/java/com/taobao/arthas/core/advisor/AdviceListenerManager.java +++ b/core/src/main/java/com/taobao/arthas/core/advisor/AdviceListenerManager.java @@ -139,17 +139,18 @@ public List queryAdviceListeners(String className, String method public void registerTraceAdviceListener(String className, String owner, String methodName, String methodDesc, AdviceListener listener) { + synchronized (this) { + className = className.replace('/', '.'); + String key = keyForTrace(className, owner, methodName, methodDesc); - className = className.replace('/', '.'); - String key = keyForTrace(className, owner, methodName, methodDesc); - - List listeners = map.get(key); - if (listeners == null) { - listeners = new ArrayList(); - map.put(key, listeners); - } - if (!listeners.contains(listener)) { - listeners.add(listener); + List listeners = map.get(key); + if (listeners == null) { + listeners = new ArrayList(); + map.put(key, listeners); + } + if (!listeners.contains(listener)) { + listeners.add(listener); + } } } diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/AuthCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/AuthCommand.java index bd99640efc2..c36937e3ce1 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/AuthCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/AuthCommand.java @@ -68,7 +68,7 @@ public void process(CommandProcess process) { message = "username can not be empty!"; return; } - if (password == null) { // 没有传入passowrd参数时,打印当前结果 + if (password == null) { // 没有传入password参数时,打印当前结果 boolean authenticated = session.get(ArthasConstants.SUBJECT_KEY) != null; boolean needLogin = this.authenticator.needLogin(); diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java index ad50157addc..d2f690cebc3 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/HistoryCommand.java @@ -39,7 +39,7 @@ public void setClear(boolean clear) { } @Argument(index = 0, argName = "n", required = false) - @Description("how many history commnads to display") + @Description("how many history commands to display") public void setNumber(int n) { this.n = n; } diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java index f615cbf9fd9..efa3a0cc4ab 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/JFRCommand.java @@ -322,7 +322,7 @@ public void process(CommandProcess process) { try { r.setDestination(Paths.get(getFilename())); } catch (IOException e) { - process.end(-1, "Failed to stop" + r.getName() + ". Could not set destination for " + filename + "to file" + e.getMessage()); + process.end(-1, "Failed to stop " + r.getName() + ". Could not set destination for " + filename + "to file" + e.getMessage()); } r.stop(); @@ -353,7 +353,7 @@ public long parseSize(String s) throws Exception { try { return Long.parseLong(s); } catch (Exception e) { - throw new NumberFormatException("'" + s + "' is not a valid size. Shoule be numeric value followed by a unit, i.e. 20M. Valid units k, M, G"); + throw new NumberFormatException("'" + s + "' is not a valid size. Should be numeric value followed by a unit, i.e. 20M. Valid units k, M, G"); } } } diff --git a/core/src/main/java/com/taobao/arthas/core/command/basic1000/OptionsCommand.java b/core/src/main/java/com/taobao/arthas/core/command/basic1000/OptionsCommand.java index 14a0a6174ad..b463975394f 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/basic1000/OptionsCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/basic1000/OptionsCommand.java @@ -155,6 +155,11 @@ private ExitStatus processChangeNameValue(CommandProcess process) throws Illegal return ExitStatus.failure(-1, format("Options[%s] type[%s] was unsupported.", optionName, type.getSimpleName())); } + // FIXME hack for ongl strict + if (field.getName().equals("strict")) { + GlobalOptions.updateOnglStrict(Boolean.valueOf(optionValue)); + logger.info("update ongl strict to: {}", optionValue); + } } catch (Throwable t) { return ExitStatus.failure(-1, format("Cannot cast option value[%s] to type[%s].", optionValue, type.getSimpleName())); } diff --git a/core/src/main/java/com/taobao/arthas/core/command/express/ArthasObjectPropertyAccessor.java b/core/src/main/java/com/taobao/arthas/core/command/express/ArthasObjectPropertyAccessor.java index f83d330448d..7562705fdef 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/express/ArthasObjectPropertyAccessor.java +++ b/core/src/main/java/com/taobao/arthas/core/command/express/ArthasObjectPropertyAccessor.java @@ -1,9 +1,10 @@ package com.taobao.arthas.core.command.express; +import java.util.Map; + import com.taobao.arthas.core.GlobalOptions; import ognl.ObjectPropertyAccessor; -import ognl.OgnlContext; import ognl.OgnlException; /** @@ -12,7 +13,7 @@ public class ArthasObjectPropertyAccessor extends ObjectPropertyAccessor { @Override - public Object setPossibleProperty(OgnlContext context, Object target, String name, Object value) throws OgnlException { + public Object setPossibleProperty(Map context, Object target, String name, Object value) throws OgnlException { if (GlobalOptions.strict) { throw new IllegalAccessError(GlobalOptions.STRICT_MESSAGE); } diff --git a/core/src/main/java/com/taobao/arthas/core/command/express/ClassLoaderClassResolver.java b/core/src/main/java/com/taobao/arthas/core/command/express/ClassLoaderClassResolver.java index e69cf743bef..7409d2916d1 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/express/ClassLoaderClassResolver.java +++ b/core/src/main/java/com/taobao/arthas/core/command/express/ClassLoaderClassResolver.java @@ -4,7 +4,6 @@ import java.util.concurrent.ConcurrentHashMap; import ognl.ClassResolver; -import ognl.OgnlContext; /** * @author hengyunabc 2018-10-18 @@ -20,9 +19,8 @@ public ClassLoaderClassResolver(ClassLoader classLoader) { this.classLoader = classLoader; } - @Override - public Class classForName(String className, OgnlContext ognlContext) throws ClassNotFoundException { + public Class classForName(String className, Map context) throws ClassNotFoundException { Class result = null; if ((result = classes.get(className)) == null) { @@ -39,6 +37,6 @@ public Class classForName(String className, OgnlContext ognlContext) thro } classes.put(className, result); } - return (Class) result; + return result; } } diff --git a/core/src/main/java/com/taobao/arthas/core/command/express/CustomClassResolver.java b/core/src/main/java/com/taobao/arthas/core/command/express/CustomClassResolver.java index 81c9c174b66..7512e92a4f0 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/express/CustomClassResolver.java +++ b/core/src/main/java/com/taobao/arthas/core/command/express/CustomClassResolver.java @@ -1,7 +1,6 @@ package com.taobao.arthas.core.command.express; import ognl.ClassResolver; -import ognl.OgnlContext; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -21,7 +20,7 @@ private CustomClassResolver() { } @Override - public Class classForName(String className, OgnlContext ognlContext) throws ClassNotFoundException { + public Class classForName(String className, Map context) throws ClassNotFoundException { Class result = null; if ((result = classes.get(className)) == null) { @@ -40,6 +39,6 @@ public Class classForName(String className, OgnlContext ognlContext) thro } classes.put(className, result); } - return (Class) result; + return result; } } diff --git a/core/src/main/java/com/taobao/arthas/core/command/express/DefaultMemberAccess.java b/core/src/main/java/com/taobao/arthas/core/command/express/DefaultMemberAccess.java index 2f5abb4c88f..3384a863c39 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/express/DefaultMemberAccess.java +++ b/core/src/main/java/com/taobao/arthas/core/command/express/DefaultMemberAccess.java @@ -1,11 +1,11 @@ package com.taobao.arthas.core.command.express; import ognl.MemberAccess; -import ognl.OgnlContext; import java.lang.reflect.AccessibleObject; import java.lang.reflect.Member; import java.lang.reflect.Modifier; +import java.util.Map; /** * ognl.DefaultMemberAccess (ognl:ognl:3.1.19) @@ -58,7 +58,8 @@ public void setAllowPackageProtectedAccess(boolean value) { allowPackageProtectedAccess = value; } - public Object setup(OgnlContext context, Object target, Member member, String propertyName) { + @Override + public Object setup(Map context, Object target, Member member, String propertyName) { Object result = null; if (isAccessible(context, target, member, propertyName)) { @@ -72,7 +73,8 @@ public Object setup(OgnlContext context, Object target, Member member, String pr return result; } - public void restore(OgnlContext context, Object target, Member member, String propertyName, Object state) { + @Override + public void restore(Map context, Object target, Member member, String propertyName, Object state) { if (state != null) { ((AccessibleObject)member).setAccessible((Boolean)state); } @@ -88,7 +90,8 @@ public void restore(OgnlContext context, Object target, Member member, String pr * @param propertyName the property to test accessibility for (not used). * @return true if the member is accessible in the context, false otherwise. */ - public boolean isAccessible(OgnlContext context, Object target, Member member, String propertyName) { + @Override + public boolean isAccessible(Map context, Object target, Member member, String propertyName) { int modifiers = member.getModifiers(); boolean result = Modifier.isPublic(modifiers); diff --git a/core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderCommand.java b/core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderCommand.java index 6a798136104..f283eff4a9d 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/klass100/ClassLoaderCommand.java @@ -57,7 +57,7 @@ Constants.WIKI + Constants.WIKI_HOME + "classloader") public class ClassLoaderCommand extends AnnotatedCommand { - private Logger logger = LoggerFactory.getLogger(ClassLoaderCommand.class); + private static Logger logger = LoggerFactory.getLogger(ClassLoaderCommand.class); private boolean isTree = false; private String hashCode; private String classLoaderClass; @@ -449,31 +449,37 @@ private Map urlStats(Instrumentation inst) { // 以树状列出ClassLoader的继承结构 private static List processClassLoaderTree(List classLoaders) { - List rootClassLoaders = new ArrayList(); - List parentNotNullClassLoaders = new ArrayList(); + List rootClassLoaders = new ArrayList<>(); + Map> childMap = new HashMap<>(); + + // 分离根节点和非根节点,并构建父子关系映射 for (ClassLoaderVO classLoaderVO : classLoaders) { if (classLoaderVO.getParent() == null) { rootClassLoaders.add(classLoaderVO); } else { - parentNotNullClassLoaders.add(classLoaderVO); + childMap.computeIfAbsent(classLoaderVO.getParent(), k -> new ArrayList<>()).add(classLoaderVO); } } - for (ClassLoaderVO classLoaderVO : rootClassLoaders) { - buildTree(classLoaderVO, parentNotNullClassLoaders); + // 构建树 + for (ClassLoaderVO root : rootClassLoaders) { + buildTree(root, childMap); } + return rootClassLoaders; } - private static void buildTree(ClassLoaderVO parent, List parentNotNullClassLoaders) { - for (ClassLoaderVO classLoaderVO : parentNotNullClassLoaders) { - if (parent.getName().equals(classLoaderVO.getParent())){ - parent.addChild(classLoaderVO); - buildTree(classLoaderVO, parentNotNullClassLoaders); + private static void buildTree(ClassLoaderVO parent, Map> childMap) { + List children = childMap.get(parent.getName()); + if (children != null) { + for (ClassLoaderVO child : children) { + parent.addChild(child); + buildTree(child, childMap); } } } + private static Set getAllClassLoaders(Instrumentation inst, Filter... filters) { Set classLoaderSet = new HashSet(); diff --git a/core/src/main/java/com/taobao/arthas/core/command/klass100/OgnlCommand.java b/core/src/main/java/com/taobao/arthas/core/command/klass100/OgnlCommand.java index bb36bb5d91c..b2dd6125dcd 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/klass100/OgnlCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/klass100/OgnlCommand.java @@ -102,7 +102,8 @@ public void process(CommandProcess process) { Express unpooledExpress = ExpressFactory.unpooledExpress(classLoader); try { - Object value = unpooledExpress.get(express); + // https://github.com/alibaba/arthas/issues/2892 + Object value = unpooledExpress.bind(new Object()).get(express); OgnlModel ognlModel = new OgnlModel() .setValue(new ObjectVO(value, expand)); process.appendResult(ognlModel); diff --git a/core/src/main/java/com/taobao/arthas/core/command/klass100/RetransformCommand.java b/core/src/main/java/com/taobao/arthas/core/command/klass100/RetransformCommand.java index 88cd6c37062..fe929db740f 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/klass100/RetransformCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/klass100/RetransformCommand.java @@ -411,7 +411,7 @@ public static synchronized void addRetransformEntry(List retra Collections.sort(tmp, new Comparator() { @Override public int compare(RetransformEntry entry1, RetransformEntry entry2) { - return entry1.getId() - entry2.getId(); + return Integer.compare(entry1.getId(), entry2.getId()); } }); retransformEntries = tmp; diff --git a/core/src/main/java/com/taobao/arthas/core/command/monitor200/AbstractTraceAdviceListener.java b/core/src/main/java/com/taobao/arthas/core/command/monitor200/AbstractTraceAdviceListener.java index e9eaee2f2bb..19b747be569 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/monitor200/AbstractTraceAdviceListener.java +++ b/core/src/main/java/com/taobao/arthas/core/command/monitor200/AbstractTraceAdviceListener.java @@ -9,6 +9,8 @@ import com.taobao.arthas.core.util.LogUtil; import com.taobao.arthas.core.util.ThreadLocalWatch; +import java.util.concurrent.atomic.AtomicBoolean; + /** * @author ralf0131 2017-01-06 16:02. */ @@ -17,6 +19,7 @@ public class AbstractTraceAdviceListener extends AdviceListenerAdapter { protected final ThreadLocalWatch threadLocalWatch = new ThreadLocalWatch(); protected TraceCommand command; protected CommandProcess process; + private final AtomicBoolean processAborted = new AtomicBoolean(false); protected final ThreadLocal threadBoundEntity = new ThreadLocal(); @@ -99,7 +102,6 @@ private void finishing(ClassLoader loader, Advice advice) { // 是否到达数量限制 if (isLimitExceeded(command.getNumberOfLimit(), process.times().get())) { - // TODO: concurrency issue to abort process abortProcess(process, command.getNumberOfLimit()); } } @@ -112,4 +114,12 @@ private void finishing(ClassLoader loader, Advice advice) { } } } + + @Override + protected void abortProcess(CommandProcess process, int limit) { + // Only proceed if this thread is the first one to set the flag to true + if (processAborted.compareAndSet(false, true)) { + super.abortProcess(process, limit); + } + } } diff --git a/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java b/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java index 2ad257b7eeb..5deeb786986 100644 --- a/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java +++ b/core/src/main/java/com/taobao/arthas/core/command/monitor200/ProfilerCommand.java @@ -38,7 +38,7 @@ import one.profiler.Counter; /** - * + * https://github.com/async-profiler/async-profiler/blob/master/docs/ProfilerOptions.md 具体参数说明,以及哪些参数可以传递给 async-profiler agent * @author hengyunabc 2019-10-31 * */ @@ -51,6 +51,9 @@ + " profiler list # list all supported events\n" + " profiler actions # list all supported actions\n" + " profiler start --event alloc\n" + + " profiler start --timeout 300s" + + " profiler start --loop 300s -f /tmp/result-%t.html" + + " profiler start --duration 300" + " profiler stop --format html # output file format, support flat[=N]|traces[=N]|collapsed|flamegraph|tree|jfr\n" + " profiler stop --file /tmp/result.html\n" + " profiler stop --threads \n" @@ -66,7 +69,10 @@ //@formatter:on public class ProfilerCommand extends AnnotatedCommand { private static final Logger logger = LoggerFactory.getLogger(ProfilerCommand.class); + // Track if a file was specified during profiler start + private static String fileSpecifiedAtStart = null; + // TODO start 时,没指定 file, 是否在 stop 时,能生成 html 或者 jfr 不? private String action; private String actionArg; @@ -117,6 +123,11 @@ public class ProfilerCommand extends AnnotatedCommand { */ private Integer jstackdepth; + /** + * wall clock profiling interval + */ + private Long wall; + /** * profile different threads separately */ @@ -229,6 +240,26 @@ public class ProfilerCommand extends AnnotatedCommand { */ private String timeout; + /** + * Features enabled for profiling + */ + private String features; + + /** + * Profiling signal to use + */ + private String signal; + + /* + * Clock source for sampling timestamps: monotonic or tsc + */ + private String clock; + + /* + * Normalize method names by removing unique numerical suffixes from lambda classes. + */ + private boolean norm; + private static String libPath; private static AsyncProfiler profiler = null; @@ -236,16 +267,12 @@ public class ProfilerCommand extends AnnotatedCommand { String profilerSoPath = null; if (OSUtils.isMac()) { // FAT_BINARY support both x86_64/arm64 - profilerSoPath = "async-profiler/libasyncProfiler-mac.so"; + profilerSoPath = "async-profiler/libasyncProfiler-mac.dylib"; } if (OSUtils.isLinux()) { - if (OSUtils.isX86_64() && OSUtils.isMuslLibc()) { - profilerSoPath = "async-profiler/libasyncProfiler-linux-musl-x64.so"; - } else if(OSUtils.isX86_64()){ + if (OSUtils.isX86_64()) { profilerSoPath = "async-profiler/libasyncProfiler-linux-x64.so"; - } else if (OSUtils.isArm64() && OSUtils.isMuslLibc()) { - profilerSoPath = "async-profiler/libasyncProfiler-linux-musl-arm64.so"; - } else if (OSUtils.isArm64()) { + } else if (OSUtils.isArm64()) { profilerSoPath = "async-profiler/libasyncProfiler-linux-arm64.so"; } } @@ -334,17 +361,48 @@ public void setLock(String lock) { } @Option(longName = "jfrsync") - @Description("start Java Flight Recording with the given config along with the profiler") + @Description("Start Java Flight Recording with the given config along with the profiler. " + + "Accepts a predefined profile name, a path to a .jfc file, or a list of JFR events starting with '+'. ") public void setJfrsync(String jfrsync) { this.jfrsync = jfrsync; } + @Option(longName = "wall") + @Description("wall clock profiling interval in milliseconds(recommended: 200)") + public void setWall(Long wall) { + this.wall = wall; + } + @Option(shortName = "t", longName = "threads", flag = true) @Description("profile different threads separately") public void setThreads(boolean threads) { this.threads = threads; } + @Option(shortName = "F", longName = "features") + @Description("Features enabled for profiling") + public void setFeatures(String features) { + this.features = features; + } + + @Option(longName = "signal") + @Description("Set the profiling signal to use") + public void setSignal(String signal) { + this.signal = signal; + } + + @Option(longName = "clock") + @Description("Clock source for sampling timestamps: monotonic or tsc") + public void setClock(String clock) { + this.clock = clock; + } + + @Option(longName = "norm", flag = true) + @Description("Normalize method names by removing unique numerical suffixes from lambda classes.") + public void setNorm(boolean norm) { + this.norm = norm; + } + @Option(longName = "sched", flag = true) @Description("group threads by scheduling policy") public void setSched(boolean sched) { @@ -472,18 +530,12 @@ public void setChunktime(String chunktime) { @Description("run profiler in a loop (continuous profiling)") public void setLoop(String loop) { this.loop = loop; - if (this.action.equals("collect")) { - this.action = "start"; - } } @Option(longName = "timeout") @Description("automatically stop profiler at TIME (absolute or relative)") public void setTimeout(String timeout) { this.timeout = timeout; - if (this.action.equals("collect")) { - this.action = "start"; - } } @@ -529,11 +581,11 @@ private AsyncProfiler profilerInstance() { } /** - * https://github.com/async-profiler/async-profiler/blob/v2.9/profiler.sh#L154 + * https://github.com/async-profiler/async-profiler/blob/v3.0/src/arguments.cpp#L131 */ public enum ProfilerAction { - // start, resume, stop, dump, check, status, meminfo, list, collect, - start, resume, stop, dump, check, status, meminfo, list, collect, + // start, resume, stop, dump, check, status, meminfo, list, + start, resume, stop, dump, check, status, meminfo, list, version, load, @@ -576,6 +628,15 @@ private String executeArgs(ProfilerAction action) { if (this.interval != null) { sb.append("interval=").append(this.interval).append(COMMA); } + if (this.features != null) { + sb.append("features=").append(this.features).append(COMMA); + } + if (this.signal != null) { + sb.append("signal=").append(this.signal).append(COMMA); + } + if (this.clock != null) { + sb.append("clock=").append(this.clock).append(COMMA); + } if (this.jstackdepth != null) { sb.append("jstackdepth=").append(this.jstackdepth).append(COMMA); } @@ -603,6 +664,9 @@ private String executeArgs(ProfilerAction action) { if (this.alluser) { sb.append("alluser").append(COMMA); } + if (this.norm) { + sb.append("norm").append(COMMA); + } if (this.includes != null) { for (String include : includes) { sb.append("include=").append(include).append(COMMA); @@ -623,7 +687,9 @@ private String executeArgs(ProfilerAction action) { if (this.end != null) { sb.append("end=").append(this.end).append(COMMA); } - + if (this.wall != null) { + sb.append("wall=").append(this.wall).append(COMMA); + } if (this.title != null) { sb.append("title=").append(this.title).append(COMMA); } @@ -654,6 +720,7 @@ private String executeArgs(ProfilerAction action) { private static String execute(AsyncProfiler asyncProfiler, String arg) throws IllegalArgumentException, IOException { + logger.info("profiler execute args: {}", arg); String result = asyncProfiler.execute(arg); if (!result.endsWith("\n")) { result += "\n"; @@ -681,13 +748,42 @@ public void process(final CommandProcess process) { } String result = execute(asyncProfiler, this.actionArg); appendExecuteResult(process, result); - } else if (ProfilerAction.collect.equals(profilerAction)) { - String executeArgs = executeArgs(ProfilerAction.collect); - String result = execute(asyncProfiler, executeArgs); - ProfilerModel profilerModel = createProfilerModel(result); + } else if (ProfilerAction.start.equals(profilerAction)) { + // Track if file parameter was specified during start + boolean autoGeneratedFile = false; + if (this.file != null) { + fileSpecifiedAtStart = this.file; + logger.debug("File specified during profiler start: {}", fileSpecifiedAtStart); + } else if (this.timeout != null) { + // Auto-generate file if timeout is specified but file is not + try { + this.file = outputFile(); + logger.debug("Auto-generated file for timeout: {}", this.file); + fileSpecifiedAtStart = this.file; + autoGeneratedFile = true; + } catch (IOException e) { + logger.warn("Failed to auto-generate file for timeout", e); + } + } + + if (this.duration == null) { + String executeArgs = executeArgs(ProfilerAction.start); + String result = execute(asyncProfiler, executeArgs); + ProfilerModel profilerModel = createProfilerModel(result); - if (this.duration != null) { + // Add information about auto-generated file for timeout + if (autoGeneratedFile && this.file != null) { + profilerModel.setOutputFile(this.file); + profilerModel.setExecuteResult(profilerModel.getExecuteResult() + + "\nAuto-generated output file will be: " + this.file + "\n"); + } + + process.appendResult(profilerModel); + } else { // 设置延时执行 stop final String outputFile = outputFile(); + String executeArgs = executeArgs(ProfilerAction.start); + String result = execute(asyncProfiler, executeArgs); + ProfilerModel profilerModel = createProfilerModel(result); profilerModel.setOutputFile(outputFile); profilerModel.setDuration(duration); @@ -695,7 +791,7 @@ public void process(final CommandProcess process) { ArthasBootstrap.getInstance().getScheduledExecutorService().schedule(new Runnable() { @Override public void run() { - //在异步线程执行,profiler命令已经结束,不能输出到客户端 + // 在异步线程执行,profiler命令已经结束,不能输出到客户端 try { logger.info("stopping profiler ..."); ProfilerModel model = processStop(asyncProfiler, ProfilerAction.stop); @@ -706,12 +802,9 @@ public void run() { } } }, this.duration, TimeUnit.SECONDS); + process.appendResult(profilerModel); } - process.appendResult(profilerModel); - } else if (ProfilerAction.start.equals(profilerAction)) { - String executeArgs = executeArgs(ProfilerAction.start); - String result = execute(asyncProfiler, executeArgs); - appendExecuteResult(process, result); + } else if (ProfilerAction.stop.equals(profilerAction)) { ProfilerModel profilerModel = processStop(asyncProfiler, profilerAction); process.appendResult(profilerModel); @@ -772,12 +865,27 @@ public void run() { } private ProfilerModel processStop(AsyncProfiler asyncProfiler, ProfilerAction profilerAction) throws IOException { - String outputFile = outputFile(); + String outputFile = null; + + // If we're stopping and a file was specified during start, don't generate a new + // output file + if (profilerAction == ProfilerAction.stop && fileSpecifiedAtStart != null) { + outputFile = fileSpecifiedAtStart; + // Reset the tracking variable after stop + logger.debug("Using file specified during start: {}", fileSpecifiedAtStart); + fileSpecifiedAtStart = null; + } else { + // Otherwise generate or use the specified output file + outputFile = outputFile(); + } + String executeArgs = executeArgs(profilerAction); String result = execute(asyncProfiler, executeArgs); ProfilerModel profilerModel = createProfilerModel(result); - profilerModel.setOutputFile(outputFile); + if (outputFile != null) { + profilerModel.setOutputFile(outputFile); + } return profilerModel; } diff --git a/core/src/main/java/com/taobao/arthas/core/shell/cli/CompletionUtils.java b/core/src/main/java/com/taobao/arthas/core/shell/cli/CompletionUtils.java index b95b5ea0dcd..15d1f70cbdc 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/cli/CompletionUtils.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/cli/CompletionUtils.java @@ -238,6 +238,7 @@ public static boolean completeMethodName(Completion completion) { res.add(method.getName()); } } + res.add(""); if (res.size() == 1) { completion.complete(res.get(0).substring(lastToken.length()), true); diff --git a/core/src/main/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImpl.java b/core/src/main/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImpl.java index 175f4cd824e..ca956e5566c 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImpl.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImpl.java @@ -11,9 +11,6 @@ * @author Julien Viet */ public class CliTokenImpl implements CliToken { - private static final String PIPE = "|"; - private static final String REDIRECT = ">"; - private static final String REDIRECT_APPEND = ">>"; final boolean text; final String raw; @@ -74,7 +71,7 @@ public static List tokenize(String s) { tokenize(s, 0, tokens); - tokens = adjustTokensForSpecialSymbols(tokens); + tokens = correctPipeChar(tokens); return tokens; } @@ -90,53 +87,35 @@ public static List tokenize(String s) { * unsupported: * 3) thread|grep xxx * 4) trace -E classA|classB methodA|methodB|grep classA - * - * Also handles redirection of '>' and '>>' in the similar way - * - * @param tokens original tokens - * @return adjusted tokens + * @param tokens + * @return */ - private static List adjustTokensForSpecialSymbols(List tokens) { - return separateLeadingAndTailingSymbol(tokens, PIPE, REDIRECT_APPEND, REDIRECT); - } - - private static List separateLeadingAndTailingSymbol(List tokens, String... symbols) { - List adjustedTokens = new ArrayList<>(); + private static List correctPipeChar(List tokens) { + List newTokens = new ArrayList(tokens.size()+4); for (CliToken token : tokens) { - String value = token.value(); - String raw = token.raw(); - boolean handled = false; - for (String symbol : symbols) { - if (value.equals(symbol)) { - break; - } else if (value.endsWith(symbol)) { - handled = true; - int lastIndexOfSymbol = raw.lastIndexOf(symbol); - adjustedTokens.add(new CliTokenImpl( - token.isText(), - raw.substring(0, lastIndexOfSymbol), - value.substring(0, value.length() - symbol.length()) - )); - adjustedTokens.add(new CliTokenImpl(true, raw.substring(lastIndexOfSymbol), symbol)); - break; - } else if (value.startsWith(symbol)) { - handled = true; - int firstIndexOfSymbol = raw.indexOf(symbol); - adjustedTokens.add(new CliTokenImpl(true, - raw.substring(0, firstIndexOfSymbol + symbol.length()), symbol)); - adjustedTokens.add(new CliTokenImpl( - token.isText(), - raw.substring(firstIndexOfSymbol + symbol.length()), - value.substring(symbol.length()) - )); - break; - } - } - if (!handled) { - adjustedTokens.add(token); + String tokenValue = token.value(); + if (tokenValue.length()>1 && tokenValue.endsWith("|")) { + //split last char '|' + tokenValue = tokenValue.substring(0, tokenValue.length()-1); + String rawValue = token.raw(); + rawValue = rawValue.substring(0, rawValue.length()-1); + newTokens.add(new CliTokenImpl(token.isText(), rawValue, tokenValue)); + //add '|' char + newTokens.add(new CliTokenImpl(true, "|", "|")); + + } else if (tokenValue.length()>1 && tokenValue.startsWith("|")) { + //add '|' char + newTokens.add(new CliTokenImpl(true, "|", "|")); + //remove first char '|' + tokenValue = tokenValue.substring(1); + String rawValue = token.raw(); + rawValue = rawValue.substring(1); + newTokens.add(new CliTokenImpl(token.isText(), rawValue, tokenValue)); + } else { + newTokens.add(token); } } - return adjustedTokens; + return newTokens; } private static void tokenize(String s, int index, List builder) { diff --git a/core/src/main/java/com/taobao/arthas/core/shell/handlers/shell/ShellLineHandler.java b/core/src/main/java/com/taobao/arthas/core/shell/handlers/shell/ShellLineHandler.java index 70d09aa0b32..24eb3711f29 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/handlers/shell/ShellLineHandler.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/handlers/shell/ShellLineHandler.java @@ -8,6 +8,7 @@ import com.taobao.arthas.core.shell.system.Job; import com.taobao.arthas.core.shell.term.Term; import com.taobao.arthas.core.util.TokenUtils; +import com.taobao.arthas.core.view.Ansi; import java.util.List; @@ -166,6 +167,10 @@ private void handleJobs() { } private void handleExit() { + String msg = Ansi.ansi().fg(Ansi.Color.GREEN).a("Session has been terminated.\n" + + "Arthas is still running in the background.\n" + + "To completely shutdown arthas, please execute the 'stop' command.\n").reset().toString(); + term.write(msg); term.close(); } } diff --git a/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java b/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java index 1e87e10d931..a397538ce3f 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/system/impl/JobControllerImpl.java @@ -222,8 +222,8 @@ private Process createCommandProcess(Command command, ListIterator tok stdoutHandlerChain.add(new RedirectHandler()); } } - ProcessOutput ProcessOutput = new ProcessOutput(stdoutHandlerChain, cacheLocation, term); - ProcessImpl process = new ProcessImpl(command, remaining, command.processHandler(), ProcessOutput, resultDistributor); + ProcessOutput processOutput = new ProcessOutput(stdoutHandlerChain, cacheLocation, term); + ProcessImpl process = new ProcessImpl(command, remaining, command.processHandler(), processOutput, resultDistributor); process.setTty(term); return process; } diff --git a/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java b/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java index 63b68c55027..5ee8564b0f9 100644 --- a/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java +++ b/core/src/main/java/com/taobao/arthas/core/shell/term/impl/http/DirectoryBrowser.java @@ -186,9 +186,15 @@ public static DefaultFullHttpResponse directView(File dir, String path, FullHttp } finally { IOUtils.close(fileInputStream); } - ctx.write(fullResp); - ChannelFuture future = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); - future.addListener(ChannelFutureListener.CLOSE); + ChannelFuture channelFuture = ctx.writeAndFlush(fullResp); + channelFuture.addListener((ChannelFutureListener) future -> { + if (future.isSuccess()) { + ChannelFuture lastContentFuture = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); + lastContentFuture.addListener(ChannelFutureListener.CLOSE); + } else { + future.channel().close(); + } + }); return fullResp; } logger.info("file {} size bigger than {}, send by future.",file.getName(), MIN_NETTY_DIRECT_SEND_SIZE); diff --git a/core/src/main/java/com/taobao/arthas/core/util/ArthasBanner.java b/core/src/main/java/com/taobao/arthas/core/util/ArthasBanner.java index e03db910c3b..468781b9529 100644 --- a/core/src/main/java/com/taobao/arthas/core/util/ArthasBanner.java +++ b/core/src/main/java/com/taobao/arthas/core/util/ArthasBanner.java @@ -112,13 +112,25 @@ public static String welcome() { public static String welcome(Map infos) { logger.info("Current arthas version: {}, recommend latest version: {}", version(), latestVersion()); + String appName = System.getProperty("project.name"); + if (appName == null) { + appName = System.getProperty("app.name"); + } + if (appName == null) { + appName = System.getProperty("spring.application.name"); + } TableElement table = new TableElement().rightCellPadding(1) .row("wiki", wiki()) .row("tutorials", tutorials()) .row("version", version()) - .row("main_class", PidUtils.mainClass()) - .row("pid", PidUtils.currentPid()) - .row("time", DateUtils.getCurrentDateTime()); + .row("main_class", PidUtils.mainClass()); + + if (appName != null) { + table.row("app_name", appName); + } + table.row("pid", PidUtils.currentPid()) + .row("start_time", DateUtils.getStartDateTime()) + .row("currnt_time", DateUtils.getCurrentDateTime()); for (Entry entry : infos.entrySet()) { table.row(entry.getKey(), entry.getValue()); } diff --git a/core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java b/core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java index 7be694adebb..a8e49118f91 100644 --- a/core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java +++ b/core/src/main/java/com/taobao/arthas/core/util/ClassLoaderUtils.java @@ -9,13 +9,16 @@ import java.util.List; import java.util.Set; +import com.alibaba.arthas.deps.org.slf4j.Logger; +import com.alibaba.arthas.deps.org.slf4j.LoggerFactory; + /** * * @author hengyunabc 2019-02-05 * */ public class ClassLoaderUtils { - + private static Logger logger = LoggerFactory.getLogger(ClassLoaderUtils.class); public static Set getAllClassLoader(Instrumentation inst) { Set classLoaderSet = new HashSet(); @@ -127,7 +130,11 @@ else if (!StringUtils.isEmpty(classLoaderToString) && StringUtils.isEmpty(classL @SuppressWarnings({ "unchecked", "restriction" }) public static URL[] getUrls(ClassLoader classLoader) { if (classLoader instanceof URLClassLoader) { - return ((URLClassLoader) classLoader).getURLs(); + try { + return ((URLClassLoader) classLoader).getURLs(); + } catch (Throwable e) { + logger.error("classLoader: {} getUrls error", classLoader, e); + } } // jdk9 diff --git a/core/src/main/java/com/taobao/arthas/core/util/DateUtils.java b/core/src/main/java/com/taobao/arthas/core/util/DateUtils.java index 2efa0dedb26..0a4f34a93ec 100644 --- a/core/src/main/java/com/taobao/arthas/core/util/DateUtils.java +++ b/core/src/main/java/com/taobao/arthas/core/util/DateUtils.java @@ -1,6 +1,10 @@ package com.taobao.arthas.core.util; +import java.lang.management.ManagementFactory; +import java.lang.management.RuntimeMXBean; +import java.time.Instant; import java.time.LocalDateTime; +import java.time.ZoneId; import java.time.format.DateTimeFormatter; /** @@ -21,4 +25,16 @@ public static String getCurrentDateTime() { public static String formatDateTime(LocalDateTime dateTime) { return DATE_TIME_FORMATTER.format(dateTime); } + + public static String getStartDateTime() { + try { + RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); + long startTime = runtimeMXBean.getStartTime(); + Instant startInstant = Instant.ofEpochMilli(startTime); + LocalDateTime startDateTime = LocalDateTime.ofInstant(startInstant, ZoneId.systemDefault()); + return DATE_TIME_FORMATTER.format(startDateTime); + } catch (Throwable e) { + return "unknown"; + } + } } diff --git a/core/src/main/java/one/profiler/AsyncProfiler.java b/core/src/main/java/one/profiler/AsyncProfiler.java index 9a1514388c3..d077f49e498 100644 --- a/core/src/main/java/one/profiler/AsyncProfiler.java +++ b/core/src/main/java/one/profiler/AsyncProfiler.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -283,4 +272,4 @@ private void filterThread(Thread thread, boolean enable) { private native String execute0(String command) throws IllegalArgumentException, IllegalStateException, IOException; private native void filterThread0(Thread thread, boolean enable); -} +} \ No newline at end of file diff --git a/core/src/main/java/one/profiler/AsyncProfilerMXBean.java b/core/src/main/java/one/profiler/AsyncProfilerMXBean.java index 90abf830c7a..5210c647b09 100644 --- a/core/src/main/java/one/profiler/AsyncProfilerMXBean.java +++ b/core/src/main/java/one/profiler/AsyncProfilerMXBean.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -40,4 +29,4 @@ public interface AsyncProfilerMXBean { String dumpCollapsed(Counter counter); String dumpTraces(int maxTraces); String dumpFlat(int maxMethods); -} +} \ No newline at end of file diff --git a/core/src/main/java/one/profiler/Counter.java b/core/src/main/java/one/profiler/Counter.java index 489053b7290..0d0ec1160cc 100644 --- a/core/src/main/java/one/profiler/Counter.java +++ b/core/src/main/java/one/profiler/Counter.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -22,4 +11,4 @@ public enum Counter { SAMPLES, TOTAL -} +} \ No newline at end of file diff --git a/core/src/main/java/one/profiler/Events.java b/core/src/main/java/one/profiler/Events.java index 1731122c725..677c0e4140f 100644 --- a/core/src/main/java/one/profiler/Events.java +++ b/core/src/main/java/one/profiler/Events.java @@ -1,17 +1,6 @@ /* - * Copyright 2018 Andrei Pangin - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Copyright The async-profiler authors + * SPDX-License-Identifier: Apache-2.0 */ package one.profiler; @@ -24,5 +13,6 @@ public class Events { public static final String ALLOC = "alloc"; public static final String LOCK = "lock"; public static final String WALL = "wall"; + public static final String CTIMER = "ctimer"; public static final String ITIMER = "itimer"; -} +} \ No newline at end of file diff --git a/core/src/test/java/com/taobao/arthas/core/GlobalOptionsTest.java b/core/src/test/java/com/taobao/arthas/core/GlobalOptionsTest.java new file mode 100644 index 00000000000..f915d6c616a --- /dev/null +++ b/core/src/test/java/com/taobao/arthas/core/GlobalOptionsTest.java @@ -0,0 +1,18 @@ +package com.taobao.arthas.core; + +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +import ognl.OgnlRuntime; + +class GlobalOptionsTest { + + @Test + void test() { + GlobalOptions.updateOnglStrict(true); + Assertions.assertThat(OgnlRuntime.getUseStricterInvocationValue()).isTrue(); + GlobalOptions.updateOnglStrict(false); + Assertions.assertThat(OgnlRuntime.getUseStricterInvocationValue()).isFalse(); + } + +} diff --git a/core/src/test/java/com/taobao/arthas/core/command/express/FlowAttribute.java b/core/src/test/java/com/taobao/arthas/core/command/express/FlowAttribute.java new file mode 100644 index 00000000000..1848b650ca1 --- /dev/null +++ b/core/src/test/java/com/taobao/arthas/core/command/express/FlowAttribute.java @@ -0,0 +1,9 @@ +package com.taobao.arthas.core.command.express; + +public class FlowAttribute { + private String bxApp = "aaa"; + + public String getBxApp() { + return this.bxApp ; + } +} diff --git a/core/src/test/java/com/taobao/arthas/core/command/express/FlowContext.java b/core/src/test/java/com/taobao/arthas/core/command/express/FlowContext.java new file mode 100644 index 00000000000..c1991bdbe79 --- /dev/null +++ b/core/src/test/java/com/taobao/arthas/core/command/express/FlowContext.java @@ -0,0 +1,9 @@ +package com.taobao.arthas.core.command.express; + +public class FlowContext { + private FlowAttribute flowAttribute = new FlowAttribute(); + + public FlowAttribute getFlowAttribute() { + return this.flowAttribute ; + } +} diff --git a/core/src/test/java/com/taobao/arthas/core/command/express/OgnlTest.java b/core/src/test/java/com/taobao/arthas/core/command/express/OgnlTest.java new file mode 100644 index 00000000000..7148ebbbb2a --- /dev/null +++ b/core/src/test/java/com/taobao/arthas/core/command/express/OgnlTest.java @@ -0,0 +1,46 @@ +package com.taobao.arthas.core.command.express; + +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import com.taobao.arthas.core.advisor.Advice; +import ognl.OgnlException; + +import static org.junit.jupiter.api.Assertions.assertTrue; + +/** + * https://github.com/alibaba/arthas/issues/2954 + */ +public class OgnlTest { + + private Express express; + + @BeforeEach + public void setUp() throws OgnlException, ExpressException { + FlowContext context = new FlowContext(); + Object[] params = new Object[4]; + params[0] = context; + Advice advice = Advice.newForAfterReturning(null, getClass(), null, null, params, null); + express = ExpressFactory.unpooledExpress(null).bind(advice).bind("cost", 123); + } + + @Test + public void testStringEquals() throws OgnlException, ExpressException { + String conditionExpress = "\"aaa\".equals(params[0].flowAttribute.getBxApp())"; + boolean result = express.is(conditionExpress); + assertTrue(result); + } + + @Test + public void testObjectEquals() throws OgnlException, ExpressException { + String conditionExpress = "params[0].flowAttribute.getBxApp().equals(\"aaa\")"; + boolean result = express.is(conditionExpress); + assertTrue(result); + } + + @Test + public void testEqualSign() throws OgnlException, ExpressException { + String conditionExpress = "\"aaa\" == params[0].flowAttribute.getBxApp()"; + boolean result = express.is(conditionExpress); + assertTrue(result); + } +} diff --git a/core/src/test/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImplTest.java b/core/src/test/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImplTest.java index 8e347d3adf5..fbaeb1b230c 100644 --- a/core/src/test/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImplTest.java +++ b/core/src/test/java/com/taobao/arthas/core/shell/cli/impl/CliTokenImplTest.java @@ -4,7 +4,7 @@ import org.junit.Assert; import org.junit.Test; -import java.util.ArrayList; +import java.util.Iterator; import java.util.List; public class CliTokenImplTest { @@ -25,86 +25,14 @@ public class CliTokenImplTest { @Test public void testSupportedPipeCharWithoutRegex() { String[] expectedTextTokenValue = new String[]{"thread", "|", "grep", "xxx"}; - String cmd = "thread| grep xxx"; - List actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread | grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread |grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread'|' grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread '|' grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread '|'grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread\"|\" grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread \"|\" grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread \"|\"grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"thread| grep", "xxx"}; - cmd = "thread'| 'grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread\"| \"grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"thread |grep", "xxx"}; - cmd = "thread' |'grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "thread\" |\"grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"thread \"|\"grep", "xxx"}; - cmd = "thread' \"|\"'grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"thread '|'grep", "xxx"}; - cmd = "thread\" '|'\"grep xxx"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); + List actualTokens = CliTokenImpl.tokenize("thread| grep xxx"); + assertEquals(expectedTextTokenValue, actualTokens); + actualTokens = CliTokenImpl.tokenize("thread | grep xxx"); + assertEquals(expectedTextTokenValue, actualTokens); + actualTokens = CliTokenImpl.tokenize("thread |grep xxx"); + assertEquals(expectedTextTokenValue, actualTokens); } /** @@ -123,85 +51,14 @@ public void testSupportedPipeCharWithoutRegex() { @Test public void testSupportedPipeCharWithRegex() { String[] expectedTextTokenValue = new String[]{"trace", "-E", "classA|classB", "methodA|methodB", "|", "grep", "classA"}; - String cmd = "trace -E classA|classB methodA|methodB| grep classA"; - List actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB | grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB |grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB'|' grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB '|' grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB '|'grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - + List actualTokens = CliTokenImpl.tokenize("trace -E classA|classB methodA|methodB| grep classA"); + assertEquals(expectedTextTokenValue, actualTokens); - cmd = "trace -E classA|classB methodA|methodB\"|\" grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); + actualTokens = CliTokenImpl.tokenize("trace -E classA|classB methodA|methodB | grep classA"); + assertEquals(expectedTextTokenValue, actualTokens); - cmd = "trace -E classA|classB methodA|methodB \"|\" grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB \"|\"grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"trace", "-E", "classA|classB", "methodA|methodB| grep", "classA"}; - cmd = "trace -E classA|classB methodA|methodB'| 'grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB\"| \"grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"trace", "-E", "classA|classB", "methodA|methodB |grep", "classA"}; - cmd = "trace -E classA|classB methodA|methodB' |'grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "trace -E classA|classB methodA|methodB\" |\"grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"trace", "-E", "classA|classB", "methodA|methodB '|'grep", "classA"}; - cmd = "trace -E classA|classB methodA|methodB\" '|'\"grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"trace", "-E", "classA|classB", "methodA|methodB \"|\"grep", "classA"}; - cmd = "trace -E classA|classB methodA|methodB' \"|\"'grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); + actualTokens = CliTokenImpl.tokenize("trace -E classA|classB methodA|methodB |grep classA"); + assertEquals(expectedTextTokenValue, actualTokens); } /** @@ -220,247 +77,34 @@ public void testSupportedPipeCharWithRegex() { @Test public void testUnSupportedPipeChar() { String[] expectedTextTokenValue = new String[]{"thread|grep", "xxx"}; - String cmd = "thread|grep xxx"; - List actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); + List actualTokens = CliTokenImpl.tokenize("thread|grep xxx"); + assertEquals(expectedTextTokenValue, actualTokens); expectedTextTokenValue = new String[]{"trace", "-E", "classA|classB", "methodA|methodB|grep", "classA"}; - cmd = "trace -E classA|classB methodA|methodB|grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); + actualTokens = CliTokenImpl.tokenize("trace -E classA|classB methodA|methodB|grep classA"); + assertEquals(expectedTextTokenValue, actualTokens); expectedTextTokenValue = new String[]{"trace", "-E", "classA|classB", "|", "methodA|methodB", "|", "grep", "classA"}; - cmd = "trace -E classA|classB| methodA|methodB | grep classA"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); + actualTokens = CliTokenImpl.tokenize("trace -E classA|classB| methodA|methodB | grep classA"); + assertEquals(expectedTextTokenValue, actualTokens); } - @Test - public void testSeparateRedirect() { - String[] expectedTextTokenValue = new String[]{"jad", "aaa", ">", "bbb"}; - String cmd = "jad aaa> bbb"; - List actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa > bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa >bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa'>' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa '>' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa '>'bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa\">\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - - cmd = "jad aaa \">\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa \">\"bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa >bbb"}; - - cmd = "jad aaa' >'bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa\" >\"bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa> bbb"}; - - cmd = "jad aaa\"> \"bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa'> 'bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa\\r", ">", "bbb"}; - - cmd = "jad aaa'\\r>' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa\"\\r>\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa'", ">", "bbb"}; - cmd = "jad aaa\"'>\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa'>'", "bbb"}; - cmd = "jad aaa\"'>'\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa\">\"", "bbb"}; - cmd = "jad aaa'\">\"' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - } - - @Test - public void testSeparateRedirectAppend() { - String[] expectedTextTokenValue = new String[]{"jad", "aaa", ">>", "bbb"}; - String cmd = "jad aaa>> bbb"; - List actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa >> bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa >>bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa'>>' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa '>>' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa '>>'bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa\">>\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - - cmd = "jad aaa \">>\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa \">>\"bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa >>bbb"}; - - cmd = "jad aaa' >>'bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa\" >>\"bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa>> bbb"}; - - cmd = "jad aaa\">> \"bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa'>> 'bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa\\r", ">>", "bbb"}; - - cmd = "jad aaa'\\r>>' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - cmd = "jad aaa\"\\r>>\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa'", ">>", "bbb"}; - cmd = "jad aaa\"'>>\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa'>>'", "bbb"}; - cmd = "jad aaa\"'>>'\" bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - - expectedTextTokenValue = new String[]{"jad", "aaa\">>\"", "bbb"}; - cmd = "jad aaa'\">>\"' bbb"; - actualTokens = CliTokenImpl.tokenize(cmd); - assertEqualsIgnoreBlank(expectedTextTokenValue, actualTokens); - Assert.assertEquals(cmd, concatRaw(actualTokens)); - } - - private void assertEqualsIgnoreBlank(String[] expectedTextTokenValue, List actualTokens) { - Assert.assertArrayEquals(expectedTextTokenValue, removeBlankToken(actualTokens)); - } - - private static String[] removeBlankToken(List cliTokens) { - List copy = new ArrayList<>(cliTokens); - return copy.stream() - .filter(token -> !token.isBlank()) - .map(CliToken::value) - .toArray(String[]::new); + private void assertEquals(String[] expectedTextTokenValue, List actualTokens) { + removeBlankToken(actualTokens); + for (int i = 0; i < expectedTextTokenValue.length; i++) { + Assert.assertEquals(expectedTextTokenValue[i], actualTokens.get(i).value()); + } } - private static String concatRaw(List tokens) { - StringBuilder builder = new StringBuilder(); - for (CliToken token : tokens) { - builder.append(token.raw()); + private void removeBlankToken(List cliTokens) { + CliToken blankToken = new CliTokenImpl(false, " "); + Iterator it = cliTokens.iterator(); + while (it.hasNext()) { + CliToken token = it.next(); + if (blankToken.equals(token)) { + it.remove(); + } } - return builder.toString(); } } diff --git a/labs/README.md b/labs/README.md new file mode 100644 index 00000000000..6457ced6c71 --- /dev/null +++ b/labs/README.md @@ -0,0 +1,3 @@ +# Arthas 实验项目 + +不保证生产可用,实验研究项目。 \ No newline at end of file diff --git a/labs/arthas-grpc-server/README.md b/labs/arthas-grpc-server/README.md new file mode 100644 index 00000000000..20bf89a4c43 --- /dev/null +++ b/labs/arthas-grpc-server/README.md @@ -0,0 +1,3 @@ +# Arthas Grpc + +这个模块提供了一个轻量级的 Grpc 实现,目前任在开发中 \ No newline at end of file diff --git a/labs/arthas-grpc-server/pom.xml b/labs/arthas-grpc-server/pom.xml new file mode 100644 index 00000000000..835188bbb4e --- /dev/null +++ b/labs/arthas-grpc-server/pom.xml @@ -0,0 +1,156 @@ + + + + + arthas-all + com.taobao.arthas + ${revision} + ../../pom.xml + + 4.0.0 + arthas-grpc-server + arthas-grpc-server + https://github.com/alibaba/arthas + + + 8 + 8 + UTF-8 + 1.46.0 + + + + + + io.grpc + grpc-bom + ${grpc.version} + pom + import + + + + + + + + + io.netty + netty-codec-http2 + 4.1.72.Final + + + + com.google.protobuf + protobuf-java + 3.19.2 + + + + com.taobao.arthas + arthas-common + ${project.version} + + + + + + io.grpc + grpc-netty + provided + + + io.netty + netty-codec-http2 + + + + + io.grpc + grpc-services + provided + + + org.junit.vintage + junit-vintage-engine + test + + + org.junit.jupiter + junit-jupiter + test + + + + javax.annotation + javax.annotation-api + 1.3.2 + provided + true + + + com.alibaba.arthas + arthas-repackage-logger + + + ch.qos.logback + logback-classic + + + ch.qos.logback + logback-core + + + org.slf4j + slf4j-api + + + + + + + + org.xolstice.maven.plugins + protobuf-maven-plugin + 0.6.1 + + ${basedir}/src/main/proto + com.google.protobuf:protoc:3.11.0:exe:${os.detected.classifier} + grpc-java + io.grpc:protoc-gen-grpc-java:1.28.0:exe:${os.detected.classifier} + + + + + compile + compile-custom + + + + + + + + kr.motd.maven + os-maven-plugin + 1.4.1.Final + + + + + + + mac + + + mac + + + + osx-x86_64 + + + + \ No newline at end of file diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/ArthasGrpcBootstrap.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/ArthasGrpcBootstrap.java new file mode 100644 index 00000000000..02d5d9af4bb --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/ArthasGrpcBootstrap.java @@ -0,0 +1,13 @@ +package com.taobao.arthas.grpc.server; + +/** + * @author: FengYe + * @date: 2024/10/13 02:40 + * @description: ArthasGrpcServerBootstrap + */ +public class ArthasGrpcBootstrap { + public static void main(String[] args) { + ArthasGrpcServer arthasGrpcServer = new ArthasGrpcServer(9091, null); + arthasGrpcServer.start(); + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/ArthasGrpcServer.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/ArthasGrpcServer.java new file mode 100644 index 00000000000..81080c73aa7 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/ArthasGrpcServer.java @@ -0,0 +1,73 @@ +package com.taobao.arthas.grpc.server; + +import com.alibaba.arthas.deps.ch.qos.logback.classic.Level; +import com.alibaba.arthas.deps.ch.qos.logback.classic.LoggerContext; +import com.alibaba.arthas.deps.org.slf4j.Logger; +import com.alibaba.arthas.deps.org.slf4j.LoggerFactory; +import com.taobao.arthas.grpc.server.handler.GrpcDispatcher; +import com.taobao.arthas.grpc.server.handler.Http2Handler; +import com.taobao.arthas.grpc.server.handler.executor.GrpcExecutorFactory; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.Channel; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelOption; +import io.netty.channel.EventLoopGroup; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.codec.http2.Http2FrameCodecBuilder; +import io.netty.util.concurrent.DefaultEventExecutorGroup; +import io.netty.util.concurrent.EventExecutorGroup; + +import java.lang.invoke.MethodHandles; + +/** + * @author: FengYe + * @date: 2024/7/3 上午12:30 + * @description: ArthasGrpcServer + */ +public class ArthasGrpcServer { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass().getName()); + + private int port = 9091; + + private String grpcServicePackageName; + + public ArthasGrpcServer(int port, String grpcServicePackageName) { + this.port = port; + this.grpcServicePackageName = grpcServicePackageName; + } + + public void start() { + EventLoopGroup bossGroup = new NioEventLoopGroup(1); + EventLoopGroup workerGroup = new NioEventLoopGroup(10); + + GrpcDispatcher grpcDispatcher = new GrpcDispatcher(); + grpcDispatcher.loadGrpcService(grpcServicePackageName); + GrpcExecutorFactory grpcExecutorFactory = new GrpcExecutorFactory(); + grpcExecutorFactory.loadExecutor(grpcDispatcher); + + try { + ServerBootstrap b = new ServerBootstrap(); + b.group(bossGroup, workerGroup) + .channel(NioServerSocketChannel.class) + .option(ChannelOption.SO_BACKLOG, 1024) + .childHandler(new ChannelInitializer() { + @Override + public void initChannel(SocketChannel ch) { + ch.pipeline().addLast(Http2FrameCodecBuilder.forServer().build()); + ch.pipeline().addLast(new Http2Handler(grpcDispatcher, grpcExecutorFactory)); + } + }); + Channel channel = b.bind(port).sync().channel(); + logger.info("ArthasGrpcServer start successfully on port: {}", port); + channel.closeFuture().sync(); + } catch (InterruptedException e) { + logger.error("ArthasGrpcServer start error", e); + } finally { + bossGroup.shutdownGracefully(); + workerGroup.shutdownGracefully(); + } + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcDispatcher.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcDispatcher.java new file mode 100644 index 00000000000..4ad3313f11e --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcDispatcher.java @@ -0,0 +1,198 @@ +package com.taobao.arthas.grpc.server.handler; + + +import com.alibaba.arthas.deps.org.slf4j.Logger; +import com.alibaba.arthas.deps.org.slf4j.LoggerFactory; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcMethod; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcService; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import com.taobao.arthas.grpc.server.utils.ReflectUtil; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * @author: FengYe + * @date: 2024/9/6 01:12 + * @description: GrpcDelegrate + */ +public class GrpcDispatcher { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass().getName()); + + public static final String DEFAULT_GRPC_SERVICE_PACKAGE_NAME = "com.taobao.arthas.grpc.server.service.impl"; + + public static Map grpcInvokeMap = new HashMap<>(); + +// public static Map clientStreamInvokeMap = new HashMap<>(); + + public static Map requestParseFromMap = new HashMap<>(); + + public static Map requestToByteArrayMap = new HashMap<>(); + + public static Map responseParseFromMap = new HashMap<>(); + + public static Map responseToByteArrayMap = new HashMap<>(); + + public static Map grpcInvokeTypeMap = new HashMap<>(); + + public void loadGrpcService(String grpcServicePackageName) { + List> classes = ReflectUtil.findClasses(Optional.ofNullable(grpcServicePackageName).orElse(DEFAULT_GRPC_SERVICE_PACKAGE_NAME)); + for (Class clazz : classes) { + if (clazz.isAnnotationPresent(GrpcService.class)) { + try { + // 处理 service + GrpcService grpcService = clazz.getAnnotation(GrpcService.class); + Object instance = clazz.getDeclaredConstructor().newInstance(); + // 处理 method + MethodHandles.Lookup lookup = MethodHandles.lookup(); + Method[] declaredMethods = clazz.getDeclaredMethods(); + for (Method method : declaredMethods) { + if (method.isAnnotationPresent(GrpcMethod.class)) { + GrpcMethod grpcMethod = method.getAnnotation(GrpcMethod.class); + MethodHandle grpcInvoke = lookup.unreflect(method); + String grpcMethodKey = generateGrpcMethodKey(grpcService.value(), grpcMethod.value()); + grpcInvokeTypeMap.put(grpcMethodKey, grpcMethod.grpcType()); + grpcInvokeMap.put(grpcMethodKey, grpcInvoke.bindTo(instance)); + + + Class requestClass = null; + Class responseClass = null; + if (GrpcInvokeTypeEnum.UNARY.equals(grpcMethod.grpcType())) { + requestClass = grpcInvoke.type().parameterType(1); + responseClass = grpcInvoke.type().returnType(); + } else if (GrpcInvokeTypeEnum.CLIENT_STREAM.equals(grpcMethod.grpcType()) || GrpcInvokeTypeEnum.BI_STREAM.equals(grpcMethod.grpcType())) { + responseClass = getInnerGenericClass(method.getGenericParameterTypes()[0]); + requestClass = getInnerGenericClass(method.getGenericReturnType()); + } else if (GrpcInvokeTypeEnum.SERVER_STREAM.equals(grpcMethod.grpcType())) { + requestClass = getInnerGenericClass(method.getGenericParameterTypes()[0]); + responseClass = getInnerGenericClass(method.getGenericParameterTypes()[1]); + } + MethodHandle requestParseFrom = lookup.findStatic(requestClass, "parseFrom", MethodType.methodType(requestClass, byte[].class)); + MethodHandle responseParseFrom = lookup.findStatic(responseClass, "parseFrom", MethodType.methodType(responseClass, byte[].class)); + MethodHandle requestToByteArray = lookup.findVirtual(requestClass, "toByteArray", MethodType.methodType(byte[].class)); + MethodHandle responseToByteArray = lookup.findVirtual(responseClass, "toByteArray", MethodType.methodType(byte[].class)); + requestParseFromMap.put(grpcMethodKey, requestParseFrom); + responseParseFromMap.put(grpcMethodKey, responseParseFrom); + requestToByteArrayMap.put(grpcMethodKey, requestToByteArray); + responseToByteArrayMap.put(grpcMethodKey, responseToByteArray); + + +// switch (grpcMethod.grpcType()) { +// case UNARY: +// unaryInvokeMap.put(grpcMethodKey, grpcInvoke.bindTo(instance)); +// return; +// case CLIENT_STREAM: +// Object invoke = grpcInvoke.bindTo(instance).invoke(); +// if (!(invoke instanceof StreamObserver)) { +// throw new RuntimeException(grpcMethodKey + " return class is not StreamObserver!"); +// } +// clientStreamInvokeMap.put(grpcMethodKey, (StreamObserver) invoke); +// return; +// case SERVER_STREAM: +// return; +// case BI_STREAM: +// return; +// } + } + } + } catch (Throwable e) { + logger.error("GrpcDispatcher loadGrpcService error.", e); + } + } + } + } + + public GrpcResponse doUnaryExecute(String service, String method, byte[] arg) throws Throwable { + MethodHandle methodHandle = grpcInvokeMap.get(generateGrpcMethodKey(service, method)); + MethodType type = grpcInvokeMap.get(generateGrpcMethodKey(service, method)).type(); + Object req = requestParseFromMap.get(generateGrpcMethodKey(service, method)).invoke(arg); + Object execute = methodHandle.invoke(req); + GrpcResponse grpcResponse = new GrpcResponse(); + grpcResponse.setClazz(type.returnType()); + grpcResponse.setService(service); + grpcResponse.setMethod(method); + grpcResponse.writeResponseData(execute); + return grpcResponse; + } + + public GrpcResponse unaryExecute(GrpcRequest request) throws Throwable { + MethodHandle methodHandle = grpcInvokeMap.get(request.getGrpcMethodKey()); + MethodType type = grpcInvokeMap.get(request.getGrpcMethodKey()).type(); + Object req = requestParseFromMap.get(request.getGrpcMethodKey()).invoke(request.readData()); + Object execute = methodHandle.invoke(req); + GrpcResponse grpcResponse = new GrpcResponse(); + grpcResponse.setClazz(type.returnType()); + grpcResponse.setService(request.getService()); + grpcResponse.setMethod(request.getMethod()); + grpcResponse.writeResponseData(execute); + return grpcResponse; + } + + public StreamObserver clientStreamExecute(GrpcRequest request, StreamObserver responseObserver) throws Throwable { + MethodHandle methodHandle = grpcInvokeMap.get(request.getGrpcMethodKey()); + return (StreamObserver) methodHandle.invoke(responseObserver); + } + + public void serverStreamExecute(GrpcRequest request, StreamObserver responseObserver) throws Throwable { + MethodHandle methodHandle = grpcInvokeMap.get(request.getGrpcMethodKey()); + Object req = requestParseFromMap.get(request.getGrpcMethodKey()).invoke(request.readData()); + methodHandle.invoke(req, responseObserver); + } + + public StreamObserver biStreamExecute(GrpcRequest request, StreamObserver responseObserver) throws Throwable { + MethodHandle methodHandle = grpcInvokeMap.get(request.getGrpcMethodKey()); + return (StreamObserver) methodHandle.invoke(responseObserver); + } + + /** + * 获取指定 service method 对应的入参类型 + * + * @param serviceName + * @param methodName + * @return + */ + public static Class getRequestClass(String serviceName, String methodName) { + //protobuf 规范只能有单入参 + return Optional.ofNullable(grpcInvokeMap.get(generateGrpcMethodKey(serviceName, methodName))).orElseThrow(() -> new RuntimeException("The specified grpc method does not exist")).type().parameterArray()[0]; + } + + public static String generateGrpcMethodKey(String serviceName, String methodName) { + return serviceName + "." + methodName; + } + + public static void checkGrpcType(GrpcRequest request) { + request.setGrpcType( + Optional.ofNullable(grpcInvokeTypeMap.get(generateGrpcMethodKey(request.getService(), request.getMethod()))) + .orElse(GrpcInvokeTypeEnum.UNARY) + ); + request.setStreamFirstData(true); + } + + public static Class getInnerGenericClass(Type type) { + if (type instanceof Class) { + return (Class) type; + } + if (type instanceof ParameterizedType) { + ParameterizedType paramType = (ParameterizedType) type; + Type[] actualTypeArguments = paramType.getActualTypeArguments(); + if (actualTypeArguments.length > 0) { + Type innerType = actualTypeArguments[0]; // 获取第一个实际类型参数 + if (innerType instanceof ParameterizedType) { + return getInnerGenericClass(innerType); // 递归调用获取最内层类型 + } else if (innerType instanceof Class) { + return (Class) innerType; // 直接返回 Class 类型 + } + } + } + return null; // 如果没有找到对应的类型 + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcRequest.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcRequest.java new file mode 100644 index 00000000000..53b6fb13412 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcRequest.java @@ -0,0 +1,193 @@ +package com.taobao.arthas.grpc.server.handler; + +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import com.taobao.arthas.grpc.server.utils.ByteUtil; +import io.netty.buffer.ByteBuf; +import io.netty.handler.codec.http2.Http2Headers; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.zip.GZIPInputStream; + +/** + * @author: FengYe + * @date: 2024/9/4 23:07 + * @description: GrpcRequest grpc 请求体 + */ +public class GrpcRequest { + + /** + * 请求对应的 streamId + */ + private Integer streamId; + + /** + * 请求的 service + */ + private String service; + + /** + * 请求的 method + */ + private String method; + + /** + * 二进制数据,可能包含多个 grpc body,每个 body 都带有 5 个 byte 的前缀,分别是 boolean compressed - int length + */ + private ByteBuf byteData; + + /** + * 二进制数据的长度 + */ + private int length; + + /** + * 请求class + */ + private Class clazz; + + /** + * 是否是 grpc 流式请求 + */ + private boolean stream; + + /** + * 是否是 grpc 流式请求的第一个data + */ + private boolean streamFirstData; + + /** + * http2 headers + */ + private Http2Headers headers; + + /** + * grpc 调用类型 + */ + private GrpcInvokeTypeEnum grpcType; + + + public GrpcRequest(Integer streamId, String path, String method) { + this.streamId = streamId; + this.service = path; + this.method = method; + this.byteData = ByteUtil.newByteBuf(); + } + + public void writeData(ByteBuf byteBuf) { + byte[] bytes = ByteUtil.getBytes(byteBuf); + if (bytes.length == 0) { + return; + } + byte[] decompressedData = decompressGzip(bytes); + if (decompressedData == null) { + return; + } + byteData.writeBytes(ByteUtil.newByteBuf(decompressedData)); + } + + /** + * 读取部分数据 + * + * @return + */ + public synchronized byte[] readData() { + if (byteData.readableBytes() == 0) { + return null; + } + boolean compressed = byteData.readBoolean(); + int length = byteData.readInt(); + byte[] bytes = new byte[length]; + byteData.readBytes(bytes); + return bytes; + } + + public void clearData() { + byteData.clear(); + } + + private byte[] decompressGzip(byte[] compressedData) { + boolean isGzip = (compressedData.length > 2 && (compressedData[0] & 0xff) == 0x1f && (compressedData[1] & 0xff) == 0x8b); + if (isGzip) { + try (InputStream byteStream = new ByteArrayInputStream(compressedData); + GZIPInputStream gzipStream = new GZIPInputStream(byteStream); + ByteArrayOutputStream out = new ByteArrayOutputStream()) { + + byte[] buffer = new byte[1024]; + int len; + while ((len = gzipStream.read(buffer)) != -1) { + out.write(buffer, 0, len); + } + return out.toByteArray(); + } catch (IOException e) { + System.err.println("Failed to decompress GZIP data: " + e.getMessage()); + // Optionally rethrow the exception or return an Optional + return null; // or throw new RuntimeException(e); + } + } else { + return compressedData; + } + } + + public String getGrpcMethodKey() { + return service + "." + method; + } + + public Integer getStreamId() { + return streamId; + } + + public String getService() { + return service; + } + + public String getMethod() { + return method; + } + + public ByteBuf getByteData() { + return byteData; + } + + public Class getClazz() { + return clazz; + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public boolean isStream() { + return stream; + } + + public void setStream(boolean stream) { + this.stream = stream; + } + + public boolean isStreamFirstData() { + return streamFirstData; + } + + public void setStreamFirstData(boolean streamFirstData) { + this.streamFirstData = streamFirstData; + } + + public Http2Headers getHeaders() { + return headers; + } + + public void setHeaders(Http2Headers headers) { + this.headers = headers; + } + + public GrpcInvokeTypeEnum getGrpcType() { + return grpcType; + } + + public void setGrpcType(GrpcInvokeTypeEnum grpcType) { + this.grpcType = grpcType; + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcResponse.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcResponse.java new file mode 100644 index 00000000000..a275dd01444 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/GrpcResponse.java @@ -0,0 +1,114 @@ +package com.taobao.arthas.grpc.server.handler; + + +import arthas.grpc.common.ArthasGrpc; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcMethod; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcService; +import com.taobao.arthas.grpc.server.utils.ByteUtil; +import io.netty.buffer.ByteBuf; +import io.netty.handler.codec.http2.DefaultHttp2Headers; +import io.netty.handler.codec.http2.Http2Headers; + +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + +/** + * @author: FengYe + * @date: 2024/9/5 02:05 + * @description: GrpcResponse + */ +public class GrpcResponse { + + private Map headers; + + /** + * 请求的 service + */ + private String service; + + /** + * 请求的 method + */ + private String method; + + /** + * 二进制数据 + */ + private ByteBuf byteData; + + /** + * 响应class + */ + private Class clazz; + + { + headers = new HashMap<>(); + headers.put("content-type", "application/grpc"); + headers.put("grpc-encoding", "identity"); + headers.put("grpc-accept-encoding", "identity,deflate,gzip"); + } + + public GrpcResponse() { + } + + public GrpcResponse(Method method) { + this.service = method.getDeclaringClass().getAnnotation(GrpcService.class).value(); + this.method = method.getAnnotation(GrpcMethod.class).value(); + } + + public Http2Headers getEndHeader() { + Http2Headers endHeader = new DefaultHttp2Headers().status("200"); + headers.forEach(endHeader::set); + return endHeader; + } + + public Http2Headers getEndStreamHeader() { + return new DefaultHttp2Headers().set("grpc-status", "0"); + } + + public static Http2Headers getDefaultEndStreamHeader() { + return new DefaultHttp2Headers().set("grpc-status", "0"); + } + + public ByteBuf getResponseData() { + return byteData; + } + + public void writeResponseData(Object response) { + byte[] encode = null; + try { + if (ArthasGrpc.ErrorRes.class.equals(clazz)) { + encode = ((ArthasGrpc.ErrorRes) response).toByteArray(); + } else { + encode = (byte[]) GrpcDispatcher.responseToByteArrayMap.get(GrpcDispatcher.generateGrpcMethodKey(service, method)).invoke(response); + } + } catch (Throwable e) { + throw new RuntimeException(e); + } + this.byteData = ByteUtil.newByteBuf(); + this.byteData.writeBoolean(false); + this.byteData.writeInt(encode.length); + this.byteData.writeBytes(encode); + } + + public void setClazz(Class clazz) { + this.clazz = clazz; + } + + public String getService() { + return service; + } + + public void setService(String service) { + this.service = service; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/Http2FrameRequest.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/Http2FrameRequest.java new file mode 100644 index 00000000000..1e8058dcceb --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/Http2FrameRequest.java @@ -0,0 +1,16 @@ +package com.taobao.arthas.grpc.server.handler; + +import java.util.List; + +/** + * @author: FengYe + * @date: 2024/9/18 23:12 + * @description: 一个 http2 的 frame 中可能存在多个 grpc 的请求体 + */ +public class Http2FrameRequest { + + /** + * grpc 请求体 + */ + private List grpcRequests; +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/Http2Handler.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/Http2Handler.java new file mode 100644 index 00000000000..d0068b213f5 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/Http2Handler.java @@ -0,0 +1,113 @@ +package com.taobao.arthas.grpc.server.handler; + + +import arthas.grpc.common.ArthasGrpc; +import com.alibaba.arthas.deps.org.slf4j.Logger; +import com.alibaba.arthas.deps.org.slf4j.LoggerFactory; +import com.taobao.arthas.grpc.server.handler.executor.GrpcExecutorFactory; +import io.netty.buffer.ByteBuf; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.handler.codec.http2.*; +import io.netty.util.concurrent.EventExecutorGroup; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.Optional; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author: FengYe + * @date: 2024/7/7 下午9:58 + * @description: Http2Handler + */ +public class Http2Handler extends SimpleChannelInboundHandler { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass().getName()); + + private GrpcDispatcher grpcDispatcher; + + private GrpcExecutorFactory grpcExecutorFactory; + + private final EventExecutorGroup executorGroup = new NioEventLoopGroup(); + + /** + * 暂存收到的所有请求的数据 + */ + private ConcurrentHashMap dataBuffer = new ConcurrentHashMap<>(); + + private static final String HEADER_PATH = ":path"; + + public Http2Handler(GrpcDispatcher grpcDispatcher, GrpcExecutorFactory grpcExecutorFactory) { + this.grpcDispatcher = grpcDispatcher; + this.grpcExecutorFactory = grpcExecutorFactory; + } + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + super.channelRead(ctx, msg); + } + + @Override + protected void channelRead0(ChannelHandlerContext ctx, Http2Frame frame) throws IOException { + if (frame instanceof Http2HeadersFrame) { + handleGrpcRequest((Http2HeadersFrame) frame, ctx); + } else if (frame instanceof Http2DataFrame) { + handleGrpcData((Http2DataFrame) frame, ctx); + } else if (frame instanceof Http2ResetFrame) { + handleResetStream((Http2ResetFrame) frame, ctx); + } + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + cause.printStackTrace(); + ctx.close(); + } + + private void handleGrpcRequest(Http2HeadersFrame headersFrame, ChannelHandlerContext ctx) { + int id = headersFrame.stream().id(); + String path = headersFrame.headers().get(HEADER_PATH).toString(); + // 去掉前面的斜杠,然后按斜杠分割 + String[] parts = path.substring(1).split("/"); + GrpcRequest grpcRequest = new GrpcRequest(headersFrame.stream().id(), parts[0], parts[1]); + grpcRequest.setHeaders(headersFrame.headers()); + GrpcDispatcher.checkGrpcType(grpcRequest); + dataBuffer.put(id, grpcRequest); + System.out.println("Received headers: " + headersFrame.headers()); + } + + private void handleGrpcData(Http2DataFrame dataFrame, ChannelHandlerContext ctx) throws IOException { + int streamId = dataFrame.stream().id(); + GrpcRequest grpcRequest = dataBuffer.get(streamId); + ByteBuf content = dataFrame.content(); + grpcRequest.writeData(content); + + executorGroup.execute(() -> { + try { + grpcExecutorFactory.getExecutor(grpcRequest.getGrpcType()).execute(grpcRequest, dataFrame, ctx); + } catch (Throwable e) { + logger.error("handleGrpcData error", e); + processError(ctx, e, dataFrame.stream()); + } + }); + } + + private void handleResetStream(Http2ResetFrame resetFrame, ChannelHandlerContext ctx) { + int id = resetFrame.stream().id(); + System.out.println("handleResetStream"); + dataBuffer.remove(id); + } + + private void processError(ChannelHandlerContext ctx, Throwable e, Http2FrameStream stream) { + GrpcResponse response = new GrpcResponse(); + ArthasGrpc.ErrorRes.Builder builder = ArthasGrpc.ErrorRes.newBuilder(); + ArthasGrpc.ErrorRes errorRes = builder.setErrorMsg(Optional.ofNullable(e.getMessage()).orElse("")).build(); + response.setClazz(ArthasGrpc.ErrorRes.class); + response.writeResponseData(errorRes); + ctx.writeAndFlush(new DefaultHttp2HeadersFrame(response.getEndHeader()).stream(stream)); + ctx.writeAndFlush(new DefaultHttp2DataFrame(response.getResponseData()).stream(stream)); + ctx.writeAndFlush(new DefaultHttp2HeadersFrame(response.getEndStreamHeader(), true).stream(stream)); + } +} \ No newline at end of file diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/StreamObserver.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/StreamObserver.java new file mode 100644 index 00000000000..570661ee3bc --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/StreamObserver.java @@ -0,0 +1,13 @@ +package com.taobao.arthas.grpc.server.handler; + +/** + * @author: FengYe + * @date: 2024/10/24 00:22 + * @description: StreamObserver + */ +public interface StreamObserver { + + void onNext(V req); + + void onCompleted(); +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/annotation/GrpcMethod.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/annotation/GrpcMethod.java new file mode 100644 index 00000000000..dec0e2bef06 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/annotation/GrpcMethod.java @@ -0,0 +1,23 @@ +package com.taobao.arthas.grpc.server.handler.annotation; + +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author: FengYe + * @date: 2024/9/6 01:57 + * @description: GrpcMethod + */ +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface GrpcMethod { + String value() default ""; + + boolean stream() default false; + + GrpcInvokeTypeEnum grpcType() default GrpcInvokeTypeEnum.UNARY; +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/annotation/GrpcService.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/annotation/GrpcService.java new file mode 100644 index 00000000000..c54dc7d624b --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/annotation/GrpcService.java @@ -0,0 +1,17 @@ +package com.taobao.arthas.grpc.server.handler.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author: FengYe + * @date: 2024/9/6 01:57 + * @description: GrpcService + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface GrpcService { + String value() default ""; +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/constant/GrpcInvokeTypeEnum.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/constant/GrpcInvokeTypeEnum.java new file mode 100644 index 00000000000..46fb252b154 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/constant/GrpcInvokeTypeEnum.java @@ -0,0 +1,13 @@ +package com.taobao.arthas.grpc.server.handler.constant; + +/** + * @author: FengYe + * @date: 2024/10/24 01:06 + * @description: StreamTypeEnum + */ +public enum GrpcInvokeTypeEnum { + UNARY, + SERVER_STREAM, + CLIENT_STREAM, + BI_STREAM; +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/AbstractGrpcExecutor.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/AbstractGrpcExecutor.java new file mode 100644 index 00000000000..d814749dd38 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/AbstractGrpcExecutor.java @@ -0,0 +1,22 @@ +package com.taobao.arthas.grpc.server.handler.executor; + +import com.taobao.arthas.grpc.server.handler.GrpcDispatcher; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.StreamObserver; + +import java.util.concurrent.ConcurrentHashMap; + +/** + * @author: FengYe + * @date: 2024/10/24 02:07 + * @description: AbstractGrpcExecutor + */ +public abstract class AbstractGrpcExecutor implements GrpcExecutor{ + protected GrpcDispatcher dispatcher; + + protected ConcurrentHashMap> requestStreamObserverMap = new ConcurrentHashMap<>(); + + public AbstractGrpcExecutor(GrpcDispatcher dispatcher) { + this.dispatcher = dispatcher; + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/BiStreamExecutor.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/BiStreamExecutor.java new file mode 100644 index 00000000000..1291463997e --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/BiStreamExecutor.java @@ -0,0 +1,66 @@ +package com.taobao.arthas.grpc.server.handler.executor; + +import com.taobao.arthas.grpc.server.handler.GrpcDispatcher; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.StreamObserver; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http2.DefaultHttp2DataFrame; +import io.netty.handler.codec.http2.DefaultHttp2HeadersFrame; +import io.netty.handler.codec.http2.Http2DataFrame; + +import java.util.concurrent.atomic.AtomicBoolean; + +/** + * @author: FengYe + * @date: 2024/10/24 01:52 + * @description: BiStreamProcessor + */ +public class BiStreamExecutor extends AbstractGrpcExecutor { + + public BiStreamExecutor(GrpcDispatcher dispatcher) { + super(dispatcher); + } + + @Override + public GrpcInvokeTypeEnum supportGrpcType() { + return GrpcInvokeTypeEnum.BI_STREAM; + } + + @Override + public void execute(GrpcRequest request, Http2DataFrame frame, ChannelHandlerContext context) throws Throwable { + Integer streamId = request.getStreamId(); + + StreamObserver requestObserver = requestStreamObserverMap.computeIfAbsent(streamId, id->{ + StreamObserver responseObserver = new StreamObserver() { + AtomicBoolean sendHeader = new AtomicBoolean(false); + + @Override + public void onNext(GrpcResponse res) { + // 控制流只能响应一次header + if (!sendHeader.get()) { + sendHeader.compareAndSet(false, true); + context.writeAndFlush(new DefaultHttp2HeadersFrame(res.getEndHeader()).stream(frame.stream())); + } + context.writeAndFlush(new DefaultHttp2DataFrame(res.getResponseData()).stream(frame.stream())); + } + + @Override + public void onCompleted() { + context.writeAndFlush(new DefaultHttp2HeadersFrame(GrpcResponse.getDefaultEndStreamHeader(), true).stream(frame.stream())); + } + }; + try { + return dispatcher.biStreamExecute(request, responseObserver); + } catch (Throwable e) { + throw new RuntimeException(e); + } + }); + + requestObserver.onNext(request); + if (frame.isEndStream()) { + requestObserver.onCompleted(); + } + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/ClientStreamExecutor.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/ClientStreamExecutor.java new file mode 100644 index 00000000000..d58547928a8 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/ClientStreamExecutor.java @@ -0,0 +1,66 @@ +package com.taobao.arthas.grpc.server.handler.executor; + +import com.taobao.arthas.grpc.server.handler.GrpcDispatcher; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.StreamObserver; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http2.DefaultHttp2DataFrame; +import io.netty.handler.codec.http2.DefaultHttp2HeadersFrame; +import io.netty.handler.codec.http2.Http2DataFrame; + +import java.util.concurrent.atomic.AtomicBoolean; + +/** + * @author: FengYe + * @date: 2024/10/24 01:51 + * @description: UnaryProcessor + */ +public class ClientStreamExecutor extends AbstractGrpcExecutor { + + public ClientStreamExecutor(GrpcDispatcher dispatcher) { + super(dispatcher); + } + + @Override + public GrpcInvokeTypeEnum supportGrpcType() { + return GrpcInvokeTypeEnum.CLIENT_STREAM; + } + + @Override + public void execute(GrpcRequest request, Http2DataFrame frame, ChannelHandlerContext context) throws Throwable { + Integer streamId = request.getStreamId(); + + StreamObserver requestObserver = requestStreamObserverMap.computeIfAbsent(streamId, id->{ + StreamObserver responseObserver = new StreamObserver() { + AtomicBoolean sendHeader = new AtomicBoolean(false); + + @Override + public void onNext(GrpcResponse res) { + // 控制流只能响应一次header + if (!sendHeader.get()) { + sendHeader.compareAndSet(false, true); + context.writeAndFlush(new DefaultHttp2HeadersFrame(res.getEndHeader()).stream(frame.stream())); + } + context.writeAndFlush(new DefaultHttp2DataFrame(res.getResponseData()).stream(frame.stream())); + } + + @Override + public void onCompleted() { + context.writeAndFlush(new DefaultHttp2HeadersFrame(GrpcResponse.getDefaultEndStreamHeader(), true).stream(frame.stream())); + } + }; + try { + return dispatcher.clientStreamExecute(request, responseObserver); + } catch (Throwable e) { + throw new RuntimeException(e); + } + }); + + requestObserver.onNext(request); + if (frame.isEndStream()) { + requestObserver.onCompleted(); + } + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/GrpcExecutor.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/GrpcExecutor.java new file mode 100644 index 00000000000..6f1fa7f00bf --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/GrpcExecutor.java @@ -0,0 +1,17 @@ +package com.taobao.arthas.grpc.server.handler.executor; + +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http2.Http2DataFrame; + +/** + * @author: FengYe + * @date: 2024/10/24 01:50 + * @description: GrpcProcessor + */ +public interface GrpcExecutor { + GrpcInvokeTypeEnum supportGrpcType(); + + void execute(GrpcRequest request, Http2DataFrame frame, ChannelHandlerContext context) throws Throwable; +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/GrpcExecutorFactory.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/GrpcExecutorFactory.java new file mode 100644 index 00000000000..c102a257643 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/GrpcExecutorFactory.java @@ -0,0 +1,55 @@ +package com.taobao.arthas.grpc.server.handler.executor; + +import com.alibaba.arthas.deps.org.slf4j.Logger; +import com.alibaba.arthas.deps.org.slf4j.LoggerFactory; +import com.taobao.arthas.grpc.server.handler.GrpcDispatcher; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import com.taobao.arthas.grpc.server.utils.ReflectUtil; + +import java.lang.invoke.MethodHandles; +import java.lang.reflect.Constructor; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author: FengYe + * @date: 2024/10/24 01:56 + * @description: GrpcExecutorFactory + */ +public class GrpcExecutorFactory { + + private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass().getName()); + + public static final String DEFAULT_GRPC_EXECUTOR_PACKAGE_NAME = "com.taobao.arthas.grpc.server.handler.executor"; + + private final Map map = new HashMap<>(); + + public void loadExecutor(GrpcDispatcher dispatcher) { + List> classes = ReflectUtil.findClasses(DEFAULT_GRPC_EXECUTOR_PACKAGE_NAME); + for (Class clazz : classes) { + if (GrpcExecutor.class.isAssignableFrom(clazz)) { + try { + if (AbstractGrpcExecutor.class.equals(clazz) || GrpcExecutor.class.equals(clazz)) { + continue; + } + if (AbstractGrpcExecutor.class.isAssignableFrom(clazz)) { + Constructor constructor = clazz.getConstructor(GrpcDispatcher.class); + GrpcExecutor executor = (GrpcExecutor) constructor.newInstance(dispatcher); + map.put(executor.supportGrpcType(), executor); + } else { + Constructor constructor = clazz.getConstructor(); + GrpcExecutor executor = (GrpcExecutor) constructor.newInstance(); + map.put(executor.supportGrpcType(), executor); + } + } catch (Exception e) { + logger.error("GrpcExecutorFactory loadExecutor error", e); + } + } + } + } + + public GrpcExecutor getExecutor(GrpcInvokeTypeEnum grpcType) { + return map.get(grpcType); + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/ServerStreamExecutor.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/ServerStreamExecutor.java new file mode 100644 index 00000000000..5192fa41dea --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/ServerStreamExecutor.java @@ -0,0 +1,57 @@ +package com.taobao.arthas.grpc.server.handler.executor; + +import com.taobao.arthas.grpc.server.handler.GrpcDispatcher; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.StreamObserver; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http2.DefaultHttp2DataFrame; +import io.netty.handler.codec.http2.DefaultHttp2HeadersFrame; +import io.netty.handler.codec.http2.Http2DataFrame; + +import java.util.concurrent.atomic.AtomicBoolean; + +/** + * @author: FengYe + * @date: 2024/10/24 01:51 + * @description: UnaryProcessor + */ +public class ServerStreamExecutor extends AbstractGrpcExecutor { + + public ServerStreamExecutor(GrpcDispatcher dispatcher) { + super(dispatcher); + } + + @Override + public GrpcInvokeTypeEnum supportGrpcType() { + return GrpcInvokeTypeEnum.SERVER_STREAM; + } + + @Override + public void execute(GrpcRequest request, Http2DataFrame frame, ChannelHandlerContext context) throws Throwable { + StreamObserver responseObserver = new StreamObserver() { + AtomicBoolean sendHeader = new AtomicBoolean(false); + + @Override + public void onNext(GrpcResponse res) { + // 控制流只能响应一次header + if (!sendHeader.get()) { + sendHeader.compareAndSet(false, true); + context.writeAndFlush(new DefaultHttp2HeadersFrame(res.getEndHeader()).stream(frame.stream())); + } + context.writeAndFlush(new DefaultHttp2DataFrame(res.getResponseData()).stream(frame.stream())); + } + + @Override + public void onCompleted() { + context.writeAndFlush(new DefaultHttp2HeadersFrame(GrpcResponse.getDefaultEndStreamHeader(), true).stream(frame.stream())); + } + }; + try { + dispatcher.serverStreamExecute(request, responseObserver); + } catch (Throwable e) { + throw new RuntimeException(e); + } + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/UnaryExecutor.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/UnaryExecutor.java new file mode 100644 index 00000000000..0995bd3f898 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/handler/executor/UnaryExecutor.java @@ -0,0 +1,38 @@ +package com.taobao.arthas.grpc.server.handler.executor; + +import com.taobao.arthas.grpc.server.handler.GrpcDispatcher; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http2.DefaultHttp2DataFrame; +import io.netty.handler.codec.http2.DefaultHttp2HeadersFrame; +import io.netty.handler.codec.http2.Http2DataFrame; + +/** + * @author: FengYe + * @date: 2024/10/24 01:51 + * @description: UnaryProcessor + */ +public class UnaryExecutor extends AbstractGrpcExecutor { + + public UnaryExecutor(GrpcDispatcher dispatcher) { + super(dispatcher); + } + + @Override + public GrpcInvokeTypeEnum supportGrpcType() { + return GrpcInvokeTypeEnum.UNARY; + } + + @Override + public void execute(GrpcRequest request, Http2DataFrame frame, ChannelHandlerContext context) throws Throwable { + // 一元调用,等到 endStream 再响应 + if (frame.isEndStream()) { + GrpcResponse response = dispatcher.unaryExecute(request); + context.writeAndFlush(new DefaultHttp2HeadersFrame(response.getEndHeader()).stream(frame.stream())); + context.writeAndFlush(new DefaultHttp2DataFrame(response.getResponseData()).stream(frame.stream())); + context.writeAndFlush(new DefaultHttp2HeadersFrame(response.getEndStreamHeader(), true).stream(frame.stream())); + } + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/service/ArthasSampleService.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/service/ArthasSampleService.java new file mode 100644 index 00000000000..f0098f93c51 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/service/ArthasSampleService.java @@ -0,0 +1,26 @@ +package com.taobao.arthas.grpc.server.service; + +import arthas.grpc.unittest.ArthasUnittest; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.StreamObserver; + + +/** + * @author: FengYe + * @date: 2024/6/30 下午11:42 + * @description: ArthasSampleService + */ +public interface ArthasSampleService { + ArthasUnittest.ArthasUnittestResponse unary(ArthasUnittest.ArthasUnittestRequest command); + + ArthasUnittest.ArthasUnittestResponse unaryAddSum(ArthasUnittest.ArthasUnittestRequest command); + + ArthasUnittest.ArthasUnittestResponse unaryGetSum(ArthasUnittest.ArthasUnittestRequest command); + + StreamObserver> clientStreamSum(StreamObserver> observer); + + void serverStream(ArthasUnittest.ArthasUnittestRequest request, StreamObserver> observer); + + StreamObserver> biStream(StreamObserver> observer); +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/service/impl/ArthasSampleServiceImpl.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/service/impl/ArthasSampleServiceImpl.java new file mode 100644 index 00000000000..a3961cb31b4 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/service/impl/ArthasSampleServiceImpl.java @@ -0,0 +1,133 @@ +package com.taobao.arthas.grpc.server.service.impl; + +import arthas.grpc.unittest.ArthasUnittest; +import com.google.protobuf.InvalidProtocolBufferException; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.StreamObserver; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcMethod; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcService; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import com.taobao.arthas.grpc.server.service.ArthasSampleService; +import com.taobao.arthas.grpc.server.utils.ByteUtil; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author: FengYe + * @date: 2024/6/30 下午11:43 + * @description: ArthasSampleServiceImpl + */ +@GrpcService("arthas.grpc.unittest.ArthasUnittestService") +public class ArthasSampleServiceImpl implements ArthasSampleService { + + private ConcurrentHashMap map = new ConcurrentHashMap<>(); + + @Override + @GrpcMethod(value = "unary") + public ArthasUnittest.ArthasUnittestResponse unary(ArthasUnittest.ArthasUnittestRequest command) { + ArthasUnittest.ArthasUnittestResponse.Builder builder = ArthasUnittest.ArthasUnittestResponse.newBuilder(); + builder.setMessage(command.getMessage()); + return builder.build(); + } + + @Override + @GrpcMethod(value = "unaryAddSum") + public ArthasUnittest.ArthasUnittestResponse unaryAddSum(ArthasUnittest.ArthasUnittestRequest command) { + ArthasUnittest.ArthasUnittestResponse.Builder builder = ArthasUnittest.ArthasUnittestResponse.newBuilder(); + builder.setMessage(command.getMessage()); + map.merge(command.getId(), command.getNum(), Integer::sum); + return builder.build(); + } + + @Override + @GrpcMethod(value = "unaryGetSum") + public ArthasUnittest.ArthasUnittestResponse unaryGetSum(ArthasUnittest.ArthasUnittestRequest command) { + ArthasUnittest.ArthasUnittestResponse.Builder builder = ArthasUnittest.ArthasUnittestResponse.newBuilder(); + builder.setMessage(command.getMessage()); + Integer sum = map.getOrDefault(command.getId(), 0); + builder.setNum(sum); + return builder.build(); + } + + @Override + @GrpcMethod(value = "clientStreamSum", grpcType = GrpcInvokeTypeEnum.CLIENT_STREAM) + public StreamObserver> clientStreamSum(StreamObserver> observer) { + return new StreamObserver>() { + AtomicInteger sum = new AtomicInteger(0); + + @Override + public void onNext(GrpcRequest req) { + try { + byte[] bytes = req.readData(); + while (bytes != null && bytes.length != 0) { + ArthasUnittest.ArthasUnittestRequest request = ArthasUnittest.ArthasUnittestRequest.parseFrom(bytes); + sum.addAndGet(request.getNum()); + bytes = req.readData(); + } + } catch (InvalidProtocolBufferException e) { + throw new RuntimeException(e); + } + } + + @Override + public void onCompleted() { + ArthasUnittest.ArthasUnittestResponse response = ArthasUnittest.ArthasUnittestResponse.newBuilder() + .setNum(sum.get()) + .build(); + GrpcResponse grpcResponse = new GrpcResponse<>(); + grpcResponse.setService("arthas.grpc.unittest.ArthasUnittestService"); + grpcResponse.setMethod("clientStreamSum"); + grpcResponse.writeResponseData(response); + observer.onNext(grpcResponse); + observer.onCompleted(); + } + }; + } + + @Override + @GrpcMethod(value = "serverStream", grpcType = GrpcInvokeTypeEnum.SERVER_STREAM) + public void serverStream(ArthasUnittest.ArthasUnittestRequest request, StreamObserver> observer) { + + for (int i = 0; i < 5; i++) { + ArthasUnittest.ArthasUnittestResponse response = ArthasUnittest.ArthasUnittestResponse.newBuilder() + .setMessage("Server response " + i + " to " + request.getMessage()) + .build(); + GrpcResponse grpcResponse = new GrpcResponse<>(); + grpcResponse.setService("arthas.grpc.unittest.ArthasUnittestService"); + grpcResponse.setMethod("serverStream"); + grpcResponse.writeResponseData(response); + observer.onNext(grpcResponse); + } + observer.onCompleted(); + } + + @Override + @GrpcMethod(value = "biStream", grpcType = GrpcInvokeTypeEnum.BI_STREAM) + public StreamObserver> biStream(StreamObserver> observer) { + return new StreamObserver>() { + @Override + public void onNext(GrpcRequest req) { + try { + byte[] bytes = req.readData(); + while (bytes != null && bytes.length != 0) { + GrpcResponse grpcResponse = new GrpcResponse<>(); + grpcResponse.setService("arthas.grpc.unittest.ArthasUnittestService"); + grpcResponse.setMethod("biStream"); + grpcResponse.writeResponseData(ArthasUnittest.ArthasUnittestResponse.parseFrom(bytes)); + observer.onNext(grpcResponse); + bytes = req.readData(); + } + } catch (InvalidProtocolBufferException e) { + throw new RuntimeException(e); + } + } + + @Override + public void onCompleted() { + observer.onCompleted(); + } + }; + } +} \ No newline at end of file diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/utils/ByteUtil.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/utils/ByteUtil.java new file mode 100644 index 00000000000..2bd239521de --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/utils/ByteUtil.java @@ -0,0 +1,33 @@ +package com.taobao.arthas.grpc.server.utils; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.PooledByteBufAllocator; + +/** + * @author: FengYe + * @date: 2024/9/5 00:51 + * @description: ByteUtil + */ +public class ByteUtil { + + public static ByteBuf newByteBuf() { + return PooledByteBufAllocator.DEFAULT.buffer(); + } + + public static ByteBuf newByteBuf(byte[] bytes) { + return PooledByteBufAllocator.DEFAULT.buffer(bytes.length).writeBytes(bytes); + } + + public static byte[] getBytes(ByteBuf buf) { + if (buf.hasArray()) { + // 如果 ByteBuf 是一个支持底层数组的实现,直接获取数组 + return buf.array(); + } else { + // 创建一个新的 byte 数组 + byte[] bytes = new byte[buf.readableBytes()]; + // 将 ByteBuf 的内容复制到 byte 数组中 + buf.getBytes(buf.readerIndex(), bytes); + return bytes; + } + } +} diff --git a/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/utils/ReflectUtil.java b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/utils/ReflectUtil.java new file mode 100644 index 00000000000..c6e3e053ed5 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/java/com/taobao/arthas/grpc/server/utils/ReflectUtil.java @@ -0,0 +1,35 @@ +package com.taobao.arthas.grpc.server.utils; + +import java.io.File; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; + +/** + * @author: FengYe + * @date: 2024/9/6 02:20 + * @description: ReflectUtil + */ +public class ReflectUtil { + public static List> findClasses(String packageName) { + List> classes = new ArrayList<>(); + String path = packageName.replace('.', '/'); + try { + URL resource = Thread.currentThread().getContextClassLoader().getResource(path); + if (resource != null) { + File directory = new File(resource.toURI()); + if (directory.exists()) { + for (File file : directory.listFiles()) { + if (file.isFile() && file.getName().endsWith(".class")) { + String className = packageName + '.' + file.getName().replace(".class", ""); + classes.add(Class.forName(className)); + } + } + } + } + } catch (Exception e) { + + } + return classes; + } +} diff --git a/labs/arthas-grpc-server/src/main/proto/arthasGrpc.proto b/labs/arthas-grpc-server/src/main/proto/arthasGrpc.proto new file mode 100644 index 00000000000..103bb9b4c41 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/proto/arthasGrpc.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package arthas.grpc.common; + +message ErrorRes { + string errorMsg = 1; +} \ No newline at end of file diff --git a/labs/arthas-grpc-server/src/main/proto/arthasUnittest.proto b/labs/arthas-grpc-server/src/main/proto/arthasUnittest.proto new file mode 100644 index 00000000000..6b925dcce91 --- /dev/null +++ b/labs/arthas-grpc-server/src/main/proto/arthasUnittest.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package arthas.grpc.unittest; + +service ArthasUnittestService { + rpc unary(ArthasUnittestRequest) returns (ArthasUnittestResponse); + rpc unaryAddSum(ArthasUnittestRequest) returns (ArthasUnittestResponse); + rpc unaryGetSum(ArthasUnittestRequest) returns (ArthasUnittestResponse); + rpc clientStreamSum(stream ArthasUnittestRequest) returns (ArthasUnittestResponse); + rpc serverStream(ArthasUnittestRequest) returns (stream ArthasUnittestResponse); + rpc biStream(stream ArthasUnittestRequest) returns (stream ArthasUnittestResponse); +} + +message ArthasUnittestRequest { + int32 id = 1; + string message = 2; + int32 num = 3; +} + +message ArthasUnittestResponse{ + int32 id = 1; + string message = 2; + int32 num = 3; +} diff --git a/labs/arthas-grpc-server/src/test/java/unittest/grpc/GrpcTest.java b/labs/arthas-grpc-server/src/test/java/unittest/grpc/GrpcTest.java new file mode 100644 index 00000000000..5af03515d12 --- /dev/null +++ b/labs/arthas-grpc-server/src/test/java/unittest/grpc/GrpcTest.java @@ -0,0 +1,276 @@ +package unittest.grpc; + +import arthas.grpc.unittest.ArthasUnittest; +import arthas.grpc.unittest.ArthasUnittestServiceGrpc; +import ch.qos.logback.classic.Level; +import ch.qos.logback.classic.Logger; +import ch.qos.logback.classic.LoggerContext; +import com.taobao.arthas.grpc.server.ArthasGrpcServer; +import io.grpc.ManagedChannel; +import io.grpc.ManagedChannelBuilder; +import io.grpc.stub.StreamObserver; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.slf4j.LoggerFactory; + +import java.lang.invoke.MethodHandles; +import java.util.Random; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author: FengYe + * @date: 2024/9/24 00:17 + * @description: GrpcUnaryTest + */ +public class GrpcTest { + private static final String HOST = "localhost"; + private static final int PORT = 9092; + private static final String HOST_PORT = HOST + ":" + PORT; + private static final String UNIT_TEST_GRPC_SERVICE_PACKAGE_NAME = "unittest.grpc.service.impl"; + private static final Logger log = (Logger) LoggerFactory.getLogger(GrpcTest.class); + private ManagedChannel clientChannel; + Random random = new Random(); + ExecutorService threadPool = Executors.newFixedThreadPool(10); + + + @Before + public void startServer() { + LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); + Logger rootLogger = loggerContext.getLogger("ROOT"); + + rootLogger.setLevel(Level.INFO); + + Thread grpcWebProxyStart = new Thread(() -> { + ArthasGrpcServer arthasGrpcServer = new ArthasGrpcServer(PORT, UNIT_TEST_GRPC_SERVICE_PACKAGE_NAME); + arthasGrpcServer.start(); + }); + grpcWebProxyStart.start(); + + clientChannel = ManagedChannelBuilder.forTarget(HOST_PORT) + .usePlaintext() + .build(); + } + + @Test + public void testUnary() { + log.info("testUnary start!"); + + + ArthasUnittestServiceGrpc.ArthasUnittestServiceBlockingStub stub = ArthasUnittestServiceGrpc.newBlockingStub(clientChannel); + + try { + ArthasUnittest.ArthasUnittestRequest request = ArthasUnittest.ArthasUnittestRequest.newBuilder().setMessage("unaryInvoke").build(); + ArthasUnittest.ArthasUnittestResponse res = stub.unary(request); + System.out.println(res.getMessage()); + } finally { + clientChannel.shutdownNow(); + } + log.info("testUnary success!"); + } + + @Test + public void testUnarySum() throws InterruptedException { + log.info("testUnarySum start!"); + + ArthasUnittestServiceGrpc.ArthasUnittestServiceBlockingStub stub = ArthasUnittestServiceGrpc.newBlockingStub(clientChannel); + for (int i = 0; i < 10; i++) { + AtomicInteger sum = new AtomicInteger(0); + int finalId = i; + for (int j = 0; j < 10; j++) { + int num = random.nextInt(101); + sum.addAndGet(num); + threadPool.submit(() -> { + addSum(stub, finalId, num); + }); + } + Thread.sleep(2000L); + int grpcSum = getSum(stub, finalId); + System.out.println("id:" + finalId + ",sum:" + sum.get() + ",grpcSum:" + grpcSum); + Assert.assertEquals(sum.get(), grpcSum); + } + clientChannel.shutdown(); + log.info("testUnarySum success!"); + } + + // 用于测试客户端流 + @Test + public void testClientStreamSum() throws Throwable { + log.info("testClientStreamSum start!"); + + ArthasUnittestServiceGrpc.ArthasUnittestServiceStub stub = ArthasUnittestServiceGrpc.newStub(clientChannel); + + AtomicInteger sum = new AtomicInteger(0); + CountDownLatch latch = new CountDownLatch(1); + StreamObserver clientStreamObserver = stub.clientStreamSum(new StreamObserver() { + @Override + public void onNext(ArthasUnittest.ArthasUnittestResponse response) { + System.out.println("local sum:" + sum + ", grpc sum:" + response.getNum()); + Assert.assertEquals(sum.get(), response.getNum()); + } + + @Override + public void onError(Throwable t) { + System.err.println("Error: " + t); + } + + @Override + public void onCompleted() { + System.out.println("testClientStreamSum completed."); + latch.countDown(); + } + }); + + for (int j = 0; j < 100; j++) { + int num = random.nextInt(1001); + sum.addAndGet(num); + clientStreamObserver.onNext(ArthasUnittest.ArthasUnittestRequest.newBuilder().setNum(num).build()); + } + + clientStreamObserver.onCompleted(); + latch.await(20,TimeUnit.SECONDS); + clientChannel.shutdown(); + log.info("testClientStreamSum success!"); + } + + // 用于测试请求数据隔离性 + @Test + public void testDataIsolation() throws InterruptedException { + log.info("testDataIsolation start!"); + + ArthasUnittestServiceGrpc.ArthasUnittestServiceStub stub = ArthasUnittestServiceGrpc.newStub(clientChannel); + for (int i = 0; i < 10; i++) { + threadPool.submit(() -> { + AtomicInteger sum = new AtomicInteger(0); + CountDownLatch latch = new CountDownLatch(1); + StreamObserver clientStreamObserver = stub.clientStreamSum(new StreamObserver() { + @Override + public void onNext(ArthasUnittest.ArthasUnittestResponse response) { + System.out.println("local sum:" + sum + ", grpc sum:" + response.getNum()); + Assert.assertEquals(sum.get(), response.getNum()); + } + + @Override + public void onError(Throwable t) { + System.err.println("Error: " + t); + } + + @Override + public void onCompleted() { + System.out.println("testDataIsolation completed."); + latch.countDown(); + } + }); + + for (int j = 0; j < 5; j++) { + int num = random.nextInt(101); + try { + Thread.sleep(1000L); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + sum.addAndGet(num); + clientStreamObserver.onNext(ArthasUnittest.ArthasUnittestRequest.newBuilder().setNum(num).build()); + } + + clientStreamObserver.onCompleted(); + try { + latch.await(20,TimeUnit.SECONDS); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + clientChannel.shutdown(); + }); + } + Thread.sleep(10000L); + log.info("testDataIsolation success!"); + } + + @Test + public void testServerStream() throws InterruptedException { + log.info("testServerStream start!"); + + ArthasUnittestServiceGrpc.ArthasUnittestServiceStub stub = ArthasUnittestServiceGrpc.newStub(clientChannel); + + ArthasUnittest.ArthasUnittestRequest request = ArthasUnittest.ArthasUnittestRequest.newBuilder().setMessage("serverStream").build(); + + stub.serverStream(request, new StreamObserver() { + @Override + public void onNext(ArthasUnittest.ArthasUnittestResponse value) { + System.out.println("testServerStream client receive: " + value.getMessage()); + } + + @Override + public void onError(Throwable t) { + } + + @Override + public void onCompleted() { + System.out.println("testServerStream completed"); + } + }); + + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + clientChannel.shutdown(); + } + log.info("testServerStream success!"); + } + + // 用于测试双向流 + @Test + public void testBiStream() throws Throwable { + log.info("testBiStream start!"); + + ArthasUnittestServiceGrpc.ArthasUnittestServiceStub stub = ArthasUnittestServiceGrpc.newStub(clientChannel); + + CountDownLatch latch = new CountDownLatch(1); + StreamObserver biStreamObserver = stub.biStream(new StreamObserver() { + @Override + public void onNext(ArthasUnittest.ArthasUnittestResponse response) { + System.out.println("testBiStream receive: "+response.getMessage()); + } + + @Override + public void onError(Throwable t) { + System.err.println("Error: " + t); + } + + @Override + public void onCompleted() { + System.out.println("testBiStream completed."); + latch.countDown(); + } + }); + + String[] messages = new String[]{"testBiStream1","testBiStream2","testBiStream3"}; + for (String msg : messages) { + ArthasUnittest.ArthasUnittestRequest request = ArthasUnittest.ArthasUnittestRequest.newBuilder().setMessage(msg).build(); + biStreamObserver.onNext(request); + } + + Thread.sleep(2000); + biStreamObserver.onCompleted(); + latch.await(20, TimeUnit.SECONDS); + clientChannel.shutdown(); + log.info("testBiStream success!"); + } + + private void addSum(ArthasUnittestServiceGrpc.ArthasUnittestServiceBlockingStub stub, int id, int num) { + ArthasUnittest.ArthasUnittestRequest request = ArthasUnittest.ArthasUnittestRequest.newBuilder().setId(id).setNum(num).build(); + ArthasUnittest.ArthasUnittestResponse res = stub.unaryAddSum(request); + } + + private int getSum(ArthasUnittestServiceGrpc.ArthasUnittestServiceBlockingStub stub, int id) { + ArthasUnittest.ArthasUnittestRequest request = ArthasUnittest.ArthasUnittestRequest.newBuilder().setId(id).build(); + ArthasUnittest.ArthasUnittestResponse res = stub.unaryGetSum(request); + return res.getNum(); + } +} diff --git a/labs/arthas-grpc-server/src/test/java/unittest/grpc/service/ArthasUnittestService.java b/labs/arthas-grpc-server/src/test/java/unittest/grpc/service/ArthasUnittestService.java new file mode 100644 index 00000000000..6ba3081d21b --- /dev/null +++ b/labs/arthas-grpc-server/src/test/java/unittest/grpc/service/ArthasUnittestService.java @@ -0,0 +1,26 @@ +package unittest.grpc.service; + +import arthas.grpc.unittest.ArthasUnittest.ArthasUnittestRequest; +import arthas.grpc.unittest.ArthasUnittest.ArthasUnittestResponse; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.StreamObserver; + +/** + * @author: FengYe + * @date: 2024/6/30 下午11:42 + * @description: ArthasSampleService + */ +public interface ArthasUnittestService { + ArthasUnittestResponse unary(ArthasUnittestRequest command); + + ArthasUnittestResponse unaryAddSum(ArthasUnittestRequest command); + + ArthasUnittestResponse unaryGetSum(ArthasUnittestRequest command); + + StreamObserver> clientStreamSum(StreamObserver> observer); + + void serverStream(ArthasUnittestRequest request, StreamObserver> observer); + + StreamObserver> biStream(StreamObserver> observer); +} diff --git a/labs/arthas-grpc-server/src/test/java/unittest/grpc/service/impl/ArthasUnittestServiceImpl.java b/labs/arthas-grpc-server/src/test/java/unittest/grpc/service/impl/ArthasUnittestServiceImpl.java new file mode 100644 index 00000000000..aba8faff188 --- /dev/null +++ b/labs/arthas-grpc-server/src/test/java/unittest/grpc/service/impl/ArthasUnittestServiceImpl.java @@ -0,0 +1,134 @@ +package unittest.grpc.service.impl; + +import arthas.grpc.unittest.ArthasUnittest; +import arthas.grpc.unittest.ArthasUnittest.ArthasUnittestRequest; +import arthas.grpc.unittest.ArthasUnittest.ArthasUnittestResponse; +import com.google.protobuf.InvalidProtocolBufferException; +import com.taobao.arthas.grpc.server.handler.GrpcRequest; +import com.taobao.arthas.grpc.server.handler.GrpcResponse; +import com.taobao.arthas.grpc.server.handler.StreamObserver; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcMethod; +import com.taobao.arthas.grpc.server.handler.annotation.GrpcService; +import com.taobao.arthas.grpc.server.handler.constant.GrpcInvokeTypeEnum; +import unittest.grpc.service.ArthasUnittestService; + +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author: FengYe + * @date: 2024/6/30 下午11:43 + * @description: ArthasSampleServiceImpl + */ +@GrpcService("arthas.grpc.unittest.ArthasUnittestService") +public class ArthasUnittestServiceImpl implements ArthasUnittestService { + + private ConcurrentHashMap map = new ConcurrentHashMap<>(); + + @Override + @GrpcMethod(value = "unary") + public ArthasUnittestResponse unary(ArthasUnittestRequest command) { + ArthasUnittestResponse.Builder builder = ArthasUnittestResponse.newBuilder(); + builder.setMessage(command.getMessage()); + return builder.build(); + } + + @Override + @GrpcMethod(value = "unaryAddSum") + public ArthasUnittestResponse unaryAddSum(ArthasUnittestRequest command) { + ArthasUnittestResponse.Builder builder = ArthasUnittestResponse.newBuilder(); + builder.setMessage(command.getMessage()); + map.merge(command.getId(), command.getNum(), Integer::sum); + return builder.build(); + } + + @Override + @GrpcMethod(value = "unaryGetSum") + public ArthasUnittestResponse unaryGetSum(ArthasUnittestRequest command) { + ArthasUnittestResponse.Builder builder = ArthasUnittestResponse.newBuilder(); + builder.setMessage(command.getMessage()); + Integer sum = map.getOrDefault(command.getId(), 0); + builder.setNum(sum); + return builder.build(); + } + + @Override + @GrpcMethod(value = "clientStreamSum", grpcType = GrpcInvokeTypeEnum.CLIENT_STREAM) + public StreamObserver> clientStreamSum(StreamObserver> observer) { + return new StreamObserver>() { + AtomicInteger sum = new AtomicInteger(0); + + @Override + public void onNext(GrpcRequest req) { + try { + byte[] bytes = req.readData(); + while (bytes != null && bytes.length != 0) { + ArthasUnittestRequest request = ArthasUnittestRequest.parseFrom(bytes); + sum.addAndGet(request.getNum()); + bytes = req.readData(); + } + } catch (InvalidProtocolBufferException e) { + throw new RuntimeException(e); + } + } + + @Override + public void onCompleted() { + ArthasUnittestResponse response = ArthasUnittestResponse.newBuilder() + .setNum(sum.get()) + .build(); + GrpcResponse grpcResponse = new GrpcResponse<>(); + grpcResponse.setService("arthas.grpc.unittest.ArthasUnittestService"); + grpcResponse.setMethod("clientStreamSum"); + grpcResponse.writeResponseData(response); + observer.onNext(grpcResponse); + observer.onCompleted(); + } + }; + } + + @Override + @GrpcMethod(value = "serverStream", grpcType = GrpcInvokeTypeEnum.SERVER_STREAM) + public void serverStream(ArthasUnittestRequest request, StreamObserver> observer) { + + for (int i = 0; i < 5; i++) { + ArthasUnittest.ArthasUnittestResponse response = ArthasUnittest.ArthasUnittestResponse.newBuilder() + .setMessage("Server response " + i + " to " + request.getMessage()) + .build(); + GrpcResponse grpcResponse = new GrpcResponse<>(); + grpcResponse.setService("arthas.grpc.unittest.ArthasUnittestService"); + grpcResponse.setMethod("serverStream"); + grpcResponse.writeResponseData(response); + observer.onNext(grpcResponse); + } + observer.onCompleted(); + } + + @Override + @GrpcMethod(value = "biStream", grpcType = GrpcInvokeTypeEnum.BI_STREAM) + public StreamObserver> biStream(StreamObserver> observer) { + return new StreamObserver>() { + @Override + public void onNext(GrpcRequest req) { + try { + byte[] bytes = req.readData(); + while (bytes != null && bytes.length != 0) { + GrpcResponse grpcResponse = new GrpcResponse<>(); + grpcResponse.setService("arthas.grpc.unittest.ArthasUnittestService"); + grpcResponse.setMethod("biStream"); + grpcResponse.writeResponseData(ArthasUnittestResponse.parseFrom(bytes)); + observer.onNext(grpcResponse); + bytes = req.readData(); + } + } catch (InvalidProtocolBufferException e) { + throw new RuntimeException(e); + } + } + + @Override + public void onCompleted() { + observer.onCompleted(); + } + }; + } +} \ No newline at end of file diff --git a/arthas-grpc-web-proxy/README.md b/labs/arthas-grpc-web-proxy/README.md similarity index 100% rename from arthas-grpc-web-proxy/README.md rename to labs/arthas-grpc-web-proxy/README.md diff --git a/arthas-grpc-web-proxy/pom.xml b/labs/arthas-grpc-web-proxy/pom.xml similarity index 97% rename from arthas-grpc-web-proxy/pom.xml rename to labs/arthas-grpc-web-proxy/pom.xml index c7eaaa2425c..7689e82996b 100644 --- a/arthas-grpc-web-proxy/pom.xml +++ b/labs/arthas-grpc-web-proxy/pom.xml @@ -1,12 +1,11 @@ + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> arthas-all com.taobao.arthas ${revision} - ../pom.xml + ../../pom.xml 4.0.0 arthas-grpc-web-proxy diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/DemoBootstrap.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/DemoBootstrap.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/DemoBootstrap.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/DemoBootstrap.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/distribution/GrpcResultDistributorImpl.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/distribution/GrpcResultDistributorImpl.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/distribution/GrpcResultDistributorImpl.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/distribution/GrpcResultDistributorImpl.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/EnhancerRequestModel.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/EnhancerRequestModel.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/EnhancerRequestModel.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/EnhancerRequestModel.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchRequestModel.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchRequestModel.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchRequestModel.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchRequestModel.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchResponseModel.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchResponseModel.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchResponseModel.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/model/WatchResponseModel.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/ComplexObject.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/ComplexObject.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/ComplexObject.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/ComplexObject.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/JavaObjectConverter.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/JavaObjectConverter.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/JavaObjectConverter.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/objectUtils/JavaObjectConverter.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/ArthasStreamObserver.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/ArthasStreamObserver.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/ArthasStreamObserver.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/ArthasStreamObserver.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/ArthasStreamObserverImpl.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/ArthasStreamObserverImpl.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/ArthasStreamObserverImpl.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/ArthasStreamObserverImpl.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/GrpcProcess.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/GrpcProcess.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/GrpcProcess.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/observer/impl/GrpcProcess.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/GrpcServer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/GrpcServer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/GrpcServer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/GrpcServer.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpInitializer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpInitializer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpInitializer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpInitializer.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpServer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpServer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpServer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpServer.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpStaticFileHandler.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpStaticFileHandler.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpStaticFileHandler.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/server/httpServer/NettyHttpStaticFileHandler.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/GrpcJobController.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/GrpcJobController.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/GrpcJobController.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/GrpcJobController.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/ObjectService.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/ObjectService.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/ObjectService.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/ObjectService.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/PwdCommandService.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/PwdCommandService.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/PwdCommandService.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/PwdCommandService.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/SystemPropertyCommandService.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/SystemPropertyCommandService.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/SystemPropertyCommandService.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/SystemPropertyCommandService.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/WatchCommandService.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/WatchCommandService.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/WatchCommandService.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/WatchCommandService.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/AdviceListenerManager.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/AdviceListenerManager.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/AdviceListenerManager.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/AdviceListenerManager.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/Enhancer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/Enhancer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/Enhancer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/Enhancer.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/SpyImpl.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/SpyImpl.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/SpyImpl.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/SpyImpl.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/WatchRpcAdviceListener.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/WatchRpcAdviceListener.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/WatchRpcAdviceListener.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/service/advisor/WatchRpcAdviceListener.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcEnhancerView.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcEnhancerView.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcEnhancerView.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcEnhancerView.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcMessageView.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcMessageView.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcMessageView.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcMessageView.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcPwdView.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcPwdView.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcPwdView.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcPwdView.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultView.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultView.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultView.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultView.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultViewResolver.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultViewResolver.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultViewResolver.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcResultViewResolver.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcStatusView.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcStatusView.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcStatusView.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcStatusView.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcSystemPropertyView.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcSystemPropertyView.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcSystemPropertyView.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcSystemPropertyView.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcWatchView.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcWatchView.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcWatchView.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/grpc/view/GrpcWatchView.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/CorsUtils.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/CorsUtils.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/CorsUtils.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/CorsUtils.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcServiceConnectionManager.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcServiceConnectionManager.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcServiceConnectionManager.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcServiceConnectionManager.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebClientInterceptor.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebClientInterceptor.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebClientInterceptor.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebClientInterceptor.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebRequestHandler.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebRequestHandler.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebRequestHandler.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/GrpcWebRequestHandler.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageDeframer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageDeframer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageDeframer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageDeframer.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageFramer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageFramer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageFramer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageFramer.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageUtils.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageUtils.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageUtils.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MessageUtils.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MetadataUtil.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MetadataUtil.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MetadataUtil.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/MetadataUtil.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SendGrpcWebResponse.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SendGrpcWebResponse.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SendGrpcWebResponse.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SendGrpcWebResponse.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SingleHttpChunkedInput.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SingleHttpChunkedInput.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SingleHttpChunkedInput.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/SingleHttpChunkedInput.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyHandler.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyHandler.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyHandler.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyHandler.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServer.java diff --git a/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerInitializer.java b/labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerInitializer.java similarity index 100% rename from arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerInitializer.java rename to labs/arthas-grpc-web-proxy/src/main/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerInitializer.java diff --git a/arthas-grpc-web-proxy/src/main/proto/ArthasServices.proto b/labs/arthas-grpc-web-proxy/src/main/proto/ArthasServices.proto similarity index 100% rename from arthas-grpc-web-proxy/src/main/proto/ArthasServices.proto rename to labs/arthas-grpc-web-proxy/src/main/proto/ArthasServices.proto diff --git a/arthas-grpc-web-proxy/src/main/proto/echo.proto b/labs/arthas-grpc-web-proxy/src/main/proto/echo.proto similarity index 100% rename from arthas-grpc-web-proxy/src/main/proto/echo.proto rename to labs/arthas-grpc-web-proxy/src/main/proto/echo.proto diff --git a/arthas-grpc-web-proxy/src/main/proto/greeter.proto b/labs/arthas-grpc-web-proxy/src/main/proto/greeter.proto similarity index 100% rename from arthas-grpc-web-proxy/src/main/proto/greeter.proto rename to labs/arthas-grpc-web-proxy/src/main/proto/greeter.proto diff --git a/arthas-grpc-web-proxy/src/main/proto/helloworld.proto b/labs/arthas-grpc-web-proxy/src/main/proto/helloworld.proto similarity index 100% rename from arthas-grpc-web-proxy/src/main/proto/helloworld.proto rename to labs/arthas-grpc-web-proxy/src/main/proto/helloworld.proto diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/grpc/service/JavaObjectConverterTest.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/grpc/service/JavaObjectConverterTest.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/grpc/service/JavaObjectConverterTest.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/grpc/service/JavaObjectConverterTest.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/CorsUtilsTest.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/CorsUtilsTest.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/CorsUtilsTest.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/CorsUtilsTest.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerTest.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerTest.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerTest.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/GrpcWebProxyServerTest.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageDeframerTest.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageDeframerTest.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageDeframerTest.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageDeframerTest.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageUtilsTest.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageUtilsTest.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageUtilsTest.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/MessageUtilsTest.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcTest.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcTest.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcTest.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcTest.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcWebProxyTest.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcWebProxyTest.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcWebProxyTest.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/StartGrpcWebProxyTest.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/EchoImpl.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/EchoImpl.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/EchoImpl.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/EchoImpl.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/GreeterService.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/GreeterService.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/GreeterService.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/GreeterService.java diff --git a/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/HelloImpl.java b/labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/HelloImpl.java similarity index 100% rename from arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/HelloImpl.java rename to labs/arthas-grpc-web-proxy/src/test/java/com/taobao/arthas/grpcweb/proxy/server/grpcService/HelloImpl.java diff --git a/arthas-grpc-web-proxy/src/test/proto/echo.proto b/labs/arthas-grpc-web-proxy/src/test/proto/echo.proto similarity index 100% rename from arthas-grpc-web-proxy/src/test/proto/echo.proto rename to labs/arthas-grpc-web-proxy/src/test/proto/echo.proto diff --git a/arthas-grpc-web-proxy/src/test/proto/greeter.proto b/labs/arthas-grpc-web-proxy/src/test/proto/greeter.proto similarity index 100% rename from arthas-grpc-web-proxy/src/test/proto/greeter.proto rename to labs/arthas-grpc-web-proxy/src/test/proto/greeter.proto diff --git a/arthas-grpc-web-proxy/src/test/proto/helloworld.proto b/labs/arthas-grpc-web-proxy/src/test/proto/helloworld.proto similarity index 100% rename from arthas-grpc-web-proxy/src/test/proto/helloworld.proto rename to labs/arthas-grpc-web-proxy/src/test/proto/helloworld.proto diff --git a/arthas-grpc-web-proxy/ui/.gitignore b/labs/arthas-grpc-web-proxy/ui/.gitignore similarity index 100% rename from arthas-grpc-web-proxy/ui/.gitignore rename to labs/arthas-grpc-web-proxy/ui/.gitignore diff --git a/arthas-grpc-web-proxy/ui/README.md b/labs/arthas-grpc-web-proxy/ui/README.md similarity index 100% rename from arthas-grpc-web-proxy/ui/README.md rename to labs/arthas-grpc-web-proxy/ui/README.md diff --git a/arthas-grpc-web-proxy/ui/babel.config.js b/labs/arthas-grpc-web-proxy/ui/babel.config.js similarity index 100% rename from arthas-grpc-web-proxy/ui/babel.config.js rename to labs/arthas-grpc-web-proxy/ui/babel.config.js diff --git a/arthas-grpc-web-proxy/ui/jsconfig.json b/labs/arthas-grpc-web-proxy/ui/jsconfig.json similarity index 100% rename from arthas-grpc-web-proxy/ui/jsconfig.json rename to labs/arthas-grpc-web-proxy/ui/jsconfig.json diff --git a/arthas-grpc-web-proxy/ui/package-lock.json b/labs/arthas-grpc-web-proxy/ui/package-lock.json similarity index 100% rename from arthas-grpc-web-proxy/ui/package-lock.json rename to labs/arthas-grpc-web-proxy/ui/package-lock.json diff --git a/arthas-grpc-web-proxy/ui/package.json b/labs/arthas-grpc-web-proxy/ui/package.json similarity index 100% rename from arthas-grpc-web-proxy/ui/package.json rename to labs/arthas-grpc-web-proxy/ui/package.json diff --git a/arthas-grpc-web-proxy/ui/public/favicon.ico b/labs/arthas-grpc-web-proxy/ui/public/favicon.ico similarity index 100% rename from arthas-grpc-web-proxy/ui/public/favicon.ico rename to labs/arthas-grpc-web-proxy/ui/public/favicon.ico diff --git a/arthas-grpc-web-proxy/ui/public/index.html b/labs/arthas-grpc-web-proxy/ui/public/index.html similarity index 100% rename from arthas-grpc-web-proxy/ui/public/index.html rename to labs/arthas-grpc-web-proxy/ui/public/index.html diff --git a/arthas-grpc-web-proxy/ui/src/App.vue b/labs/arthas-grpc-web-proxy/ui/src/App.vue similarity index 100% rename from arthas-grpc-web-proxy/ui/src/App.vue rename to labs/arthas-grpc-web-proxy/ui/src/App.vue diff --git a/arthas-grpc-web-proxy/ui/src/assets/logo.png b/labs/arthas-grpc-web-proxy/ui/src/assets/logo.png similarity index 100% rename from arthas-grpc-web-proxy/ui/src/assets/logo.png rename to labs/arthas-grpc-web-proxy/ui/src/assets/logo.png diff --git a/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices.proto b/labs/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices.proto similarity index 100% rename from arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices.proto rename to labs/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices.proto diff --git a/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_grpc_web_pb.js b/labs/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_grpc_web_pb.js similarity index 100% rename from arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_grpc_web_pb.js rename to labs/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_grpc_web_pb.js diff --git a/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_pb.js b/labs/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_pb.js similarity index 100% rename from arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_pb.js rename to labs/arthas-grpc-web-proxy/ui/src/assets/proto/ArthasServices_pb.js diff --git a/arthas-grpc-web-proxy/ui/src/assets/proto/protoc-gen-grpc-web.exe b/labs/arthas-grpc-web-proxy/ui/src/assets/proto/protoc-gen-grpc-web.exe similarity index 100% rename from arthas-grpc-web-proxy/ui/src/assets/proto/protoc-gen-grpc-web.exe rename to labs/arthas-grpc-web-proxy/ui/src/assets/proto/protoc-gen-grpc-web.exe diff --git a/arthas-grpc-web-proxy/ui/src/components/DemoUI.vue b/labs/arthas-grpc-web-proxy/ui/src/components/DemoUI.vue similarity index 100% rename from arthas-grpc-web-proxy/ui/src/components/DemoUI.vue rename to labs/arthas-grpc-web-proxy/ui/src/components/DemoUI.vue diff --git a/arthas-grpc-web-proxy/ui/src/main.js b/labs/arthas-grpc-web-proxy/ui/src/main.js similarity index 100% rename from arthas-grpc-web-proxy/ui/src/main.js rename to labs/arthas-grpc-web-proxy/ui/src/main.js diff --git a/arthas-grpc-web-proxy/ui/src/router/index.js b/labs/arthas-grpc-web-proxy/ui/src/router/index.js similarity index 100% rename from arthas-grpc-web-proxy/ui/src/router/index.js rename to labs/arthas-grpc-web-proxy/ui/src/router/index.js diff --git a/arthas-grpc-web-proxy/ui/src/router/routes.js b/labs/arthas-grpc-web-proxy/ui/src/router/routes.js similarity index 100% rename from arthas-grpc-web-proxy/ui/src/router/routes.js rename to labs/arthas-grpc-web-proxy/ui/src/router/routes.js diff --git a/arthas-grpc-web-proxy/ui/src/view/pwdView.vue b/labs/arthas-grpc-web-proxy/ui/src/view/pwdView.vue similarity index 100% rename from arthas-grpc-web-proxy/ui/src/view/pwdView.vue rename to labs/arthas-grpc-web-proxy/ui/src/view/pwdView.vue diff --git a/arthas-grpc-web-proxy/ui/src/view/syspropView.vue b/labs/arthas-grpc-web-proxy/ui/src/view/syspropView.vue similarity index 100% rename from arthas-grpc-web-proxy/ui/src/view/syspropView.vue rename to labs/arthas-grpc-web-proxy/ui/src/view/syspropView.vue diff --git a/arthas-grpc-web-proxy/ui/src/view/vmtoolView.vue b/labs/arthas-grpc-web-proxy/ui/src/view/vmtoolView.vue similarity index 100% rename from arthas-grpc-web-proxy/ui/src/view/vmtoolView.vue rename to labs/arthas-grpc-web-proxy/ui/src/view/vmtoolView.vue diff --git a/arthas-grpc-web-proxy/ui/src/view/watchView.vue b/labs/arthas-grpc-web-proxy/ui/src/view/watchView.vue similarity index 100% rename from arthas-grpc-web-proxy/ui/src/view/watchView.vue rename to labs/arthas-grpc-web-proxy/ui/src/view/watchView.vue diff --git a/arthas-grpc-web-proxy/ui/vue.config.js b/labs/arthas-grpc-web-proxy/ui/vue.config.js similarity index 100% rename from arthas-grpc-web-proxy/ui/vue.config.js rename to labs/arthas-grpc-web-proxy/ui/vue.config.js diff --git a/arthas-grpc-web-proxy/ui/yarn.lock b/labs/arthas-grpc-web-proxy/ui/yarn.lock similarity index 100% rename from arthas-grpc-web-proxy/ui/yarn.lock rename to labs/arthas-grpc-web-proxy/ui/yarn.lock diff --git a/labs/cluster-management/README.md b/labs/cluster-management/README.md new file mode 100644 index 00000000000..99b99f4d8aa --- /dev/null +++ b/labs/cluster-management/README.md @@ -0,0 +1,80 @@ + +## Arthas Native Agent - 集群管理 + +![](images/cluster_management.png) + +# 快速开始 + +## 启动native-agent +native-agent,启动在需要动态attach的服务器上 +启动参数 + +| 参数 | 必填 | 解释 | +|----------------------|-----|-------------------------------------| +| http-port | N | http端口 ,默认2671 | +| ws-port | N | ws端口,默认2672 | +| registration-typ | Y | 注册中心类型(目前实现的有etcd和zookeeper,推荐etcd) | +| registration-address | Y | 注册中心的地址 | + +example: +```shell +java -jar native-agent.jar --ip 164.196.97.123 --http-port 2671 --ws-port 2672 --registration-type etcd --registration-address 164.196.97.123:2379 +``` + +## 启动native-agent-proxy +做为native-agent和native-agent-management-web的网络中转 + +| 参数 | 必填 | 解释 | +|---------------------------------|-----|------------------------------------------------------------------| +| port | N | http/ws端口 ,默认2233 | +| ip | Y | proxy的ip | +| management-registration-type | Y | native-agent-manangement-web的注册中心类型(目前实现的有etcd和zookeeper,推荐etcd) | +| management-registration-address | Y | native-agent-manangement-webd的注册中心地址 | + | agent-registration-type | Y | native-agent的注册中心类型(目前实现的有etcd和zookeeper,推荐etcd) | + | agent-registration-address | Y | native-agent的注册中心地址 | + + +example: +```shell +java -jar native-agent-proxy.jar --ip 164.196.97.123 --management-registration-type etcd --management-registration-address 164.196.97.123:2379 --agent-registration-type etcd --agent-registration-address 164.196.97.123:2379 +``` + +## 启动native-agent-management-web +native-agent的管理页面 + +| 参数 | 必填 | 解释 | +|----------------------|-----|-------------------------------------| +| port | N | http端口 ,默认3939 | +| registration-typ | Y | 注册中心类型(目前实现的有etcd和zookeeper,推荐etcd) | +| registration-address | Y | 注册中心的地址 | + + +example: +```shell +java -jar native-agent-management-web.jar --registration-type etcd --registration-address 164.196.97.123:2379 +``` + + +## 监控指定JVM +进入native-agent-server管理页面,点击VIEW JAVA PROCESS INFO 按钮,可以查看到当前服务器上的Java进程 +![](images/native_agent_list.png) +进入到Java进程页后,我们可以点击Monitor按钮,Monitor目标Java进程 +![](images/native_agent_java_process_page.png) +之后点击MONITOR按钮就可以进入到监控界面了 +![](images/native_agent_moniotr_page.png) + +# 扩展注册中心 +目前实现的有zookeeper和etcd,如果想要扩展注册中心,可以看看下面的实现。下面演示的是native-agent-management-web的扩展,其他也是同样的道理。 + +需要实现com.alibaba.arthas.nat.agent.management.web.discovery.NativeAgentProxyDiscovery接口,并在META-INF/arthas/com.alibaba.arthas.native.agent.management.web.NativeAgentProxyDiscoveryFactory 添加上你的实现 +```properties +zookeeper=com.alibaba.arthas.nat.agent.management.web.discovery.impl.ZookeeperNativeAgentProxyDiscovery +etcd=com.alibaba.arthas.nat.agent.management.web.discovery.impl.EtcdNativeAgentProxyDiscovery +注册中心名称=你的实现 +``` +# 添加你的实现 +注册中心名称=你实现类的具体路径 +之后你启动native-agent-management-web就可以,通过--registration-type参数,来指定你实现的注册中心 +```shell +java -jar native-agent-management-web.jar --registration-type 注册中心名称 --registration-address 注册中心的地址 +``` diff --git a/labs/cluster-management/images/cluster_management.png b/labs/cluster-management/images/cluster_management.png new file mode 100644 index 00000000000..0a406e5abad Binary files /dev/null and b/labs/cluster-management/images/cluster_management.png differ diff --git a/labs/cluster-management/images/native_agent_architecture.png b/labs/cluster-management/images/native_agent_architecture.png new file mode 100644 index 00000000000..a1e2be155d8 Binary files /dev/null and b/labs/cluster-management/images/native_agent_architecture.png differ diff --git a/labs/cluster-management/images/native_agent_java_process_page.png b/labs/cluster-management/images/native_agent_java_process_page.png new file mode 100644 index 00000000000..7b0a7add6f3 Binary files /dev/null and b/labs/cluster-management/images/native_agent_java_process_page.png differ diff --git a/labs/cluster-management/images/native_agent_list.png b/labs/cluster-management/images/native_agent_list.png new file mode 100644 index 00000000000..d9bb8f2d468 Binary files /dev/null and b/labs/cluster-management/images/native_agent_list.png differ diff --git a/labs/cluster-management/images/native_agent_moniotr_page.png b/labs/cluster-management/images/native_agent_moniotr_page.png new file mode 100644 index 00000000000..b1a19dd4d11 Binary files /dev/null and b/labs/cluster-management/images/native_agent_moniotr_page.png differ diff --git a/labs/cluster-management/native-agent-common/pom.xml b/labs/cluster-management/native-agent-common/pom.xml new file mode 100644 index 00000000000..1439c2062a9 --- /dev/null +++ b/labs/cluster-management/native-agent-common/pom.xml @@ -0,0 +1,70 @@ + + + + arthas-all + com.taobao.arthas + ${revision} + ../../../pom.xml + + + 4.0.0 + native-agent-common + native-agent-common + + + 8 + 8 + UTF-8 + + + + + + io.netty + netty-common + + + io.netty + netty-buffer + + + io.netty + netty-handler + + + io.netty + netty-transport + + + + io.netty + netty-codec-http + + + + com.alibaba.fastjson2 + fastjson2 + + + + org.apache.zookeeper + zookeeper + 3.7.0 + + + + io.etcd + jetcd-core + 0.7.0 + + + + com.squareup.okhttp3 + okhttp + 4.10.0 + + + + + \ No newline at end of file diff --git a/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/constants/NativeAgentConstants.java b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/constants/NativeAgentConstants.java new file mode 100644 index 00000000000..9b0e9628468 --- /dev/null +++ b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/constants/NativeAgentConstants.java @@ -0,0 +1,18 @@ +package com.alibaba.arthas.nat.agent.common.constants; + +/** + * @description: hello world + * @author:flzjkl + * @date: 2024-09-22 0:47 + */ +public class NativeAgentConstants { + + public static final int ARTHAS_SERVER_HTTP_PORT = 8563; + + public static final int MAX_HTTP_CONTENT_LENGTH = 1024 * 1024 * 10; + + public static final String NATIVE_AGENT_KEY = "/native-agent"; + + public static final String NATIVE_AGENT_PROXY_KEY = "/native-agent-proxy"; + +} diff --git a/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/dto/NativeAgentInfoDTO.java b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/dto/NativeAgentInfoDTO.java new file mode 100644 index 00000000000..4e7fc43d8e4 --- /dev/null +++ b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/dto/NativeAgentInfoDTO.java @@ -0,0 +1,47 @@ +package com.alibaba.arthas.nat.agent.common.dto; + +/** + * @description: NativeAgentInfoDTO + * @author:flzjkl + * @date: 2024-09-05 8:04 + */ +public class NativeAgentInfoDTO { + private String ip; + private Integer httpPort; + private Integer wsPort; + + public NativeAgentInfoDTO() { + + } + + public NativeAgentInfoDTO(String ip, Integer httpPort, Integer wsPort) { + this.ip = ip; + this.httpPort = httpPort; + this.wsPort = wsPort; + } + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public Integer getHttpPort() { + return httpPort; + } + + public void setHttpPort(Integer httpPort) { + this.httpPort = httpPort; + } + + public Integer getWsPort() { + return wsPort; + } + + public void setWsPort(Integer wsPort) { + this.wsPort = wsPort; + } +} + diff --git a/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/handler/HttpOptionRequestHandler.java b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/handler/HttpOptionRequestHandler.java new file mode 100644 index 00000000000..9626044f4d3 --- /dev/null +++ b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/handler/HttpOptionRequestHandler.java @@ -0,0 +1,46 @@ +package com.alibaba.arthas.nat.agent.common.handler; + +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http.*; + +/** + * @description: HttpOptionRequestHandler + * @author:flzjkl + * @date: 2024-09-22 7:21 + */ +public class HttpOptionRequestHandler { + + public FullHttpResponse handleOptionsRequest(ChannelHandlerContext ctx, FullHttpRequest request) { + FullHttpResponse response = new DefaultFullHttpResponse( + request.getProtocolVersion(), + HttpResponseStatus.OK, + Unpooled.EMPTY_BUFFER); + + // Set the CORS response header + String origin = request.headers().get(HttpHeaderNames.ORIGIN); + if (origin != null) { + response.headers().set(HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN, origin); + } else { + response.headers().set(HttpHeaderNames.ACCESS_CONTROL_ALLOW_ORIGIN, "*"); + } + response.headers().set(HttpHeaderNames.ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, PUT, DELETE, OPTIONS"); + response.headers().set(HttpHeaderNames.ACCESS_CONTROL_MAX_AGE, 3600L); + response.headers().set(HttpHeaderNames.ACCESS_CONTROL_ALLOW_HEADERS, "Content-Type, Authorization, X-Requested-With, Accept, Origin"); + + // If the request contains an Access-Control-Request-Method, a response is required + String accessControlRequestMethod = request.headers().get(HttpHeaderNames.ACCESS_CONTROL_REQUEST_METHOD); + if (accessControlRequestMethod != null) { + response.headers().set(HttpHeaderNames.ACCESS_CONTROL_ALLOW_METHODS, accessControlRequestMethod); + } + + // If the request contains Access-Control-Request-Headers, a response is required + String accessControlRequestHeaders = request.headers().get(HttpHeaderNames.ACCESS_CONTROL_REQUEST_HEADERS); + if (accessControlRequestHeaders != null) { + response.headers().set(HttpHeaderNames.ACCESS_CONTROL_ALLOW_HEADERS, accessControlRequestHeaders); + } + + return response; + } + +} diff --git a/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/utils/OkHttpUtil.java b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/utils/OkHttpUtil.java new file mode 100644 index 00000000000..fae2acb47fa --- /dev/null +++ b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/utils/OkHttpUtil.java @@ -0,0 +1,46 @@ +package com.alibaba.arthas.nat.agent.common.utils; + +import okhttp3.*; + +import java.io.IOException; +import java.util.concurrent.TimeUnit; + +/** + * @description: OkHttpUtil + * @author:flzjkl + * @date: 2024-10-20 21:35 + */ +public class OkHttpUtil { + + private static final OkHttpClient client = new OkHttpClient.Builder() + .connectTimeout(10, TimeUnit.SECONDS) + .writeTimeout(10, TimeUnit.SECONDS) + .readTimeout(30, TimeUnit.SECONDS) + .build(); + + private static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); + + public static String get(String url) throws IOException { + Request request = new Request.Builder() + .url(url) + .build(); + + try (Response response = client.newCall(request).execute()) { + return response.body().string(); + } + } + + public static String post(String url, String json) throws IOException { + RequestBody body = RequestBody.create(json, JSON); + Request request = new Request.Builder() + .url(url) + .post(body) + .header("Content-Type", "application/json") + .build(); + + try (Response response = client.newCall(request).execute()) { + return response.body().string(); + } + } + +} diff --git a/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/utils/WelcomeUtil.java b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/utils/WelcomeUtil.java new file mode 100644 index 00000000000..9fceee91327 --- /dev/null +++ b/labs/cluster-management/native-agent-common/src/main/java/com/alibaba/arthas/nat/agent/common/utils/WelcomeUtil.java @@ -0,0 +1,44 @@ +package com.alibaba.arthas.nat.agent.common.utils; + + +/** + * @description: WelcomeUtil + * @author:flzjkl + * @date: 2024-09-22 18:26 + */ +public class WelcomeUtil { + + public static void printNativeAgentWelcomeMsg() { + String welcomeMsg = " _ _ _ \n" + + " _ __ __ _ | |_ (_) __ __ ___ __ _ __ _ ___ _ __ | |_ \n" + + " | '_ \\ / _` | | __| | | \\ \\ / / / _ \\ / _` | / _` | / _ \\ | '_ \\ | __|\n" + + " | | | | | (_| | | |_ | | \\ V / | __/ | (_| | | (_| | | __/ | | | | | |_ \n" + + " |_| |_| \\__,_| \\__| |_| \\_/ \\___| \\__,_| \\__, | \\___| |_| |_| \\__|\n" + + " |___/ "; + System.out.println(welcomeMsg); + System.out.println("======================================================================================================================="); + } + + public static void printManagementWebWelcomeMsg() { + String welcomeMsg = " _ _ _ _ _ \n" + + " _ __ __ _ | |_ (_) __ __ ___ __ _ __ _ ___ _ __ | |_ _ __ ___ __ _ _ __ __ _ __ _ ___ _ __ ___ ___ _ __ | |_ __ __ ___ | |__ \n" + + " | '_ \\ / _` | | __| | | \\ \\ / / / _ \\ / _` | / _` | / _ \\ | '_ \\ | __| | '_ ` _ \\ / _` | | '_ \\ / _` | / _` | / _ \\ | '_ ` _ \\ / _ \\ | '_ \\ | __| \\ \\ /\\ / / / _ \\ | '_ \\ \n" + + " | | | | | (_| | | |_ | | \\ V / | __/ | (_| | | (_| | | __/ | | | | | |_ | | | | | | | (_| | | | | | | (_| | | (_| | | __/ | | | | | | | __/ | | | | | |_ \\ V V / | __/ | |_) |\n" + + " |_| |_| \\__,_| \\__| |_| \\_/ \\___| \\__,_| \\__, | \\___| |_| |_| \\__| |_| |_| |_| \\__,_| |_| |_| \\__,_| \\__, | \\___| |_| |_| |_| \\___| |_| |_| \\__| \\_/\\_/ \\___| |_.__/ \n" + + " |___/ |___/ "; + System.out.println(welcomeMsg); + System.out.println("========================================================================================================================================================================================================================="); + } + + public static void printProxyWelcomeMsg() { + String welcomeMsg = " _ _ _ \n" + + " _ __ __ _ | |_ (_)__ __ ___ __ _ __ _ ___ _ __ | |_ _ __ _ __ ___ __ __ _ _ \n" + + "| '_ \\ / _` || __|| |\\ \\ / / / _ \\ / _` | / _` | / _ \\| '_ \\ | __| | '_ \\ | '__| / _ \\ \\ \\/ /| | | |\n" + + "| | | || (_| || |_ | | \\ V / | __/ | (_| || (_| || __/| | | || |_ | |_) || | | (_) | > < | |_| |\n" + + "|_| |_| \\__,_| \\__||_| \\_/ \\___| \\__,_| \\__, | \\___||_| |_| \\__| | .__/ |_| \\___/ /_/\\_\\ \\__, |\n" + + " |___/ |_| |___/ "; + System.out.println(welcomeMsg); + System.out.println("=========================================================================================================================="); + } + +} diff --git a/labs/cluster-management/native-agent-management-web/pom.xml b/labs/cluster-management/native-agent-management-web/pom.xml new file mode 100644 index 00000000000..873a168b770 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/pom.xml @@ -0,0 +1,82 @@ + + + + arthas-all + com.taobao.arthas + ${revision} + ../../../pom.xml + + 4.0.0 + + native-agent-management-web + native-agent-management-web + + + 8 + 8 + UTF-8 + + + + + + + + org.junit.jupiter + junit-jupiter + 5.8.2 + test + + + io.etcd + jetcd-core + 0.7.0 + + + + + org.slf4j + slf4j-api + 1.7.36 + + + + com.alibaba.middleware + cli + + + com.taobao.arthas + native-agent-common + ${project.version} + + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.6.0 + + + package + + shade + + + + + com.alibaba.arthas.nat.agent.management.web.server.NativeAgentManagementWebBootstrap + + + + + + + + + + + diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/NativeAgentProxyDiscovery.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/NativeAgentProxyDiscovery.java new file mode 100644 index 00000000000..b8225ccc84f --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/NativeAgentProxyDiscovery.java @@ -0,0 +1,18 @@ +package com.alibaba.arthas.nat.agent.management.web.discovery; + +import java.util.List; + +/** + * @description: NativeAgentProyDiscovery + * @author:flzjkl + * @date: 2024-09-19 7:22 + */ +public interface NativeAgentProxyDiscovery { + + /** + * list native agent proxy address + * @param address register address + * @return native agent proxy address + */ + List listNativeAgentProxy(String address); +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/impl/EtcdNativeAgentProxyDiscovery.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/impl/EtcdNativeAgentProxyDiscovery.java new file mode 100644 index 00000000000..693dec5cf06 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/impl/EtcdNativeAgentProxyDiscovery.java @@ -0,0 +1,69 @@ +package com.alibaba.arthas.nat.agent.management.web.discovery.impl; + +import com.alibaba.arthas.nat.agent.common.constants.NativeAgentConstants; +import com.alibaba.arthas.nat.agent.management.web.discovery.NativeAgentProxyDiscovery; +import io.etcd.jetcd.ByteSequence; +import io.etcd.jetcd.Client; +import io.etcd.jetcd.KV; +import io.etcd.jetcd.KeyValue; +import io.etcd.jetcd.kv.GetResponse; +import io.etcd.jetcd.options.GetOption; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + +/** + * @description: EtcdNativeAgentDiscovery implements NativeAgentDiscovery + * @author:flzjkl + * @date: 2024-09-15 9:19 + */ +public class EtcdNativeAgentProxyDiscovery implements NativeAgentProxyDiscovery { + + private static final Logger logger = LoggerFactory.getLogger(EtcdNativeAgentProxyDiscovery.class); + + + @Override + public List listNativeAgentProxy(String address) { + // Create kv client + Client client = null; + KV kvClient = null; + List res = null; + try { + client = Client.builder().endpoints("http://" + address).build(); + kvClient = client.getKVClient(); + + // Get value by prefix /native-agent-client + GetResponse getResponse = null; + try { + ByteSequence prefix = ByteSequence.from(NativeAgentConstants.NATIVE_AGENT_PROXY_KEY, StandardCharsets.UTF_8); + GetOption option = GetOption.newBuilder().isPrefix(Boolean.TRUE).build(); + getResponse = kvClient.get(prefix, option).get(); + } catch (Exception e) { + logger.error("get value failed with prefix" + NativeAgentConstants.NATIVE_AGENT_PROXY_KEY); + throw new RuntimeException(e); + } + + // Build Map + List kvs = getResponse.getKvs(); + if (kvs == null || kvs.size() == 0) { + return null; + } + res = new ArrayList<>(kvs.size()); + for (KeyValue kv : kvs) { + String value = kv.getValue().toString(StandardCharsets.UTF_8); + res.add(value); + } + } finally { + if (kvClient != null) { + kvClient.close(); + } + if (client != null) { + client.close(); + } + } + return res; + } +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/impl/ZookeeperNativeAgentProxyDiscovery.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/impl/ZookeeperNativeAgentProxyDiscovery.java new file mode 100644 index 00000000000..dbd9bc86f03 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/discovery/impl/ZookeeperNativeAgentProxyDiscovery.java @@ -0,0 +1,48 @@ +package com.alibaba.arthas.nat.agent.management.web.discovery.impl; + +import com.alibaba.arthas.nat.agent.common.constants.NativeAgentConstants; +import com.alibaba.arthas.nat.agent.management.web.discovery.NativeAgentProxyDiscovery; +import org.apache.zookeeper.Watcher; +import org.apache.zookeeper.ZooKeeper; + +import java.util.List; +import java.util.concurrent.CountDownLatch; + +/** + * @description: ZookeeperNativeAgentProxyDiscovery implements NativeAgentProxyDiscovery + * @author:flzjkl + * @date: 2024-07-24 20:33 + */ +public class ZookeeperNativeAgentProxyDiscovery implements NativeAgentProxyDiscovery { + + private static final int SESSION_TIMEOUT = 20000; + private static final CountDownLatch connectedSemaphore = new CountDownLatch(1); + + @Override + public List listNativeAgentProxy(String address) { + if (address == null || "".equals(address)) { + return null; + } + + // Wait for connection to be established + try { + ZooKeeper zooKeeper = new ZooKeeper(address, SESSION_TIMEOUT, event -> { + if (event.getState() == Watcher.Event.KeeperState.SyncConnected) { + connectedSemaphore.countDown(); + } + }); + connectedSemaphore.await(); + + // Gets a list of all children of the parent node + List children = zooKeeper.getChildren(NativeAgentConstants.NATIVE_AGENT_PROXY_KEY, false); + if (children == null || children.size() == 0) { + return children; + } + + zooKeeper.close(); + return children; + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/factory/NativeAgentProxyDiscoveryFactory.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/factory/NativeAgentProxyDiscoveryFactory.java new file mode 100644 index 00000000000..7b5480d25ae --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/factory/NativeAgentProxyDiscoveryFactory.java @@ -0,0 +1,87 @@ +package com.alibaba.arthas.nat.agent.management.web.factory; + +import com.alibaba.arthas.nat.agent.management.web.discovery.NativeAgentProxyDiscovery; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Constructor; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * @description: NativeAgentProxyDiscoveryFactory + * @author:flzjkl + * @date: 2024-10-20 20:37 + */ +public class NativeAgentProxyDiscoveryFactory { + + private static final String FILE_PATH = "META-INF/arthas/com.alibaba.arthas.native.agent.management.web.NativeAgentProxyDiscoveryFactory"; + private static Map nativeAgentProxyDiscoveryMap = new ConcurrentHashMap<>(); + + private static volatile NativeAgentProxyDiscoveryFactory nativeAgentProxyDiscoveryFactory; + + private NativeAgentProxyDiscoveryFactory() { + Map registrationConfigMap = readConfigInfo(FILE_PATH); + loadNativeAgentDiscovery2Map(registrationConfigMap); + } + + public static NativeAgentProxyDiscoveryFactory getNativeAgentProxyDiscoveryFactory() { + if (nativeAgentProxyDiscoveryFactory == null) { + synchronized (NativeAgentProxyDiscoveryFactory.class) { + if (nativeAgentProxyDiscoveryFactory == null) { + nativeAgentProxyDiscoveryFactory = new NativeAgentProxyDiscoveryFactory(); + } + } + } + return nativeAgentProxyDiscoveryFactory; + } + + private void loadNativeAgentDiscovery2Map(Map registrationConfigMap) { + for (Map.Entry entry : registrationConfigMap.entrySet()) { + String name = entry.getKey(); + String classPath = entry.getValue(); + + try { + Class clazz = Class.forName(classPath); + Constructor constructor = clazz.getConstructor(); + NativeAgentProxyDiscovery instance = (NativeAgentProxyDiscovery) constructor.newInstance(); + nativeAgentProxyDiscoveryMap.put(name, instance); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + + public Map readConfigInfo (String filePath) { + Map nativeAgentDiscoveryConfigMap = new ConcurrentHashMap<>(); + ClassLoader classLoader = NativeAgentProxyDiscoveryFactory.class.getClassLoader(); + + try (InputStream inputStream = classLoader.getResourceAsStream(filePath); + BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { + + if (inputStream == null) { + throw new IllegalArgumentException("File not found: " + filePath); + } + + String line; + while ((line = reader.readLine()) != null) { + if (!line.trim().isEmpty() && line.contains("=")) { + String[] parts = line.split("=", 2); + if (parts.length == 2) { + nativeAgentDiscoveryConfigMap.put(parts[0].trim(), parts[1].trim()); + } + } + } + } catch (IOException e) { + e.printStackTrace(); + } + return nativeAgentDiscoveryConfigMap; + } + + public NativeAgentProxyDiscovery getNativeAgentProxyDiscovery(String name) { + return nativeAgentProxyDiscoveryMap.get(name); + } +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/NativeAgentManagementWebBootstrap.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/NativeAgentManagementWebBootstrap.java new file mode 100644 index 00000000000..2251169e317 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/NativeAgentManagementWebBootstrap.java @@ -0,0 +1,128 @@ +package com.alibaba.arthas.nat.agent.management.web.server; + +import com.alibaba.arthas.nat.agent.common.constants.NativeAgentConstants; +import com.alibaba.arthas.nat.agent.common.utils.WelcomeUtil; +import com.alibaba.arthas.nat.agent.management.web.server.http.HttpRequestHandler; + +import com.taobao.middleware.cli.CLI; +import com.taobao.middleware.cli.CommandLine; +import com.taobao.middleware.cli.annotations.*; +import io.netty.bootstrap.ServerBootstrap; +import io.netty.channel.ChannelFuture; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.codec.http.HttpObjectAggregator; +import io.netty.handler.codec.http.HttpServerCodec; +import io.netty.handler.logging.LogLevel; +import io.netty.handler.logging.LoggingHandler; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Arrays; + +/** + * @description: native agent server + * @author:flzjkl + * @date: 2024-07-20 9:23 + */ + +@Name("arthas-native-agent-management-web") +@Summary("Bootstrap Arthas Native Management Web") +@Description("EXAMPLES:\n" + " java -jar native-agent-management-web.jar --registration-type etcd --registration-address 161.169.97.114:2379\n" + + "java -jar native-agent-management-web.jar --port 3939 --registration-type etcd --registration-address 161.169.97.114:2379\n" + + "https://arthas.aliyun.com/doc\n") +public class NativeAgentManagementWebBootstrap { + private static final Logger logger = LoggerFactory.getLogger(NativeAgentManagementWebBootstrap.class); + private static final int DEFAULT_NATIVE_AGENT_MANAGEMENT_WEB_PORT = 3939; + private Integer port; + public static String registrationType; + public static String registrationAddress; + + @Option(longName = "port") + @Description("native agent management port, default 3939") + public void setPort(Integer port) { + this.port = port; + } + + @Option(longName = "registration-type", required = true) + @Description("registration type") + public void setRegistrationType(String registrationType) { + this.registrationType = registrationType; + } + + @Option(longName = "registration-address", required = true) + @Description("registration address") + public void setRegistrationAddress(String registrationAddress) { + this.registrationAddress = registrationAddress; + } + + public static void main(String[] args) { + // Print welcome message + WelcomeUtil.printManagementWebWelcomeMsg(); + + // Startup parameter analysis + logger.info("read input config..."); + NativeAgentManagementWebBootstrap nativeAgentManagementWebBootstrap = new NativeAgentManagementWebBootstrap(); + CLI cli = CLIConfigurator.define(NativeAgentManagementWebBootstrap.class); + CommandLine commandLine = cli.parse(Arrays.asList(args)); + try { + CLIConfigurator.inject(commandLine, nativeAgentManagementWebBootstrap); + } catch (Throwable e) { + e.printStackTrace(); + System.exit(1); + } + logger.info("read input success!"); + + // Start the http server + logger.info("start the http server... httPort:{}", nativeAgentManagementWebBootstrap.getPortOrDefault()); + NioEventLoopGroup bossGroup = new NioEventLoopGroup(); + NioEventLoopGroup workGroup = new NioEventLoopGroup(); + try { + ServerBootstrap b = new ServerBootstrap(); + b.group(bossGroup, workGroup) + .channel(NioServerSocketChannel.class) + .handler(new LoggingHandler(LogLevel.INFO)) + .childHandler(new ChannelInitializer() { + @Override + protected void initChannel(SocketChannel ch) { + ch.pipeline().addLast(new HttpServerCodec()); + ch.pipeline().addLast(new HttpObjectAggregator(NativeAgentConstants.MAX_HTTP_CONTENT_LENGTH)); + ch.pipeline().addLast(new HttpRequestHandler()); + } + }); + ChannelFuture f = b.bind(nativeAgentManagementWebBootstrap.getPortOrDefault()).sync(); + logger.info("start the http server success! htt port:{}", nativeAgentManagementWebBootstrap.getPortOrDefault()); + f.channel().closeFuture().sync(); + } catch (Exception e) { + e.printStackTrace(); + logger.error("The native agent server fails to start, http port{}", nativeAgentManagementWebBootstrap.getPortOrDefault()); + throw new RuntimeException(e); + } finally { + bossGroup.shutdownGracefully(); + workGroup.shutdownGracefully(); + logger.info("shutdown native agent server"); + } + } + + public int getPortOrDefault() { + if (this.port == null) { + return DEFAULT_NATIVE_AGENT_MANAGEMENT_WEB_PORT; + } else { + return this.port; + } + } + + public String getRegistrationType() { + return registrationType; + } + + public String getRegistrationAddress() { + return registrationAddress; + } + + public Integer getPort() { + return port; + } +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpNativeAgentHandler.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpNativeAgentHandler.java new file mode 100644 index 00000000000..38c18b8e772 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpNativeAgentHandler.java @@ -0,0 +1,70 @@ +package com.alibaba.arthas.nat.agent.management.web.server.http; + +import com.alibaba.arthas.nat.agent.common.utils.OkHttpUtil; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.TypeReference; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http.DefaultFullHttpResponse; +import io.netty.handler.codec.http.FullHttpRequest; +import io.netty.handler.codec.http.FullHttpResponse; +import io.netty.handler.codec.http.HttpResponseStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.Map; + +/** + * @description: HttpNativeAgentHandler + * @author:flzjkl + * @date: 2024-08-01 7:32 + */ +public class HttpNativeAgentHandler { + + private static final Logger logger = LoggerFactory.getLogger(HttpNativeAgentHandler.class); + + private static HttpNativeAgentProxyHandler httpNativeAgentProxyHandler = new HttpNativeAgentProxyHandler(); + + public FullHttpResponse handle(ChannelHandlerContext ctx, FullHttpRequest request) { + String content = request.content().toString(StandardCharsets.UTF_8); + Map bodyMap = JSON.parseObject(content, new TypeReference>() { + }); + String operation = (String) bodyMap.get("operation"); + + if ("listNativeAgent".equals(operation)) { + return doListNativeAgent(ctx, request); + } + return null; + } + + private FullHttpResponse doListNativeAgent(ChannelHandlerContext ctx, FullHttpRequest request) { + // 1、Find native agent proxy address + String address = httpNativeAgentProxyHandler.findAvailableProxyAddress(); + if (address == null || "".equals(address)) { + return null; + } + // 2、Send Http request to native agent proxy to get native agent list + String resStr = null; + try { + String url = "http://" + address + "/api/native-agent-proxy"; + String jsonBody = "{\"operation\":\"listNativeAgent\"}"; + resStr = OkHttpUtil.post(url, jsonBody); + } catch (IOException e) { + logger.error("Send http to native agent proxy failed"); + throw new RuntimeException(e); + } + if (resStr == null) { + return null; + } + DefaultFullHttpResponse response = new DefaultFullHttpResponse( + request.getProtocolVersion(), + HttpResponseStatus.OK, + Unpooled.copiedBuffer(resStr, StandardCharsets.UTF_8) + ); + + return response; + } + +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpNativeAgentProxyHandler.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpNativeAgentProxyHandler.java new file mode 100644 index 00000000000..0e1ad426694 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpNativeAgentProxyHandler.java @@ -0,0 +1,70 @@ +package com.alibaba.arthas.nat.agent.management.web.server.http; + +import com.alibaba.arthas.nat.agent.management.web.discovery.NativeAgentProxyDiscovery; +import com.alibaba.arthas.nat.agent.management.web.factory.NativeAgentProxyDiscoveryFactory; +import com.alibaba.arthas.nat.agent.management.web.server.NativeAgentManagementWebBootstrap; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.TypeReference; +import io.netty.buffer.Unpooled; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http.DefaultFullHttpResponse; +import io.netty.handler.codec.http.FullHttpRequest; +import io.netty.handler.codec.http.FullHttpResponse; +import io.netty.handler.codec.http.HttpResponseStatus; + +import java.nio.charset.StandardCharsets; +import java.util.List; +import java.util.Map; +import java.util.Random; + +/** + * @description: HttpNativeAgentProxyHandler + * @author:flzjkl + * @date: 2024-10-21 7:01 + */ +public class HttpNativeAgentProxyHandler { + + public FullHttpResponse handle(ChannelHandlerContext ctx, FullHttpRequest request) { + String content = request.content().toString(StandardCharsets.UTF_8); + Map bodyMap = JSON.parseObject(content, new TypeReference>() { + }); + String operation = (String) bodyMap.get("operation"); + + if ("findAvailableProxyAddress".equals(operation)) { + return responseFindAvailableProxyAddress(ctx, request); + } + + return null; + } + + + public FullHttpResponse responseFindAvailableProxyAddress(ChannelHandlerContext ctx, FullHttpRequest request) { + String availableProxyAddress = findAvailableProxyAddress(); + if (availableProxyAddress == null || "".equals(availableProxyAddress)) { + return null; + } + DefaultFullHttpResponse response = new DefaultFullHttpResponse( + request.getProtocolVersion(), + HttpResponseStatus.OK, + Unpooled.copiedBuffer(availableProxyAddress, StandardCharsets.UTF_8) + ); + return response; + } + + + public String findAvailableProxyAddress() { + // Find in address register + NativeAgentProxyDiscoveryFactory proxyDiscoveryFactory = NativeAgentProxyDiscoveryFactory.getNativeAgentProxyDiscoveryFactory(); + NativeAgentProxyDiscovery proxyDiscovery = proxyDiscoveryFactory.getNativeAgentProxyDiscovery(NativeAgentManagementWebBootstrap.registrationType); + List proxyList = proxyDiscovery.listNativeAgentProxy(NativeAgentManagementWebBootstrap.registrationAddress); + if (proxyList == null || proxyList.size() == 0) { + return null; + } + // Return a random index of proxy address, like 127.0.0.1:2233 + Random random = new Random(); + int randomIndex = random.nextInt(proxyList.size()); + return proxyList.get(randomIndex); + } + + +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpRequestHandler.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpRequestHandler.java new file mode 100644 index 00000000000..5c17c2250ff --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpRequestHandler.java @@ -0,0 +1,72 @@ +package com.alibaba.arthas.nat.agent.management.web.server.http; + +import com.alibaba.arthas.nat.agent.common.handler.HttpOptionRequestHandler; +import io.netty.channel.ChannelFutureListener; +import io.netty.channel.ChannelHandlerContext; +import io.netty.channel.SimpleChannelInboundHandler; +import io.netty.handler.codec.http.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.URI; + +/** + * @description: HttpRequestHandler + * @author:flzjkl + * @date: 2024-07-20 10:09 + */ +public class HttpRequestHandler extends SimpleChannelInboundHandler { + + private static final Logger logger = LoggerFactory.getLogger(HttpRequestHandler.class); + + private HttpNativeAgentHandler httpNativeAgentHandler = new HttpNativeAgentHandler(); + private HttpNativeAgentProxyHandler httpNativeAgentProxyHandler = new HttpNativeAgentProxyHandler(); + + private HttpOptionRequestHandler httpOptionRequestHandler = new HttpOptionRequestHandler(); + + private HttpResourcesHandler httpResourcesHandler = new HttpResourcesHandler(); + + + @Override + protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest request) throws Exception { + String path = new URI(request.uri()).getPath(); + HttpMethod method = request.method(); + FullHttpResponse resp = null; + + if (HttpMethod.GET.equals(method)) { + if ("/".equals(path)) { + path = "/index.html"; + } + resp = httpResourcesHandler.handlerResources(request, path); + } + + if (HttpMethod.OPTIONS.equals(method)) { + resp = httpOptionRequestHandler.handleOptionsRequest(ctx, request); + } + + if (HttpMethod.POST.equals(method)) { + if ("/api/native-agent".equals(path)) { + resp = httpNativeAgentHandler.handle(ctx, request); + } + if ("/api/native-agent-proxy".equals(path)) { + resp = httpNativeAgentProxyHandler.handle(ctx, request); + } + } + + if (resp == null) { + resp = new DefaultFullHttpResponse(request.getProtocolVersion(), HttpResponseStatus.NOT_FOUND); + resp.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/html; charset=utf-8"); + } + + ctx.writeAndFlush(resp).addListener(ChannelFutureListener.CLOSE); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + cause.printStackTrace(); + if (ctx.channel().isActive()) { + ctx.writeAndFlush(new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.INTERNAL_SERVER_ERROR)); + ctx.close(); + } + } +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpResourcesHandler.java b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpResourcesHandler.java new file mode 100644 index 00000000000..d7f1914c709 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/java/com/alibaba/arthas/nat/agent/management/web/server/http/HttpResourcesHandler.java @@ -0,0 +1,117 @@ +package com.alibaba.arthas.nat.agent.management.web.server.http; + +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.handler.codec.http.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Collections; +import java.util.HashSet; +import java.util.Set; + +/** + * @description: HttpResourcesHandler + * @author:flzjkl + * @date: 2024-09-23 7:44 + */ +public class HttpResourcesHandler { + + private static final Logger logger = LoggerFactory.getLogger(HttpResourcesHandler.class); + private static final String RESOURCES_BASE_PATH = "/native-agent"; + private static final Set ALLOWED_EXTENSIONS; + + static { + Set tempSet = new HashSet<>(); + tempSet.add(".html"); + tempSet.add(".css"); + tempSet.add(".js"); + tempSet.add(".ico"); + tempSet.add(".png"); + ALLOWED_EXTENSIONS = Collections.unmodifiableSet(tempSet); + } + + public FullHttpResponse handlerResources(FullHttpRequest request, String path) { + try { + if (request == null || path == null) { + return null; + } + String normalizedPath = normalizePath(path); + if (normalizedPath == null) { + return null; + } + URL resourceUrl = getClass().getResource(RESOURCES_BASE_PATH + normalizedPath); + if (resourceUrl == null) { + return null; + } + try (InputStream is = resourceUrl.openStream()) { + if (is == null) { + return null; + } + + ByteBuf content = readInputStream(is); + FullHttpResponse response = new DefaultFullHttpResponse( + request.protocolVersion(), HttpResponseStatus.OK, content); + + HttpHeaders headers = response.headers(); + headers.set(HttpHeaderNames.CONTENT_TYPE, getContentType(normalizedPath)); + headers.setInt(HttpHeaderNames.CONTENT_LENGTH, content.readableBytes()); + headers.set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); + + return response; + } + } catch (Exception e) { + logger.error(""); + return null; + } + } + + private String normalizePath(String path) { + if (path == null) { + return null; + } + + path = path.replaceAll("\\.\\./", "").replaceAll("\\./", ""); + + + path = path.startsWith("/") ? path : "/" + path; + + + path = path.endsWith("/") ? path.substring(0, path.length() - 1) : path; + + + String finalPath = path; + boolean hasAllowedExtension = ALLOWED_EXTENSIONS.stream() + .anyMatch(finalPath::endsWith); + + if (!hasAllowedExtension) { + return null; + } + + return path; + } + + private String getContentType(String path) { + if (path.endsWith(".html")) return "text/html"; + if (path.endsWith(".css")) return "text/css"; + if (path.endsWith(".js")) return "application/javascript"; + if (path.endsWith(".ico")) return "image/x-icon"; + if (path.endsWith(".png")) return "image/png"; + return "application/octet-stream"; + } + + private ByteBuf readInputStream(InputStream is) throws IOException { + ByteBuf buffer = Unpooled.buffer(); + byte[] tmp = new byte[1024]; + int length; + while ((length = is.read(tmp)) != -1) { + buffer.writeBytes(tmp, 0, length); + } + is.close(); + return buffer; + } + +} diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/META-INF/arthas/com.alibaba.arthas.native.agent.management.web.NativeAgentProxyDiscoveryFactory b/labs/cluster-management/native-agent-management-web/src/main/resources/META-INF/arthas/com.alibaba.arthas.native.agent.management.web.NativeAgentProxyDiscoveryFactory new file mode 100644 index 00000000000..c47db4f485f --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/META-INF/arthas/com.alibaba.arthas.native.agent.management.web.NativeAgentProxyDiscoveryFactory @@ -0,0 +1,2 @@ +zookeeper=com.alibaba.arthas.nat.agent.management.web.discovery.impl.ZookeeperNativeAgentProxyDiscovery +etcd=com.alibaba.arthas.nat.agent.management.web.discovery.impl.EtcdNativeAgentProxyDiscovery \ No newline at end of file diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/log4j.properties b/labs/cluster-management/native-agent-management-web/src/main/resources/log4j.properties new file mode 100644 index 00000000000..e3b0cf60277 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/log4j.properties @@ -0,0 +1,7 @@ +# log4j.properties ?? +log4j.rootLogger=INFO, Console + +log4j.appender.Console=org.apache.log4j.ConsoleAppender +log4j.appender.Console.Target=System.out +log4j.appender.Console.layout=org.apache.log4j.PatternLayout +log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n \ No newline at end of file diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/agents.html b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/agents.html new file mode 100644 index 00000000000..ce16e744fca --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/agents.html @@ -0,0 +1,22 @@ + + + + + + + Arthas Native Agent + + + + + + + + + +
+
+ + + + \ No newline at end of file diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/console.html b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/console.html new file mode 100644 index 00000000000..4d21c548349 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/console.html @@ -0,0 +1,21 @@ + + + + + + + + Arthas Native Agent + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/favicon.ico b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/favicon.ico new file mode 100644 index 00000000000..df9b02e1eb1 Binary files /dev/null and b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/favicon.ico differ diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/index.html b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/index.html new file mode 100644 index 00000000000..eb06ac0a439 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/index.html @@ -0,0 +1,22 @@ + + + + + + + + Arthas Native Agent + + + + + + + + + +
+ + + + \ No newline at end of file diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/processes.html b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/processes.html new file mode 100644 index 00000000000..ee9566ffaac --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/processes.html @@ -0,0 +1,21 @@ + + + + + + + Arthas Native Agent + + + + + + + + +
+
+ + + + \ No newline at end of file diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/console-991af56b.css b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/console-991af56b.css new file mode 100644 index 00000000000..cdb4d714fd4 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/console-991af56b.css @@ -0,0 +1 @@ +#terminal:-webkit-full-screen{background-color:#ffff0c}.fullSc{z-index:10000;position:fixed;top:25%;left:90%}#fullScBtn{border-radius:17px;border:0;cursor:pointer;background-color:#000} diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/main-c782b056.css b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/main-c782b056.css new file mode 100644 index 00000000000..f6a0dd71e25 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/main-c782b056.css @@ -0,0 +1 @@ +*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}:root,[data-theme]{background-color:hsla(var(--b1) / var(--tw-bg-opacity, 1));color:hsla(var(--bc) / var(--tw-text-opacity, 1))}html{-webkit-tap-highlight-color:transparent}:root{color-scheme:light;--pf: 259 94% 41%;--sf: 314 100% 38%;--af: 174 60% 41%;--nf: 219 14% 22%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 259 94% 51%;--pc: 0 0% 100%;--s: 314 100% 47%;--sc: 0 0% 100%;--a: 174 60% 51%;--ac: 175 44% 15%;--n: 219 14% 28%;--nc: 0 0% 100%;--b1: 0 0% 100%;--b2: 0 0% 95%;--b3: 180 2% 90%;--bc: 215 28% 17%}@media (prefers-color-scheme: dark){:root{color-scheme:dark;--pf: 262 80% 40%;--sf: 316 70% 40%;--af: 175 70% 33%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 262 80% 50%;--pc: 0 0% 100%;--s: 316 70% 50%;--sc: 0 0% 100%;--a: 175 70% 41%;--ac: 0 0% 100%;--n: 218 18% 12%;--nf: 223 17% 8%;--nc: 220 13% 69%;--b1: 220 18% 20%;--b2: 220 17% 17%;--b3: 219 18% 15%;--bc: 220 13% 69%}}[data-theme=light]{color-scheme:light;--pf: 259 94% 41%;--sf: 314 100% 38%;--af: 174 60% 41%;--nf: 219 14% 22%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 259 94% 51%;--pc: 0 0% 100%;--s: 314 100% 47%;--sc: 0 0% 100%;--a: 174 60% 51%;--ac: 175 44% 15%;--n: 219 14% 28%;--nc: 0 0% 100%;--b1: 0 0% 100%;--b2: 0 0% 95%;--b3: 180 2% 90%;--bc: 215 28% 17%}[data-theme=dark]{color-scheme:dark;--pf: 262 80% 40%;--sf: 316 70% 40%;--af: 175 70% 33%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 262 80% 50%;--pc: 0 0% 100%;--s: 316 70% 50%;--sc: 0 0% 100%;--a: 175 70% 41%;--ac: 0 0% 100%;--n: 218 18% 12%;--nf: 223 17% 8%;--nc: 220 13% 69%;--b1: 220 18% 20%;--b2: 220 17% 17%;--b3: 219 18% 15%;--bc: 220 13% 69%}[data-theme=cupcake]{color-scheme:light;--pf: 183 47% 47%;--sf: 338 71% 62%;--af: 39 84% 46%;--nf: 280 46% 11%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--pc: 183 100% 12%;--sc: 338 100% 16%;--ac: 39 100% 12%;--nc: 280 83% 83%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--p: 183 47% 59%;--s: 338 71% 78%;--a: 39 84% 58%;--n: 280 46% 14%;--b1: 24 33% 97%;--b2: 27 22% 92%;--b3: 22 14% 89%;--bc: 280 46% 14%;--rounded-btn: 1.9rem;--tab-border: 2px;--tab-radius: .5rem}[data-theme=bumblebee]{color-scheme:light;--pf: 41 74% 42%;--sf: 50 94% 46%;--af: 240 33% 11%;--nf: 240 33% 11%;--b2: 0 0% 90%;--b3: 0 0% 81%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--bc: 0 0% 20%;--ac: 240 60% 83%;--nc: 240 60% 83%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 41 74% 53%;--pc: 240 33% 14%;--s: 50 94% 58%;--sc: 240 33% 14%;--a: 240 33% 14%;--n: 240 33% 14%;--b1: 0 0% 100%}[data-theme=emerald]{color-scheme:light;--pf: 141 50% 48%;--sf: 219 96% 48%;--af: 10 81% 45%;--nf: 219 20% 20%;--b2: 0 0% 90%;--b3: 0 0% 81%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--btn-text-case: uppercase;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 141 50% 60%;--pc: 151 28% 19%;--s: 219 96% 60%;--sc: 210 20% 98%;--a: 10 81% 56%;--ac: 210 20% 98%;--n: 219 20% 25%;--nc: 210 20% 98%;--b1: 0 0% 100%;--bc: 219 20% 25%;--animation-btn: 0;--animation-input: 0;--btn-focus-scale: 1}[data-theme=corporate]{color-scheme:light;--pf: 229 96% 51%;--sf: 215 26% 47%;--af: 154 49% 48%;--nf: 233 27% 10%;--b2: 0 0% 90%;--b3: 0 0% 81%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--pc: 229 100% 93%;--sc: 215 100% 12%;--ac: 154 100% 12%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--btn-text-case: uppercase;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 229 96% 64%;--s: 215 26% 59%;--a: 154 49% 60%;--n: 233 27% 13%;--nc: 210 38% 95%;--b1: 0 0% 100%;--bc: 233 27% 13%;--rounded-box: .25rem;--rounded-btn: .125rem;--rounded-badge: .125rem;--animation-btn: 0;--animation-input: 0;--btn-focus-scale: 1}[data-theme=synthwave]{color-scheme:dark;--pf: 321 70% 55%;--sf: 197 87% 52%;--af: 48 89% 46%;--nf: 253 61% 15%;--b2: 254 59% 23%;--b3: 254 59% 21%;--pc: 321 100% 14%;--sc: 197 100% 13%;--ac: 48 100% 11%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 321 70% 69%;--s: 197 87% 65%;--a: 48 89% 57%;--n: 253 61% 19%;--nc: 260 60% 98%;--b1: 254 59% 26%;--bc: 260 60% 98%;--in: 199 87% 64%;--inc: 257 63% 17%;--su: 168 74% 68%;--suc: 257 63% 17%;--wa: 48 89% 57%;--wac: 257 63% 17%;--er: 352 74% 57%;--erc: 260 60% 98%}[data-theme=retro]{color-scheme:light;--pf: 3 74% 61%;--sf: 145 27% 58%;--af: 49 67% 61%;--nf: 42 17% 34%;--inc: 221 100% 91%;--suc: 142 100% 87%;--wac: 32 100% 9%;--erc: 0 100% 90%;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 3 74% 76%;--pc: 345 5% 15%;--s: 145 27% 72%;--sc: 345 5% 15%;--a: 49 67% 76%;--ac: 345 5% 15%;--n: 42 17% 42%;--nc: 45 47% 80%;--b1: 45 47% 80%;--b2: 45 37% 72%;--b3: 42 36% 65%;--bc: 345 5% 15%;--in: 221 83% 53%;--su: 142 76% 36%;--wa: 32 95% 44%;--er: 0 72% 51%;--rounded-box: .4rem;--rounded-btn: .4rem;--rounded-badge: .4rem}[data-theme=cyberpunk]{color-scheme:light;--pf: 345 100% 58%;--sf: 195 80% 56%;--af: 276 74% 57%;--nf: 57 100% 10%;--b2: 56 100% 45%;--b3: 56 100% 41%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--bc: 56 100% 10%;--pc: 345 100% 15%;--sc: 195 100% 14%;--ac: 276 100% 14%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;--p: 345 100% 73%;--s: 195 80% 70%;--a: 276 74% 71%;--n: 57 100% 13%;--nc: 56 100% 50%;--b1: 56 100% 50%;--rounded-box: 0;--rounded-btn: 0;--rounded-badge: 0;--tab-radius: 0}[data-theme=valentine]{color-scheme:light;--pf: 353 74% 54%;--sf: 254 86% 61%;--af: 181 56% 56%;--nf: 336 43% 38%;--b2: 318 46% 80%;--b3: 318 46% 72%;--pc: 353 100% 13%;--sc: 254 100% 15%;--ac: 181 100% 14%;--inc: 221 100% 91%;--suc: 142 100% 87%;--wac: 32 100% 9%;--erc: 0 100% 90%;--rounded-box: 1rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 353 74% 67%;--s: 254 86% 77%;--a: 181 56% 70%;--n: 336 43% 48%;--nc: 318 46% 89%;--b1: 318 46% 89%;--bc: 344 38% 28%;--in: 221 83% 53%;--su: 142 76% 36%;--wa: 32 95% 44%;--er: 0 72% 51%;--rounded-btn: 1.9rem}[data-theme=halloween]{color-scheme:dark;--pf: 32 89% 42%;--sf: 271 46% 34%;--af: 91 100% 26%;--nf: 180 4% 9%;--b2: 0 0% 12%;--b3: 0 0% 10%;--bc: 0 0% 83%;--sc: 271 100% 88%;--ac: 91 100% 7%;--nc: 180 5% 82%;--inc: 221 100% 91%;--suc: 142 100% 87%;--wac: 32 100% 9%;--erc: 0 100% 90%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 32 89% 52%;--pc: 180 7% 8%;--s: 271 46% 42%;--a: 91 100% 33%;--n: 180 4% 11%;--b1: 0 0% 13%;--in: 221 83% 53%;--su: 142 76% 36%;--wa: 32 95% 44%;--er: 0 72% 51%}[data-theme=garden]{color-scheme:light;--pf: 139 16% 34%;--sf: 97 37% 75%;--af: 0 68% 75%;--nf: 0 4% 28%;--b2: 0 4% 82%;--b3: 0 4% 74%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--pc: 139 100% 89%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 139 16% 43%;--s: 97 37% 93%;--sc: 96 32% 15%;--a: 0 68% 94%;--ac: 0 22% 16%;--n: 0 4% 35%;--nc: 0 4% 91%;--b1: 0 4% 91%;--bc: 0 3% 6%}[data-theme=forest]{color-scheme:dark;--pf: 141 72% 34%;--sf: 141 75% 38%;--af: 35 69% 42%;--nf: 0 10% 5%;--b2: 0 12% 7%;--b3: 0 12% 7%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--bc: 0 12% 82%;--sc: 141 100% 10%;--ac: 35 100% 10%;--nc: 0 7% 81%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 141 72% 42%;--pc: 141 100% 88%;--s: 141 75% 48%;--a: 35 69% 52%;--n: 0 10% 6%;--b1: 0 12% 8%;--rounded-btn: 1.9rem}[data-theme=aqua]{color-scheme:dark;--pf: 182 93% 40%;--sf: 274 31% 45%;--af: 47 100% 64%;--nf: 205 54% 40%;--b2: 219 53% 39%;--b3: 219 53% 35%;--bc: 219 100% 89%;--sc: 274 100% 91%;--ac: 47 100% 16%;--nc: 205 100% 90%;--inc: 221 100% 91%;--suc: 142 100% 87%;--wac: 32 100% 9%;--erc: 0 100% 90%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 182 93% 49%;--pc: 181 100% 17%;--s: 274 31% 57%;--a: 47 100% 80%;--n: 205 54% 50%;--b1: 219 53% 43%;--in: 221 83% 53%;--su: 142 76% 36%;--wa: 32 95% 44%;--er: 0 72% 51%}[data-theme=lofi]{color-scheme:light;--pf: 0 0% 4%;--sf: 0 2% 8%;--af: 0 0% 12%;--nf: 0 0% 0%;--btn-text-case: uppercase;--border-btn: 1px;--tab-border: 1px;--p: 0 0% 5%;--pc: 0 0% 100%;--s: 0 2% 10%;--sc: 0 0% 100%;--a: 0 0% 15%;--ac: 0 0% 100%;--n: 0 0% 0%;--nc: 0 0% 100%;--b1: 0 0% 100%;--b2: 0 0% 95%;--b3: 0 2% 90%;--bc: 0 0% 0%;--in: 212 100% 48%;--inc: 0 0% 100%;--su: 137 72% 46%;--suc: 0 0% 100%;--wa: 5 100% 66%;--wac: 0 0% 100%;--er: 325 78% 49%;--erc: 0 0% 100%;--rounded-box: .25rem;--rounded-btn: .125rem;--rounded-badge: .125rem;--animation-btn: 0;--animation-input: 0;--btn-focus-scale: 1;--tab-radius: 0}[data-theme=pastel]{color-scheme:light;--pf: 284 22% 64%;--sf: 352 70% 70%;--af: 158 55% 65%;--nf: 199 44% 49%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--bc: 0 0% 20%;--pc: 284 59% 16%;--sc: 352 100% 18%;--ac: 158 100% 16%;--nc: 199 100% 12%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 284 22% 80%;--s: 352 70% 88%;--a: 158 55% 81%;--n: 199 44% 61%;--b1: 0 0% 100%;--b2: 210 20% 98%;--b3: 216 12% 84%;--rounded-btn: 1.9rem}[data-theme=fantasy]{color-scheme:light;--pf: 296 83% 20%;--sf: 200 100% 30%;--af: 31 94% 41%;--nf: 215 28% 13%;--b2: 0 0% 90%;--b3: 0 0% 81%;--in: 198 93% 60%;--su: 158 64% 52%;--wa: 43 96% 56%;--er: 0 91% 71%;--pc: 296 100% 85%;--sc: 200 100% 87%;--ac: 31 100% 10%;--nc: 215 62% 83%;--inc: 198 100% 12%;--suc: 158 100% 10%;--wac: 43 100% 11%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 296 83% 25%;--s: 200 100% 37%;--a: 31 94% 51%;--n: 215 28% 17%;--b1: 0 0% 100%;--bc: 215 28% 17%}[data-theme=wireframe]{color-scheme:light;--pf: 0 0% 58%;--sf: 0 0% 58%;--af: 0 0% 58%;--nf: 0 0% 74%;--bc: 0 0% 20%;--pc: 0 0% 14%;--sc: 0 0% 14%;--ac: 0 0% 14%;--nc: 0 0% 18%;--inc: 240 100% 90%;--suc: 120 100% 85%;--wac: 60 100% 10%;--erc: 0 100% 90%;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;font-family:Chalkboard,comic sans ms,sanssecondaryerif;--p: 0 0% 72%;--s: 0 0% 72%;--a: 0 0% 72%;--n: 0 0% 92%;--b1: 0 0% 100%;--b2: 0 0% 93%;--b3: 0 0% 87%;--in: 240 100% 50%;--su: 120 100% 25%;--wa: 60 30% 50%;--er: 0 100% 50%;--rounded-box: .2rem;--rounded-btn: .2rem;--rounded-badge: .2rem;--tab-radius: .2rem}[data-theme=black]{color-scheme:dark;--pf: 0 2% 16%;--sf: 0 2% 16%;--af: 0 2% 16%;--bc: 0 0% 80%;--pc: 0 5% 84%;--sc: 0 5% 84%;--ac: 0 5% 84%;--nc: 0 3% 83%;--inc: 240 100% 90%;--suc: 120 100% 85%;--wac: 60 100% 10%;--erc: 0 100% 90%;--border-btn: 1px;--tab-border: 1px;--p: 0 2% 20%;--s: 0 2% 20%;--a: 0 2% 20%;--b1: 0 0% 0%;--b2: 0 0% 5%;--b3: 0 2% 10%;--n: 0 1% 15%;--nf: 0 2% 20%;--in: 240 100% 50%;--su: 120 100% 25%;--wa: 60 100% 50%;--er: 0 100% 50%;--rounded-box: 0;--rounded-btn: 0;--rounded-badge: 0;--animation-btn: 0;--animation-input: 0;--btn-text-case: lowercase;--btn-focus-scale: 1;--tab-radius: 0}[data-theme=luxury]{color-scheme:dark;--pf: 0 0% 80%;--sf: 218 54% 14%;--af: 319 22% 21%;--nf: 270 4% 7%;--pc: 0 0% 20%;--sc: 218 100% 84%;--ac: 319 85% 85%;--inc: 202 100% 14%;--suc: 89 100% 10%;--wac: 54 100% 13%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 0 0% 100%;--s: 218 54% 18%;--a: 319 22% 26%;--n: 270 4% 9%;--nc: 37 67% 58%;--b1: 240 10% 4%;--b2: 270 4% 9%;--b3: 270 2% 18%;--bc: 37 67% 58%;--in: 202 100% 70%;--su: 89 62% 52%;--wa: 54 69% 64%;--er: 0 100% 72%}[data-theme=dracula]{color-scheme:dark;--pf: 326 100% 59%;--sf: 265 89% 62%;--af: 31 100% 57%;--nf: 230 15% 24%;--b2: 231 15% 17%;--b3: 231 15% 15%;--pc: 326 100% 15%;--sc: 265 100% 16%;--ac: 31 100% 14%;--nc: 230 71% 86%;--inc: 191 100% 15%;--suc: 135 100% 13%;--wac: 65 100% 15%;--erc: 0 100% 93%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 326 100% 74%;--s: 265 89% 78%;--a: 31 100% 71%;--n: 230 15% 30%;--b1: 231 15% 18%;--bc: 60 30% 96%;--in: 191 97% 77%;--su: 135 94% 65%;--wa: 65 92% 76%;--er: 0 100% 67%}[data-theme=cmyk]{color-scheme:light;--pf: 203 83% 48%;--sf: 335 78% 48%;--af: 56 100% 48%;--nf: 0 0% 8%;--b2: 0 0% 90%;--b3: 0 0% 81%;--bc: 0 0% 20%;--pc: 203 100% 12%;--sc: 335 100% 92%;--ac: 56 100% 12%;--nc: 0 0% 82%;--inc: 192 100% 10%;--suc: 291 100% 88%;--wac: 25 100% 11%;--erc: 4 100% 91%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 203 83% 60%;--s: 335 78% 60%;--a: 56 100% 60%;--n: 0 0% 10%;--b1: 0 0% 100%;--in: 192 48% 52%;--su: 291 48% 38%;--wa: 25 85% 57%;--er: 4 81% 56%}[data-theme=autumn]{color-scheme:light;--pf: 344 96% 22%;--sf: 0 63% 47%;--af: 27 56% 50%;--nf: 22 17% 35%;--b2: 0 0% 85%;--b3: 0 0% 77%;--bc: 0 0% 19%;--pc: 344 100% 86%;--sc: 0 100% 92%;--ac: 27 100% 13%;--nc: 22 100% 89%;--inc: 187 100% 10%;--suc: 165 100% 9%;--wac: 30 100% 10%;--erc: 354 100% 90%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 344 96% 28%;--s: 0 63% 58%;--a: 27 56% 63%;--n: 22 17% 44%;--b1: 0 0% 95%;--in: 187 48% 50%;--su: 165 34% 43%;--wa: 30 84% 50%;--er: 354 79% 49%}[data-theme=business]{color-scheme:dark;--pf: 210 64% 24%;--sf: 200 13% 44%;--af: 13 80% 48%;--nf: 213 14% 13%;--b2: 0 0% 11%;--b3: 0 0% 10%;--bc: 0 0% 83%;--pc: 210 100% 86%;--sc: 200 100% 11%;--ac: 13 100% 12%;--nc: 213 28% 83%;--inc: 199 100% 88%;--suc: 144 100% 11%;--wac: 39 100% 12%;--erc: 6 100% 89%;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 210 64% 31%;--s: 200 13% 55%;--a: 13 80% 60%;--n: 213 14% 16%;--b1: 0 0% 13%;--in: 199 100% 42%;--su: 144 31% 56%;--wa: 39 64% 60%;--er: 6 56% 43%;--rounded-box: .25rem;--rounded-btn: .125rem;--rounded-badge: .125rem}[data-theme=acid]{color-scheme:light;--pf: 303 100% 40%;--sf: 27 100% 40%;--af: 72 98% 40%;--nf: 238 43% 14%;--b2: 0 0% 88%;--b3: 0 0% 79%;--bc: 0 0% 20%;--pc: 303 100% 90%;--sc: 27 100% 10%;--ac: 72 100% 10%;--nc: 238 99% 83%;--inc: 210 100% 12%;--suc: 149 100% 12%;--wac: 53 100% 11%;--erc: 1 100% 89%;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 303 100% 50%;--s: 27 100% 50%;--a: 72 98% 50%;--n: 238 43% 17%;--b1: 0 0% 98%;--in: 210 92% 58%;--su: 149 50% 58%;--wa: 53 93% 57%;--er: 1 100% 45%;--rounded-box: 1.25rem;--rounded-btn: 1rem;--rounded-badge: 1rem}[data-theme=lemonade]{color-scheme:light;--pf: 89 96% 24%;--sf: 60 81% 44%;--af: 63 80% 71%;--nf: 238 43% 14%;--b2: 0 0% 90%;--b3: 0 0% 81%;--bc: 0 0% 20%;--pc: 89 100% 86%;--sc: 60 100% 11%;--ac: 63 100% 18%;--nc: 238 99% 83%;--inc: 192 79% 17%;--suc: 74 100% 16%;--wac: 50 100% 15%;--erc: 1 100% 17%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 89 96% 31%;--s: 60 81% 55%;--a: 63 80% 88%;--n: 238 43% 17%;--b1: 0 0% 100%;--in: 192 39% 85%;--su: 74 76% 79%;--wa: 50 87% 75%;--er: 1 70% 83%}[data-theme=night]{color-scheme:dark;--pf: 198 93% 48%;--sf: 234 89% 59%;--af: 329 86% 56%;--b2: 222 47% 10%;--b3: 222 47% 9%;--bc: 222 66% 82%;--pc: 198 100% 12%;--sc: 234 100% 15%;--ac: 329 100% 14%;--nc: 217 76% 83%;--inc: 198 100% 10%;--suc: 172 100% 10%;--wac: 41 100% 13%;--erc: 351 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 198 93% 60%;--s: 234 89% 74%;--a: 329 86% 70%;--n: 217 33% 17%;--nf: 217 30% 22%;--b1: 222 47% 11%;--in: 198 90% 48%;--su: 172 66% 50%;--wa: 41 88% 64%;--er: 351 95% 71%}[data-theme=coffee]{color-scheme:dark;--pf: 30 67% 46%;--sf: 182 25% 16%;--af: 194 74% 20%;--nf: 300 20% 5%;--b2: 306 19% 10%;--b3: 306 19% 9%;--pc: 30 100% 12%;--sc: 182 67% 84%;--ac: 194 100% 85%;--nc: 300 14% 81%;--inc: 171 100% 13%;--suc: 93 100% 12%;--wac: 43 100% 14%;--erc: 10 100% 15%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 30 67% 58%;--s: 182 25% 20%;--a: 194 74% 25%;--n: 300 20% 6%;--b1: 306 19% 11%;--bc: 37 8% 42%;--in: 171 37% 67%;--su: 93 25% 62%;--wa: 43 100% 69%;--er: 10 95% 75%}[data-theme=winter]{color-scheme:light;--pf: 212 100% 41%;--sf: 247 47% 35%;--af: 310 49% 42%;--nf: 217 92% 8%;--pc: 212 100% 90%;--sc: 247 100% 89%;--ac: 310 100% 90%;--nc: 217 100% 82%;--inc: 192 100% 16%;--suc: 182 100% 13%;--wac: 32 100% 17%;--erc: 0 100% 14%;--rounded-box: 1rem;--rounded-btn: .5rem;--rounded-badge: 1.9rem;--animation-btn: .25s;--animation-input: .2s;--btn-text-case: uppercase;--btn-focus-scale: .95;--border-btn: 1px;--tab-border: 1px;--tab-radius: .5rem;--p: 212 100% 51%;--s: 247 47% 43%;--a: 310 49% 52%;--n: 217 92% 10%;--b1: 0 0% 100%;--b2: 217 100% 97%;--b3: 219 44% 92%;--bc: 214 30% 32%;--in: 192 93% 78%;--su: 182 47% 66%;--wa: 32 62% 84%;--er: 0 63% 72%}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.alert{display:flex;width:100%;flex-direction:column;align-items:center;justify-content:space-between;gap:1rem;--tw-bg-opacity: 1;background-color:hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity));padding:1rem;border-radius:var(--rounded-box, 1rem)}.alert>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}@media (min-width: 768px){.alert{flex-direction:row}.alert>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}}.alert>:where(*){display:flex;align-items:center;gap:.5rem}.avatar.placeholder>div{display:flex;align-items:center;justify-content:center}.badge{display:inline-flex;align-items:center;justify-content:center;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1);height:1.25rem;font-size:.875rem;line-height:1.25rem;width:-moz-fit-content;width:fit-content;padding-left:.563rem;padding-right:.563rem;border-width:1px;--tw-border-opacity: 1;border-color:hsl(var(--n) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--n) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--nc) / var(--tw-text-opacity));border-radius:var(--rounded-badge, 1.9rem)}.btn{display:inline-flex;flex-shrink:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-wrap:wrap;align-items:center;justify-content:center;border-color:transparent;border-color:hsl(var(--n) / var(--tw-border-opacity));text-align:center;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1);border-radius:var(--rounded-btn, .5rem);height:3rem;padding-left:1rem;padding-right:1rem;font-size:.875rem;line-height:1.25rem;line-height:1em;min-height:3rem;font-weight:600;text-transform:uppercase;text-transform:var(--btn-text-case, uppercase);text-decoration-line:none;border-width:var(--border-btn, 1px);animation:button-pop var(--animation-btn, .25s) ease-out;--tw-border-opacity: 1;--tw-bg-opacity: 1;background-color:hsl(var(--n) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--nc) / var(--tw-text-opacity))}.btn-disabled,.btn[disabled],.btn.loading,.btn.loading:hover{pointer-events:none}.btn.loading:before{margin-right:.5rem;height:1rem;width:1rem;border-radius:9999px;border-width:2px;animation:spin 2s linear infinite;content:"";border-top-color:transparent;border-left-color:transparent;border-bottom-color:currentColor;border-right-color:currentColor}@media (prefers-reduced-motion: reduce){.btn.loading:before{animation:spin 10s linear infinite}}@keyframes spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.btn-group{display:inline-flex}.btn-group>input[type=radio].btn{-webkit-appearance:none;-moz-appearance:none;appearance:none}.btn-group>input[type=radio].btn:before{content:attr(data-title)}.card{position:relative;display:flex;flex-direction:column;border-radius:var(--rounded-box, 1rem)}.card:focus{outline:2px solid transparent;outline-offset:2px}.card-body{display:flex;flex:1 1 auto;flex-direction:column;padding:var(--padding-card, 2rem);gap:.5rem}.card-body :where(p){flex-grow:1}.card figure{display:flex;align-items:center;justify-content:center}.card.image-full{display:grid}.card.image-full:before{position:relative;content:"";z-index:10;--tw-bg-opacity: 1;background-color:hsl(var(--n) / var(--tw-bg-opacity));opacity:.75;border-radius:var(--rounded-box, 1rem)}.card.image-full:before,.card.image-full>*{grid-column-start:1;grid-row-start:1}.card.image-full>figure img{height:100%;-o-object-fit:cover;object-fit:cover}.card.image-full>.card-body{position:relative;z-index:20;--tw-text-opacity: 1;color:hsl(var(--nc) / var(--tw-text-opacity))}.checkbox{flex-shrink:0;--chkbg: var(--bc);--chkfg: var(--b1);height:1.5rem;width:1.5rem;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-width:1px;border-color:hsl(var(--bc) / var(--tw-border-opacity));--tw-border-opacity: .2;border-radius:var(--rounded-btn, .5rem)}.divider{display:flex;flex-direction:row;align-items:center;align-self:stretch;margin-top:1rem;margin-bottom:1rem;height:1rem;white-space:nowrap}.divider:before,.divider:after{content:"";flex-grow:1;height:.125rem;width:100%}.dropdown{position:relative;display:inline-block}.dropdown>*:focus{outline:2px solid transparent;outline-offset:2px}.dropdown .dropdown-content{visibility:hidden;position:absolute;z-index:50;opacity:0;transform-origin:top;--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.dropdown-end .dropdown-content{right:0px}.dropdown-left .dropdown-content{top:0px;right:100%;bottom:auto;transform-origin:right}.dropdown-right .dropdown-content{left:100%;top:0px;bottom:auto;transform-origin:left}.dropdown-bottom .dropdown-content{bottom:auto;top:100%;transform-origin:top}.dropdown-top .dropdown-content{bottom:100%;top:auto;transform-origin:bottom}.dropdown-end.dropdown-right .dropdown-content,.dropdown-end.dropdown-left .dropdown-content{bottom:0px;top:auto}.dropdown.dropdown-open .dropdown-content,.dropdown.dropdown-hover:hover .dropdown-content,.dropdown:not(.dropdown-hover):focus .dropdown-content,.dropdown:not(.dropdown-hover):focus-within .dropdown-content{visibility:visible;opacity:1}.form-control{display:flex;flex-direction:column}.label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;justify-content:space-between;padding:.5rem .25rem}.input{flex-shrink:1;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1);height:3rem;padding-left:1rem;padding-right:1rem;font-size:1rem;line-height:2;line-height:1.5rem;border-width:1px;border-color:hsl(var(--bc) / var(--tw-border-opacity));--tw-border-opacity: 0;--tw-bg-opacity: 1;background-color:hsl(var(--b1) / var(--tw-bg-opacity));border-radius:var(--rounded-btn, .5rem)}.input-group{display:flex;width:100%;align-items:stretch}.input-group>.input{isolation:isolate}.input-group>*,.input-group>.input,.input-group>.select{border-radius:0}.input-group-sm{font-size:.875rem;line-height:2rem}.input-group :where(span){display:flex;align-items:center;--tw-bg-opacity: 1;background-color:hsl(var(--b3, var(--b2)) / var(--tw-bg-opacity));padding-left:1rem;padding-right:1rem}.input-group>:first-child{border-top-left-radius:var(--rounded-btn, .5rem);border-top-right-radius:0;border-bottom-left-radius:var(--rounded-btn, .5rem);border-bottom-right-radius:0}.input-group>:last-child{border-top-left-radius:0;border-top-right-radius:var(--rounded-btn, .5rem);border-bottom-left-radius:0;border-bottom-right-radius:var(--rounded-btn, .5rem)}.menu{display:flex;flex-direction:column;flex-wrap:wrap}.menu.horizontal{display:inline-flex;flex-direction:row}.menu.horizontal :where(li){flex-direction:row}.menu :where(li){position:relative;display:flex;flex-shrink:0;flex-direction:column;flex-wrap:wrap;align-items:stretch}.menu :where(li:not(.menu-title))>:where(*:not(ul)){display:flex}.menu :where(li:not(.disabled):not(.menu-title))>:where(*:not(ul)){cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;outline:2px solid transparent;outline-offset:2px}.menu>:where(li > *:not(ul):focus){outline:2px solid transparent;outline-offset:2px}.menu>:where(li.disabled > *:not(ul):focus){cursor:auto}.menu>:where(li) :where(ul){display:flex;flex-direction:column;align-items:stretch}.menu>:where(li)>:where(ul){position:absolute;display:none;top:initial;left:100%;border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.menu>:where(li:hover)>:where(ul){display:flex}.menu>:where(li:focus)>:where(ul){display:flex}.navbar{display:flex;align-items:center;padding:var(--navbar-padding, .5rem);min-height:4rem;width:100%}:where(.navbar > *){display:inline-flex;align-items:center}.navbar-start{width:50%;justify-content:flex-start}.navbar-center{flex-shrink:0}.navbar-end{width:50%;justify-content:flex-end}.select{display:inline-flex;flex-shrink:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:3rem;padding-left:1rem;padding-right:2.5rem;font-size:.875rem;line-height:1.25rem;line-height:2;min-height:3rem;border-width:1px;border-color:hsl(var(--bc) / var(--tw-border-opacity));--tw-border-opacity: 0;--tw-bg-opacity: 1;background-color:hsl(var(--b1) / var(--tw-bg-opacity));font-weight:600;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1);border-radius:var(--rounded-btn, .5rem);background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);background-position:calc(100% - 20px) calc(1px + 50%),calc(100% - 16px) calc(1px + 50%);background-size:4px 4px,4px 4px;background-repeat:no-repeat}.select[multiple]{height:auto}.stack{display:inline-grid;place-items:center;align-items:flex-end}.stack>*{grid-column-start:1;grid-row-start:1;transform:translateY(10%) scale(.9);z-index:1;width:100%;opacity:.6}.stack>*:nth-child(2){transform:translateY(5%) scale(.95);z-index:2;opacity:.8}.stack>*:nth-child(1){transform:translateY(0) scale(1);z-index:3;opacity:1}.stats{display:inline-grid;--tw-bg-opacity: 1;background-color:hsl(var(--b1) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity));border-radius:var(--rounded-box, 1rem)}:where(.stats){grid-auto-flow:column;overflow-x:auto}.stat{display:inline-grid;width:100%;grid-template-columns:repeat(1,1fr);-moz-column-gap:1rem;column-gap:1rem;border-color:hsl(var(--bc) / var(--tw-border-opacity));--tw-border-opacity: .1;padding:1rem 1.5rem}.stat-title{grid-column-start:1;white-space:nowrap;opacity:.6}.stat-value{grid-column-start:1;white-space:nowrap;font-size:2.25rem;line-height:2.5rem;font-weight:800}.steps .step{display:grid;grid-template-columns:repeat(1,minmax(0,1fr));grid-template-columns:auto;grid-template-rows:repeat(2,minmax(0,1fr));grid-template-rows:40px 1fr;place-items:center;text-align:center;min-width:4rem}.tabs{display:flex;flex-wrap:wrap;align-items:flex-end}.tab{position:relative;display:inline-flex;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;flex-wrap:wrap;align-items:center;justify-content:center;text-align:center;height:2rem;font-size:.875rem;line-height:1.25rem;line-height:2;--tab-padding: 1rem;--tw-text-opacity: .5;--tab-color: hsla(var(--bc) / var(--tw-text-opacity, 1));--tab-bg: hsla(var(--b1) / var(--tw-bg-opacity, 1));--tab-border-color: hsla(var(--b3) / var(--tw-bg-opacity, 1));color:var(--tab-color);padding-left:var(--tab-padding, 1rem);padding-right:var(--tab-padding, 1rem)}.table{position:relative;text-align:left}.table th:first-child{position:sticky;position:-webkit-sticky;left:0px;z-index:11}.toggle{flex-shrink:0;--tglbg: hsl(var(--b1));--handleoffset: 1.5rem;--handleoffsetcalculator: calc(var(--handleoffset) * -1);--togglehandleborder: 0 0;height:1.5rem;width:3rem;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-width:1px;border-color:hsl(var(--bc) / var(--tw-border-opacity));--tw-border-opacity: .2;background-color:hsl(var(--bc) / var(--tw-bg-opacity));--tw-bg-opacity: .5;transition-duration:.3s;transition-timing-function:cubic-bezier(.4,0,.2,1);border-radius:var(--rounded-badge, 1.9rem);transition:background,box-shadow var(--animation-input, .2s) ease-in-out;box-shadow:var(--handleoffsetcalculator) 0 0 2px var(--tglbg) inset,0 0 0 2px var(--tglbg) inset,var(--togglehandleborder)}.tooltip{position:relative;display:inline-block;--tooltip-offset: calc(100% + 1px + var(--tooltip-tail, 0px));text-align:center;--tooltip-tail: 3px;--tooltip-color: hsl(var(--n));--tooltip-text-color: hsl(var(--nc));--tooltip-tail-offset: calc(100% + 1px - var(--tooltip-tail))}.tooltip:before{position:absolute;pointer-events:none;content:attr(data-tip);max-width:20rem;border-radius:.25rem;padding:.25rem .5rem;font-size:.875rem;line-height:1.25rem;background-color:var(--tooltip-color);color:var(--tooltip-text-color);width:-moz-max-content;width:max-content}.tooltip:before,.tooltip-top:before{transform:translate(-50%);top:auto;left:50%;right:auto;bottom:var(--tooltip-offset)}.badge-primary{--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--p) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.badge-ghost{--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity))}.badge-outline{border-color:currentColor;--tw-border-opacity: .5;background-color:transparent;color:currentColor}.badge-outline.badge-primary{--tw-text-opacity: 1;color:hsl(var(--p) / var(--tw-text-opacity))}.badge-outline.badge-secondary{--tw-text-opacity: 1;color:hsl(var(--s) / var(--tw-text-opacity))}.badge-outline.badge-accent{--tw-text-opacity: 1;color:hsl(var(--a) / var(--tw-text-opacity))}.badge-outline.badge-info{--tw-text-opacity: 1;color:hsl(var(--in) / var(--tw-text-opacity))}.badge-outline.badge-success{--tw-text-opacity: 1;color:hsl(var(--su) / var(--tw-text-opacity))}.badge-outline.badge-warning{--tw-text-opacity: 1;color:hsl(var(--wa) / var(--tw-text-opacity))}.badge-outline.badge-error{--tw-text-opacity: 1;color:hsl(var(--er) / var(--tw-text-opacity))}.btn-outline .badge{--tw-border-opacity: 1;border-color:hsl(var(--nf, var(--n)) / var(--tw-border-opacity));--tw-text-opacity: 1;color:hsl(var(--nc) / var(--tw-text-opacity))}.btn-outline.btn-primary .badge{--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--p) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.btn-outline.btn-secondary .badge{--tw-border-opacity: 1;border-color:hsl(var(--s) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--s) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--sc) / var(--tw-text-opacity))}.btn-outline.btn-accent .badge{--tw-border-opacity: 1;border-color:hsl(var(--a) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--a) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--ac) / var(--tw-text-opacity))}.btn-outline .badge.outline{--tw-border-opacity: 1;border-color:hsl(var(--nf, var(--n)) / var(--tw-border-opacity));background-color:transparent}.btn-outline.btn-primary .badge-outline{--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity));background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--p) / var(--tw-text-opacity))}.btn-outline.btn-secondary .badge-outline{--tw-border-opacity: 1;border-color:hsl(var(--s) / var(--tw-border-opacity));background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--s) / var(--tw-text-opacity))}.btn-outline.btn-accent .badge-outline{--tw-border-opacity: 1;border-color:hsl(var(--a) / var(--tw-border-opacity));background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--a) / var(--tw-text-opacity))}.btn-outline.btn-info .badge-outline{--tw-border-opacity: 1;border-color:hsl(var(--in) / var(--tw-border-opacity));background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--in) / var(--tw-text-opacity))}.btn-outline.btn-success .badge-outline{--tw-border-opacity: 1;border-color:hsl(var(--su) / var(--tw-border-opacity));background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--su) / var(--tw-text-opacity))}.btn-outline.btn-warning .badge-outline{--tw-border-opacity: 1;border-color:hsl(var(--wa) / var(--tw-border-opacity));background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--wa) / var(--tw-text-opacity))}.btn-outline.btn-error .badge-outline{--tw-border-opacity: 1;border-color:hsl(var(--er) / var(--tw-border-opacity));background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--er) / var(--tw-text-opacity))}.btn-outline:hover .badge{--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity))}.btn-outline:hover .badge.outline{--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity));--tw-text-opacity: 1;color:hsl(var(--nc) / var(--tw-text-opacity))}.btn-outline.btn-primary:hover .badge{--tw-border-opacity: 1;border-color:hsl(var(--pc) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--pc) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--p) / var(--tw-text-opacity))}.btn-outline.btn-primary:hover .badge.outline{--tw-border-opacity: 1;border-color:hsl(var(--pc) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--pf, var(--p)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.btn-outline.btn-secondary:hover .badge{--tw-border-opacity: 1;border-color:hsl(var(--sc) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--sc) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--s) / var(--tw-text-opacity))}.btn-outline.btn-secondary:hover .badge.outline{--tw-border-opacity: 1;border-color:hsl(var(--sc) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--sf, var(--s)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--sc) / var(--tw-text-opacity))}.btn-outline.btn-accent:hover .badge{--tw-border-opacity: 1;border-color:hsl(var(--ac) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--ac) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--a) / var(--tw-text-opacity))}.btn-outline.btn-accent:hover .badge.outline{--tw-border-opacity: 1;border-color:hsl(var(--ac) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--af, var(--a)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--ac) / var(--tw-text-opacity))}.btm-nav>*:where(.active){border-top-width:2px;--tw-bg-opacity: 1;background-color:hsl(var(--b1) / var(--tw-bg-opacity))}{border-top-width:2px!important;--tw-bg-opacity: 1 !important;background-color:hsl(var(--b1) / var(--tw-bg-opacity))!important}.btm-nav>* .label{font-size:1rem;line-height:1.5rem}.btn:active:hover,.btn:active:focus{animation:none;transform:scale(var(--btn-focus-scale, .95))}.btn:hover,.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--nf, var(--n)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--nf, var(--n)) / var(--tw-bg-opacity))}.btn:focus-visible{outline:2px solid hsl(var(--nf));outline-offset:2px}.btn-primary{--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--p) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.btn-primary:hover,.btn-primary.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--pf, var(--p)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--pf, var(--p)) / var(--tw-bg-opacity))}.btn-primary:focus-visible{outline:2px solid hsl(var(--p))}.btn-error{--tw-border-opacity: 1;border-color:hsl(var(--er) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--er) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--erc, var(--nc)) / var(--tw-text-opacity))}.btn-error:hover,.btn-error.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--er) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--er) / var(--tw-bg-opacity))}.btn-error:focus-visible{outline:2px solid hsl(var(--er))}.btn.glass:hover,.btn.glass.btn-active{--glass-opacity: 25%;--glass-border-opacity: 15%}.btn.glass:focus-visible{outline:2px solid currentColor}.btn-ghost{border-width:1px;border-color:transparent;background-color:transparent;color:currentColor}.btn-ghost:hover,.btn-ghost.btn-active{--tw-border-opacity: 0;background-color:hsl(var(--bc) / var(--tw-bg-opacity));--tw-bg-opacity: .2}.btn-ghost:focus-visible{outline:2px solid currentColor}.btn-outline{border-color:currentColor;background-color:transparent;--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity))}.btn-outline:hover,.btn-outline.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--bc) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--bc) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--b1) / var(--tw-text-opacity))}.btn-outline.btn-primary{--tw-text-opacity: 1;color:hsl(var(--p) / var(--tw-text-opacity))}.btn-outline.btn-primary:hover,.btn-outline.btn-primary.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--pf, var(--p)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--pf, var(--p)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.btn-outline.btn-secondary{--tw-text-opacity: 1;color:hsl(var(--s) / var(--tw-text-opacity))}.btn-outline.btn-secondary:hover,.btn-outline.btn-secondary.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--sf, var(--s)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--sf, var(--s)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--sc) / var(--tw-text-opacity))}.btn-outline.btn-accent{--tw-text-opacity: 1;color:hsl(var(--a) / var(--tw-text-opacity))}.btn-outline.btn-accent:hover,.btn-outline.btn-accent.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--af, var(--a)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--af, var(--a)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--ac) / var(--tw-text-opacity))}.btn-outline.btn-success{--tw-text-opacity: 1;color:hsl(var(--su) / var(--tw-text-opacity))}.btn-outline.btn-success:hover,.btn-outline.btn-success.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--su) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--su) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--suc, var(--nc)) / var(--tw-text-opacity))}.btn-outline.btn-info{--tw-text-opacity: 1;color:hsl(var(--in) / var(--tw-text-opacity))}.btn-outline.btn-info:hover,.btn-outline.btn-info.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--in) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--in) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--inc, var(--nc)) / var(--tw-text-opacity))}.btn-outline.btn-warning{--tw-text-opacity: 1;color:hsl(var(--wa) / var(--tw-text-opacity))}.btn-outline.btn-warning:hover,.btn-outline.btn-warning.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--wa) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--wa) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--wac, var(--nc)) / var(--tw-text-opacity))}.btn-outline.btn-error{--tw-text-opacity: 1;color:hsl(var(--er) / var(--tw-text-opacity))}.btn-outline.btn-error:hover,.btn-outline.btn-error.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--er) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--er) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--erc, var(--nc)) / var(--tw-text-opacity))}.btn-disabled,.btn-disabled:hover,.btn[disabled],.btn[disabled]:hover{--tw-border-opacity: 0;background-color:hsl(var(--n) / var(--tw-bg-opacity));--tw-bg-opacity: .2;color:hsl(var(--bc) / var(--tw-text-opacity));--tw-text-opacity: .2}.btn.loading.btn-square:before,.btn.loading.btn-circle:before{margin-right:0}.btn.loading.btn-xl:before,.btn.loading.btn-lg:before{height:1.25rem;width:1.25rem}.btn.loading.btn-sm:before,.btn.loading.btn-xs:before{height:.75rem;width:.75rem}.btn-group>input[type=radio]:checked.btn,.btn-group>.btn-active{--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--p) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.btn-group>input[type=radio]:checked.btn:focus-visible,.btn-group>.btn-active:focus-visible{outline:2px solid hsl(var(--p))}@keyframes button-pop{0%{transform:scale(var(--btn-focus-scale, .95))}40%{transform:scale(1.02)}to{transform:scale(1)}}.card :where(figure:first-child){overflow:hidden;border-start-start-radius:inherit;border-start-end-radius:inherit;border-end-start-radius:unset;border-end-end-radius:unset}.card :where(figure:last-child){overflow:hidden;border-start-start-radius:unset;border-start-end-radius:unset;border-end-start-radius:inherit;border-end-end-radius:inherit}.card:focus-visible{outline:2px solid currentColor;outline-offset:2px}.card.bordered{border-width:1px;--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity))}.card.compact .card-body{padding:1rem;font-size:.875rem;line-height:1.25rem}.card.image-full :where(figure){overflow:hidden;border-radius:inherit}.checkbox:focus-visible{outline:2px solid hsl(var(--bc));outline-offset:2px}.checkbox:checked,.checkbox[checked=true],.checkbox[aria-checked=true]{--tw-bg-opacity: 1;background-color:hsl(var(--bc) / var(--tw-bg-opacity));background-repeat:no-repeat;animation:checkmark var(--animation-input, .2s) ease-in-out;background-image:linear-gradient(-45deg,transparent 65%,hsl(var(--chkbg)) 65.99%),linear-gradient(45deg,transparent 75%,hsl(var(--chkbg)) 75.99%),linear-gradient(-45deg,hsl(var(--chkbg)) 40%,transparent 40.99%),linear-gradient(45deg,hsl(var(--chkbg)) 30%,hsl(var(--chkfg)) 30.99%,hsl(var(--chkfg)) 40%,transparent 40.99%),linear-gradient(-45deg,hsl(var(--chkfg)) 50%,hsl(var(--chkbg)) 50.99%)}.checkbox:indeterminate{--tw-bg-opacity: 1;background-color:hsl(var(--bc) / var(--tw-bg-opacity));background-repeat:no-repeat;animation:checkmark var(--animation-input, .2s) ease-in-out;background-image:linear-gradient(90deg,transparent 80%,hsl(var(--chkbg)) 80%),linear-gradient(-90deg,transparent 80%,hsl(var(--chkbg)) 80%),linear-gradient(0deg,hsl(var(--chkbg)) 43%,hsl(var(--chkfg)) 43%,hsl(var(--chkfg)) 57%,hsl(var(--chkbg)) 57%)}.checkbox:disabled{cursor:not-allowed;border-color:transparent;--tw-bg-opacity: 1;background-color:hsl(var(--bc) / var(--tw-bg-opacity));opacity:.2}@keyframes checkmark{0%{background-position-y:5px}50%{background-position-y:-2px}to{background-position-y:0}}[dir=rtl] .checkbox:checked,[dir=rtl] .checkbox[checked=true],[dir=rtl] .checkbox[aria-checked=true]{background-image:linear-gradient(45deg,transparent 65%,hsl(var(--chkbg)) 65.99%),linear-gradient(-45deg,transparent 75%,hsl(var(--chkbg)) 75.99%),linear-gradient(45deg,hsl(var(--chkbg)) 40%,transparent 40.99%),linear-gradient(-45deg,hsl(var(--chkbg)) 30%,hsl(var(--chkfg)) 30.99%,hsl(var(--chkfg)) 40%,transparent 40.99%),linear-gradient(45deg,hsl(var(--chkfg)) 50%,hsl(var(--chkbg)) 50.99%)}.divider:before{background-color:hsl(var(--bc) / var(--tw-bg-opacity));--tw-bg-opacity: .1}.divider:after{background-color:hsl(var(--bc) / var(--tw-bg-opacity));--tw-bg-opacity: .1}.divider:not(:empty){gap:1rem}.drawer-toggle:focus-visible~.drawer-content .drawer-button.btn-primary{outline:2px solid hsl(var(--p))}.drawer-toggle:focus-visible~.drawer-content .drawer-button.btn-error{outline:2px solid hsl(var(--er))}.drawer-toggle:focus-visible~.drawer-content .drawer-button.btn-ghost{outline:2px solid currentColor}.dropdown.dropdown-open .dropdown-content,.dropdown.dropdown-hover:hover .dropdown-content,.dropdown:focus .dropdown-content,.dropdown:focus-within .dropdown-content{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.label-text{font-size:.875rem;line-height:1.25rem;--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity))}.label a:hover{--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity))}.input[list]::-webkit-calendar-picker-indicator{line-height:1em}.input-bordered{--tw-border-opacity: .2}.input:focus{outline:2px solid hsla(var(--bc) / .2);outline-offset:2px}.input-disabled,.input[disabled]{cursor:not-allowed;--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity));--tw-text-opacity: .2}.input-disabled::-moz-placeholder,.input[disabled]::-moz-placeholder{color:hsl(var(--bc) / var(--tw-placeholder-opacity));--tw-placeholder-opacity: .2}.input-disabled::placeholder,.input[disabled]::placeholder{color:hsl(var(--bc) / var(--tw-placeholder-opacity));--tw-placeholder-opacity: .2}.menu.horizontal li.bordered>a,.menu.horizontal li.bordered>button,.menu.horizontal li.bordered>span{border-left-width:0px;border-bottom-width:4px;--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity))}.menu[class*=" px-"]:not(.menu[class*=" px-0"]) li>*,.menu[class^=px-]:not(.menu[class^="px-0"]) li>*,.menu[class*=" p-"]:not(.menu[class*=" p-0"]) li>*,.menu[class^=p-]:not(.menu[class^="p-0"]) li>*{border-radius:var(--rounded-btn, .5rem)}.menu :where(li.bordered > *){border-left-width:4px;--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity))}.menu :where(li)>:where(*:not(ul)){gap:.75rem;padding:.75rem 1rem;color:currentColor}.menu :where(li:not(.menu-title):not(:empty))>:where(*:not(ul):focus),.menu :where(li:not(.menu-title):not(:empty))>:where(*:not(ul):hover){background-color:hsl(var(--bc) / var(--tw-bg-opacity));--tw-bg-opacity: .1}.menu :where(li:not(.menu-title):not(:empty))>:where(:not(ul).active),.menu :where(li:not(.menu-title):not(:empty))>:where(*:not(ul):active){--tw-bg-opacity: 1;background-color:hsl(var(--p) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}{--tw-bg-opacity: 1 !important;background-color:hsl(var(--p) / var(--tw-bg-opacity))!important;--tw-text-opacity: 1 !important;color:hsl(var(--pc) / var(--tw-text-opacity))!important}.menu :where(li:empty){margin:.5rem 1rem;height:1px;background-color:hsl(var(--bc) / var(--tw-bg-opacity));--tw-bg-opacity: .1}.menu li.disabled>*{-webkit-user-select:none;-moz-user-select:none;user-select:none;color:hsl(var(--bc) / var(--tw-text-opacity));--tw-text-opacity: .2}.menu li.disabled>*:hover{background-color:transparent}.menu li.hover-bordered a{border-left-width:4px;border-color:transparent}.menu li.hover-bordered a:hover{--tw-border-opacity: 1;border-color:hsl(var(--p) / var(--tw-border-opacity))}.menu.compact li>a,.menu.compact li>span{padding-top:.5rem;padding-bottom:.5rem;font-size:.875rem;line-height:1.25rem}.menu .menu-title>*{padding-top:.25rem;padding-bottom:.25rem;font-size:.75rem;line-height:1rem;font-weight:700;color:hsl(var(--bc) / var(--tw-text-opacity));--tw-text-opacity: .4}.menu :where(li:not(.disabled))>:where(*:not(ul)){outline:2px solid transparent;outline-offset:2px;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.menu>:where(li:first-child){border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:unset;border-bottom-left-radius:unset}.menu>:where(li:first-child)>:where(:not(ul)){border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:unset;border-bottom-left-radius:unset}.menu>:where(li:last-child){border-top-left-radius:unset;border-top-right-radius:unset;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.menu>:where(li:last-child)>:where(:not(ul)){border-top-left-radius:unset;border-top-right-radius:unset;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.menu>:where(li)>:where(ul) :where(li){width:100%;white-space:nowrap}.menu>:where(li)>:where(ul) :where(li) :where(ul){padding-left:1rem}.menu>:where(li)>:where(ul) :where(li)>:where(:not(ul)){width:100%;white-space:nowrap}.menu>:where(li)>:where(ul)>:where(li:first-child){border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:unset;border-bottom-left-radius:unset}.menu>:where(li)>:where(ul)>:where(li:first-child)>:where(:not(ul)){border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:unset;border-bottom-left-radius:unset}.menu>:where(li)>:where(ul)>:where(li:last-child){border-top-left-radius:unset;border-top-right-radius:unset;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.menu>:where(li)>:where(ul)>:where(li:last-child)>:where(:not(ul)){border-top-left-radius:unset;border-top-right-radius:unset;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}@keyframes progress-loading{50%{left:107%}}@keyframes radiomark{0%{box-shadow:0 0 0 12px hsl(var(--b1)) inset,0 0 0 12px hsl(var(--b1)) inset}50%{box-shadow:0 0 0 3px hsl(var(--b1)) inset,0 0 0 3px hsl(var(--b1)) inset}to{box-shadow:0 0 0 4px hsl(var(--b1)) inset,0 0 0 4px hsl(var(--b1)) inset}}@keyframes rating-pop{0%{transform:translateY(-.125em)}40%{transform:translateY(-.125em)}to{transform:translateY(0)}}.select:focus{outline:2px solid hsla(var(--bc) / .2);outline-offset:2px}.select-disabled,.select[disabled]{cursor:not-allowed;--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity));--tw-text-opacity: .2}.select-disabled::-moz-placeholder,.select[disabled]::-moz-placeholder{color:hsl(var(--bc) / var(--tw-placeholder-opacity));--tw-placeholder-opacity: .2}.select-disabled::placeholder,.select[disabled]::placeholder{color:hsl(var(--bc) / var(--tw-placeholder-opacity));--tw-placeholder-opacity: .2}.select-multiple,.select[multiple],.select[size].select:not([size="1"]){background-image:none;padding-right:1rem}:where(.stats)>:not([hidden])~:not([hidden]){--tw-divide-x-reverse: 0;border-right-width:calc(1px * var(--tw-divide-x-reverse));border-left-width:calc(1px * calc(1 - var(--tw-divide-x-reverse)));--tw-divide-y-reverse: 0;border-top-width:calc(0px * calc(1 - var(--tw-divide-y-reverse)));border-bottom-width:calc(0px * var(--tw-divide-y-reverse))}.steps .step:before{top:0px;grid-column-start:1;grid-row-start:1;height:.5rem;width:100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));--tw-bg-opacity: 1;background-color:hsl(var(--b3, var(--b2)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity));content:"";margin-left:-100%}.steps .step:after{content:counter(step);counter-increment:step;z-index:1;position:relative;grid-column-start:1;grid-row-start:1;display:grid;height:2rem;width:2rem;place-items:center;place-self:center;border-radius:9999px;--tw-bg-opacity: 1;background-color:hsl(var(--b3, var(--b2)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity))}.steps .step:first-child:before{content:none}.steps .step[data-content]:after{content:attr(data-content)}.tab:hover{--tw-text-opacity: 1}.tab.tab-active{border-color:hsl(var(--bc) / var(--tw-border-opacity));--tw-border-opacity: 1;--tw-text-opacity: 1}.tab:focus{outline:2px solid transparent;outline-offset:2px}.tab:focus-visible{outline:2px solid currentColor;outline-offset:-3px}.tab:focus-visible.tab-lifted{border-bottom-right-radius:var(--tab-radius, .5rem);border-bottom-left-radius:var(--tab-radius, .5rem)}.table :where(th,td){white-space:nowrap;padding:1rem;vertical-align:middle}.table tr.active th,.table tr.active td,.table tr.active:nth-child(even) th,.table tr.active:nth-child(even) td{--tw-bg-opacity: 1;background-color:hsl(var(--b3, var(--b2)) / var(--tw-bg-opacity))}.table tr.\!active th,.table tr.\!active td,.table tr.\!active:nth-child(even) th,.table tr.\!active:nth-child(even) td{--tw-bg-opacity: 1 !important;background-color:hsl(var(--b3, var(--b2)) / var(--tw-bg-opacity))!important}.table tr.hover:hover th,.table tr.hover:hover td,.table tr.hover:nth-child(even):hover th,.table tr.hover:nth-child(even):hover td{--tw-bg-opacity: 1;background-color:hsl(var(--b3, var(--b2)) / var(--tw-bg-opacity))}.table:where(:not(.table-zebra)) :where(thead,tbody,tfoot) :where(tr:not(:last-child) :where(th,td)){border-bottom-width:1px;--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity))}.table :where(thead,tfoot) :where(th,td){--tw-bg-opacity: 1;background-color:hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity));font-size:.75rem;line-height:1rem;font-weight:700;text-transform:uppercase}.table :where(tbody th,tbody td){--tw-bg-opacity: 1;background-color:hsl(var(--b1) / var(--tw-bg-opacity))}:where(.table *:first-child) :where(*:first-child) :where(th,td):first-child{border-top-left-radius:.5rem}:where(.table *:first-child) :where(*:first-child) :where(th,td):last-child{border-top-right-radius:.5rem}:where(.table *:last-child) :where(*:last-child) :where(th,td):first-child{border-bottom-left-radius:.5rem}:where(.table *:last-child) :where(*:last-child) :where(th,td):last-child{border-bottom-right-radius:.5rem}@keyframes toast-pop{0%{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}[dir=rtl] .toggle{--handleoffsetcalculator: calc(var(--handleoffset) * 1)}.toggle:focus-visible{outline:2px solid hsl(var(--bc));outline-offset:2px}.toggle:checked,.toggle[checked=true],.toggle[aria-checked=true]{--handleoffsetcalculator: var(--handleoffset);--tw-border-opacity: 1;--tw-bg-opacity: 1}[dir=rtl] .toggle:checked,[dir=rtl] .toggle[checked=true],[dir=rtl] .toggle[aria-checked=true]{--handleoffsetcalculator: calc(var(--handleoffset) * -1)}.toggle:indeterminate{--tw-border-opacity: 1;--tw-bg-opacity: 1;box-shadow:calc(var(--handleoffset) / 2) 0 0 2px var(--tglbg) inset,calc(var(--handleoffset) / -2) 0 0 2px var(--tglbg) inset,0 0 0 2px var(--tglbg) inset}[dir=rtl] .toggle:indeterminate{box-shadow:calc(var(--handleoffset) / 2) 0 0 2px var(--tglbg) inset,calc(var(--handleoffset) / -2) 0 0 2px var(--tglbg) inset,0 0 0 2px var(--tglbg) inset}.toggle:disabled{cursor:not-allowed;--tw-border-opacity: 1;border-color:hsl(var(--bc) / var(--tw-border-opacity));background-color:transparent;opacity:.3;--togglehandleborder: 0 0 0 3px hsl(var(--bc)) inset, var(--handleoffsetcalculator) 0 0 3px hsl(var(--bc)) inset}.tooltip:before,.tooltip:after{opacity:0;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-delay:.1s;transition-duration:.2s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.tooltip:after{position:absolute;content:"";border-style:solid;border-width:var(--tooltip-tail, 0);width:0;height:0;display:block}.tooltip.tooltip-open:before,.tooltip.tooltip-open:after,.tooltip:hover:before,.tooltip:hover:after{opacity:1;transition-delay:75ms}.tooltip:after,.tooltip-top:after{transform:translate(-50%);border-color:var(--tooltip-color) transparent transparent transparent;top:auto;left:50%;right:auto;bottom:var(--tooltip-tail-offset)}.rounded-box{border-radius:var(--rounded-box, 1rem)}.badge-sm{height:1rem;font-size:.75rem;line-height:1rem;padding-left:.438rem;padding-right:.438rem}.btm-nav-xs>*:where(.active){border-top-width:1px}{border-top-width:1px!important}.btm-nav-sm>*:where(.active){border-top-width:2px}{border-top-width:2px!important}.btm-nav-md>*:where(.active){border-top-width:2px}{border-top-width:2px!important}.btm-nav-lg>*:where(.active){border-top-width:4px}{border-top-width:4px!important}.btn-xs{height:1.5rem;padding-left:.5rem;padding-right:.5rem;min-height:1.5rem;font-size:.75rem}.btn-sm{height:2rem;padding-left:.75rem;padding-right:.75rem;min-height:2rem;font-size:.875rem}.btn-square:where(.btn-xs){height:1.5rem;width:1.5rem;padding:0}.btn-square:where(.btn-sm){height:2rem;width:2rem;padding:0}.btn-circle:where(.btn-xs){height:1.5rem;width:1.5rem;border-radius:9999px;padding:0}.btn-circle:where(.btn-sm){height:2rem;width:2rem;border-radius:9999px;padding:0}.btn-group-horizontal{flex-direction:row}.input-sm{height:2rem;padding-left:.75rem;padding-right:.75rem;font-size:.875rem;line-height:2rem}.menu-vertical{flex-direction:column}.menu-vertical :where(li){flex-direction:column}.menu-vertical>:where(li)>:where(ul){top:initial;left:100%}.menu-horizontal{display:inline-flex;width:-moz-max-content;width:max-content;flex-direction:row}.menu-horizontal :where(li){flex-direction:row}.menu-horizontal>:where(li)>:where(ul){top:100%;left:initial}.steps-horizontal .step{display:grid;grid-template-columns:repeat(1,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));place-items:center;text-align:center}.steps-vertical .step{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(1,minmax(0,1fr))}.avatar.online:before{content:"";position:absolute;z-index:10;display:block;border-radius:9999px;--tw-bg-opacity: 1;background-color:hsl(var(--su) / var(--tw-bg-opacity));width:15%;height:15%;top:7%;right:7%;box-shadow:0 0 0 2px hsl(var(--b1))}.btn-group .btn:not(:first-child):not(:last-child),.btn-group.btn-group-horizontal .btn:not(:first-child):not(:last-child){border-radius:0}.btn-group .btn:first-child:not(:last-child),.btn-group.btn-group-horizontal .btn:first-child:not(:last-child){margin-left:-1px;margin-top:-0px;border-top-left-radius:var(--rounded-btn, .5rem);border-top-right-radius:0;border-bottom-left-radius:var(--rounded-btn, .5rem);border-bottom-right-radius:0}.btn-group .btn:last-child:not(:first-child),.btn-group.btn-group-horizontal .btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:var(--rounded-btn, .5rem);border-bottom-left-radius:0;border-bottom-right-radius:var(--rounded-btn, .5rem)}.btn-group.btn-group-vertical .btn:first-child:not(:last-child){margin-left:-0px;margin-top:-1px;border-top-left-radius:var(--rounded-btn, .5rem);border-top-right-radius:var(--rounded-btn, .5rem);border-bottom-left-radius:0;border-bottom-right-radius:0}.btn-group.btn-group-vertical .btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:var(--rounded-btn, .5rem);border-bottom-right-radius:var(--rounded-btn, .5rem)}.card-compact .card-body{padding:1rem;font-size:.875rem;line-height:1.25rem}.card-normal .card-body{padding:var(--padding-card, 2rem);font-size:1rem;line-height:1.5rem}.menu-vertical :where(li.bordered > *){border-left-width:4px;border-bottom-width:0px}.menu-horizontal :where(li.bordered > *){border-left-width:0px;border-bottom-width:4px}.menu-compact :where(li > *){padding-top:.5rem;padding-bottom:.5rem;font-size:.875rem;line-height:1.25rem}.menu-vertical>:where(li:first-child){border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:unset;border-bottom-left-radius:unset}.menu-vertical>:where(li:first-child)>:where(*:not(ul)){border-top-left-radius:inherit;border-top-right-radius:inherit;border-bottom-right-radius:unset;border-bottom-left-radius:unset}.menu-vertical>:where(li:last-child){border-top-left-radius:unset;border-top-right-radius:unset;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.menu-vertical>:where(li:last-child)>:where(*:not(ul)){border-top-left-radius:unset;border-top-right-radius:unset;border-bottom-right-radius:inherit;border-bottom-left-radius:inherit}.menu-horizontal>:where(li:first-child){border-top-left-radius:inherit;border-top-right-radius:unset;border-bottom-right-radius:unset;border-bottom-left-radius:inherit}.menu-horizontal>:where(li:first-child)>:where(*:not(ul)){border-top-left-radius:inherit;border-top-right-radius:unset;border-bottom-right-radius:unset;border-bottom-left-radius:inherit}.menu-horizontal>:where(li:last-child){border-top-left-radius:unset;border-top-right-radius:inherit;border-bottom-right-radius:inherit;border-bottom-left-radius:unset}.menu-horizontal>:where(li:last-child)>:where(*:not(ul)){border-top-left-radius:unset;border-top-right-radius:inherit;border-bottom-right-radius:inherit;border-bottom-left-radius:unset}.steps-horizontal .step{grid-template-rows:40px 1fr;grid-template-columns:auto;min-width:4rem}.steps-horizontal .step:before{height:.5rem;width:100%;--tw-translate-y: 0px;--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));content:"";margin-left:-100%}.steps-vertical .step{gap:.5rem;grid-template-columns:40px 1fr;grid-template-rows:auto;min-height:4rem;justify-items:start}.steps-vertical .step:before{height:100%;width:.5rem;--tw-translate-y: -50%;--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));margin-left:50%}.table-normal :where(th,td){padding:1rem;font-size:1rem;line-height:1.5rem}.table-compact :where(th,td){padding:.5rem;font-size:.875rem;line-height:1.25rem}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.pointer-events-auto{pointer-events:auto}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0px;right:0px;bottom:0px;left:0px}.inset-y-0{top:0px;bottom:0px}.right-0{right:0px}.top-\[100\%\],.top-full{top:100%}.z-20{z-index:20}.z-30{z-index:30}.z-10{z-index:10}.m-1{margin:.25rem}.m-2{margin:.5rem}.mx-2{margin-left:.5rem;margin-right:.5rem}.my-10{margin-top:2.5rem;margin-bottom:2.5rem}.my-2{margin-top:.5rem;margin-bottom:.5rem}.mx-auto{margin-left:auto;margin-right:auto}.my-4{margin-top:1rem;margin-bottom:1rem}.mr-2{margin-right:.5rem}.mr-20{margin-right:5rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mr-4{margin-right:1rem}.mt-1{margin-top:.25rem}.ml-2{margin-left:.5rem}.mt-2{margin-top:.5rem}.ml-1{margin-left:.25rem}.mb-1{margin-bottom:.25rem}.mt-4{margin-top:1rem}.mr-1{margin-right:.25rem}.mt-10{margin-top:2.5rem}.box-border{box-sizing:border-box}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-\[100vh\]{height:100vh}.h-6{height:1.5rem}.h-0{height:0px}.h-full{height:100%}.h-screen{height:100vh}.h-\[10vh\]{height:10vh}.h-\[90vh\]{height:90vh}.h-4{height:1rem}.h-20{height:5rem}.h-1\/2{height:50%}.h-10{height:2.5rem}.h-auto{height:auto}.h-80{height:20rem}.h-12{height:3rem}.h-5{height:1.25rem}.h-60{height:15rem}.h-64{height:16rem}.h-\[40vh\]{height:40vh}.h-\[5vh\]{height:5vh}.h-\[50vh\]{height:50vh}.h-\[8vh\]{height:8vh}.max-h-\[70vh\]{max-height:70vh}.max-h-60{max-height:15rem}.max-h-80{max-height:20rem}.min-h-max{min-height:-moz-max-content;min-height:max-content}.w-\[100vw\]{width:100vw}.w-6{width:1.5rem}.w-20{width:5rem}.w-full{width:100%}.w-4{width:1rem}.w-32{width:8rem}.w-40{width:10rem}.w-11\/12{width:91.666667%}.w-24{width:6rem}.w-1\/3{width:33.333333%}.w-0{width:0px}.w-12{width:3rem}.w-5{width:1.25rem}.w-1\/5{width:20%}.w-3\/5{width:60%}.w-11{width:2.75rem}.w-1\/2{width:50%}.w-52{width:13rem}.w-\[10vw\]{width:10vw}.w-80{width:20rem}.w-10\/12{width:83.333333%}.w-1\/4{width:25%}.w-2\/3{width:66.666667%}.w-44{width:11rem}.min-w-max{min-width:-moz-max-content;min-width:max-content}.min-w-\[15rem\]{min-width:15rem}.max-w-4xl{max-width:56rem}.flex-auto{flex:1 1 auto}.flex-1{flex:1 1 0%}.flex-shrink-0{flex-shrink:0}.border-collapse{border-collapse:collapse}.translate-x-6{--tw-translate-x: 1.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-1{--tw-translate-x: .25rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-95{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.animate-spin-rev-pause{animation:.3s linear 0s infinite reverse both pause spin}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin-rev-running{animation:.3s linear 0s infinite reverse both running spin}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-content-center{place-content:center}.place-items-start{place-items:start}.place-items-center{place-items:center}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-stretch{align-items:stretch}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.justify-evenly{justify-content:space-evenly}.self-start{align-self:flex-start}.self-end{align-self:flex-end}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-clip{overflow:clip}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.overscroll-auto{overscroll-behavior:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-md{border-radius:.375rem}.rounded-sm{border-radius:.125rem}.rounded-xl{border-radius:.75rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-r{border-top-right-radius:.25rem;border-bottom-right-radius:.25rem}.rounded-l{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-br{border-bottom-right-radius:.25rem}.border{border-width:1px}.border-x-0{border-left-width:0px;border-right-width:0px}.border-b-2{border-bottom-width:2px}.border-t-2{border-top-width:2px}.border-l{border-left-width:1px}.border-none{border-style:none}.border-base-100{--tw-border-opacity: 1;border-color:hsl(var(--b1) / var(--tw-border-opacity))}.border-slate-400{--tw-border-opacity: 1;border-color:rgb(148 163 184 / var(--tw-border-opacity))}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.border-black{--tw-border-opacity: 1;border-color:rgb(0 0 0 / var(--tw-border-opacity))}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-neutral{--tw-border-opacity: 1;border-color:hsl(var(--n) / var(--tw-border-opacity))}.border-primary-focus{--tw-border-opacity: 1;border-color:hsl(var(--pf, var(--p)) / var(--tw-border-opacity))}.bg-base-100{--tw-bg-opacity: 1;background-color:hsl(var(--b1) / var(--tw-bg-opacity))}.bg-secondary{--tw-bg-opacity: 1;background-color:hsl(var(--s) / var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-primary{--tw-bg-opacity: 1;background-color:hsl(var(--p) / var(--tw-bg-opacity))}.bg-base-200{--tw-bg-opacity: 1;background-color:hsl(var(--b2, var(--b1)) / var(--tw-bg-opacity))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.bg-green-200{--tw-bg-opacity: 1;background-color:rgb(187 247 208 / var(--tw-bg-opacity))}.bg-blue-200{--tw-bg-opacity: 1;background-color:rgb(191 219 254 / var(--tw-bg-opacity))}.bg-slate-200{--tw-bg-opacity: 1;background-color:rgb(226 232 240 / var(--tw-bg-opacity))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity))}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity))}.bg-blue-500{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.bg-teal-700{--tw-bg-opacity: 1;background-color:rgb(15 118 110 / var(--tw-bg-opacity))}.bg-blue-300{--tw-bg-opacity: 1;background-color:rgb(147 197 253 / var(--tw-bg-opacity))}.bg-neutral{--tw-bg-opacity: 1;background-color:hsl(var(--n) / var(--tw-bg-opacity))}.bg-neutral-focus{--tw-bg-opacity: 1;background-color:hsl(var(--nf, var(--n)) / var(--tw-bg-opacity))}.bg-info{--tw-bg-opacity: 1;background-color:hsl(var(--in) / var(--tw-bg-opacity))}.bg-accent{--tw-bg-opacity: 1;background-color:hsl(var(--a) / var(--tw-bg-opacity))}.bg-base-300{--tw-bg-opacity: 1;background-color:hsl(var(--b3, var(--b2)) / var(--tw-bg-opacity))}.bg-success{--tw-bg-opacity: 1;background-color:hsl(var(--su) / var(--tw-bg-opacity))}.bg-primary-focus{--tw-bg-opacity: 1;background-color:hsl(var(--pf, var(--p)) / var(--tw-bg-opacity))}.bg-\[\#f6f6f6\]{--tw-bg-opacity: 1;background-color:rgb(246 246 246 / var(--tw-bg-opacity))}.bg-opacity-25{--tw-bg-opacity: .25}.p-2{padding:.5rem}.p-10{padding:2.5rem}.p-1{padding:.25rem}.p-4{padding:1rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.pl-3{padding-left:.75rem}.pr-10{padding-right:2.5rem}.pr-2{padding-right:.5rem}.pl-2{padding-left:.5rem}.pl-4{padding-left:1rem}.pt-4{padding-top:1rem}.pt-2{padding-top:.5rem}.pl-10{padding-left:2.5rem}.text-left{text-align:left}.text-sm{font-size:.875rem;line-height:1.25rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-bold{font-weight:700}.uppercase{text-transform:uppercase}.normal-case{text-transform:none}.leading-5{line-height:1.25rem}.text-secondary-content{--tw-text-opacity: 1;color:hsl(var(--sc) / var(--tw-text-opacity))}.text-primary-content{--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.text-error{--tw-text-opacity: 1;color:hsl(var(--er) / var(--tw-text-opacity))}.text-success{--tw-text-opacity: 1;color:hsl(var(--su) / var(--tw-text-opacity))}.text-warning{--tw-text-opacity: 1;color:hsl(var(--wa) / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.text-teal-600{--tw-text-opacity: 1;color:rgb(13 148 136 / var(--tw-text-opacity))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-neutral-content{--tw-text-opacity: 1;color:hsl(var(--nc) / var(--tw-text-opacity))}.text-info-content{--tw-text-opacity: 1;color:hsl(var(--inc, var(--nc)) / var(--tw-text-opacity))}.text-accent-content{--tw-text-opacity: 1;color:hsl(var(--ac) / var(--tw-text-opacity))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity))}.text-base-content{--tw-text-opacity: 1;color:hsl(var(--bc) / var(--tw-text-opacity))}.text-neutral{--tw-text-opacity: 1;color:hsl(var(--n) / var(--tw-text-opacity))}.text-success-content{--tw-text-opacity: 1;color:hsl(var(--suc, var(--nc)) / var(--tw-text-opacity))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline-1{outline-width:1px}.outline-2{outline-width:2px}.ring-1{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-black{--tw-ring-opacity: 1;--tw-ring-color: rgb(0 0 0 / var(--tw-ring-opacity))}.ring-opacity-5{--tw-ring-opacity: .05}.blur{--tw-blur: blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-300{transition-duration:.3s}.duration-200{transition-duration:.2s}.duration-75{transition-duration:75ms}.duration-500{transition-duration:.5s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.ease-in{transition-timing-function:cubic-bezier(.4,0,1,1)}.btn-outline .focus-within\:outline:focus-within.badge{--tw-border-opacity: 1;border-color:hsl(var(--nf, var(--n)) / var(--tw-border-opacity));background-color:transparent}.focus-within\:outline:focus-within{outline-style:solid}.btn-outline:hover .focus-within\:outline:focus-within.badge{--tw-border-opacity: 1;border-color:hsl(var(--b2, var(--b1)) / var(--tw-border-opacity));--tw-text-opacity: 1;color:hsl(var(--nc) / var(--tw-text-opacity))}.btn-outline.btn-primary:hover .focus-within\:outline:focus-within.badge{--tw-border-opacity: 1;border-color:hsl(var(--pc) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--pf, var(--p)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--pc) / var(--tw-text-opacity))}.btn-outline.btn-secondary:hover .focus-within\:outline:focus-within.badge{--tw-border-opacity: 1;border-color:hsl(var(--sc) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--sf, var(--s)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--sc) / var(--tw-text-opacity))}.btn-outline.btn-accent:hover .focus-within\:outline:focus-within.badge{--tw-border-opacity: 1;border-color:hsl(var(--ac) / var(--tw-border-opacity));--tw-bg-opacity: 1;background-color:hsl(var(--af, var(--a)) / var(--tw-bg-opacity));--tw-text-opacity: 1;color:hsl(var(--ac) / var(--tw-text-opacity))}.hover\:bg-secondary-focus:hover{--tw-bg-opacity: 1;background-color:hsl(var(--sf, var(--s)) / var(--tw-bg-opacity))}.hover\:bg-blue-500:hover{--tw-bg-opacity: 1;background-color:rgb(59 130 246 / var(--tw-bg-opacity))}.hover\:text-sky-500:hover{--tw-text-opacity: 1;color:rgb(14 165 233 / var(--tw-text-opacity))}.hover\:opacity-50:hover{opacity:.5}.hover\:shadow:hover{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-md:hover{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-xl:hover{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:shadow-gray-400:hover{--tw-shadow-color: #9ca3af;--tw-shadow: var(--tw-shadow-colored)}.focus\:bg-secondary-focus:focus{--tw-bg-opacity: 1;background-color:hsl(var(--sf, var(--s)) / var(--tw-bg-opacity))}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:outline-gray-600:focus-visible{outline-color:#4b5563}.group:first-child .group-first\:z-0{z-index:0}.group:focus-within .group-focus-within\:h-auto{height:auto}.group:hover .group-hover\:h-auto{height:auto}.group:hover .group-hover\:opacity-100{opacity:1}@media (prefers-color-scheme: dark){.dark\:hover\:text-sky-400:hover{--tw-text-opacity: 1;color:rgb(56 189 248 / var(--tw-text-opacity))}}@media (min-width: 768px){.md\:flex-row{flex-direction:row}.md\:btn-group-vertical{flex-direction:column}.md\:btn-group-vertical.btn-group .btn:first-child:not(:last-child){margin-left:-0px;margin-top:-1px;border-top-left-radius:var(--rounded-btn, .5rem);border-top-right-radius:var(--rounded-btn, .5rem);border-bottom-left-radius:0;border-bottom-right-radius:0}.md\:btn-group-vertical.btn-group .btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:0;border-bottom-left-radius:var(--rounded-btn, .5rem);border-bottom-right-radius:var(--rounded-btn, .5rem)}}@media (min-width: 1024px){.lg\:flex-row{flex-direction:row}}@media (min-width: 1280px){.xl\:flex{display:flex}.xl\:hidden{display:none}.xl\:flex-row{flex-direction:row}}@media (min-width: 1536px){.\32xl\:hidden{display:none}.\32xl\:btn-group-horizontal{flex-direction:row}.\32xl\:menu-horizontal{display:inline-flex;width:-moz-max-content;width:max-content;flex-direction:row}.\32xl\:menu-horizontal :where(li){flex-direction:row}.\32xl\:menu-horizontal>:where(li)>:where(ul){top:100%;left:initial}.\32xl\:btn-group-horizontal .btn-group .btn:not(:first-child):not(:last-child){border-radius:0}.\32xl\:btn-group-horizontal .btn-group .btn:first-child:not(:last-child){margin-left:-1px;margin-top:-0px;border-top-left-radius:var(--rounded-btn, .5rem);border-top-right-radius:0;border-bottom-left-radius:var(--rounded-btn, .5rem);border-bottom-right-radius:0}.\32xl\:btn-group-horizontal .btn-group .btn:last-child:not(:first-child){border-top-left-radius:0;border-top-right-radius:var(--rounded-btn, .5rem);border-bottom-left-radius:0;border-bottom-right-radius:var(--rounded-btn, .5rem)}.\32xl\:menu-horizontal :where(li.bordered > *){border-left-width:0px;border-bottom-width:4px}.\32xl\:menu-horizontal>:where(li:first-child){border-top-left-radius:inherit;border-top-right-radius:unset;border-bottom-right-radius:unset;border-bottom-left-radius:inherit}.\32xl\:menu-horizontal>:where(li:first-child)>:where(*:not(ul)){border-top-left-radius:inherit;border-top-right-radius:unset;border-bottom-right-radius:unset;border-bottom-left-radius:inherit}.\32xl\:menu-horizontal>:where(li:last-child){border-top-left-radius:unset;border-top-right-radius:inherit;border-bottom-right-radius:inherit;border-bottom-left-radius:unset}.\32xl\:menu-horizontal>:where(li:last-child)>:where(*:not(ul)){border-top-left-radius:unset;border-top-right-radius:inherit;border-bottom-right-radius:inherit;border-bottom-left-radius:unset}} diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/xterm-2831e07f.css b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/xterm-2831e07f.css new file mode 100644 index 00000000000..2b85b0e97ee --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/css/xterm-2831e07f.css @@ -0,0 +1,32 @@ +/** + * Copyright (c) 2014 The xterm.js authors. All rights reserved. + * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License) + * https://github.com/chjj/term.js + * @license MIT + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * Originally forked from (with the author's permission): + * Fabrice Bellard's javascript vt100 for jslinux: + * http://bellard.org/jslinux/ + * Copyright (c) 2011 Fabrice Bellard + * The original design remains. The terminal itself + * has been extended to include xterm CSI codes, among + * other features. + */.xterm{cursor:text;position:relative;-moz-user-select:none;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#fff;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm .xterm-scroll-area{visibility:hidden}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility,.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:.5}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{-webkit-text-decoration:double underline;text-decoration:double underline}.xterm-underline-3{-webkit-text-decoration:wavy underline;text-decoration:wavy underline}.xterm-underline-4{-webkit-text-decoration:dotted underline;text-decoration:dotted underline}.xterm-underline-5{-webkit-text-decoration:dashed underline;text-decoration:dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-decoration-overview-ruler{z-index:7;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative} diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/Agent-7549a395.js b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/Agent-7549a395.js new file mode 100644 index 00000000000..f50144df6b9 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/Agent-7549a395.js @@ -0,0 +1 @@ +import{_ as c,d as p,r as h,o as m,a,b as r,e as t,F as _,f as u,t as o}from"./main-38ee3337.js";import{a as d}from"./axios-1e59ba81.js";const v={class:"table table-normal w-[100vw]"},w=t("thead",null,[t("tr",null,[t("th",{class:"normal-case"},"IP"),t("th",{class:"normal-case"},"http-port"),t("th",{class:"normal-case"},"ws-port"),t("th",{class:"normal-case"},"Option")])],-1),b=["href"],f=p({__name:"Agent",setup(y){const s=h([]),i=async()=>{let n=window.location.origin+"/api/native-agent";const l={operation:"listNativeAgent"};try{const e=await d.post(n,l);Array.isArray(e.data)&&s.splice(0,s.length,...e.data)}catch{}};return m(()=>{i()}),(n,l)=>(a(),r("table",v,[w,t("tbody",null,[(a(!0),r(_,null,u(s,e=>(a(),r("tr",{key:e.ip,class:"hover"},[t("td",null,o(e.ip),1),t("td",null,o(e.httpPort),1),t("td",null,o(e.wsPort),1),t("td",null,[t("a",{class:"btn btn-primary btn-sm",href:"processes.html?ip="+e.ip+"&httpPort="+e.httpPort+"&wsPort="+e.wsPort},"view java processes info",8,b)])]))),128))])]))}});var P=c(f,[["__file","D:/code/java/read/arthas/web-ui/arthasWebConsole/all/native-agent/src/Agent.vue"]]);export{P as A}; diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/agents-b07f3b75.js b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/agents-b07f3b75.js new file mode 100644 index 00000000000..24af6a3143d --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/agents-b07f3b75.js @@ -0,0 +1 @@ +import{c as p}from"./main-38ee3337.js";import{A as o}from"./Agent-7549a395.js";import"./axios-1e59ba81.js";const m=p(o);m.mount("#app"); diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/axios-1e59ba81.js b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/axios-1e59ba81.js new file mode 100644 index 00000000000..be38a0cb527 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/axios-1e59ba81.js @@ -0,0 +1,6 @@ +function Fe(e,t){return function(){return e.apply(t,arguments)}}const{toString:tt}=Object.prototype,{getPrototypeOf:ue}=Object,V=(e=>t=>{const n=tt.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),C=e=>(e=e.toLowerCase(),t=>V(t)===e),W=e=>t=>typeof t===e,{isArray:D}=Array,j=W("undefined");function nt(e){return e!==null&&!j(e)&&e.constructor!==null&&!j(e.constructor)&&A(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Be=C("ArrayBuffer");function rt(e){let t;return typeof ArrayBuffer!="undefined"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&Be(e.buffer),t}const st=W("string"),A=W("function"),Le=W("number"),K=e=>e!==null&&typeof e=="object",ot=e=>e===!0||e===!1,I=e=>{if(V(e)!=="object")return!1;const t=ue(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},it=C("Date"),at=C("File"),ct=C("Blob"),ut=C("FileList"),lt=e=>K(e)&&A(e.pipe),ft=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||A(e.append)&&((t=V(e))==="formdata"||t==="object"&&A(e.toString)&&e.toString()==="[object FormData]"))},dt=C("URLSearchParams"),[pt,ht,mt,yt]=["ReadableStream","Request","Response","Headers"].map(C),bt=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function q(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e=="undefined")return;let r,s;if(typeof e!="object"&&(e=[e]),D(e))for(r=0,s=e.length;r0;)if(s=n[r],t===s.toLowerCase())return s;return null}const B=(()=>typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:global)(),Ue=e=>!j(e)&&e!==B;function ne(){const{caseless:e}=Ue(this)&&this||{},t={},n=(r,s)=>{const o=e&&De(t,s)||s;I(t[o])&&I(r)?t[o]=ne(t[o],r):I(r)?t[o]=ne({},r):D(r)?t[o]=r.slice():t[o]=r};for(let r=0,s=arguments.length;r(q(t,(s,o)=>{n&&A(s)?e[o]=Fe(s,n):e[o]=s},{allOwnKeys:r}),e),Et=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),St=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},gt=(e,t,n,r)=>{let s,o,i;const c={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),o=s.length;o-- >0;)i=s[o],(!r||r(i,e,t))&&!c[i]&&(t[i]=e[i],c[i]=!0);e=n!==!1&&ue(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},Rt=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},Ot=e=>{if(!e)return null;if(D(e))return e;let t=e.length;if(!Le(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},Tt=(e=>t=>e&&t instanceof e)(typeof Uint8Array!="undefined"&&ue(Uint8Array)),At=(e,t)=>{const r=(e&&e[Symbol.iterator]).call(e);let s;for(;(s=r.next())&&!s.done;){const o=s.value;t.call(e,o[0],o[1])}},xt=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},Ct=C("HTMLFormElement"),Nt=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),be=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),Pt=C("RegExp"),ke=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};q(n,(s,o)=>{let i;(i=t(s,o,e))!==!1&&(r[o]=i||s)}),Object.defineProperties(e,r)},_t=e=>{ke(e,(t,n)=>{if(A(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(!!A(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},Ft=(e,t)=>{const n={},r=s=>{s.forEach(o=>{n[o]=!0})};return D(e)?r(e):r(String(e).split(t)),n},Bt=()=>{},Lt=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t,Z="abcdefghijklmnopqrstuvwxyz",we="0123456789",je={DIGIT:we,ALPHA:Z,ALPHA_DIGIT:Z+Z.toUpperCase()+we},Dt=(e=16,t=je.ALPHA_DIGIT)=>{let n="";const{length:r}=t;for(;e--;)n+=t[Math.random()*r|0];return n};function Ut(e){return!!(e&&A(e.append)&&e[Symbol.toStringTag]==="FormData"&&e[Symbol.iterator])}const kt=e=>{const t=new Array(10),n=(r,s)=>{if(K(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[s]=r;const o=D(r)?[]:{};return q(r,(i,c)=>{const f=n(i,s+1);!j(f)&&(o[c]=f)}),t[s]=void 0,o}}return r};return n(e,0)},jt=C("AsyncFunction"),qt=e=>e&&(K(e)||A(e))&&A(e.then)&&A(e.catch),qe=((e,t)=>e?setImmediate:t?((n,r)=>(B.addEventListener("message",({source:s,data:o})=>{s===B&&o===n&&r.length&&r.shift()()},!1),s=>{r.push(s),B.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",A(B.postMessage)),Ht=typeof queueMicrotask!="undefined"?queueMicrotask.bind(B):typeof process!="undefined"&&process.nextTick||qe;var a={isArray:D,isArrayBuffer:Be,isBuffer:nt,isFormData:ft,isArrayBufferView:rt,isString:st,isNumber:Le,isBoolean:ot,isObject:K,isPlainObject:I,isReadableStream:pt,isRequest:ht,isResponse:mt,isHeaders:yt,isUndefined:j,isDate:it,isFile:at,isBlob:ct,isRegExp:Pt,isFunction:A,isStream:lt,isURLSearchParams:dt,isTypedArray:Tt,isFileList:ut,forEach:q,merge:ne,extend:wt,trim:bt,stripBOM:Et,inherits:St,toFlatObject:gt,kindOf:V,kindOfTest:C,endsWith:Rt,toArray:Ot,forEachEntry:At,matchAll:xt,isHTMLForm:Ct,hasOwnProperty:be,hasOwnProp:be,reduceDescriptors:ke,freezeMethods:_t,toObjectSet:Ft,toCamelCase:Nt,noop:Bt,toFiniteNumber:Lt,findKey:De,global:B,isContextDefined:Ue,ALPHABET:je,generateString:Dt,isSpecCompliantForm:Ut,toJSONObject:kt,isAsyncFn:jt,isThenable:qt,setImmediate:qe,asap:Ht};function m(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}a.inherits(m,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:a.toJSONObject(this.config),code:this.code,status:this.status}}});const He=m.prototype,Ie={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{Ie[e]={value:e}});Object.defineProperties(m,Ie);Object.defineProperty(He,"isAxiosError",{value:!0});m.from=(e,t,n,r,s,o)=>{const i=Object.create(He);return a.toFlatObject(e,i,function(f){return f!==Error.prototype},c=>c!=="isAxiosError"),m.call(i,e.message,t,n,r,s),i.cause=e,i.name=e.name,o&&Object.assign(i,o),i};var It=null;function re(e){return a.isPlainObject(e)||a.isArray(e)}function ve(e){return a.endsWith(e,"[]")?e.slice(0,-2):e}function Ee(e,t,n){return e?e.concat(t).map(function(s,o){return s=ve(s),!n&&o?"["+s+"]":s}).join(n?".":""):t}function vt(e){return a.isArray(e)&&!e.some(re)}const Mt=a.toFlatObject(a,{},null,function(t){return/^is[A-Z]/.test(t)});function G(e,t,n){if(!a.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=a.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(y,h){return!a.isUndefined(h[y])});const r=n.metaTokens,s=n.visitor||l,o=n.dots,i=n.indexes,f=(n.Blob||typeof Blob!="undefined"&&Blob)&&a.isSpecCompliantForm(t);if(!a.isFunction(s))throw new TypeError("visitor must be a function");function u(p){if(p===null)return"";if(a.isDate(p))return p.toISOString();if(!f&&a.isBlob(p))throw new m("Blob is not supported. Use a Buffer instead.");return a.isArrayBuffer(p)||a.isTypedArray(p)?f&&typeof Blob=="function"?new Blob([p]):Buffer.from(p):p}function l(p,y,h){let w=p;if(p&&!h&&typeof p=="object"){if(a.endsWith(y,"{}"))y=r?y:y.slice(0,-2),p=JSON.stringify(p);else if(a.isArray(p)&&vt(p)||(a.isFileList(p)||a.endsWith(y,"[]"))&&(w=a.toArray(p)))return y=ve(y),w.forEach(function(R,N){!(a.isUndefined(R)||R===null)&&t.append(i===!0?Ee([y],N,o):i===null?y:y+"[]",u(R))}),!1}return re(p)?!0:(t.append(Ee(h,y,o),u(p)),!1)}const d=[],b=Object.assign(Mt,{defaultVisitor:l,convertValue:u,isVisitable:re});function S(p,y){if(!a.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+y.join("."));d.push(p),a.forEach(p,function(w,g){(!(a.isUndefined(w)||w===null)&&s.call(t,w,a.isString(g)?g.trim():g,y,b))===!0&&S(w,y?y.concat(g):[g])}),d.pop()}}if(!a.isObject(e))throw new TypeError("data must be an object");return S(e),t}function Se(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function le(e,t){this._pairs=[],e&&G(e,this,t)}const Me=le.prototype;Me.append=function(t,n){this._pairs.push([t,n])};Me.toString=function(t){const n=t?function(r){return t.call(this,r,Se)}:Se;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function zt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ze(e,t,n){if(!t)return e;const r=n&&n.encode||zt,s=n&&n.serialize;let o;if(s?o=s(t,n):o=a.isURLSearchParams(t)?t.toString():new le(t,n).toString(r),o){const i=e.indexOf("#");i!==-1&&(e=e.slice(0,i)),e+=(e.indexOf("?")===-1?"?":"&")+o}return e}class Jt{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){a.forEach(this.handlers,function(r){r!==null&&t(r)})}}var ge=Jt,Je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},$t=typeof URLSearchParams!="undefined"?URLSearchParams:le,Vt=typeof FormData!="undefined"?FormData:null,Wt=typeof Blob!="undefined"?Blob:null,Kt={isBrowser:!0,classes:{URLSearchParams:$t,FormData:Vt,Blob:Wt},protocols:["http","https","file","blob","url","data"]};const fe=typeof window!="undefined"&&typeof document!="undefined",se=typeof navigator=="object"&&navigator||void 0,Gt=fe&&(!se||["ReactNative","NativeScript","NS"].indexOf(se.product)<0),Xt=(()=>typeof WorkerGlobalScope!="undefined"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function")(),Qt=fe&&window.location.href||"http://localhost";var Zt=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:fe,hasStandardBrowserWebWorkerEnv:Xt,hasStandardBrowserEnv:Gt,navigator:se,origin:Qt},Symbol.toStringTag,{value:"Module"})),T={...Zt,...Kt};function Yt(e,t){return G(e,new T.classes.URLSearchParams,Object.assign({visitor:function(n,r,s,o){return T.isNode&&a.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)}},t))}function en(e){return a.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function tn(e){const t={},n=Object.keys(e);let r;const s=n.length;let o;for(r=0;r=n.length;return i=!i&&a.isArray(s)?s.length:i,f?(a.hasOwnProp(s,i)?s[i]=[s[i],r]:s[i]=r,!c):((!s[i]||!a.isObject(s[i]))&&(s[i]=[]),t(n,r,s[i],o)&&a.isArray(s[i])&&(s[i]=tn(s[i])),!c)}if(a.isFormData(e)&&a.isFunction(e.entries)){const n={};return a.forEachEntry(e,(r,s)=>{t(en(r),s,n,0)}),n}return null}function nn(e,t,n){if(a.isString(e))try{return(t||JSON.parse)(e),a.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const de={transitional:Je,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,o=a.isObject(t);if(o&&a.isHTMLForm(t)&&(t=new FormData(t)),a.isFormData(t))return s?JSON.stringify($e(t)):t;if(a.isArrayBuffer(t)||a.isBuffer(t)||a.isStream(t)||a.isFile(t)||a.isBlob(t)||a.isReadableStream(t))return t;if(a.isArrayBufferView(t))return t.buffer;if(a.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let c;if(o){if(r.indexOf("application/x-www-form-urlencoded")>-1)return Yt(t,this.formSerializer).toString();if((c=a.isFileList(t))||r.indexOf("multipart/form-data")>-1){const f=this.env&&this.env.FormData;return G(c?{"files[]":t}:t,f&&new f,this.formSerializer)}}return o||s?(n.setContentType("application/json",!1),nn(t)):t}],transformResponse:[function(t){const n=this.transitional||de.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(a.isResponse(t)||a.isReadableStream(t))return t;if(t&&a.isString(t)&&(r&&!this.responseType||s)){const i=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t)}catch(c){if(i)throw c.name==="SyntaxError"?m.from(c,m.ERR_BAD_RESPONSE,this,null,this.response):c}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:T.classes.FormData,Blob:T.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};a.forEach(["delete","get","head","post","put","patch"],e=>{de.headers[e]={}});var pe=de;const rn=a.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);var sn=e=>{const t={};let n,r,s;return e&&e.split(` +`).forEach(function(i){s=i.indexOf(":"),n=i.substring(0,s).trim().toLowerCase(),r=i.substring(s+1).trim(),!(!n||t[n]&&rn[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t};const Re=Symbol("internals");function k(e){return e&&String(e).trim().toLowerCase()}function v(e){return e===!1||e==null?e:a.isArray(e)?e.map(v):String(e)}function on(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const an=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Y(e,t,n,r,s){if(a.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!a.isString(t)){if(a.isString(r))return t.indexOf(r)!==-1;if(a.isRegExp(r))return r.test(t)}}function cn(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function un(e,t){const n=a.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,o,i){return this[r].call(this,t,s,o,i)},configurable:!0})})}class X{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function o(c,f,u){const l=k(f);if(!l)throw new Error("header name must be a non-empty string");const d=a.findKey(s,l);(!d||s[d]===void 0||u===!0||u===void 0&&s[d]!==!1)&&(s[d||f]=v(c))}const i=(c,f)=>a.forEach(c,(u,l)=>o(u,l,f));if(a.isPlainObject(t)||t instanceof this.constructor)i(t,n);else if(a.isString(t)&&(t=t.trim())&&!an(t))i(sn(t),n);else if(a.isHeaders(t))for(const[c,f]of t.entries())o(f,c,r);else t!=null&&o(n,t,r);return this}get(t,n){if(t=k(t),t){const r=a.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return on(s);if(a.isFunction(n))return n.call(this,s,r);if(a.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=k(t),t){const r=a.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Y(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function o(i){if(i=k(i),i){const c=a.findKey(r,i);c&&(!n||Y(r,r[c],c,n))&&(delete r[c],s=!0)}}return a.isArray(t)?t.forEach(o):o(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const o=n[r];(!t||Y(this,this[o],o,t,!0))&&(delete this[o],s=!0)}return s}normalize(t){const n=this,r={};return a.forEach(this,(s,o)=>{const i=a.findKey(r,o);if(i){n[i]=v(s),delete n[o];return}const c=t?cn(o):String(o).trim();c!==o&&delete n[o],n[c]=v(s),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return a.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&a.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` +`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[Re]=this[Re]={accessors:{}}).accessors,s=this.prototype;function o(i){const c=k(i);r[c]||(un(s,i),r[c]=!0)}return a.isArray(t)?t.forEach(o):o(t),this}}X.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);a.reduceDescriptors(X.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});a.freezeMethods(X);var x=X;function ee(e,t){const n=this||pe,r=t||n,s=x.from(r.headers);let o=r.data;return a.forEach(e,function(c){o=c.call(n,o,s.normalize(),t?t.status:void 0)}),s.normalize(),o}function Ve(e){return!!(e&&e.__CANCEL__)}function U(e,t,n){m.call(this,e==null?"canceled":e,m.ERR_CANCELED,t,n),this.name="CanceledError"}a.inherits(U,m,{__CANCEL__:!0});function We(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new m("Request failed with status code "+n.status,[m.ERR_BAD_REQUEST,m.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function ln(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function fn(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,o=0,i;return t=t!==void 0?t:1e3,function(f){const u=Date.now(),l=r[o];i||(i=u),n[s]=f,r[s]=u;let d=o,b=0;for(;d!==s;)b+=n[d++],d=d%e;if(s=(s+1)%e,s===o&&(o=(o+1)%e),u-i{n=l,s=null,o&&(clearTimeout(o),o=null),e.apply(null,u)};return[(...u)=>{const l=Date.now(),d=l-n;d>=r?i(u,l):(s=u,o||(o=setTimeout(()=>{o=null,i(s)},r-d)))},()=>s&&i(s)]}const z=(e,t,n=3)=>{let r=0;const s=fn(50,250);return dn(o=>{const i=o.loaded,c=o.lengthComputable?o.total:void 0,f=i-r,u=s(f),l=i<=c;r=i;const d={loaded:i,total:c,progress:c?i/c:void 0,bytes:f,rate:u||void 0,estimated:u&&c&&l?(c-i)/u:void 0,event:o,lengthComputable:c!=null,[t?"download":"upload"]:!0};e(d)},n)},Oe=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Te=e=>(...t)=>a.asap(()=>e(...t));var pn=T.hasStandardBrowserEnv?function(){const t=T.navigator&&/(msie|trident)/i.test(T.navigator.userAgent),n=document.createElement("a");let r;function s(o){let i=o;return t&&(n.setAttribute("href",i),i=n.href),n.setAttribute("href",i),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=s(window.location.href),function(i){const c=a.isString(i)?s(i):i;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}(),hn=T.hasStandardBrowserEnv?{write(e,t,n,r,s,o){const i=[e+"="+encodeURIComponent(t)];a.isNumber(n)&&i.push("expires="+new Date(n).toGMTString()),a.isString(r)&&i.push("path="+r),a.isString(s)&&i.push("domain="+s),o===!0&&i.push("secure"),document.cookie=i.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function mn(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function yn(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Ke(e,t){return e&&!mn(t)?yn(e,t):t}const Ae=e=>e instanceof x?{...e}:e;function L(e,t){t=t||{};const n={};function r(u,l,d){return a.isPlainObject(u)&&a.isPlainObject(l)?a.merge.call({caseless:d},u,l):a.isPlainObject(l)?a.merge({},l):a.isArray(l)?l.slice():l}function s(u,l,d){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u,d)}else return r(u,l,d)}function o(u,l){if(!a.isUndefined(l))return r(void 0,l)}function i(u,l){if(a.isUndefined(l)){if(!a.isUndefined(u))return r(void 0,u)}else return r(void 0,l)}function c(u,l,d){if(d in t)return r(u,l);if(d in e)return r(void 0,u)}const f={url:o,method:o,data:o,baseURL:i,transformRequest:i,transformResponse:i,paramsSerializer:i,timeout:i,timeoutMessage:i,withCredentials:i,withXSRFToken:i,adapter:i,responseType:i,xsrfCookieName:i,xsrfHeaderName:i,onUploadProgress:i,onDownloadProgress:i,decompress:i,maxContentLength:i,maxBodyLength:i,beforeRedirect:i,transport:i,httpAgent:i,httpsAgent:i,cancelToken:i,socketPath:i,responseEncoding:i,validateStatus:c,headers:(u,l)=>s(Ae(u),Ae(l),!0)};return a.forEach(Object.keys(Object.assign({},e,t)),function(l){const d=f[l]||s,b=d(e[l],t[l],l);a.isUndefined(b)&&d!==c||(n[l]=b)}),n}var Ge=e=>{const t=L({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:o,headers:i,auth:c}=t;t.headers=i=x.from(i),t.url=ze(Ke(t.baseURL,t.url),e.params,e.paramsSerializer),c&&i.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):"")));let f;if(a.isFormData(n)){if(T.hasStandardBrowserEnv||T.hasStandardBrowserWebWorkerEnv)i.setContentType(void 0);else if((f=i.getContentType())!==!1){const[u,...l]=f?f.split(";").map(d=>d.trim()).filter(Boolean):[];i.setContentType([u||"multipart/form-data",...l].join("; "))}}if(T.hasStandardBrowserEnv&&(r&&a.isFunction(r)&&(r=r(t)),r||r!==!1&&pn(t.url))){const u=s&&o&&hn.read(o);u&&i.set(s,u)}return t};const bn=typeof XMLHttpRequest!="undefined";var wn=bn&&function(e){return new Promise(function(n,r){const s=Ge(e);let o=s.data;const i=x.from(s.headers).normalize();let{responseType:c,onUploadProgress:f,onDownloadProgress:u}=s,l,d,b,S,p;function y(){S&&S(),p&&p(),s.cancelToken&&s.cancelToken.unsubscribe(l),s.signal&&s.signal.removeEventListener("abort",l)}let h=new XMLHttpRequest;h.open(s.method.toUpperCase(),s.url,!0),h.timeout=s.timeout;function w(){if(!h)return;const R=x.from("getAllResponseHeaders"in h&&h.getAllResponseHeaders()),O={data:!c||c==="text"||c==="json"?h.responseText:h.response,status:h.status,statusText:h.statusText,headers:R,config:e,request:h};We(function(F){n(F),y()},function(F){r(F),y()},O),h=null}"onloadend"in h?h.onloadend=w:h.onreadystatechange=function(){!h||h.readyState!==4||h.status===0&&!(h.responseURL&&h.responseURL.indexOf("file:")===0)||setTimeout(w)},h.onabort=function(){!h||(r(new m("Request aborted",m.ECONNABORTED,e,h)),h=null)},h.onerror=function(){r(new m("Network Error",m.ERR_NETWORK,e,h)),h=null},h.ontimeout=function(){let N=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const O=s.transitional||Je;s.timeoutErrorMessage&&(N=s.timeoutErrorMessage),r(new m(N,O.clarifyTimeoutError?m.ETIMEDOUT:m.ECONNABORTED,e,h)),h=null},o===void 0&&i.setContentType(null),"setRequestHeader"in h&&a.forEach(i.toJSON(),function(N,O){h.setRequestHeader(O,N)}),a.isUndefined(s.withCredentials)||(h.withCredentials=!!s.withCredentials),c&&c!=="json"&&(h.responseType=s.responseType),u&&([b,p]=z(u,!0),h.addEventListener("progress",b)),f&&h.upload&&([d,S]=z(f),h.upload.addEventListener("progress",d),h.upload.addEventListener("loadend",S)),(s.cancelToken||s.signal)&&(l=R=>{!h||(r(!R||R.type?new U(null,e,h):R),h.abort(),h=null)},s.cancelToken&&s.cancelToken.subscribe(l),s.signal&&(s.signal.aborted?l():s.signal.addEventListener("abort",l)));const g=ln(s.url);if(g&&T.protocols.indexOf(g)===-1){r(new m("Unsupported protocol "+g+":",m.ERR_BAD_REQUEST,e));return}h.send(o||null)})};const En=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const o=function(u){if(!s){s=!0,c();const l=u instanceof Error?u:this.reason;r.abort(l instanceof m?l:new U(l instanceof Error?l.message:l))}};let i=t&&setTimeout(()=>{i=null,o(new m(`timeout ${t} of ms exceeded`,m.ETIMEDOUT))},t);const c=()=>{e&&(i&&clearTimeout(i),i=null,e.forEach(u=>{u.unsubscribe?u.unsubscribe(o):u.removeEventListener("abort",o)}),e=null)};e.forEach(u=>u.addEventListener("abort",o));const{signal:f}=r;return f.unsubscribe=()=>a.asap(c),f}};var Sn=En;const gn=function*(e,t){let n=e.byteLength;if(!t||n{const s=Rn(e,t);let o=0,i,c=f=>{i||(i=!0,r&&r(f))};return new ReadableStream({async pull(f){try{const{done:u,value:l}=await s.next();if(u){c(),f.close();return}let d=l.byteLength;if(n){let b=o+=d;n(b)}f.enqueue(new Uint8Array(l))}catch(u){throw c(u),u}},cancel(f){return c(f),s.return()}},{highWaterMark:2})},Q=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",Xe=Q&&typeof ReadableStream=="function",Tn=Q&&(typeof TextEncoder=="function"?(e=>t=>e.encode(t))(new TextEncoder):async e=>new Uint8Array(await new Response(e).arrayBuffer())),Qe=(e,...t)=>{try{return!!e(...t)}catch{return!1}},An=Xe&&Qe(()=>{let e=!1;const t=new Request(T.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t}),Ce=64*1024,oe=Xe&&Qe(()=>a.isReadableStream(new Response("").body)),J={stream:oe&&(e=>e.body)};Q&&(e=>{["text","arrayBuffer","blob","formData","stream"].forEach(t=>{!J[t]&&(J[t]=a.isFunction(e[t])?n=>n[t]():(n,r)=>{throw new m(`Response type '${t}' is not supported`,m.ERR_NOT_SUPPORT,r)})})})(new Response);const xn=async e=>{if(e==null)return 0;if(a.isBlob(e))return e.size;if(a.isSpecCompliantForm(e))return(await new Request(T.origin,{method:"POST",body:e}).arrayBuffer()).byteLength;if(a.isArrayBufferView(e)||a.isArrayBuffer(e))return e.byteLength;if(a.isURLSearchParams(e)&&(e=e+""),a.isString(e))return(await Tn(e)).byteLength},Cn=async(e,t)=>{const n=a.toFiniteNumber(e.getContentLength());return n==null?xn(t):n};var Nn=Q&&(async e=>{let{url:t,method:n,data:r,signal:s,cancelToken:o,timeout:i,onDownloadProgress:c,onUploadProgress:f,responseType:u,headers:l,withCredentials:d="same-origin",fetchOptions:b}=Ge(e);u=u?(u+"").toLowerCase():"text";let S=Sn([s,o&&o.toAbortSignal()],i),p;const y=S&&S.unsubscribe&&(()=>{S.unsubscribe()});let h;try{if(f&&An&&n!=="get"&&n!=="head"&&(h=await Cn(l,r))!==0){let O=new Request(t,{method:"POST",body:r,duplex:"half"}),P;if(a.isFormData(r)&&(P=O.headers.get("content-type"))&&l.setContentType(P),O.body){const[F,H]=Oe(h,z(Te(f)));r=xe(O.body,Ce,F,H)}}a.isString(d)||(d=d?"include":"omit");const w="credentials"in Request.prototype;p=new Request(t,{...b,signal:S,method:n.toUpperCase(),headers:l.normalize().toJSON(),body:r,duplex:"half",credentials:w?d:void 0});let g=await fetch(p);const R=oe&&(u==="stream"||u==="response");if(oe&&(c||R&&y)){const O={};["status","statusText","headers"].forEach(ye=>{O[ye]=g[ye]});const P=a.toFiniteNumber(g.headers.get("content-length")),[F,H]=c&&Oe(P,z(Te(c),!0))||[];g=new Response(xe(g.body,Ce,F,()=>{H&&H(),y&&y()}),O)}u=u||"text";let N=await J[a.findKey(J,u)||"text"](g,e);return!R&&y&&y(),await new Promise((O,P)=>{We(O,P,{data:N,headers:x.from(g.headers),status:g.status,statusText:g.statusText,config:e,request:p})})}catch(w){throw y&&y(),w&&w.name==="TypeError"&&/fetch/i.test(w.message)?Object.assign(new m("Network Error",m.ERR_NETWORK,e,p),{cause:w.cause||w}):m.from(w,w&&w.code,e,p)}});const ie={http:It,xhr:wn,fetch:Nn};a.forEach(ie,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Ne=e=>`- ${e}`,Pn=e=>a.isFunction(e)||e===null||e===!1;var Ze={getAdapter:e=>{e=a.isArray(e)?e:[e];const{length:t}=e;let n,r;const s={};for(let o=0;o`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let i=t?o.length>1?`since : +`+o.map(Ne).join(` +`):" "+Ne(o[0]):"as no adapter specified";throw new m("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r},adapters:ie};function te(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new U(null,e)}function Pe(e){return te(e),e.headers=x.from(e.headers),e.data=ee.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Ze.getAdapter(e.adapter||pe.adapter)(e).then(function(r){return te(e),r.data=ee.call(e,e.transformResponse,r),r.headers=x.from(r.headers),r},function(r){return Ve(r)||(te(e),r&&r.response&&(r.response.data=ee.call(e,e.transformResponse,r.response),r.response.headers=x.from(r.response.headers))),Promise.reject(r)})}const Ye="1.7.7",he={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{he[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const _e={};he.transitional=function(t,n,r){function s(o,i){return"[Axios v"+Ye+"] Transitional option '"+o+"'"+i+(r?". "+r:"")}return(o,i,c)=>{if(t===!1)throw new m(s(i," has been removed"+(n?" in "+n:"")),m.ERR_DEPRECATED);return n&&!_e[i]&&(_e[i]=!0),t?t(o,i,c):!0}};function _n(e,t,n){if(typeof e!="object")throw new m("options must be an object",m.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const o=r[s],i=t[o];if(i){const c=e[o],f=c===void 0||i(c,o,e);if(f!==!0)throw new m("option "+o+" must be "+f,m.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new m("Unknown option "+o,m.ERR_BAD_OPTION)}}var ae={assertOptions:_n,validators:he};const _=ae.validators;class ${constructor(t){this.defaults=t,this.interceptors={request:new ge,response:new ge}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s;Error.captureStackTrace?Error.captureStackTrace(s={}):s=new Error;const o=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?o&&!String(r.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(r.stack+=` +`+o):r.stack=o}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=L(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:o}=n;r!==void 0&&ae.assertOptions(r,{silentJSONParsing:_.transitional(_.boolean),forcedJSONParsing:_.transitional(_.boolean),clarifyTimeoutError:_.transitional(_.boolean)},!1),s!=null&&(a.isFunction(s)?n.paramsSerializer={serialize:s}:ae.assertOptions(s,{encode:_.function,serialize:_.function},!0)),n.method=(n.method||this.defaults.method||"get").toLowerCase();let i=o&&a.merge(o.common,o[n.method]);o&&a.forEach(["delete","get","head","post","put","patch","common"],p=>{delete o[p]}),n.headers=x.concat(i,o);const c=[];let f=!0;this.interceptors.request.forEach(function(y){typeof y.runWhen=="function"&&y.runWhen(n)===!1||(f=f&&y.synchronous,c.unshift(y.fulfilled,y.rejected))});const u=[];this.interceptors.response.forEach(function(y){u.push(y.fulfilled,y.rejected)});let l,d=0,b;if(!f){const p=[Pe.bind(this),void 0];for(p.unshift.apply(p,c),p.push.apply(p,u),b=p.length,l=Promise.resolve(n);d{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](s);r._listeners=null}),this.promise.then=s=>{let o;const i=new Promise(c=>{r.subscribe(c),o=c}).then(s);return i.cancel=function(){r.unsubscribe(o)},i},t(function(o,i,c){r.reason||(r.reason=new U(o,i,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new me(function(s){t=s}),cancel:t}}}var Fn=me;function Bn(e){return function(n){return e.apply(null,n)}}function Ln(e){return a.isObject(e)&&e.isAxiosError===!0}const ce={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ce).forEach(([e,t])=>{ce[t]=e});var Dn=ce;function et(e){const t=new M(e),n=Fe(M.prototype.request,t);return a.extend(n,M.prototype,t,{allOwnKeys:!0}),a.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return et(L(e,s))},n}const E=et(pe);E.Axios=M;E.CanceledError=U;E.CancelToken=Fn;E.isCancel=Ve;E.VERSION=Ye;E.toFormData=G;E.AxiosError=m;E.Cancel=E.CanceledError;E.all=function(t){return Promise.all(t)};E.spread=Bn;E.isAxiosError=Ln;E.mergeConfig=L;E.AxiosHeaders=x;E.formToJSON=e=>$e(a.isHTMLForm(e)?new FormData(e):e);E.getAdapter=Ze.getAdapter;E.HttpStatusCode=Dn;E.default=E;var Un=E;export{Un as a}; diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/console-35a3b78f.js b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/console-35a3b78f.js new file mode 100644 index 00000000000..2cdc631f4f9 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/console-35a3b78f.js @@ -0,0 +1,58 @@ +import{a as ce,i as ke,j as Ee,_ as Be,d as Te,k as ae,l as Ie,o as Pe,b as ue,e as G,u as fe,n as ye,w as pe,v as me,g as Ce,m as Le,p as xe,c as Oe,h as He}from"./main-38ee3337.js";/* empty css */var Se={exports:{}};(function(X,z){(function(ee,J){X.exports=J()})(self,function(){return(()=>{var ee={4567:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const o=h(9042),d=h(6114),c=h(9924),_=h(3656),l=h(844),a=h(5596),i=h(9631);class e extends l.Disposable{constructor(t,s){super(),this._terminal=t,this._renderService=s,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityTreeRoot=document.createElement("div"),this._accessibilityTreeRoot.classList.add("xterm-accessibility"),this._accessibilityTreeRoot.tabIndex=0,this._rowContainer=document.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let f=0;fthis._onBoundaryFocus(f,0),this._bottomBoundaryFocusListener=f=>this._onBoundaryFocus(f,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityTreeRoot.appendChild(this._rowContainer),this._renderRowsDebouncer=new c.TimeBasedDebouncer(this._renderRows.bind(this)),this._refreshRows(),this._liveRegion=document.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityTreeRoot.appendChild(this._liveRegion),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityTreeRoot),this.register(this._renderRowsDebouncer),this.register(this._terminal.onResize(f=>this._onResize(f.rows))),this.register(this._terminal.onRender(f=>this._refreshRows(f.start,f.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(f=>this._onChar(f))),this.register(this._terminal.onLineFeed(()=>this._onChar(` +`))),this.register(this._terminal.onA11yTab(f=>this._onTab(f))),this.register(this._terminal.onKey(f=>this._onKey(f.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this._screenDprMonitor=new a.ScreenDprMonitor(window),this.register(this._screenDprMonitor),this._screenDprMonitor.setListener(()=>this._refreshRowsDimensions()),this.register((0,_.addDisposableDomListener)(window,"resize",()=>this._refreshRowsDimensions()))}dispose(){super.dispose(),(0,i.removeElementFromParent)(this._accessibilityTreeRoot),this._rowElements.length=0}_onBoundaryFocus(t,s){const f=t.target,v=this._rowElements[s===0?1:this._rowElements.length-2];if(f.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||t.relatedTarget!==v)return;let u,C;if(s===0?(u=f,C=this._rowElements.pop(),this._rowContainer.removeChild(C)):(u=this._rowElements.shift(),C=f,this._rowContainer.removeChild(u)),u.removeEventListener("focus",this._topBoundaryFocusListener),C.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const g=this._createAccessibilityTreeNode();this._rowElements.unshift(g),this._rowContainer.insertAdjacentElement("afterbegin",g)}else{const g=this._createAccessibilityTreeNode();this._rowElements.push(g),this._rowContainer.appendChild(g)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),t.preventDefault(),t.stopImmediatePropagation()}_onResize(t){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;st;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const t=document.createElement("div");return t.setAttribute("role","listitem"),t.tabIndex=-1,this._refreshRowDimensions(t),t}_onTab(t){for(let s=0;s0?this._charsToConsume.shift()!==t&&(this._charsToAnnounce+=t):this._charsToAnnounce+=t,t===` +`&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=o.tooMuchOutput)),d.isMac&&this._liveRegion.textContent&&this._liveRegion.textContent.length>0&&!this._liveRegion.parentNode&&setTimeout(()=>{this._accessibilityTreeRoot.appendChild(this._liveRegion)},0))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0,d.isMac&&(0,i.removeElementFromParent)(this._liveRegion)}_onKey(t){this._clearLiveRegion(),this._charsToConsume.push(t)}_refreshRows(t,s){this._renderRowsDebouncer.refresh(t,s,this._terminal.rows)}_renderRows(t,s){const f=this._terminal.buffer,v=f.lines.length.toString();for(let u=t;u<=s;u++){const C=f.translateBufferLineToString(f.ydisp+u,!0),g=(f.ydisp+u+1).toString(),m=this._rowElements[u];m&&(C.length===0?m.innerText="\xA0":m.textContent=C,m.setAttribute("aria-posinset",g),m.setAttribute("aria-setsize",v))}this._announceCharacters()}_refreshRowsDimensions(){if(this._renderService.dimensions.actualCellHeight){this._rowElements.length!==this._terminal.rows&&this._onResize(this._terminal.rows);for(let t=0;t{function h(_){return _.replace(/\r?\n/g,"\r")}function o(_,l){return l?"\x1B[200~"+_+"\x1B[201~":_}function d(_,l,a){_=o(_=h(_),a.decPrivateModes.bracketedPasteMode),a.triggerDataEvent(_,!0),l.value=""}function c(_,l,a){const i=a.getBoundingClientRect(),e=_.clientX-i.left-10,n=_.clientY-i.top-10;l.style.width="20px",l.style.height="20px",l.style.left=`${e}px`,l.style.top=`${n}px`,l.style.zIndex="1000",l.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=h,r.bracketTextForPaste=o,r.copyHandler=function(_,l){_.clipboardData&&_.clipboardData.setData("text/plain",l.selectionText),_.preventDefault()},r.handlePasteEvent=function(_,l,a){_.stopPropagation(),_.clipboardData&&d(_.clipboardData.getData("text/plain"),l,a)},r.paste=d,r.moveTextAreaUnderMouseCursor=c,r.rightClickHandler=function(_,l,a,i,e){c(_,l,a),e&&i.rightClickSelect(_),l.value=i.selectionText,l.select()}},7239:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const o=h(1505);r.ColorContrastCache=class{constructor(){this._color=new o.TwoKeyMap,this._css=new o.TwoKeyMap}setCss(d,c,_){this._css.set(d,c,_)}getCss(d,c){return this._css.get(d,c)}setColor(d,c,_){this._color.set(d,c,_)}getColor(d,c){return this._color.get(d,c)}clear(){this._color.clear(),this._css.clear()}}},5680:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorManager=r.DEFAULT_ANSI_COLORS=void 0;const o=h(8055),d=h(7239),c=o.css.toColor("#ffffff"),_=o.css.toColor("#000000"),l=o.css.toColor("#ffffff"),a=o.css.toColor("#000000"),i={css:"rgba(255, 255, 255, 0.3)",rgba:4294967117};r.DEFAULT_ANSI_COLORS=Object.freeze((()=>{const e=[o.css.toColor("#2e3436"),o.css.toColor("#cc0000"),o.css.toColor("#4e9a06"),o.css.toColor("#c4a000"),o.css.toColor("#3465a4"),o.css.toColor("#75507b"),o.css.toColor("#06989a"),o.css.toColor("#d3d7cf"),o.css.toColor("#555753"),o.css.toColor("#ef2929"),o.css.toColor("#8ae234"),o.css.toColor("#fce94f"),o.css.toColor("#729fcf"),o.css.toColor("#ad7fa8"),o.css.toColor("#34e2e2"),o.css.toColor("#eeeeec")],n=[0,95,135,175,215,255];for(let t=0;t<216;t++){const s=n[t/36%6|0],f=n[t/6%6|0],v=n[t%6];e.push({css:o.channels.toCss(s,f,v),rgba:o.channels.toRgba(s,f,v)})}for(let t=0;t<24;t++){const s=8+10*t;e.push({css:o.channels.toCss(s,s,s),rgba:o.channels.toRgba(s,s,s)})}return e})()),r.ColorManager=class{constructor(e,n){this.allowTransparency=n;const t=e.createElement("canvas");t.width=1,t.height=1;const s=t.getContext("2d");if(!s)throw new Error("Could not get rendering context");this._ctx=s,this._ctx.globalCompositeOperation="copy",this._litmusColor=this._ctx.createLinearGradient(0,0,1,1),this._contrastCache=new d.ColorContrastCache,this.colors={foreground:c,background:_,cursor:l,cursorAccent:a,selectionForeground:void 0,selectionBackgroundTransparent:i,selectionBackgroundOpaque:o.color.blend(_,i),selectionInactiveBackgroundTransparent:i,selectionInactiveBackgroundOpaque:o.color.blend(_,i),ansi:r.DEFAULT_ANSI_COLORS.slice(),contrastCache:this._contrastCache},this._updateRestoreColors()}onOptionsChange(e,n){switch(e){case"minimumContrastRatio":this._contrastCache.clear();break;case"allowTransparency":this.allowTransparency=n}}setTheme(e={}){this.colors.foreground=this._parseColor(e.foreground,c),this.colors.background=this._parseColor(e.background,_),this.colors.cursor=this._parseColor(e.cursor,l,!0),this.colors.cursorAccent=this._parseColor(e.cursorAccent,a,!0),this.colors.selectionBackgroundTransparent=this._parseColor(e.selectionBackground,i,!0),this.colors.selectionBackgroundOpaque=o.color.blend(this.colors.background,this.colors.selectionBackgroundTransparent),this.colors.selectionInactiveBackgroundTransparent=this._parseColor(e.selectionInactiveBackground,this.colors.selectionBackgroundTransparent,!0),this.colors.selectionInactiveBackgroundOpaque=o.color.blend(this.colors.background,this.colors.selectionInactiveBackgroundTransparent);const n={css:"",rgba:0};if(this.colors.selectionForeground=e.selectionForeground?this._parseColor(e.selectionForeground,n):void 0,this.colors.selectionForeground===n&&(this.colors.selectionForeground=void 0),o.color.isOpaque(this.colors.selectionBackgroundTransparent)&&(this.colors.selectionBackgroundTransparent=o.color.opacity(this.colors.selectionBackgroundTransparent,.3)),o.color.isOpaque(this.colors.selectionInactiveBackgroundTransparent)&&(this.colors.selectionInactiveBackgroundTransparent=o.color.opacity(this.colors.selectionInactiveBackgroundTransparent,.3)),this.colors.ansi=r.DEFAULT_ANSI_COLORS.slice(),this.colors.ansi[0]=this._parseColor(e.black,r.DEFAULT_ANSI_COLORS[0]),this.colors.ansi[1]=this._parseColor(e.red,r.DEFAULT_ANSI_COLORS[1]),this.colors.ansi[2]=this._parseColor(e.green,r.DEFAULT_ANSI_COLORS[2]),this.colors.ansi[3]=this._parseColor(e.yellow,r.DEFAULT_ANSI_COLORS[3]),this.colors.ansi[4]=this._parseColor(e.blue,r.DEFAULT_ANSI_COLORS[4]),this.colors.ansi[5]=this._parseColor(e.magenta,r.DEFAULT_ANSI_COLORS[5]),this.colors.ansi[6]=this._parseColor(e.cyan,r.DEFAULT_ANSI_COLORS[6]),this.colors.ansi[7]=this._parseColor(e.white,r.DEFAULT_ANSI_COLORS[7]),this.colors.ansi[8]=this._parseColor(e.brightBlack,r.DEFAULT_ANSI_COLORS[8]),this.colors.ansi[9]=this._parseColor(e.brightRed,r.DEFAULT_ANSI_COLORS[9]),this.colors.ansi[10]=this._parseColor(e.brightGreen,r.DEFAULT_ANSI_COLORS[10]),this.colors.ansi[11]=this._parseColor(e.brightYellow,r.DEFAULT_ANSI_COLORS[11]),this.colors.ansi[12]=this._parseColor(e.brightBlue,r.DEFAULT_ANSI_COLORS[12]),this.colors.ansi[13]=this._parseColor(e.brightMagenta,r.DEFAULT_ANSI_COLORS[13]),this.colors.ansi[14]=this._parseColor(e.brightCyan,r.DEFAULT_ANSI_COLORS[14]),this.colors.ansi[15]=this._parseColor(e.brightWhite,r.DEFAULT_ANSI_COLORS[15]),e.extendedAnsi){const t=Math.min(this.colors.ansi.length-16,e.extendedAnsi.length);for(let s=0;sNumber(m)),g=Math.round(255*C);return{rgba:o.channels.toRgba(f,v,u,g),css:e}}return{css:this._ctx.fillStyle,rgba:o.channels.toRgba(s[0],s[1],s[2],s[3])}}}},9631:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.removeElementFromParent=void 0,r.removeElementFromParent=function(...h){var o;for(const d of h)(o=d==null?void 0:d.parentElement)===null||o===void 0||o.removeChild(d)}},3656:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(h,o,d,c){h.addEventListener(o,d,c);let _=!1;return{dispose:()=>{_||(_=!0,h.removeEventListener(o,d,c))}}}},6465:function(D,r,h){var o=this&&this.__decorate||function(e,n,t,s){var f,v=arguments.length,u=v<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,n,t,s);else for(var C=e.length-1;C>=0;C--)(f=e[C])&&(u=(v<3?f(u):v>3?f(n,t,u):f(n,t))||u);return v>3&&u&&Object.defineProperty(n,t,u),u},d=this&&this.__param||function(e,n){return function(t,s){n(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier2=void 0;const c=h(2585),_=h(8460),l=h(844),a=h(3656);let i=class extends l.Disposable{constructor(e){super(),this._bufferService=e,this._linkProviders=[],this._linkCacheDisposables=[],this._isMouseOut=!0,this._activeLine=-1,this._onShowLinkUnderline=this.register(new _.EventEmitter),this._onHideLinkUnderline=this.register(new _.EventEmitter),this.register((0,l.getDisposeArrayDisposable)(this._linkCacheDisposables))}get currentLink(){return this._currentLink}get onShowLinkUnderline(){return this._onShowLinkUnderline.event}get onHideLinkUnderline(){return this._onHideLinkUnderline.event}dispose(){super.dispose(),this._lastMouseEvent=void 0}registerLinkProvider(e){return this._linkProviders.push(e),{dispose:()=>{const n=this._linkProviders.indexOf(e);n!==-1&&this._linkProviders.splice(n,1)}}}attachToDom(e,n,t){this._element=e,this._mouseService=n,this._renderService=t,this.register((0,a.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,a.addDisposableDomListener)(this._element,"mousemove",this._onMouseMove.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,a.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_onMouseMove(e){if(this._lastMouseEvent=e,!this._element||!this._mouseService)return;const n=this._positionFromMouseEvent(e,this._element,this._mouseService);if(!n)return;this._isMouseOut=!1;const t=e.composedPath();for(let s=0;s{v==null||v.forEach(u=>{u.link.dispose&&u.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=e.y);let f=!1;for(const[v,u]of this._linkProviders.entries())n?!((s=this._activeProviderReplies)===null||s===void 0)&&s.get(v)&&(f=this._checkLinkProviderResult(v,e,f)):u.provideLinks(e.y,C=>{var g,m;if(this._isMouseOut)return;const b=C==null?void 0:C.map(y=>({link:y}));(g=this._activeProviderReplies)===null||g===void 0||g.set(v,b),f=this._checkLinkProviderResult(v,e,f),((m=this._activeProviderReplies)===null||m===void 0?void 0:m.size)===this._linkProviders.length&&this._removeIntersectingLinks(e.y,this._activeProviderReplies)})}_removeIntersectingLinks(e,n){const t=new Set;for(let s=0;se?this._bufferService.cols:u.link.range.end.x;for(let m=C;m<=g;m++){if(t.has(m)){f.splice(v--,1);break}t.add(m)}}}}_checkLinkProviderResult(e,n,t){var s;if(!this._activeProviderReplies)return t;const f=this._activeProviderReplies.get(e);let v=!1;for(let u=0;uthis._linkAtPosition(C.link,n));u&&(t=!0,this._handleNewLink(u))}if(this._activeProviderReplies.size===this._linkProviders.length&&!t)for(let u=0;uthis._linkAtPosition(g.link,n));if(C){t=!0,this._handleNewLink(C);break}}return t}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(e){if(!this._element||!this._mouseService||!this._currentLink)return;const n=this._positionFromMouseEvent(e,this._element,this._mouseService);n&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,n)&&this._currentLink.link.activate(e,this._currentLink.link.text)}_clearCurrentLink(e,n){this._element&&this._currentLink&&this._lastMouseEvent&&(!e||!n||this._currentLink.link.range.start.y>=e&&this._currentLink.link.range.end.y<=n)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,l.disposeArray)(this._linkCacheDisposables))}_handleNewLink(e){if(!this._element||!this._lastMouseEvent||!this._mouseService)return;const n=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);n&&this._linkAtPosition(e.link,n)&&(this._currentLink=e,this._currentLink.state={decorations:{underline:e.link.decorations===void 0||e.link.decorations.underline,pointerCursor:e.link.decorations===void 0||e.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,e.link,this._lastMouseEvent),e.link.decorations={},Object.defineProperties(e.link.decorations,{pointerCursor:{get:()=>{var t,s;return(s=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||s===void 0?void 0:s.decorations.pointerCursor},set:t=>{var s,f;((s=this._currentLink)===null||s===void 0?void 0:s.state)&&this._currentLink.state.decorations.pointerCursor!==t&&(this._currentLink.state.decorations.pointerCursor=t,this._currentLink.state.isHovered&&((f=this._element)===null||f===void 0||f.classList.toggle("xterm-cursor-pointer",t)))}},underline:{get:()=>{var t,s;return(s=(t=this._currentLink)===null||t===void 0?void 0:t.state)===null||s===void 0?void 0:s.decorations.underline},set:t=>{var s,f,v;((s=this._currentLink)===null||s===void 0?void 0:s.state)&&((v=(f=this._currentLink)===null||f===void 0?void 0:f.state)===null||v===void 0?void 0:v.decorations.underline)!==t&&(this._currentLink.state.decorations.underline=t,this._currentLink.state.isHovered&&this._fireUnderlineEvent(e.link,t))}}}),this._renderService&&this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(t=>{const s=t.start===0?0:t.start+1+this._bufferService.buffer.ydisp;this._clearCurrentLink(s,t.end+1+this._bufferService.buffer.ydisp)})))}_linkHover(e,n,t){var s;!((s=this._currentLink)===null||s===void 0)&&s.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!0),this._currentLink.state.decorations.pointerCursor&&e.classList.add("xterm-cursor-pointer")),n.hover&&n.hover(t,n.text)}_fireUnderlineEvent(e,n){const t=e.range,s=this._bufferService.buffer.ydisp,f=this._createLinkUnderlineEvent(t.start.x-1,t.start.y-s-1,t.end.x,t.end.y-s-1,void 0);(n?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(f)}_linkLeave(e,n,t){var s;!((s=this._currentLink)===null||s===void 0)&&s.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(n,!1),this._currentLink.state.decorations.pointerCursor&&e.classList.remove("xterm-cursor-pointer")),n.leave&&n.leave(t,n.text)}_linkAtPosition(e,n){const t=e.range.start.y===e.range.end.y,s=e.range.start.yn.y;return(t&&e.range.start.x<=n.x&&e.range.end.x>=n.x||s&&e.range.end.x>=n.x||f&&e.range.start.x<=n.x||s&&f)&&e.range.start.y<=n.y&&e.range.end.y>=n.y}_positionFromMouseEvent(e,n,t){const s=t.getCoords(e,n,this._bufferService.cols,this._bufferService.rows);if(s)return{x:s[0],y:s[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(e,n,t,s,f){return{x1:e,y1:n,x2:t,y2:s,cols:this._bufferService.cols,fg:f}}};i=o([d(0,c.IBufferService)],i),r.Linkifier2=i},9042:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},2962:function(D,r,h){var o=this&&this.__decorate||function(i,e,n,t){var s,f=arguments.length,v=f<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,n):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,e,n,t);else for(var u=i.length-1;u>=0;u--)(s=i[u])&&(v=(f<3?s(v):f>3?s(e,n,v):s(e,n))||v);return f>3&&v&&Object.defineProperty(e,n,v),v},d=this&&this.__param||function(i,e){return function(n,t){e(n,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const c=h(511),_=h(2585);let l=class{constructor(i,e,n){this._bufferService=i,this._optionsService=e,this._oscLinkService=n}provideLinks(i,e){var n;const t=this._bufferService.buffer.lines.get(i-1);if(!t)return void e(void 0);const s=[],f=this._optionsService.rawOptions.linkHandler,v=new c.CellData,u=t.getTrimmedLength();let C=-1,g=-1,m=!1;for(let b=0;bf?f.activate(p,S,w):a(0,S),hover:(p,S)=>{var L;return(L=f==null?void 0:f.hover)===null||L===void 0?void 0:L.call(f,p,S,w)},leave:(p,S)=>{var L;return(L=f==null?void 0:f.leave)===null||L===void 0?void 0:L.call(f,p,S,w)}})}m=!1,v.hasExtendedAttrs()&&v.extended.urlId?(g=b,C=v.extended.urlId):(g=-1,C=-1)}}e(s)}};function a(i,e){if(confirm(`Do you want to navigate to ${e}?`)){const n=window.open();if(n){try{n.opener=null}catch{}n.location.href=e}}}l=o([d(0,_.IBufferService),d(1,_.IOptionsService),d(2,_.IOscLinkService)],l),r.OscLinkProvider=l},6193:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderDebouncer=void 0,r.RenderDebouncer=class{constructor(h,o){this._parentWindow=h,this._renderCallback=o,this._refreshCallbacks=[]}dispose(){this._animationFrame&&(this._parentWindow.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}addRefreshCallback(h){return this._refreshCallbacks.push(h),this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh())),this._animationFrame}refresh(h,o,d){this._rowCount=d,h=h!==void 0?h:0,o=o!==void 0?o:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,o):o,this._animationFrame||(this._animationFrame=this._parentWindow.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return void this._runRefreshCallbacks();const h=Math.max(this._rowStart,0),o=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,o),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(const h of this._refreshCallbacks)h(0);this._refreshCallbacks=[]}}},5596:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ScreenDprMonitor=void 0;const o=h(844);class d extends o.Disposable{constructor(_){super(),this._parentWindow=_,this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio}setListener(_){this._listener&&this.clearListener(),this._listener=_,this._outerListener=()=>{this._listener&&(this._listener(this._parentWindow.devicePixelRatio,this._currentDevicePixelRatio),this._updateDpr())},this._updateDpr()}dispose(){super.dispose(),this.clearListener()}_updateDpr(){var _;this._outerListener&&((_=this._resolutionMediaMatchList)===null||_===void 0||_.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){this._resolutionMediaMatchList&&this._listener&&this._outerListener&&(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._listener=void 0,this._outerListener=void 0)}}r.ScreenDprMonitor=d},3236:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Terminal=void 0;const o=h(2950),d=h(1680),c=h(3614),_=h(2584),l=h(5435),a=h(9312),i=h(6114),e=h(3656),n=h(9042),t=h(4567),s=h(1296),f=h(7399),v=h(8460),u=h(8437),C=h(5680),g=h(3230),m=h(4725),b=h(428),y=h(8934),w=h(6465),p=h(5114),S=h(8969),L=h(8055),E=h(4269),A=h(5941),k=h(3107),O=h(5744),T=h(9074),H=h(2585),W=h(2962),x=typeof window!="undefined"?window.document:null;class B extends S.CoreTerminal{constructor(R={}){super(R),this.browser=i,this._keyDownHandled=!1,this._keyDownSeen=!1,this._keyPressHandled=!1,this._unprocessedDeadKey=!1,this._onCursorMove=new v.EventEmitter,this._onKey=new v.EventEmitter,this._onRender=new v.EventEmitter,this._onSelectionChange=new v.EventEmitter,this._onTitleChange=new v.EventEmitter,this._onBell=new v.EventEmitter,this._onFocus=new v.EventEmitter,this._onBlur=new v.EventEmitter,this._onA11yCharEmitter=new v.EventEmitter,this._onA11yTabEmitter=new v.EventEmitter,this._setup(),this.linkifier2=this.register(this._instantiationService.createInstance(w.Linkifier2)),this.linkifier2.registerLinkProvider(this._instantiationService.createInstance(W.OscLinkProvider)),this._decorationService=this._instantiationService.createInstance(T.DecorationService),this._instantiationService.setService(H.IDecorationService,this._decorationService),this.register(this._inputHandler.onRequestBell(()=>this._onBell.fire())),this.register(this._inputHandler.onRequestRefreshRows((M,F)=>this.refresh(M,F))),this.register(this._inputHandler.onRequestSendFocus(()=>this._reportFocus())),this.register(this._inputHandler.onRequestReset(()=>this.reset())),this.register(this._inputHandler.onRequestWindowsOptionsReport(M=>this._reportWindowsOptions(M))),this.register(this._inputHandler.onColor(M=>this._handleColorEvent(M))),this.register((0,v.forwardEvent)(this._inputHandler.onCursorMove,this._onCursorMove)),this.register((0,v.forwardEvent)(this._inputHandler.onTitleChange,this._onTitleChange)),this.register((0,v.forwardEvent)(this._inputHandler.onA11yChar,this._onA11yCharEmitter)),this.register((0,v.forwardEvent)(this._inputHandler.onA11yTab,this._onA11yTabEmitter)),this.register(this._bufferService.onResize(M=>this._afterResize(M.cols,M.rows)))}get onCursorMove(){return this._onCursorMove.event}get onKey(){return this._onKey.event}get onRender(){return this._onRender.event}get onSelectionChange(){return this._onSelectionChange.event}get onTitleChange(){return this._onTitleChange.event}get onBell(){return this._onBell.event}get onFocus(){return this._onFocus.event}get onBlur(){return this._onBlur.event}get onA11yChar(){return this._onA11yCharEmitter.event}get onA11yTab(){return this._onA11yTabEmitter.event}_handleColorEvent(R){var M,F;if(this._colorManager){for(const U of R){let $,I="";switch(U.index){case 256:$="foreground",I="10";break;case 257:$="background",I="11";break;case 258:$="cursor",I="12";break;default:$="ansi",I="4;"+U.index}switch(U.type){case 0:const K=L.color.toColorRGB($==="ansi"?this._colorManager.colors.ansi[U.index]:this._colorManager.colors[$]);this.coreService.triggerDataEvent(`${_.C0.ESC}]${I};${(0,A.toRgbString)(K)}${_.C1_ESCAPED.ST}`);break;case 1:$==="ansi"?this._colorManager.colors.ansi[U.index]=L.rgba.toColor(...U.color):this._colorManager.colors[$]=L.rgba.toColor(...U.color);break;case 2:this._colorManager.restoreColor(U.index)}}(M=this._renderService)===null||M===void 0||M.setColors(this._colorManager.colors),(F=this.viewport)===null||F===void 0||F.onThemeChange(this._colorManager.colors)}}dispose(){var R,M,F;this._isDisposed||(super.dispose(),(R=this._renderService)===null||R===void 0||R.dispose(),this._customKeyEventHandler=void 0,this.write=()=>{},(F=(M=this.element)===null||M===void 0?void 0:M.parentNode)===null||F===void 0||F.removeChild(this.element))}_setup(){super._setup(),this._customKeyEventHandler=void 0}get buffer(){return this.buffers.active}focus(){this.textarea&&this.textarea.focus({preventScroll:!0})}_updateOptions(R){var M,F,U,$;switch(super._updateOptions(R),R){case"fontFamily":case"fontSize":(M=this._renderService)===null||M===void 0||M.clear(),(F=this._charSizeService)===null||F===void 0||F.measure();break;case"cursorBlink":case"cursorStyle":this.refresh(this.buffer.y,this.buffer.y);break;case"customGlyphs":case"drawBoldTextInBrightColors":case"letterSpacing":case"lineHeight":case"fontWeight":case"fontWeightBold":case"minimumContrastRatio":this._renderService&&(this._renderService.clear(),this._renderService.onResize(this.cols,this.rows),this.refresh(0,this.rows-1));break;case"scrollback":(U=this.viewport)===null||U===void 0||U.syncScrollArea();break;case"screenReaderMode":this.optionsService.rawOptions.screenReaderMode?!this._accessibilityManager&&this._renderService&&(this._accessibilityManager=new t.AccessibilityManager(this,this._renderService)):(($=this._accessibilityManager)===null||$===void 0||$.dispose(),this._accessibilityManager=void 0);break;case"tabStopWidth":this.buffers.setupTabStops();break;case"theme":this._setTheme(this.optionsService.rawOptions.theme)}}_onTextAreaFocus(R){this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(_.C0.ESC+"[I"),this.updateCursorStyle(R),this.element.classList.add("focus"),this._showCursor(),this._onFocus.fire()}blur(){var R;return(R=this.textarea)===null||R===void 0?void 0:R.blur()}_onTextAreaBlur(){this.textarea.value="",this.refresh(this.buffer.y,this.buffer.y),this.coreService.decPrivateModes.sendFocus&&this.coreService.triggerDataEvent(_.C0.ESC+"[O"),this.element.classList.remove("focus"),this._onBlur.fire()}_syncTextArea(){if(!this.textarea||!this.buffer.isCursorInViewport||this._compositionHelper.isComposing||!this._renderService)return;const R=this.buffer.ybase+this.buffer.y,M=this.buffer.lines.get(R);if(!M)return;const F=Math.min(this.buffer.x,this.cols-1),U=this._renderService.dimensions.actualCellHeight,$=M.getWidth(F),I=this._renderService.dimensions.actualCellWidth*$,K=this.buffer.y*this._renderService.dimensions.actualCellHeight,N=F*this._renderService.dimensions.actualCellWidth;this.textarea.style.left=N+"px",this.textarea.style.top=K+"px",this.textarea.style.width=I+"px",this.textarea.style.height=U+"px",this.textarea.style.lineHeight=U+"px",this.textarea.style.zIndex="-5"}_initGlobal(){this._bindKeys(),this.register((0,e.addDisposableDomListener)(this.element,"copy",M=>{this.hasSelection()&&(0,c.copyHandler)(M,this._selectionService)}));const R=M=>(0,c.handlePasteEvent)(M,this.textarea,this.coreService);this.register((0,e.addDisposableDomListener)(this.textarea,"paste",R)),this.register((0,e.addDisposableDomListener)(this.element,"paste",R)),i.isFirefox?this.register((0,e.addDisposableDomListener)(this.element,"mousedown",M=>{M.button===2&&(0,c.rightClickHandler)(M,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})):this.register((0,e.addDisposableDomListener)(this.element,"contextmenu",M=>{(0,c.rightClickHandler)(M,this.textarea,this.screenElement,this._selectionService,this.options.rightClickSelectsWord)})),i.isLinux&&this.register((0,e.addDisposableDomListener)(this.element,"auxclick",M=>{M.button===1&&(0,c.moveTextAreaUnderMouseCursor)(M,this.textarea,this.screenElement)}))}_bindKeys(){this.register((0,e.addDisposableDomListener)(this.textarea,"keyup",R=>this._keyUp(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"keydown",R=>this._keyDown(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"keypress",R=>this._keyPress(R),!0)),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionstart",()=>this._compositionHelper.compositionstart())),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionupdate",R=>this._compositionHelper.compositionupdate(R))),this.register((0,e.addDisposableDomListener)(this.textarea,"compositionend",()=>this._compositionHelper.compositionend())),this.register((0,e.addDisposableDomListener)(this.textarea,"input",R=>this._inputEvent(R),!0)),this.register(this.onRender(()=>this._compositionHelper.updateCompositionElements()))}open(R){var M;if(!R)throw new Error("Terminal requires a parent element.");R.isConnected||this._logService.debug("Terminal.open was called on an element that was not attached to the DOM"),this._document=R.ownerDocument,this.element=this._document.createElement("div"),this.element.dir="ltr",this.element.classList.add("terminal"),this.element.classList.add("xterm"),this.element.setAttribute("tabindex","0"),R.appendChild(this.element);const F=x.createDocumentFragment();this._viewportElement=x.createElement("div"),this._viewportElement.classList.add("xterm-viewport"),F.appendChild(this._viewportElement),this._viewportScrollArea=x.createElement("div"),this._viewportScrollArea.classList.add("xterm-scroll-area"),this._viewportElement.appendChild(this._viewportScrollArea),this.screenElement=x.createElement("div"),this.screenElement.classList.add("xterm-screen"),this._helperContainer=x.createElement("div"),this._helperContainer.classList.add("xterm-helpers"),this.screenElement.appendChild(this._helperContainer),F.appendChild(this.screenElement),this.textarea=x.createElement("textarea"),this.textarea.classList.add("xterm-helper-textarea"),this.textarea.setAttribute("aria-label",n.promptLabel),this.textarea.setAttribute("aria-multiline","false"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.tabIndex=0,this.register((0,e.addDisposableDomListener)(this.textarea,"focus",$=>this._onTextAreaFocus($))),this.register((0,e.addDisposableDomListener)(this.textarea,"blur",()=>this._onTextAreaBlur())),this._helperContainer.appendChild(this.textarea),this._coreBrowserService=this._instantiationService.createInstance(p.CoreBrowserService,this.textarea,(M=this._document.defaultView)!==null&&M!==void 0?M:window),this._instantiationService.setService(m.ICoreBrowserService,this._coreBrowserService),this._charSizeService=this._instantiationService.createInstance(b.CharSizeService,this._document,this._helperContainer),this._instantiationService.setService(m.ICharSizeService,this._charSizeService),this._theme=this.options.theme||this._theme,this._colorManager=new C.ColorManager(x,this.options.allowTransparency),this.register(this.optionsService.onOptionChange($=>this._colorManager.onOptionsChange($,this.optionsService.rawOptions[$]))),this._colorManager.setTheme(this._theme),this._characterJoinerService=this._instantiationService.createInstance(E.CharacterJoinerService),this._instantiationService.setService(m.ICharacterJoinerService,this._characterJoinerService);const U=this._createRenderer();this._renderService=this.register(this._instantiationService.createInstance(g.RenderService,U,this.rows,this.screenElement)),this._instantiationService.setService(m.IRenderService,this._renderService),this.register(this._renderService.onRenderedViewportChange($=>this._onRender.fire($))),this.onResize($=>this._renderService.resize($.cols,$.rows)),this._compositionView=x.createElement("div"),this._compositionView.classList.add("composition-view"),this._compositionHelper=this._instantiationService.createInstance(o.CompositionHelper,this.textarea,this._compositionView),this._helperContainer.appendChild(this._compositionView),this.element.appendChild(F),this._mouseService=this._instantiationService.createInstance(y.MouseService),this._instantiationService.setService(m.IMouseService,this._mouseService),this.viewport=this._instantiationService.createInstance(d.Viewport,$=>this.scrollLines($,!0,1),this._viewportElement,this._viewportScrollArea,this.element),this.viewport.onThemeChange(this._colorManager.colors),this.register(this._inputHandler.onRequestSyncScrollBar(()=>this.viewport.syncScrollArea())),this.register(this.viewport),this.register(this.onCursorMove(()=>{this._renderService.onCursorMove(),this._syncTextArea()})),this.register(this.onResize(()=>this._renderService.onResize(this.cols,this.rows))),this.register(this.onBlur(()=>this._renderService.onBlur())),this.register(this.onFocus(()=>this._renderService.onFocus())),this.register(this._renderService.onDimensionsChange(()=>this.viewport.syncScrollArea())),this._selectionService=this.register(this._instantiationService.createInstance(a.SelectionService,this.element,this.screenElement,this.linkifier2)),this._instantiationService.setService(m.ISelectionService,this._selectionService),this.register(this._selectionService.onRequestScrollLines($=>this.scrollLines($.amount,$.suppressScrollEvent))),this.register(this._selectionService.onSelectionChange(()=>this._onSelectionChange.fire())),this.register(this._selectionService.onRequestRedraw($=>this._renderService.onSelectionChanged($.start,$.end,$.columnSelectMode))),this.register(this._selectionService.onLinuxMouseSelection($=>{this.textarea.value=$,this.textarea.focus(),this.textarea.select()})),this.register(this._onScroll.event($=>{this.viewport.syncScrollArea(),this._selectionService.refresh()})),this.register((0,e.addDisposableDomListener)(this._viewportElement,"scroll",()=>this._selectionService.refresh())),this.linkifier2.attachToDom(this.screenElement,this._mouseService,this._renderService),this.register(this._instantiationService.createInstance(k.BufferDecorationRenderer,this.screenElement)),this.register((0,e.addDisposableDomListener)(this.element,"mousedown",$=>this._selectionService.onMouseDown($))),this.coreMouseService.areMouseEventsActive?(this._selectionService.disable(),this.element.classList.add("enable-mouse-events")):this._selectionService.enable(),this.options.screenReaderMode&&(this._accessibilityManager=new t.AccessibilityManager(this,this._renderService)),this.options.overviewRulerWidth&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(O.OverviewRulerRenderer,this._viewportElement,this.screenElement))),this.optionsService.onOptionChange(()=>{!this._overviewRulerRenderer&&this.options.overviewRulerWidth&&this._viewportElement&&this.screenElement&&(this._overviewRulerRenderer=this.register(this._instantiationService.createInstance(O.OverviewRulerRenderer,this._viewportElement,this.screenElement)))}),this._charSizeService.measure(),this.refresh(0,this.rows-1),this._initGlobal(),this.bindMouse()}_createRenderer(){return this._instantiationService.createInstance(s.DomRenderer,this._colorManager.colors,this.element,this.screenElement,this._viewportElement,this.linkifier2)}_setTheme(R){var M,F,U;this._theme=R,(M=this._colorManager)===null||M===void 0||M.setTheme(R),(F=this._renderService)===null||F===void 0||F.setColors(this._colorManager.colors),(U=this.viewport)===null||U===void 0||U.onThemeChange(this._colorManager.colors)}bindMouse(){const R=this,M=this.element;function F(I){const K=R._mouseService.getMouseReportCoords(I,R.screenElement);if(!K)return!1;let N,Z;switch(I.overrideType||I.type){case"mousemove":Z=32,I.buttons===void 0?(N=3,I.button!==void 0&&(N=I.button<3?I.button:3)):N=1&I.buttons?0:4&I.buttons?1:2&I.buttons?2:3;break;case"mouseup":Z=0,N=I.button<3?I.button:3;break;case"mousedown":Z=1,N=I.button<3?I.button:3;break;case"wheel":if(R.viewport.getLinesScrolled(I)===0)return!1;Z=I.deltaY<0?0:1,N=4;break;default:return!1}return!(Z===void 0||N===void 0||N>4)&&R.coreMouseService.triggerMouseEvent({col:K.col,row:K.row,x:K.x,y:K.y,button:N,action:Z,ctrl:I.ctrlKey,alt:I.altKey,shift:I.shiftKey})}const U={mouseup:null,wheel:null,mousedrag:null,mousemove:null},$={mouseup:I=>(F(I),I.buttons||(this._document.removeEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.removeEventListener("mousemove",U.mousedrag)),this.cancel(I)),wheel:I=>(F(I),this.cancel(I,!0)),mousedrag:I=>{I.buttons&&F(I)},mousemove:I=>{I.buttons||F(I)}};this.register(this.coreMouseService.onProtocolChange(I=>{I?(this.optionsService.rawOptions.logLevel==="debug"&&this._logService.debug("Binding to mouse events:",this.coreMouseService.explainEvents(I)),this.element.classList.add("enable-mouse-events"),this._selectionService.disable()):(this._logService.debug("Unbinding from mouse events."),this.element.classList.remove("enable-mouse-events"),this._selectionService.enable()),8&I?U.mousemove||(M.addEventListener("mousemove",$.mousemove),U.mousemove=$.mousemove):(M.removeEventListener("mousemove",U.mousemove),U.mousemove=null),16&I?U.wheel||(M.addEventListener("wheel",$.wheel,{passive:!1}),U.wheel=$.wheel):(M.removeEventListener("wheel",U.wheel),U.wheel=null),2&I?U.mouseup||(U.mouseup=$.mouseup):(this._document.removeEventListener("mouseup",U.mouseup),U.mouseup=null),4&I?U.mousedrag||(U.mousedrag=$.mousedrag):(this._document.removeEventListener("mousemove",U.mousedrag),U.mousedrag=null)})),this.coreMouseService.activeProtocol=this.coreMouseService.activeProtocol,this.register((0,e.addDisposableDomListener)(M,"mousedown",I=>{if(I.preventDefault(),this.focus(),this.coreMouseService.areMouseEventsActive&&!this._selectionService.shouldForceSelection(I))return F(I),U.mouseup&&this._document.addEventListener("mouseup",U.mouseup),U.mousedrag&&this._document.addEventListener("mousemove",U.mousedrag),this.cancel(I)})),this.register((0,e.addDisposableDomListener)(M,"wheel",I=>{if(!U.wheel){if(!this.buffer.hasScrollback){const K=this.viewport.getLinesScrolled(I);if(K===0)return;const N=_.C0.ESC+(this.coreService.decPrivateModes.applicationCursorKeys?"O":"[")+(I.deltaY<0?"A":"B");let Z="";for(let oe=0;oe{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.onTouchStart(I),this.cancel(I)},{passive:!0})),this.register((0,e.addDisposableDomListener)(M,"touchmove",I=>{if(!this.coreMouseService.areMouseEventsActive)return this.viewport.onTouchMove(I)?void 0:this.cancel(I)},{passive:!1}))}refresh(R,M){var F;(F=this._renderService)===null||F===void 0||F.refreshRows(R,M)}updateCursorStyle(R){var M;!((M=this._selectionService)===null||M===void 0)&&M.shouldColumnSelect(R)?this.element.classList.add("column-select"):this.element.classList.remove("column-select")}_showCursor(){this.coreService.isCursorInitialized||(this.coreService.isCursorInitialized=!0,this.refresh(this.buffer.y,this.buffer.y))}scrollLines(R,M,F=0){super.scrollLines(R,M,F),this.refresh(0,this.rows-1)}paste(R){(0,c.paste)(R,this.textarea,this.coreService)}attachCustomKeyEventHandler(R){this._customKeyEventHandler=R}registerLinkProvider(R){return this.linkifier2.registerLinkProvider(R)}registerCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");const M=this._characterJoinerService.register(R);return this.refresh(0,this.rows-1),M}deregisterCharacterJoiner(R){if(!this._characterJoinerService)throw new Error("Terminal must be opened first");this._characterJoinerService.deregister(R)&&this.refresh(0,this.rows-1)}get markers(){return this.buffer.markers}addMarker(R){return this.buffer.addMarker(this.buffer.ybase+this.buffer.y+R)}registerDecoration(R){return this._decorationService.registerDecoration(R)}hasSelection(){return!!this._selectionService&&this._selectionService.hasSelection}select(R,M,F){this._selectionService.setSelection(R,M,F)}getSelection(){return this._selectionService?this._selectionService.selectionText:""}getSelectionPosition(){if(this._selectionService&&this._selectionService.hasSelection)return{start:{x:this._selectionService.selectionStart[0],y:this._selectionService.selectionStart[1]},end:{x:this._selectionService.selectionEnd[0],y:this._selectionService.selectionEnd[1]}}}clearSelection(){var R;(R=this._selectionService)===null||R===void 0||R.clearSelection()}selectAll(){var R;(R=this._selectionService)===null||R===void 0||R.selectAll()}selectLines(R,M){var F;(F=this._selectionService)===null||F===void 0||F.selectLines(R,M)}_keyDown(R){if(this._keyDownHandled=!1,this._keyDownSeen=!0,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;const M=this.browser.isMac&&this.options.macOptionIsMeta&&R.altKey;if(!M&&!this._compositionHelper.keydown(R))return this.buffer.ybase!==this.buffer.ydisp&&this._bufferService.scrollToBottom(),!1;M||R.key!=="Dead"&&R.key!=="AltGraph"||(this._unprocessedDeadKey=!0);const F=(0,f.evaluateKeyboardEvent)(R,this.coreService.decPrivateModes.applicationCursorKeys,this.browser.isMac,this.options.macOptionIsMeta);if(this.updateCursorStyle(R),F.type===3||F.type===2){const U=this.rows-1;return this.scrollLines(F.type===2?-U:U),this.cancel(R,!0)}return F.type===1&&this.selectAll(),!!this._isThirdLevelShift(this.browser,R)||(F.cancel&&this.cancel(R,!0),!F.key||!!(R.key&&!R.ctrlKey&&!R.altKey&&!R.metaKey&&R.key.length===1&&R.key.charCodeAt(0)>=65&&R.key.charCodeAt(0)<=90)||(this._unprocessedDeadKey?(this._unprocessedDeadKey=!1,!0):(F.key!==_.C0.ETX&&F.key!==_.C0.CR||(this.textarea.value=""),this._onKey.fire({key:F.key,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(F.key,!0),this.optionsService.rawOptions.screenReaderMode?void(this._keyDownHandled=!0):this.cancel(R,!0))))}_isThirdLevelShift(R,M){const F=R.isMac&&!this.options.macOptionIsMeta&&M.altKey&&!M.ctrlKey&&!M.metaKey||R.isWindows&&M.altKey&&M.ctrlKey&&!M.metaKey||R.isWindows&&M.getModifierState("AltGraph");return M.type==="keypress"?F:F&&(!M.keyCode||M.keyCode>47)}_keyUp(R){this._keyDownSeen=!1,this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1||(function(M){return M.keyCode===16||M.keyCode===17||M.keyCode===18}(R)||this.focus(),this.updateCursorStyle(R),this._keyPressHandled=!1)}_keyPress(R){let M;if(this._keyPressHandled=!1,this._keyDownHandled||this._customKeyEventHandler&&this._customKeyEventHandler(R)===!1)return!1;if(this.cancel(R),R.charCode)M=R.charCode;else if(R.which===null||R.which===void 0)M=R.keyCode;else{if(R.which===0||R.charCode===0)return!1;M=R.which}return!(!M||(R.altKey||R.ctrlKey||R.metaKey)&&!this._isThirdLevelShift(this.browser,R)||(M=String.fromCharCode(M),this._onKey.fire({key:M,domEvent:R}),this._showCursor(),this.coreService.triggerDataEvent(M,!0),this._keyPressHandled=!0,this._unprocessedDeadKey=!1,0))}_inputEvent(R){if(R.data&&R.inputType==="insertText"&&(!R.composed||!this._keyDownSeen)&&!this.optionsService.rawOptions.screenReaderMode){if(this._keyPressHandled)return!1;this._unprocessedDeadKey=!1;const M=R.data;return this.coreService.triggerDataEvent(M,!0),this.cancel(R),!0}return!1}resize(R,M){R!==this.cols||M!==this.rows?super.resize(R,M):this._charSizeService&&!this._charSizeService.hasValidSize&&this._charSizeService.measure()}_afterResize(R,M){var F,U;(F=this._charSizeService)===null||F===void 0||F.measure(),(U=this.viewport)===null||U===void 0||U.syncScrollArea(!0)}clear(){if(this.buffer.ybase!==0||this.buffer.y!==0){this.buffer.clearAllMarkers(),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(let R=1;R{Object.defineProperty(r,"__esModule",{value:!0}),r.TimeBasedDebouncer=void 0,r.TimeBasedDebouncer=class{constructor(h,o=1e3){this._renderCallback=h,this._debounceThresholdMS=o,this._lastRefreshMs=0,this._additionalRefreshRequested=!1}dispose(){this._refreshTimeoutID&&clearTimeout(this._refreshTimeoutID)}refresh(h,o,d){this._rowCount=d,h=h!==void 0?h:0,o=o!==void 0?o:this._rowCount-1,this._rowStart=this._rowStart!==void 0?Math.min(this._rowStart,h):h,this._rowEnd=this._rowEnd!==void 0?Math.max(this._rowEnd,o):o;const c=Date.now();if(c-this._lastRefreshMs>=this._debounceThresholdMS)this._lastRefreshMs=c,this._innerRefresh();else if(!this._additionalRefreshRequested){const _=c-this._lastRefreshMs,l=this._debounceThresholdMS-_;this._additionalRefreshRequested=!0,this._refreshTimeoutID=window.setTimeout(()=>{this._lastRefreshMs=Date.now(),this._innerRefresh(),this._additionalRefreshRequested=!1,this._refreshTimeoutID=void 0},l)}}_innerRefresh(){if(this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0)return;const h=Math.max(this._rowStart,0),o=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(h,o)}}},1680:function(D,r,h){var o=this&&this.__decorate||function(e,n,t,s){var f,v=arguments.length,u=v<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,n,t,s);else for(var C=e.length-1;C>=0;C--)(f=e[C])&&(u=(v<3?f(u):v>3?f(n,t,u):f(n,t))||u);return v>3&&u&&Object.defineProperty(n,t,u),u},d=this&&this.__param||function(e,n){return function(t,s){n(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Viewport=void 0;const c=h(844),_=h(3656),l=h(4725),a=h(2585);let i=class extends c.Disposable{constructor(e,n,t,s,f,v,u,C,g){super(),this._scrollLines=e,this._viewportElement=n,this._scrollArea=t,this._element=s,this._bufferService=f,this._optionsService=v,this._charSizeService=u,this._renderService=C,this._coreBrowserService=g,this.scrollBarWidth=0,this._currentRowHeight=0,this._currentScaledCellHeight=0,this._lastRecordedBufferLength=0,this._lastRecordedViewportHeight=0,this._lastRecordedBufferHeight=0,this._lastTouchY=0,this._lastScrollTop=0,this._wheelPartialScroll=0,this._refreshAnimationFrame=null,this._ignoreNextScrollEvent=!1,this._smoothScrollState={startTime:0,origin:-1,target:-1},this.scrollBarWidth=this._viewportElement.offsetWidth-this._scrollArea.offsetWidth||15,this.register((0,_.addDisposableDomListener)(this._viewportElement,"scroll",this._onScroll.bind(this))),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(m=>this._activeBuffer=m.activeBuffer)),this._renderDimensions=this._renderService.dimensions,this.register(this._renderService.onDimensionsChange(m=>this._renderDimensions=m)),setTimeout(()=>this.syncScrollArea(),0)}onThemeChange(e){this._viewportElement.style.backgroundColor=e.background.css}_refresh(e){if(e)return this._innerRefresh(),void(this._refreshAnimationFrame!==null&&this._coreBrowserService.window.cancelAnimationFrame(this._refreshAnimationFrame));this._refreshAnimationFrame===null&&(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._charSizeService.height>0){this._currentRowHeight=this._renderService.dimensions.scaledCellHeight/this._coreBrowserService.dpr,this._currentScaledCellHeight=this._renderService.dimensions.scaledCellHeight,this._lastRecordedViewportHeight=this._viewportElement.offsetHeight;const n=Math.round(this._currentRowHeight*this._lastRecordedBufferLength)+(this._lastRecordedViewportHeight-this._renderService.dimensions.canvasHeight);this._lastRecordedBufferHeight!==n&&(this._lastRecordedBufferHeight=n,this._scrollArea.style.height=this._lastRecordedBufferHeight+"px")}const e=this._bufferService.buffer.ydisp*this._currentRowHeight;this._viewportElement.scrollTop!==e&&(this._ignoreNextScrollEvent=!0,this._viewportElement.scrollTop=e),this._refreshAnimationFrame=null}syncScrollArea(e=!1){if(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._activeBuffer.ydisp*this._currentRowHeight&&this._renderDimensions.scaledCellHeight===this._currentScaledCellHeight||this._refresh(e)}_onScroll(e){if(this._lastScrollTop=this._viewportElement.scrollTop,!this._viewportElement.offsetParent)return;if(this._ignoreNextScrollEvent)return this._ignoreNextScrollEvent=!1,void this._scrollLines(0);const n=Math.round(this._lastScrollTop/this._currentRowHeight)-this._bufferService.buffer.ydisp;this._scrollLines(n)}_smoothScroll(){if(this._isDisposed||this._smoothScrollState.origin===-1||this._smoothScrollState.target===-1)return;const e=this._smoothScrollPercent();this._viewportElement.scrollTop=this._smoothScrollState.origin+Math.round(e*(this._smoothScrollState.target-this._smoothScrollState.origin)),e<1?this._coreBrowserService.window.requestAnimationFrame(()=>this._smoothScroll()):this._clearSmoothScrollState()}_smoothScrollPercent(){return this._optionsService.rawOptions.smoothScrollDuration&&this._smoothScrollState.startTime?Math.max(Math.min((Date.now()-this._smoothScrollState.startTime)/this._optionsService.rawOptions.smoothScrollDuration,1),0):1}_clearSmoothScrollState(){this._smoothScrollState.startTime=0,this._smoothScrollState.origin=-1,this._smoothScrollState.target=-1}_bubbleScroll(e,n){const t=this._viewportElement.scrollTop+this._lastRecordedViewportHeight;return!(n<0&&this._viewportElement.scrollTop!==0||n>0&&t0?1:-1),this._wheelPartialScroll%=1):e.deltaMode===WheelEvent.DOM_DELTA_PAGE&&(n*=this._bufferService.rows),n}_applyScrollModifier(e,n){const t=this._optionsService.rawOptions.fastScrollModifier;return t==="alt"&&n.altKey||t==="ctrl"&&n.ctrlKey||t==="shift"&&n.shiftKey?e*this._optionsService.rawOptions.fastScrollSensitivity*this._optionsService.rawOptions.scrollSensitivity:e*this._optionsService.rawOptions.scrollSensitivity}onTouchStart(e){this._lastTouchY=e.touches[0].pageY}onTouchMove(e){const n=this._lastTouchY-e.touches[0].pageY;return this._lastTouchY=e.touches[0].pageY,n!==0&&(this._viewportElement.scrollTop+=n,this._bubbleScroll(e,n))}};i=o([d(4,a.IBufferService),d(5,a.IOptionsService),d(6,l.ICharSizeService),d(7,l.IRenderService),d(8,l.ICoreBrowserService)],i),r.Viewport=i},3107:function(D,r,h){var o=this&&this.__decorate||function(e,n,t,s){var f,v=arguments.length,u=v<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,n,t,s);else for(var C=e.length-1;C>=0;C--)(f=e[C])&&(u=(v<3?f(u):v>3?f(n,t,u):f(n,t))||u);return v>3&&u&&Object.defineProperty(n,t,u),u},d=this&&this.__param||function(e,n){return function(t,s){n(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferDecorationRenderer=void 0;const c=h(3656),_=h(4725),l=h(844),a=h(2585);let i=class extends l.Disposable{constructor(e,n,t,s){super(),this._screenElement=e,this._bufferService=n,this._decorationService=t,this._renderService=s,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement("div"),this._container.classList.add("xterm-decoration-container"),this._screenElement.appendChild(this._container),this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this.register((0,c.addDisposableDomListener)(window,"resize",()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this.register(this._decorationService.onDecorationRemoved(f=>this._removeDecoration(f)))}dispose(){this._container.remove(),this._decorationElements.clear(),super.dispose()}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this.refreshDecorations(),this._animationFrame=void 0}))}refreshDecorations(){for(const e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){var n;const t=document.createElement("div");t.classList.add("xterm-decoration"),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.actualCellWidth)}px`,t.style.height=(e.options.height||1)*this._renderService.dimensions.actualCellHeight+"px",t.style.top=(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.actualCellHeight+"px",t.style.lineHeight=`${this._renderService.dimensions.actualCellHeight}px`;const s=(n=e.options.x)!==null&&n!==void 0?n:0;return s&&s>this._bufferService.cols&&(t.style.display="none"),this._refreshXPosition(e,t),t}_refreshStyle(e){const n=e.marker.line-this._bufferService.buffers.active.ydisp;if(n<0||n>=this._bufferService.rows)e.element&&(e.element.style.display="none",e.onRenderEmitter.fire(e.element));else{let t=this._decorationElements.get(e);t||(e.onDispose(()=>this._removeDecoration(e)),t=this._createElement(e),e.element=t,this._decorationElements.set(e,t),this._container.appendChild(t)),t.style.top=n*this._renderService.dimensions.actualCellHeight+"px",t.style.display=this._altBufferIsActive?"none":"block",e.onRenderEmitter.fire(t)}}_refreshXPosition(e,n=e.element){var t;if(!n)return;const s=(t=e.options.x)!==null&&t!==void 0?t:0;(e.options.anchor||"left")==="right"?n.style.right=s?s*this._renderService.dimensions.actualCellWidth+"px":"":n.style.left=s?s*this._renderService.dimensions.actualCellWidth+"px":""}_removeDecoration(e){var n;(n=this._decorationElements.get(e))===null||n===void 0||n.remove(),this._decorationElements.delete(e)}};i=o([d(1,a.IBufferService),d(2,a.IDecorationService),d(3,_.IRenderService)],i),r.BufferDecorationRenderer=i},5871:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorZoneStore=void 0,r.ColorZoneStore=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(h){if(h.options.overviewRulerOptions){for(const o of this._zones)if(o.color===h.options.overviewRulerOptions.color&&o.position===h.options.overviewRulerOptions.position){if(this._lineIntersectsZone(o,h.marker.line))return;if(this._lineAdjacentToZone(o,h.marker.line,h.options.overviewRulerOptions.position))return void this._addLineToZone(o,h.marker.line)}if(this._zonePoolIndex=h.startBufferLine&&o<=h.endBufferLine}_lineAdjacentToZone(h,o,d){return o>=h.startBufferLine-this._linePadding[d||"full"]&&o<=h.endBufferLine+this._linePadding[d||"full"]}_addLineToZone(h,o){h.startBufferLine=Math.min(h.startBufferLine,o),h.endBufferLine=Math.max(h.endBufferLine,o)}}},5744:function(D,r,h){var o=this&&this.__decorate||function(f,v,u,C){var g,m=arguments.length,b=m<3?v:C===null?C=Object.getOwnPropertyDescriptor(v,u):C;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")b=Reflect.decorate(f,v,u,C);else for(var y=f.length-1;y>=0;y--)(g=f[y])&&(b=(m<3?g(b):m>3?g(v,u,b):g(v,u))||b);return m>3&&b&&Object.defineProperty(v,u,b),b},d=this&&this.__param||function(f,v){return function(u,C){v(u,C,f)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OverviewRulerRenderer=void 0;const c=h(5871),_=h(3656),l=h(4725),a=h(844),i=h(2585),e={full:0,left:0,center:0,right:0},n={full:0,left:0,center:0,right:0},t={full:0,left:0,center:0,right:0};let s=class extends a.Disposable{constructor(f,v,u,C,g,m,b){var y;super(),this._viewportElement=f,this._screenElement=v,this._bufferService=u,this._decorationService=C,this._renderService=g,this._optionsService=m,this._coreBrowseService=b,this._colorZoneStore=new c.ColorZoneStore,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add("xterm-decoration-overview-ruler"),this._refreshCanvasDimensions(),(y=this._viewportElement.parentElement)===null||y===void 0||y.insertBefore(this._canvas,this._viewportElement);const w=this._canvas.getContext("2d");if(!w)throw new Error("Ctx cannot be null");this._ctx=w,this._registerDecorationListeners(),this._registerBufferChangeListeners(),this._registerDimensionChangeListeners()}get _width(){return this._optionsService.options.overviewRulerWidth||0}_registerDecorationListeners(){this.register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this.register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0)))}_registerBufferChangeListeners(){this.register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this.register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?"none":"block"})),this.register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())}))}_registerDimensionChangeListeners(){this.register(this._renderService.onRender(()=>{this._containerHeight&&this._containerHeight===this._screenElement.clientHeight||(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this.register(this._optionsService.onOptionChange(f=>{f==="overviewRulerWidth"&&this._queueRefresh(!0)})),this.register((0,_.addDisposableDomListener)(this._coreBrowseService.window,"resize",()=>{this._queueRefresh(!0)})),this._queueRefresh(!0)}dispose(){var f;(f=this._canvas)===null||f===void 0||f.remove(),super.dispose()}_refreshDrawConstants(){const f=Math.floor(this._canvas.width/3),v=Math.ceil(this._canvas.width/3);n.full=this._canvas.width,n.left=f,n.center=v,n.right=f,this._refreshDrawHeightConstants(),t.full=0,t.left=0,t.center=n.left,t.right=n.left+n.center}_refreshDrawHeightConstants(){e.full=Math.round(2*this._coreBrowseService.dpr);const f=this._canvas.height/this._bufferService.buffer.lines.length,v=Math.round(Math.max(Math.min(f,12),6)*this._coreBrowseService.dpr);e.left=v,e.center=v,e.right=v}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*e.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowseService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowseService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(const v of this._decorationService.decorations)this._colorZoneStore.addDecoration(v);this._ctx.lineWidth=1;const f=this._colorZoneStore.zones;for(const v of f)v.position!=="full"&&this._renderColorZone(v);for(const v of f)v.position==="full"&&this._renderColorZone(v);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderColorZone(f){this._ctx.fillStyle=f.color,this._ctx.fillRect(t[f.position||"full"],Math.round((this._canvas.height-1)*(f.startBufferLine/this._bufferService.buffers.active.lines.length)-e[f.position||"full"]/2),n[f.position||"full"],Math.round((this._canvas.height-1)*((f.endBufferLine-f.startBufferLine)/this._bufferService.buffers.active.lines.length)+e[f.position||"full"]))}_queueRefresh(f,v){this._shouldUpdateDimensions=f||this._shouldUpdateDimensions,this._shouldUpdateAnchor=v||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowseService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};s=o([d(2,i.IBufferService),d(3,i.IDecorationService),d(4,l.IRenderService),d(5,i.IOptionsService),d(6,l.ICoreBrowserService)],s),r.OverviewRulerRenderer=s},2950:function(D,r,h){var o=this&&this.__decorate||function(i,e,n,t){var s,f=arguments.length,v=f<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,n):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,e,n,t);else for(var u=i.length-1;u>=0;u--)(s=i[u])&&(v=(f<3?s(v):f>3?s(e,n,v):s(e,n))||v);return f>3&&v&&Object.defineProperty(e,n,v),v},d=this&&this.__param||function(i,e){return function(n,t){e(n,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CompositionHelper=void 0;const c=h(4725),_=h(2585),l=h(2584);let a=class{constructor(i,e,n,t,s,f){this._textarea=i,this._compositionView=e,this._bufferService=n,this._optionsService=t,this._coreService=s,this._renderService=f,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=""}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent="",this._dataAlreadySent="",this._compositionView.classList.add("active")}compositionupdate(i){this._compositionView.textContent=i.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(i){if(this._isComposing||this._isSendingComposition){if(i.keyCode===229||i.keyCode===16||i.keyCode===17||i.keyCode===18)return!1;this._finalizeComposition(!1)}return i.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(i){if(this._compositionView.classList.remove("active"),this._isComposing=!1,i){const e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){let n;this._isSendingComposition=!1,e.start+=this._dataAlreadySent.length,n=this._isComposing?this._textarea.value.substring(e.start,e.end):this._textarea.value.substring(e.start),n.length>0&&this._coreService.triggerDataEvent(n,!0)}},0)}else{this._isSendingComposition=!1;const e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){const i=this._textarea.value;setTimeout(()=>{if(!this._isComposing){const e=this._textarea.value,n=e.replace(i,"");this._dataAlreadySent=n,e.length>i.length?this._coreService.triggerDataEvent(n,!0):e.lengththis.updateCompositionElements(!0),0)}}};a=o([d(2,_.IBufferService),d(3,_.IOptionsService),d(4,_.ICoreService),d(5,c.IRenderService)],a),r.CompositionHelper=a},9806:(D,r)=>{function h(o,d,c){const _=c.getBoundingClientRect(),l=o.getComputedStyle(c),a=parseInt(l.getPropertyValue("padding-left")),i=parseInt(l.getPropertyValue("padding-top"));return[d.clientX-_.left-a,d.clientY-_.top-i]}Object.defineProperty(r,"__esModule",{value:!0}),r.getCoords=r.getCoordsRelativeToElement=void 0,r.getCoordsRelativeToElement=h,r.getCoords=function(o,d,c,_,l,a,i,e,n){if(!a)return;const t=h(o,d,c);return t?(t[0]=Math.ceil((t[0]+(n?i/2:0))/i),t[1]=Math.ceil(t[1]/e),t[0]=Math.min(Math.max(t[0],1),_+(n?1:0)),t[1]=Math.min(Math.max(t[1],1),l),t):void 0}},9504:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.moveToCellSequence=void 0;const o=h(2584);function d(e,n,t,s){const f=e-c(t,e),v=n-c(t,n),u=Math.abs(f-v)-function(C,g,m){let b=0;const y=C-c(m,C),w=g-c(m,g);for(let p=0;p=0&&nn?"A":"B"}function l(e,n,t,s,f,v){let u=e,C=n,g="";for(;u!==t||C!==s;)u+=f?1:-1,f&&u>v.cols-1?(g+=v.buffer.translateBufferLineToString(C,!1,e,u),u=0,e=0,C++):!f&&u<0&&(g+=v.buffer.translateBufferLineToString(C,!1,0,e+1),u=v.cols-1,e=u,C--);return g+v.buffer.translateBufferLineToString(C,!1,e,u)}function a(e,n){const t=n?"O":"[";return o.C0.ESC+t+e}function i(e,n){e=Math.floor(e);let t="";for(let s=0;s0?y-c(w,y):m;const L=y,E=function(A,k,O,T,H,W){let x;return x=d(O,T,H,W).length>0?T-c(H,T):k,A=O&&xe?"D":"C",i(Math.abs(f-e),a(u,s));u=v>n?"D":"C";const C=Math.abs(v-n);return i(function(g,m){return m.cols-g}(v>n?e:f,t)+(C-1)*t.cols+1+((v>n?f:e)-1),a(u,s))}},8036:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const o=h(6114);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=o.isFirefox||o.isLegacyEdge?"bottom":"ideographic"},1752:(D,r)=>{function h(o){return 57508<=o&&o<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(o){if(!o)throw new Error("value must not be falsy");return o},r.isPowerlineGlyph=h,r.isRestrictedPowerlineGlyph=function(o){return 57520<=o&&o<=57527},r.excludeFromContrastRatioDemands=function(o){return h(o)||function(d){return 9472<=d&&d<=9631}(o)}},1296:function(D,r,h){var o=this&&this.__decorate||function(C,g,m,b){var y,w=arguments.length,p=w<3?g:b===null?b=Object.getOwnPropertyDescriptor(g,m):b;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")p=Reflect.decorate(C,g,m,b);else for(var S=C.length-1;S>=0;S--)(y=C[S])&&(p=(w<3?y(p):w>3?y(g,m,p):y(g,m))||p);return w>3&&p&&Object.defineProperty(g,m,p),p},d=this&&this.__param||function(C,g){return function(m,b){g(m,b,C)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRenderer=void 0;const c=h(3787),_=h(8036),l=h(844),a=h(4725),i=h(2585),e=h(8460),n=h(8055),t=h(9631),s="xterm-dom-renderer-owner-",f="xterm-focus";let v=1,u=class extends l.Disposable{constructor(C,g,m,b,y,w,p,S,L,E){super(),this._colors=C,this._element=g,this._screenElement=m,this._viewportElement=b,this._linkifier2=y,this._charSizeService=p,this._optionsService=S,this._bufferService=L,this._coreBrowserService=E,this._terminalClass=v++,this._rowElements=[],this._rowContainer=document.createElement("div"),this._rowContainer.classList.add("xterm-rows"),this._rowContainer.style.lineHeight="normal",this._rowContainer.setAttribute("aria-hidden","true"),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=document.createElement("div"),this._selectionContainer.classList.add("xterm-selection"),this._selectionContainer.setAttribute("aria-hidden","true"),this.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},this._updateDimensions(),this._injectCss(),this._rowFactory=w.createInstance(c.DomRendererRowFactory,document,this._colors),this._element.classList.add(s+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this.register(this._linkifier2.onShowLinkUnderline(A=>this._onLinkHover(A))),this.register(this._linkifier2.onHideLinkUnderline(A=>this._onLinkLeave(A)))}get onRequestRedraw(){return new e.EventEmitter().event}dispose(){this._element.classList.remove(s+this._terminalClass),(0,t.removeElementFromParent)(this._rowContainer,this._selectionContainer,this._themeStyleElement,this._dimensionsStyleElement),super.dispose()}_updateDimensions(){const C=this._coreBrowserService.dpr;this.dimensions.scaledCharWidth=this._charSizeService.width*C,this.dimensions.scaledCharHeight=Math.ceil(this._charSizeService.height*C),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._optionsService.rawOptions.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/C),this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/C),this.dimensions.actualCellWidth=this.dimensions.canvasWidth/this._bufferService.cols,this.dimensions.actualCellHeight=this.dimensions.canvasHeight/this._bufferService.rows;for(const m of this._rowElements)m.style.width=`${this.dimensions.canvasWidth}px`,m.style.height=`${this.dimensions.actualCellHeight}px`,m.style.lineHeight=`${this.dimensions.actualCellHeight}px`,m.style.overflow="hidden";this._dimensionsStyleElement||(this._dimensionsStyleElement=document.createElement("style"),this._screenElement.appendChild(this._dimensionsStyleElement));const g=`${this._terminalSelector} .xterm-rows span { display: inline-block; height: 100%; vertical-align: top; width: ${this.dimensions.actualCellWidth}px}`;this._dimensionsStyleElement.textContent=g,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.canvasWidth}px`,this._screenElement.style.height=`${this.dimensions.canvasHeight}px`}setColors(C){this._colors=C,this._injectCss()}_injectCss(){this._themeStyleElement||(this._themeStyleElement=document.createElement("style"),this._screenElement.appendChild(this._themeStyleElement));let C=`${this._terminalSelector} .xterm-rows { color: ${this._colors.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px;}`;C+=`${this._terminalSelector} span:not(.${c.BOLD_CLASS}) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.${c.BOLD_CLASS} { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.${c.ITALIC_CLASS} { font-style: italic;}`,C+="@keyframes blink_box_shadow_"+this._terminalClass+" { 50% { box-shadow: none; }}",C+="@keyframes blink_block_"+this._terminalClass+` { 0% { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css}; } 50% { background-color: ${this._colors.cursorAccent.css}; color: ${this._colors.cursor.css}; }}`,C+=`${this._terminalSelector} .xterm-rows:not(.xterm-focus) .${c.CURSOR_CLASS}.${c.CURSOR_STYLE_BLOCK_CLASS} { outline: 1px solid ${this._colors.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .xterm-rows.xterm-focus .${c.CURSOR_CLASS}.${c.CURSOR_BLINK_CLASS}:not(.${c.CURSOR_STYLE_BLOCK_CLASS}) { animation: blink_box_shadow_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${c.CURSOR_CLASS}.${c.CURSOR_BLINK_CLASS}.${c.CURSOR_STYLE_BLOCK_CLASS} { animation: blink_block_`+this._terminalClass+` 1s step-end infinite;}${this._terminalSelector} .xterm-rows.xterm-focus .${c.CURSOR_CLASS}.${c.CURSOR_STYLE_BLOCK_CLASS} { background-color: ${this._colors.cursor.css}; color: ${this._colors.cursorAccent.css};}${this._terminalSelector} .xterm-rows .${c.CURSOR_CLASS}.${c.CURSOR_STYLE_BAR_CLASS} { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${this._colors.cursor.css} inset;}${this._terminalSelector} .xterm-rows .${c.CURSOR_CLASS}.${c.CURSOR_STYLE_UNDERLINE_CLASS} { box-shadow: 0 -1px 0 ${this._colors.cursor.css} inset;}`,C+=`${this._terminalSelector} .xterm-selection { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .xterm-selection div { position: absolute; background-color: ${this._colors.selectionBackgroundOpaque.css};}${this._terminalSelector} .xterm-selection div { position: absolute; background-color: ${this._colors.selectionInactiveBackgroundOpaque.css};}`,this._colors.ansi.forEach((g,m)=>{C+=`${this._terminalSelector} .xterm-fg-${m} { color: ${g.css}; }${this._terminalSelector} .xterm-bg-${m} { background-color: ${g.css}; }`}),C+=`${this._terminalSelector} .xterm-fg-${_.INVERTED_DEFAULT_COLOR} { color: ${n.color.opaque(this._colors.background).css}; }${this._terminalSelector} .xterm-bg-${_.INVERTED_DEFAULT_COLOR} { background-color: ${this._colors.foreground.css}; }`,this._themeStyleElement.textContent=C}onDevicePixelRatioChange(){this._updateDimensions()}_refreshRowElements(C,g){for(let m=this._rowElements.length;m<=g;m++){const b=document.createElement("div");this._rowContainer.appendChild(b),this._rowElements.push(b)}for(;this._rowElements.length>g;)this._rowContainer.removeChild(this._rowElements.pop())}onResize(C,g){this._refreshRowElements(C,g),this._updateDimensions()}onCharSizeChanged(){this._updateDimensions()}onBlur(){this._rowContainer.classList.remove(f)}onFocus(){this._rowContainer.classList.add(f)}onSelectionChanged(C,g,m){for(;this._selectionContainer.children.length;)this._selectionContainer.removeChild(this._selectionContainer.children[0]);if(this._rowFactory.onSelectionChanged(C,g,m),this.renderRows(0,this._bufferService.rows-1),!C||!g)return;const b=C[1]-this._bufferService.buffer.ydisp,y=g[1]-this._bufferService.buffer.ydisp,w=Math.max(b,0),p=Math.min(y,this._bufferService.rows-1);if(w>=this._bufferService.rows||p<0)return;const S=document.createDocumentFragment();if(m){const L=C[0]>g[0];S.appendChild(this._createSelectionElement(w,L?g[0]:C[0],L?C[0]:g[0],p-w+1))}else{const L=b===w?C[0]:0,E=w===y?g[0]:this._bufferService.cols;S.appendChild(this._createSelectionElement(w,L,E));const A=p-w-1;if(S.appendChild(this._createSelectionElement(w+1,0,this._bufferService.cols,A)),w!==p){const k=y===p?g[0]:this._bufferService.cols;S.appendChild(this._createSelectionElement(p,0,k))}}this._selectionContainer.appendChild(S)}_createSelectionElement(C,g,m,b=1){const y=document.createElement("div");return y.style.height=b*this.dimensions.actualCellHeight+"px",y.style.top=C*this.dimensions.actualCellHeight+"px",y.style.left=g*this.dimensions.actualCellWidth+"px",y.style.width=this.dimensions.actualCellWidth*(m-g)+"px",y}onCursorMove(){}onOptionsChanged(){this._updateDimensions(),this._injectCss()}clear(){for(const C of this._rowElements)C.innerText=""}renderRows(C,g){const m=this._bufferService.buffer.ybase+this._bufferService.buffer.y,b=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),y=this._optionsService.rawOptions.cursorBlink;for(let w=C;w<=g;w++){const p=this._rowElements[w];p.innerText="";const S=w+this._bufferService.buffer.ydisp,L=this._bufferService.buffer.lines.get(S),E=this._optionsService.rawOptions.cursorStyle;p.appendChild(this._rowFactory.createRow(L,S,S===m,E,b,y,this.dimensions.actualCellWidth,this._bufferService.cols))}}get _terminalSelector(){return`.${s}${this._terminalClass}`}_onLinkHover(C){this._setCellUnderline(C.x1,C.x2,C.y1,C.y2,C.cols,!0)}_onLinkLeave(C){this._setCellUnderline(C.x1,C.x2,C.y1,C.y2,C.cols,!1)}_setCellUnderline(C,g,m,b,y,w){for(;C!==g||m!==b;){const p=this._rowElements[m];if(!p)return;const S=p.children[C];S&&(S.style.textDecoration=w?"underline":"none"),++C>=y&&(C=0,m++)}}};u=o([d(5,i.IInstantiationService),d(6,a.ICharSizeService),d(7,i.IOptionsService),d(8,i.IBufferService),d(9,a.ICoreBrowserService)],u),r.DomRenderer=u},3787:function(D,r,h){var o=this&&this.__decorate||function(u,C,g,m){var b,y=arguments.length,w=y<3?C:m===null?m=Object.getOwnPropertyDescriptor(C,g):m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")w=Reflect.decorate(u,C,g,m);else for(var p=u.length-1;p>=0;p--)(b=u[p])&&(w=(y<3?b(w):y>3?b(C,g,w):b(C,g))||w);return y>3&&w&&Object.defineProperty(C,g,w),w},d=this&&this.__param||function(u,C){return function(g,m){C(g,m,u)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DomRendererRowFactory=r.CURSOR_STYLE_UNDERLINE_CLASS=r.CURSOR_STYLE_BAR_CLASS=r.CURSOR_STYLE_BLOCK_CLASS=r.CURSOR_BLINK_CLASS=r.CURSOR_CLASS=r.STRIKETHROUGH_CLASS=r.UNDERLINE_CLASS=r.ITALIC_CLASS=r.DIM_CLASS=r.BOLD_CLASS=void 0;const c=h(8036),_=h(643),l=h(511),a=h(2585),i=h(8055),e=h(4725),n=h(4269),t=h(1752),s=h(3734);r.BOLD_CLASS="xterm-bold",r.DIM_CLASS="xterm-dim",r.ITALIC_CLASS="xterm-italic",r.UNDERLINE_CLASS="xterm-underline",r.STRIKETHROUGH_CLASS="xterm-strikethrough",r.CURSOR_CLASS="xterm-cursor",r.CURSOR_BLINK_CLASS="xterm-cursor-blink",r.CURSOR_STYLE_BLOCK_CLASS="xterm-cursor-block",r.CURSOR_STYLE_BAR_CLASS="xterm-cursor-bar",r.CURSOR_STYLE_UNDERLINE_CLASS="xterm-cursor-underline";let f=class{constructor(u,C,g,m,b,y,w){this._document=u,this._colors=C,this._characterJoinerService=g,this._optionsService=m,this._coreBrowserService=b,this._coreService=y,this._decorationService=w,this._workCell=new l.CellData,this._columnSelectMode=!1}setColors(u){this._colors=u}onSelectionChanged(u,C,g){this._selectionStart=u,this._selectionEnd=C,this._columnSelectMode=g}createRow(u,C,g,m,b,y,w,p){const S=this._document.createDocumentFragment(),L=this._characterJoinerService.getJoinedCharacters(C);let E=0;for(let A=Math.min(u.length,p)-1;A>=0;A--)if(u.loadCell(A,this._workCell).getCode()!==_.NULL_CELL_CODE||g&&A===b){E=A+1;break}for(let A=0;A0&&A===L[0][0]){O=!0;const N=L.shift();H=new n.JoinedCellData(this._workCell,u.translateToString(!0,N[0],N[1]),N[1]-N[0]),T=N[1]-1,k=H.getWidth()}const W=this._document.createElement("span");if(k>1&&(W.style.width=w*k+"px"),O&&(W.style.display="inline",b>=A&&b<=T&&(b=A)),!this._coreService.isCursorHidden&&g&&A===b)switch(W.classList.add(r.CURSOR_CLASS),y&&W.classList.add(r.CURSOR_BLINK_CLASS),m){case"bar":W.classList.add(r.CURSOR_STYLE_BAR_CLASS);break;case"underline":W.classList.add(r.CURSOR_STYLE_UNDERLINE_CLASS);break;default:W.classList.add(r.CURSOR_STYLE_BLOCK_CLASS)}if(H.isBold()&&W.classList.add(r.BOLD_CLASS),H.isItalic()&&W.classList.add(r.ITALIC_CLASS),H.isDim()&&W.classList.add(r.DIM_CLASS),H.isInvisible()?W.textContent=_.WHITESPACE_CELL_CHAR:W.textContent=H.getChars()||_.WHITESPACE_CELL_CHAR,H.isUnderline()&&(W.classList.add(`${r.UNDERLINE_CLASS}-${H.extended.underlineStyle}`),W.textContent===" "&&(W.innerHTML=" "),!H.isUnderlineColorDefault()))if(H.isUnderlineColorRGB())W.style.textDecorationColor=`rgb(${s.AttributeData.toColorRGB(H.getUnderlineColor()).join(",")})`;else{let N=H.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&H.isBold()&&N<8&&(N+=8),W.style.textDecorationColor=this._colors.ansi[N].css}H.isStrikethrough()&&W.classList.add(r.STRIKETHROUGH_CLASS);let x=H.getFgColor(),B=H.getFgColorMode(),P=H.getBgColor(),R=H.getBgColorMode();const M=!!H.isInverse();if(M){const N=x;x=P,P=N;const Z=B;B=R,R=Z}let F,U,$=!1;this._decorationService.forEachDecorationAtCell(A,C,void 0,N=>{N.options.layer!=="top"&&$||(N.backgroundColorRGB&&(R=50331648,P=N.backgroundColorRGB.rgba>>8&16777215,F=N.backgroundColorRGB),N.foregroundColorRGB&&(B=50331648,x=N.foregroundColorRGB.rgba>>8&16777215,U=N.foregroundColorRGB),$=N.options.layer==="top")});const I=this._isCellInSelection(A,C);let K;switch($||this._colors.selectionForeground&&I&&(B=50331648,x=this._colors.selectionForeground.rgba>>8&16777215,U=this._colors.selectionForeground),I&&(F=this._coreBrowserService.isFocused?this._colors.selectionBackgroundOpaque:this._colors.selectionInactiveBackgroundOpaque,$=!0),$&&W.classList.add("xterm-decoration-top"),R){case 16777216:case 33554432:K=this._colors.ansi[P],W.classList.add(`xterm-bg-${P}`);break;case 50331648:K=i.rgba.toColor(P>>16,P>>8&255,255&P),this._addStyle(W,`background-color:#${v((P>>>0).toString(16),"0",6)}`);break;default:M?(K=this._colors.foreground,W.classList.add(`xterm-bg-${c.INVERTED_DEFAULT_COLOR}`)):K=this._colors.background}switch(F||H.isDim()&&(F=i.color.multiplyOpacity(K,.5)),B){case 16777216:case 33554432:H.isBold()&&x<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(x+=8),this._applyMinimumContrast(W,K,this._colors.ansi[x],H,F,void 0)||W.classList.add(`xterm-fg-${x}`);break;case 50331648:const N=i.rgba.toColor(x>>16&255,x>>8&255,255&x);this._applyMinimumContrast(W,K,N,H,F,U)||this._addStyle(W,`color:#${v(x.toString(16),"0",6)}`);break;default:this._applyMinimumContrast(W,K,this._colors.foreground,H,F,void 0)||M&&W.classList.add(`xterm-fg-${c.INVERTED_DEFAULT_COLOR}`)}S.appendChild(W),A=T}return S}_applyMinimumContrast(u,C,g,m,b,y){if(this._optionsService.rawOptions.minimumContrastRatio===1||(0,t.excludeFromContrastRatioDemands)(m.getCode()))return!1;let w;return b||y||(w=this._colors.contrastCache.getColor(C.rgba,g.rgba)),w===void 0&&(w=i.color.ensureContrastRatio(b||C,y||g,this._optionsService.rawOptions.minimumContrastRatio),this._colors.contrastCache.setColor((b||C).rgba,(y||g).rgba,w!=null?w:null)),!!w&&(this._addStyle(u,`color:${w.css}`),!0)}_addStyle(u,C){u.setAttribute("style",`${u.getAttribute("style")||""}${C};`)}_isCellInSelection(u,C){const g=this._selectionStart,m=this._selectionEnd;return!(!g||!m)&&(this._columnSelectMode?g[0]<=m[0]?u>=g[0]&&C>=g[1]&&u=g[1]&&u>=m[0]&&C<=m[1]:C>g[1]&&C=g[0]&&u=g[0])}};function v(u,C,g){for(;u.length{Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionModel=void 0,r.SelectionModel=class{constructor(h){this._bufferService=h,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:this.selectionEnd&&this.selectionStart&&this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?h%this._bufferService.cols==0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)-1]:[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[h,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){const h=this.selectionStart[0]+this.selectionStartLength;return h>this._bufferService.cols?[h%this._bufferService.cols,this.selectionStart[1]+Math.floor(h/this._bufferService.cols)]:[Math.max(h,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){const h=this.selectionStart,o=this.selectionEnd;return!(!h||!o)&&(h[1]>o[1]||h[1]===o[1]&&h[0]>o[0])}onTrim(h){return this.selectionStart&&(this.selectionStart[1]-=h),this.selectionEnd&&(this.selectionEnd[1]-=h),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}}},428:function(D,r,h){var o=this&&this.__decorate||function(i,e,n,t){var s,f=arguments.length,v=f<3?e:t===null?t=Object.getOwnPropertyDescriptor(e,n):t;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")v=Reflect.decorate(i,e,n,t);else for(var u=i.length-1;u>=0;u--)(s=i[u])&&(v=(f<3?s(v):f>3?s(e,n,v):s(e,n))||v);return f>3&&v&&Object.defineProperty(e,n,v),v},d=this&&this.__param||function(i,e){return function(n,t){e(n,t,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharSizeService=void 0;const c=h(2585),_=h(8460);let l=class{constructor(i,e,n){this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=new _.EventEmitter,this._measureStrategy=new a(i,e,this._optionsService)}get hasValidSize(){return this.width>0&&this.height>0}get onCharSizeChange(){return this._onCharSizeChange.event}measure(){const i=this._measureStrategy.measure();i.width===this.width&&i.height===this.height||(this.width=i.width,this.height=i.height,this._onCharSizeChange.fire())}};l=o([d(2,c.IOptionsService)],l),r.CharSizeService=l;class a{constructor(e,n,t){this._document=e,this._parentElement=n,this._optionsService=t,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)}measure(){this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`;const e=this._measureElement.getBoundingClientRect();return e.width!==0&&e.height!==0&&(this._result.width=e.width,this._result.height=Math.ceil(e.height)),this._result}}},4269:function(D,r,h){var o=this&&this.__decorate||function(n,t,s,f){var v,u=arguments.length,C=u<3?t:f===null?f=Object.getOwnPropertyDescriptor(t,s):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")C=Reflect.decorate(n,t,s,f);else for(var g=n.length-1;g>=0;g--)(v=n[g])&&(C=(u<3?v(C):u>3?v(t,s,C):v(t,s))||C);return u>3&&C&&Object.defineProperty(t,s,C),C},d=this&&this.__param||function(n,t){return function(s,f){t(s,f,n)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterJoinerService=r.JoinedCellData=void 0;const c=h(3734),_=h(643),l=h(511),a=h(2585);class i extends c.AttributeData{constructor(t,s,f){super(),this.content=0,this.combinedData="",this.fg=t.fg,this.bg=t.bg,this.combinedData=s,this._width=f}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(t){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=i;let e=class Re{constructor(t){this._bufferService=t,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new l.CellData}register(t){const s={id:this._nextCharacterJoinerId++,handler:t};return this._characterJoiners.push(s),s.id}deregister(t){for(let s=0;s1){const w=this._getJoinedRanges(v,g,C,s,u);for(let p=0;p1){const y=this._getJoinedRanges(v,g,C,s,u);for(let w=0;w{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreBrowserService=void 0,r.CoreBrowserService=class{constructor(h,o){this._textarea=h,this.window=o}get dpr(){return this.window.devicePixelRatio}get isFocused(){return(this._textarea.getRootNode?this._textarea.getRootNode():this._textarea.ownerDocument).activeElement===this._textarea&&this._textarea.ownerDocument.hasFocus()}}},8934:function(D,r,h){var o=this&&this.__decorate||function(a,i,e,n){var t,s=arguments.length,f=s<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(a,i,e,n);else for(var v=a.length-1;v>=0;v--)(t=a[v])&&(f=(s<3?t(f):s>3?t(i,e,f):t(i,e))||f);return s>3&&f&&Object.defineProperty(i,e,f),f},d=this&&this.__param||function(a,i){return function(e,n){i(e,n,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.MouseService=void 0;const c=h(4725),_=h(9806);let l=class{constructor(a,i){this._renderService=a,this._charSizeService=i}getCoords(a,i,e,n,t){return(0,_.getCoords)(window,a,i,e,n,this._charSizeService.hasValidSize,this._renderService.dimensions.actualCellWidth,this._renderService.dimensions.actualCellHeight,t)}getMouseReportCoords(a,i){const e=(0,_.getCoordsRelativeToElement)(window,a,i);if(!(!this._charSizeService.hasValidSize||e[0]<0||e[1]<0||e[0]>=this._renderService.dimensions.canvasWidth||e[1]>=this._renderService.dimensions.canvasHeight))return{col:Math.floor(e[0]/this._renderService.dimensions.actualCellWidth),row:Math.floor(e[1]/this._renderService.dimensions.actualCellHeight),x:Math.floor(e[0]),y:Math.floor(e[1])}}};l=o([d(0,c.IRenderService),d(1,c.ICharSizeService)],l),r.MouseService=l},3230:function(D,r,h){var o=this&&this.__decorate||function(s,f,v,u){var C,g=arguments.length,m=g<3?f:u===null?u=Object.getOwnPropertyDescriptor(f,v):u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")m=Reflect.decorate(s,f,v,u);else for(var b=s.length-1;b>=0;b--)(C=s[b])&&(m=(g<3?C(m):g>3?C(f,v,m):C(f,v))||m);return g>3&&m&&Object.defineProperty(f,v,m),m},d=this&&this.__param||function(s,f){return function(v,u){f(v,u,s)}};Object.defineProperty(r,"__esModule",{value:!0}),r.RenderService=void 0;const c=h(6193),_=h(8460),l=h(844),a=h(5596),i=h(3656),e=h(2585),n=h(4725);let t=class extends l.Disposable{constructor(s,f,v,u,C,g,m,b){if(super(),this._renderer=s,this._rowCount=f,this._charSizeService=C,this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=new _.EventEmitter,this._onRenderedViewportChange=new _.EventEmitter,this._onRender=new _.EventEmitter,this._onRefreshRequest=new _.EventEmitter,this.register({dispose:()=>this._renderer.dispose()}),this._renderDebouncer=new c.RenderDebouncer(b.window,(y,w)=>this._renderRows(y,w)),this.register(this._renderDebouncer),this._screenDprMonitor=new a.ScreenDprMonitor(b.window),this._screenDprMonitor.setListener(()=>this.onDevicePixelRatioChange()),this.register(this._screenDprMonitor),this.register(m.onResize(()=>this._fullRefresh())),this.register(m.buffers.onBufferActivate(()=>{var y;return(y=this._renderer)===null||y===void 0?void 0:y.clear()})),this.register(u.onOptionChange(()=>this._handleOptionsChanged())),this.register(this._charSizeService.onCharSizeChange(()=>this.onCharSizeChanged())),this.register(g.onDecorationRegistered(()=>this._fullRefresh())),this.register(g.onDecorationRemoved(()=>this._fullRefresh())),this._renderer.onRequestRedraw(y=>this.refreshRows(y.start,y.end,!0)),this.register((0,i.addDisposableDomListener)(b.window,"resize",()=>this.onDevicePixelRatioChange())),"IntersectionObserver"in b.window){const y=new b.window.IntersectionObserver(w=>this._onIntersectionChange(w[w.length-1]),{threshold:0});y.observe(v),this.register({dispose:()=>y.disconnect()})}}get onDimensionsChange(){return this._onDimensionsChange.event}get onRenderedViewportChange(){return this._onRenderedViewportChange.event}get onRender(){return this._onRender.event}get onRefreshRequest(){return this._onRefreshRequest.event}get dimensions(){return this._renderer.dimensions}_onIntersectionChange(s){this._isPaused=s.isIntersecting===void 0?s.intersectionRatio===0:!s.isIntersecting,this._isPaused||this._charSizeService.hasValidSize||this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(s,f,v=!1){this._isPaused?this._needsFullRefresh=!0:(v||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(s,f,this._rowCount))}_renderRows(s,f){this._renderer.renderRows(s,f),this._needsSelectionRefresh&&(this._renderer.onSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),this._needsSelectionRefresh=!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:s,end:f}),this._onRender.fire({start:s,end:f}),this._isNextRenderRedrawOnly=!0}resize(s,f){this._rowCount=f,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.onOptionsChanged(),this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize()}_fireOnCanvasResize(){this._renderer.dimensions.canvasWidth===this._canvasWidth&&this._renderer.dimensions.canvasHeight===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.dimensions)}dispose(){super.dispose()}setRenderer(s){this._renderer.dispose(),this._renderer=s,this._renderer.onRequestRedraw(f=>this.refreshRows(f.start,f.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh()}addRefreshCallback(s){return this._renderDebouncer.addRefreshCallback(s)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){var s,f;(f=(s=this._renderer)===null||s===void 0?void 0:s.clearTextureAtlas)===null||f===void 0||f.call(s),this._fullRefresh()}setColors(s){this._renderer.setColors(s),this._fullRefresh()}onDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.onDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1)}onResize(s,f){this._renderer.onResize(s,f),this._fullRefresh()}onCharSizeChanged(){this._renderer.onCharSizeChanged()}onBlur(){this._renderer.onBlur()}onFocus(){this._renderer.onFocus()}onSelectionChanged(s,f,v){this._selectionState.start=s,this._selectionState.end=f,this._selectionState.columnSelectMode=v,this._renderer.onSelectionChanged(s,f,v)}onCursorMove(){this._renderer.onCursorMove()}clear(){this._renderer.clear()}};t=o([d(3,e.IOptionsService),d(4,n.ICharSizeService),d(5,e.IDecorationService),d(6,e.IBufferService),d(7,n.ICoreBrowserService)],t),r.RenderService=t},9312:function(D,r,h){var o=this&&this.__decorate||function(g,m,b,y){var w,p=arguments.length,S=p<3?m:y===null?y=Object.getOwnPropertyDescriptor(m,b):y;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")S=Reflect.decorate(g,m,b,y);else for(var L=g.length-1;L>=0;L--)(w=g[L])&&(S=(p<3?w(S):p>3?w(m,b,S):w(m,b))||S);return p>3&&S&&Object.defineProperty(m,b,S),S},d=this&&this.__param||function(g,m){return function(b,y){m(b,y,g)}};Object.defineProperty(r,"__esModule",{value:!0}),r.SelectionService=void 0;const c=h(6114),_=h(456),l=h(511),a=h(8460),i=h(4725),e=h(2585),n=h(9806),t=h(9504),s=h(844),f=h(4841),v=String.fromCharCode(160),u=new RegExp(v,"g");let C=class extends s.Disposable{constructor(g,m,b,y,w,p,S,L,E){super(),this._element=g,this._screenElement=m,this._linkifier=b,this._bufferService=y,this._coreService=w,this._mouseService=p,this._optionsService=S,this._renderService=L,this._coreBrowserService=E,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new l.CellData,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this.register(new a.EventEmitter),this._onRedrawRequest=this.register(new a.EventEmitter),this._onSelectionChange=this.register(new a.EventEmitter),this._onRequestScrollLines=this.register(new a.EventEmitter),this._mouseMoveListener=A=>this._onMouseMove(A),this._mouseUpListener=A=>this._onMouseUp(A),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(A=>this._onTrim(A)),this.register(this._bufferService.buffers.onBufferActivate(A=>this._onBufferActivate(A))),this.enable(),this._model=new _.SelectionModel(this._bufferService),this._activeSelectionMode=0}get onLinuxMouseSelection(){return this._onLinuxMouseSelection.event}get onRequestRedraw(){return this._onRedrawRequest.event}get onSelectionChange(){return this._onSelectionChange.event}get onRequestScrollLines(){return this._onRequestScrollLines.event}dispose(){this._removeMouseDownListeners()}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){const g=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;return!(!g||!m||g[0]===m[0]&&g[1]===m[1])}get selectionText(){const g=this._model.finalSelectionStart,m=this._model.finalSelectionEnd;if(!g||!m)return"";const b=this._bufferService.buffer,y=[];if(this._activeSelectionMode===3){if(g[0]===m[0])return"";const w=g[0]w.replace(u," ")).join(c.isWindows?`\r +`:` +`)}clearSelection(){this._model.clearSelection(),this._removeMouseDownListeners(),this.refresh(),this._onSelectionChange.fire()}refresh(g){this._refreshAnimationFrame||(this._refreshAnimationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._refresh())),c.isLinux&&g&&this.selectionText.length&&this._onLinuxMouseSelection.fire(this.selectionText)}_refresh(){this._refreshAnimationFrame=void 0,this._onRedrawRequest.fire({start:this._model.finalSelectionStart,end:this._model.finalSelectionEnd,columnSelectMode:this._activeSelectionMode===3})}_isClickInSelection(g){const m=this._getMouseBufferCoords(g),b=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!!(b&&y&&m)&&this._areCoordsInSelection(m,b,y)}isCellInSelection(g,m){const b=this._model.finalSelectionStart,y=this._model.finalSelectionEnd;return!(!b||!y)&&this._areCoordsInSelection([g,m],b,y)}_areCoordsInSelection(g,m,b){return g[1]>m[1]&&g[1]=m[0]&&g[0]=m[0]}_selectWordAtCursor(g,m){var b,y;const w=(y=(b=this._linkifier.currentLink)===null||b===void 0?void 0:b.link)===null||y===void 0?void 0:y.range;if(w)return this._model.selectionStart=[w.start.x-1,w.start.y-1],this._model.selectionStartLength=(0,f.getRangeLength)(w,this._bufferService.cols),this._model.selectionEnd=void 0,!0;const p=this._getMouseBufferCoords(g);return!!p&&(this._selectWordAt(p,m),this._model.selectionEnd=void 0,!0)}selectAll(){this._model.isSelectAllActive=!0,this.refresh(),this._onSelectionChange.fire()}selectLines(g,m){this._model.clearSelection(),g=Math.max(g,0),m=Math.min(m,this._bufferService.buffer.lines.length-1),this._model.selectionStart=[0,g],this._model.selectionEnd=[this._bufferService.cols,m],this.refresh(),this._onSelectionChange.fire()}_onTrim(g){this._model.onTrim(g)&&this.refresh()}_getMouseBufferCoords(g){const m=this._mouseService.getCoords(g,this._screenElement,this._bufferService.cols,this._bufferService.rows,!0);if(m)return m[0]--,m[1]--,m[1]+=this._bufferService.buffer.ydisp,m}_getMouseEventScrollAmount(g){let m=(0,n.getCoordsRelativeToElement)(this._coreBrowserService.window,g,this._screenElement)[1];const b=this._renderService.dimensions.canvasHeight;return m>=0&&m<=b?0:(m>b&&(m-=b),m=Math.min(Math.max(m,-50),50),m/=50,m/Math.abs(m)+Math.round(14*m))}shouldForceSelection(g){return c.isMac?g.altKey&&this._optionsService.rawOptions.macOptionClickForcesSelection:g.shiftKey}onMouseDown(g){if(this._mouseDownTimeStamp=g.timeStamp,(g.button!==2||!this.hasSelection)&&g.button===0){if(!this._enabled){if(!this.shouldForceSelection(g))return;g.stopPropagation()}g.preventDefault(),this._dragScrollAmount=0,this._enabled&&g.shiftKey?this._onIncrementalClick(g):g.detail===1?this._onSingleClick(g):g.detail===2?this._onDoubleClick(g):g.detail===3&&this._onTripleClick(g),this._addMouseDownListeners(),this.refresh(!0)}}_addMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.addEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.addEventListener("mouseup",this._mouseUpListener)),this._dragScrollIntervalTimer=this._coreBrowserService.window.setInterval(()=>this._dragScroll(),50)}_removeMouseDownListeners(){this._screenElement.ownerDocument&&(this._screenElement.ownerDocument.removeEventListener("mousemove",this._mouseMoveListener),this._screenElement.ownerDocument.removeEventListener("mouseup",this._mouseUpListener)),this._coreBrowserService.window.clearInterval(this._dragScrollIntervalTimer),this._dragScrollIntervalTimer=void 0}_onIncrementalClick(g){this._model.selectionStart&&(this._model.selectionEnd=this._getMouseBufferCoords(g))}_onSingleClick(g){if(this._model.selectionStartLength=0,this._model.isSelectAllActive=!1,this._activeSelectionMode=this.shouldColumnSelect(g)?3:0,this._model.selectionStart=this._getMouseBufferCoords(g),!this._model.selectionStart)return;this._model.selectionEnd=void 0;const m=this._bufferService.buffer.lines.get(this._model.selectionStart[1]);m&&m.length!==this._model.selectionStart[0]&&m.hasWidth(this._model.selectionStart[0])===0&&this._model.selectionStart[0]++}_onDoubleClick(g){this._selectWordAtCursor(g,!0)&&(this._activeSelectionMode=1)}_onTripleClick(g){const m=this._getMouseBufferCoords(g);m&&(this._activeSelectionMode=2,this._selectLineAt(m[1]))}shouldColumnSelect(g){return g.altKey&&!(c.isMac&&this._optionsService.rawOptions.macOptionClickForcesSelection)}_onMouseMove(g){if(g.stopImmediatePropagation(),!this._model.selectionStart)return;const m=this._model.selectionEnd?[this._model.selectionEnd[0],this._model.selectionEnd[1]]:null;if(this._model.selectionEnd=this._getMouseBufferCoords(g),!this._model.selectionEnd)return void this.refresh(!0);this._activeSelectionMode===2?this._model.selectionEnd[1]0?this._model.selectionEnd[0]=this._bufferService.cols:this._dragScrollAmount<0&&(this._model.selectionEnd[0]=0));const b=this._bufferService.buffer;if(this._model.selectionEnd[1]0?(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=this._bufferService.cols),this._model.selectionEnd[1]=Math.min(g.ydisp+this._bufferService.rows,g.lines.length-1)):(this._activeSelectionMode!==3&&(this._model.selectionEnd[0]=0),this._model.selectionEnd[1]=g.ydisp),this.refresh()}}_onMouseUp(g){const m=g.timeStamp-this._mouseDownTimeStamp;if(this._removeMouseDownListeners(),this.selectionText.length<=1&&m<500&&g.altKey&&this._optionsService.rawOptions.altClickMovesCursor){if(this._bufferService.buffer.ybase===this._bufferService.buffer.ydisp){const b=this._mouseService.getCoords(g,this._element,this._bufferService.cols,this._bufferService.rows,!1);if(b&&b[0]!==void 0&&b[1]!==void 0){const y=(0,t.moveToCellSequence)(b[0]-1,b[1]-1,this._bufferService,this._coreService.decPrivateModes.applicationCursorKeys);this._coreService.triggerDataEvent(y,!0)}}}else this._fireEventIfSelectionChanged()}_fireEventIfSelectionChanged(){const g=this._model.finalSelectionStart,m=this._model.finalSelectionEnd,b=!(!g||!m||g[0]===m[0]&&g[1]===m[1]);b?g&&m&&(this._oldSelectionStart&&this._oldSelectionEnd&&g[0]===this._oldSelectionStart[0]&&g[1]===this._oldSelectionStart[1]&&m[0]===this._oldSelectionEnd[0]&&m[1]===this._oldSelectionEnd[1]||this._fireOnSelectionChange(g,m,b)):this._oldHasSelection&&this._fireOnSelectionChange(g,m,b)}_fireOnSelectionChange(g,m,b){this._oldSelectionStart=g,this._oldSelectionEnd=m,this._oldHasSelection=b,this._onSelectionChange.fire()}_onBufferActivate(g){this.clearSelection(),this._trimListener.dispose(),this._trimListener=g.activeBuffer.lines.onTrim(m=>this._onTrim(m))}_convertViewportColToCharacterIndex(g,m){let b=m[0];for(let y=0;m[0]>=y;y++){const w=g.loadCell(y,this._workCell).getChars().length;this._workCell.getWidth()===0?b--:w>1&&m[0]!==y&&(b+=w-1)}return b}setSelection(g,m,b){this._model.clearSelection(),this._removeMouseDownListeners(),this._model.selectionStart=[g,m],this._model.selectionStartLength=b,this.refresh(),this._fireEventIfSelectionChanged()}rightClickSelect(g){this._isClickInSelection(g)||(this._selectWordAtCursor(g,!1)&&this.refresh(!0),this._fireEventIfSelectionChanged())}_getWordAt(g,m,b=!0,y=!0){if(g[0]>=this._bufferService.cols)return;const w=this._bufferService.buffer,p=w.lines.get(g[1]);if(!p)return;const S=w.translateBufferLineToString(g[1],!1);let L=this._convertViewportColToCharacterIndex(p,g),E=L;const A=g[0]-L;let k=0,O=0,T=0,H=0;if(S.charAt(L)===" "){for(;L>0&&S.charAt(L-1)===" ";)L--;for(;E1&&(H+=R-1,E+=R-1);B>0&&L>0&&!this._isCharWordSeparator(p.loadCell(B-1,this._workCell));){p.loadCell(B-1,this._workCell);const M=this._workCell.getChars().length;this._workCell.getWidth()===0?(k++,B--):M>1&&(T+=M-1,L-=M-1),L--,B--}for(;P1&&(H+=M-1,E+=M-1),E++,P++}}E++;let W=L+A-k+T,x=Math.min(this._bufferService.cols,E-L+k+O-T-H);if(m||S.slice(L,E).trim()!==""){if(b&&W===0&&p.getCodePoint(0)!==32){const B=w.lines.get(g[1]-1);if(B&&p.isWrapped&&B.getCodePoint(this._bufferService.cols-1)!==32){const P=this._getWordAt([this._bufferService.cols-1,g[1]-1],!1,!0,!1);if(P){const R=this._bufferService.cols-P.start;W-=R,x+=R}}}if(y&&W+x===this._bufferService.cols&&p.getCodePoint(this._bufferService.cols-1)!==32){const B=w.lines.get(g[1]+1);if((B==null?void 0:B.isWrapped)&&B.getCodePoint(0)!==32){const P=this._getWordAt([0,g[1]+1],!1,!1,!0);P&&(x+=P.length)}}return{start:W,length:x}}}_selectWordAt(g,m){const b=this._getWordAt(g,m);if(b){for(;b.start<0;)b.start+=this._bufferService.cols,g[1]--;this._model.selectionStart=[b.start,g[1]],this._model.selectionStartLength=b.length}}_selectToWordAt(g){const m=this._getWordAt(g,!0);if(m){let b=g[1];for(;m.start<0;)m.start+=this._bufferService.cols,b--;if(!this._model.areSelectionValuesReversed())for(;m.start+m.length>this._bufferService.cols;)m.length-=this._bufferService.cols,b++;this._model.selectionEnd=[this._model.areSelectionValuesReversed()?m.start:m.start+m.length,b]}}_isCharWordSeparator(g){return g.getWidth()!==0&&this._optionsService.rawOptions.wordSeparator.indexOf(g.getChars())>=0}_selectLineAt(g){const m=this._bufferService.buffer.getWrappedRangeForLine(g),b={start:{x:0,y:m.first},end:{x:this._bufferService.cols-1,y:m.last}};this._model.selectionStart=[0,m.first],this._model.selectionEnd=void 0,this._model.selectionStartLength=(0,f.getRangeLength)(b,this._bufferService.cols)}};C=o([d(3,e.IBufferService),d(4,e.ICoreService),d(5,i.IMouseService),d(6,e.IOptionsService),d(7,i.IRenderService),d(8,i.ICoreBrowserService)],C),r.SelectionService=C},4725:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ICharacterJoinerService=r.ISelectionService=r.IRenderService=r.IMouseService=r.ICoreBrowserService=r.ICharSizeService=void 0;const o=h(8343);r.ICharSizeService=(0,o.createDecorator)("CharSizeService"),r.ICoreBrowserService=(0,o.createDecorator)("CoreBrowserService"),r.IMouseService=(0,o.createDecorator)("MouseService"),r.IRenderService=(0,o.createDecorator)("RenderService"),r.ISelectionService=(0,o.createDecorator)("SelectionService"),r.ICharacterJoinerService=(0,o.createDecorator)("CharacterJoinerService")},6349:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CircularList=void 0;const o=h(8460);r.CircularList=class{constructor(d){this._maxLength=d,this.onDeleteEmitter=new o.EventEmitter,this.onInsertEmitter=new o.EventEmitter,this.onTrimEmitter=new o.EventEmitter,this._array=new Array(this._maxLength),this._startIndex=0,this._length=0}get onDelete(){return this.onDeleteEmitter.event}get onInsert(){return this.onInsertEmitter.event}get onTrim(){return this.onTrimEmitter.event}get maxLength(){return this._maxLength}set maxLength(d){if(this._maxLength===d)return;const c=new Array(d);for(let _=0;_this._length)for(let c=this._length;c=d;l--)this._array[this._getCyclicIndex(l+_.length)]=this._array[this._getCyclicIndex(l)];for(let l=0;l<_.length;l++)this._array[this._getCyclicIndex(d+l)]=_[l];if(_.length&&this.onInsertEmitter.fire({index:d,amount:_.length}),this._length+_.length>this._maxLength){const l=this._length+_.length-this._maxLength;this._startIndex+=l,this._length=this._maxLength,this.onTrimEmitter.fire(l)}else this._length+=_.length}trimStart(d){d>this._length&&(d=this._length),this._startIndex+=d,this._length-=d,this.onTrimEmitter.fire(d)}shiftElements(d,c,_){if(!(c<=0)){if(d<0||d>=this._length)throw new Error("start argument out of range");if(d+_<0)throw new Error("Cannot shift elements in list beyond index 0");if(_>0){for(let a=c-1;a>=0;a--)this.set(d+a+_,this.get(d+a));const l=d+c+_-this._length;if(l>0)for(this._length+=l;this._length>this._maxLength;)this._length--,this._startIndex++,this.onTrimEmitter.fire(1)}else for(let l=0;l{Object.defineProperty(r,"__esModule",{value:!0}),r.clone=void 0,r.clone=function h(o,d=5){if(typeof o!="object")return o;const c=Array.isArray(o)?[]:{};for(const _ in o)c[_]=d<=1?o[_]:o[_]&&h(o[_],d-1);return c}},8055:(D,r)=>{var h,o,d;function c(l){const a=l.toString(16);return a.length<2?"0"+a:a}function _(l,a){return l>>0}}(h=r.channels||(r.channels={})),function(l){function a(i,e){const n=Math.round(255*e),[t,s,f]=d.toChannels(i.rgba);return{css:h.toCss(t,s,f,n),rgba:h.toRgba(t,s,f,n)}}l.blend=function(i,e){const n=(255&e.rgba)/255;if(n===1)return{css:e.css,rgba:e.rgba};const t=e.rgba>>24&255,s=e.rgba>>16&255,f=e.rgba>>8&255,v=i.rgba>>24&255,u=i.rgba>>16&255,C=i.rgba>>8&255,g=v+Math.round((t-v)*n),m=u+Math.round((s-u)*n),b=C+Math.round((f-C)*n);return{css:h.toCss(g,m,b),rgba:h.toRgba(g,m,b)}},l.isOpaque=function(i){return(255&i.rgba)==255},l.ensureContrastRatio=function(i,e,n){const t=d.ensureContrastRatio(i.rgba,e.rgba,n);if(t)return d.toColor(t>>24&255,t>>16&255,t>>8&255)},l.opaque=function(i){const e=(255|i.rgba)>>>0,[n,t,s]=d.toChannels(e);return{css:h.toCss(n,t,s),rgba:e}},l.opacity=a,l.multiplyOpacity=function(i,e){return a(i,(255&i.rgba)*e/255)},l.toColorRGB=function(i){return[i.rgba>>24&255,i.rgba>>16&255,i.rgba>>8&255]}}(r.color||(r.color={})),(r.css||(r.css={})).toColor=function(l){if(l.match(/#[0-9a-f]{3,8}/i))switch(l.length){case 4:{const i=parseInt(l.slice(1,2).repeat(2),16),e=parseInt(l.slice(2,3).repeat(2),16),n=parseInt(l.slice(3,4).repeat(2),16);return d.toColor(i,e,n)}case 5:{const i=parseInt(l.slice(1,2).repeat(2),16),e=parseInt(l.slice(2,3).repeat(2),16),n=parseInt(l.slice(3,4).repeat(2),16),t=parseInt(l.slice(4,5).repeat(2),16);return d.toColor(i,e,n,t)}case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}const a=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a){const i=parseInt(a[1]),e=parseInt(a[2]),n=parseInt(a[3]),t=Math.round(255*(a[5]===void 0?1:parseFloat(a[5])));return d.toColor(i,e,n,t)}throw new Error("css.toColor: Unsupported css format")},function(l){function a(i,e,n){const t=i/255,s=e/255,f=n/255;return .2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4))}l.relativeLuminance=function(i){return a(i>>16&255,i>>8&255,255&i)},l.relativeLuminance2=a}(o=r.rgb||(r.rgb={})),function(l){function a(e,n,t){const s=e>>24&255,f=e>>16&255,v=e>>8&255;let u=n>>24&255,C=n>>16&255,g=n>>8&255,m=_(o.relativeLuminance2(u,C,g),o.relativeLuminance2(s,f,v));for(;m0||C>0||g>0);)u-=Math.max(0,Math.ceil(.1*u)),C-=Math.max(0,Math.ceil(.1*C)),g-=Math.max(0,Math.ceil(.1*g)),m=_(o.relativeLuminance2(u,C,g),o.relativeLuminance2(s,f,v));return(u<<24|C<<16|g<<8|255)>>>0}function i(e,n,t){const s=e>>24&255,f=e>>16&255,v=e>>8&255;let u=n>>24&255,C=n>>16&255,g=n>>8&255,m=_(o.relativeLuminance2(u,C,g),o.relativeLuminance2(s,f,v));for(;m>>0}l.ensureContrastRatio=function(e,n,t){const s=o.relativeLuminance(e>>8),f=o.relativeLuminance(n>>8);if(_(s,f)>8));if(g_(s,o.relativeLuminance(m>>8))?C:m}return C}const v=i(e,n,t),u=_(s,o.relativeLuminance(v>>8));if(u_(s,o.relativeLuminance(C>>8))?v:C}return v}},l.reduceLuminance=a,l.increaseLuminance=i,l.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},l.toColor=function(e,n,t,s){return{css:h.toCss(e,n,t,s),rgba:h.toRgba(e,n,t,s)}}}(d=r.rgba||(r.rgba={})),r.toPaddedHex=c,r.contrastRatio=_},8969:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CoreTerminal=void 0;const o=h(844),d=h(2585),c=h(4348),_=h(7866),l=h(744),a=h(7302),i=h(6975),e=h(8460),n=h(1753),t=h(3730),s=h(1480),f=h(7994),v=h(9282),u=h(5435),C=h(5981),g=h(2660);let m=!1;class b extends o.Disposable{constructor(w){super(),this._onBinary=new e.EventEmitter,this._onData=new e.EventEmitter,this._onLineFeed=new e.EventEmitter,this._onResize=new e.EventEmitter,this._onScroll=new e.EventEmitter,this._onWriteParsed=new e.EventEmitter,this._instantiationService=new c.InstantiationService,this.optionsService=new a.OptionsService(w),this._instantiationService.setService(d.IOptionsService,this.optionsService),this._bufferService=this.register(this._instantiationService.createInstance(l.BufferService)),this._instantiationService.setService(d.IBufferService,this._bufferService),this._logService=this._instantiationService.createInstance(_.LogService),this._instantiationService.setService(d.ILogService,this._logService),this.coreService=this.register(this._instantiationService.createInstance(i.CoreService,()=>this.scrollToBottom())),this._instantiationService.setService(d.ICoreService,this.coreService),this.coreMouseService=this._instantiationService.createInstance(n.CoreMouseService),this._instantiationService.setService(d.ICoreMouseService,this.coreMouseService),this._dirtyRowService=this._instantiationService.createInstance(t.DirtyRowService),this._instantiationService.setService(d.IDirtyRowService,this._dirtyRowService),this.unicodeService=this._instantiationService.createInstance(s.UnicodeService),this._instantiationService.setService(d.IUnicodeService,this.unicodeService),this._charsetService=this._instantiationService.createInstance(f.CharsetService),this._instantiationService.setService(d.ICharsetService,this._charsetService),this._oscLinkService=this._instantiationService.createInstance(g.OscLinkService),this._instantiationService.setService(d.IOscLinkService,this._oscLinkService),this._inputHandler=new u.InputHandler(this._bufferService,this._charsetService,this.coreService,this._dirtyRowService,this._logService,this.optionsService,this._oscLinkService,this.coreMouseService,this.unicodeService),this.register((0,e.forwardEvent)(this._inputHandler.onLineFeed,this._onLineFeed)),this.register(this._inputHandler),this.register((0,e.forwardEvent)(this._bufferService.onResize,this._onResize)),this.register((0,e.forwardEvent)(this.coreService.onData,this._onData)),this.register((0,e.forwardEvent)(this.coreService.onBinary,this._onBinary)),this.register(this.optionsService.onOptionChange(p=>this._updateOptions(p))),this.register(this._bufferService.onScroll(p=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this.register(this._inputHandler.onScroll(p=>{this._onScroll.fire({position:this._bufferService.buffer.ydisp,source:0}),this._dirtyRowService.markRangeDirty(this._bufferService.buffer.scrollTop,this._bufferService.buffer.scrollBottom)})),this._writeBuffer=new C.WriteBuffer((p,S)=>this._inputHandler.parse(p,S)),this.register((0,e.forwardEvent)(this._writeBuffer.onWriteParsed,this._onWriteParsed))}get onBinary(){return this._onBinary.event}get onData(){return this._onData.event}get onLineFeed(){return this._onLineFeed.event}get onResize(){return this._onResize.event}get onWriteParsed(){return this._onWriteParsed.event}get onScroll(){return this._onScrollApi||(this._onScrollApi=new e.EventEmitter,this.register(this._onScroll.event(w=>{var p;(p=this._onScrollApi)===null||p===void 0||p.fire(w.position)}))),this._onScrollApi.event}get cols(){return this._bufferService.cols}get rows(){return this._bufferService.rows}get buffers(){return this._bufferService.buffers}get options(){return this.optionsService.options}set options(w){for(const p in w)this.optionsService.options[p]=w[p]}dispose(){var w;this._isDisposed||(super.dispose(),(w=this._windowsMode)===null||w===void 0||w.dispose(),this._windowsMode=void 0)}write(w,p){this._writeBuffer.write(w,p)}writeSync(w,p){this._logService.logLevel<=d.LogLevelEnum.WARN&&!m&&(this._logService.warn("writeSync is unreliable and will be removed soon."),m=!0),this._writeBuffer.writeSync(w,p)}resize(w,p){isNaN(w)||isNaN(p)||(w=Math.max(w,l.MINIMUM_COLS),p=Math.max(p,l.MINIMUM_ROWS),this._bufferService.resize(w,p))}scroll(w,p=!1){this._bufferService.scroll(w,p)}scrollLines(w,p,S){this._bufferService.scrollLines(w,p,S)}scrollPages(w){this._bufferService.scrollPages(w)}scrollToTop(){this._bufferService.scrollToTop()}scrollToBottom(){this._bufferService.scrollToBottom()}scrollToLine(w){this._bufferService.scrollToLine(w)}registerEscHandler(w,p){return this._inputHandler.registerEscHandler(w,p)}registerDcsHandler(w,p){return this._inputHandler.registerDcsHandler(w,p)}registerCsiHandler(w,p){return this._inputHandler.registerCsiHandler(w,p)}registerOscHandler(w,p){return this._inputHandler.registerOscHandler(w,p)}_setup(){this.optionsService.rawOptions.windowsMode&&this._enableWindowsMode()}reset(){this._inputHandler.reset(),this._bufferService.reset(),this._charsetService.reset(),this.coreService.reset(),this.coreMouseService.reset()}_updateOptions(w){var p;switch(w){case"scrollback":this.buffers.resize(this.cols,this.rows);break;case"windowsMode":this.optionsService.rawOptions.windowsMode?this._enableWindowsMode():((p=this._windowsMode)===null||p===void 0||p.dispose(),this._windowsMode=void 0)}}_enableWindowsMode(){if(!this._windowsMode){const w=[];w.push(this.onLineFeed(v.updateWindowsModeWrappedState.bind(null,this._bufferService))),w.push(this.registerCsiHandler({final:"H"},()=>((0,v.updateWindowsModeWrappedState)(this._bufferService),!1))),this._windowsMode={dispose:()=>{for(const p of w)p.dispose()}}}}}r.CoreTerminal=b},8460:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let o=0;oo.fire(d))}},5435:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InputHandler=r.WindowsOptionsReportType=void 0;const o=h(2584),d=h(7116),c=h(2015),_=h(844),l=h(482),a=h(8437),i=h(8460),e=h(643),n=h(511),t=h(3734),s=h(2585),f=h(6242),v=h(6351),u=h(5941),C={"(":0,")":1,"*":2,"+":3,"-":1,".":2},g=131072;function m(w,p){if(w>24)return p.setWinLines||!1;switch(w){case 1:return!!p.restoreWin;case 2:return!!p.minimizeWin;case 3:return!!p.setWinPosition;case 4:return!!p.setWinSizePixels;case 5:return!!p.raiseWin;case 6:return!!p.lowerWin;case 7:return!!p.refreshWin;case 8:return!!p.setWinSizeChars;case 9:return!!p.maximizeWin;case 10:return!!p.fullscreenWin;case 11:return!!p.getWinState;case 13:return!!p.getWinPosition;case 14:return!!p.getWinSizePixels;case 15:return!!p.getScreenSizePixels;case 16:return!!p.getCellSizePixels;case 18:return!!p.getWinSizeChars;case 19:return!!p.getScreenSizeChars;case 20:return!!p.getIconTitle;case 21:return!!p.getWinTitle;case 22:return!!p.pushTitle;case 23:return!!p.popTitle;case 24:return!!p.setWinLines}return!1}var b;(function(w){w[w.GET_WIN_SIZE_PIXELS=0]="GET_WIN_SIZE_PIXELS",w[w.GET_CELL_SIZE_PIXELS=1]="GET_CELL_SIZE_PIXELS"})(b=r.WindowsOptionsReportType||(r.WindowsOptionsReportType={}));class y extends _.Disposable{constructor(p,S,L,E,A,k,O,T,H,W=new c.EscapeSequenceParser){super(),this._bufferService=p,this._charsetService=S,this._coreService=L,this._dirtyRowService=E,this._logService=A,this._optionsService=k,this._oscLinkService=O,this._coreMouseService=T,this._unicodeService=H,this._parser=W,this._parseBuffer=new Uint32Array(4096),this._stringDecoder=new l.StringToUtf32,this._utf8Decoder=new l.Utf8ToUtf32,this._workCell=new n.CellData,this._windowTitle="",this._iconName="",this._windowTitleStack=[],this._iconNameStack=[],this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone(),this._onRequestBell=new i.EventEmitter,this._onRequestRefreshRows=new i.EventEmitter,this._onRequestReset=new i.EventEmitter,this._onRequestSendFocus=new i.EventEmitter,this._onRequestSyncScrollBar=new i.EventEmitter,this._onRequestWindowsOptionsReport=new i.EventEmitter,this._onA11yChar=new i.EventEmitter,this._onA11yTab=new i.EventEmitter,this._onCursorMove=new i.EventEmitter,this._onLineFeed=new i.EventEmitter,this._onScroll=new i.EventEmitter,this._onTitleChange=new i.EventEmitter,this._onColor=new i.EventEmitter,this._parseStack={paused:!1,cursorStartX:0,cursorStartY:0,decodedLength:0,position:0},this._specialColors=[256,257,258],this.register(this._parser),this._activeBuffer=this._bufferService.buffer,this.register(this._bufferService.buffers.onBufferActivate(x=>this._activeBuffer=x.activeBuffer)),this._parser.setCsiHandlerFallback((x,B)=>{this._logService.debug("Unknown CSI code: ",{identifier:this._parser.identToString(x),params:B.toArray()})}),this._parser.setEscHandlerFallback(x=>{this._logService.debug("Unknown ESC code: ",{identifier:this._parser.identToString(x)})}),this._parser.setExecuteHandlerFallback(x=>{this._logService.debug("Unknown EXECUTE code: ",{code:x})}),this._parser.setOscHandlerFallback((x,B,P)=>{this._logService.debug("Unknown OSC code: ",{identifier:x,action:B,data:P})}),this._parser.setDcsHandlerFallback((x,B,P)=>{B==="HOOK"&&(P=P.toArray()),this._logService.debug("Unknown DCS code: ",{identifier:this._parser.identToString(x),action:B,payload:P})}),this._parser.setPrintHandler((x,B,P)=>this.print(x,B,P)),this._parser.registerCsiHandler({final:"@"},x=>this.insertChars(x)),this._parser.registerCsiHandler({intermediates:" ",final:"@"},x=>this.scrollLeft(x)),this._parser.registerCsiHandler({final:"A"},x=>this.cursorUp(x)),this._parser.registerCsiHandler({intermediates:" ",final:"A"},x=>this.scrollRight(x)),this._parser.registerCsiHandler({final:"B"},x=>this.cursorDown(x)),this._parser.registerCsiHandler({final:"C"},x=>this.cursorForward(x)),this._parser.registerCsiHandler({final:"D"},x=>this.cursorBackward(x)),this._parser.registerCsiHandler({final:"E"},x=>this.cursorNextLine(x)),this._parser.registerCsiHandler({final:"F"},x=>this.cursorPrecedingLine(x)),this._parser.registerCsiHandler({final:"G"},x=>this.cursorCharAbsolute(x)),this._parser.registerCsiHandler({final:"H"},x=>this.cursorPosition(x)),this._parser.registerCsiHandler({final:"I"},x=>this.cursorForwardTab(x)),this._parser.registerCsiHandler({final:"J"},x=>this.eraseInDisplay(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"J"},x=>this.eraseInDisplay(x,!0)),this._parser.registerCsiHandler({final:"K"},x=>this.eraseInLine(x,!1)),this._parser.registerCsiHandler({prefix:"?",final:"K"},x=>this.eraseInLine(x,!0)),this._parser.registerCsiHandler({final:"L"},x=>this.insertLines(x)),this._parser.registerCsiHandler({final:"M"},x=>this.deleteLines(x)),this._parser.registerCsiHandler({final:"P"},x=>this.deleteChars(x)),this._parser.registerCsiHandler({final:"S"},x=>this.scrollUp(x)),this._parser.registerCsiHandler({final:"T"},x=>this.scrollDown(x)),this._parser.registerCsiHandler({final:"X"},x=>this.eraseChars(x)),this._parser.registerCsiHandler({final:"Z"},x=>this.cursorBackwardTab(x)),this._parser.registerCsiHandler({final:"`"},x=>this.charPosAbsolute(x)),this._parser.registerCsiHandler({final:"a"},x=>this.hPositionRelative(x)),this._parser.registerCsiHandler({final:"b"},x=>this.repeatPrecedingCharacter(x)),this._parser.registerCsiHandler({final:"c"},x=>this.sendDeviceAttributesPrimary(x)),this._parser.registerCsiHandler({prefix:">",final:"c"},x=>this.sendDeviceAttributesSecondary(x)),this._parser.registerCsiHandler({final:"d"},x=>this.linePosAbsolute(x)),this._parser.registerCsiHandler({final:"e"},x=>this.vPositionRelative(x)),this._parser.registerCsiHandler({final:"f"},x=>this.hVPosition(x)),this._parser.registerCsiHandler({final:"g"},x=>this.tabClear(x)),this._parser.registerCsiHandler({final:"h"},x=>this.setMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"h"},x=>this.setModePrivate(x)),this._parser.registerCsiHandler({final:"l"},x=>this.resetMode(x)),this._parser.registerCsiHandler({prefix:"?",final:"l"},x=>this.resetModePrivate(x)),this._parser.registerCsiHandler({final:"m"},x=>this.charAttributes(x)),this._parser.registerCsiHandler({final:"n"},x=>this.deviceStatus(x)),this._parser.registerCsiHandler({prefix:"?",final:"n"},x=>this.deviceStatusPrivate(x)),this._parser.registerCsiHandler({intermediates:"!",final:"p"},x=>this.softReset(x)),this._parser.registerCsiHandler({intermediates:" ",final:"q"},x=>this.setCursorStyle(x)),this._parser.registerCsiHandler({final:"r"},x=>this.setScrollRegion(x)),this._parser.registerCsiHandler({final:"s"},x=>this.saveCursor(x)),this._parser.registerCsiHandler({final:"t"},x=>this.windowOptions(x)),this._parser.registerCsiHandler({final:"u"},x=>this.restoreCursor(x)),this._parser.registerCsiHandler({intermediates:"'",final:"}"},x=>this.insertColumns(x)),this._parser.registerCsiHandler({intermediates:"'",final:"~"},x=>this.deleteColumns(x)),this._parser.registerCsiHandler({intermediates:'"',final:"q"},x=>this.selectProtected(x)),this._parser.registerCsiHandler({intermediates:"$",final:"p"},x=>this.requestMode(x,!0)),this._parser.registerCsiHandler({prefix:"?",intermediates:"$",final:"p"},x=>this.requestMode(x,!1)),this._parser.setExecuteHandler(o.C0.BEL,()=>this.bell()),this._parser.setExecuteHandler(o.C0.LF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.VT,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.FF,()=>this.lineFeed()),this._parser.setExecuteHandler(o.C0.CR,()=>this.carriageReturn()),this._parser.setExecuteHandler(o.C0.BS,()=>this.backspace()),this._parser.setExecuteHandler(o.C0.HT,()=>this.tab()),this._parser.setExecuteHandler(o.C0.SO,()=>this.shiftOut()),this._parser.setExecuteHandler(o.C0.SI,()=>this.shiftIn()),this._parser.setExecuteHandler(o.C1.IND,()=>this.index()),this._parser.setExecuteHandler(o.C1.NEL,()=>this.nextLine()),this._parser.setExecuteHandler(o.C1.HTS,()=>this.tabSet()),this._parser.registerOscHandler(0,new f.OscHandler(x=>(this.setTitle(x),this.setIconName(x),!0))),this._parser.registerOscHandler(1,new f.OscHandler(x=>this.setIconName(x))),this._parser.registerOscHandler(2,new f.OscHandler(x=>this.setTitle(x))),this._parser.registerOscHandler(4,new f.OscHandler(x=>this.setOrReportIndexedColor(x))),this._parser.registerOscHandler(8,new f.OscHandler(x=>this.setHyperlink(x))),this._parser.registerOscHandler(10,new f.OscHandler(x=>this.setOrReportFgColor(x))),this._parser.registerOscHandler(11,new f.OscHandler(x=>this.setOrReportBgColor(x))),this._parser.registerOscHandler(12,new f.OscHandler(x=>this.setOrReportCursorColor(x))),this._parser.registerOscHandler(104,new f.OscHandler(x=>this.restoreIndexedColor(x))),this._parser.registerOscHandler(110,new f.OscHandler(x=>this.restoreFgColor(x))),this._parser.registerOscHandler(111,new f.OscHandler(x=>this.restoreBgColor(x))),this._parser.registerOscHandler(112,new f.OscHandler(x=>this.restoreCursorColor(x))),this._parser.registerEscHandler({final:"7"},()=>this.saveCursor()),this._parser.registerEscHandler({final:"8"},()=>this.restoreCursor()),this._parser.registerEscHandler({final:"D"},()=>this.index()),this._parser.registerEscHandler({final:"E"},()=>this.nextLine()),this._parser.registerEscHandler({final:"H"},()=>this.tabSet()),this._parser.registerEscHandler({final:"M"},()=>this.reverseIndex()),this._parser.registerEscHandler({final:"="},()=>this.keypadApplicationMode()),this._parser.registerEscHandler({final:">"},()=>this.keypadNumericMode()),this._parser.registerEscHandler({final:"c"},()=>this.fullReset()),this._parser.registerEscHandler({final:"n"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"o"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"|"},()=>this.setgLevel(3)),this._parser.registerEscHandler({final:"}"},()=>this.setgLevel(2)),this._parser.registerEscHandler({final:"~"},()=>this.setgLevel(1)),this._parser.registerEscHandler({intermediates:"%",final:"@"},()=>this.selectDefaultCharset()),this._parser.registerEscHandler({intermediates:"%",final:"G"},()=>this.selectDefaultCharset());for(const x in d.CHARSETS)this._parser.registerEscHandler({intermediates:"(",final:x},()=>this.selectCharset("("+x)),this._parser.registerEscHandler({intermediates:")",final:x},()=>this.selectCharset(")"+x)),this._parser.registerEscHandler({intermediates:"*",final:x},()=>this.selectCharset("*"+x)),this._parser.registerEscHandler({intermediates:"+",final:x},()=>this.selectCharset("+"+x)),this._parser.registerEscHandler({intermediates:"-",final:x},()=>this.selectCharset("-"+x)),this._parser.registerEscHandler({intermediates:".",final:x},()=>this.selectCharset("."+x)),this._parser.registerEscHandler({intermediates:"/",final:x},()=>this.selectCharset("/"+x));this._parser.registerEscHandler({intermediates:"#",final:"8"},()=>this.screenAlignmentPattern()),this._parser.setErrorHandler(x=>(this._logService.error("Parsing error: ",x),x)),this._parser.registerDcsHandler({intermediates:"$",final:"q"},new v.DcsHandler((x,B)=>this.requestStatusString(x,B)))}getAttrData(){return this._curAttrData}get onRequestBell(){return this._onRequestBell.event}get onRequestRefreshRows(){return this._onRequestRefreshRows.event}get onRequestReset(){return this._onRequestReset.event}get onRequestSendFocus(){return this._onRequestSendFocus.event}get onRequestSyncScrollBar(){return this._onRequestSyncScrollBar.event}get onRequestWindowsOptionsReport(){return this._onRequestWindowsOptionsReport.event}get onA11yChar(){return this._onA11yChar.event}get onA11yTab(){return this._onA11yTab.event}get onCursorMove(){return this._onCursorMove.event}get onLineFeed(){return this._onLineFeed.event}get onScroll(){return this._onScroll.event}get onTitleChange(){return this._onTitleChange.event}get onColor(){return this._onColor.event}dispose(){super.dispose()}_preserveStack(p,S,L,E){this._parseStack.paused=!0,this._parseStack.cursorStartX=p,this._parseStack.cursorStartY=S,this._parseStack.decodedLength=L,this._parseStack.position=E}_logSlowResolvingAsync(p){this._logService.logLevel<=s.LogLevelEnum.WARN&&Promise.race([p,new Promise((S,L)=>setTimeout(()=>L("#SLOW_TIMEOUT"),5e3))]).catch(S=>{if(S!=="#SLOW_TIMEOUT")throw S})}parse(p,S){let L,E=this._activeBuffer.x,A=this._activeBuffer.y,k=0;const O=this._parseStack.paused;if(O){if(L=this._parser.parse(this._parseBuffer,this._parseStack.decodedLength,S))return this._logSlowResolvingAsync(L),L;E=this._parseStack.cursorStartX,A=this._parseStack.cursorStartY,this._parseStack.paused=!1,p.length>g&&(k=this._parseStack.position+g)}if(this._logService.logLevel<=s.LogLevelEnum.DEBUG&&this._logService.debug("parsing data"+(typeof p=="string"?` "${p}"`:` "${Array.prototype.map.call(p,T=>String.fromCharCode(T)).join("")}"`),typeof p=="string"?p.split("").map(T=>T.charCodeAt(0)):p),this._parseBuffer.lengthg)for(let T=k;T0&&B.getWidth(this._activeBuffer.x-1)===2&&B.setCellFromCodePoint(this._activeBuffer.x-1,0,1,x.fg,x.bg,x.extended);for(let P=S;P=T){if(H){for(;this._activeBuffer.x=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!0),B=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y)}else if(this._activeBuffer.x=T-1,A===2)continue}if(W&&(B.insertCells(this._activeBuffer.x,A,this._activeBuffer.getNullCell(x),x),B.getWidth(T-1)===2&&B.setCellFromCodePoint(T-1,e.NULL_CELL_CODE,e.NULL_CELL_WIDTH,x.fg,x.bg,x.extended)),B.setCellFromCodePoint(this._activeBuffer.x++,E,A,x.fg,x.bg,x.extended),A>0)for(;--A;)B.setCellFromCodePoint(this._activeBuffer.x++,0,0,x.fg,x.bg,x.extended)}else B.getWidth(this._activeBuffer.x-1)?B.addCodepointToCell(this._activeBuffer.x-1,E):B.addCodepointToCell(this._activeBuffer.x-2,E)}L-S>0&&(B.loadCell(this._activeBuffer.x-1,this._workCell),this._workCell.getWidth()===2||this._workCell.getCode()>65535?this._parser.precedingCodepoint=0:this._workCell.isCombined()?this._parser.precedingCodepoint=this._workCell.getChars().charCodeAt(0):this._parser.precedingCodepoint=this._workCell.content),this._activeBuffer.x0&&B.getWidth(this._activeBuffer.x)===0&&!B.hasContent(this._activeBuffer.x)&&B.setCellFromCodePoint(this._activeBuffer.x,0,1,x.fg,x.bg,x.extended),this._dirtyRowService.markDirty(this._activeBuffer.y)}registerCsiHandler(p,S){return p.final!=="t"||p.prefix||p.intermediates?this._parser.registerCsiHandler(p,S):this._parser.registerCsiHandler(p,L=>!m(L.params[0],this._optionsService.rawOptions.windowOptions)||S(L))}registerDcsHandler(p,S){return this._parser.registerDcsHandler(p,new v.DcsHandler(S))}registerEscHandler(p,S){return this._parser.registerEscHandler(p,S)}registerOscHandler(p,S){return this._parser.registerOscHandler(p,new f.OscHandler(S))}bell(){return this._onRequestBell.fire(),!0}lineFeed(){return this._dirtyRowService.markDirty(this._activeBuffer.y),this._optionsService.rawOptions.convertEol&&(this._activeBuffer.x=0),this._activeBuffer.y++,this._activeBuffer.y===this._activeBuffer.scrollBottom+1?(this._activeBuffer.y--,this._bufferService.scroll(this._eraseAttrData())):this._activeBuffer.y>=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._activeBuffer.x>=this._bufferService.cols&&this._activeBuffer.x--,this._dirtyRowService.markDirty(this._activeBuffer.y),this._onLineFeed.fire(),!0}carriageReturn(){return this._activeBuffer.x=0,!0}backspace(){var p;if(!this._coreService.decPrivateModes.reverseWraparound)return this._restrictCursor(),this._activeBuffer.x>0&&this._activeBuffer.x--,!0;if(this._restrictCursor(this._bufferService.cols),this._activeBuffer.x>0)this._activeBuffer.x--;else if(this._activeBuffer.x===0&&this._activeBuffer.y>this._activeBuffer.scrollTop&&this._activeBuffer.y<=this._activeBuffer.scrollBottom&&((p=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y))===null||p===void 0?void 0:p.isWrapped)){this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y).isWrapped=!1,this._activeBuffer.y--,this._activeBuffer.x=this._bufferService.cols-1;const S=this._activeBuffer.lines.get(this._activeBuffer.ybase+this._activeBuffer.y);S.hasWidth(this._activeBuffer.x)&&!S.hasContent(this._activeBuffer.x)&&this._activeBuffer.x--}return this._restrictCursor(),!0}tab(){if(this._activeBuffer.x>=this._bufferService.cols)return!0;const p=this._activeBuffer.x;return this._activeBuffer.x=this._activeBuffer.nextStop(),this._optionsService.rawOptions.screenReaderMode&&this._onA11yTab.fire(this._activeBuffer.x-p),!0}shiftOut(){return this._charsetService.setgLevel(1),!0}shiftIn(){return this._charsetService.setgLevel(0),!0}_restrictCursor(p=this._bufferService.cols-1){this._activeBuffer.x=Math.min(p,Math.max(0,this._activeBuffer.x)),this._activeBuffer.y=this._coreService.decPrivateModes.origin?Math.min(this._activeBuffer.scrollBottom,Math.max(this._activeBuffer.scrollTop,this._activeBuffer.y)):Math.min(this._bufferService.rows-1,Math.max(0,this._activeBuffer.y)),this._dirtyRowService.markDirty(this._activeBuffer.y)}_setCursor(p,S){this._dirtyRowService.markDirty(this._activeBuffer.y),this._coreService.decPrivateModes.origin?(this._activeBuffer.x=p,this._activeBuffer.y=this._activeBuffer.scrollTop+S):(this._activeBuffer.x=p,this._activeBuffer.y=S),this._restrictCursor(),this._dirtyRowService.markDirty(this._activeBuffer.y)}_moveCursor(p,S){this._restrictCursor(),this._setCursor(this._activeBuffer.x+p,this._activeBuffer.y+S)}cursorUp(p){const S=this._activeBuffer.y-this._activeBuffer.scrollTop;return S>=0?this._moveCursor(0,-Math.min(S,p.params[0]||1)):this._moveCursor(0,-(p.params[0]||1)),!0}cursorDown(p){const S=this._activeBuffer.scrollBottom-this._activeBuffer.y;return S>=0?this._moveCursor(0,Math.min(S,p.params[0]||1)):this._moveCursor(0,p.params[0]||1),!0}cursorForward(p){return this._moveCursor(p.params[0]||1,0),!0}cursorBackward(p){return this._moveCursor(-(p.params[0]||1),0),!0}cursorNextLine(p){return this.cursorDown(p),this._activeBuffer.x=0,!0}cursorPrecedingLine(p){return this.cursorUp(p),this._activeBuffer.x=0,!0}cursorCharAbsolute(p){return this._setCursor((p.params[0]||1)-1,this._activeBuffer.y),!0}cursorPosition(p){return this._setCursor(p.length>=2?(p.params[1]||1)-1:0,(p.params[0]||1)-1),!0}charPosAbsolute(p){return this._setCursor((p.params[0]||1)-1,this._activeBuffer.y),!0}hPositionRelative(p){return this._moveCursor(p.params[0]||1,0),!0}linePosAbsolute(p){return this._setCursor(this._activeBuffer.x,(p.params[0]||1)-1),!0}vPositionRelative(p){return this._moveCursor(0,p.params[0]||1),!0}hVPosition(p){return this.cursorPosition(p),!0}tabClear(p){const S=p.params[0];return S===0?delete this._activeBuffer.tabs[this._activeBuffer.x]:S===3&&(this._activeBuffer.tabs={}),!0}cursorForwardTab(p){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=p.params[0]||1;for(;S--;)this._activeBuffer.x=this._activeBuffer.nextStop();return!0}cursorBackwardTab(p){if(this._activeBuffer.x>=this._bufferService.cols)return!0;let S=p.params[0]||1;for(;S--;)this._activeBuffer.x=this._activeBuffer.prevStop();return!0}selectProtected(p){const S=p.params[0];return S===1&&(this._curAttrData.bg|=536870912),S!==2&&S!==0||(this._curAttrData.bg&=-536870913),!0}_eraseInBufferLine(p,S,L,E=!1,A=!1){const k=this._activeBuffer.lines.get(this._activeBuffer.ybase+p);k.replaceCells(S,L,this._activeBuffer.getNullCell(this._eraseAttrData()),this._eraseAttrData(),A),E&&(k.isWrapped=!1)}_resetBufferLine(p,S=!1){const L=this._activeBuffer.lines.get(this._activeBuffer.ybase+p);L.fill(this._activeBuffer.getNullCell(this._eraseAttrData()),S),this._bufferService.buffer.clearMarkers(this._activeBuffer.ybase+p),L.isWrapped=!1}eraseInDisplay(p,S=!1){let L;switch(this._restrictCursor(this._bufferService.cols),p.params[0]){case 0:for(L=this._activeBuffer.y,this._dirtyRowService.markDirty(L),this._eraseInBufferLine(L++,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,S);L=this._bufferService.cols&&(this._activeBuffer.lines.get(L+1).isWrapped=!1);L--;)this._resetBufferLine(L,S);this._dirtyRowService.markDirty(0);break;case 2:for(L=this._bufferService.rows,this._dirtyRowService.markDirty(L-1);L--;)this._resetBufferLine(L,S);this._dirtyRowService.markDirty(0);break;case 3:const E=this._activeBuffer.lines.length-this._bufferService.rows;E>0&&(this._activeBuffer.lines.trimStart(E),this._activeBuffer.ybase=Math.max(this._activeBuffer.ybase-E,0),this._activeBuffer.ydisp=Math.max(this._activeBuffer.ydisp-E,0),this._onScroll.fire(0))}return!0}eraseInLine(p,S=!1){switch(this._restrictCursor(this._bufferService.cols),p.params[0]){case 0:this._eraseInBufferLine(this._activeBuffer.y,this._activeBuffer.x,this._bufferService.cols,this._activeBuffer.x===0,S);break;case 1:this._eraseInBufferLine(this._activeBuffer.y,0,this._activeBuffer.x+1,!1,S);break;case 2:this._eraseInBufferLine(this._activeBuffer.y,0,this._bufferService.cols,!0,S)}return this._dirtyRowService.markDirty(this._activeBuffer.y),!0}insertLines(p){this._restrictCursor();let S=p.params[0]||1;if(this._activeBuffer.y>this._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.ythis._activeBuffer.scrollBottom||this._activeBuffer.y0||(this._is("xterm")||this._is("rxvt-unicode")||this._is("screen")?this._coreService.triggerDataEvent(o.C0.ESC+"[?1;2c"):this._is("linux")&&this._coreService.triggerDataEvent(o.C0.ESC+"[?6c")),!0}sendDeviceAttributesSecondary(p){return p.params[0]>0||(this._is("xterm")?this._coreService.triggerDataEvent(o.C0.ESC+"[>0;276;0c"):this._is("rxvt-unicode")?this._coreService.triggerDataEvent(o.C0.ESC+"[>85;95;0c"):this._is("linux")?this._coreService.triggerDataEvent(p.params[0]+"c"):this._is("screen")&&this._coreService.triggerDataEvent(o.C0.ESC+"[>83;40003;0c")),!0}_is(p){return(this._optionsService.rawOptions.termName+"").indexOf(p)===0}setMode(p){for(let S=0;SF?1:2,P=p.params[0];return R=P,M=S?P===2?3:P===4?B(k.modes.insertMode):P===12?4:P===20?B(x.convertEol):0:P===1?B(L.applicationCursorKeys):P===3?x.windowOptions.setWinLines?T===80?2:T===132?1:0:0:P===6?B(L.origin):P===7?B(L.wraparound):P===8?3:P===9?B(E==="X10"):P===12?B(x.cursorBlink):P===25?B(!k.isCursorHidden):P===45?B(L.reverseWraparound):P===66?B(L.applicationKeypad):P===1e3?B(E==="VT200"):P===1002?B(E==="DRAG"):P===1003?B(E==="ANY"):P===1004?B(L.sendFocus):P===1005?4:P===1006?B(A==="SGR"):P===1015?4:P===1016?B(A==="SGR_PIXELS"):P===1048?1:P===47||P===1047||P===1049?B(H===W):P===2004?B(L.bracketedPasteMode):0,k.triggerDataEvent(`${o.C0.ESC}[${S?"":"?"}${R};${M}$y`),!0;var R,M}_updateAttrColor(p,S,L,E,A){return S===2?(p|=50331648,p&=-16777216,p|=t.AttributeData.fromColorRGB([L,E,A])):S===5&&(p&=-50331904,p|=33554432|255&L),p}_extractColor(p,S,L){const E=[0,0,-1,0,0,0];let A=0,k=0;do{if(E[k+A]=p.params[S+k],p.hasSubParams(S+k)){const O=p.getSubParams(S+k);let T=0;do E[1]===5&&(A=1),E[k+T+1+A]=O[T];while(++T=2||E[1]===2&&k+A>=5)break;E[1]&&(A=1)}while(++k+S5)&&(p=1),S.extended.underlineStyle=p,S.fg|=268435456,p===0&&(S.fg&=-268435457),S.updateExtended()}charAttributes(p){if(p.length===1&&p.params[0]===0)return this._curAttrData.fg=a.DEFAULT_ATTR_DATA.fg,this._curAttrData.bg=a.DEFAULT_ATTR_DATA.bg,!0;const S=p.length;let L;const E=this._curAttrData;for(let A=0;A=30&&L<=37?(E.fg&=-50331904,E.fg|=16777216|L-30):L>=40&&L<=47?(E.bg&=-50331904,E.bg|=16777216|L-40):L>=90&&L<=97?(E.fg&=-50331904,E.fg|=16777224|L-90):L>=100&&L<=107?(E.bg&=-50331904,E.bg|=16777224|L-100):L===0?(E.fg=a.DEFAULT_ATTR_DATA.fg,E.bg=a.DEFAULT_ATTR_DATA.bg):L===1?E.fg|=134217728:L===3?E.bg|=67108864:L===4?(E.fg|=268435456,this._processUnderline(p.hasSubParams(A)?p.getSubParams(A)[0]:1,E)):L===5?E.fg|=536870912:L===7?E.fg|=67108864:L===8?E.fg|=1073741824:L===9?E.fg|=2147483648:L===2?E.bg|=134217728:L===21?this._processUnderline(2,E):L===22?(E.fg&=-134217729,E.bg&=-134217729):L===23?E.bg&=-67108865:L===24?(E.fg&=-268435457,this._processUnderline(0,E)):L===25?E.fg&=-536870913:L===27?E.fg&=-67108865:L===28?E.fg&=-1073741825:L===29?E.fg&=2147483647:L===39?(E.fg&=-67108864,E.fg|=16777215&a.DEFAULT_ATTR_DATA.fg):L===49?(E.bg&=-67108864,E.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):L===38||L===48||L===58?A+=this._extractColor(p,A,E):L===59?(E.extended=E.extended.clone(),E.extended.underlineColor=-1,E.updateExtended()):L===100?(E.fg&=-67108864,E.fg|=16777215&a.DEFAULT_ATTR_DATA.fg,E.bg&=-67108864,E.bg|=16777215&a.DEFAULT_ATTR_DATA.bg):this._logService.debug("Unknown SGR attribute: %d.",L);return!0}deviceStatus(p){switch(p.params[0]){case 5:this._coreService.triggerDataEvent(`${o.C0.ESC}[0n`);break;case 6:const S=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[${S};${L}R`)}return!0}deviceStatusPrivate(p){if(p.params[0]===6){const S=this._activeBuffer.y+1,L=this._activeBuffer.x+1;this._coreService.triggerDataEvent(`${o.C0.ESC}[?${S};${L}R`)}return!0}softReset(p){return this._coreService.isCursorHidden=!1,this._onRequestSyncScrollBar.fire(),this._activeBuffer.scrollTop=0,this._activeBuffer.scrollBottom=this._bufferService.rows-1,this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._coreService.reset(),this._charsetService.reset(),this._activeBuffer.savedX=0,this._activeBuffer.savedY=this._activeBuffer.ybase,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,this._coreService.decPrivateModes.origin=!1,!0}setCursorStyle(p){const S=p.params[0]||1;switch(S){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"}const L=S%2==1;return this._optionsService.options.cursorBlink=L,!0}setScrollRegion(p){const S=p.params[0]||1;let L;return(p.length<2||(L=p.params[1])>this._bufferService.rows||L===0)&&(L=this._bufferService.rows),L>S&&(this._activeBuffer.scrollTop=S-1,this._activeBuffer.scrollBottom=L-1,this._setCursor(0,0)),!0}windowOptions(p){if(!m(p.params[0],this._optionsService.rawOptions.windowOptions))return!0;const S=p.length>1?p.params[1]:0;switch(p.params[0]){case 14:S!==2&&this._onRequestWindowsOptionsReport.fire(b.GET_WIN_SIZE_PIXELS);break;case 16:this._onRequestWindowsOptionsReport.fire(b.GET_CELL_SIZE_PIXELS);break;case 18:this._bufferService&&this._coreService.triggerDataEvent(`${o.C0.ESC}[8;${this._bufferService.rows};${this._bufferService.cols}t`);break;case 22:S!==0&&S!==2||(this._windowTitleStack.push(this._windowTitle),this._windowTitleStack.length>10&&this._windowTitleStack.shift()),S!==0&&S!==1||(this._iconNameStack.push(this._iconName),this._iconNameStack.length>10&&this._iconNameStack.shift());break;case 23:S!==0&&S!==2||this._windowTitleStack.length&&this.setTitle(this._windowTitleStack.pop()),S!==0&&S!==1||this._iconNameStack.length&&this.setIconName(this._iconNameStack.pop())}return!0}saveCursor(p){return this._activeBuffer.savedX=this._activeBuffer.x,this._activeBuffer.savedY=this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.savedCurAttrData.fg=this._curAttrData.fg,this._activeBuffer.savedCurAttrData.bg=this._curAttrData.bg,this._activeBuffer.savedCharset=this._charsetService.charset,!0}restoreCursor(p){return this._activeBuffer.x=this._activeBuffer.savedX||0,this._activeBuffer.y=Math.max(this._activeBuffer.savedY-this._activeBuffer.ybase,0),this._curAttrData.fg=this._activeBuffer.savedCurAttrData.fg,this._curAttrData.bg=this._activeBuffer.savedCurAttrData.bg,this._charsetService.charset=this._savedCharset,this._activeBuffer.savedCharset&&(this._charsetService.charset=this._activeBuffer.savedCharset),this._restrictCursor(),!0}setTitle(p){return this._windowTitle=p,this._onTitleChange.fire(p),!0}setIconName(p){return this._iconName=p,!0}setOrReportIndexedColor(p){const S=[],L=p.split(";");for(;L.length>1;){const E=L.shift(),A=L.shift();if(/^\d+$/.exec(E)){const k=parseInt(E);if(0<=k&&k<256)if(A==="?")S.push({type:0,index:k});else{const O=(0,u.parseColor)(A);O&&S.push({type:1,index:k,color:O})}}}return S.length&&this._onColor.fire(S),!0}setHyperlink(p){const S=p.split(";");return!(S.length<2)&&(S[1]?this._createHyperlink(S[0],S[1]):!S[0]&&this._finishHyperlink())}_createHyperlink(p,S){this._currentLinkId!==void 0&&this._finishHyperlink();const L=p.split(":");let E;const A=L.findIndex(k=>k.startsWith("id="));return A!==-1&&(E=L[A].slice(3)||void 0),this._curAttrData.extended=this._curAttrData.extended.clone(),this._currentLinkId=this._oscLinkService.registerLink({id:E,uri:S}),this._curAttrData.extended.urlId=this._currentLinkId,this._curAttrData.updateExtended(),!0}_finishHyperlink(){return this._curAttrData.extended=this._curAttrData.extended.clone(),this._curAttrData.extended.urlId=0,this._curAttrData.updateExtended(),this._currentLinkId=void 0,!0}_setOrReportSpecialColor(p,S){const L=p.split(";");for(let E=0;E=this._specialColors.length);++E,++S)if(L[E]==="?")this._onColor.fire([{type:0,index:this._specialColors[S]}]);else{const A=(0,u.parseColor)(L[E]);A&&this._onColor.fire([{type:1,index:this._specialColors[S],color:A}])}return!0}setOrReportFgColor(p){return this._setOrReportSpecialColor(p,0)}setOrReportBgColor(p){return this._setOrReportSpecialColor(p,1)}setOrReportCursorColor(p){return this._setOrReportSpecialColor(p,2)}restoreIndexedColor(p){if(!p)return this._onColor.fire([{type:2}]),!0;const S=[],L=p.split(";");for(let E=0;E=this._bufferService.rows&&(this._activeBuffer.y=this._bufferService.rows-1),this._restrictCursor(),!0}tabSet(){return this._activeBuffer.tabs[this._activeBuffer.x]=!0,!0}reverseIndex(){if(this._restrictCursor(),this._activeBuffer.y===this._activeBuffer.scrollTop){const p=this._activeBuffer.scrollBottom-this._activeBuffer.scrollTop;this._activeBuffer.lines.shiftElements(this._activeBuffer.ybase+this._activeBuffer.y,p,1),this._activeBuffer.lines.set(this._activeBuffer.ybase+this._activeBuffer.y,this._activeBuffer.getBlankLine(this._eraseAttrData())),this._dirtyRowService.markRangeDirty(this._activeBuffer.scrollTop,this._activeBuffer.scrollBottom)}else this._activeBuffer.y--,this._restrictCursor();return!0}fullReset(){return this._parser.reset(),this._onRequestReset.fire(),!0}reset(){this._curAttrData=a.DEFAULT_ATTR_DATA.clone(),this._eraseAttrDataInternal=a.DEFAULT_ATTR_DATA.clone()}_eraseAttrData(){return this._eraseAttrDataInternal.bg&=-67108864,this._eraseAttrDataInternal.bg|=67108863&this._curAttrData.bg,this._eraseAttrDataInternal}setgLevel(p){return this._charsetService.setgLevel(p),!0}screenAlignmentPattern(){const p=new n.CellData;p.content=4194304|"E".charCodeAt(0),p.fg=this._curAttrData.fg,p.bg=this._curAttrData.bg,this._setCursor(0,0);for(let S=0;S(this._coreService.triggerDataEvent(`${o.C0.ESC}${A}${o.C0.ESC}\\`),!0))(p==='"q'?`P1$r${this._curAttrData.isProtected()?1:0}"q`:p==='"p'?'P1$r61;1"p':p==="r"?`P1$r${L.scrollTop+1};${L.scrollBottom+1}r`:p==="m"?"P1$r0m":p===" q"?`P1$r${{block:2,underline:4,bar:6}[E.cursorStyle]-(E.cursorBlink?1:0)} q`:"P0$r")}}r.InputHandler=y},844:(D,r)=>{function h(o){for(const d of o)d.dispose();o.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const o of this._disposables)o.dispose();this._disposables.length=0}register(o){return this._disposables.push(o),o}unregister(o){const d=this._disposables.indexOf(o);d!==-1&&this._disposables.splice(d,1)}},r.toDisposable=function(o){return{dispose:o}},r.disposeArray=h,r.getDisposeArrayDisposable=function(o){return{dispose:()=>h(o)}}},1505:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(d,c,_){this._data[d]||(this._data[d]={}),this._data[d][c]=_}get(d,c){return this._data[d]?this._data[d][c]:void 0}clear(){this._data={}}}r.TwoKeyMap=h,r.FourKeyMap=class{constructor(){this._data=new h}set(o,d,c,_,l){this._data.get(o,d)||this._data.set(o,d,new h),this._data.get(o,d).set(c,_,l)}get(o,d,c,_){var l;return(l=this._data.get(o,d))===null||l===void 0?void 0:l.get(c,_)}clear(){this._data.clear()}}},6114:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.isSafari=r.isLegacyEdge=r.isFirefox=void 0;const h=typeof navigator=="undefined",o=h?"node":navigator.userAgent,d=h?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),r.isIpad=d==="iPad",r.isIphone=d==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),r.isLinux=d.indexOf("Linux")>=0},6106:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SortedList=void 0;let h=0;r.SortedList=class{constructor(o){this._getKey=o,this._array=[]}clear(){this._array.length=0}insert(o){this._array.length!==0?(h=this._search(this._getKey(o),0,this._array.length-1),this._array.splice(h,0,o)):this._array.push(o)}delete(o){if(this._array.length===0)return!1;const d=this._getKey(o);if(d===void 0||(h=this._search(d,0,this._array.length-1),h===-1)||this._getKey(this._array[h])!==d)return!1;do if(this._array[h]===o)return this._array.splice(h,1),!0;while(++h=this._array.length)&&this._getKey(this._array[h])===o))do yield this._array[h];while(++h=this._array.length)&&this._getKey(this._array[h])===o))do d(this._array[h]);while(++ho)return this._search(o,d,_-1);if(l0&&this._getKey(this._array[_-1])===o;)_--;return _}}},8273:(D,r)=>{function h(o,d,c=0,_=o.length){if(c>=o.length)return o;c=(o.length+c)%o.length,_=_>=o.length?o.length:(o.length+_)%o.length;for(let l=c;l<_;++l)o[l]=d;return o}Object.defineProperty(r,"__esModule",{value:!0}),r.concat=r.fillFallback=r.fill=void 0,r.fill=function(o,d,c,_){return o.fill?o.fill(d,c,_):h(o,d,c,_)},r.fillFallback=h,r.concat=function(o,d){const c=new o.constructor(o.length+d.length);return c.set(o),c.set(d,o.length),c}},9282:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.updateWindowsModeWrappedState=void 0;const o=h(643);r.updateWindowsModeWrappedState=function(d){const c=d.buffer.lines.get(d.buffer.ybase+d.buffer.y-1),_=c==null?void 0:c.get(d.cols-1),l=d.buffer.lines.get(d.buffer.ybase+d.buffer.y);l&&_&&(l.isWrapped=_[o.CHAR_DATA_CODE_INDEX]!==o.NULL_CELL_CODE&&_[o.CHAR_DATA_CODE_INDEX]!==o.WHITESPACE_CELL_CODE)}},3734:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new o}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new h;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){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()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=h;class o{constructor(c=0,_=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=_}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}clone(){return new o(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=o},9092:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferStringIterator=r.Buffer=r.MAX_BUFFER_SIZE=void 0;const o=h(6349),d=h(8437),c=h(511),_=h(643),l=h(4634),a=h(4863),i=h(7116),e=h(3734);r.MAX_BUFFER_SIZE=4294967295,r.Buffer=class{constructor(t,s,f){this._hasScrollback=t,this._optionsService=s,this._bufferService=f,this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.savedY=0,this.savedX=0,this.savedCurAttrData=d.DEFAULT_ATTR_DATA.clone(),this.savedCharset=i.DEFAULT_CHARSET,this.markers=[],this._nullCell=c.CellData.fromCharData([0,_.NULL_CELL_CHAR,_.NULL_CELL_WIDTH,_.NULL_CELL_CODE]),this._whitespaceCell=c.CellData.fromCharData([0,_.WHITESPACE_CELL_CHAR,_.WHITESPACE_CELL_WIDTH,_.WHITESPACE_CELL_CODE]),this._isClearing=!1,this._cols=this._bufferService.cols,this._rows=this._bufferService.rows,this.lines=new o.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}getNullCell(t){return t?(this._nullCell.fg=t.fg,this._nullCell.bg=t.bg,this._nullCell.extended=t.extended):(this._nullCell.fg=0,this._nullCell.bg=0,this._nullCell.extended=new e.ExtendedAttrs),this._nullCell}getWhitespaceCell(t){return t?(this._whitespaceCell.fg=t.fg,this._whitespaceCell.bg=t.bg,this._whitespaceCell.extended=t.extended):(this._whitespaceCell.fg=0,this._whitespaceCell.bg=0,this._whitespaceCell.extended=new e.ExtendedAttrs),this._whitespaceCell}getBlankLine(t,s){return new d.BufferLine(this._bufferService.cols,this.getNullCell(t),s)}get hasScrollback(){return this._hasScrollback&&this.lines.maxLength>this._rows}get isCursorInViewport(){const t=this.ybase+this.y-this.ydisp;return t>=0&&tr.MAX_BUFFER_SIZE?r.MAX_BUFFER_SIZE:s}fillViewportRows(t){if(this.lines.length===0){t===void 0&&(t=d.DEFAULT_ATTR_DATA);let s=this._rows;for(;s--;)this.lines.push(this.getBlankLine(t))}}clear(){this.ydisp=0,this.ybase=0,this.y=0,this.x=0,this.lines=new o.CircularList(this._getCorrectBufferLength(this._rows)),this.scrollTop=0,this.scrollBottom=this._rows-1,this.setupTabStops()}resize(t,s){const f=this.getNullCell(d.DEFAULT_ATTR_DATA),v=this._getCorrectBufferLength(s);if(v>this.lines.maxLength&&(this.lines.maxLength=v),this.lines.length>0){if(this._cols0&&this.lines.length<=this.ybase+this.y+u+1?(this.ybase--,u++,this.ydisp>0&&this.ydisp--):this.lines.push(new d.BufferLine(t,f)));else for(let C=this._rows;C>s;C--)this.lines.length>s+this.ybase&&(this.lines.length>this.ybase+this.y+1?this.lines.pop():(this.ybase++,this.ydisp++));if(v0&&(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=v}this.x=Math.min(this.x,t-1),this.y=Math.min(this.y,s-1),u&&(this.y+=u),this.savedX=Math.min(this.savedX,t-1),this.scrollTop=0}if(this.scrollBottom=s-1,this._isReflowEnabled&&(this._reflow(t,s),this._cols>t))for(let u=0;uthis._cols?this._reflowLarger(t,s):this._reflowSmaller(t,s))}_reflowLarger(t,s){const f=(0,l.reflowLargerGetLinesToRemove)(this.lines,this._cols,t,this.ybase+this.y,this.getNullCell(d.DEFAULT_ATTR_DATA));if(f.length>0){const v=(0,l.reflowLargerCreateNewLayout)(this.lines,f);(0,l.reflowLargerApplyNewLayout)(this.lines,v.layout),this._reflowLargerAdjustViewport(t,s,v.countRemoved)}}_reflowLargerAdjustViewport(t,s,f){const v=this.getNullCell(d.DEFAULT_ATTR_DATA);let u=f;for(;u-- >0;)this.ybase===0?(this.y>0&&this.y--,this.lines.length=0;C--){let g=this.lines.get(C);if(!g||!g.isWrapped&&g.getTrimmedLength()<=t)continue;const m=[g];for(;g.isWrapped&&C>0;)g=this.lines.get(--C),m.unshift(g);const b=this.ybase+this.y;if(b>=C&&b0&&(v.push({start:C+m.length+u,newLines:L}),u+=L.length),m.push(...L);let E=w.length-1,A=w[E];A===0&&(E--,A=w[E]);let k=m.length-p-1,O=y;for(;k>=0;){const H=Math.min(O,A);if(m[E]===void 0)break;if(m[E].copyCellsFrom(m[k],O-H,A-H,H,!0),A-=H,A===0&&(E--,A=w[E]),O-=H,O===0){k--;const W=Math.max(k,0);O=(0,l.getWrappedLineTrimmedLength)(m,W,this._cols)}}for(let H=0;H0;)this.ybase===0?this.y0){const C=[],g=[];for(let E=0;E=0;E--)if(w&&w.start>b+p){for(let A=w.newLines.length-1;A>=0;A--)this.lines.set(E--,w.newLines[A]);E++,C.push({index:b+1,amount:w.newLines.length}),p+=w.newLines.length,w=v[++y]}else this.lines.set(E,g[b--]);let S=0;for(let E=C.length-1;E>=0;E--)C[E].index+=S,this.lines.onInsertEmitter.fire(C[E]),S+=C[E].amount;const L=Math.max(0,m+u-this.lines.maxLength);L>0&&this.lines.onTrimEmitter.fire(L)}}stringIndexToBufferIndex(t,s,f=!1){for(;s;){const v=this.lines.get(t);if(!v)return[-1,-1];const u=f?v.getTrimmedLength():v.length;for(let C=0;C0&&this.lines.get(s).isWrapped;)s--;for(;f+10;);return t>=this._cols?this._cols-1:t<0?0:t}nextStop(t){for(t==null&&(t=this.x);!this.tabs[++t]&&t=this._cols?this._cols-1:t<0?0:t}clearMarkers(t){this._isClearing=!0;for(let s=0;s{s.line-=f,s.line<0&&s.dispose()})),s.register(this.lines.onInsert(f=>{s.line>=f.index&&(s.line+=f.amount)})),s.register(this.lines.onDelete(f=>{s.line>=f.index&&s.linef.index&&(s.line-=f.amount)})),s.register(s.onDispose(()=>this._removeMarker(s))),s}_removeMarker(t){this._isClearing||this.markers.splice(this.markers.indexOf(t),1)}iterator(t,s,f,v,u){return new n(this,t,s,f,v,u)}};class n{constructor(s,f,v=0,u=s.lines.length,C=0,g=0){this._buffer=s,this._trimRight=f,this._startIndex=v,this._endIndex=u,this._startOverscan=C,this._endOverscan=g,this._startIndex<0&&(this._startIndex=0),this._endIndex>this._buffer.lines.length&&(this._endIndex=this._buffer.lines.length),this._current=this._startIndex}hasNext(){return this._currentthis._endIndex+this._endOverscan&&(s.last=this._endIndex+this._endOverscan),s.first=Math.max(s.first,0),s.last=Math.min(s.last,this._buffer.lines.length);let f="";for(let v=s.first;v<=s.last;++v)f+=this._buffer.translateBufferLineToString(v,this._trimRight);return this._current=s.last+1,{range:s,content:f}}}r.BufferStringIterator=n},8437:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLine=r.DEFAULT_ATTR_DATA=void 0;const o=h(482),d=h(643),c=h(511),_=h(3734);r.DEFAULT_ATTR_DATA=Object.freeze(new _.AttributeData);const l={startIndex:0};class a{constructor(e,n,t=!1){this.isWrapped=t,this._combined={},this._extendedAttrs={},this._data=new Uint32Array(3*e);const s=n||c.CellData.fromCharData([0,d.NULL_CELL_CHAR,d.NULL_CELL_WIDTH,d.NULL_CELL_CODE]);for(let f=0;f>22,2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):t]}set(e,n){this._data[3*e+1]=n[d.CHAR_DATA_ATTR_INDEX],n[d.CHAR_DATA_CHAR_INDEX].length>1?(this._combined[e]=n[1],this._data[3*e+0]=2097152|e|n[d.CHAR_DATA_WIDTH_INDEX]<<22):this._data[3*e+0]=n[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|n[d.CHAR_DATA_WIDTH_INDEX]<<22}getWidth(e){return this._data[3*e+0]>>22}hasWidth(e){return 12582912&this._data[3*e+0]}getFg(e){return this._data[3*e+1]}getBg(e){return this._data[3*e+2]}hasContent(e){return 4194303&this._data[3*e+0]}getCodePoint(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e].charCodeAt(this._combined[e].length-1):2097151&n}isCombined(e){return 2097152&this._data[3*e+0]}getString(e){const n=this._data[3*e+0];return 2097152&n?this._combined[e]:2097151&n?(0,o.stringFromCodePoint)(2097151&n):""}isProtected(e){return 536870912&this._data[3*e+2]}loadCell(e,n){return l.startIndex=3*e,n.content=this._data[l.startIndex+0],n.fg=this._data[l.startIndex+1],n.bg=this._data[l.startIndex+2],2097152&n.content&&(n.combinedData=this._combined[e]),268435456&n.bg&&(n.extended=this._extendedAttrs[e]),n}setCell(e,n){2097152&n.content&&(this._combined[e]=n.combinedData),268435456&n.bg&&(this._extendedAttrs[e]=n.extended),this._data[3*e+0]=n.content,this._data[3*e+1]=n.fg,this._data[3*e+2]=n.bg}setCellFromCodePoint(e,n,t,s,f,v){268435456&f&&(this._extendedAttrs[e]=v),this._data[3*e+0]=n|t<<22,this._data[3*e+1]=s,this._data[3*e+2]=f}addCodepointToCell(e,n){let t=this._data[3*e+0];2097152&t?this._combined[e]+=(0,o.stringFromCodePoint)(n):(2097151&t?(this._combined[e]=(0,o.stringFromCodePoint)(2097151&t)+(0,o.stringFromCodePoint)(n),t&=-2097152,t|=2097152):t=n|4194304,this._data[3*e+0]=t)}insertCells(e,n,t,s){if((e%=this.length)&&this.getWidth(e-1)===2&&this.setCellFromCodePoint(e-1,0,1,(s==null?void 0:s.fg)||0,(s==null?void 0:s.bg)||0,(s==null?void 0:s.extended)||new _.ExtendedAttrs),n=0;--v)this.setCell(e+n+v,this.loadCell(e+v,f));for(let v=0;vthis.length){const t=new Uint32Array(3*e);this.length&&(3*e=e&&delete this._combined[v]}}else this._data=new Uint32Array(0),this._combined={};this.length=e}}fill(e,n=!1){if(n)for(let t=0;t=0;--e)if(4194303&this._data[3*e+0])return e+(this._data[3*e+0]>>22);return 0}copyCellsFrom(e,n,t,s,f){const v=e._data;if(f)for(let C=s-1;C>=0;C--){for(let g=0;g<3;g++)this._data[3*(t+C)+g]=v[3*(n+C)+g];268435456&v[3*(n+C)+2]&&(this._extendedAttrs[t+C]=e._extendedAttrs[n+C])}else for(let C=0;C=n&&(this._combined[g-n+t]=e._combined[g])}}translateToString(e=!1,n=0,t=this.length){e&&(t=Math.min(t,this.getTrimmedLength()));let s="";for(;n>22||1}return s}}r.BufferLine=a},4841:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.getRangeLength=void 0,r.getRangeLength=function(h,o){if(h.start.y>h.end.y)throw new Error(`Buffer range end (${h.end.x}, ${h.end.y}) cannot be before start (${h.start.x}, ${h.start.y})`);return o*(h.end.y-h.start.y)+(h.end.x-h.start.x+1)}},4634:(D,r)=>{function h(o,d,c){if(d===o.length-1)return o[d].getTrimmedLength();const _=!o[d].hasContent(c-1)&&o[d].getWidth(c-1)===1,l=o[d+1].getWidth(0)===2;return _&&l?c-1:c}Object.defineProperty(r,"__esModule",{value:!0}),r.getWrappedLineTrimmedLength=r.reflowSmallerGetNewLineLengths=r.reflowLargerApplyNewLayout=r.reflowLargerCreateNewLayout=r.reflowLargerGetLinesToRemove=void 0,r.reflowLargerGetLinesToRemove=function(o,d,c,_,l){const a=[];for(let i=0;i=i&&_0&&(g>s||t[g].getTrimmedLength()===0);g--)C++;C>0&&(a.push(i+t.length-C),a.push(C)),i+=t.length-1}return a},r.reflowLargerCreateNewLayout=function(o,d){const c=[];let _=0,l=d[_],a=0;for(let i=0;ih(o,t,d)).reduce((n,t)=>n+t);let a=0,i=0,e=0;for(;en&&(a-=n,i++);const t=o[i].getWidth(a-1)===2;t&&a--;const s=t?c-1:c;_.push(s),e+=s}return _},r.getWrappedLineTrimmedLength=h},5295:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferSet=void 0;const o=h(9092),d=h(8460),c=h(844);class _ extends c.Disposable{constructor(a,i){super(),this._optionsService=a,this._bufferService=i,this._onBufferActivate=this.register(new d.EventEmitter),this.reset()}get onBufferActivate(){return this._onBufferActivate.event}reset(){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._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}),this.setupTabStops()}get alt(){return this._alt}get active(){return this._activeBuffer}get normal(){return this._normal}activateNormalBuffer(){this._activeBuffer!==this._normal&&(this._normal.x=this._alt.x,this._normal.y=this._alt.y,this._alt.clearAllMarkers(),this._alt.clear(),this._activeBuffer=this._normal,this._onBufferActivate.fire({activeBuffer:this._normal,inactiveBuffer:this._alt}))}activateAltBuffer(a){this._activeBuffer!==this._alt&&(this._alt.fillViewportRows(a),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}))}resize(a,i){this._normal.resize(a,i),this._alt.resize(a,i)}setupTabStops(a){this._normal.setupTabStops(a),this._alt.setupTabStops(a)}}r.BufferSet=_},511:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const o=h(482),d=h(643),c=h(3734);class _ extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(a){const i=new _;return i.setFromCharData(a),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,o.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(a){this.fg=a[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let i=!1;if(a[d.CHAR_DATA_CHAR_INDEX].length>2)i=!0;else if(a[d.CHAR_DATA_CHAR_INDEX].length===2){const e=a[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=a[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|a[d.CHAR_DATA_WIDTH_INDEX]<<22:i=!0}else i=!0}else this.content=a[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|a[d.CHAR_DATA_WIDTH_INDEX]<<22;i&&(this.combinedData=a[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|a[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},643:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=256,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},4863:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Marker=void 0;const o=h(8460),d=h(844);class c extends d.Disposable{constructor(l){super(),this.line=l,this._id=c._nextId++,this.isDisposed=!1,this._onDispose=new o.EventEmitter}get id(){return this._id}get onDispose(){return this._onDispose.event}dispose(){this.isDisposed||(this.isDisposed=!0,this.line=-1,this._onDispose.fire(),super.dispose())}}r.Marker=c,c._nextId=1},7116:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_CHARSET=r.CHARSETS=void 0,r.CHARSETS={},r.DEFAULT_CHARSET=r.CHARSETS.B,r.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"},r.CHARSETS.A={"#":"\xA3"},r.CHARSETS.B=void 0,r.CHARSETS[4]={"#":"\xA3","@":"\xBE","[":"ij","\\":"\xBD","]":"|","{":"\xA8","|":"f","}":"\xBC","~":"\xB4"},r.CHARSETS.C=r.CHARSETS[5]={"[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS.R={"#":"\xA3","@":"\xE0","[":"\xB0","\\":"\xE7","]":"\xA7","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xA8"},r.CHARSETS.Q={"@":"\xE0","[":"\xE2","\\":"\xE7","]":"\xEA","^":"\xEE","`":"\xF4","{":"\xE9","|":"\xF9","}":"\xE8","~":"\xFB"},r.CHARSETS.K={"@":"\xA7","[":"\xC4","\\":"\xD6","]":"\xDC","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xDF"},r.CHARSETS.Y={"#":"\xA3","@":"\xA7","[":"\xB0","\\":"\xE7","]":"\xE9","`":"\xF9","{":"\xE0","|":"\xF2","}":"\xE8","~":"\xEC"},r.CHARSETS.E=r.CHARSETS[6]={"@":"\xC4","[":"\xC6","\\":"\xD8","]":"\xC5","^":"\xDC","`":"\xE4","{":"\xE6","|":"\xF8","}":"\xE5","~":"\xFC"},r.CHARSETS.Z={"#":"\xA3","@":"\xA7","[":"\xA1","\\":"\xD1","]":"\xBF","{":"\xB0","|":"\xF1","}":"\xE7"},r.CHARSETS.H=r.CHARSETS[7]={"@":"\xC9","[":"\xC4","\\":"\xD6","]":"\xC5","^":"\xDC","`":"\xE9","{":"\xE4","|":"\xF6","}":"\xE5","~":"\xFC"},r.CHARSETS["="]={"#":"\xF9","@":"\xE0","[":"\xE9","\\":"\xE7","]":"\xEA","^":"\xEE",_:"\xE8","`":"\xF4","{":"\xE4","|":"\xF6","}":"\xFC","~":"\xFB"}},2584:(D,r)=>{var h,o;Object.defineProperty(r,"__esModule",{value:!0}),r.C1_ESCAPED=r.C1=r.C0=void 0,function(d){d.NUL="\0",d.SOH="",d.STX="",d.ETX="",d.EOT="",d.ENQ="",d.ACK="",d.BEL="\x07",d.BS="\b",d.HT=" ",d.LF=` +`,d.VT="\v",d.FF="\f",d.CR="\r",d.SO="",d.SI="",d.DLE="",d.DC1="",d.DC2="",d.DC3="",d.DC4="",d.NAK="",d.SYN="",d.ETB="",d.CAN="",d.EM="",d.SUB="",d.ESC="\x1B",d.FS="",d.GS="",d.RS="",d.US="",d.SP=" ",d.DEL="\x7F"}(h=r.C0||(r.C0={})),(o=r.C1||(r.C1={})).PAD="\x80",o.HOP="\x81",o.BPH="\x82",o.NBH="\x83",o.IND="\x84",o.NEL="\x85",o.SSA="\x86",o.ESA="\x87",o.HTS="\x88",o.HTJ="\x89",o.VTS="\x8A",o.PLD="\x8B",o.PLU="\x8C",o.RI="\x8D",o.SS2="\x8E",o.SS3="\x8F",o.DCS="\x90",o.PU1="\x91",o.PU2="\x92",o.STS="\x93",o.CCH="\x94",o.MW="\x95",o.SPA="\x96",o.EPA="\x97",o.SOS="\x98",o.SGCI="\x99",o.SCI="\x9A",o.CSI="\x9B",o.ST="\x9C",o.OSC="\x9D",o.PM="\x9E",o.APC="\x9F",(r.C1_ESCAPED||(r.C1_ESCAPED={})).ST=`${h.ESC}\\`},7399:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.evaluateKeyboardEvent=void 0;const o=h(2584),d={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:["'",'"']};r.evaluateKeyboardEvent=function(c,_,l,a){const i={type:0,cancel:!1,key:void 0},e=(c.shiftKey?1:0)|(c.altKey?2:0)|(c.ctrlKey?4:0)|(c.metaKey?8:0);switch(c.keyCode){case 0:c.key==="UIKeyInputUpArrow"?i.key=_?o.C0.ESC+"OA":o.C0.ESC+"[A":c.key==="UIKeyInputLeftArrow"?i.key=_?o.C0.ESC+"OD":o.C0.ESC+"[D":c.key==="UIKeyInputRightArrow"?i.key=_?o.C0.ESC+"OC":o.C0.ESC+"[C":c.key==="UIKeyInputDownArrow"&&(i.key=_?o.C0.ESC+"OB":o.C0.ESC+"[B");break;case 8:if(c.altKey){i.key=o.C0.ESC+o.C0.DEL;break}i.key=o.C0.DEL;break;case 9:if(c.shiftKey){i.key=o.C0.ESC+"[Z";break}i.key=o.C0.HT,i.cancel=!0;break;case 13:i.key=c.altKey?o.C0.ESC+o.C0.CR:o.C0.CR,i.cancel=!0;break;case 27:i.key=o.C0.ESC,c.altKey&&(i.key=o.C0.ESC+o.C0.ESC),i.cancel=!0;break;case 37:if(c.metaKey)break;e?(i.key=o.C0.ESC+"[1;"+(e+1)+"D",i.key===o.C0.ESC+"[1;3D"&&(i.key=o.C0.ESC+(l?"b":"[1;5D"))):i.key=_?o.C0.ESC+"OD":o.C0.ESC+"[D";break;case 39:if(c.metaKey)break;e?(i.key=o.C0.ESC+"[1;"+(e+1)+"C",i.key===o.C0.ESC+"[1;3C"&&(i.key=o.C0.ESC+(l?"f":"[1;5C"))):i.key=_?o.C0.ESC+"OC":o.C0.ESC+"[C";break;case 38:if(c.metaKey)break;e?(i.key=o.C0.ESC+"[1;"+(e+1)+"A",l||i.key!==o.C0.ESC+"[1;3A"||(i.key=o.C0.ESC+"[1;5A")):i.key=_?o.C0.ESC+"OA":o.C0.ESC+"[A";break;case 40:if(c.metaKey)break;e?(i.key=o.C0.ESC+"[1;"+(e+1)+"B",l||i.key!==o.C0.ESC+"[1;3B"||(i.key=o.C0.ESC+"[1;5B")):i.key=_?o.C0.ESC+"OB":o.C0.ESC+"[B";break;case 45:c.shiftKey||c.ctrlKey||(i.key=o.C0.ESC+"[2~");break;case 46:i.key=e?o.C0.ESC+"[3;"+(e+1)+"~":o.C0.ESC+"[3~";break;case 36:i.key=e?o.C0.ESC+"[1;"+(e+1)+"H":_?o.C0.ESC+"OH":o.C0.ESC+"[H";break;case 35:i.key=e?o.C0.ESC+"[1;"+(e+1)+"F":_?o.C0.ESC+"OF":o.C0.ESC+"[F";break;case 33:c.shiftKey?i.type=2:c.ctrlKey?i.key=o.C0.ESC+"[5;"+(e+1)+"~":i.key=o.C0.ESC+"[5~";break;case 34:c.shiftKey?i.type=3:c.ctrlKey?i.key=o.C0.ESC+"[6;"+(e+1)+"~":i.key=o.C0.ESC+"[6~";break;case 112:i.key=e?o.C0.ESC+"[1;"+(e+1)+"P":o.C0.ESC+"OP";break;case 113:i.key=e?o.C0.ESC+"[1;"+(e+1)+"Q":o.C0.ESC+"OQ";break;case 114:i.key=e?o.C0.ESC+"[1;"+(e+1)+"R":o.C0.ESC+"OR";break;case 115:i.key=e?o.C0.ESC+"[1;"+(e+1)+"S":o.C0.ESC+"OS";break;case 116:i.key=e?o.C0.ESC+"[15;"+(e+1)+"~":o.C0.ESC+"[15~";break;case 117:i.key=e?o.C0.ESC+"[17;"+(e+1)+"~":o.C0.ESC+"[17~";break;case 118:i.key=e?o.C0.ESC+"[18;"+(e+1)+"~":o.C0.ESC+"[18~";break;case 119:i.key=e?o.C0.ESC+"[19;"+(e+1)+"~":o.C0.ESC+"[19~";break;case 120:i.key=e?o.C0.ESC+"[20;"+(e+1)+"~":o.C0.ESC+"[20~";break;case 121:i.key=e?o.C0.ESC+"[21;"+(e+1)+"~":o.C0.ESC+"[21~";break;case 122:i.key=e?o.C0.ESC+"[23;"+(e+1)+"~":o.C0.ESC+"[23~";break;case 123:i.key=e?o.C0.ESC+"[24;"+(e+1)+"~":o.C0.ESC+"[24~";break;default:if(!c.ctrlKey||c.shiftKey||c.altKey||c.metaKey)if(l&&!a||!c.altKey||c.metaKey)!l||c.altKey||c.ctrlKey||c.shiftKey||!c.metaKey?c.key&&!c.ctrlKey&&!c.altKey&&!c.metaKey&&c.keyCode>=48&&c.key.length===1?i.key=c.key:c.key&&c.ctrlKey&&(c.key==="_"&&(i.key=o.C0.US),c.key==="@"&&(i.key=o.C0.NUL)):c.keyCode===65&&(i.type=1);else{const n=d[c.keyCode],t=n==null?void 0:n[c.shiftKey?1:0];if(t)i.key=o.C0.ESC+t;else if(c.keyCode>=65&&c.keyCode<=90){const s=c.ctrlKey?c.keyCode-64:c.keyCode+32;let f=String.fromCharCode(s);c.shiftKey&&(f=f.toUpperCase()),i.key=o.C0.ESC+f}else if(c.key==="Dead"&&c.code.startsWith("Key")){let s=c.code.slice(3,4);c.shiftKey||(s=s.toLowerCase()),i.key=o.C0.ESC+s,i.cancel=!0}}else c.keyCode>=65&&c.keyCode<=90?i.key=String.fromCharCode(c.keyCode-64):c.keyCode===32?i.key=o.C0.NUL:c.keyCode>=51&&c.keyCode<=55?i.key=String.fromCharCode(c.keyCode-51+27):c.keyCode===56?i.key=o.C0.DEL:c.keyCode===219?i.key=o.C0.ESC:c.keyCode===220?i.key=o.C0.FS:c.keyCode===221&&(i.key=o.C0.GS)}return i}},482:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},r.utf32ToString=function(h,o=0,d=h.length){let c="";for(let _=o;_65535?(l-=65536,c+=String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):c+=String.fromCharCode(l)}return c},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,o){const d=h.length;if(!d)return 0;let c=0,_=0;if(this._interim){const l=h.charCodeAt(_++);56320<=l&&l<=57343?o[c++]=1024*(this._interim-55296)+l-56320+65536:(o[c++]=this._interim,o[c++]=l),this._interim=0}for(let l=_;l=d)return this._interim=a,c;const i=h.charCodeAt(l);56320<=i&&i<=57343?o[c++]=1024*(a-55296)+i-56320+65536:(o[c++]=a,o[c++]=i)}else a!==65279&&(o[c++]=a)}return c}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,o){const d=h.length;if(!d)return 0;let c,_,l,a,i=0,e=0,n=0;if(this.interim[0]){let f=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let u,C=0;for(;(u=63&this.interim[++C])&&C<4;)v<<=6,v|=u;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=g-C;for(;n=d)return 0;if(u=h[n++],(192&u)!=128){n--,f=!0;break}this.interim[C++]=u,v<<=6,v|=63&u}f||(g===2?v<128?n--:o[i++]=v:g===3?v<2048||v>=55296&&v<=57343||v===65279||(o[i++]=v):v<65536||v>1114111||(o[i++]=v)),this.interim.fill(0)}const t=d-4;let s=n;for(;s=d)return this.interim[0]=c,i;if(_=h[s++],(192&_)!=128){s--;continue}if(e=(31&c)<<6|63&_,e<128){s--;continue}o[i++]=e}else if((240&c)==224){if(s>=d)return this.interim[0]=c,i;if(_=h[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=c,this.interim[1]=_,i;if(l=h[s++],(192&l)!=128){s--;continue}if(e=(15&c)<<12|(63&_)<<6|63&l,e<2048||e>=55296&&e<=57343||e===65279)continue;o[i++]=e}else if((248&c)==240){if(s>=d)return this.interim[0]=c,i;if(_=h[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=c,this.interim[1]=_,i;if(l=h[s++],(192&l)!=128){s--;continue}if(s>=d)return this.interim[0]=c,this.interim[1]=_,this.interim[2]=l,i;if(a=h[s++],(192&a)!=128){s--;continue}if(e=(7&c)<<18|(63&_)<<12|(63&l)<<6|63&a,e<65536||e>1114111)continue;o[i++]=e}}return i}}},225:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeV6=void 0;const o=h(8273),d=[[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]],c=[[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]];let _;r.UnicodeV6=class{constructor(){if(this.version="6",!_){_=new Uint8Array(65536),(0,o.fill)(_,1),_[0]=0,(0,o.fill)(_,0,1,32),(0,o.fill)(_,0,127,160),(0,o.fill)(_,2,4352,4448),_[9001]=2,_[9002]=2,(0,o.fill)(_,2,11904,42192),_[12351]=1,(0,o.fill)(_,2,44032,55204),(0,o.fill)(_,2,63744,64256),(0,o.fill)(_,2,65040,65050),(0,o.fill)(_,2,65072,65136),(0,o.fill)(_,2,65280,65377),(0,o.fill)(_,2,65504,65511);for(let l=0;li[t][1])return!1;for(;t>=n;)if(e=n+t>>1,a>i[e][1])n=e+1;else{if(!(a=131072&&l<=196605||l>=196608&&l<=262141?2:1}}},5981:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WriteBuffer=void 0;const o=h(8460),d=typeof queueMicrotask=="undefined"?c=>{Promise.resolve().then(c)}:queueMicrotask;r.WriteBuffer=class{constructor(c){this._action=c,this._writeBuffer=[],this._callbacks=[],this._pendingData=0,this._bufferOffset=0,this._isSyncWriting=!1,this._syncCalls=0,this._onWriteParsed=new o.EventEmitter}get onWriteParsed(){return this._onWriteParsed.event}writeSync(c,_){if(_!==void 0&&this._syncCalls>_)return void(this._syncCalls=0);if(this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(void 0),this._syncCalls++,this._isSyncWriting)return;let l;for(this._isSyncWriting=!0;l=this._writeBuffer.shift();){this._action(l);const a=this._callbacks.shift();a&&a()}this._pendingData=0,this._bufferOffset=2147483647,this._isSyncWriting=!1,this._syncCalls=0}write(c,_){if(this._pendingData>5e7)throw new Error("write data discarded, use flow control to avoid losing data");this._writeBuffer.length||(this._bufferOffset=0,setTimeout(()=>this._innerWrite())),this._pendingData+=c.length,this._writeBuffer.push(c),this._callbacks.push(_)}_innerWrite(c=0,_=!0){const l=c||Date.now();for(;this._writeBuffer.length>this._bufferOffset;){const a=this._writeBuffer[this._bufferOffset],i=this._action(a,_);if(i){const n=t=>Date.now()-l>=12?setTimeout(()=>this._innerWrite(0,t)):this._innerWrite(l,t);return void i.catch(t=>(d(()=>{throw t}),Promise.resolve(!1))).then(n)}const e=this._callbacks[this._bufferOffset];if(e&&e(),this._bufferOffset++,this._pendingData-=a.length,Date.now()-l>=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(()=>this._innerWrite())):(this._writeBuffer.length=0,this._callbacks.length=0,this._pendingData=0,this._bufferOffset=0),this._onWriteParsed.fire()}}},5941:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.toRgbString=r.parseColor=void 0;const h=/^([\da-f])\/([\da-f])\/([\da-f])$|^([\da-f]{2})\/([\da-f]{2})\/([\da-f]{2})$|^([\da-f]{3})\/([\da-f]{3})\/([\da-f]{3})$|^([\da-f]{4})\/([\da-f]{4})\/([\da-f]{4})$/,o=/^[\da-f]+$/;function d(c,_){const l=c.toString(16),a=l.length<2?"0"+l:l;switch(_){case 4:return l[0];case 8:return a;case 12:return(a+a).slice(0,3);default:return a+a}}r.parseColor=function(c){if(!c)return;let _=c.toLowerCase();if(_.indexOf("rgb:")===0){_=_.slice(4);const l=h.exec(_);if(l){const a=l[1]?15:l[4]?255:l[7]?4095:65535;return[Math.round(parseInt(l[1]||l[4]||l[7]||l[10],16)/a*255),Math.round(parseInt(l[2]||l[5]||l[8]||l[11],16)/a*255),Math.round(parseInt(l[3]||l[6]||l[9]||l[12],16)/a*255)]}}else if(_.indexOf("#")===0&&(_=_.slice(1),o.exec(_)&&[3,6,9,12].includes(_.length))){const l=_.length/3,a=[0,0,0];for(let i=0;i<3;++i){const e=parseInt(_.slice(l*i,l*i+l),16);a[i]=l===1?e<<4:l===2?e:l===3?e>>4:e>>8}return a}},r.toRgbString=function(c,_=16){const[l,a,i]=c;return`rgb:${d(l,_)}/${d(a,_)}/${d(i,_)}`}},5770:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PAYLOAD_LIMIT=void 0,r.PAYLOAD_LIMIT=1e7},6351:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DcsHandler=r.DcsParser=void 0;const o=h(482),d=h(8742),c=h(5770),_=[];r.DcsParser=class{constructor(){this._handlers=Object.create(null),this._active=_,this._ident=0,this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=_}registerHandler(a,i){this._handlers[a]===void 0&&(this._handlers[a]=[]);const e=this._handlers[a];return e.push(i),{dispose:()=>{const n=e.indexOf(i);n!==-1&&e.splice(n,1)}}}clearHandler(a){this._handlers[a]&&delete this._handlers[a]}setHandlerFallback(a){this._handlerFb=a}reset(){if(this._active.length)for(let a=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;a>=0;--a)this._active[a].unhook(!1);this._stack.paused=!1,this._active=_,this._ident=0}hook(a,i){if(this.reset(),this._ident=a,this._active=this._handlers[a]||_,this._active.length)for(let e=this._active.length-1;e>=0;e--)this._active[e].hook(i);else this._handlerFb(this._ident,"HOOK",i)}put(a,i,e){if(this._active.length)for(let n=this._active.length-1;n>=0;n--)this._active[n].put(a,i,e);else this._handlerFb(this._ident,"PUT",(0,o.utf32ToString)(a,i,e))}unhook(a,i=!0){if(this._active.length){let e=!1,n=this._active.length-1,t=!1;if(this._stack.paused&&(n=this._stack.loopPosition-1,e=i,t=this._stack.fallThrough,this._stack.paused=!1),!t&&e===!1){for(;n>=0&&(e=this._active[n].unhook(a),e!==!0);n--)if(e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!1,e;n--}for(;n>=0;n--)if(e=this._active[n].unhook(!1),e instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=n,this._stack.fallThrough=!0,e}else this._handlerFb(this._ident,"UNHOOK",a);this._active=_,this._ident=0}};const l=new d.Params;l.addParam(0),r.DcsHandler=class{constructor(a){this._handler=a,this._data="",this._params=l,this._hitLimit=!1}hook(a){this._params=a.length>1||a.params[0]?a.clone():l,this._data="",this._hitLimit=!1}put(a,i,e){this._hitLimit||(this._data+=(0,o.utf32ToString)(a,i,e),this._data.length>c.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}unhook(a){let i=!1;if(this._hitLimit)i=!1;else if(a&&(i=this._handler(this._data,this._params),i instanceof Promise))return i.then(e=>(this._params=l,this._data="",this._hitLimit=!1,e));return this._params=l,this._data="",this._hitLimit=!1,i}}},2015:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.EscapeSequenceParser=r.VT500_TRANSITION_TABLE=r.TransitionTable=void 0;const o=h(844),d=h(8273),c=h(8742),_=h(6242),l=h(6351);class a{constructor(t){this.table=new Uint8Array(t)}setDefault(t,s){(0,d.fill)(this.table,t<<4|s)}add(t,s,f,v){this.table[s<<8|t]=f<<4|v}addMany(t,s,f,v){for(let u=0;um),s=(g,m)=>t.slice(g,m),f=s(32,127),v=s(0,24);v.push(25),v.push.apply(v,s(28,32));const u=s(0,14);let C;for(C in n.setDefault(1,0),n.addMany(f,0,2,0),u)n.addMany([24,26,153,154],C,3,0),n.addMany(s(128,144),C,3,0),n.addMany(s(144,152),C,3,0),n.add(156,C,0,0),n.add(27,C,11,1),n.add(157,C,4,8),n.addMany([152,158,159],C,0,7),n.add(155,C,11,3),n.add(144,C,11,9);return n.addMany(v,0,3,0),n.addMany(v,1,3,1),n.add(127,1,0,1),n.addMany(v,8,0,8),n.addMany(v,3,3,3),n.add(127,3,0,3),n.addMany(v,4,3,4),n.add(127,4,0,4),n.addMany(v,6,3,6),n.addMany(v,5,3,5),n.add(127,5,0,5),n.addMany(v,2,3,2),n.add(127,2,0,2),n.add(93,1,4,8),n.addMany(f,8,5,8),n.add(127,8,5,8),n.addMany([156,27,24,26,7],8,6,0),n.addMany(s(28,32),8,0,8),n.addMany([88,94,95],1,0,7),n.addMany(f,7,0,7),n.addMany(v,7,0,7),n.add(156,7,0,0),n.add(127,7,0,7),n.add(91,1,11,3),n.addMany(s(64,127),3,7,0),n.addMany(s(48,60),3,8,4),n.addMany([60,61,62,63],3,9,4),n.addMany(s(48,60),4,8,4),n.addMany(s(64,127),4,7,0),n.addMany([60,61,62,63],4,0,6),n.addMany(s(32,64),6,0,6),n.add(127,6,0,6),n.addMany(s(64,127),6,0,0),n.addMany(s(32,48),3,9,5),n.addMany(s(32,48),5,9,5),n.addMany(s(48,64),5,0,6),n.addMany(s(64,127),5,7,0),n.addMany(s(32,48),4,9,5),n.addMany(s(32,48),1,9,2),n.addMany(s(32,48),2,9,2),n.addMany(s(48,127),2,10,0),n.addMany(s(48,80),1,10,0),n.addMany(s(81,88),1,10,0),n.addMany([89,90,92],1,10,0),n.addMany(s(96,127),1,10,0),n.add(80,1,11,9),n.addMany(v,9,0,9),n.add(127,9,0,9),n.addMany(s(28,32),9,0,9),n.addMany(s(32,48),9,9,12),n.addMany(s(48,60),9,8,10),n.addMany([60,61,62,63],9,9,10),n.addMany(v,11,0,11),n.addMany(s(32,128),11,0,11),n.addMany(s(28,32),11,0,11),n.addMany(v,10,0,10),n.add(127,10,0,10),n.addMany(s(28,32),10,0,10),n.addMany(s(48,60),10,8,10),n.addMany([60,61,62,63],10,0,11),n.addMany(s(32,48),10,9,12),n.addMany(v,12,0,12),n.add(127,12,0,12),n.addMany(s(28,32),12,0,12),n.addMany(s(32,48),12,9,12),n.addMany(s(48,64),12,0,11),n.addMany(s(64,127),12,12,13),n.addMany(s(64,127),10,12,13),n.addMany(s(64,127),9,12,13),n.addMany(v,13,13,13),n.addMany(f,13,13,13),n.add(127,13,0,13),n.addMany([27,156,24,26],13,14,0),n.add(i,0,2,0),n.add(i,8,5,8),n.add(i,6,0,6),n.add(i,11,0,11),n.add(i,13,13,13),n}();class e extends o.Disposable{constructor(t=r.VT500_TRANSITION_TABLE){super(),this._transitions=t,this._parseStack={state:0,handlers:[],handlerPos:0,transition:0,chunkPos:0},this.initialState=0,this.currentState=this.initialState,this._params=new c.Params,this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._printHandlerFb=(s,f,v)=>{},this._executeHandlerFb=s=>{},this._csiHandlerFb=(s,f)=>{},this._escHandlerFb=s=>{},this._errorHandlerFb=s=>s,this._printHandler=this._printHandlerFb,this._executeHandlers=Object.create(null),this._csiHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser=new _.OscParser,this._dcsParser=new l.DcsParser,this._errorHandler=this._errorHandlerFb,this.registerEscHandler({final:"\\"},()=>!0)}_identifier(t,s=[64,126]){let f=0;if(t.prefix){if(t.prefix.length>1)throw new Error("only one byte as prefix supported");if(f=t.prefix.charCodeAt(0),f&&60>f||f>63)throw new Error("prefix must be in range 0x3c .. 0x3f")}if(t.intermediates){if(t.intermediates.length>2)throw new Error("only two bytes as intermediates are supported");for(let u=0;uC||C>47)throw new Error("intermediate must be in range 0x20 .. 0x2f");f<<=8,f|=C}}if(t.final.length!==1)throw new Error("final must be a single byte");const v=t.final.charCodeAt(0);if(s[0]>v||v>s[1])throw new Error(`final must be in range ${s[0]} .. ${s[1]}`);return f<<=8,f|=v,f}identToString(t){const s=[];for(;t;)s.push(String.fromCharCode(255&t)),t>>=8;return s.reverse().join("")}dispose(){this._csiHandlers=Object.create(null),this._executeHandlers=Object.create(null),this._escHandlers=Object.create(null),this._oscParser.dispose(),this._dcsParser.dispose()}setPrintHandler(t){this._printHandler=t}clearPrintHandler(){this._printHandler=this._printHandlerFb}registerEscHandler(t,s){const f=this._identifier(t,[48,126]);this._escHandlers[f]===void 0&&(this._escHandlers[f]=[]);const v=this._escHandlers[f];return v.push(s),{dispose:()=>{const u=v.indexOf(s);u!==-1&&v.splice(u,1)}}}clearEscHandler(t){this._escHandlers[this._identifier(t,[48,126])]&&delete this._escHandlers[this._identifier(t,[48,126])]}setEscHandlerFallback(t){this._escHandlerFb=t}setExecuteHandler(t,s){this._executeHandlers[t.charCodeAt(0)]=s}clearExecuteHandler(t){this._executeHandlers[t.charCodeAt(0)]&&delete this._executeHandlers[t.charCodeAt(0)]}setExecuteHandlerFallback(t){this._executeHandlerFb=t}registerCsiHandler(t,s){const f=this._identifier(t);this._csiHandlers[f]===void 0&&(this._csiHandlers[f]=[]);const v=this._csiHandlers[f];return v.push(s),{dispose:()=>{const u=v.indexOf(s);u!==-1&&v.splice(u,1)}}}clearCsiHandler(t){this._csiHandlers[this._identifier(t)]&&delete this._csiHandlers[this._identifier(t)]}setCsiHandlerFallback(t){this._csiHandlerFb=t}registerDcsHandler(t,s){return this._dcsParser.registerHandler(this._identifier(t),s)}clearDcsHandler(t){this._dcsParser.clearHandler(this._identifier(t))}setDcsHandlerFallback(t){this._dcsParser.setHandlerFallback(t)}registerOscHandler(t,s){return this._oscParser.registerHandler(t,s)}clearOscHandler(t){this._oscParser.clearHandler(t)}setOscHandlerFallback(t){this._oscParser.setHandlerFallback(t)}setErrorHandler(t){this._errorHandler=t}clearErrorHandler(){this._errorHandler=this._errorHandlerFb}reset(){this.currentState=this.initialState,this._oscParser.reset(),this._dcsParser.reset(),this._params.reset(),this._params.addParam(0),this._collect=0,this.precedingCodepoint=0,this._parseStack.state!==0&&(this._parseStack.state=2,this._parseStack.handlers=[])}_preserveStack(t,s,f,v,u){this._parseStack.state=t,this._parseStack.handlers=s,this._parseStack.handlerPos=f,this._parseStack.transition=v,this._parseStack.chunkPos=u}parse(t,s,f){let v,u=0,C=0,g=0;if(this._parseStack.state)if(this._parseStack.state===2)this._parseStack.state=0,g=this._parseStack.chunkPos+1;else{if(f===void 0||this._parseStack.state===1)throw this._parseStack.state=1,new Error("improper continuation due to previous async handler, giving up parsing");const m=this._parseStack.handlers;let b=this._parseStack.handlerPos-1;switch(this._parseStack.state){case 3:if(f===!1&&b>-1){for(;b>=0&&(v=m[b](this._params),v!==!0);b--)if(v instanceof Promise)return this._parseStack.handlerPos=b,v}this._parseStack.handlers=[];break;case 4:if(f===!1&&b>-1){for(;b>=0&&(v=m[b](),v!==!0);b--)if(v instanceof Promise)return this._parseStack.handlerPos=b,v}this._parseStack.handlers=[];break;case 6:if(u=t[this._parseStack.chunkPos],v=this._dcsParser.unhook(u!==24&&u!==26,f),v)return v;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0;break;case 5:if(u=t[this._parseStack.chunkPos],v=this._oscParser.end(u!==24&&u!==26,f),v)return v;u===27&&(this._parseStack.transition|=1),this._params.reset(),this._params.addParam(0),this._collect=0}this._parseStack.state=0,g=this._parseStack.chunkPos+1,this.precedingCodepoint=0,this.currentState=15&this._parseStack.transition}for(let m=g;m>4){case 2:for(let S=m+1;;++S){if(S>=s||(u=t[S])<32||u>126&&u=s||(u=t[S])<32||u>126&&u=s||(u=t[S])<32||u>126&&u=s||(u=t[S])<32||u>126&&u=0&&(v=b[y](this._params),v!==!0);y--)if(v instanceof Promise)return this._preserveStack(3,b,y,C,m),v;y<0&&this._csiHandlerFb(this._collect<<8|u,this._params),this.precedingCodepoint=0;break;case 8:do switch(u){case 59:this._params.addParam(0);break;case 58:this._params.addSubParam(-1);break;default:this._params.addDigit(u-48)}while(++m47&&u<60);m--;break;case 9:this._collect<<=8,this._collect|=u;break;case 10:const w=this._escHandlers[this._collect<<8|u];let p=w?w.length-1:-1;for(;p>=0&&(v=w[p](),v!==!0);p--)if(v instanceof Promise)return this._preserveStack(4,w,p,C,m),v;p<0&&this._escHandlerFb(this._collect<<8|u),this.precedingCodepoint=0;break;case 11:this._params.reset(),this._params.addParam(0),this._collect=0;break;case 12:this._dcsParser.hook(this._collect<<8|u,this._params);break;case 13:for(let S=m+1;;++S)if(S>=s||(u=t[S])===24||u===26||u===27||u>127&&u=s||(u=t[S])<32||u>127&&u{Object.defineProperty(r,"__esModule",{value:!0}),r.OscHandler=r.OscParser=void 0;const o=h(5770),d=h(482),c=[];r.OscParser=class{constructor(){this._state=0,this._active=c,this._id=-1,this._handlers=Object.create(null),this._handlerFb=()=>{},this._stack={paused:!1,loopPosition:0,fallThrough:!1}}registerHandler(_,l){this._handlers[_]===void 0&&(this._handlers[_]=[]);const a=this._handlers[_];return a.push(l),{dispose:()=>{const i=a.indexOf(l);i!==-1&&a.splice(i,1)}}}clearHandler(_){this._handlers[_]&&delete this._handlers[_]}setHandlerFallback(_){this._handlerFb=_}dispose(){this._handlers=Object.create(null),this._handlerFb=()=>{},this._active=c}reset(){if(this._state===2)for(let _=this._stack.paused?this._stack.loopPosition-1:this._active.length-1;_>=0;--_)this._active[_].end(!1);this._stack.paused=!1,this._active=c,this._id=-1,this._state=0}_start(){if(this._active=this._handlers[this._id]||c,this._active.length)for(let _=this._active.length-1;_>=0;_--)this._active[_].start();else this._handlerFb(this._id,"START")}_put(_,l,a){if(this._active.length)for(let i=this._active.length-1;i>=0;i--)this._active[i].put(_,l,a);else this._handlerFb(this._id,"PUT",(0,d.utf32ToString)(_,l,a))}start(){this.reset(),this._state=1}put(_,l,a){if(this._state!==3){if(this._state===1)for(;l0&&this._put(_,l,a)}}end(_,l=!0){if(this._state!==0){if(this._state!==3)if(this._state===1&&this._start(),this._active.length){let a=!1,i=this._active.length-1,e=!1;if(this._stack.paused&&(i=this._stack.loopPosition-1,a=l,e=this._stack.fallThrough,this._stack.paused=!1),!e&&a===!1){for(;i>=0&&(a=this._active[i].end(_),a!==!0);i--)if(a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!1,a;i--}for(;i>=0;i--)if(a=this._active[i].end(!1),a instanceof Promise)return this._stack.paused=!0,this._stack.loopPosition=i,this._stack.fallThrough=!0,a}else this._handlerFb(this._id,"END",_);this._active=c,this._id=-1,this._state=0}}},r.OscHandler=class{constructor(_){this._handler=_,this._data="",this._hitLimit=!1}start(){this._data="",this._hitLimit=!1}put(_,l,a){this._hitLimit||(this._data+=(0,d.utf32ToString)(_,l,a),this._data.length>o.PAYLOAD_LIMIT&&(this._data="",this._hitLimit=!0))}end(_){let l=!1;if(this._hitLimit)l=!1;else if(_&&(l=this._handler(this._data),l instanceof Promise))return l.then(a=>(this._data="",this._hitLimit=!1,a));return this._data="",this._hitLimit=!1,l}}},8742:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Params=void 0;const h=2147483647;class o{constructor(c=32,_=32){if(this.maxLength=c,this.maxSubParamsLength=_,_>256)throw new Error("maxSubParamsLength must not be greater than 256");this.params=new Int32Array(c),this.length=0,this._subParams=new Int32Array(_),this._subParamsLength=0,this._subParamsIdx=new Uint16Array(c),this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}static fromArray(c){const _=new o;if(!c.length)return _;for(let l=Array.isArray(c[0])?1:0;l>8,a=255&this._subParamsIdx[_];a-l>0&&c.push(Array.prototype.slice.call(this._subParams,l,a))}return c}reset(){this.length=0,this._subParamsLength=0,this._rejectDigits=!1,this._rejectSubDigits=!1,this._digitIsSub=!1}addParam(c){if(this._digitIsSub=!1,this.length>=this.maxLength)this._rejectDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParamsIdx[this.length]=this._subParamsLength<<8|this._subParamsLength,this.params[this.length++]=c>h?h:c}}addSubParam(c){if(this._digitIsSub=!0,this.length)if(this._rejectDigits||this._subParamsLength>=this.maxSubParamsLength)this._rejectSubDigits=!0;else{if(c<-1)throw new Error("values lesser than -1 are not allowed");this._subParams[this._subParamsLength++]=c>h?h:c,this._subParamsIdx[this.length-1]++}}hasSubParams(c){return(255&this._subParamsIdx[c])-(this._subParamsIdx[c]>>8)>0}getSubParams(c){const _=this._subParamsIdx[c]>>8,l=255&this._subParamsIdx[c];return l-_>0?this._subParams.subarray(_,l):null}getSubParamsAll(){const c={};for(let _=0;_>8,a=255&this._subParamsIdx[_];a-l>0&&(c[_]=this._subParams.slice(l,a))}return c}addDigit(c){let _;if(this._rejectDigits||!(_=this._digitIsSub?this._subParamsLength:this.length)||this._digitIsSub&&this._rejectSubDigits)return;const l=this._digitIsSub?this._subParams:this.params,a=l[_-1];l[_-1]=~a?Math.min(10*a+c,h):c}}r.Params=o},5741:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AddonManager=void 0,r.AddonManager=class{constructor(){this._addons=[]}dispose(){for(let h=this._addons.length-1;h>=0;h--)this._addons[h].instance.dispose()}loadAddon(h,o){const d={instance:o,dispose:o.dispose,isDisposed:!1};this._addons.push(d),o.dispose=()=>this._wrappedAddonDispose(d),o.activate(h)}_wrappedAddonDispose(h){if(h.isDisposed)return;let o=-1;for(let d=0;d{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferApiView=void 0;const o=h(3785),d=h(511);r.BufferApiView=class{constructor(c,_){this._buffer=c,this.type=_}init(c){return this._buffer=c,this}get cursorY(){return this._buffer.y}get cursorX(){return this._buffer.x}get viewportY(){return this._buffer.ydisp}get baseY(){return this._buffer.ybase}get length(){return this._buffer.lines.length}getLine(c){const _=this._buffer.lines.get(c);if(_)return new o.BufferLineApiView(_)}getNullCell(){return new d.CellData}}},3785:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferLineApiView=void 0;const o=h(511);r.BufferLineApiView=class{constructor(d){this._line=d}get isWrapped(){return this._line.isWrapped}get length(){return this._line.length}getCell(d,c){if(!(d<0||d>=this._line.length))return c?(this._line.loadCell(d,c),c):this._line.loadCell(d,new o.CellData)}translateToString(d,c,_){return this._line.translateToString(d,c,_)}}},8285:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BufferNamespaceApi=void 0;const o=h(8771),d=h(8460);r.BufferNamespaceApi=class{constructor(c){this._core=c,this._onBufferChange=new d.EventEmitter,this._normal=new o.BufferApiView(this._core.buffers.normal,"normal"),this._alternate=new o.BufferApiView(this._core.buffers.alt,"alternate"),this._core.buffers.onBufferActivate(()=>this._onBufferChange.fire(this.active))}get onBufferChange(){return this._onBufferChange.event}get active(){if(this._core.buffers.active===this._core.buffers.normal)return this.normal;if(this._core.buffers.active===this._core.buffers.alt)return this.alternate;throw new Error("Active buffer is neither normal nor alternate")}get normal(){return this._normal.init(this._core.buffers.normal)}get alternate(){return this._alternate.init(this._core.buffers.alt)}}},7975:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParserApi=void 0,r.ParserApi=class{constructor(h){this._core=h}registerCsiHandler(h,o){return this._core.registerCsiHandler(h,d=>o(d.toArray()))}addCsiHandler(h,o){return this.registerCsiHandler(h,o)}registerDcsHandler(h,o){return this._core.registerDcsHandler(h,(d,c)=>o(d,c.toArray()))}addDcsHandler(h,o){return this.registerDcsHandler(h,o)}registerEscHandler(h,o){return this._core.registerEscHandler(h,o)}addEscHandler(h,o){return this.registerEscHandler(h,o)}registerOscHandler(h,o){return this._core.registerOscHandler(h,o)}addOscHandler(h,o){return this.registerOscHandler(h,o)}}},7090:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeApi=void 0,r.UnicodeApi=class{constructor(h){this._core=h}register(h){this._core.unicodeService.register(h)}get versions(){return this._core.unicodeService.versions}get activeVersion(){return this._core.unicodeService.activeVersion}set activeVersion(h){this._core.unicodeService.activeVersion=h}}},744:function(D,r,h){var o=this&&this.__decorate||function(e,n,t,s){var f,v=arguments.length,u=v<3?n:s===null?s=Object.getOwnPropertyDescriptor(n,t):s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")u=Reflect.decorate(e,n,t,s);else for(var C=e.length-1;C>=0;C--)(f=e[C])&&(u=(v<3?f(u):v>3?f(n,t,u):f(n,t))||u);return v>3&&u&&Object.defineProperty(n,t,u),u},d=this&&this.__param||function(e,n){return function(t,s){n(t,s,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.BufferService=r.MINIMUM_ROWS=r.MINIMUM_COLS=void 0;const c=h(2585),_=h(5295),l=h(8460),a=h(844);r.MINIMUM_COLS=2,r.MINIMUM_ROWS=1;let i=class extends a.Disposable{constructor(e){super(),this.isUserScrolling=!1,this._onResize=new l.EventEmitter,this._onScroll=new l.EventEmitter,this.cols=Math.max(e.rawOptions.cols||0,r.MINIMUM_COLS),this.rows=Math.max(e.rawOptions.rows||0,r.MINIMUM_ROWS),this.buffers=new _.BufferSet(e,this)}get onResize(){return this._onResize.event}get onScroll(){return this._onScroll.event}get buffer(){return this.buffers.active}dispose(){super.dispose(),this.buffers.dispose()}resize(e,n){this.cols=e,this.rows=n,this.buffers.resize(e,n),this.buffers.setupTabStops(this.cols),this._onResize.fire({cols:e,rows:n})}reset(){this.buffers.reset(),this.isUserScrolling=!1}scroll(e,n=!1){const t=this.buffer;let s;s=this._cachedBlankLine,s&&s.length===this.cols&&s.getFg(0)===e.fg&&s.getBg(0)===e.bg||(s=t.getBlankLine(e,n),this._cachedBlankLine=s),s.isWrapped=n;const f=t.ybase+t.scrollTop,v=t.ybase+t.scrollBottom;if(t.scrollTop===0){const u=t.lines.isFull;v===t.lines.length-1?u?t.lines.recycle().copyFrom(s):t.lines.push(s.clone()):t.lines.splice(v+1,0,s.clone()),u?this.isUserScrolling&&(t.ydisp=Math.max(t.ydisp-1,0)):(t.ybase++,this.isUserScrolling||t.ydisp++)}else{const u=v-f+1;t.lines.shiftElements(f+1,u-1,-1),t.lines.set(v,s.clone())}this.isUserScrolling||(t.ydisp=t.ybase),this._onScroll.fire(t.ydisp)}scrollLines(e,n,t){const s=this.buffer;if(e<0){if(s.ydisp===0)return;this.isUserScrolling=!0}else e+s.ydisp>=s.ybase&&(this.isUserScrolling=!1);const f=s.ydisp;s.ydisp=Math.max(Math.min(s.ydisp+e,s.ybase),0),f!==s.ydisp&&(n||this._onScroll.fire(s.ydisp))}scrollPages(e){this.scrollLines(e*(this.rows-1))}scrollToTop(){this.scrollLines(-this.buffer.ydisp)}scrollToBottom(){this.scrollLines(this.buffer.ybase-this.buffer.ydisp)}scrollToLine(e){const n=e-this.buffer.ydisp;n!==0&&this.scrollLines(n)}};i=o([d(0,c.IOptionsService)],i),r.BufferService=i},7994:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharsetService=void 0,r.CharsetService=class{constructor(){this.glevel=0,this._charsets=[]}reset(){this.charset=void 0,this._charsets=[],this.glevel=0}setgLevel(h){this.glevel=h,this.charset=this._charsets[h]}setgCharset(h,o){this._charsets[h]=o,this.glevel===h&&(this.charset=o)}}},1753:function(D,r,h){var o=this&&this.__decorate||function(t,s,f,v){var u,C=arguments.length,g=C<3?s:v===null?v=Object.getOwnPropertyDescriptor(s,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,s,f,v);else for(var m=t.length-1;m>=0;m--)(u=t[m])&&(g=(C<3?u(g):C>3?u(s,f,g):u(s,f))||g);return C>3&&g&&Object.defineProperty(s,f,g),g},d=this&&this.__param||function(t,s){return function(f,v){s(f,v,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreMouseService=void 0;const c=h(2585),_=h(8460),l={NONE:{events:0,restrict:()=>!1},X10:{events:1,restrict:t=>t.button!==4&&t.action===1&&(t.ctrl=!1,t.alt=!1,t.shift=!1,!0)},VT200:{events:19,restrict:t=>t.action!==32},DRAG:{events:23,restrict:t=>t.action!==32||t.button!==3},ANY:{events:31,restrict:t=>!0}};function a(t,s){let f=(t.ctrl?16:0)|(t.shift?4:0)|(t.alt?8:0);return t.button===4?(f|=64,f|=t.action):(f|=3&t.button,4&t.button&&(f|=64),8&t.button&&(f|=128),t.action===32?f|=32:t.action!==0||s||(f|=3)),f}const i=String.fromCharCode,e={DEFAULT:t=>{const s=[a(t,!1)+32,t.col+32,t.row+32];return s[0]>255||s[1]>255||s[2]>255?"":`\x1B[M${i(s[0])}${i(s[1])}${i(s[2])}`},SGR:t=>{const s=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${a(t,!0)};${t.col};${t.row}${s}`},SGR_PIXELS:t=>{const s=t.action===0&&t.button!==4?"m":"M";return`\x1B[<${a(t,!0)};${t.x};${t.y}${s}`}};let n=class{constructor(t,s){this._bufferService=t,this._coreService=s,this._protocols={},this._encodings={},this._activeProtocol="",this._activeEncoding="",this._onProtocolChange=new _.EventEmitter,this._lastEvent=null;for(const f of Object.keys(l))this.addProtocol(f,l[f]);for(const f of Object.keys(e))this.addEncoding(f,e[f]);this.reset()}addProtocol(t,s){this._protocols[t]=s}addEncoding(t,s){this._encodings[t]=s}get activeProtocol(){return this._activeProtocol}get areMouseEventsActive(){return this._protocols[this._activeProtocol].events!==0}set activeProtocol(t){if(!this._protocols[t])throw new Error(`unknown protocol "${t}"`);this._activeProtocol=t,this._onProtocolChange.fire(this._protocols[t].events)}get activeEncoding(){return this._activeEncoding}set activeEncoding(t){if(!this._encodings[t])throw new Error(`unknown encoding "${t}"`);this._activeEncoding=t}reset(){this.activeProtocol="NONE",this.activeEncoding="DEFAULT",this._lastEvent=null}get onProtocolChange(){return this._onProtocolChange.event}triggerMouseEvent(t){if(t.col<0||t.col>=this._bufferService.cols||t.row<0||t.row>=this._bufferService.rows||t.button===4&&t.action===32||t.button===3&&t.action!==32||t.button!==4&&(t.action===2||t.action===3)||(t.col++,t.row++,t.action===32&&this._lastEvent&&this._equalEvents(this._lastEvent,t,this._activeEncoding==="SGR_PIXELS"))||!this._protocols[this._activeProtocol].restrict(t))return!1;const s=this._encodings[this._activeEncoding](t);return s&&(this._activeEncoding==="DEFAULT"?this._coreService.triggerBinaryEvent(s):this._coreService.triggerDataEvent(s,!0)),this._lastEvent=t,!0}explainEvents(t){return{down:!!(1&t),up:!!(2&t),drag:!!(4&t),move:!!(8&t),wheel:!!(16&t)}}_equalEvents(t,s,f){if(f){if(t.x!==s.x||t.y!==s.y)return!1}else if(t.col!==s.col||t.row!==s.row)return!1;return t.button===s.button&&t.action===s.action&&t.ctrl===s.ctrl&&t.alt===s.alt&&t.shift===s.shift}};n=o([d(0,c.IBufferService),d(1,c.ICoreService)],n),r.CoreMouseService=n},6975:function(D,r,h){var o=this&&this.__decorate||function(t,s,f,v){var u,C=arguments.length,g=C<3?s:v===null?v=Object.getOwnPropertyDescriptor(s,f):v;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(t,s,f,v);else for(var m=t.length-1;m>=0;m--)(u=t[m])&&(g=(C<3?u(g):C>3?u(s,f,g):u(s,f))||g);return C>3&&g&&Object.defineProperty(s,f,g),g},d=this&&this.__param||function(t,s){return function(f,v){s(f,v,t)}};Object.defineProperty(r,"__esModule",{value:!0}),r.CoreService=void 0;const c=h(2585),_=h(8460),l=h(1439),a=h(844),i=Object.freeze({insertMode:!1}),e=Object.freeze({applicationCursorKeys:!1,applicationKeypad:!1,bracketedPasteMode:!1,origin:!1,reverseWraparound:!1,sendFocus:!1,wraparound:!0});let n=class extends a.Disposable{constructor(t,s,f,v){super(),this._bufferService=s,this._logService=f,this._optionsService=v,this.isCursorInitialized=!1,this.isCursorHidden=!1,this._onData=this.register(new _.EventEmitter),this._onUserInput=this.register(new _.EventEmitter),this._onBinary=this.register(new _.EventEmitter),this._scrollToBottom=t,this.register({dispose:()=>this._scrollToBottom=void 0}),this.modes=(0,l.clone)(i),this.decPrivateModes=(0,l.clone)(e)}get onData(){return this._onData.event}get onUserInput(){return this._onUserInput.event}get onBinary(){return this._onBinary.event}reset(){this.modes=(0,l.clone)(i),this.decPrivateModes=(0,l.clone)(e)}triggerDataEvent(t,s=!1){if(this._optionsService.rawOptions.disableStdin)return;const f=this._bufferService.buffer;f.ybase!==f.ydisp&&this._scrollToBottom(),s&&this._onUserInput.fire(),this._logService.debug(`sending data "${t}"`,()=>t.split("").map(v=>v.charCodeAt(0))),this._onData.fire(t)}triggerBinaryEvent(t){this._optionsService.rawOptions.disableStdin||(this._logService.debug(`sending binary "${t}"`,()=>t.split("").map(s=>s.charCodeAt(0))),this._onBinary.fire(t))}};n=o([d(1,c.IBufferService),d(2,c.ILogService),d(3,c.IOptionsService)],n),r.CoreService=n},9074:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DecorationService=void 0;const o=h(8055),d=h(8460),c=h(844),_=h(6106),l={xmin:0,xmax:0};class a extends c.Disposable{constructor(){super(...arguments),this._decorations=new _.SortedList(n=>n==null?void 0:n.marker.line),this._onDecorationRegistered=this.register(new d.EventEmitter),this._onDecorationRemoved=this.register(new d.EventEmitter)}get onDecorationRegistered(){return this._onDecorationRegistered.event}get onDecorationRemoved(){return this._onDecorationRemoved.event}get decorations(){return this._decorations.values()}registerDecoration(n){if(n.marker.isDisposed)return;const t=new i(n);if(t){const s=t.marker.onDispose(()=>t.dispose());t.onDispose(()=>{t&&(this._decorations.delete(t)&&this._onDecorationRemoved.fire(t),s.dispose())}),this._decorations.insert(t),this._onDecorationRegistered.fire(t)}return t}reset(){for(const n of this._decorations.values())n.dispose();this._decorations.clear()}*getDecorationsAtCell(n,t,s){var f,v,u;let C=0,g=0;for(const m of this._decorations.getKeyIterator(t))C=(f=m.options.x)!==null&&f!==void 0?f:0,g=C+((v=m.options.width)!==null&&v!==void 0?v:1),n>=C&&n{var u,C,g;l.xmin=(u=v.options.x)!==null&&u!==void 0?u:0,l.xmax=l.xmin+((C=v.options.width)!==null&&C!==void 0?C:1),n>=l.xmin&&n=0;f--)(n=l[f])&&(s=(t<3?n(s):t>3?n(a,i,s):n(a,i))||s);return t>3&&s&&Object.defineProperty(a,i,s),s},d=this&&this.__param||function(l,a){return function(i,e){a(i,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.DirtyRowService=void 0;const c=h(2585);let _=class{constructor(l){this._bufferService=l,this.clearRange()}get start(){return this._start}get end(){return this._end}clearRange(){this._start=this._bufferService.buffer.y,this._end=this._bufferService.buffer.y}markDirty(l){lthis._end&&(this._end=l)}markRangeDirty(l,a){if(l>a){const i=l;l=a,a=i}lthis._end&&(this._end=a)}markAllDirty(){this.markRangeDirty(0,this._bufferService.rows-1)}};_=o([d(0,c.IBufferService)],_),r.DirtyRowService=_},4348:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InstantiationService=r.ServiceCollection=void 0;const o=h(2585),d=h(8343);class c{constructor(...l){this._entries=new Map;for(const[a,i]of l)this.set(a,i)}set(l,a){const i=this._entries.get(l);return this._entries.set(l,a),i}forEach(l){this._entries.forEach((a,i)=>l(i,a))}has(l){return this._entries.has(l)}get(l){return this._entries.get(l)}}r.ServiceCollection=c,r.InstantiationService=class{constructor(){this._services=new c,this._services.set(o.IInstantiationService,this)}setService(_,l){this._services.set(_,l)}getService(_){return this._services.get(_)}createInstance(_,...l){const a=(0,d.getServiceDependencies)(_).sort((n,t)=>n.index-t.index),i=[];for(const n of a){const t=this._services.get(n.id);if(!t)throw new Error(`[createInstance] ${_.name} depends on UNKNOWN service ${n.id}.`);i.push(t)}const e=a.length>0?a[0].index:l.length;if(l.length!==e)throw new Error(`[createInstance] First service dependency of ${_.name} at position ${e+1} conflicts with ${l.length} static arguments`);return new _(...l,...i)}}},7866:function(D,r,h){var o=this&&this.__decorate||function(a,i,e,n){var t,s=arguments.length,f=s<3?i:n===null?n=Object.getOwnPropertyDescriptor(i,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(a,i,e,n);else for(var v=a.length-1;v>=0;v--)(t=a[v])&&(f=(s<3?t(f):s>3?t(i,e,f):t(i,e))||f);return s>3&&f&&Object.defineProperty(i,e,f),f},d=this&&this.__param||function(a,i){return function(e,n){i(e,n,a)}};Object.defineProperty(r,"__esModule",{value:!0}),r.LogService=void 0;const c=h(2585),_={debug:c.LogLevelEnum.DEBUG,info:c.LogLevelEnum.INFO,warn:c.LogLevelEnum.WARN,error:c.LogLevelEnum.ERROR,off:c.LogLevelEnum.OFF};let l=class{constructor(a){this._optionsService=a,this.logLevel=c.LogLevelEnum.OFF,this._updateLogLevel(),this._optionsService.onOptionChange(i=>{i==="logLevel"&&this._updateLogLevel()})}_updateLogLevel(){this.logLevel=_[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(a){for(let i=0;i{Object.defineProperty(r,"__esModule",{value:!0}),r.OptionsService=r.DEFAULT_OPTIONS=void 0;const o=h(8460),d=h(6114);r.DEFAULT_OPTIONS={cols:80,rows:24,cursorBlink:!1,cursorStyle:"block",cursorWidth:1,customGlyphs:!0,drawBoldTextInBrightColors:!0,fastScrollModifier:"alt",fastScrollSensitivity:5,fontFamily:"courier-new, courier, monospace",fontSize:15,fontWeight:"normal",fontWeightBold:"bold",lineHeight:1,letterSpacing:0,linkHandler:null,logLevel:"info",scrollback:1e3,scrollSensitivity:1,screenReaderMode:!1,smoothScrollDuration:0,macOptionIsMeta:!1,macOptionClickForcesSelection:!1,minimumContrastRatio:1,disableStdin:!1,allowProposedApi:!1,allowTransparency:!1,tabStopWidth:8,theme:{},rightClickSelectsWord:d.isMac,windowOptions:{},windowsMode:!1,wordSeparator:" ()[]{}',\"`",altClickMovesCursor:!0,convertEol:!1,termName:"xterm",cancelEvents:!1,overviewRulerWidth:0};const c=["normal","bold","100","200","300","400","500","600","700","800","900"];r.OptionsService=class{constructor(_){this._onOptionChange=new o.EventEmitter;const l=Object.assign({},r.DEFAULT_OPTIONS);for(const a in _)if(a in l)try{const i=_[a];l[a]=this._sanitizeAndValidateOption(a,i)}catch{}this.rawOptions=l,this.options=Object.assign({},l),this._setupOptions()}get onOptionChange(){return this._onOptionChange.event}_setupOptions(){const _=a=>{if(!(a in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${a}"`);return this.rawOptions[a]},l=(a,i)=>{if(!(a in r.DEFAULT_OPTIONS))throw new Error(`No option with key "${a}"`);i=this._sanitizeAndValidateOption(a,i),this.rawOptions[a]!==i&&(this.rawOptions[a]=i,this._onOptionChange.fire(a))};for(const a in this.rawOptions){const i={get:_.bind(this,a),set:l.bind(this,a)};Object.defineProperty(this.options,a,i)}}_sanitizeAndValidateOption(_,l){switch(_){case"cursorStyle":if(l||(l=r.DEFAULT_OPTIONS[_]),!function(a){return a==="block"||a==="underline"||a==="bar"}(l))throw new Error(`"${l}" is not a valid value for ${_}`);break;case"wordSeparator":l||(l=r.DEFAULT_OPTIONS[_]);break;case"fontWeight":case"fontWeightBold":if(typeof l=="number"&&1<=l&&l<=1e3)break;l=c.includes(l)?l:r.DEFAULT_OPTIONS[_];break;case"cursorWidth":l=Math.floor(l);case"lineHeight":case"tabStopWidth":if(l<1)throw new Error(`${_} cannot be less than 1, value: ${l}`);break;case"minimumContrastRatio":l=Math.max(1,Math.min(21,Math.round(10*l)/10));break;case"scrollback":if((l=Math.min(l,4294967295))<0)throw new Error(`${_} cannot be less than 0, value: ${l}`);break;case"fastScrollSensitivity":case"scrollSensitivity":if(l<=0)throw new Error(`${_} cannot be less than or equal to 0, value: ${l}`);case"rows":case"cols":if(!l&&l!==0)throw new Error(`${_} must be numeric, value: ${l}`)}return l}}},2660:function(D,r,h){var o=this&&this.__decorate||function(l,a,i,e){var n,t=arguments.length,s=t<3?a:e===null?e=Object.getOwnPropertyDescriptor(a,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(l,a,i,e);else for(var f=l.length-1;f>=0;f--)(n=l[f])&&(s=(t<3?n(s):t>3?n(a,i,s):n(a,i))||s);return t>3&&s&&Object.defineProperty(a,i,s),s},d=this&&this.__param||function(l,a){return function(i,e){a(i,e,l)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkService=void 0;const c=h(2585);let _=class{constructor(l){this._bufferService=l,this._nextId=1,this._entriesWithId=new Map,this._dataByLinkId=new Map}registerLink(l){const a=this._bufferService.buffer;if(l.id===void 0){const f=a.addMarker(a.ybase+a.y),v={data:l,id:this._nextId++,lines:[f]};return f.onDispose(()=>this._removeMarkerFromLink(v,f)),this._dataByLinkId.set(v.id,v),v.id}const i=l,e=this._getEntryIdKey(i),n=this._entriesWithId.get(e);if(n)return this.addLineToLink(n.id,a.ybase+a.y),n.id;const t=a.addMarker(a.ybase+a.y),s={id:this._nextId++,key:this._getEntryIdKey(i),data:i,lines:[t]};return t.onDispose(()=>this._removeMarkerFromLink(s,t)),this._entriesWithId.set(s.key,s),this._dataByLinkId.set(s.id,s),s.id}addLineToLink(l,a){const i=this._dataByLinkId.get(l);if(i&&i.lines.every(e=>e.line!==a)){const e=this._bufferService.buffer.addMarker(a);i.lines.push(e),e.onDispose(()=>this._removeMarkerFromLink(i,e))}}getLinkData(l){var a;return(a=this._dataByLinkId.get(l))===null||a===void 0?void 0:a.data}_getEntryIdKey(l){return`${l.id};;${l.uri}`}_removeMarkerFromLink(l,a){const i=l.lines.indexOf(a);i!==-1&&(l.lines.splice(i,1),l.lines.length===0&&(l.data.id!==void 0&&this._entriesWithId.delete(l.key),this._dataByLinkId.delete(l.id)))}};_=o([d(0,c.IBufferService)],_),r.OscLinkService=_},8343:(D,r)=>{function h(o,d,c){d.di$target===d?d.di$dependencies.push({id:o,index:c}):(d.di$dependencies=[{id:o,index:c}],d.di$target=d)}Object.defineProperty(r,"__esModule",{value:!0}),r.createDecorator=r.getServiceDependencies=r.serviceRegistry=void 0,r.serviceRegistry=new Map,r.getServiceDependencies=function(o){return o.di$dependencies||[]},r.createDecorator=function(o){if(r.serviceRegistry.has(o))return r.serviceRegistry.get(o);const d=function(c,_,l){if(arguments.length!==3)throw new Error("@IServiceName-decorator can only be used to decorate a parameter");h(d,c,l)};return d.toString=()=>o,r.serviceRegistry.set(o,d),d}},2585:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IDecorationService=r.IUnicodeService=r.IOscLinkService=r.IOptionsService=r.ILogService=r.LogLevelEnum=r.IInstantiationService=r.IDirtyRowService=r.ICharsetService=r.ICoreService=r.ICoreMouseService=r.IBufferService=void 0;const o=h(8343);var d;r.IBufferService=(0,o.createDecorator)("BufferService"),r.ICoreMouseService=(0,o.createDecorator)("CoreMouseService"),r.ICoreService=(0,o.createDecorator)("CoreService"),r.ICharsetService=(0,o.createDecorator)("CharsetService"),r.IDirtyRowService=(0,o.createDecorator)("DirtyRowService"),r.IInstantiationService=(0,o.createDecorator)("InstantiationService"),(d=r.LogLevelEnum||(r.LogLevelEnum={}))[d.DEBUG=0]="DEBUG",d[d.INFO=1]="INFO",d[d.WARN=2]="WARN",d[d.ERROR=3]="ERROR",d[d.OFF=4]="OFF",r.ILogService=(0,o.createDecorator)("LogService"),r.IOptionsService=(0,o.createDecorator)("OptionsService"),r.IOscLinkService=(0,o.createDecorator)("OscLinkService"),r.IUnicodeService=(0,o.createDecorator)("UnicodeService"),r.IDecorationService=(0,o.createDecorator)("DecorationService")},1480:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnicodeService=void 0;const o=h(8460),d=h(225);r.UnicodeService=class{constructor(){this._providers=Object.create(null),this._active="",this._onChange=new o.EventEmitter;const c=new d.UnicodeV6;this.register(c),this._active=c.version,this._activeProvider=c}get onChange(){return this._onChange.event}get versions(){return Object.keys(this._providers)}get activeVersion(){return this._active}set activeVersion(c){if(!this._providers[c])throw new Error(`unknown Unicode version "${c}"`);this._active=c,this._activeProvider=this._providers[c],this._onChange.fire(c)}register(c){this._providers[c.version]=c}wcwidth(c){return this._activeProvider.wcwidth(c)}getStringCellWidth(c){let _=0;const l=c.length;for(let a=0;a=l)return _+this.wcwidth(i);const e=c.charCodeAt(a);56320<=e&&e<=57343?i=1024*(i-55296)+e-56320+65536:_+=this.wcwidth(e)}_+=this.wcwidth(i)}return _}}}},J={};function j(D){var r=J[D];if(r!==void 0)return r.exports;var h=J[D]={exports:{}};return ee[D].call(h.exports,h,h.exports,j),h.exports}var se={};return(()=>{var D=se;Object.defineProperty(D,"__esModule",{value:!0}),D.Terminal=void 0;const r=j(3236),h=j(9042),o=j(7975),d=j(7090),c=j(5741),_=j(8285),l=["cols","rows"];D.Terminal=class{constructor(a){this._core=new r.Terminal(a),this._addonManager=new c.AddonManager,this._publicOptions=Object.assign({},this._core.options);const i=n=>this._core.options[n],e=(n,t)=>{this._checkReadonlyOptions(n),this._core.options[n]=t};for(const n in this._core.options){const t={get:i.bind(this,n),set:e.bind(this,n)};Object.defineProperty(this._publicOptions,n,t)}}_checkReadonlyOptions(a){if(l.includes(a))throw new Error(`Option "${a}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.rawOptions.allowProposedApi)throw new Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onKey(){return this._core.onKey}get onLineFeed(){return this._core.onLineFeed}get onRender(){return this._core.onRender}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onSelectionChange(){return this._core.onSelectionChange}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get element(){return this._core.element}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new o.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new d.UnicodeApi(this._core)}get textarea(){return this._core.textarea}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=new _.BufferNamespaceApi(this._core)),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){const a=this._core.coreService.decPrivateModes;let i="none";switch(this._core.coreMouseService.activeProtocol){case"X10":i="x10";break;case"VT200":i="vt200";break;case"DRAG":i="drag";break;case"ANY":i="any"}return{applicationCursorKeysMode:a.applicationCursorKeys,applicationKeypadMode:a.applicationKeypad,bracketedPasteMode:a.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:i,originMode:a.origin,reverseWraparoundMode:a.reverseWraparound,sendFocusMode:a.sendFocus,wraparoundMode:a.wraparound}}get options(){return this._publicOptions}set options(a){for(const i in a)this._publicOptions[i]=a[i]}blur(){this._core.blur()}focus(){this._core.focus()}resize(a,i){this._verifyIntegers(a,i),this._core.resize(a,i)}open(a){this._core.open(a)}attachCustomKeyEventHandler(a){this._core.attachCustomKeyEventHandler(a)}registerLinkProvider(a){return this._checkProposedApi(),this._core.registerLinkProvider(a)}registerCharacterJoiner(a){return this._checkProposedApi(),this._core.registerCharacterJoiner(a)}deregisterCharacterJoiner(a){this._checkProposedApi(),this._core.deregisterCharacterJoiner(a)}registerMarker(a=0){return this._verifyIntegers(a),this._core.addMarker(a)}registerDecoration(a){var i,e,n;return this._checkProposedApi(),this._verifyPositiveIntegers((i=a.x)!==null&&i!==void 0?i:0,(e=a.width)!==null&&e!==void 0?e:0,(n=a.height)!==null&&n!==void 0?n:0),this._core.registerDecoration(a)}hasSelection(){return this._core.hasSelection()}select(a,i,e){this._verifyIntegers(a,i,e),this._core.select(a,i,e)}getSelection(){return this._core.getSelection()}getSelectionPosition(){return this._core.getSelectionPosition()}clearSelection(){this._core.clearSelection()}selectAll(){this._core.selectAll()}selectLines(a,i){this._verifyIntegers(a,i),this._core.selectLines(a,i)}dispose(){this._addonManager.dispose(),this._core.dispose()}scrollLines(a){this._verifyIntegers(a),this._core.scrollLines(a)}scrollPages(a){this._verifyIntegers(a),this._core.scrollPages(a)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(a){this._verifyIntegers(a),this._core.scrollToLine(a)}clear(){this._core.clear()}write(a,i){this._core.write(a,i)}writeln(a,i){this._core.write(a),this._core.write(`\r +`,i)}paste(a){this._core.paste(a)}refresh(a,i){this._verifyIntegers(a,i),this._core.refresh(a,i)}reset(){this._core.reset()}clearTextureAtlas(){this._core.clearTextureAtlas()}loadAddon(a){return this._addonManager.loadAddon(this,a)}static get strings(){return h}_verifyIntegers(...a){for(const i of a)if(i===1/0||isNaN(i)||i%1!=0)throw new Error("This API only accepts integers")}_verifyPositiveIntegers(...a){for(const i of a)if(i&&(i===1/0||isNaN(i)||i%1!=0||i<0))throw new Error("This API only accepts positive integers")}}})(),se})()})})(Se);var Ae={exports:{}};(function(X,z){(function(ee,J){X.exports=J()})(self,function(){return(()=>{var ee={};return(()=>{var J=ee;Object.defineProperty(J,"__esModule",{value:!0}),J.FitAddon=void 0,J.FitAddon=class{constructor(){}activate(j){this._terminal=j}dispose(){}fit(){const j=this.proposeDimensions();if(!j||!this._terminal||isNaN(j.cols)||isNaN(j.rows))return;const se=this._terminal._core;this._terminal.rows===j.rows&&this._terminal.cols===j.cols||(se._renderService.clear(),this._terminal.resize(j.cols,j.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const j=this._terminal._core;if(j._renderService.dimensions.actualCellWidth===0||j._renderService.dimensions.actualCellHeight===0)return;const se=this._terminal.options.scrollback===0?0:j.viewport.scrollBarWidth,D=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(D.getPropertyValue("height")),h=Math.max(0,parseInt(D.getPropertyValue("width"))),o=window.getComputedStyle(this._terminal.element),d=r-(parseInt(o.getPropertyValue("padding-top"))+parseInt(o.getPropertyValue("padding-bottom"))),c=h-(parseInt(o.getPropertyValue("padding-right"))+parseInt(o.getPropertyValue("padding-left")))-se;return{cols:Math.max(2,Math.floor(c/j._renderService.dimensions.actualCellWidth)),rows:Math.max(1,Math.floor(d/j._renderService.dimensions.actualCellHeight))}}}})(),ee})()})})(Ae);var De={exports:{}};(function(X,z){(function(ee,J){X.exports=J()})(self,function(){return(()=>{var ee={965:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GlyphRenderer=void 0;const o=h(381),d=h(455),c=h(855),_=h(859),l=10,a=l*Float32Array.BYTES_PER_ELEMENT,i={i:0,glyph:void 0,leftCellPadding:0,clippedPixels:0};class e extends _.Disposable{constructor(t,s,f,v){super(),this._terminal=t,this._colors=s,this._gl=f,this._dimensions=v,this._activeBuffer=0,this._vertices={count:0,attributes:new Float32Array(0),attributesBuffers:[new Float32Array(0),new Float32Array(0)]};const u=this._gl;this._program=(0,o.throwIfFalsy)((0,o.createProgram)(u,`#version 300 es +layout (location = 0) in vec2 a_unitquad; +layout (location = 1) in vec2 a_cellpos; +layout (location = 2) in vec2 a_offset; +layout (location = 3) in vec2 a_size; +layout (location = 4) in vec2 a_texcoord; +layout (location = 5) in vec2 a_texsize; + +uniform mat4 u_projection; +uniform vec2 u_resolution; + +out vec2 v_texcoord; + +void main() { + vec2 zeroToOne = (a_offset / u_resolution) + a_cellpos + (a_unitquad * a_size); + gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0); + v_texcoord = a_texcoord + a_unitquad * a_texsize; +}`,`#version 300 es +precision lowp float; + +in vec2 v_texcoord; + +uniform sampler2D u_texture; + +out vec4 outColor; + +void main() { + outColor = texture(u_texture, v_texcoord); +}`)),this.register((0,_.toDisposable)(()=>u.deleteProgram(this._program))),this._projectionLocation=(0,o.throwIfFalsy)(u.getUniformLocation(this._program,"u_projection")),this._resolutionLocation=(0,o.throwIfFalsy)(u.getUniformLocation(this._program,"u_resolution")),this._textureLocation=(0,o.throwIfFalsy)(u.getUniformLocation(this._program,"u_texture")),this._vertexArrayObject=u.createVertexArray(),u.bindVertexArray(this._vertexArrayObject);const C=new Float32Array([0,0,1,0,0,1,1,1]),g=u.createBuffer();this.register((0,_.toDisposable)(()=>u.deleteBuffer(g))),u.bindBuffer(u.ARRAY_BUFFER,g),u.bufferData(u.ARRAY_BUFFER,C,u.STATIC_DRAW),u.enableVertexAttribArray(0),u.vertexAttribPointer(0,2,this._gl.FLOAT,!1,0,0);const m=new Uint8Array([0,1,3,0,2,3]),b=u.createBuffer();this.register((0,_.toDisposable)(()=>u.deleteBuffer(b))),u.bindBuffer(u.ELEMENT_ARRAY_BUFFER,b),u.bufferData(u.ELEMENT_ARRAY_BUFFER,m,u.STATIC_DRAW),this._attributesBuffer=(0,o.throwIfFalsy)(u.createBuffer()),this.register((0,_.toDisposable)(()=>u.deleteBuffer(this._attributesBuffer))),u.bindBuffer(u.ARRAY_BUFFER,this._attributesBuffer),u.enableVertexAttribArray(2),u.vertexAttribPointer(2,2,u.FLOAT,!1,a,0),u.vertexAttribDivisor(2,1),u.enableVertexAttribArray(3),u.vertexAttribPointer(3,2,u.FLOAT,!1,a,2*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(3,1),u.enableVertexAttribArray(4),u.vertexAttribPointer(4,2,u.FLOAT,!1,a,4*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(4,1),u.enableVertexAttribArray(5),u.vertexAttribPointer(5,2,u.FLOAT,!1,a,6*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(5,1),u.enableVertexAttribArray(1),u.vertexAttribPointer(1,2,u.FLOAT,!1,a,8*Float32Array.BYTES_PER_ELEMENT),u.vertexAttribDivisor(1,1),this._atlasTexture=(0,o.throwIfFalsy)(u.createTexture()),this.register((0,_.toDisposable)(()=>u.deleteTexture(this._atlasTexture))),u.bindTexture(u.TEXTURE_2D,this._atlasTexture),u.texImage2D(u.TEXTURE_2D,0,u.RGBA,1,1,0,u.RGBA,u.UNSIGNED_BYTE,new Uint8Array([0,0,255,255])),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.enable(u.BLEND),u.blendFunc(u.SRC_ALPHA,u.ONE_MINUS_SRC_ALPHA),this.onResize()}beginFrame(){return!this._atlas||this._atlas.beginFrame()}updateCell(t,s,f,v,u,C,g,m){this._updateCell(this._vertices.attributes,t,s,f,v,u,C,g,m)}_updateCell(t,s,f,v,u,C,g,m,b){i.i=(f*this._terminal.cols+s)*l,v!==c.NULL_CELL_CODE&&v!==void 0?this._atlas&&(m&&m.length>1?i.glyph=this._atlas.getRasterizedGlyphCombinedChar(m,u,C,g):i.glyph=this._atlas.getRasterizedGlyph(v,u,C,g),i.leftCellPadding=Math.floor((this._dimensions.scaledCellWidth-this._dimensions.scaledCharWidth)/2),u!==b&&i.glyph.offset.x>i.leftCellPadding?(i.clippedPixels=i.glyph.offset.x-i.leftCellPadding,t[i.i]=-(i.glyph.offset.x-i.clippedPixels)+this._dimensions.scaledCharLeft,t[i.i+1]=-i.glyph.offset.y+this._dimensions.scaledCharTop,t[i.i+2]=(i.glyph.size.x-i.clippedPixels)/this._dimensions.scaledCanvasWidth,t[i.i+3]=i.glyph.size.y/this._dimensions.scaledCanvasHeight,t[i.i+4]=i.glyph.texturePositionClipSpace.x+i.clippedPixels/this._atlas.cacheCanvas.width,t[i.i+5]=i.glyph.texturePositionClipSpace.y,t[i.i+6]=i.glyph.sizeClipSpace.x-i.clippedPixels/this._atlas.cacheCanvas.width,t[i.i+7]=i.glyph.sizeClipSpace.y):(t[i.i]=-i.glyph.offset.x+this._dimensions.scaledCharLeft,t[i.i+1]=-i.glyph.offset.y+this._dimensions.scaledCharTop,t[i.i+2]=i.glyph.size.x/this._dimensions.scaledCanvasWidth,t[i.i+3]=i.glyph.size.y/this._dimensions.scaledCanvasHeight,t[i.i+4]=i.glyph.texturePositionClipSpace.x,t[i.i+5]=i.glyph.texturePositionClipSpace.y,t[i.i+6]=i.glyph.sizeClipSpace.x,t[i.i+7]=i.glyph.sizeClipSpace.y)):(0,d.fill)(t,0,i.i,i.i+l-1-2)}clear(){const t=this._terminal,s=t.cols*t.rows*l;this._vertices.count!==s?this._vertices.attributes=new Float32Array(s):this._vertices.attributes.fill(0);for(let v=0;v{Object.defineProperty(r,"__esModule",{value:!0}),r.RectangleRenderer=void 0;const o=h(381),d=h(310),c=h(859),_=h(302),l=8*Float32Array.BYTES_PER_ELEMENT,a={rgba:0,isDefault:!1,x1:0,y1:0,r:0,g:0,b:0,a:0};class i extends c.Disposable{constructor(n,t,s,f){super(),this._terminal=n,this._colors=t,this._gl=s,this._dimensions=f,this._vertices={count:0,attributes:new Float32Array(160)};const v=this._gl;this._program=(0,o.throwIfFalsy)((0,o.createProgram)(v,`#version 300 es +layout (location = 0) in vec2 a_position; +layout (location = 1) in vec2 a_size; +layout (location = 2) in vec4 a_color; +layout (location = 3) in vec2 a_unitquad; + +uniform mat4 u_projection; + +out vec4 v_color; + +void main() { + vec2 zeroToOne = a_position + (a_unitquad * a_size); + gl_Position = u_projection * vec4(zeroToOne, 0.0, 1.0); + v_color = a_color; +}`,`#version 300 es +precision lowp float; + +in vec4 v_color; + +out vec4 outColor; + +void main() { + outColor = v_color; +}`)),this.register((0,c.toDisposable)(()=>v.deleteProgram(this._program))),this._projectionLocation=(0,o.throwIfFalsy)(v.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=v.createVertexArray(),v.bindVertexArray(this._vertexArrayObject);const u=new Float32Array([0,0,1,0,0,1,1,1]),C=v.createBuffer();this.register((0,c.toDisposable)(()=>v.deleteBuffer(C))),v.bindBuffer(v.ARRAY_BUFFER,C),v.bufferData(v.ARRAY_BUFFER,u,v.STATIC_DRAW),v.enableVertexAttribArray(3),v.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);const g=new Uint8Array([0,1,3,0,2,3]),m=v.createBuffer();this.register((0,c.toDisposable)(()=>v.deleteBuffer(m))),v.bindBuffer(v.ELEMENT_ARRAY_BUFFER,m),v.bufferData(v.ELEMENT_ARRAY_BUFFER,g,v.STATIC_DRAW),this._attributesBuffer=(0,o.throwIfFalsy)(v.createBuffer()),this.register((0,c.toDisposable)(()=>v.deleteBuffer(this._attributesBuffer))),v.bindBuffer(v.ARRAY_BUFFER,this._attributesBuffer),v.enableVertexAttribArray(0),v.vertexAttribPointer(0,2,v.FLOAT,!1,l,0),v.vertexAttribDivisor(0,1),v.enableVertexAttribArray(1),v.vertexAttribPointer(1,2,v.FLOAT,!1,l,2*Float32Array.BYTES_PER_ELEMENT),v.vertexAttribDivisor(1,1),v.enableVertexAttribArray(2),v.vertexAttribPointer(2,4,v.FLOAT,!1,l,4*Float32Array.BYTES_PER_ELEMENT),v.vertexAttribDivisor(2,1),this._updateCachedColors()}render(){const n=this._gl;n.useProgram(this._program),n.bindVertexArray(this._vertexArrayObject),n.uniformMatrix4fv(this._projectionLocation,!1,o.PROJECTION_MATRIX),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.bufferData(n.ARRAY_BUFFER,this._vertices.attributes,n.DYNAMIC_DRAW),n.drawElementsInstanced(this._gl.TRIANGLES,6,n.UNSIGNED_BYTE,0,this._vertices.count)}onResize(){this._updateViewportRectangle()}setColors(){this._updateCachedColors(),this._updateViewportRectangle()}setDimensions(n){this._dimensions=n}_updateCachedColors(){this._bgFloat=this._colorToFloat32Array(this._colors.background)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.scaledCellWidth,this._terminal.rows*this._dimensions.scaledCellHeight,this._bgFloat)}updateBackgrounds(n){const t=this._terminal,s=this._vertices;let f,v,u,C,g,m,b,y,w,p,S,L=1;for(f=0;f>24&255)/255,a.g=(a.rgba>>16&255)/255,a.b=(a.rgba>>8&255)/255,a.a=!a.isDefault&&134217728&f?_.DIM_OPACITY:1,this._addRectangle(n.attributes,t,a.x1,a.y1,(u-v)*this._dimensions.scaledCellWidth,this._dimensions.scaledCellHeight,a.r,a.g,a.b,a.a)}_addRectangle(n,t,s,f,v,u,C,g,m,b){n[t]=s/this._dimensions.scaledCanvasWidth,n[t+1]=f/this._dimensions.scaledCanvasHeight,n[t+2]=v/this._dimensions.scaledCanvasWidth,n[t+3]=u/this._dimensions.scaledCanvasHeight,n[t+4]=C,n[t+5]=g,n[t+6]=m,n[t+7]=b}_addRectangleFloat(n,t,s,f,v,u,C){n[t]=s/this._dimensions.scaledCanvasWidth,n[t+1]=f/this._dimensions.scaledCanvasHeight,n[t+2]=v/this._dimensions.scaledCanvasWidth,n[t+3]=u/this._dimensions.scaledCanvasHeight,n[t+4]=C[0],n[t+5]=C[1],n[t+6]=C[2],n[t+7]=C[3]}_colorToFloat32Array(n){return new Float32Array([(n.rgba>>24&255)/255,(n.rgba>>16&255)/255,(n.rgba>>8&255)/255,(255&n.rgba)/255])}}r.RectangleRenderer=i},310:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.RenderModel=r.COMBINED_CHAR_BIT_MASK=r.RENDER_MODEL_EXT_OFFSET=r.RENDER_MODEL_FG_OFFSET=r.RENDER_MODEL_BG_OFFSET=r.RENDER_MODEL_INDICIES_PER_CELL=void 0;const o=h(455);r.RENDER_MODEL_INDICIES_PER_CELL=4,r.RENDER_MODEL_BG_OFFSET=1,r.RENDER_MODEL_FG_OFFSET=2,r.RENDER_MODEL_EXT_OFFSET=3,r.COMBINED_CHAR_BIT_MASK=2147483648,r.RenderModel=class{constructor(){this.cells=new Uint32Array(0),this.lineLengths=new Uint32Array(0),this.selection={hasSelection:!1,columnSelectMode:!1,viewportStartRow:0,viewportEndRow:0,viewportCappedStartRow:0,viewportCappedEndRow:0,startCol:0,endCol:0}}resize(d,c){const _=d*c*r.RENDER_MODEL_INDICIES_PER_CELL;_!==this.cells.length&&(this.cells=new Uint32Array(_),this.lineLengths=new Uint32Array(c))}clear(){(0,o.fill)(this.cells,0,0),(0,o.fill)(this.lineLengths,0,0)}clearSelection(){this.selection.hasSelection=!1,this.selection.viewportStartRow=0,this.selection.viewportEndRow=0,this.selection.viewportCappedStartRow=0,this.selection.viewportCappedEndRow=0,this.selection.startCol=0,this.selection.endCol=0}}},666:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.JoinedCellData=r.WebglRenderer=void 0;const o=h(965),d=h(733),c=h(461),_=h(713),l=h(742),a=h(310),i=h(859),e=h(855),n=h(476),t=h(345),s=h(782),f=h(820),v=h(147),u={fg:0,bg:0,hasFg:!1,hasBg:!1,isSelected:!1};class C extends i.Disposable{constructor(b,y,w,p,S,L,E){super(),this._terminal=b,this._colors=y,this._characterJoinerService=w,this._coreBrowserService=p,this._decorationService=L,this._model=new a.RenderModel,this._workCell=new s.CellData,this._workColors={fg:0,bg:0,ext:0},this._onChangeTextureAtlas=new t.EventEmitter,this._onRequestRedraw=new t.EventEmitter,this._onContextLoss=new t.EventEmitter,this._core=this._terminal._core,this._renderLayers=[new d.LinkRenderLayer(this._core.screenElement,2,this._colors,this._core,this._coreBrowserService),new c.CursorRenderLayer(b,this._core.screenElement,3,this._colors,this._onRequestRedraw,this._coreBrowserService,S)],this.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},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._canvas=document.createElement("canvas");const A={antialias:!1,depth:!1,preserveDrawingBuffer:E};if(this._gl=this._canvas.getContext("webgl2",A),!this._gl)throw new Error("WebGL2 not supported "+this._gl);this.register((0,f.addDisposableDomListener)(this._canvas,"webglcontextlost",k=>{k.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,this._onContextLoss.fire(k)},3e3)})),this.register((0,f.addDisposableDomListener)(this._canvas,"webglcontextrestored",k=>{clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,(0,_.removeTerminalFromCache)(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this.register((0,n.observeDevicePixelDimensions)(this._canvas,this._coreBrowserService.window,(k,O)=>this._setCanvasDevicePixelDimensions(k,O))),this._core.screenElement.appendChild(this._canvas),this._initializeWebGLState(),this._isAttached=this._coreBrowserService.window.document.body.contains(this._core.screenElement)}get onChangeTextureAtlas(){return this._onChangeTextureAtlas.event}get onRequestRedraw(){return this._onRequestRedraw.event}get onContextLoss(){return this._onContextLoss.event}dispose(){var b;for(const y of this._renderLayers)y.dispose();(b=this._canvas.parentElement)===null||b===void 0||b.removeChild(this._canvas),(0,_.removeTerminalFromCache)(this._terminal),super.dispose()}get textureAtlas(){var b;return(b=this._charAtlas)===null||b===void 0?void 0:b.cacheCanvas}setColors(b){this._colors=b;for(const y of this._renderLayers)y.setColors(this._terminal,this._colors),y.reset(this._terminal);this._rectangleRenderer.setColors(),this._refreshCharAtlas(),this._clearModel(!0)}onDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.onResize(this._terminal.cols,this._terminal.rows))}onResize(b,y){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(const w of this._renderLayers)w.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.scaledCanvasWidth,this._canvas.height=this.dimensions.scaledCanvasHeight,this._canvas.style.width=`${this.dimensions.canvasWidth}px`,this._canvas.style.height=`${this.dimensions.canvasHeight}px`,this._core.screenElement.style.width=`${this.dimensions.canvasWidth}px`,this._core.screenElement.style.height=`${this.dimensions.canvasHeight}px`,this._rectangleRenderer.setDimensions(this.dimensions),this._rectangleRenderer.onResize(),this._glyphRenderer.setDimensions(this.dimensions),this._glyphRenderer.onResize(),this._refreshCharAtlas(),this._clearModel(!1)}onCharSizeChanged(){this.onResize(this._terminal.cols,this._terminal.rows)}onBlur(){for(const b of this._renderLayers)b.onBlur(this._terminal);this._requestRedrawViewport()}onFocus(){for(const b of this._renderLayers)b.onFocus(this._terminal);this._requestRedrawViewport()}onSelectionChanged(b,y,w){for(const p of this._renderLayers)p.onSelectionChanged(this._terminal,b,y,w);this._updateSelectionModel(b,y,w),this._requestRedrawViewport()}onCursorMove(){for(const b of this._renderLayers)b.onCursorMove(this._terminal)}onOptionsChanged(){for(const b of this._renderLayers)b.onOptionsChanged(this._terminal);this._updateDimensions(),this._refreshCharAtlas()}_initializeWebGLState(){var b,y;(b=this._rectangleRenderer)===null||b===void 0||b.dispose(),(y=this._glyphRenderer)===null||y===void 0||y.dispose(),this._rectangleRenderer=new l.RectangleRenderer(this._terminal,this._colors,this._gl,this.dimensions),this._glyphRenderer=new o.GlyphRenderer(this._terminal,this._colors,this._gl,this.dimensions),this.onCharSizeChanged()}_refreshCharAtlas(){if(this.dimensions.scaledCharWidth<=0&&this.dimensions.scaledCharHeight<=0)return void(this._isAttached=!1);const b=(0,_.acquireCharAtlas)(this._terminal,this._colors,this.dimensions.scaledCellWidth,this.dimensions.scaledCellHeight,this.dimensions.scaledCharWidth,this.dimensions.scaledCharHeight,this._coreBrowserService.dpr);if(!("getRasterizedGlyph"in b))throw new Error("The webgl renderer only works with the webgl char atlas");this._charAtlas!==b&&this._onChangeTextureAtlas.fire(b.cacheCanvas),this._charAtlas=b,this._charAtlas.warmUp(),this._glyphRenderer.setAtlas(this._charAtlas)}_clearModel(b){this._model.clear(),b&&this._glyphRenderer.clear()}clearCharAtlas(){var b;(b=this._charAtlas)===null||b===void 0||b.clearTexture(),this._clearModel(!0),this._updateModel(0,this._terminal.rows-1),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(const b of this._renderLayers)b.reset(this._terminal)}registerCharacterJoiner(b){return-1}deregisterCharacterJoiner(b){return!1}renderRows(b,y){if(!this._isAttached){if(!(this._coreBrowserService.window.document.body.contains(this._core.screenElement)&&this._core._charSizeService.width&&this._core._charSizeService.height))return;this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0}for(const w of this._renderLayers)w.onGridChanged(this._terminal,b,y);this._glyphRenderer.beginFrame()&&(this._clearModel(!0),this._updateSelectionModel(void 0,void 0)),this._updateModel(b,y),this._rectangleRenderer.render(),this._glyphRenderer.render(this._model)}_updateModel(b,y){const w=this._core;let p,S,L,E,A,k,O,T,H,W,x,B,P,R=this._workCell;for(S=b;S<=y;S++)for(L=S+w.buffer.ydisp,E=w.buffer.lines.get(L),this._model.lineLengths[S]=0,A=this._characterJoinerService.getJoinedCharacters(L),B=0;B0&&B===A[0][0]&&(k=!0,T=A.shift(),R=new g(R,E.translateToString(!0,T[0],T[1]),T[1]-T[0]),O=T[1]-1),H=R.getChars(),W=R.getCode(),x=(S*w.cols+B)*a.RENDER_MODEL_INDICIES_PER_CELL,this._loadColorsForCell(B,L),W!==e.NULL_CELL_CODE&&(this._model.lineLengths[S]=B+1),(this._model.cells[x]!==W||this._model.cells[x+a.RENDER_MODEL_BG_OFFSET]!==this._workColors.bg||this._model.cells[x+a.RENDER_MODEL_FG_OFFSET]!==this._workColors.fg||this._model.cells[x+a.RENDER_MODEL_EXT_OFFSET]!==this._workColors.ext)&&(H.length>1&&(W|=a.COMBINED_CHAR_BIT_MASK),this._model.cells[x]=W,this._model.cells[x+a.RENDER_MODEL_BG_OFFSET]=this._workColors.bg,this._model.cells[x+a.RENDER_MODEL_FG_OFFSET]=this._workColors.fg,this._model.cells[x+a.RENDER_MODEL_EXT_OFFSET]=this._workColors.ext,this._glyphRenderer.updateCell(B,S,W,this._workColors.bg,this._workColors.fg,this._workColors.ext,H,p),k))for(R=this._workCell,B++;B{w.backgroundColorRGB&&(u.bg=w.backgroundColorRGB.rgba>>8&16777215,u.hasBg=!0),w.foregroundColorRGB&&(u.fg=w.foregroundColorRGB.rgba>>8&16777215,u.hasFg=!0)}),u.isSelected=this._isCellSelected(b,y),u.isSelected&&(u.bg=(this._coreBrowserService.isFocused?this._colors.selectionBackgroundOpaque:this._colors.selectionInactiveBackgroundOpaque).rgba>>8&16777215,u.hasBg=!0,this._colors.selectionForeground&&(u.fg=this._colors.selectionForeground.rgba>>8&16777215,u.hasFg=!0)),this._decorationService.forEachDecorationAtCell(b,y,"top",w=>{w.backgroundColorRGB&&(u.bg=w.backgroundColorRGB.rgba>>8&16777215,u.hasBg=!0),w.foregroundColorRGB&&(u.fg=w.foregroundColorRGB.rgba>>8&16777215,u.hasFg=!0)}),u.hasBg&&(u.isSelected?u.bg=-16777216&this._workCell.bg&-134217729|u.bg|50331648:u.bg=-16777216&this._workCell.bg|u.bg|50331648),u.hasFg&&(u.fg=-16777216&this._workCell.fg&-67108865|u.fg|50331648),67108864&this._workColors.fg&&(u.hasBg&&!u.hasFg&&((50331648&this._workColors.bg)==0?u.fg=-134217728&this._workColors.fg|16777215&this._colors.background.rgba>>8|50331648:u.fg=-134217728&this._workColors.fg|67108863&this._workColors.bg,u.hasFg=!0),!u.hasBg&&u.hasFg&&((50331648&this._workColors.fg)==0?u.bg=-67108864&this._workColors.bg|16777215&this._colors.foreground.rgba>>8|50331648:u.bg=-67108864&this._workColors.bg|67108863&this._workColors.fg,u.hasBg=!0)),this._workColors.bg=u.hasBg?u.bg:this._workColors.bg,this._workColors.fg=u.hasFg?u.fg:this._workColors.fg}_isCellSelected(b,y){return!!this._model.selection.hasSelection&&(y-=this._terminal.buffer.active.viewportY,this._model.selection.columnSelectMode?this._model.selection.startCol<=this._model.selection.endCol?b>=this._model.selection.startCol&&y>=this._model.selection.viewportCappedStartRow&&b=this._model.selection.viewportCappedStartRow&&b>=this._model.selection.endCol&&y<=this._model.selection.viewportCappedEndRow:y>this._model.selection.viewportStartRow&&y=this._model.selection.startCol&&b=this._model.selection.startCol)}_updateSelectionModel(b,y,w=!1){const p=this._terminal;if(!b||!y||b[0]===y[0]&&b[1]===y[1])return void this._model.clearSelection();const S=b[1]-p.buffer.active.viewportY,L=y[1]-p.buffer.active.viewportY,E=Math.max(S,0),A=Math.min(L,p.rows-1);E>=p.rows||A<0?this._model.clearSelection():(this._model.selection.hasSelection=!0,this._model.selection.columnSelectMode=w,this._model.selection.viewportStartRow=S,this._model.selection.viewportEndRow=L,this._model.selection.viewportCappedStartRow=E,this._model.selection.viewportCappedEndRow=A,this._model.selection.startCol=b[0],this._model.selection.endCol=y[0])}_updateDimensions(){this._core._charSizeService.width&&this._core._charSizeService.height&&(this.dimensions.scaledCharWidth=Math.floor(this._core._charSizeService.width*this._devicePixelRatio),this.dimensions.scaledCharHeight=Math.ceil(this._core._charSizeService.height*this._devicePixelRatio),this.dimensions.scaledCellHeight=Math.floor(this.dimensions.scaledCharHeight*this._terminal.options.lineHeight),this.dimensions.scaledCharTop=this._terminal.options.lineHeight===1?0:Math.round((this.dimensions.scaledCellHeight-this.dimensions.scaledCharHeight)/2),this.dimensions.scaledCellWidth=this.dimensions.scaledCharWidth+Math.round(this._terminal.options.letterSpacing),this.dimensions.scaledCharLeft=Math.floor(this._terminal.options.letterSpacing/2),this.dimensions.scaledCanvasHeight=this._terminal.rows*this.dimensions.scaledCellHeight,this.dimensions.scaledCanvasWidth=this._terminal.cols*this.dimensions.scaledCellWidth,this.dimensions.canvasHeight=Math.round(this.dimensions.scaledCanvasHeight/this._devicePixelRatio),this.dimensions.canvasWidth=Math.round(this.dimensions.scaledCanvasWidth/this._devicePixelRatio),this.dimensions.actualCellHeight=this.dimensions.scaledCellHeight/this._devicePixelRatio,this.dimensions.actualCellWidth=this.dimensions.scaledCellWidth/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(b,y){this._canvas.width===b&&this._canvas.height===y||(this._canvas.width=b,this._canvas.height=y,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}}r.WebglRenderer=C;class g extends v.AttributeData{constructor(b,y,w){super(),this.content=0,this.combinedData="",this.fg=b.fg,this.bg=b.bg,this.combinedData=y,this._width=w}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(b){throw new Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.JoinedCellData=g},381:(D,r)=>{function h(d,c,_){const l=o(d.createShader(c));if(d.shaderSource(l,_),d.compileShader(l),d.getShaderParameter(l,d.COMPILE_STATUS))return l;d.deleteShader(l)}function o(d){if(!d)throw new Error("value must not be falsy");return d}Object.defineProperty(r,"__esModule",{value:!0}),r.throwIfFalsy=r.expandFloat32Array=r.createShader=r.createProgram=r.PROJECTION_MATRIX=void 0,r.PROJECTION_MATRIX=new Float32Array([2,0,0,0,0,-2,0,0,0,0,1,0,-1,1,0,1]),r.createProgram=function(d,c,_){const l=o(d.createProgram());if(d.attachShader(l,o(h(d,d.VERTEX_SHADER,c))),d.attachShader(l,o(h(d,d.FRAGMENT_SHADER,_))),d.linkProgram(l),d.getProgramParameter(l,d.LINK_STATUS))return l;d.deleteProgram(l)},r.createShader=h,r.expandFloat32Array=function(d,c){const _=Math.min(2*d.length,c),l=new Float32Array(_);for(let a=0;a{Object.defineProperty(r,"__esModule",{value:!0}),r.removeTerminalFromCache=r.acquireCharAtlas=void 0;const o=h(433),d=h(167),c=[];r.acquireCharAtlas=function(_,l,a,i,e,n,t){const s=(0,o.generateConfig)(a,i,e,n,_,l,t);for(let u=0;u=0){if((0,o.configEquals)(C.config,s))return C.atlas;C.ownedBy.length===1?(C.atlas.dispose(),c.splice(u,1)):C.ownedBy.splice(g,1);break}}for(let u=0;u{Object.defineProperty(r,"__esModule",{value:!0}),r.is256Color=r.configEquals=r.generateConfig=void 0;const h={css:"",rgba:0};r.generateConfig=function(o,d,c,_,l,a,i){const e={foreground:a.foreground,background:a.background,cursor:h,cursorAccent:h,selectionForeground:h,selectionBackgroundTransparent:h,selectionBackgroundOpaque:h,selectionInactiveBackgroundTransparent:h,selectionInactiveBackgroundOpaque:h,ansi:a.ansi.slice(),contrastCache:a.contrastCache};return{customGlyphs:l.options.customGlyphs,devicePixelRatio:i,letterSpacing:l.options.letterSpacing,lineHeight:l.options.lineHeight,scaledCellWidth:o,scaledCellHeight:d,scaledCharWidth:c,scaledCharHeight:_,fontFamily:l.options.fontFamily,fontSize:l.options.fontSize,fontWeight:l.options.fontWeight,fontWeightBold:l.options.fontWeightBold,allowTransparency:l.options.allowTransparency,drawBoldTextInBrightColors:l.options.drawBoldTextInBrightColors,minimumContrastRatio:l.options.minimumContrastRatio,colors:e}},r.configEquals=function(o,d){for(let c=0;c{Object.defineProperty(r,"__esModule",{value:!0}),r.WebglCharAtlas=void 0;const o=h(302),d=h(855),c=h(381),_=h(147),l=h(160),a=h(14),i=h(634),e=h(485),n=1024,t=1024,s=Math.floor(819.2),f={css:"rgba(0, 0, 0, 0)",rgba:0},v={offset:{x:0,y:0},texturePosition:{x:0,y:0},texturePositionClipSpace:{x:0,y:0},size:{x:0,y:0},sizeClipSpace:{x:0,y:0}},u={glyph:void 0};function C(g,m,b,y){const w=m.rgba>>>24,p=m.rgba>>>16&255,S=m.rgba>>>8&255,L=b.rgba>>>24,E=b.rgba>>>16&255,A=b.rgba>>>8&255,k=Math.floor((Math.abs(w-L)+Math.abs(p-E)+Math.abs(S-A))/12);let O=!0;for(let T=0;Ts&&(this.clearTexture(),this.warmUp(),!0)}clearTexture(){this._currentRow.x===0&&this._currentRow.y===0||(this._cacheCtx.clearRect(0,0,n,t),this._cacheMap.clear(),this._cacheMapCombined.clear(),this._currentRow.x=0,this._currentRow.y=0,this._currentRow.height=0,this._fixedRows.length=0,this._didWarmUp=!1)}getRasterizedGlyphCombinedChar(g,m,b,y){return this._getFromCacheMap(this._cacheMapCombined,g,m,b,y)}getRasterizedGlyph(g,m,b,y){return this._getFromCacheMap(this._cacheMap,g,m,b,y)}_getFromCacheMap(g,m,b,y,w){return u.glyph=g.get(m,b,y,w),u.glyph||(u.glyph=this._drawToCache(m,b,y,w),g.set(m,b,y,w,u.glyph)),u.glyph}_getColorFromAnsiIndex(g){if(g>=this._config.colors.ansi.length)throw new Error("No color found for idx "+g);return this._config.colors.ansi[g]}_getBackgroundColor(g,m,b,y){if(this._config.allowTransparency)return f;let w;switch(g){case 16777216:case 33554432:w=this._getColorFromAnsiIndex(m);break;case 50331648:const p=_.AttributeData.toColorRGB(m);w=l.rgba.toColor(p[0],p[1],p[2]);break;default:w=b?this._config.colors.foreground:this._config.colors.background}return y&&(w=l.color.blend(this._config.colors.background,l.color.multiplyOpacity(w,o.DIM_OPACITY))),w}_getForegroundColor(g,m,b,y,w,p,S,L,E,A){const k=this._getMinimumContrastColor(g,m,b,y,w,p,!1,E,A);if(k)return k;let O;switch(w){case 16777216:case 33554432:this._config.drawBoldTextInBrightColors&&E&&p<8&&(p+=8),O=this._getColorFromAnsiIndex(p);break;case 50331648:const T=_.AttributeData.toColorRGB(p);O=l.rgba.toColor(T[0],T[1],T[2]);break;default:O=S?this._config.colors.background:this._config.colors.foreground}return this._config.allowTransparency&&(O=l.color.opaque(O)),L&&(O=l.color.multiplyOpacity(O,o.DIM_OPACITY)),O}_resolveBackgroundRgba(g,m,b){switch(g){case 16777216:case 33554432:return this._getColorFromAnsiIndex(m).rgba;case 50331648:return m<<8;default:return b?this._config.colors.foreground.rgba:this._config.colors.background.rgba}}_resolveForegroundRgba(g,m,b,y){switch(g){case 16777216:case 33554432:return this._config.drawBoldTextInBrightColors&&y&&m<8&&(m+=8),this._getColorFromAnsiIndex(m).rgba;case 50331648:return m<<8;default:return b?this._config.colors.background.rgba:this._config.colors.foreground.rgba}}_getMinimumContrastColor(g,m,b,y,w,p,S,L,E){if(this._config.minimumContrastRatio===1||E)return;const A=this._config.colors.contrastCache.getColor(g,y);if(A!==void 0)return A||void 0;const k=this._resolveBackgroundRgba(m,b,S),O=this._resolveForegroundRgba(w,p,S,L),T=l.rgba.ensureContrastRatio(k,O,this._config.minimumContrastRatio);if(!T)return void this._config.colors.contrastCache.setColor(g,y,null);const H=l.rgba.toColor(T>>24&255,T>>16&255,T>>8&255);return this._config.colors.contrastCache.setColor(g,y,H),H}_drawToCache(g,m,b,y){const w=typeof g=="number"?String.fromCharCode(g):g;this.hasCanvasChanged=!0;const p=this._config.scaledCellWidth*Math.max(w.length,2)+4;this._tmpCanvas.width=12&&!this._config.allowTransparency&&w!==" "){this._tmpCtx.save(),this._tmpCtx.textBaseline="alphabetic";const re=this._tmpCtx.measureText(w);if(this._tmpCtx.restore(),"actualBoundingBoxDescent"in re&&re.actualBoundingBoxDescent>0){this._tmpCtx.save();const Q=new Path2D;Q.rect(ge,ie-Math.ceil(q/2),this._config.scaledCellWidth,le-ie+Math.ceil(q/2)),this._tmpCtx.clip(Q),this._tmpCtx.lineWidth=3*this._config.devicePixelRatio,this._tmpCtx.strokeStyle=P.css,this._tmpCtx.strokeText(w,I,I+this._config.scaledCharHeight),this._tmpCtx.restore()}}}if(K||this._tmpCtx.fillText(w,I,I+this._config.scaledCharHeight),w==="_"&&!this._config.allowTransparency){let q=C(this._tmpCtx.getImageData(I,I,this._config.scaledCellWidth,this._config.scaledCellHeight),P,$,Z);if(q)for(let Y=1;Y<=5&&(this._tmpCtx.save(),this._tmpCtx.fillStyle=P.css,this._tmpCtx.fillRect(0,0,this._tmpCanvas.width,this._tmpCanvas.height),this._tmpCtx.restore(),this._tmpCtx.fillText(w,I,I+this._config.scaledCharHeight-Y),q=C(this._tmpCtx.getImageData(I,I,this._config.scaledCellWidth,this._config.scaledCellHeight),P,$,Z),q);Y++);}if(T){const q=Math.max(1,Math.floor(this._config.fontSize*this._config.devicePixelRatio/10)),Y=this._tmpCtx.lineWidth%2==1?.5:0;this._tmpCtx.lineWidth=q,this._tmpCtx.strokeStyle=this._tmpCtx.fillStyle,this._tmpCtx.beginPath(),this._tmpCtx.moveTo(I,I+Math.floor(this._config.scaledCharHeight/2)-Y),this._tmpCtx.lineTo(I+this._config.scaledCharWidth*N,I+Math.floor(this._config.scaledCharHeight/2)-Y),this._tmpCtx.stroke()}this._tmpCtx.restore();const oe=this._tmpCtx.getImageData(0,0,this._tmpCanvas.width,this._tmpCanvas.height);let be;if(be=this._config.allowTransparency?function(q){for(let Y=0;Y0)return!1;return!0}(oe):C(oe,P,$,Z),be)return v;const te=this._findGlyphBoundingBox(oe,this._workBoundingBox,p,U,K,I),Me=this._clipImageData(oe,this._workBoundingBox);let V;for(;;){V=this._currentRow;for(const q of this._fixedRows)(V===this._currentRow||q.height2*te.size.y&&(this._currentRow.height>0&&this._fixedRows.push(this._currentRow),V={x:0,y:this._currentRow.y+this._currentRow.height,height:te.size.y},this._fixedRows.push(V),this._currentRow={x:0,y:V.y+V.height,height:0}),V.x+te.size.x<=n)break;V===this._currentRow?(V.x=0,V.y+=V.height,V.height=0):this._fixedRows.splice(this._fixedRows.indexOf(V),1)}return te.texturePosition.x=V.x,te.texturePosition.y=V.y,te.texturePositionClipSpace.x=V.x/n,te.texturePositionClipSpace.y=V.y/t,V.height=Math.max(V.height,te.size.y),V.x+=te.size.x,this._cacheCtx.putImageData(Me,te.texturePosition.x,te.texturePosition.y),te}_findGlyphBoundingBox(g,m,b,y,w,p){m.top=0;const S=y?this._config.scaledCellHeight:this._tmpCanvas.height,L=y?this._config.scaledCellWidth:b;let E=!1;for(let A=0;A=0;A--){for(let k=0;k=0;A--){for(let k=0;k{Object.defineProperty(r,"__esModule",{value:!0}),r.BaseRenderLayer=void 0;const o=h(713),d=h(302),c=h(381);r.BaseRenderLayer=class{constructor(_,l,a,i,e,n){this._container=_,this._alpha=i,this._colors=e,this._coreBrowserService=n,this._scaledCharWidth=0,this._scaledCharHeight=0,this._scaledCellWidth=0,this._scaledCellHeight=0,this._scaledCharLeft=0,this._scaledCharTop=0,this._canvas=document.createElement("canvas"),this._canvas.classList.add(`xterm-${l}-layer`),this._canvas.style.zIndex=a.toString(),this._initCanvas(),this._container.appendChild(this._canvas)}dispose(){this._canvas.remove(),this._charAtlas&&this._charAtlas.dispose()}_initCanvas(){this._ctx=(0,c.throwIfFalsy)(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}onOptionsChanged(_){}onBlur(_){}onFocus(_){}onCursorMove(_){}onGridChanged(_,l,a){}onSelectionChanged(_,l,a,i=!1){}setColors(_,l){this._refreshCharAtlas(_,l)}_setTransparency(_,l){if(l===this._alpha)return;const a=this._canvas;this._alpha=l,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,a),this._refreshCharAtlas(_,this._colors),this.onGridChanged(_,0,_.rows-1)}_refreshCharAtlas(_,l){this._scaledCharWidth<=0&&this._scaledCharHeight<=0||(this._charAtlas=(0,o.acquireCharAtlas)(_,l,this._scaledCellWidth,this._scaledCellHeight,this._scaledCharWidth,this._scaledCharHeight,this._coreBrowserService.dpr),this._charAtlas.warmUp())}resize(_,l){this._scaledCellWidth=l.scaledCellWidth,this._scaledCellHeight=l.scaledCellHeight,this._scaledCharWidth=l.scaledCharWidth,this._scaledCharHeight=l.scaledCharHeight,this._scaledCharLeft=l.scaledCharLeft,this._scaledCharTop=l.scaledCharTop,this._canvas.width=l.scaledCanvasWidth,this._canvas.height=l.scaledCanvasHeight,this._canvas.style.width=`${l.canvasWidth}px`,this._canvas.style.height=`${l.canvasHeight}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(_,this._colors)}_fillCells(_,l,a,i){this._ctx.fillRect(_*this._scaledCellWidth,l*this._scaledCellHeight,a*this._scaledCellWidth,i*this._scaledCellHeight)}_fillBottomLineAtCells(_,l,a=1){this._ctx.fillRect(_*this._scaledCellWidth,(l+1)*this._scaledCellHeight-this._coreBrowserService.dpr-1,a*this._scaledCellWidth,this._coreBrowserService.dpr)}_fillLeftLineAtCell(_,l,a){this._ctx.fillRect(_*this._scaledCellWidth,l*this._scaledCellHeight,this._coreBrowserService.dpr*a,this._scaledCellHeight)}_strokeRectAtCell(_,l,a,i){this._ctx.lineWidth=this._coreBrowserService.dpr,this._ctx.strokeRect(_*this._scaledCellWidth+this._coreBrowserService.dpr/2,l*this._scaledCellHeight+this._coreBrowserService.dpr/2,a*this._scaledCellWidth-this._coreBrowserService.dpr,i*this._scaledCellHeight-this._coreBrowserService.dpr)}_clearAll(){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))}_clearCells(_,l,a,i){this._alpha?this._ctx.clearRect(_*this._scaledCellWidth,l*this._scaledCellHeight,a*this._scaledCellWidth,i*this._scaledCellHeight):(this._ctx.fillStyle=this._colors.background.css,this._ctx.fillRect(_*this._scaledCellWidth,l*this._scaledCellHeight,a*this._scaledCellWidth,i*this._scaledCellHeight))}_fillCharTrueColor(_,l,a,i){this._ctx.font=this._getFont(_,!1,!1),this._ctx.textBaseline=d.TEXT_BASELINE,this._clipCell(a,i,l.getWidth()),this._ctx.fillText(l.getChars(),a*this._scaledCellWidth+this._scaledCharLeft,i*this._scaledCellHeight+this._scaledCharTop+this._scaledCharHeight)}_clipCell(_,l,a){this._ctx.beginPath(),this._ctx.rect(_*this._scaledCellWidth,l*this._scaledCellHeight,a*this._scaledCellWidth,this._scaledCellHeight),this._ctx.clip()}_getFont(_,l,a){return`${a?"italic":""} ${l?_.options.fontWeightBold:_.options.fontWeight} ${_.options.fontSize*this._coreBrowserService.dpr}px ${_.options.fontFamily}`}}},461:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CursorRenderLayer=void 0;const o=h(592),d=h(782);class c extends o.BaseRenderLayer{constructor(a,i,e,n,t,s,f){super(i,"cursor",e,!0,n,s),this._onRequestRefreshRowsEvent=t,this._coreService=f,this._cell=new d.CellData,this._state={x:0,y:0,isFocused:!1,style:"",width:0},this._cursorRenderers={bar:this._renderBarCursor.bind(this),block:this._renderBlockCursor.bind(this),underline:this._renderUnderlineCursor.bind(this)},this.onOptionsChanged(a)}dispose(){var a;(a=this._cursorBlinkStateManager)===null||a===void 0||a.dispose(),this._cursorBlinkStateManager=void 0,super.dispose()}resize(a,i){super.resize(a,i),this._state={x:0,y:0,isFocused:!1,style:"",width:0}}reset(a){var i;this._clearCursor(),(i=this._cursorBlinkStateManager)===null||i===void 0||i.restartBlinkAnimation(a),this.onOptionsChanged(a)}onBlur(a){var i;(i=this._cursorBlinkStateManager)===null||i===void 0||i.pause(),this._onRequestRefreshRowsEvent.fire({start:a.buffer.active.cursorY,end:a.buffer.active.cursorY})}onFocus(a){var i;(i=this._cursorBlinkStateManager)===null||i===void 0||i.resume(a),this._onRequestRefreshRowsEvent.fire({start:a.buffer.active.cursorY,end:a.buffer.active.cursorY})}onOptionsChanged(a){var i;a.options.cursorBlink?this._cursorBlinkStateManager||(this._cursorBlinkStateManager=new _(()=>{this._render(a,!0)},this._coreBrowserService)):((i=this._cursorBlinkStateManager)===null||i===void 0||i.dispose(),this._cursorBlinkStateManager=void 0),this._onRequestRefreshRowsEvent.fire({start:a.buffer.active.cursorY,end:a.buffer.active.cursorY})}onCursorMove(a){var i;(i=this._cursorBlinkStateManager)===null||i===void 0||i.restartBlinkAnimation(a)}onGridChanged(a,i,e){!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isPaused?this._render(a,!1):this._cursorBlinkStateManager.restartBlinkAnimation(a)}_render(a,i){if(!this._coreService.isCursorInitialized||this._coreService.isCursorHidden)return void this._clearCursor();const e=a.buffer.active.baseY+a.buffer.active.cursorY,n=e-a.buffer.active.viewportY,t=Math.min(a.buffer.active.cursorX,a.cols-1);if(n<0||n>=a.rows)this._clearCursor();else if(a._core.buffer.lines.get(e).loadCell(t,this._cell),this._cell.content!==void 0){if(!this._coreBrowserService.isFocused){this._clearCursor(),this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css;const s=a.options.cursorStyle;return s&&s!=="block"?this._cursorRenderers[s](a,t,n,this._cell):this._renderBlurCursor(a,t,n,this._cell),this._ctx.restore(),this._state.x=t,this._state.y=n,this._state.isFocused=!1,this._state.style=s,void(this._state.width=this._cell.getWidth())}if(!this._cursorBlinkStateManager||this._cursorBlinkStateManager.isCursorVisible){if(this._state){if(this._state.x===t&&this._state.y===n&&this._state.isFocused===this._coreBrowserService.isFocused&&this._state.style===a.options.cursorStyle&&this._state.width===this._cell.getWidth())return;this._clearCursor()}this._ctx.save(),this._cursorRenderers[a.options.cursorStyle||"block"](a,t,n,this._cell),this._ctx.restore(),this._state.x=t,this._state.y=n,this._state.isFocused=!1,this._state.style=a.options.cursorStyle,this._state.width=this._cell.getWidth()}else this._clearCursor()}}_clearCursor(){this._state&&(this._coreBrowserService.dpr<1?this._clearAll():this._clearCells(this._state.x,this._state.y,this._state.width,1),this._state={x:0,y:0,isFocused:!1,style:"",width:0})}_renderBarCursor(a,i,e,n){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillLeftLineAtCell(i,e,a.options.cursorWidth),this._ctx.restore()}_renderBlockCursor(a,i,e,n){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillCells(i,e,n.getWidth(),1),this._ctx.fillStyle=this._colors.cursorAccent.css,this._fillCharTrueColor(a,n,i,e),this._ctx.restore()}_renderUnderlineCursor(a,i,e,n){this._ctx.save(),this._ctx.fillStyle=this._colors.cursor.css,this._fillBottomLineAtCells(i,e),this._ctx.restore()}_renderBlurCursor(a,i,e,n){this._ctx.save(),this._ctx.strokeStyle=this._colors.cursor.css,this._strokeRectAtCell(i,e,n.getWidth(),1),this._ctx.restore()}}r.CursorRenderLayer=c;class _{constructor(a,i){this._renderCallback=a,this._coreBrowserService=i,this.isCursorVisible=!0,this._coreBrowserService.isFocused&&this._restartInterval()}get isPaused(){return!(this._blinkStartTimeout||this._blinkInterval)}dispose(){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}restartBlinkAnimation(a){this.isPaused||(this._animationTimeRestarted=Date.now(),this.isCursorVisible=!0,this._animationFrame||(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})))}_restartInterval(a=600){this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout=this._coreBrowserService.window.setTimeout(()=>{if(this._animationTimeRestarted){const i=600-(Date.now()-this._animationTimeRestarted);if(this._animationTimeRestarted=void 0,i>0)return void this._restartInterval(i)}this.isCursorVisible=!1,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0}),this._blinkInterval=this._coreBrowserService.window.setInterval(()=>{if(this._animationTimeRestarted){const i=600-(Date.now()-this._animationTimeRestarted);return this._animationTimeRestarted=void 0,void this._restartInterval(i)}this.isCursorVisible=!this.isCursorVisible,this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._renderCallback(),this._animationFrame=void 0})},600)},a)}pause(){this.isCursorVisible=!0,this._blinkInterval&&(this._coreBrowserService.window.clearInterval(this._blinkInterval),this._blinkInterval=void 0),this._blinkStartTimeout&&(this._coreBrowserService.window.clearTimeout(this._blinkStartTimeout),this._blinkStartTimeout=void 0),this._animationFrame&&(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),this._animationFrame=void 0)}resume(a){this.pause(),this._animationTimeRestarted=void 0,this._restartInterval(),this.restartBlinkAnimation(a)}}},733:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LinkRenderLayer=void 0;const o=h(592),d=h(302),c=h(433);class _ extends o.BaseRenderLayer{constructor(a,i,e,n,t){super(a,"link",i,!0,e,t),n.linkifier2.onShowLinkUnderline(s=>this._onShowLinkUnderline(s)),n.linkifier2.onHideLinkUnderline(s=>this._onHideLinkUnderline(s))}resize(a,i){super.resize(a,i),this._state=void 0}reset(a){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);const a=this._state.y2-this._state.y1-1;a>0&&this._clearCells(0,this._state.y1+1,this._state.cols,a),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_onShowLinkUnderline(a){if(a.fg===d.INVERTED_DEFAULT_COLOR?this._ctx.fillStyle=this._colors.background.css:a.fg!==void 0&&(0,c.is256Color)(a.fg)?this._ctx.fillStyle=this._colors.ansi[a.fg].css:this._ctx.fillStyle=this._colors.foreground.css,a.y1===a.y2)this._fillBottomLineAtCells(a.x1,a.y1,a.x2-a.x1);else{this._fillBottomLineAtCells(a.x1,a.y1,a.cols-a.x1);for(let i=a.y1+1;i{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(h,o,d,c){h.addEventListener(o,d,c);let _=!1;return{dispose:()=>{_||(_=!0,h.removeEventListener(o,d,c))}}}},302:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TEXT_BASELINE=r.DIM_OPACITY=r.INVERTED_DEFAULT_COLOR=void 0;const o=h(399);r.INVERTED_DEFAULT_COLOR=257,r.DIM_OPACITY=.5,r.TEXT_BASELINE=o.isFirefox||o.isLegacyEdge?"bottom":"ideographic"},14:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryDrawCustomChar=r.powerlineDefinitions=r.boxDrawingDefinitions=r.blockElementDefinitions=void 0;const o=h(634);r.blockElementDefinitions={"\u2580":[{x:0,y:0,w:8,h:4}],"\u2581":[{x:0,y:7,w:8,h:1}],"\u2582":[{x:0,y:6,w:8,h:2}],"\u2583":[{x:0,y:5,w:8,h:3}],"\u2584":[{x:0,y:4,w:8,h:4}],"\u2585":[{x:0,y:3,w:8,h:5}],"\u2586":[{x:0,y:2,w:8,h:6}],"\u2587":[{x:0,y:1,w:8,h:7}],"\u2588":[{x:0,y:0,w:8,h:8}],"\u2589":[{x:0,y:0,w:7,h:8}],"\u258A":[{x:0,y:0,w:6,h:8}],"\u258B":[{x:0,y:0,w:5,h:8}],"\u258C":[{x:0,y:0,w:4,h:8}],"\u258D":[{x:0,y:0,w:3,h:8}],"\u258E":[{x:0,y:0,w:2,h:8}],"\u258F":[{x:0,y:0,w:1,h:8}],"\u2590":[{x:4,y:0,w:4,h:8}],"\u2594":[{x:0,y:0,w:9,h:1}],"\u2595":[{x:7,y:0,w:1,h:8}],"\u2596":[{x:0,y:4,w:4,h:4}],"\u2597":[{x:4,y:4,w:4,h:4}],"\u2598":[{x:0,y:0,w:4,h:4}],"\u2599":[{x:0,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u259A":[{x:0,y:0,w:4,h:4},{x:4,y:4,w:4,h:4}],"\u259B":[{x:0,y:0,w:4,h:8},{x:4,y:0,w:4,h:4}],"\u259C":[{x:0,y:0,w:8,h:4},{x:4,y:0,w:4,h:8}],"\u259D":[{x:4,y:0,w:4,h:4}],"\u259E":[{x:4,y:0,w:4,h:4},{x:0,y:4,w:4,h:4}],"\u259F":[{x:4,y:0,w:4,h:8},{x:0,y:4,w:8,h:4}],"\u{1FB70}":[{x:1,y:0,w:1,h:8}],"\u{1FB71}":[{x:2,y:0,w:1,h:8}],"\u{1FB72}":[{x:3,y:0,w:1,h:8}],"\u{1FB73}":[{x:4,y:0,w:1,h:8}],"\u{1FB74}":[{x:5,y:0,w:1,h:8}],"\u{1FB75}":[{x:6,y:0,w:1,h:8}],"\u{1FB76}":[{x:0,y:1,w:8,h:1}],"\u{1FB77}":[{x:0,y:2,w:8,h:1}],"\u{1FB78}":[{x:0,y:3,w:8,h:1}],"\u{1FB79}":[{x:0,y:4,w:8,h:1}],"\u{1FB7A}":[{x:0,y:5,w:8,h:1}],"\u{1FB7B}":[{x:0,y:6,w:8,h:1}],"\u{1FB7C}":[{x:0,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB7D}":[{x:0,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7E}":[{x:7,y:0,w:1,h:8},{x:0,y:0,w:8,h:1}],"\u{1FB7F}":[{x:7,y:0,w:1,h:8},{x:0,y:7,w:8,h:1}],"\u{1FB80}":[{x:0,y:0,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB81}":[{x:0,y:0,w:8,h:1},{x:0,y:2,w:8,h:1},{x:0,y:4,w:8,h:1},{x:0,y:7,w:8,h:1}],"\u{1FB82}":[{x:0,y:0,w:8,h:2}],"\u{1FB83}":[{x:0,y:0,w:8,h:3}],"\u{1FB84}":[{x:0,y:0,w:8,h:5}],"\u{1FB85}":[{x:0,y:0,w:8,h:6}],"\u{1FB86}":[{x:0,y:0,w:8,h:7}],"\u{1FB87}":[{x:6,y:0,w:2,h:8}],"\u{1FB88}":[{x:5,y:0,w:3,h:8}],"\u{1FB89}":[{x:3,y:0,w:5,h:8}],"\u{1FB8A}":[{x:2,y:0,w:6,h:8}],"\u{1FB8B}":[{x:1,y:0,w:7,h:8}],"\u{1FB95}":[{x:0,y:0,w:2,h:2},{x:4,y:0,w:2,h:2},{x:2,y:2,w:2,h:2},{x:6,y:2,w:2,h:2},{x:0,y:4,w:2,h:2},{x:4,y:4,w:2,h:2},{x:2,y:6,w:2,h:2},{x:6,y:6,w:2,h:2}],"\u{1FB96}":[{x:2,y:0,w:2,h:2},{x:6,y:0,w:2,h:2},{x:0,y:2,w:2,h:2},{x:4,y:2,w:2,h:2},{x:2,y:4,w:2,h:2},{x:6,y:4,w:2,h:2},{x:0,y:6,w:2,h:2},{x:4,y:6,w:2,h:2}],"\u{1FB97}":[{x:0,y:2,w:8,h:2},{x:0,y:6,w:8,h:2}]};const d={"\u2591":[[1,0,0,0],[0,0,0,0],[0,0,1,0],[0,0,0,0]],"\u2592":[[1,0],[0,0],[0,1],[0,0]],"\u2593":[[0,1],[1,1],[1,0],[1,1]]};r.boxDrawingDefinitions={"\u2500":{1:"M0,.5 L1,.5"},"\u2501":{3:"M0,.5 L1,.5"},"\u2502":{1:"M.5,0 L.5,1"},"\u2503":{3:"M.5,0 L.5,1"},"\u250C":{1:"M0.5,1 L.5,.5 L1,.5"},"\u250F":{3:"M0.5,1 L.5,.5 L1,.5"},"\u2510":{1:"M0,.5 L.5,.5 L.5,1"},"\u2513":{3:"M0,.5 L.5,.5 L.5,1"},"\u2514":{1:"M.5,0 L.5,.5 L1,.5"},"\u2517":{3:"M.5,0 L.5,.5 L1,.5"},"\u2518":{1:"M.5,0 L.5,.5 L0,.5"},"\u251B":{3:"M.5,0 L.5,.5 L0,.5"},"\u251C":{1:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2523":{3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u2524":{1:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252B":{3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u252C":{1:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2533":{3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2534":{1:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253B":{3:"M0,.5 L1,.5 M.5,.5 L.5,0"},"\u253C":{1:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u254B":{3:"M0,.5 L1,.5 M.5,0 L.5,1"},"\u2574":{1:"M.5,.5 L0,.5"},"\u2578":{3:"M.5,.5 L0,.5"},"\u2575":{1:"M.5,.5 L.5,0"},"\u2579":{3:"M.5,.5 L.5,0"},"\u2576":{1:"M.5,.5 L1,.5"},"\u257A":{3:"M.5,.5 L1,.5"},"\u2577":{1:"M.5,.5 L.5,1"},"\u257B":{3:"M.5,.5 L.5,1"},"\u2550":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2551":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2552":{1:(i,e)=>`M.5,1 L.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u2553":{1:(i,e)=>`M${.5-i},1 L${.5-i},.5 L1,.5 M${.5+i},.5 L${.5+i},1`},"\u2554":{1:(i,e)=>`M1,${.5-e} L${.5-i},${.5-e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2555":{1:(i,e)=>`M0,${.5-e} L.5,${.5-e} L.5,1 M0,${.5+e} L.5,${.5+e}`},"\u2556":{1:(i,e)=>`M${.5+i},1 L${.5+i},.5 L0,.5 M${.5-i},.5 L${.5-i},1`},"\u2557":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5+i},${.5-e} L${.5+i},1`},"\u2558":{1:(i,e)=>`M.5,0 L.5,${.5+e} L1,${.5+e} M.5,${.5-e} L1,${.5-e}`},"\u2559":{1:(i,e)=>`M1,.5 L${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u255A":{1:(i,e)=>`M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0 M1,${.5+e} L${.5-i},${.5+e} L${.5-i},0`},"\u255B":{1:(i,e)=>`M0,${.5+e} L.5,${.5+e} L.5,0 M0,${.5-e} L.5,${.5-e}`},"\u255C":{1:(i,e)=>`M0,.5 L${.5+i},.5 L${.5+i},0 M${.5-i},.5 L${.5-i},0`},"\u255D":{1:(i,e)=>`M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M0,${.5+e} L${.5+i},${.5+e} L${.5+i},0`},"\u255E":{1:(i,e)=>`M.5,0 L.5,1 M.5,${.5-e} L1,${.5-e} M.5,${.5+e} L1,${.5+e}`},"\u255F":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1 M${.5+i},.5 L1,.5`},"\u2560":{1:(i,e)=>`M${.5-i},0 L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2561":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L.5,${.5-e} M0,${.5+e} L.5,${.5+e}`},"\u2562":{1:(i,e)=>`M0,.5 L${.5-i},.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u2563":{1:(i,e)=>`M${.5+i},0 L${.5+i},1 M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0`},"\u2564":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e} M.5,${.5+e} L.5,1`},"\u2565":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},1 M${.5+i},.5 L${.5+i},1`},"\u2566":{1:(i,e)=>`M0,${.5-e} L1,${.5-e} M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1`},"\u2567":{1:(i,e)=>`M.5,0 L.5,${.5-e} M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u2568":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},.5 L${.5-i},0 M${.5+i},.5 L${.5+i},0`},"\u2569":{1:(i,e)=>`M0,${.5+e} L1,${.5+e} M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u256A":{1:(i,e)=>`M.5,0 L.5,1 M0,${.5-e} L1,${.5-e} M0,${.5+e} L1,${.5+e}`},"\u256B":{1:(i,e)=>`M0,.5 L1,.5 M${.5-i},0 L${.5-i},1 M${.5+i},0 L${.5+i},1`},"\u256C":{1:(i,e)=>`M0,${.5+e} L${.5-i},${.5+e} L${.5-i},1 M1,${.5+e} L${.5+i},${.5+e} L${.5+i},1 M0,${.5-e} L${.5-i},${.5-e} L${.5-i},0 M1,${.5-e} L${.5+i},${.5-e} L${.5+i},0`},"\u2571":{1:"M1,0 L0,1"},"\u2572":{1:"M0,0 L1,1"},"\u2573":{1:"M1,0 L0,1 M0,0 L1,1"},"\u257C":{1:"M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u257D":{1:"M.5,.5 L.5,0",3:"M.5,.5 L.5,1"},"\u257E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u257F":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u250D":{1:"M.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u250E":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2511":{1:"M.5,.5 L.5,1",3:"M.5,.5 L0,.5"},"\u2512":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2515":{1:"M.5,.5 L.5,0",3:"M.5,.5 L1,.5"},"\u2516":{1:"M.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2519":{1:"M.5,.5 L.5,0",3:"M.5,.5 L0,.5"},"\u251A":{1:"M.5,.5 L0,.5",3:"M.5,.5 L.5,0"},"\u251D":{1:"M.5,0 L.5,1",3:"M.5,.5 L1,.5"},"\u251E":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u251F":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2520":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2521":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2522":{1:"M.5,.5 L.5,0",3:"M0.5,1 L.5,.5 L1,.5"},"\u2525":{1:"M.5,0 L.5,1",3:"M.5,.5 L0,.5"},"\u2526":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2527":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L.5,1"},"\u2528":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1"},"\u2529":{1:"M.5,.5 L.5,1",3:"M.5,0 L.5,.5 L0,.5"},"\u252A":{1:"M.5,.5 L.5,0",3:"M0,.5 L.5,.5 L.5,1"},"\u252D":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u252E":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,.5 L1,.5"},"\u252F":{1:"M.5,.5 L.5,1",3:"M0,.5 L1,.5"},"\u2530":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2531":{1:"M.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2532":{1:"M.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2535":{1:"M.5,0 L.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u2536":{1:"M.5,0 L.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u2537":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5"},"\u2538":{1:"M0,.5 L1,.5",3:"M.5,.5 L.5,0"},"\u2539":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u253A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,.5 L1,.5"},"\u253D":{1:"M.5,0 L.5,1 M.5,.5 L1,.5",3:"M.5,.5 L0,.5"},"\u253E":{1:"M.5,0 L.5,1 M.5,.5 L0,.5",3:"M.5,.5 L1,.5"},"\u253F":{1:"M.5,0 L.5,1",3:"M0,.5 L1,.5"},"\u2540":{1:"M0,.5 L1,.5 M.5,.5 L.5,1",3:"M.5,.5 L.5,0"},"\u2541":{1:"M.5,.5 L.5,0 M0,.5 L1,.5",3:"M.5,.5 L.5,1"},"\u2542":{1:"M0,.5 L1,.5",3:"M.5,0 L.5,1"},"\u2543":{1:"M0.5,1 L.5,.5 L1,.5",3:"M.5,0 L.5,.5 L0,.5"},"\u2544":{1:"M0,.5 L.5,.5 L.5,1",3:"M.5,0 L.5,.5 L1,.5"},"\u2545":{1:"M.5,0 L.5,.5 L1,.5",3:"M0,.5 L.5,.5 L.5,1"},"\u2546":{1:"M.5,0 L.5,.5 L0,.5",3:"M0.5,1 L.5,.5 L1,.5"},"\u2547":{1:"M.5,.5 L.5,1",3:"M.5,.5 L.5,0 M0,.5 L1,.5"},"\u2548":{1:"M.5,.5 L.5,0",3:"M0,.5 L1,.5 M.5,.5 L.5,1"},"\u2549":{1:"M.5,.5 L1,.5",3:"M.5,0 L.5,1 M.5,.5 L0,.5"},"\u254A":{1:"M.5,.5 L0,.5",3:"M.5,0 L.5,1 M.5,.5 L1,.5"},"\u254C":{1:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u254D":{3:"M.1,.5 L.4,.5 M.6,.5 L.9,.5"},"\u2504":{1:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2505":{3:"M.0667,.5 L.2667,.5 M.4,.5 L.6,.5 M.7333,.5 L.9333,.5"},"\u2508":{1:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u2509":{3:"M.05,.5 L.2,.5 M.3,.5 L.45,.5 M.55,.5 L.7,.5 M.8,.5 L.95,.5"},"\u254E":{1:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u254F":{3:"M.5,.1 L.5,.4 M.5,.6 L.5,.9"},"\u2506":{1:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u2507":{3:"M.5,.0667 L.5,.2667 M.5,.4 L.5,.6 M.5,.7333 L.5,.9333"},"\u250A":{1:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u250B":{3:"M.5,.05 L.5,.2 M.5,.3 L.5,.45 L.5,.55 M.5,.7 L.5,.95"},"\u256D":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,1,.5`},"\u256E":{1:(i,e)=>`M.5,1 L.5,${.5+e/.15*.5} C.5,${.5+e/.15*.5},.5,.5,0,.5`},"\u256F":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,0,.5`},"\u2570":{1:(i,e)=>`M.5,0 L.5,${.5-e/.15*.5} C.5,${.5-e/.15*.5},.5,.5,1,.5`}},r.powerlineDefinitions={"\uE0B0":{d:"M0,0 L1,.5 L0,1",type:0,rightPadding:2},"\uE0B1":{d:"M-1,-.5 L1,.5 L-1,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B2":{d:"M1,0 L0,.5 L1,1",type:0,leftPadding:2},"\uE0B3":{d:"M2,-.5 L0,.5 L2,1.5",type:1,leftPadding:1,rightPadding:1},"\uE0B4":{d:"M0,0 L0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:0,rightPadding:1},"\uE0B5":{d:"M0,1 C0.552,1,1,0.776,1,.5 C1,0.224,0.552,0,0,0",type:1,rightPadding:1},"\uE0B6":{d:"M1,0 L1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:0,leftPadding:1},"\uE0B7":{d:"M1,1 C0.448,1,0,0.776,0,.5 C0,0.224,0.448,0,1,0",type:1,leftPadding:1}},r.tryDrawCustomChar=function(i,e,n,t,s,f,v,u){const C=r.blockElementDefinitions[e];if(C)return function(y,w,p,S,L,E){for(let A=0;A7&&parseInt(k.slice(7,9),16)||1;else{if(!k.startsWith("rgba"))throw new Error(`Unexpected fillStyle color format "${k}" when drawing pattern glyph`);[P,R,M,F]=k.substring(5,k.length-1).split(",").map(U=>parseFloat(U))}for(let U=0;Ui.bezierCurveTo(e[0],e[1],e[2],e[3],e[4],e[5]),L:(i,e)=>i.lineTo(e[0],e[1]),M:(i,e)=>i.moveTo(e[0],e[1])};function a(i,e,n,t,s,f,v,u=0,C=0){const g=i.map(m=>parseFloat(m)||parseInt(m));if(g.length<2)throw new Error("Too few arguments for instruction");for(let m=0;m{Object.defineProperty(r,"__esModule",{value:!0}),r.observeDevicePixelDimensions=void 0;const o=h(859);r.observeDevicePixelDimensions=function(d,c,_){let l=new c.ResizeObserver(a=>{const i=a.find(t=>t.target===d);if(!i)return;if(!("devicePixelContentBoxSize"in i))return l==null||l.disconnect(),void(l=void 0);const e=i.devicePixelContentBoxSize[0].inlineSize,n=i.devicePixelContentBoxSize[0].blockSize;e>0&&n>0&&_(e,n)});try{l.observe(d,{box:["device-pixel-content-box"]})}catch{l.disconnect(),l=void 0}return(0,o.toDisposable)(()=>l==null?void 0:l.disconnect())}},634:(D,r)=>{function h(o){return 57508<=o&&o<=57558}Object.defineProperty(r,"__esModule",{value:!0}),r.excludeFromContrastRatioDemands=r.isRestrictedPowerlineGlyph=r.isPowerlineGlyph=r.throwIfFalsy=void 0,r.throwIfFalsy=function(o){if(!o)throw new Error("value must not be falsy");return o},r.isPowerlineGlyph=h,r.isRestrictedPowerlineGlyph=function(o){return 57520<=o&&o<=57527},r.excludeFromContrastRatioDemands=function(o){return h(o)||function(d){return 9472<=d&&d<=9631}(o)}},160:(D,r)=>{var h,o,d;function c(l){const a=l.toString(16);return a.length<2?"0"+a:a}function _(l,a){return l>>0}}(h=r.channels||(r.channels={})),function(l){function a(i,e){const n=Math.round(255*e),[t,s,f]=d.toChannels(i.rgba);return{css:h.toCss(t,s,f,n),rgba:h.toRgba(t,s,f,n)}}l.blend=function(i,e){const n=(255&e.rgba)/255;if(n===1)return{css:e.css,rgba:e.rgba};const t=e.rgba>>24&255,s=e.rgba>>16&255,f=e.rgba>>8&255,v=i.rgba>>24&255,u=i.rgba>>16&255,C=i.rgba>>8&255,g=v+Math.round((t-v)*n),m=u+Math.round((s-u)*n),b=C+Math.round((f-C)*n);return{css:h.toCss(g,m,b),rgba:h.toRgba(g,m,b)}},l.isOpaque=function(i){return(255&i.rgba)==255},l.ensureContrastRatio=function(i,e,n){const t=d.ensureContrastRatio(i.rgba,e.rgba,n);if(t)return d.toColor(t>>24&255,t>>16&255,t>>8&255)},l.opaque=function(i){const e=(255|i.rgba)>>>0,[n,t,s]=d.toChannels(e);return{css:h.toCss(n,t,s),rgba:e}},l.opacity=a,l.multiplyOpacity=function(i,e){return a(i,(255&i.rgba)*e/255)},l.toColorRGB=function(i){return[i.rgba>>24&255,i.rgba>>16&255,i.rgba>>8&255]}}(r.color||(r.color={})),(r.css||(r.css={})).toColor=function(l){if(l.match(/#[0-9a-f]{3,8}/i))switch(l.length){case 4:{const i=parseInt(l.slice(1,2).repeat(2),16),e=parseInt(l.slice(2,3).repeat(2),16),n=parseInt(l.slice(3,4).repeat(2),16);return d.toColor(i,e,n)}case 5:{const i=parseInt(l.slice(1,2).repeat(2),16),e=parseInt(l.slice(2,3).repeat(2),16),n=parseInt(l.slice(3,4).repeat(2),16),t=parseInt(l.slice(4,5).repeat(2),16);return d.toColor(i,e,n,t)}case 7:return{css:l,rgba:(parseInt(l.slice(1),16)<<8|255)>>>0};case 9:return{css:l,rgba:parseInt(l.slice(1),16)>>>0}}const a=l.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(a){const i=parseInt(a[1]),e=parseInt(a[2]),n=parseInt(a[3]),t=Math.round(255*(a[5]===void 0?1:parseFloat(a[5])));return d.toColor(i,e,n,t)}throw new Error("css.toColor: Unsupported css format")},function(l){function a(i,e,n){const t=i/255,s=e/255,f=n/255;return .2126*(t<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.7152*(s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4))+.0722*(f<=.03928?f/12.92:Math.pow((f+.055)/1.055,2.4))}l.relativeLuminance=function(i){return a(i>>16&255,i>>8&255,255&i)},l.relativeLuminance2=a}(o=r.rgb||(r.rgb={})),function(l){function a(e,n,t){const s=e>>24&255,f=e>>16&255,v=e>>8&255;let u=n>>24&255,C=n>>16&255,g=n>>8&255,m=_(o.relativeLuminance2(u,C,g),o.relativeLuminance2(s,f,v));for(;m0||C>0||g>0);)u-=Math.max(0,Math.ceil(.1*u)),C-=Math.max(0,Math.ceil(.1*C)),g-=Math.max(0,Math.ceil(.1*g)),m=_(o.relativeLuminance2(u,C,g),o.relativeLuminance2(s,f,v));return(u<<24|C<<16|g<<8|255)>>>0}function i(e,n,t){const s=e>>24&255,f=e>>16&255,v=e>>8&255;let u=n>>24&255,C=n>>16&255,g=n>>8&255,m=_(o.relativeLuminance2(u,C,g),o.relativeLuminance2(s,f,v));for(;m>>0}l.ensureContrastRatio=function(e,n,t){const s=o.relativeLuminance(e>>8),f=o.relativeLuminance(n>>8);if(_(s,f)>8));if(g_(s,o.relativeLuminance(m>>8))?C:m}return C}const v=i(e,n,t),u=_(s,o.relativeLuminance(v>>8));if(u_(s,o.relativeLuminance(C>>8))?v:C}return v}},l.reduceLuminance=a,l.increaseLuminance=i,l.toChannels=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},l.toColor=function(e,n,t,s){return{css:h.toCss(e,n,t,s),rgba:h.toRgba(e,n,t,s)}}}(d=r.rgba||(r.rgba={})),r.toPaddedHex=c,r.contrastRatio=_},345:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.forwardEvent=r.EventEmitter=void 0,r.EventEmitter=class{constructor(){this._listeners=[],this._disposed=!1}get event(){return this._event||(this._event=h=>(this._listeners.push(h),{dispose:()=>{if(!this._disposed){for(let o=0;oo.fire(d))}},859:(D,r)=>{function h(o){for(const d of o)d.dispose();o.length=0}Object.defineProperty(r,"__esModule",{value:!0}),r.getDisposeArrayDisposable=r.disposeArray=r.toDisposable=r.Disposable=void 0,r.Disposable=class{constructor(){this._disposables=[],this._isDisposed=!1}dispose(){this._isDisposed=!0;for(const o of this._disposables)o.dispose();this._disposables.length=0}register(o){return this._disposables.push(o),o}unregister(o){const d=this._disposables.indexOf(o);d!==-1&&this._disposables.splice(d,1)}},r.toDisposable=function(o){return{dispose:o}},r.disposeArray=h,r.getDisposeArrayDisposable=function(o){return{dispose:()=>h(o)}}},485:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FourKeyMap=r.TwoKeyMap=void 0;class h{constructor(){this._data={}}set(d,c,_){this._data[d]||(this._data[d]={}),this._data[d][c]=_}get(d,c){return this._data[d]?this._data[d][c]:void 0}clear(){this._data={}}}r.TwoKeyMap=h,r.FourKeyMap=class{constructor(){this._data=new h}set(o,d,c,_,l){this._data.get(o,d)||this._data.set(o,d,new h),this._data.get(o,d).set(c,_,l)}get(o,d,c,_){var l;return(l=this._data.get(o,d))===null||l===void 0?void 0:l.get(c,_)}clear(){this._data.clear()}}},399:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.isLinux=r.isWindows=r.isIphone=r.isIpad=r.isMac=r.isSafari=r.isLegacyEdge=r.isFirefox=void 0;const h=typeof navigator=="undefined",o=h?"node":navigator.userAgent,d=h?"node":navigator.platform;r.isFirefox=o.includes("Firefox"),r.isLegacyEdge=o.includes("Edge"),r.isSafari=/^((?!chrome|android).)*safari/i.test(o),r.isMac=["Macintosh","MacIntel","MacPPC","Mac68K"].includes(d),r.isIpad=d==="iPad",r.isIphone=d==="iPhone",r.isWindows=["Windows","Win16","Win32","WinCE"].includes(d),r.isLinux=d.indexOf("Linux")>=0},455:(D,r)=>{function h(o,d,c=0,_=o.length){if(c>=o.length)return o;c=(o.length+c)%o.length,_=_>=o.length?o.length:(o.length+_)%o.length;for(let l=c;l<_;++l)o[l]=d;return o}Object.defineProperty(r,"__esModule",{value:!0}),r.concat=r.fillFallback=r.fill=void 0,r.fill=function(o,d,c,_){return o.fill?o.fill(d,c,_):h(o,d,c,_)},r.fillFallback=h,r.concat=function(o,d){const c=new o.constructor(o.length+d.length);return c.set(o),c.set(d,o.length),c}},147:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExtendedAttrs=r.AttributeData=void 0;class h{constructor(){this.fg=0,this.bg=0,this.extended=new o}static toColorRGB(c){return[c>>>16&255,c>>>8&255,255&c]}static fromColorRGB(c){return(255&c[0])<<16|(255&c[1])<<8|255&c[2]}clone(){const c=new h;return c.fg=this.fg,c.bg=this.bg,c.extended=this.extended.clone(),c}isInverse(){return 67108864&this.fg}isBold(){return 134217728&this.fg}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:268435456&this.fg}isBlink(){return 536870912&this.fg}isInvisible(){return 1073741824&this.fg}isItalic(){return 67108864&this.bg}isDim(){return 134217728&this.bg}isStrikethrough(){return 2147483648&this.fg}isProtected(){return 536870912&this.bg}getFgColorMode(){return 50331648&this.fg}getBgColorMode(){return 50331648&this.bg}isFgRGB(){return(50331648&this.fg)==50331648}isBgRGB(){return(50331648&this.bg)==50331648}isFgPalette(){return(50331648&this.fg)==16777216||(50331648&this.fg)==33554432}isBgPalette(){return(50331648&this.bg)==16777216||(50331648&this.bg)==33554432}isFgDefault(){return(50331648&this.fg)==0}isBgDefault(){return(50331648&this.bg)==0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(50331648&this.fg){case 16777216:case 33554432:return 255&this.fg;case 50331648:return 16777215&this.fg;default:return-1}}getBgColor(){switch(50331648&this.bg){case 16777216:case 33554432:return 255&this.bg;case 50331648:return 16777215&this.bg;default:return-1}}hasExtendedAttrs(){return 268435456&this.bg}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){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()}getUnderlineColorMode(){return 268435456&this.bg&&~this.extended.underlineColor?50331648&this.extended.underlineColor:this.getFgColorMode()}isUnderlineColorRGB(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==16777216||(50331648&this.extended.underlineColor)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return 268435456&this.bg&&~this.extended.underlineColor?(50331648&this.extended.underlineColor)==0:this.isFgDefault()}getUnderlineStyle(){return 268435456&this.fg?268435456&this.bg?this.extended.underlineStyle:1:0}}r.AttributeData=h;class o{constructor(c=0,_=0){this._ext=0,this._urlId=0,this._ext=c,this._urlId=_}get ext(){return this._urlId?-469762049&this._ext|this.underlineStyle<<26:this._ext}set ext(c){this._ext=c}get underlineStyle(){return this._urlId?5:(469762048&this._ext)>>26}set underlineStyle(c){this._ext&=-469762049,this._ext|=c<<26&469762048}get underlineColor(){return 67108863&this._ext}set underlineColor(c){this._ext&=-67108864,this._ext|=67108863&c}get urlId(){return this._urlId}set urlId(c){this._urlId=c}clone(){return new o(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}}r.ExtendedAttrs=o},782:(D,r,h)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CellData=void 0;const o=h(133),d=h(855),c=h(147);class _ extends c.AttributeData{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new c.ExtendedAttrs,this.combinedData=""}static fromCharData(a){const i=new _;return i.setFromCharData(a),i}isCombined(){return 2097152&this.content}getWidth(){return this.content>>22}getChars(){return 2097152&this.content?this.combinedData:2097151&this.content?(0,o.stringFromCodePoint)(2097151&this.content):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):2097151&this.content}setFromCharData(a){this.fg=a[d.CHAR_DATA_ATTR_INDEX],this.bg=0;let i=!1;if(a[d.CHAR_DATA_CHAR_INDEX].length>2)i=!0;else if(a[d.CHAR_DATA_CHAR_INDEX].length===2){const e=a[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0);if(55296<=e&&e<=56319){const n=a[d.CHAR_DATA_CHAR_INDEX].charCodeAt(1);56320<=n&&n<=57343?this.content=1024*(e-55296)+n-56320+65536|a[d.CHAR_DATA_WIDTH_INDEX]<<22:i=!0}else i=!0}else this.content=a[d.CHAR_DATA_CHAR_INDEX].charCodeAt(0)|a[d.CHAR_DATA_WIDTH_INDEX]<<22;i&&(this.combinedData=a[d.CHAR_DATA_CHAR_INDEX],this.content=2097152|a[d.CHAR_DATA_WIDTH_INDEX]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}}r.CellData=_},855:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.WHITESPACE_CELL_CODE=r.WHITESPACE_CELL_WIDTH=r.WHITESPACE_CELL_CHAR=r.NULL_CELL_CODE=r.NULL_CELL_WIDTH=r.NULL_CELL_CHAR=r.CHAR_DATA_CODE_INDEX=r.CHAR_DATA_WIDTH_INDEX=r.CHAR_DATA_CHAR_INDEX=r.CHAR_DATA_ATTR_INDEX=r.DEFAULT_EXT=r.DEFAULT_ATTR=r.DEFAULT_COLOR=void 0,r.DEFAULT_COLOR=256,r.DEFAULT_ATTR=256|r.DEFAULT_COLOR<<9,r.DEFAULT_EXT=0,r.CHAR_DATA_ATTR_INDEX=0,r.CHAR_DATA_CHAR_INDEX=1,r.CHAR_DATA_WIDTH_INDEX=2,r.CHAR_DATA_CODE_INDEX=3,r.NULL_CELL_CHAR="",r.NULL_CELL_WIDTH=1,r.NULL_CELL_CODE=0,r.WHITESPACE_CELL_CHAR=" ",r.WHITESPACE_CELL_WIDTH=1,r.WHITESPACE_CELL_CODE=32},133:(D,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Utf8ToUtf32=r.StringToUtf32=r.utf32ToString=r.stringFromCodePoint=void 0,r.stringFromCodePoint=function(h){return h>65535?(h-=65536,String.fromCharCode(55296+(h>>10))+String.fromCharCode(h%1024+56320)):String.fromCharCode(h)},r.utf32ToString=function(h,o=0,d=h.length){let c="";for(let _=o;_65535?(l-=65536,c+=String.fromCharCode(55296+(l>>10))+String.fromCharCode(l%1024+56320)):c+=String.fromCharCode(l)}return c},r.StringToUtf32=class{constructor(){this._interim=0}clear(){this._interim=0}decode(h,o){const d=h.length;if(!d)return 0;let c=0,_=0;if(this._interim){const l=h.charCodeAt(_++);56320<=l&&l<=57343?o[c++]=1024*(this._interim-55296)+l-56320+65536:(o[c++]=this._interim,o[c++]=l),this._interim=0}for(let l=_;l=d)return this._interim=a,c;const i=h.charCodeAt(l);56320<=i&&i<=57343?o[c++]=1024*(a-55296)+i-56320+65536:(o[c++]=a,o[c++]=i)}else a!==65279&&(o[c++]=a)}return c}},r.Utf8ToUtf32=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(h,o){const d=h.length;if(!d)return 0;let c,_,l,a,i=0,e=0,n=0;if(this.interim[0]){let f=!1,v=this.interim[0];v&=(224&v)==192?31:(240&v)==224?15:7;let u,C=0;for(;(u=63&this.interim[++C])&&C<4;)v<<=6,v|=u;const g=(224&this.interim[0])==192?2:(240&this.interim[0])==224?3:4,m=g-C;for(;n=d)return 0;if(u=h[n++],(192&u)!=128){n--,f=!0;break}this.interim[C++]=u,v<<=6,v|=63&u}f||(g===2?v<128?n--:o[i++]=v:g===3?v<2048||v>=55296&&v<=57343||v===65279||(o[i++]=v):v<65536||v>1114111||(o[i++]=v)),this.interim.fill(0)}const t=d-4;let s=n;for(;s=d)return this.interim[0]=c,i;if(_=h[s++],(192&_)!=128){s--;continue}if(e=(31&c)<<6|63&_,e<128){s--;continue}o[i++]=e}else if((240&c)==224){if(s>=d)return this.interim[0]=c,i;if(_=h[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=c,this.interim[1]=_,i;if(l=h[s++],(192&l)!=128){s--;continue}if(e=(15&c)<<12|(63&_)<<6|63&l,e<2048||e>=55296&&e<=57343||e===65279)continue;o[i++]=e}else if((248&c)==240){if(s>=d)return this.interim[0]=c,i;if(_=h[s++],(192&_)!=128){s--;continue}if(s>=d)return this.interim[0]=c,this.interim[1]=_,i;if(l=h[s++],(192&l)!=128){s--;continue}if(s>=d)return this.interim[0]=c,this.interim[1]=_,this.interim[2]=l,i;if(a=h[s++],(192&a)!=128){s--;continue}if(e=(7&c)<<18|(63&_)<<12|(63&l)<<6|63&a,e<65536||e>1114111)continue;o[i++]=e}}return i}}}},J={};function j(D){var r=J[D];if(r!==void 0)return r.exports;var h=J[D]={exports:{}};return ee[D](h,h.exports,j),h.exports}var se={};return(()=>{var D=se;Object.defineProperty(D,"__esModule",{value:!0}),D.WebglAddon=void 0;const r=j(666),h=j(345),o=j(399);D.WebglAddon=class{constructor(d){this._preserveDrawingBuffer=d,this._onChangeTextureAtlas=new h.EventEmitter,this._onContextLoss=new h.EventEmitter}get onChangeTextureAtlas(){return this._onChangeTextureAtlas.event}get onContextLoss(){return this._onContextLoss.event}activate(d){if(!d.element)throw new Error("Cannot activate WebglAddon before Terminal.open");if(o.isSafari)throw new Error("Webgl is not currently supported on Safari");this._terminal=d;const c=d._core._renderService,_=d._core._characterJoinerService,l=d._core._coreBrowserService,a=d._core.coreService,i=d._core._decorationService,e=d._core._colorManager.colors;this._renderer=new r.WebglRenderer(d,e,_,l,a,i,this._preserveDrawingBuffer),(0,h.forwardEvent)(this._renderer.onContextLoss,this._onContextLoss),(0,h.forwardEvent)(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas),c.setRenderer(this._renderer)}dispose(){var d;if(!this._terminal)throw new Error("Cannot dispose WebglAddon because it is activated");const c=this._terminal._core._renderService;c.setRenderer(this._terminal._core._createRenderer()),c.onResize(this._terminal.cols,this._terminal.rows),(d=this._renderer)===null||d===void 0||d.dispose(),this._renderer=void 0}get textureAtlas(){var d;return(d=this._renderer)===null||d===void 0?void 0:d.textureAtlas}clearTextureAtlas(){var d;(d=this._renderer)===null||d===void 0||d.clearCharAtlas()}}})(),se})()})})(De);function Fe(X,z){return ce(),ke("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor","aria-hidden":"true"},[Ee("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 6h16M4 12h16M4 18h7"})])}var We="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAB5UlEQVRYR+2XQU8TURSFz2lLCHa6QJopbExcmHSmaogbd8oPENeucW1YWxcCCbAnbA2/AfEHwM7EBYmGRxP2hj6MLphaDWWu6ZQhdBjo9IURSPq28+49X857b+69xDUvhvp/fzxwjo5z0wLeSZOJkN9D2dbGcHFvt60TAHi6MgnIdprC0dwEnuRttR0ANLRbFWBRIFsQbqYKQpki+JzAu7ytlgKAw7o7R+K9COYLJTWXJkBU6+YCeHXnM8inXW6I/GGWr/JFtR7n0qF2Ntv2XhaT2AFPu3JOxASgk2TZslU17rgvPIIQwLLV6VPt926El3sAYOZA3d1vW26V1Hi/1of7G9qdEeCDALMFW630eQcqgbBl7wQgJksEbPwqP8yP1nZI+H0BmAgmiUn8DJMkM9kzABg4cHsc8LTzqfMf2H1hctuDRuegPO37XMtk+TqsoIkdGBSjG+NA0KieLIJNAtV2NxvbEdWdBRDPTvcL7oG8b14NiVJUSOC/Kdi11TgATzvfAU6cjzGshsLj8tlkWWaaI2PqS1jZokKeroz3ikn8CkyfXq+4WABPu28BLP3PwQRA1bLVcmc0+1l+hFbmay/6K/2e8x9bd2vfuodTP/dShCNXKhRJRkpzKNP62DWcpinYK/c/z0ExP3rClK8AAAAASUVORK5CYII=",Ue="./static/png/arthas-bcfffb2d.png";const $e={class:"flex flex-col h-[100vh] w-[100vw] resize-none"},Ne={key:0,class:"navbar bg-base-100 md:flex-row flex-col w-[100vw]"},ze={class:"navbar-start"},je={class:"dropdown dropdown-start 2xl:hidden"},Ke={tabindex:"0",class:"btn btn-ghost btn-sm"},qe=xe('',1),Ge={href:"https://github.com/alibaba/arthas",target:"_blank",title:"",class:"mr-2 w-20"},Ve=["src"],Xe=xe('',1),Ye={class:"navbar-center"},Je={class:"input-group input-group-sm mr-2"},Ze=G("span",null,"IP",-1),Qe={class:"input-group input-group-sm mr-2"},et=G("span",null,"Port",-1),tt={key:0,class:"input-group input-group-sm mr-2"},it=G("span",null,"AgentId",-1),st={class:"navbar-end"},rt=["onClick"],nt=["href"],ot=G("div",{class:"w-full h-0 flex-auto bg-black overscroll-auto",id:"terminal-card"},[G("div",{id:"terminal",class:"w-full h-full"})],-1),at={key:1,title:"fullscreen",id:"fullSc",class:"fullSc"},ht=["src"],lt=Te({__name:"Console",props:{isTunnel:{type:Boolean,required:!1,default:!1},isNativeAgent:{type:Boolean,required:!1,default:!1}},setup(X){let z,ee=-1;const J=1e3,j=9999999,se=1,D=X.isTunnel?"7777":"8563",r=ae(""),h=ae(""),o=ae(!0),d=ae(!0),c=ae(""),_=ae(""),l=Ie(()=>X.isTunnel?`proxy/${c.value}/arthas-output/`:"/arthas-output/"),a=new Ae.exports.FitAddon,i=new De.exports.WebglAddon;let e=new Se.exports.Terminal({allowProposedApi:!0});Pe(()=>{var w,p,S,L;r.value=(w=n("ip"))!=null?w:window.location.hostname,h.value=(p=n("port"))!=null?p:D,X.isTunnel&&(c.value=(S=n("agentId"))!=null?S:""),X.isNativeAgent&&(_.value=(L=n("nativeAgentAddress"))!=null?L:"");let y=n("iframe");y&&y.trim()!=="false"&&(o.value=!1),C(!0),window.addEventListener("resize",function(){if(z!=null){const{cols:E,rows:A}=a.proposeDimensions();z.send(JSON.stringify({action:"resize",cols:E,rows:A})),a.fit()}})});function n(y){return new URLSearchParams(window.location.search).get(y)}function t(){var E;const y=`${r.value}:${h.value}`;if(X.isNativeAgent)return`ws://${y}/ws?nativeAgentAddress=${_.value}`;if(!X.isTunnel)return`ws://${y}/ws`;const w=(E=n("path"))!=null?E:"ws",p=n("targetServer"),L=`${location.protocol==="https:"?"wss://":"ws://"}${y}/${encodeURIComponent(w)}?method=connectArthas&id=${c.value}`;return p!=null?L+"&targetServer="+encodeURIComponent(p):L}function s(y){let w=t();z=new WebSocket(w),z.onerror=function(){z!=null||z.close(),z=void 0,!y&&alert("Connect error")},z.onopen=function(){var E;d.value=!0;let p=(E=n("scrollback"))!=null?E:"0";const{cols:S,rows:L}=f(p);e.onData(function(A){z==null||z.send(JSON.stringify({action:"read",data:A}))}),z.onmessage=function(A){if(A.type==="message"){var k=A.data;e.write(k)}},z==null||z.send(JSON.stringify({action:"resize",cols:S,rows:L})),ee=window.setInterval(function(){z!=null&&z.readyState===1&&z.send(JSON.stringify({action:"read",data:""}))},3e4)},z.onclose=function(p){ee!=-1&&(window.clearInterval(ee),ee=-1),p.code===2e3&&alert(p.reason)}}function f(y){let w=parseInt(y,10);return e=new Se.exports.Terminal({screenReaderMode:!1,convertEol:!0,allowProposedApi:!0,scrollback:v(w)?w:J}),e.loadAddon(a),e.open(document.getElementById("terminal")),e.loadAddon(i),a.fit(),{cols:e.cols,rows:e.rows}}function v(y){return y>=se&&y<=j}const u=y=>r.value.trim()===""||h.value.trim()===""?(alert("Ip or port can not be empty"),!1):X.isTunnel&&c.value==""?(y||alert("AgentId can not be empty"),!1):z?(alert("Already connected"),!1):!0;function C(y=!1){u(y)&&s(y)}function g(){try{z.close(),z.onmessage=null,z.onclose=null,z=void 0,e.dispose(),a.dispose(),i.dispose(),d.value=!1,alert("Connection was closed successfully!")}catch{alert("No connection, please start connect first.")}}function m(){var y=document.getElementById("terminal-card");b(y),y.onfullscreenchange=w=>{a.fit()}}function b(y){let w=y.requestFullscreen;if(w)w.call(y);else if(window.ActiveXObject){var p=new ActiveXObject("WScript.Shell");p!==null&&p.SendKeys("{F11}")}}return(y,w)=>(ce(),ue("div",$e,[o.value?(ce(),ue("nav",Ne,[G("div",ze,[G("div",je,[G("label",Ke,[Ee(fe(Fe),{class:"w-6 h-6"})]),qe]),G("a",Ge,[G("img",{src:fe(Ue),alt:"Arthas",title:"Welcome to Arthas web console"},null,8,Ve)]),Xe]),G("div",Ye,[G("div",{class:ye(["xl:flex-row form-control",{"xl:flex-row":X.isTunnel,"lg:flex-row":!X.isTunnel}])},[G("label",Je,[Ze,pe(G("input",{type:"text",placeholder:"please enter ip address",class:"input input-bordered input-sm","onUpdate:modelValue":w[0]||(w[0]=p=>r.value=p)},null,512),[[me,r.value]])]),G("label",Qe,[et,pe(G("input",{type:"text",placeholder:"please enter port",class:"input input-sm input-bordered","onUpdate:modelValue":w[1]||(w[1]=p=>h.value=p)},null,512),[[me,h.value]])]),X.isTunnel?(ce(),ue("label",tt,[it,pe(G("input",{type:"text",placeholder:"please enter AgentId",class:"input input-sm input-bordered","onUpdate:modelValue":w[2]||(w[2]=p=>c.value=p)},null,512),[[me,c.value]])])):Ce("v-if",!0)],2)]),G("div",st,[G("div",{class:ye(["btn-group 2xl:btn-group-horizontal btn-group-horizontal",{"md:btn-group-vertical":X.isTunnel}])},[G("button",{class:"btn btn-sm bg-secondary hover:bg-secondary-focus border-none text-secondary-content focus:bg-secondary-focus normal-case",onClick:w[3]||(w[3]=Le(p=>C(!0),["prevent"]))},"Connect"),G("button",{class:"btn btn-sm bg-secondary hover:bg-secondary-focus border-none text-secondary-content focus:bg-secondary-focus normal-case",onClick:Le(g,["prevent"])},"Disconnect",8,rt),G("a",{class:"btn btn-sm bg-secondary hover:bg-secondary-focus border-none text-secondary-content focus:bg-secondary-focus normal-case",href:fe(l),target:"_blank"},"Arthas Output",8,nt)],2)])])):Ce("v-if",!0),ot,d.value?(ce(),ue("div",at,[G("button",{id:"fullScBtn",onClick:m},[G("img",{src:fe(We)},null,8,ht)])])):Ce("v-if",!0)]))}});var ct=Be(lt,[["__file","D:/code/java/read/arthas/web-ui/arthasWebConsole/all/share/component/Console.vue"]]);const dt=Oe(He(ct,{isNativeAgent:!0}));dt.mount("#app"); diff --git a/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/main-38ee3337.js b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/main-38ee3337.js new file mode 100644 index 00000000000..01119b49848 --- /dev/null +++ b/labs/cluster-management/native-agent-management-web/src/main/resources/native-agent/static/js/main-38ee3337.js @@ -0,0 +1,5 @@ +const Yr=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))o(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const i of s.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&o(i)}).observe(document,{childList:!0,subtree:!0});function n(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerpolicy&&(s.referrerPolicy=r.referrerpolicy),r.crossorigin==="use-credentials"?s.credentials="include":r.crossorigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function o(r){if(r.ep)return;r.ep=!0;const s=n(r);fetch(r.href,s)}};Yr();function Me(e,t){const n=Object.create(null),o=e.split(",");for(let r=0;r!!n[r.toLowerCase()]:r=>!!n[r]}function Rn(e){if(M(e)){const t={};for(let n=0;n{if(n){const o=n.split(Zr);o.length>1&&(t[o[0].trim()]=o[1].trim())}}),t}function Sn(e){let t="";if(U(e))t=e;else if(M(e))for(let n=0;nU(e)?e:e==null?"":M(e)||H(e)&&(e.toString===Bo||!N(e.toString))?JSON.stringify(e,Do,2):String(e),Do=(e,t)=>t&&t.__v_isRef?Do(e,t.value):Ne(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((n,[o,r])=>(n[`${o} =>`]=r,n),{})}:ko(t)?{[`Set(${t.size})`]:[...t.values()]}:H(t)&&!M(t)&&!Ko(t)?String(t):t,L=Object.freeze({}),Ze=Object.freeze([]),Ue=()=>{},Ho=()=>!1,is=/^on[^a-z]/,xt=e=>is.test(e),Dt=e=>e.startsWith("onUpdate:"),B=Object.assign,ls=(e,t)=>{const n=e.indexOf(t);n>-1&&e.splice(n,1)},cs=Object.prototype.hasOwnProperty,P=(e,t)=>cs.call(e,t),M=Array.isArray,Ne=e=>qt(e)==="[object Map]",ko=e=>qt(e)==="[object Set]",N=e=>typeof e=="function",U=e=>typeof e=="string",Nn=e=>typeof e=="symbol",H=e=>e!==null&&typeof e=="object",Uo=e=>H(e)&&N(e.then)&&N(e.catch),Bo=Object.prototype.toString,qt=e=>Bo.call(e),jn=e=>qt(e).slice(8,-1),Ko=e=>qt(e)==="[object Object]",Ln=e=>U(e)&&e!=="NaN"&&e[0]!=="-"&&""+parseInt(e,10)===e,At=Me(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),fs=Me("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),zt=e=>{const t=Object.create(null);return n=>t[n]||(t[n]=e(n))},us=/-(\w)/g,Ge=zt(e=>e.replace(us,(t,n)=>n?n.toUpperCase():"")),as=/\B([A-Z])/g,Ce=zt(e=>e.replace(as,"-$1").toLowerCase()),Dn=zt(e=>e.charAt(0).toUpperCase()+e.slice(1)),Ae=zt(e=>e?`on${Dn(e)}`:""),Hn=(e,t)=>!Object.is(e,t),ze=(e,t)=>{for(let n=0;n{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,value:n})},kt=e=>{const t=parseFloat(e);return isNaN(t)?e:t};let so;const Vo=()=>so||(so=typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});function bn(e,...t){}let ce;class ds{constructor(t=!1){this.detached=t,this.active=!0,this.effects=[],this.cleanups=[],this.parent=ce,!t&&ce&&(this.index=(ce.scopes||(ce.scopes=[])).push(this)-1)}run(t){if(this.active){const n=ce;try{return ce=this,t()}finally{ce=n}}else bn("cannot run an inactive effect scope.")}on(){ce=this}off(){ce=this.parent}stop(t){if(this.active){let n,o;for(n=0,o=this.effects.length;n{const t=new Set(e);return t.w=0,t.n=0,t},Wo=e=>(e.w&Ee)>0,qo=e=>(e.n&Ee)>0,hs=({deps:e})=>{if(e.length)for(let t=0;t{const{deps:t}=e;if(t.length){let n=0;for(let o=0;o{(d==="length"||d>=p)&&c.push(b)})}else switch(n!==void 0&&c.push(i.get(n)),t){case"add":M(e)?Ln(n)&&c.push(i.get("length")):(c.push(i.get(je)),Ne(e)&&c.push(i.get(wn)));break;case"delete":M(e)||(c.push(i.get(je)),Ne(e)&&c.push(i.get(wn)));break;case"set":Ne(e)&&c.push(i.get(je));break}const u={target:e,type:t,key:n,newValue:o,oldValue:r,oldTarget:s};if(c.length===1)c[0]&&xn(c[0],u);else{const p=[];for(const b of c)b&&p.push(...b);xn(kn(p),u)}}function xn(e,t){const n=M(e)?e:[...e];for(const o of n)o.computed&&lo(o,t);for(const o of n)o.computed||lo(o,t)}function lo(e,t){(e!==z||e.allowRecurse)&&(e.onTrigger&&e.onTrigger(B({effect:e},t)),e.scheduler?e.scheduler():e.run())}const gs=Me("__proto__,__v_isRef,__isVue"),Xo=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!=="arguments"&&e!=="caller").map(e=>Symbol[e]).filter(Nn)),bs=Jt(),_s=Jt(!1,!0),ys=Jt(!0),ws=Jt(!0,!0),co=xs();function xs(){const e={};return["includes","indexOf","lastIndexOf"].forEach(t=>{e[t]=function(...n){const o=F(this);for(let s=0,i=this.length;s{e[t]=function(...n){et();const o=F(this)[t].apply(this,n);return tt(),o}}),e}function Jt(e=!1,t=!1){return function(o,r,s){if(r==="__v_isReactive")return!e;if(r==="__v_isReadonly")return e;if(r==="__v_isShallow")return t;if(r==="__v_raw"&&s===(e?t?rr:or:t?nr:tr).get(o))return o;const i=M(o);if(!e&&i&&P(co,r))return Reflect.get(co,r,s);const c=Reflect.get(o,r,s);return(Nn(r)?Xo.has(r):gs(r))||(e||Q(o,"get",r),t)?c:J(c)?i&&Ln(r)?c:c.value:H(c)?e?ir(c):sr(c):c}}const vs=Zo(),Os=Zo(!0);function Zo(e=!1){return function(n,o,r,s){let i=n[o];if($e(i)&&J(i)&&!J(r))return!1;if(!e&&(!lr(r)&&!$e(r)&&(i=F(i),r=F(r)),!M(n)&&J(i)&&!J(r)))return i.value=r,!0;const c=M(n)&&Ln(o)?Number(o)e,Yt=e=>Reflect.getPrototypeOf(e);function $t(e,t,n=!1,o=!1){e=e.__v_raw;const r=F(e),s=F(t);n||(t!==s&&Q(r,"get",t),Q(r,"get",s));const{has:i}=Yt(r),c=o?Un:n?Bn:gt;if(i.call(r,t))return c(e.get(t));if(i.call(r,s))return c(e.get(s));e!==r&&e.get(t)}function It(e,t=!1){const n=this.__v_raw,o=F(n),r=F(e);return t||(e!==r&&Q(o,"has",e),Q(o,"has",r)),e===r?n.has(e):n.has(e)||n.has(r)}function Mt(e,t=!1){return e=e.__v_raw,!t&&Q(F(e),"iterate",je),Reflect.get(e,"size",e)}function fo(e){e=F(e);const t=F(this);return Yt(t).has.call(t,e)||(t.add(e),be(t,"add",e,e)),this}function uo(e,t){t=F(t);const n=F(this),{has:o,get:r}=Yt(n);let s=o.call(n,e);s?er(n,o,e):(e=F(e),s=o.call(n,e));const i=r.call(n,e);return n.set(e,t),s?Hn(t,i)&&be(n,"set",e,t,i):be(n,"add",e,t),this}function ao(e){const t=F(this),{has:n,get:o}=Yt(t);let r=n.call(t,e);r?er(t,n,e):(e=F(e),r=n.call(t,e));const s=o?o.call(t,e):void 0,i=t.delete(e);return r&&be(t,"delete",e,void 0,s),i}function po(){const e=F(this),t=e.size!==0,n=Ne(e)?new Map(e):new Set(e),o=e.clear();return t&&be(e,"clear",void 0,void 0,n),o}function Ft(e,t){return function(o,r){const s=this,i=s.__v_raw,c=F(i),u=t?Un:e?Bn:gt;return!e&&Q(c,"iterate",je),i.forEach((p,b)=>o.call(r,u(p),u(b),s))}}function Pt(e,t,n){return function(...o){const r=this.__v_raw,s=F(r),i=Ne(s),c=e==="entries"||e===Symbol.iterator&&i,u=e==="keys"&&i,p=r[e](...o),b=n?Un:t?Bn:gt;return!t&&Q(s,"iterate",u?wn:je),{next(){const{value:d,done:x}=p.next();return x?{value:d,done:x}:{value:c?[b(d[0]),b(d[1])]:b(d),done:x}},[Symbol.iterator](){return this}}}}function we(e){return function(...t){{const n=t[0]?`on key "${t[0]}" `:""}return e==="delete"?!1:this}}function Ms(){const e={get(s){return $t(this,s)},get size(){return Mt(this)},has:It,add:fo,set:uo,delete:ao,clear:po,forEach:Ft(!1,!1)},t={get(s){return $t(this,s,!1,!0)},get size(){return Mt(this)},has:It,add:fo,set:uo,delete:ao,clear:po,forEach:Ft(!1,!0)},n={get(s){return $t(this,s,!0)},get size(){return Mt(this,!0)},has(s){return It.call(this,s,!0)},add:we("add"),set:we("set"),delete:we("delete"),clear:we("clear"),forEach:Ft(!0,!1)},o={get(s){return $t(this,s,!0,!0)},get size(){return Mt(this,!0)},has(s){return It.call(this,s,!0)},add:we("add"),set:we("set"),delete:we("delete"),clear:we("clear"),forEach:Ft(!0,!0)};return["keys","values","entries",Symbol.iterator].forEach(s=>{e[s]=Pt(s,!1,!1),n[s]=Pt(s,!0,!1),t[s]=Pt(s,!1,!0),o[s]=Pt(s,!0,!0)}),[e,n,t,o]}const[Fs,Ps,As,Rs]=Ms();function Xt(e,t){const n=t?e?Rs:As:e?Ps:Fs;return(o,r,s)=>r==="__v_isReactive"?!e:r==="__v_isReadonly"?e:r==="__v_raw"?o:Reflect.get(P(n,r)&&r in o?n:o,r,s)}const Ss={get:Xt(!1,!1)},Ns={get:Xt(!1,!0)},js={get:Xt(!0,!1)},Ls={get:Xt(!0,!0)};function er(e,t,n){const o=F(n);if(o!==n&&t.call(e,o)){const r=jn(e)}}const tr=new WeakMap,nr=new WeakMap,or=new WeakMap,rr=new WeakMap;function Ds(e){switch(e){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function Hs(e){return e.__v_skip||!Object.isExtensible(e)?0:Ds(jn(e))}function sr(e){return $e(e)?e:Zt(e,!1,Qo,Ss,tr)}function ks(e){return Zt(e,!1,$s,Ns,nr)}function ir(e){return Zt(e,!0,Go,js,or)}function Xe(e){return Zt(e,!0,Is,Ls,rr)}function Zt(e,t,n,o,r){if(!H(e)||e.__v_raw&&!(t&&e.__v_isReactive))return e;const s=r.get(e);if(s)return s;const i=Hs(e);if(i===0)return e;const c=new Proxy(e,i===2?o:n);return r.set(e,c),c}function Qt(e){return $e(e)?Qt(e.__v_raw):!!(e&&e.__v_isReactive)}function $e(e){return!!(e&&e.__v_isReadonly)}function lr(e){return!!(e&&e.__v_isShallow)}function vn(e){return Qt(e)||$e(e)}function F(e){const t=e&&e.__v_raw;return t?F(t):e}function cr(e){return Ht(e,"__v_skip",!0),e}const gt=e=>H(e)?sr(e):e,Bn=e=>H(e)?ir(e):e;function fr(e){Te&&z&&(e=F(e),Yo(e.dep||(e.dep=kn()),{target:e,type:"get",key:"value"}))}function ur(e,t){e=F(e),e.dep&&xn(e.dep,{target:e,type:"set",key:"value",newValue:t})}function J(e){return!!(e&&e.__v_isRef===!0)}function zl(e){return Us(e,!1)}function Us(e,t){return J(e)?e:new Bs(e,t)}class Bs{constructor(t,n){this.__v_isShallow=n,this.dep=void 0,this.__v_isRef=!0,this._rawValue=n?t:F(t),this._value=n?t:gt(t)}get value(){return fr(this),this._value}set value(t){const n=this.__v_isShallow||lr(t)||$e(t);t=n?t:F(t),Hn(t,this._rawValue)&&(this._rawValue=t,this._value=n?t:gt(t),ur(this,t))}}function Ks(e){return J(e)?e.value:e}const Vs={get:(e,t,n)=>Ks(Reflect.get(e,t,n)),set:(e,t,n,o)=>{const r=e[t];return J(r)&&!J(n)?(r.value=n,!0):Reflect.set(e,t,n,o)}};function ar(e){return Qt(e)?e:new Proxy(e,Vs)}var dr;class Ws{constructor(t,n,o,r){this._setter=n,this.dep=void 0,this.__v_isRef=!0,this[dr]=!1,this._dirty=!0,this.effect=new zo(t,()=>{this._dirty||(this._dirty=!0,ur(this))}),this.effect.computed=this,this.effect.active=this._cacheable=!r,this.__v_isReadonly=o}get value(){const t=F(this);return fr(t),(t._dirty||!t._cacheable)&&(t._dirty=!1,t._value=t.effect.run()),t._value}set value(t){this._setter(t)}}dr="__v_isReadonly";function qs(e,t,n=!1){let o,r;const s=N(e);s?(o=e,r=()=>{}):(o=e.get,r=e.set);const i=new Ws(o,r,s||!r,n);return t&&!n&&(i.effect.onTrack=t.onTrack,i.effect.onTrigger=t.onTrigger),i}const Le=[];function Rt(e){Le.push(e)}function St(){Le.pop()}function O(e,...t){et();const n=Le.length?Le[Le.length-1].component:null,o=n&&n.appContext.config.warnHandler,r=zs();if(o)nt(o,n,11,[e+t.join(""),n&&n.proxy,r.map(({vnode:s})=>`at <${on(n,s.type)}>`).join(` +`),r]);else{const s=[`[Vue warn]: ${e}`,...t];r.length&&s.push(` +`,...Js(r))}tt()}function zs(){let e=Le[Le.length-1];if(!e)return[];const t=[];for(;e;){const n=t[0];n&&n.vnode===e?n.recurseCount++:t.push({vnode:e,recurseCount:0});const o=e.component&&e.component.parent;e=o&&o.vnode}return t}function Js(e){const t=[];return e.forEach((n,o)=>{t.push(...o===0?[]:[` +`],...Ys(n))}),t}function Ys({vnode:e,recurseCount:t}){const n=t>0?`... (${t} recursive calls)`:"",o=e.component?e.component.parent==null:!1,r=` at <${on(e.component,e.type,o)}`,s=">"+n;return e.props?[r,...Xs(e.props),s]:[r+s]}function Xs(e){const t=[],n=Object.keys(e);return n.slice(0,3).forEach(o=>{t.push(...pr(o,e[o]))}),n.length>3&&t.push(" ..."),t}function pr(e,t,n){return U(t)?(t=JSON.stringify(t),n?t:[`${e}=${t}`]):typeof t=="number"||typeof t=="boolean"||t==null?n?t:[`${e}=${t}`]:J(t)?(t=pr(e,F(t.value),!0),n?t:[`${e}=Ref<`,t,">"]):N(t)?[`${e}=fn${t.name?`<${t.name}>`:""}`]:(t=F(t),n?t:[`${e}=`,t])}const Kn={sp:"serverPrefetch hook",bc:"beforeCreate hook",c:"created hook",bm:"beforeMount hook",m:"mounted hook",bu:"beforeUpdate hook",u:"updated",bum:"beforeUnmount hook",um:"unmounted hook",a:"activated hook",da:"deactivated hook",ec:"errorCaptured hook",rtc:"renderTracked hook",rtg:"renderTriggered hook",[0]:"setup function",[1]:"render function",[2]:"watcher getter",[3]:"watcher callback",[4]:"watcher cleanup function",[5]:"native event handler",[6]:"component event handler",[7]:"vnode hook",[8]:"directive hook",[9]:"transition hook",[10]:"app errorHandler",[11]:"app warnHandler",[12]:"ref function",[13]:"async component loader",[14]:"scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core"};function nt(e,t,n,o){let r;try{r=o?e(...o):e()}catch(s){Gt(s,t,n)}return r}function Be(e,t,n,o){if(N(e)){const s=nt(e,t,n,o);return s&&Uo(s)&&s.catch(i=>{Gt(i,t,n)}),s}const r=[];for(let s=0;s>>1;_t(V[o])ae&&V.splice(t,1)}function gr(e){M(e)?Qe.push(...e):(!fe||!fe.includes(e,e.allowRecurse?xe+1:xe))&&Qe.push(e),mr()}function ho(e,t=bt?ae+1:0){for(e=e||new Map;t_t(n)-_t(o)),xe=0;xee.id==null?1/0:e.id,ni=(e,t)=>{const n=_t(e)-_t(t);if(n===0){if(e.pre&&!t.pre)return-1;if(t.pre&&!e.pre)return 1}return n};function _r(e){On=!1,bt=!0,e=e||new Map,V.sort(ni);const t=n=>qn(e,n);try{for(ae=0;aeQs){const o=t.ownerInstance,r=o&&Ur(o.type);return O(`Maximum recursive updates exceeded${r?` in component <${r}>`:""}. This means you have a reactive effect that is mutating its own dependencies and thus recursively triggering itself. Possible sources include component template, render function, updated hook or watcher source function.`),!0}else e.set(t,n+1)}}let De=!1;const Je=new Set;Vo().__VUE_HMR_RUNTIME__={createRecord:an(yr),rerender:an(si),reload:an(ii)};const Ke=new Map;function oi(e){const t=e.type.__hmrId;let n=Ke.get(t);n||(yr(t,e.type),n=Ke.get(t)),n.instances.add(e)}function ri(e){Ke.get(e.type.__hmrId).instances.delete(e)}function yr(e,t){return Ke.has(e)?!1:(Ke.set(e,{initialDef:dt(t),instances:new Set}),!0)}function dt(e){return Br(e)?e.__vccOpts:e}function si(e,t){const n=Ke.get(e);!n||(n.initialDef.render=t,[...n.instances].forEach(o=>{t&&(o.render=t,dt(o.type).render=t),o.renderCache=[],De=!0,o.update(),De=!1}))}function ii(e,t){const n=Ke.get(e);if(!n)return;t=dt(t),mo(n.initialDef,t);const o=[...n.instances];for(const r of o){const s=dt(r.type);Je.has(s)||(s!==n.initialDef&&mo(s,t),Je.add(s)),r.appContext.optionsCache.delete(r.type),r.ceReload?(Je.add(s),r.ceReload(t.styles),Je.delete(s)):r.parent?Wn(r.parent.update):r.appContext.reload?r.appContext.reload():typeof window!="undefined"&&window.location.reload()}gr(()=>{for(const r of o)Je.delete(dt(r.type))})}function mo(e,t){B(e,t);for(const n in e)n!=="__file"&&!(n in t)&&delete e[n]}function an(e){return(t,n)=>{try{return e(t,n)}catch{}}}let de,ut=[],Tn=!1;function vt(e,...t){de?de.emit(e,...t):Tn||ut.push({event:e,args:t})}function wr(e,t){var n,o;de=e,de?(de.enabled=!0,ut.forEach(({event:r,args:s})=>de.emit(r,...s)),ut=[]):typeof window!="undefined"&&window.HTMLElement&&!(!((o=(n=window.navigator)===null||n===void 0?void 0:n.userAgent)===null||o===void 0)&&o.includes("jsdom"))?((t.__VUE_DEVTOOLS_HOOK_REPLAY__=t.__VUE_DEVTOOLS_HOOK_REPLAY__||[]).push(s=>{wr(s,t)}),setTimeout(()=>{de||(t.__VUE_DEVTOOLS_HOOK_REPLAY__=null,Tn=!0,ut=[])},3e3)):(Tn=!0,ut=[])}function li(e,t){vt("app:init",e,t,{Fragment:ue,Text:Ot,Comment:Z,Static:pt})}function ci(e){vt("app:unmount",e)}const fi=zn("component:added"),xr=zn("component:updated"),ui=zn("component:removed"),ai=e=>{de&&typeof de.cleanupBuffer=="function"&&!de.cleanupBuffer(e)&&ui(e)};function zn(e){return t=>{vt(e,t.appContext.app,t.uid,t.parent?t.parent.uid:void 0,t)}}const di=vr("perf:start"),pi=vr("perf:end");function vr(e){return(t,n,o)=>{vt(e,t.appContext.app,t.uid,t,n,o)}}function hi(e,t,n){vt("component:emit",e.appContext.app,e,t,n)}function mi(e,t,...n){if(e.isUnmounted)return;const o=e.vnode.props||L;{const{emitsOptions:b,propsOptions:[d]}=e;if(b)if(!(t in b))(!d||!(Ae(t)in d))&&O(`Component emitted event "${t}" but it is neither declared in the emits option nor as an "${Ae(t)}" prop.`);else{const x=b[t];N(x)&&(x(...n)||O(`Invalid event arguments: event validation failed for event "${t}".`))}}let r=n;const s=t.startsWith("update:"),i=s&&t.slice(7);if(i&&i in o){const b=`${i==="modelValue"?"model":i}Modifiers`,{number:d,trim:x}=o[b]||L;x&&(r=n.map(I=>U(I)?I.trim():I)),d&&(r=n.map(kt))}hi(e,t,r);{const b=t.toLowerCase();b!==t&&o[Ae(b)]&&O(`Event "${b}" is emitted in component ${on(e,e.type)} but the handler is registered for "${t}". Note that HTML attributes are case-insensitive and you cannot use v-on to listen to camelCase events when using in-DOM templates. You should probably use "${Ce(t)}" instead of "${t}".`)}let c,u=o[c=Ae(t)]||o[c=Ae(Ge(t))];!u&&s&&(u=o[c=Ae(Ce(t))]),u&&Be(u,e,6,r);const p=o[c+"Once"];if(p){if(!e.emitted)e.emitted={};else if(e.emitted[c])return;e.emitted[c]=!0,Be(p,e,6,r)}}function gi(e,t,n=!1){const o=t.emitsCache,r=o.get(e);if(r!==void 0)return r;const s=e.emits;let i={};return!s&&!!1?(H(e)&&o.set(e,null),null):(M(s)?s.forEach(u=>i[u]=null):B(i,s),H(e)&&o.set(e,i),i)}function en(e,t){return!e||!xt(t)?!1:(t=t.slice(2).replace(/Once$/,""),P(e,t[0].toLowerCase()+t.slice(1))||P(e,Ce(t))||P(e,t))}let ee=null,Or=null;function Ut(e){const t=ee;return ee=e,Or=e&&e.type.__scopeId||null,t}function bi(e,t=ee,n){if(!t||e._n)return e;const o=(...r)=>{o._d&&Co(-1);const s=Ut(t);let i;try{i=e(...r)}finally{Ut(s),o._d&&Co(1)}return xr(t),i};return o._n=!0,o._c=!0,o._d=!0,o}let Cn=!1;function Bt(){Cn=!0}function dn(e){const{type:t,vnode:n,proxy:o,withProxy:r,props:s,propsOptions:[i],slots:c,attrs:u,emit:p,render:b,renderCache:d,data:x,setupState:I,ctx:D,inheritAttrs:R}=e;let te,se;const rn=Ut(e);Cn=!1;try{if(n.shapeFlag&4){const Y=r||o;te=oe(b.call(Y,Y,d,s,I,x,D)),se=u}else{const Y=t;u===s&&Bt(),te=oe(Y.length>1?Y(s,{get attrs(){return Bt(),u},slots:c,emit:p}):Y(s,null)),se=t.props?u:yi(u)}}catch(Y){ht.length=0,Gt(Y,e,1),te=X(Z)}let K=te,ot;if(te.patchFlag>0&&te.patchFlag&2048&&([K,ot]=_i(te)),se&&R!==!1){const Y=Object.keys(se),{shapeFlag:sn}=K;if(Y.length){if(sn&7)i&&Y.some(Dt)&&(se=wi(se,i)),K=Ie(K,se);else if(!Cn&&K.type!==Z){const Tt=Object.keys(u),Ve=[],pe=[];for(let rt=0,st=Tt.length;rt renders non-element root node that cannot be animated."),K.transition=n.transition),ot?ot(K):te=K,Ut(rn),te}const _i=e=>{const t=e.children,n=e.dynamicChildren,o=Tr(t);if(!o)return[e,void 0];const r=t.indexOf(o),s=n?n.indexOf(o):-1,i=c=>{t[r]=c,n&&(s>-1?n[s]=c:c.patchFlag>0&&(e.dynamicChildren=[...n,c]))};return[oe(o),i]};function Tr(e){let t;for(let n=0;n{let t;for(const n in e)(n==="class"||n==="style"||xt(n))&&((t||(t={}))[n]=e[n]);return t},wi=(e,t)=>{const n={};for(const o in e)(!Dt(o)||!(o.slice(9)in t))&&(n[o]=e[o]);return n},go=e=>e.shapeFlag&7||e.type===Z;function xi(e,t,n){const{props:o,children:r,component:s}=e,{props:i,children:c,patchFlag:u}=t,p=s.emitsOptions;if((r||c)&&De||t.dirs||t.transition)return!0;if(n&&u>=0){if(u&1024)return!0;if(u&16)return o?bo(o,i,p):!!i;if(u&8){const b=t.dynamicProps;for(let d=0;de.__isSuspense;function Ti(e,t){t&&t.pendingBranch?M(e)?t.effects.push(...e):t.effects.push(e):gr(e)}function at(e,t){if(!H(e)||e.__v_skip||(t=t||new Set,t.has(e)))return e;if(t.add(e),J(e))at(e.value,t);else if(M(e))for(let n=0;n{at(n,t)});else if(Ko(e))for(const n in e)at(e[n],t);return e}function Jl(e){return N(e)?{setup:e,name:e.name}:e}const Nt=e=>!!e.type.__asyncLoader,Cr=e=>e.type.__isKeepAlive;function Ci(e,t,n=ke,o=!1){if(n){const r=n[e]||(n[e]=[]),s=t.__weh||(t.__weh=(...i)=>{if(n.isUnmounted)return;et(),Xn(n);const c=Be(t,n,e,i);return mt(),tt(),c});return o?r.unshift(s):r.push(s),s}else{const r=Ae(Kn[e].replace(/ hook$/,""));O(`${r} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup(). If you are using async setup(), make sure to register lifecycle hooks before the first await statement.`)}}const Ei=e=>(t,n=ke)=>(!Wt||e==="sp")&&Ci(e,(...o)=>t(...o),n),Yl=Ei("m");function Er(e){fs(e)&&O("Do not use built-in directive ids as custom directive id: "+e)}function Xl(e,t){const n=ee;if(n===null)return O("withDirectives can only be used inside render functions."),e;const o=nn(n)||n.proxy,r=e.dirs||(e.dirs=[]);for(let s=0;st(i,c,void 0,s&&s[c]));else{const i=Object.keys(e);r=new Array(i.length);for(let c=0,u=i.length;ce?Hr(e)?nn(e)||e.proxy:En(e.parent):null,He=B(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>Xe(e.props),$attrs:e=>Xe(e.attrs),$slots:e=>Xe(e.slots),$refs:e=>Xe(e.refs),$parent:e=>En(e.parent),$root:e=>En(e.root),$emit:e=>e.emit,$options:e=>e.type,$forceUpdate:e=>e.f||(e.f=()=>Wn(e.update)),$nextTick:e=>e.n||(e.n=Gs.bind(e.proxy)),$watch:e=>Ue}),$r=e=>e==="_"||e==="$",pn=(e,t)=>e!==L&&!e.__isScriptSetup&&P(e,t),Ir={get({_:e},t){const{ctx:n,setupState:o,data:r,props:s,accessCache:i,type:c,appContext:u}=e;if(t==="__isVue")return!0;let p;if(t[0]!=="$"){const I=i[t];if(I!==void 0)switch(I){case 1:return o[t];case 2:return r[t];case 4:return n[t];case 3:return s[t]}else{if(pn(o,t))return i[t]=1,o[t];if(r!==L&&P(r,t))return i[t]=2,r[t];if((p=e.propsOptions[0])&&P(p,t))return i[t]=3,s[t];if(n!==L&&P(n,t))return i[t]=4,n[t];i[t]=0}}const b=He[t];let d,x;if(b)return t==="$attrs"&&(Q(e,"get",t),Bt()),b(e);if((d=c.__cssModules)&&(d=d[t]))return d;if(n!==L&&P(n,t))return i[t]=4,n[t];if(x=u.config.globalProperties,P(x,t))return x[t];ee&&(!U(t)||t.indexOf("__v")!==0)&&(r!==L&&$r(t[0])&&P(r,t)?O(`Property ${JSON.stringify(t)} must be accessed via $data because it starts with a reserved character ("$" or "_") and is not proxied on the render context.`):e===ee&&O(`Property ${JSON.stringify(t)} was accessed during render but is not defined on instance.`))},set({_:e},t,n){const{data:o,setupState:r,ctx:s}=e;return pn(r,t)?(r[t]=n,!0):r.__isScriptSetup&&P(r,t)?(O(`Cannot mutate + + + \ No newline at end of file diff --git a/web-ui/arthasWebConsole/all/native-agent/console.html b/web-ui/arthasWebConsole/all/native-agent/console.html new file mode 100644 index 00000000000..fd88087f014 --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/console.html @@ -0,0 +1,16 @@ + + + + + + + + Arthas Native Agent + + + +
+ + + + \ No newline at end of file diff --git a/web-ui/arthasWebConsole/all/native-agent/index.html b/web-ui/arthasWebConsole/all/native-agent/index.html new file mode 100644 index 00000000000..d5a2c23bcaf --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/index.html @@ -0,0 +1,16 @@ + + + + + + + + Arthas Native Agent + + + +
+ + + + \ No newline at end of file diff --git a/web-ui/arthasWebConsole/all/native-agent/processes.html b/web-ui/arthasWebConsole/all/native-agent/processes.html new file mode 100644 index 00000000000..1e67a6cacdb --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/processes.html @@ -0,0 +1,17 @@ + + + + + + + Arthas Native Agent + + + + +
+
+ + + + \ No newline at end of file diff --git a/web-ui/arthasWebConsole/all/native-agent/src/Agent.vue b/web-ui/arthasWebConsole/all/native-agent/src/Agent.vue new file mode 100644 index 00000000000..743a294fb64 --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/src/Agent.vue @@ -0,0 +1,54 @@ + + + \ No newline at end of file diff --git a/web-ui/arthasWebConsole/all/native-agent/src/Process.vue b/web-ui/arthasWebConsole/all/native-agent/src/Process.vue new file mode 100644 index 00000000000..b9bf6a79b17 --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/src/Process.vue @@ -0,0 +1,142 @@ + + + \ No newline at end of file diff --git a/web-ui/arthasWebConsole/all/native-agent/src/agents.ts b/web-ui/arthasWebConsole/all/native-agent/src/agents.ts new file mode 100644 index 00000000000..a94303218a8 --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/src/agents.ts @@ -0,0 +1,6 @@ +import { createApp } from "vue"; +import App from "./Agent.vue"; +const app = createApp(App); +import "~/main.css"; +app + .mount("#app"); diff --git a/web-ui/arthasWebConsole/all/native-agent/src/console.ts b/web-ui/arthasWebConsole/all/native-agent/src/console.ts new file mode 100644 index 00000000000..501d3ff8838 --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/src/console.ts @@ -0,0 +1,7 @@ +import { createApp, h } from "vue"; +import App from "~/component/Console.vue"; +const app = createApp(h(App, {isNativeAgent: true})) +import "xterm/css/xterm.css"; +import "~/main.css"; +app + .mount("#app"); diff --git a/web-ui/arthasWebConsole/all/native-agent/src/main.css b/web-ui/arthasWebConsole/all/native-agent/src/main.css new file mode 100644 index 00000000000..bd6213e1dfe --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/src/main.css @@ -0,0 +1,3 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; \ No newline at end of file diff --git a/web-ui/arthasWebConsole/all/native-agent/src/main.ts b/web-ui/arthasWebConsole/all/native-agent/src/main.ts new file mode 100644 index 00000000000..ff31d477ef6 --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/src/main.ts @@ -0,0 +1,9 @@ +import { createApp, h } from "vue"; +// import App from "~/component/Console.vue"; +import NativeAgnet from "./Agent.vue"; +// const app = createApp(h(App, { isTunnel: true })); +const app = createApp(h(NativeAgnet)) +import "xterm/css/xterm.css"; +import "~/main.css"; +app + .mount("#app"); diff --git a/web-ui/arthasWebConsole/all/native-agent/src/processes.ts b/web-ui/arthasWebConsole/all/native-agent/src/processes.ts new file mode 100644 index 00000000000..f8958217d5e --- /dev/null +++ b/web-ui/arthasWebConsole/all/native-agent/src/processes.ts @@ -0,0 +1,6 @@ +import { createApp } from "vue"; +import App from "./Process.vue"; +const app = createApp(App); +import "~/main.css"; +app + .mount("#app"); diff --git a/web-ui/arthasWebConsole/all/share/component/Console.vue b/web-ui/arthasWebConsole/all/share/component/Console.vue index a04ddcdb046..198398682e9 100644 --- a/web-ui/arthasWebConsole/all/share/component/Console.vue +++ b/web-ui/arthasWebConsole/all/share/component/Console.vue @@ -6,8 +6,9 @@ import { WebglAddon } from "xterm-addon-webgl" import { MenuAlt2Icon } from "@heroicons/vue/outline" import fullPic from "~/assert/fullsc.png" import arthasLogo from "~/assert/arthas.png" -const { isTunnel = false } = defineProps<{ +const { isTunnel = false, isNativeAgent = false} = defineProps<{ isTunnel?: boolean + isNativeAgent?: boolean }>() let ws: WebSocket | undefined; @@ -21,6 +22,7 @@ const port = ref('') const iframe = ref(true) const fullSc = ref(true) const agentID = ref('') +const nativeAgentAddress = ref('') const outputHerf = computed(() => { console.log(agentID.value) return isTunnel?`proxy/${agentID.value}/arthas-output/`:`/arthas-output/` @@ -33,6 +35,7 @@ let xterm = new Terminal({ allowProposedApi: true }) onMounted(() => { ip.value = getUrlParam('ip') ?? window.location.hostname; port.value = getUrlParam('port') ?? ARTHAS_PORT; + if (isNativeAgent) nativeAgentAddress.value = getUrlParam("nativeAgentAddress") ?? "" if (isTunnel) agentID.value = getUrlParam("agentId") ?? "" let _iframe = getUrlParam('iframe') if (_iframe && _iframe.trim() !== 'false') iframe.value = false @@ -55,6 +58,7 @@ function getUrlParam(name: string) { function getWsUri() { const host = `${ip.value}:${port.value}` + if (isNativeAgent) return `ws://${host}/ws?nativeAgentAddress=${nativeAgentAddress.value}`; if (!isTunnel) return `ws://${host}/ws`; const path = getUrlParam("path") ?? 'ws' const _targetServer = getUrlParam("targetServer") diff --git a/web-ui/arthasWebConsole/package.json b/web-ui/arthasWebConsole/package.json index 09fe3923f45..c83073e6999 100644 --- a/web-ui/arthasWebConsole/package.json +++ b/web-ui/arthasWebConsole/package.json @@ -3,9 +3,11 @@ "private": false, "version": "0.1.4", "scripts": { + "dev:native-agent": "vite --port 3939 --mode native-agent", "dev:tunnel": "vite --port 8000 --mode tunnel", "dev:ui": "vite --port 8000 --mode ui", "build": "vue-tsc --noEmit && vite build --mode tunnel && vite build --mode ui", + "build:native-agent": "vue-tsc --noEmit && vite build --mode native-agent", "build:tunnel": "vue-tsc --noEmit && vite build --mode tunnel", "build:ui": "vue-tsc --noEmit && vite build --mode ui", "preview:ui": "vite preview --mode ui", @@ -16,6 +18,7 @@ "@heroicons/vue": "^1.0.6", "@highlightjs/vue-plugin": "^2.1.0", "@xstate/vue": "^2.0.0", + "axios": "^1.7.7", "daisyui": "^2.31.0", "dayjs": "^1.11.6", "echarts": "^5.3.3", diff --git a/web-ui/arthasWebConsole/vite.config.ts b/web-ui/arthasWebConsole/vite.config.ts index 605d74daa28..7fd3a3d41c2 100644 --- a/web-ui/arthasWebConsole/vite.config.ts +++ b/web-ui/arthasWebConsole/vite.config.ts @@ -40,6 +40,22 @@ export default defineConfig(({ mode }) => { changeOrigin: true, }, }; + } else if (mode === "native-agent") { + outDir = path.resolve(__dirname, `dist/native-agent`); + root = "./all/native-agent"; + base = "./" + input = { + nativeAgent: path.resolve(__dirname, "all/native-agent/index.html"), + agents: path.resolve(__dirname, "all/native-agent/agents.html"), + processes: path.resolve(__dirname, "all/native-agent/processes.html"), + console: path.resolve(__dirname, "all/native-agent/console.html") + }; + proxy = { + "/api": { + target: `http://${proxyTarget}`, + changeOrigin: true, + }, + }; } return { diff --git a/web-ui/arthasWebConsole/yarn.lock b/web-ui/arthasWebConsole/yarn.lock index f9815dcf2c7..599bc03cc49 100644 --- a/web-ui/arthasWebConsole/yarn.lock +++ b/web-ui/arthasWebConsole/yarn.lock @@ -235,6 +235,11 @@ arg@^5.0.2: resolved "https://registry.npmmirror.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c" integrity sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg== +asynckit@^0.4.0: + version "0.4.0" + resolved "https://registry.npmmirror.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" + integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== + autoprefixer@^10.4.7: version "10.4.13" resolved "https://registry.npmmirror.com/autoprefixer/-/autoprefixer-10.4.13.tgz#b5136b59930209a321e9fa3dca2e7c4d223e83a8" @@ -247,6 +252,15 @@ autoprefixer@^10.4.7: picocolors "^1.0.0" postcss-value-parser "^4.2.0" +axios@^1.7.7: + version "1.7.7" + resolved "https://registry.npmmirror.com/axios/-/axios-1.7.7.tgz#2f554296f9892a72ac8d8e4c5b79c14a91d0a47f" + integrity sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q== + dependencies: + follow-redirects "^1.15.6" + form-data "^4.0.0" + proxy-from-env "^1.1.0" + balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.npmmirror.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -334,6 +348,13 @@ color@^4.2: color-convert "^2.0.1" color-string "^1.9.0" +combined-stream@^1.0.8: + version "1.0.8" + resolved "https://registry.npmmirror.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" + integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg== + dependencies: + delayed-stream "~1.0.0" + css-selector-tokenizer@^0.8.0: version "0.8.0" resolved "https://registry.npmmirror.com/css-selector-tokenizer/-/css-selector-tokenizer-0.8.0.tgz#88267ef6238e64f2215ea2764b3e2cf498b845dd" @@ -377,6 +398,11 @@ defined@^1.0.0: resolved "https://registry.npmmirror.com/defined/-/defined-1.0.1.tgz#c0b9db27bfaffd95d6f61399419b893df0f91ebf" integrity sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q== +delayed-stream@~1.0.0: + version "1.0.0" + resolved "https://registry.npmmirror.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" + integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== + detective@^5.2.1: version "5.2.1" resolved "https://registry.npmmirror.com/detective/-/detective-5.2.1.tgz#6af01eeda11015acb0e73f933242b70f24f91034" @@ -576,6 +602,20 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +follow-redirects@^1.15.6: + version "1.15.9" + resolved "https://registry.npmmirror.com/follow-redirects/-/follow-redirects-1.15.9.tgz#a604fa10e443bf98ca94228d9eebcc2e8a2c8ee1" + integrity sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ== + +form-data@^4.0.0: + version "4.0.1" + resolved "https://registry.npmmirror.com/form-data/-/form-data-4.0.1.tgz#ba1076daaaa5bfd7e99c1a6cb02aa0a5cff90d48" + integrity sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw== + dependencies: + asynckit "^0.4.0" + combined-stream "^1.0.8" + mime-types "^2.1.12" + fraction.js@^4.2.0: version "4.2.0" resolved "https://registry.npmmirror.com/fraction.js/-/fraction.js-4.2.0.tgz#448e5109a313a3527f5a3ab2119ec4cf0e0e2950" @@ -683,6 +723,18 @@ micromatch@^4.0.4, micromatch@^4.0.5: braces "^3.0.2" picomatch "^2.3.1" +mime-db@1.52.0: + version "1.52.0" + resolved "https://registry.npmmirror.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" + integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== + +mime-types@^2.1.12: + version "2.1.35" + resolved "https://registry.npmmirror.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" + integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== + dependencies: + mime-db "1.52.0" + minimatch@^5.1.0: version "5.1.0" resolved "https://registry.npmmirror.com/minimatch/-/minimatch-5.1.0.tgz#1717b464f4971b144f6aabe8f2d0b8e4511e09c7" @@ -806,6 +858,11 @@ postcss@^8.1.10, postcss@^8.4.13, postcss@^8.4.14, postcss@^8.4.18: picocolors "^1.0.0" source-map-js "^1.0.2" +proxy-from-env@^1.1.0: + version "1.1.0" + resolved "https://registry.npmmirror.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" + integrity sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg== + queue-microtask@^1.2.2: version "1.2.3" resolved "https://registry.npmmirror.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"